From 0db04cc8c6a1e46655faea7701791e14583519a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=B3ra=20Kocsis?= <dora@dynare.org>
Date: Mon, 6 Apr 2020 13:04:11 +0200
Subject: [PATCH] move tests under subroutines, closes #9

---
 .gitignore                                    |   5 +-
 .gitlab-ci.yml                                |   7 -
 Makefile                                      |   4 +-
 archive/template.m                            |  24 +-
 src/subroutines/fetch_series.m                | 234 +++++++++++++++++-
 src/subroutines/fetch_series_by_api_link.m    |  23 +-
 {tests => src/subroutines}/runalltests.m      |   2 +-
 tests/test_fetch_series_by_api_link.m         |  28 ---
 tests/test_fetch_series_by_code.m             |  29 ---
 tests/test_fetch_series_by_code_mask.m        |  28 ---
 ...test_fetch_series_by_code_mask_with_plus.m |  30 ---
 tests/test_fetch_series_by_dimension.m        |  28 ---
 tests/test_fetch_series_by_id.m               |  29 ---
 ...etch_series_by_ids_in_different_datasets.m |  32 ---
 ...test_fetch_series_by_ids_in_same_dataset.m |  31 ---
 tests/test_fetch_series_of_dataset.m          |  28 ---
 ...t_fetch_series_with_filter_on_one_series.m |  35 ---
 tests/test_fetch_series_with_max_nb_series.m  |  28 ---
 tests/test_fetch_series_with_na_values.m      |  34 ---
 19 files changed, 283 insertions(+), 376 deletions(-)
 rename {tests => src/subroutines}/runalltests.m (93%)
 delete mode 100644 tests/test_fetch_series_by_api_link.m
 delete mode 100644 tests/test_fetch_series_by_code.m
 delete mode 100644 tests/test_fetch_series_by_code_mask.m
 delete mode 100644 tests/test_fetch_series_by_code_mask_with_plus.m
 delete mode 100644 tests/test_fetch_series_by_dimension.m
 delete mode 100644 tests/test_fetch_series_by_id.m
 delete mode 100644 tests/test_fetch_series_by_ids_in_different_datasets.m
 delete mode 100644 tests/test_fetch_series_by_ids_in_same_dataset.m
 delete mode 100644 tests/test_fetch_series_of_dataset.m
 delete mode 100644 tests/test_fetch_series_with_filter_on_one_series.m
 delete mode 100644 tests/test_fetch_series_with_max_nb_series.m
 delete mode 100644 tests/test_fetch_series_with_na_values.m

diff --git a/.gitignore b/.gitignore
index d30ed2e..0c80b3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,8 +11,9 @@
 \#*\#
 *.mat
 *.asv
-tests/git.info
-tests/git.last-commit-hash
+src/subroutines/git.info
+src/subroutines/git.last-commit-hash
 
+/tests
 /missing_dbnomics
 /utils
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1e7af87..6819000 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,13 +10,6 @@ test_matlab:
   script:
     - make check-matlab
 
-test_old_matlab:
-  stage: test
-  variables:
-    MATLAB: /usr/local/MATLAB/R2009b/bin/matlab
-  script:
-    - make check-matlab
-
 test_octave:
   stage: test
   variables:
diff --git a/Makefile b/Makefile
index 6c1b562..6ab58da 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,11 @@ m-unit-tests/src/mtest.m:
 	git clone https://git.dynare.org/Dynare/m-unit-tests
 
 check-octave: m-unit-tests/src/mtest.m
-	@cd tests ;\
+	@cd src/subroutines;\
 	$(OCTAVE) --no-init-file --silent --no-history --eval "addpath([pwd() '/../m-unit-tests/src']); runalltests" && [ ! -f ./failed ] && [ -f ./pass ]
 
 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 ]
+	@$(MATLAB)  -nosplash -nodisplay -r "addpath([pwd '/m-unit-tests/src']); cd src/subroutines; 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
diff --git a/archive/template.m b/archive/template.m
index 183ab9c..99d0539 100644
--- a/archive/template.m
+++ b/archive/template.m
@@ -1,23 +1,45 @@
 % fetch series by provider code and dataset code
 df = fetch_series('provider_code', 'AMECO', 'dataset_code', 'UVGD', 'max_nb_series', 500);
+ds = to_dseries(df);
+
 % fetch one series by ID
 df_id = fetch_series('series_ids','AMECO/ZUTN/EA19.1.0.0.0.ZUTN');
+ds_id = to_dseries(df_id);
+
 % fetch multiple series by ID
 df_ids = fetch_series('series_ids', {'AMECO/ZUTN/EA19.1.0.0.0.ZUTN', 'AMECO/ZUTN/DNK.1.0.0.0.ZUTN'});
+ds_ids = to_dseries(df_ids);
+
 % fetch many series by ID from different datasets
-df_ids_sets = fetch_series('series_ids', {'AMECO/ZUTN/EA19.1.0.0.0.ZUTN', 'AMECO/ZUTN/DNK.1.0.0.0.ZUTN', 'IMF/CPI/A.AT.PCPIT_IX'});
 
 % fetch time series by code mask 
 df_code_mask1 = fetch_series('provider_code', 'IMF', 'dataset_code', 'CPI', 'series_code', 'M.FR+DE.PCPIEC_IX+PCPIA_IX');
+ds_code_mask1 = to_dseries(df_code_mask1);
+
 df_code_mask2 = fetch_series('provider_code', 'IMF', 'dataset_code', 'CPI', 'series_code', '.FR.PCPIEC_WT');
+ds_code_mask2 = to_dseries(df_code_mask1);
 % df_code_mask3 = fetch_series('provider_code', 'IMF', 'dataset_code', 'CPI', 'series_code', 'M..PCPIEC_IX+PCPIA_IX', 'max_nb_series', 400);
+
 % fetch series by dimensions
 df_dim = fetch_series('provider_code','AMECO', 'dataset_code', 'ZUTN', 'dimensions', '{"geo":["dnk"]}');
+ds_dim = to_dseries(df_dim);
+
 df_dims = fetch_series('provider_code','WB','dataset_code','DB', 'dimensions', '{"country":["ES","FR","IT"],"indicator":["IC.REG.COST.PC.FE.ZS.DRFN"]}');
+ds_dims = to_dseries(df_dims);
+
 % fetch series by api link
 df_link = fetch_series_by_api_link('https://api.db.nomics.world/v22/series/WB/DB?observations=1&dimensions=%7B%22country%22%3A%5B%22FR%22%2C%22IT%22%2C%22ES%22%5D%2C%22indicator%22%3A%5B%22IC.REG.COST.PC.FE.ZS.DRFN%22%5D%7D');
+ds_link = to_dseries(df_link);
+
 % fetch series from the cart
 df_cart = fetch_series_by_api_link('https://api.db.nomics.world/v22/series?series_ids=AMECO%2FZUTN%2FEA19.1.0.0.0.ZUTN&observations=1');
+ds_cart = to_dseries(df_cart);
+
+%%
+% fetch many series by ID from different datasets
+df_ids_sets = fetch_series('series_ids', {'AMECO/ZUTN/EA19.1.0.0.0.ZUTN', 'AMECO/ZUTN/DNK.1.0.0.0.ZUTN', 'IMF/CPI/A.AT.PCPIT_IX'});
+ds_ids_sets = to_dseries(df_ids_sets);
+
 % fetch multi frequency series
 df_multi_freq = fetch_series('series_ids', {'BEA/NIUnderlyingDetail-U001BC/S315-A',...
                                             'BEA/NIUnderlyingDetail-U001BC/S315-Q',...
diff --git a/src/subroutines/fetch_series.m b/src/subroutines/fetch_series.m
index 2cc9a03..b437dcf 100644
--- a/src/subroutines/fetch_series.m
+++ b/src/subroutines/fetch_series.m
@@ -1,4 +1,4 @@
-function df = fetch_series(varargin)
+function df = fetch_series(varargin) % --*-- Unitary tests --*--
 % function fetch_series(varargin)
 % Download time series from DBnomics. 
 % Returns a cell array.
@@ -119,3 +119,235 @@ end
 df = fetch_series_by_api_link(api_link, p.Results.dbnomics_filters, p.Results.max_nb_series, default_editor_base_url);
 end
 
+%@test:1    % test_fetch_series_by_code
+%$ try
+%$    df = fetch_series('provider_code', 'AMECO', 'dataset_code', 'ZUTN', 'series_code', 'EA19.1.0.0.0.ZUTN');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))),1); 
+%$    t(7) = dassert(df(2,5), {'EA19.1.0.0.0.ZUTN'}); 
+%$ end 
+%$
+%$ T = all(t);
+%@eof:1
+
+%@test:2    % test_fetch_series_by_code_mask
+%$ try
+%$    df = fetch_series('provider_code', 'IMF', 'dataset_code', 'CPI', 'series_code', 'M.FR+DE.PCPIEC_IX+PCPIA_IX');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'IMF'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'CPI'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))),4); 
+%$ end 
+%$
+%$ T = all(t);
+%@eof:2
+
+%@test:3    % test_fetch_series_by_code_mask_with_plus
+%$ try
+%$    df = fetch_series('provider_code', 'SCB', 'dataset_code', 'AKIAM', 'series_code', '"J+K"+"G+H".AM0301C1');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'SCB'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'AKIAM'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))),2); 
+%$ end 
+%$
+%$ T = all(t);
+%@eof:3
+
+%@test:4    % test_fetch_series_by_dimension
+%$ try
+%$    df = fetch_series('provider_code','WB','dataset_code','DB', 'dimensions', '{"country":["ES","FR","IT"],"indicator":["IC.REG.COST.PC.FE.ZS.DRFN"]}');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'WB'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'DB'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))),3); 
+%$ end 
+%$
+%$ T = all(t);
+%@eof:4
+
+%@test:5    % test_fetch_series_by_id
+%$ try
+%$    df = fetch_series('series_ids','AMECO/ZUTN/EA19.1.0.0.0.ZUTN');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))),1); 
+%$    t(7) = dassert(df(2,5), {'EA19.1.0.0.0.ZUTN'});
+%$ end 
+%$
+%$ T = all(t);
+%@eof:5
+
+%@test:6    % test_fetch_series_by_ids_in_different_datasets
+%$ try
+%$    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'});
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1)
+%$    provider_codes = unique(df(2:end,2));
+%$    t(2) = dassert(length(provider_codes),2); 
+%$    t(3) = dassert(provider_codes{1}, 'AMECO');
+%$    t(4) = dassert(provider_codes{2}, 'BIS');
+%$    dataset_codes = unique(df(2:end,3));
+%$    t(5) = dassert(length(dataset_codes),2); 
+%$    t(6) = dassert(dataset_codes{1}, 'ZUTN');
+%$    t(7) = dassert(dataset_codes{2}, 'cbs');
+%$    series_codes = unique(df(2:end,5));
+%$    t(8) = dassert(length(series_codes),2); 
+%$    t(9) = dassert(series_codes{1}, 'EA19.1.0.0.0.ZUTN');
+%$    t(10) = dassert(series_codes{2}, 'Q.S.5A.4B.F.B.A.A.LC1.A.1C');
+%$ end 
+%$
+%$ T = all(t);
+%@eof:6
+
+%@test:7    % test_fetch_series_by_ids_in_same_dataset
+%$ try
+%$    df = fetch_series('series_ids', {'AMECO/ZUTN/EA19.1.0.0.0.ZUTN',...
+%$                                     'AMECO/ZUTN/DNK.1.0.0.0.ZUTN'});
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'}); 
+%$    series_codes = unique(df(2:end,5));
+%$    t(6) = dassert(length(series_codes),2); 
+%$    t(7) = dassert(series_codes{1}, 'DNK.1.0.0.0.ZUTN');
+%$    t(8) = dassert(series_codes{2}, 'EA19.1.0.0.0.ZUTN');
+%$ end 
+%$
+%$ T = all(t);
+%@eof:7
+
+%@test:8    % test_fetch_series_of_dataset
+%$ try
+%$    df = fetch_series('provider_code', 'AMECO', 'dataset_code', 'ZUTN');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))), 49); 
+%$ end 
+%$
+%$ T = all(t);
+%@eof:8
+
+%@test:9    % test_fetch_series_with_filter_on_one_series
+%$ try
+%$    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_);
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'});
+%$    series_codes = unique(df(2:end,5));
+%$    t(6) = dassert(length(unique(df(2:end,5))),2);
+%$    t(7) = dassert(df(2,5), {'DEU.1.0.0.0.ZUTN'});
+%$    t(8) = dassert(series_codes{2}, 'DEU.1.0.0.0.ZUTN_filtered');
+%$    freq_ = unique(df(2:end, 1));
+%$    t(9) = dassert(freq_{2}, 'monthly');
+%$    t(10) = dassert(df(1,12), {'filtered'});
+%$ end 
+%$
+%$ T = all(t);
+%@eof:9
+
+%@test:10    % test_fetch_series_with_max_nb_series
+%$ try
+%$    df = fetch_series('provider_code', 'AMECO', 'dataset_code', 'ZUTN', 'max_nb_series',20);
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'});
+%$    series_codes = unique(df(2:end,5));
+%$    assert(length(series_codes) <= 20);
+%$ end 
+%$
+%$ T = all(t);
+%@eof:10
+
+%@test:11    % test_fetch_series_with_na_values
+%$ try
+%$    df = fetch_series('provider_code', 'AMECO', 'dataset_code', 'ZUTN', 'series_code', 'DEU.1.0.0.0.ZUTN');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'AMECO'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'ZUTN'});
+%$    t(6) = dassert(length(unique(df(2:end,5))),1); 
+%$    t(7) = dassert(df(2,5), {'DEU.1.0.0.0.ZUTN'});
+%$    assert(any(strcmp('NA', df(2:end,9))) == true);
+%$    assert(any(isnan(cell2mat(df(2:end,10)))) == true);
+%$ end 
+%$
+%$ T = all(t);
+%@eof:11
diff --git a/src/subroutines/fetch_series_by_api_link.m b/src/subroutines/fetch_series_by_api_link.m
index 64a98a9..dd438fc 100644
--- a/src/subroutines/fetch_series_by_api_link.m
+++ b/src/subroutines/fetch_series_by_api_link.m
@@ -1,4 +1,4 @@
-function df = fetch_series_by_api_link(api_link, varargin)
+function df = fetch_series_by_api_link(api_link, varargin) % --*-- Unitary tests --*--  
 % function fetch_series_by_api_link(api_link, varargin)
 % Fetch series given an "API link" URL.
 % "API link" URLs can be found on DBnomics web site (https://db.nomics.world/) on dataset or series pages using "Download" buttons.
@@ -168,4 +168,23 @@ else
         series_length=series_length+length(flat_series.value);
     end
 end
-end
\ No newline at end of file
+end
+
+%@test:1    % test_fetch_series_by_api_link
+%$ try
+%$    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');
+%$    t(1) = 1;
+%$ catch
+%$    t = 0;
+%$ end
+%$
+%$ if t(1) 
+%$    t(2) = dassert(length(unique(df(2:end,2))),1); 
+%$    t(3) = dassert(df(2,2), {'BIS'}); 
+%$    t(4) = dassert(length(unique(df(2:end,3))),1); 
+%$    t(5) = dassert(df(2,3), {'long_pp'}); 
+%$    t(6) = dassert(length(unique(df(2:end,5))),23); 
+%$ end 
+%$
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/tests/runalltests.m b/src/subroutines/runalltests.m
similarity index 93%
rename from tests/runalltests.m
rename to src/subroutines/runalltests.m
index e0c15a2..b4e639f 100644
--- a/tests/runalltests.m
+++ b/src/subroutines/runalltests.m
@@ -34,7 +34,7 @@ unit_tests_root = strrep(which('runalltests'),'runalltests.m','');
 try
     initialize_mdbnomics();
 catch
-    addpath([unit_tests_root '../src']);
+    addpath([unit_tests_root '../']);
     initialize_mdbnomics();
 end
 
diff --git a/tests/test_fetch_series_by_api_link.m b/tests/test_fetch_series_by_api_link.m
deleted file mode 100644
index 6205d38..0000000
--- a/tests/test_fetch_series_by_api_link.m
+++ /dev/null
@@ -1,28 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'BIS'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(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
-
-%@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
diff --git a/tests/test_fetch_series_by_code.m b/tests/test_fetch_series_by_code.m
deleted file mode 100644
index 4303118..0000000
--- a/tests/test_fetch_series_by_code.m
+++ /dev/null
@@ -1,29 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) == 1);
-assert(strcmp(series_codes{1},'EA19.1.0.0.0.ZUTN'));
-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
diff --git a/tests/test_fetch_series_by_code_mask.m b/tests/test_fetch_series_by_code_mask.m
deleted file mode 100644
index 6f1d4a6..0000000
--- a/tests/test_fetch_series_by_code_mask.m
+++ /dev/null
@@ -1,28 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'IMF'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'CPI'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) == 4);
-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
diff --git a/tests/test_fetch_series_by_code_mask_with_plus.m b/tests/test_fetch_series_by_code_mask_with_plus.m
deleted file mode 100644
index b38bd73..0000000
--- a/tests/test_fetch_series_by_code_mask_with_plus.m
+++ /dev/null
@@ -1,30 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'SCB'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'AKIAM'));
-
-idx = find(strcmp('series_code',df(1,:)));
-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
-
-%@test:1
-%$ try
-%$    test_fetch_series_by_code_mask_with_plus();
-%$    t(1) = true;
-%$ catch
-%$    t(1) = false;
-%$ end
-%$
-%$ T = t(1);
-%@eof:1
diff --git a/tests/test_fetch_series_by_dimension.m b/tests/test_fetch_series_by_dimension.m
deleted file mode 100644
index 3508404..0000000
--- a/tests/test_fetch_series_by_dimension.m
+++ /dev/null
@@ -1,28 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'WB'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'DB'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) == 3);
-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
diff --git a/tests/test_fetch_series_by_id.m b/tests/test_fetch_series_by_id.m
deleted file mode 100644
index e87b494..0000000
--- a/tests/test_fetch_series_by_id.m
+++ /dev/null
@@ -1,29 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) == 1);
-assert(strcmp(series_codes{1},'EA19.1.0.0.0.ZUTN'));
-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
diff --git a/tests/test_fetch_series_by_ids_in_different_datasets.m b/tests/test_fetch_series_by_ids_in_different_datasets.m
deleted file mode 100644
index d71df24..0000000
--- a/tests/test_fetch_series_by_ids_in_different_datasets.m
+++ /dev/null
@@ -1,32 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==2);
-assert(strcmp(provider_codes{1},'AMECO'));
-assert(strcmp(provider_codes{2},'BIS'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 2);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-assert(strcmp(dataset_codes{2},'cbs'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) == 2);
-assert(strcmp(series_codes{1},'EA19.1.0.0.0.ZUTN'));
-assert(strcmp(series_codes{2},'Q.S.5A.4B.F.B.A.A.LC1.A.1C'));
-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
diff --git a/tests/test_fetch_series_by_ids_in_same_dataset.m b/tests/test_fetch_series_by_ids_in_same_dataset.m
deleted file mode 100644
index c44b6bc..0000000
--- a/tests/test_fetch_series_by_ids_in_same_dataset.m
+++ /dev/null
@@ -1,31 +0,0 @@
-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'});
-    
-idx = find(strcmp('provider_code',df(1,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) == 2);
-assert(strcmp(series_codes{1},'DNK.1.0.0.0.ZUTN'));
-assert(strcmp(series_codes{2},'EA19.1.0.0.0.ZUTN'));
-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
diff --git a/tests/test_fetch_series_of_dataset.m b/tests/test_fetch_series_of_dataset.m
deleted file mode 100644
index 0b644a8..0000000
--- a/tests/test_fetch_series_of_dataset.m
+++ /dev/null
@@ -1,28 +0,0 @@
-function test_fetch_series_of_dataset() % --*-- Unitary tests --*--
-df = fetch_series('provider_code', 'AMECO', 'dataset_code', 'ZUTN');
-
-idx = find(strcmp('provider_code',df(1,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) > 1);
-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
diff --git a/tests/test_fetch_series_with_filter_on_one_series.m b/tests/test_fetch_series_with_filter_on_one_series.m
deleted file mode 100644
index 4fb85b5..0000000
--- a/tests/test_fetch_series_with_filter_on_one_series.m
+++ /dev/null
@@ -1,35 +0,0 @@
-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_);
-
-idx = find(strcmp('provider_code',df(1,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(strcmp(series_codes{1},'DEU.1.0.0.0.ZUTN'));
-
-assert(any(find(strcmp('filtered',df(1,:)))));
-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
-
-%@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
diff --git a/tests/test_fetch_series_with_max_nb_series.m b/tests/test_fetch_series_with_max_nb_series.m
deleted file mode 100644
index 77b4d7d..0000000
--- a/tests/test_fetch_series_with_max_nb_series.m
+++ /dev/null
@@ -1,28 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(length(series_codes) <= 20);
-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
diff --git a/tests/test_fetch_series_with_na_values.m b/tests/test_fetch_series_with_na_values.m
deleted file mode 100644
index 8dd7ef0..0000000
--- a/tests/test_fetch_series_with_na_values.m
+++ /dev/null
@@ -1,34 +0,0 @@
-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,:)));
-provider_codes = unique(df(2:end,idx));
-assert(length(provider_codes)==1);
-assert(strcmp(provider_codes{1},'AMECO'));
-
-idx = find(strcmp('dataset_code',df(1,:)));
-dataset_codes = unique(df(2:end,idx));
-assert(length(dataset_codes) == 1);
-assert(strcmp(dataset_codes{1},'ZUTN'));
-
-idx = find(strcmp('series_code',df(1,:)));
-series_codes = unique(df(2:end,idx));
-assert(strcmp(series_codes{1},'DEU.1.0.0.0.ZUTN'));
-
-idx = find(strcmp('original_value',df(1,:)));
-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
-
-%@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
-- 
GitLab