Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mdbnomics
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DBnomics
mdbnomics
Commits
96abce51
Commit
96abce51
authored
Mar 30, 2020
by
Dóra Kocsis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add scripts for GitLab testing
parent
930be7b1
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
247 additions
and
24 deletions
+247
-24
.gitignore
.gitignore
+2
-0
.gitlab-ci.yml
.gitlab-ci.yml
+11
-0
Makefile
Makefile
+15
-0
archive/run_all_tests_matlab.m
archive/run_all_tests_matlab.m
+0
-0
tests/runalltests.m
tests/runalltests.m
+63
-0
tests/test_fetch_series_by_api_link.m
tests/test_fetch_series_by_api_link.m
+13
-2
tests/test_fetch_series_by_code.m
tests/test_fetch_series_by_code.m
+13
-2
tests/test_fetch_series_by_code_mask.m
tests/test_fetch_series_by_code_mask.m
+13
-2
tests/test_fetch_series_by_code_mask_with_plus.m
tests/test_fetch_series_by_code_mask_with_plus.m
+13
-2
tests/test_fetch_series_by_dimension.m
tests/test_fetch_series_by_dimension.m
+13
-2
tests/test_fetch_series_by_id.m
tests/test_fetch_series_by_id.m
+13
-2
tests/test_fetch_series_by_ids_in_different_datasets.m
tests/test_fetch_series_by_ids_in_different_datasets.m
+13
-2
tests/test_fetch_series_by_ids_in_same_dataset.m
tests/test_fetch_series_by_ids_in_same_dataset.m
+13
-2
tests/test_fetch_series_of_dataset.m
tests/test_fetch_series_of_dataset.m
+13
-2
tests/test_fetch_series_with_filter_on_one_series.m
tests/test_fetch_series_with_filter_on_one_series.m
+13
-2
tests/test_fetch_series_with_max_nb_series.m
tests/test_fetch_series_with_max_nb_series.m
+13
-2
tests/test_fetch_series_with_na_values.m
tests/test_fetch_series_with_na_values.m
+13
-2
No files found.
.gitignore
View file @
96abce51
...
...
@@ -11,5 +11,7 @@
\#*\#
*.mat
*.asv
tests/git.info
tests/git.last-commit-hash
/missing_dbnomics
\ No newline at end of file
.gitlab-ci.yml
0 → 100644
View file @
96abce51
variables
:
GIT_SUBMODULE_STRATEGY
:
normal
TERM
:
linux
before_script
:
-
git clone https://git.dynare.org/Dynare/m-unit-tests
test_matlab
:
stage
:
test
script
:
-
make check-matlab
\ No newline at end of file
Makefile
0 → 100644
View file @
96abce51
OCTAVE
?=
octave-cli
MATLAB
?=
$(
shell
which matlab
)
all
:
check-matlab
m-unit-tests/src/mtest.m
:
git clone https://git.dynare.org/Dynare/m-unit-tests
check-matlab
:
m-unit-tests/src/mtest.m
@
$(MATLAB)
-nosplash
-nodisplay
-r
"addpath([pwd '/m-unit-tests/src']); cd tests; runalltests; quit"
&&
[
!
-f
./tests/failed
]
&&
[
-f
./tests/pass
]
check-clean
:
rm
-f
tests/
*
_test_
*
.m tests/
*
.csv tests/
*
.xls tests/
*
.xlsx tests/
*
.mat tests/failed tests/datafile_for_test
rm
-f
git.info git.last-commit-hash tests/pass tests/failed tests/
*
.spc
rm
-rf
m-unit-tests
tests
/run_all_tests_matlab.m
→
archive
/run_all_tests_matlab.m
View file @
96abce51
File moved
tests/runalltests.m
0 → 100644
View file @
96abce51
function
runalltests
()
% Copyright (C) 2020 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare dseries submodule is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
opath
=
path
();
system
(
'rm -f failed'
);
system
(
'rm -f pass'
);
% Check that the m-unit-tests module is available.
try
initialize_unit_tests_toolbox
;
catch
error
(
'Missing dependency: m-unit-tests module is not available.'
)
end
% Get path to the current script
unit_tests_root
=
strrep
(
which
(
'runalltests'
),
'runalltests.m'
,
''
);
% Initialize the mdbnomics module
try
initialize_mdbnomics
();
catch
addpath
([
unit_tests_root
'../src'
]);
initialize_mdbnomics
();
end
warning
off
if
isoctave
()
if
~
user_has_octave_forge_package
(
'io'
)
error
(
'Missing dependency: io package is not available.'
)
end
more
off
;
end
r
=
run_unitary_tests_in_directory
(
unit_tests_root
(
1
:
end
-
1
));
delete
(
'*.log'
);
if
any
(
~
[
r
{:,
3
}])
system
(
'touch failed'
);
else
system
(
'touch pass'
);
end
warning
on
path
(
opath
);
display_report
(
r
);
tests/test_fetch_series_by_api_link.m
View file @
96abce51
function test_fetch_series_by_api_link()
function
test_fetch_series_by_api_link
()
% --*-- Unitary tests --*--
df
=
fetch_series_by_api_link
(
"https://api.db.nomics.world/v22/series/BIS/long_pp?limit=1000&offset=0&q=&observations=1&align_periods=1&dimensions=%7B%7D"
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -14,4 +14,15 @@ assert(dataset_codes{1} == "long_pp");
idx
=
find
(
strcmp
(
'series_code'
,
df
(
1
,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
>
1
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_api_link();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_by_code.m
View file @
96abce51
function test_fetch_series_by_code()
function
test_fetch_series_by_code
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"AMECO"
,
'dataset_code'
,
"ZUTN"
,
'series_code'
,
"EA19.1.0.0.0.ZUTN"
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -15,4 +15,15 @@ idx = find(strcmp('series_code',df(1,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
==
1
);
assert
(
series_codes
{
1
}
==
"EA19.1.0.0.0.ZUTN"
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_code();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_by_code_mask.m
View file @
96abce51
function test_fetch_series_by_code_mask()
function
test_fetch_series_by_code_mask
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"IMF"
,
'dataset_code'
,
"CPI"
,
'series_code'
,
"M.FR+DE.PCPIEC_IX+PCPIA_IX"
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -14,4 +14,15 @@ assert(dataset_codes{1} == "CPI");
idx
=
find
(
strcmp
(
'series_code'
,
df
(
1
,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
==
4
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_code_mask();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_by_code_mask_with_plus
_in_dimension_code
.m
→
tests/test_fetch_series_by_code_mask_with_plus.m
View file @
96abce51
function test_fetch_series_by_code_mask_with_plus
_in_dimension_code()
function
test_fetch_series_by_code_mask_with_plus
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"SCB"
,
'dataset_code'
,
"AKIAM"
,
'series_code'
,
'"J+K"+"G+H".AM0301C1'
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -16,4 +16,15 @@ series_codes = unique(df(2:end,idx));
check
=
{
'J+K.AM0301C1'
,
'G+H.AM0301C1'
}
'
;
logA
=
cell2mat
(
cellfun
(
@
(
c
)
strcmp
(
c
,
series_codes
),
check
,
'UniformOutput'
,
false
));
assert
(
sum
(
logA
)
==
2
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_code_mask_with_plus();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
tests/test_fetch_series_by_dimension.m
View file @
96abce51
function test_fetch_series_by_dimension()
function
test_fetch_series_by_dimension
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"WB"
,
'dataset_code'
,
"DB"
,
'dimensions'
,
'{"country":["ES","FR","IT"],"indicator":["IC.REG.COST.PC.FE.ZS.DRFN"]}'
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -14,4 +14,15 @@ assert(dataset_codes{1} == "DB");
idx
=
find
(
strcmp
(
'series_code'
,
df
(
1
,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
==
3
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_dimension();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_by_id.m
View file @
96abce51
function test_fetch_series_by_id()
function
test_fetch_series_by_id
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'series_ids'
,
"AMECO/ZUTN/EA19.1.0.0.0.ZUTN"
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -15,4 +15,15 @@ idx = find(strcmp('series_code',df(1,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
==
1
);
assert
(
series_codes
{
1
}
==
"EA19.1.0.0.0.ZUTN"
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_id();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_by_ids_in_different_datasets.m
View file @
96abce51
function test_fetch_series_by_ids_in_different_datasets()
function
test_fetch_series_by_ids_in_different_datasets
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'series_ids'
,
[
"AMECO/ZUTN/EA19.1.0.0.0.ZUTN"
,
"BIS/cbs/Q.S.5A.4B.F.B.A.A.LC1.A.1C"
]);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -18,4 +18,15 @@ series_codes = unique(df(2:end,idx));
assert
(
length
(
series_codes
)
==
2
);
assert
(
series_codes
{
1
}
==
"EA19.1.0.0.0.ZUTN"
);
assert
(
series_codes
{
2
}
==
"Q.S.5A.4B.F.B.A.A.LC1.A.1C"
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_ids_in_different_datasets();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_by_ids_in_same_dataset.m
View file @
96abce51
function test_fetch_series_by_ids_in_same_dataset()
function
test_fetch_series_by_ids_in_same_dataset
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'series_ids'
,
[
"AMECO/ZUTN/EA19.1.0.0.0.ZUTN"
,
...
"AMECO/ZUTN/DNK.1.0.0.0.ZUTN"
]);
...
...
@@ -17,4 +17,15 @@ series_codes = unique(df(2:end,idx));
assert
(
length
(
series_codes
)
==
2
);
assert
(
series_codes
{
1
}
==
"DNK.1.0.0.0.ZUTN"
);
assert
(
series_codes
{
2
}
==
"EA19.1.0.0.0.ZUTN"
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_by_ids_in_same_dataset();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_of_dataset.m
View file @
96abce51
function test_fetch_series_of_dataset()
function
test_fetch_series_of_dataset
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"AMECO"
,
'dataset_code'
,
"ZUTN"
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -14,4 +14,15 @@ assert(dataset_codes{1} == "ZUTN");
idx
=
find
(
strcmp
(
'series_code'
,
df
(
1
,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
>
1
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_of_dataset();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_with_filter_on_one_series.m
View file @
96abce51
function test_fetch_series_with_filter_on_one_series()
function
test_fetch_series_with_filter_on_one_series
()
% --*-- Unitary tests --*--
filters_
=
'[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}]'
;
df
=
fetch_series
(
'provider_code'
,
"AMECO"
,
'dataset_code'
,
"ZUTN"
,
'series_code'
,
"DEU.1.0.0.0.ZUTN"
,
'dbnomics_filters'
,
filters_
);
...
...
@@ -21,4 +21,15 @@ idx_freq = find(strcmp('x_frequency',df(1,:)));
frequencies
=
unique
(
df
(
2
:
end
,
idx_freq
));
assert
(
any
(
strcmp
(
frequencies
,
"monthly"
)));
assert
(
any
(
contains
(
series_codes
,
"_filtered"
)));
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_with_filter_on_one_series();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_with_max_nb_series.m
View file @
96abce51
function test_fetch_series_with_max_nb_series()
function
test_fetch_series_with_max_nb_series
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"AMECO"
,
'dataset_code'
,
"ZUTN"
,
'max_nb_series'
,
20
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -14,4 +14,15 @@ assert(dataset_codes{1} == "ZUTN");
idx
=
find
(
strcmp
(
'series_code'
,
df
(
1
,:)));
series_codes
=
unique
(
df
(
2
:
end
,
idx
));
assert
(
length
(
series_codes
)
<=
20
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_with_max_nb_series();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
tests/test_fetch_series_with_na_values.m
View file @
96abce51
function test_fetch_series_with_na_values()
function
test_fetch_series_with_na_values
()
% --*-- Unitary tests --*--
df
=
fetch_series
(
'provider_code'
,
"AMECO"
,
'dataset_code'
,
"ZUTN"
,
'series_code'
,
"DEU.1.0.0.0.ZUTN"
);
idx
=
find
(
strcmp
(
'provider_code'
,
df
(
1
,:)));
...
...
@@ -20,4 +20,15 @@ assert(any(strcmp('NA', df(2:end,idx))) == true);
idx
=
find
(
strcmp
(
'value'
,
df
(
1
,:)));
assert
(
any
(
isnan
(
cell2mat
(
df
(
2
:
end
,
idx
))))
==
true
);
end
\ No newline at end of file
end
%@test:1
%$ try
%$ test_fetch_series_with_na_values();
%$ t(1) = true;
%$ catch
%$ t(1) = false;
%$ end
%$
%$ T = t(1);
%@eof:1
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment