Skip to content

Commit

Permalink
fixed test for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ebenetce committed Dec 6, 2023
1 parent a6ef02f commit 8cf7b93
Showing 1 changed file with 49 additions and 39 deletions.
88 changes: 49 additions & 39 deletions MATLAB/tests/testSDMX.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function tGetTimeSeries(tc)
tc.verifyLength(tts, 1)
tb = sdmxtable(tts);
tc.verifyClass(tb, 'table')

tts = sdmx.getTimeSeries('ECB','IEAF.Q.SK.N.V.D92.Z.S2.A1.S.2.X.N.Z');
tc.verifyLength(tts, 1)
tb = sdmxtable(tts, true);
Expand All @@ -75,63 +75,73 @@ function tGetTimeSeries(tc)
function tGetTimeSeriesTable(tc)
% Test 5: getTimeSeriesTable
tb = sdmx.getTimeSeriesTable('ECB', 'EXR.M.USD|GBP.EUR.SP00.A');
tc.verifyClass(tb, 'table')
tc.verifyClass(tb, 'table')

tb = sdmx.getTimeSeriesTable('ECB', 'EXR.M.USD.EUR.SP00.A');
tc.verifyClass(tb, 'table')

startTime = datetime(1995,1,1, 'Format','yyyy-MM-dd');
endTime = datetime(2005,1,1, 'Format','yyyy-MM-dd');

tb = sdmx.getTimeSeriesTable('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime));
tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');

tc.verifyLessThan(tb.TIME_PERIOD, endTime);
tc.verifyGreaterThanOrEqual(tb.TIME_PERIOD, startTime)
end

function tGetTimeSeriesRevisions(tc)
% Test 6: getTimeSeriesRevisions

startTime = datetime(1995,1,1, 'Format','yyyy-MM-dd');
endTime = datetime(2005,1,1, 'Format','yyyy-MM-dd');

tb = sdmx.getTimeSeriesRevisions('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime));
tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');

tc.verifyLessThan(tb.TIME_PERIOD, endTime);
tc.verifyGreaterThanOrEqual(tb.TIME_PERIOD, startTime)

startTime = datetime(2002,1,1, 'Format','yyyy-MM-dd');
tb = sdmx.getTimeSeriesRevisions('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime), '', true);
tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');
tc.verifyClass(tb, 'table');
tc.verifyLessThan(tb.TIME_PERIOD, endTime);
tc.verifyGreaterThanOrEqual(tb.TIME_PERIOD, startTime)

tb = sdmx.getTimeSeriesRevisions('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime), '2003-01-01', true);
tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');
tc.verifyClass(tb, 'table');
tc.verifyLessThan(tb.TIME_PERIOD, endTime);
tc.verifyGreaterThanOrEqual(tb.TIME_PERIOD, startTime)
end

% function tGetTimeSeriesTableWithStartDates(tc)
%
% startTime = string(datetime(1995,1,1));
% endTime = string(datetime(2005,1,1));
%
% tb = sdmx.getTimeSeriesTable('ECB', 'EXR.M.USD.EUR.SP00.A', startTime, endTime);
% tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');
%
% tc.verifyLessThan(tb.TIME_PERIOD, endTime);
% tc.verifyGreaterThanOrEqual(tb.TIME_PERIOD, startTime)
% end

% function tGetTimeSeriesRevisions(tc)
% % Test 6: getTimeSeriesRevisions
%
% startTime = datetime(1995,1,1);
% endTime = datetime(2005,1,1);
%
% tb = sdmx.getTimeSeriesRevisions('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime));
% tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');
%
% tc.verifyLessThan(tb.TIME_PERIOD, endTime);
% tc.verifyGreaterThanOrEqual(tb.TIME_PERIOD, startTime)
%
% % startTime = datetime(2002,1,1);
% % tb = sdmx.getTimeSeriesRevisions('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime), '', true);
% % tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');
% % tc.verifyClass(tb, 'table');
% %
% % tb = sdmx.getTimeSeriesRevisions('ECB', 'EXR.M.USD.EUR.SP00.A', string(startTime), string(endTime), '2003', true);
% % tb.TIME_PERIOD = datetime(tb.TIME_PERIOD, 'InputFormat','uuuu-MM', 'Format','uuuu-MM');
% % tc.verifyClass(tb, 'table');
% end

function tAddProvider(tc)
sdmx.addProvider('ECB_TEST', 'http://sdw-wsrest.ecb.europa.eu/service', false, false, false, 'Sample ECB provider');
providers = sdmx.getProviders;
tc.verifyTrue(any(contains(providers, 'ECB_TEST')))
% Test 7: addProvider

sdmx.addProvider('ECB_TEST', 'http://sdw-wsrest.ecb.europa.eu/service', false, false, false, 'Sample ECB provider');
providers = sdmx.getProviders;
tc.verifyTrue(any(contains(providers, 'ECB_TEST')))
end

function tGetCodes(tc)
% Test 8: getCodes

map = sdmx.getCodes('ECB','ECB,EXR,1.0', 'FREQ');
tc.verifyEqual(map('A'), "Annual")
end

function tGetDSDIdentifier(tc)
% Test 9: getDSDIdentifier

id = sdmx.getDSDIdentifier('ECB','ECB,EXR,1.0');
tc.verifyEqual(id, "ECB/ECB_EXR1/1.0")
end

function tGetSDMXTable(tc)
% getSDMXTable

tts = sdmx.getTimeSeries('ECB', 'EXR.M.USD|GBP.EUR.SP00.A');
tb = sdmxtable(tts, true);
tc.verifyClass(tb, 'table')
Expand Down

0 comments on commit 8cf7b93

Please sign in to comment.