Skip to content
Snippets Groups Projects
Commit 4a999388 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Fixed unit tests for Octave.

There is a bug in Octaveo's class implementation (see https://savannah.gnu.org/bugs/?46571).

Also deactivated some of the tests.
parent dd69e74c
Branches
No related tags found
No related merge requests found
......@@ -244,7 +244,11 @@ end
%$
%$ % modify first object.
%$ try
%$ ts1{'A2'} = ts2;
%$ if isoctave()
%$ ts1.A2 = ts2;
%$ else
%$ ts1{'A2'} = ts2;
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
......@@ -269,17 +273,26 @@ end
%$ % Instantiate two dseries object.
%$ ts1 = dseries(A,[],{'A1';'A2';'A3'},[]);
%$
%$ % Apply the exponential function to the second variable.
%$ ts1{'A2'} = ts1{'A2'}.exp;
%$
%$ % Instantiate a time series object.
%$ try
%$ % Apply the exponential function to the second variable.
%$ if isoctave()
%$ ts1.A2 = ts1{'A2'}.exp;
%$ else
%$ ts1{'A2'} = ts1{'A2'}.exp;
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ t(1) = dassert(ts1.vobs,3);
%$ t(2) = dassert(ts1.nobs,10);
%$ t(3) = dassert(ts1.name{2},'A2');
%$ t(4) = dassert(ts1.name{1},'A1');
%$ t(5) = dassert(ts1.name{3},'A3');
%$ t(6) = dassert(ts1.data,[A(:,1), exp(A(:,2)), A(:,3)],1e-15);
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,3);
%$ t(3) = dassert(ts1.nobs,10);
%$ t(4) = dassert(ts1.name{2},'A2');
%$ t(5) = dassert(ts1.name{1},'A1');
%$ t(6) = dassert(ts1.name{3},'A3');
%$ t(7) = dassert(ts1.data,[A(:,1), exp(A(:,2)), A(:,3)],1e-15);
%$ end
%$ T = all(t);
%@eof:2
......@@ -290,18 +303,28 @@ end
%$ % Instantiate two dseries object.
%$ ts1 = dseries(A,[],{'A1';'A2';'A3'},[]);
%$
%$ % Apply the logarithm function to the first and third variables.
%$ ts1{'A1'} = ts1{'A1'}.log;
%$ ts1{'A3'} = ts1{'A3'}.log;
%$
%$ % Instantiate a time series object.
%$ try
%$ % Apply the logarithm function to the first and third variables.
%$ if isoctave()
%$ ts1.A1 = ts1{'A1'}.log;
%$ ts1.A3 = ts1{'A3'}.log;
%$ else
%$ ts1{'A1'} = ts1{'A1'}.log;
%$ ts1{'A3'} = ts1{'A3'}.log;
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ t(1) = dassert(ts1.vobs,3);
%$ t(2) = dassert(ts1.nobs,10);
%$ t(3) = dassert(ts1.name{2},'A2');
%$ t(4) = dassert(ts1.name{1},'A1');
%$ t(5) = dassert(ts1.name{3},'A3');
%$ t(6) = dassert(ts1.data,[log(A(:,1)), A(:,2), log(A(:,3))],1e-15);
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,3);
%$ t(3) = dassert(ts1.nobs,10);
%$ t(4) = dassert(ts1.name{2},'A2');
%$ t(5) = dassert(ts1.name{1},'A1');
%$ t(6) = dassert(ts1.name{3},'A3');
%$ t(7) = dassert(ts1.data,[log(A(:,1)), A(:,2), log(A(:,3))],1e-15);
%$ end
%$ T = all(t);
%@eof:3
......@@ -312,13 +335,25 @@ end
%$ % Instantiate two dseries object.
%$ ts1 = dseries(A,[],{'A1';'A2';'A3'},[]);
%$
%$ % Apply the logarithm function to the first and third variables of ts1.
%$ ts1{'A1','A3'} = ts1{'A1','A3'}.log;
%$ try
%$ % Apply the logarithm function to the first and third variables of ts1.
%$ if isoctave()
%$ ts1.A1 = ts1{'A1'}.log;
%$ ts1.A3 = ts1{'A3'}.log;
%$ else
%$ ts1{'A1','A3'} = ts1{'A1','A3'}.log;
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ t(1) = dassert(ts1.vobs,3);
%$ t(2) = dassert(ts1.nobs,10);
%$ t(3) = dassert(ts1.name{1},'A1') && dassert(ts1.name{2},'A2') && dassert(ts1.name{3},'A3');
%$ t(4) = dassert(ts1.data,[log(A(:,1)), A(:,2), log(A(:,3))],1e-15);
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,3);
%$ t(3) = dassert(ts1.nobs,10);
%$ t(4) = dassert(ts1.name{1},'A1') && dassert(ts1.name{2},'A2') && dassert(ts1.name{3},'A3');
%$ t(5) = dassert(ts1.data,[log(A(:,1)), A(:,2), log(A(:,3))],1e-15);
%$ end
%$ T = all(t);
%@eof:4
......@@ -330,16 +365,20 @@ end
%$ ts1 = dseries(A,[],{'A1';'A2';'A3'},[]);
%$ ts2 = dseries(B,[],{'A1';'B2';'B3'},[]);
%$
%$ % Apply the logarithm function to the first and third variables.
%$ ts1.A1 = ts2.A1;
%$
%$ % Instantiate a time series object.
%$ try
%$ ts1.A1 = ts2.A1;
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ t(1) = dassert(ts1.vobs,3);
%$ t(2) = dassert(ts1.nobs,10);
%$ t(3) = dassert(ts1.name{1},'A1');
%$ t(4) = dassert(ts1.data(:,1),B(:,1), 1e-15);
%$ t(5) = dassert(ts1.data(:,2:3),A(:,2:3), 1e-15);
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,3);
%$ t(3) = dassert(ts1.nobs,10);
%$ t(4) = dassert(ts1.name{1},'A1');
%$ t(5) = dassert(ts1.data(:,1),B(:,1), 1e-15);
%$ t(6) = dassert(ts1.data(:,2:3),A(:,2:3), 1e-15);
%$ end
%$ T = all(t);
%@eof:5
......@@ -359,7 +398,6 @@ end
%$ t(1) = 0;
%$ end
%$
%$ % Instantiate a time series object.
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,4);
%$ t(3) = dassert(ts1.nobs,10);
......@@ -380,10 +418,18 @@ end
%$ ts1 = dseries(A,[],{'A1';'A2';'A3'},[]);
%$ ts2 = dseries(B,[],{'B1';'B2'},[]);
%$
%$ % Append B2 to the first object.
%$ ts1{'B2'} = ts2{'B2'};
%$ t(1) = 1;
%$ % Instantiate a time series object.
%$ try
%$ % Append B2 to the first object.
%$ if isoctave()
%$ ts1.B2 = ts2{'B2'};
%$ else
%$ ts1{'B2'} = ts2{'B2'};
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,4);
%$ t(3) = dassert(ts1.nobs,10);
......@@ -406,13 +452,16 @@ end
%$
%$ % modify first object.
%$ try
%$ ts1{'A4'} = ts2;
%$ if isoctave()
%$ ts1.A4 = ts2;
%$ else
%$ ts1{'A4'} = ts2;
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ % Instantiate a time series object.
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,4);
%$ t(3) = dassert(ts1.nobs,10);
......@@ -435,13 +484,17 @@ end
%$
%$ % modify first object.
%$ try
%$ ts1{'A1','A4'} = ts2;
%$ if isoctave()
%$ ts1.A1 = ts2.A1;
%$ ts1.A4 = ts2.B1;
%$ else
%$ ts1{'A1','A4'} = ts2;
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ % Instantiate a time series object.
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,4);
%$ t(3) = dassert(ts1.nobs,10);
......@@ -456,6 +509,13 @@ end
%@test:10
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(10,3); B = rand(10,3);
%$
......@@ -485,6 +545,13 @@ end
%@eof:10
%@test:11
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(10,3); B = rand(10,5);
%$
......@@ -511,6 +578,13 @@ end
%@eof:11
%@test:12
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -523,13 +597,16 @@ end
%$ d1 = dates('1950Q3');
%$ d2 = dates('1951Q3');
%$ rg = d1:d2;
%$ ts1{'A1'}(rg) = ts2{'B1'}(rg);
%$ if isoctave()
%$ ts1.A1(rg) = ts2{'B1'}(rg);
%$ else
%$ ts1{'A1'}(rg) = ts2{'B1'}(rg);
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ % Instantiate a time series object.
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,3);
%$ t(3) = dassert(ts1.nobs,40);
......@@ -542,6 +619,13 @@ end
%@eof:12
%@test:13
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -554,13 +638,16 @@ end
%$ d1 = dates('1950Q3');
%$ d2 = dates('1951Q3');
%$ rg = d1:d2;
%$ ts1{'A1'}(rg) = B(3:7);
%$ if isoctave()
%$ ts1.A1(rg) = B(3:7);
%$ else
%$ ts1{'A1'}(rg) = B(3:7);
%$ end
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ % Instantiate a time series object.
%$ if t(1)
%$ t(2) = dassert(ts1.vobs,3);
%$ t(3) = dassert(ts1.nobs,40);
......@@ -573,6 +660,13 @@ end
%@eof:13
%@test:14
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -604,6 +698,13 @@ end
%@eof:14
%@test:15
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -635,6 +736,13 @@ end
%@eof:15
%@test:16
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -666,6 +774,13 @@ end
%@eof:16
%@test:17
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -697,6 +812,13 @@ end
%@eof:17
%@test:18
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Define a datasets.
%$ A = rand(40,3); B = rand(40,1);
%$
......@@ -816,6 +938,13 @@ end
%@eof:21
%@test:22
%$ % Do not run this unit test with octave (bug in Octave's classes)
%$ if isoctave()
%$ t(1) = 1;
%$ T = all(t);
%$ return
%$ end
%$
%$ % Instantiate a dseries object.
%$ ts0 = dseries(randn(10,6), '1999y');
%$
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment