# HG changeset patch # User jwe # Date 1201038746 0 # Node ID 83a8781b529d005fa3c5b711bf3722b3aac28c3d # Parent 8a3b2ccc4e11a0cfeea480b17c8975cc3f9e02c8 [project @ 2008-01-22 21:52:25 by jwe] diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/ChangeLog --- a/scripts/ChangeLog Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/ChangeLog Tue Jan 22 21:52:26 2008 +0000 @@ -1,3 +1,47 @@ +2008-01-22 Thomas Weber + + * linear-algebra/cond.m, linear-algebra/trace.m: + Move tests here from test/test_linalg.m. + + * general/diff.m, general/fliplr.m, general/flipud.m, + general/logspace.m, general/rot90.m, general/shift.m, general/tril.m, + general/triu.m, linear-algebra/vec.m, linear-algebra/vech.m, + special-matrix/hankel.m, special-matrix/hilb.m, + special-matrix/invhilb.m, special-matrix/sylvester_matrix.m, + special-matrix/toeplitz.m, special-matrix/vander.m: + Move tests here from test/test_matrix.m. + + * general/isscalar.m, general/issquare.m, general/isvector.m: + Move tests here from test/test_number.m. + + * deprecated/polyinteg.m, polynomial/compan.m, polynomial/conv.m, + polynomial/deconv.m, polynomial/poly.m, polynomial/polyderiv.m, + polynomial/polyfit.m, polynomial/polyreduce.m, polynomial/polyval.m, + polynomial/polyvalm.m, polynomial/roots.m: + Move tests here from test/test_poly.m. + + * signal/unwrap.m: + Move tests here from test/test_signal.m. + + * statistics/base/corrcoef.m, statistics/base/cov.m, + statistics/base/kurtosis.m, statistics/base/mahalanobis.m, + statistics/base/mean.m, statistics/base/median.m, + statistics/base/skewness.m, statistics/base/std.m: + Move tests here from test/test_stats.m. + + * general/int2str.m, general/num2str.m, strings/bin2dec.m, + strings/blanks.m, strings/deblank.m, strings/dec2bin.m, + strings/dec2hex.m, strings/findstr.m, strings/hex2dec.m, + strings/index.m, strings/rindex.m, strings/split.m, strings/str2mat.m, + strings/str2num.m, strings/strcat.m, strings/strrep.m, + strings/substr.m: + Move tests here from test/test_string.m. + + * miscellaneous/computer.m, miscellaneous/ls.m, + miscellaneous/version.m, time/asctime.m, time/clock.m, time/ctime.m, + time/date.m, time/etime.m, time/is_leap_year.m: + Move tests here from test/test_system.m. + 2008-01-22 Schloegl Alois * specfun/erfinv.m: Replace z_old and z_new by a single variable z. diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/deprecated/intersection.m --- a/scripts/deprecated/intersection.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/deprecated/intersection.m Tue Jan 22 21:52:26 2008 +0000 @@ -28,3 +28,14 @@ y = intersect (varargin{:}); endfunction + +%!assert(all (all (intersection ([1, 2, 3], [2, 3, 5]) == [2, 3]))); + +%!assert(all (all (intersection ([1; 2; 3], [2, 3, 5]) == [2, 3]))); + +%!assert(isempty (intersection ([1, 2, 3], [4; 5; 6]))); + +%!error intersection (1); + +%!error intersection (1, 2, 5); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/deprecated/polyinteg.m --- a/scripts/deprecated/polyinteg.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/deprecated/polyinteg.m Tue Jan 22 21:52:26 2008 +0000 @@ -35,3 +35,12 @@ y = polyint (p); endfunction + +%!assert(all (all (polyinteg ([2, 2]) == [1, 2, 0]))); + +%!assert(isempty (polyinteg ([]))); + +%!assert(all (all (polyinteg (3) == [3, 0]))); + +%!error polyinteg ([1, 2; 3, 4]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/diff.m --- a/scripts/general/diff.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/diff.m Tue Jan 22 21:52:26 2008 +0000 @@ -131,3 +131,18 @@ endif endfunction + +%!assert((diff ([1, 2, 3, 4]) == [1, 1, 1] +%! && diff ([1, 3, 7, 19], 2) == [2, 8] +%! && diff ([1, 2; 5, 4; 8, 7; 9, 6; 3, 1]) == [4, 2; 3, 3; 1, -1; -6, -5] +%! && diff ([1, 2; 5, 4; 8, 7; 9, 6; 3, 1], 3) == [-1, -5; -5, 0] +%! && isempty (diff (1)))); + +%!error diff ([1, 2; 3, 4], -1); + +%!error diff ("foo"); + +%!error diff (); + +%!error diff (1, 2, 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/fliplr.m --- a/scripts/general/fliplr.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/fliplr.m Tue Jan 22 21:52:26 2008 +0000 @@ -51,3 +51,12 @@ y = x (:, nc:-1:1); endfunction + +%!assert((fliplr ([1, 2; 3, 4]) == [2, 1; 4, 3] +%! && fliplr ([1, 2; 3, 4; 5, 6]) == [2, 1; 4, 3; 6, 5] +%! && fliplr ([1, 2, 3; 4, 5, 6]) == [3, 2, 1; 6, 5, 4])); + +%!error fliplr(); + +%!error fliplr (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/flipud.m --- a/scripts/general/flipud.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/flipud.m Tue Jan 22 21:52:26 2008 +0000 @@ -52,3 +52,12 @@ y = x (nr:-1:1, :); endfunction + +%!assert((flipud ([1, 2; 3, 4]) == [3, 4; 1, 2] +%! && flipud ([1, 2; 3, 4; 5, 6]) == [5, 6; 3, 4; 1, 2] +%! && flipud ([1, 2, 3; 4, 5, 6]) == [4, 5, 6; 1, 2, 3])); + +%!error flipud (); + +%!error flipud (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/int2str.m --- a/scripts/general/int2str.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/int2str.m Tue Jan 22 21:52:26 2008 +0000 @@ -91,3 +91,10 @@ endif endfunction + +%!assert(strcmp (int2str (-123), "-123") && strcmp (int2str (1.2), "1")); + +%!error int2str (); + +%!error int2str (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/isscalar.m --- a/scripts/general/isscalar.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/isscalar.m Tue Jan 22 21:52:26 2008 +0000 @@ -33,3 +33,28 @@ endif endfunction + +%!assert(isscalar (1)); + +%!assert(!(isscalar ([1, 2]))); + +%!assert(!(isscalar ([]))); + +%!assert(!(isscalar ([1, 2; 3, 4]))); + +%!test +%! warn_str_to_num = 0; +%! assert((isscalar ("t"))); + +%!assert(!(isscalar ("test"))); + +%!assert(!(isscalar (["test"; "ing"]))); + +%!test +%! s.a = 1; +%! assert((isscalar (s))); + +%!error isscalar (); + +%!error isscalar (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/issquare.m --- a/scripts/general/issquare.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/issquare.m Tue Jan 22 21:52:26 2008 +0000 @@ -43,3 +43,32 @@ endif endfunction + +%!assert(issquare (1)); + +%!assert(!(issquare ([1, 2]))); + +%!assert(!(issquare ([]))); + +%!assert(issquare ([1, 2; 3, 4]) == 2); + +%!test +%! warn_str_to_num = 0; +%! assert(!(issquare ("t"))); + +%!assert(!(issquare ("test"))); + +%!test +%! warn_str_to_num = 0; +%! assert(!(issquare (["test"; "ing"; "1"; "2"]))); + +%!test +%! s.a = 1; +%! assert(!(issquare (s))); + +%!assert(!(issquare ([1, 2; 3, 4; 5, 6]))); + +%!error issquare (); + +%!error issquare ([1, 2; 3, 4], 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/isvector.m --- a/scripts/general/isvector.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/isvector.m Tue Jan 22 21:52:26 2008 +0000 @@ -36,3 +36,30 @@ endif endfunction + +%!assert(isvector (1)); + +%!assert(isvector ([1; 2; 3])); + +%!assert(!(isvector ([]))); + +%!assert(!(isvector ([1, 2; 3, 4]))); + +%!test +%! warn_str_to_num = 0; +%! assert((isvector ("t"))); + +%!test +%! warn_str_to_num = 0; +%! assert((isvector ("test"))); + +%!assert(!(isvector (["test"; "ing"]))); + +%!test +%! s.a = 1; +%! assert((isvector (s))); + +%!error isvector (); + +%!error isvector ([1, 2], 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/logspace.m --- a/scripts/general/logspace.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/logspace.m Tue Jan 22 21:52:26 2008 +0000 @@ -92,3 +92,20 @@ endif endfunction + +%!test +%! x1 = logspace (1, 2); +%! x2 = logspace (1, 2, 10); +%! x3 = logspace (1, -2, 10); +%! x4 = logspace (1, pi, 10); +%! assert((size (x1) == [1, 50] && x1(1) == 10 && x1(50) == 100 +%! && size (x2) == [1, 10] && x2(1) == 10 && x2(10) == 100 +%! && size (x3) == [1, 10] && x3(1) == 10 && x3(10) == 0.01 +%! && size (x4) == [1, 10] && x4(1) == 10 && abs (x4(10) - pi) < sqrt (eps))); + +%!error logspace ([1, 2; 3, 4], 5, 6); + +%!error logspace (); + +%!error logspace (1, 2, 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/num2str.m --- a/scripts/general/num2str.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/num2str.m Tue Jan 22 21:52:26 2008 +0000 @@ -148,3 +148,10 @@ endif endfunction + +%!assert((strcmp (num2str (123), "123") && strcmp (num2str (1.23), "1.23"))); + +%!error num2str (); + +%!error num2str (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/rot90.m --- a/scripts/general/rot90.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/rot90.m Tue Jan 22 21:52:26 2008 +0000 @@ -90,3 +90,21 @@ endif endfunction + +%!test +%! x1 = [1, 2; +%! 3, 4]; +%! x2 = [2, 4; +%! 1, 3]; +%! x3 = [4, 3; +%! 2, 1]; +%! x4 = [3, 1; +%! 4, 2]; +%! +%! assert((rot90 (x1)== x2 && rot90 (x1, 2) == x3 && rot90 (x1, 3) == x4 +%! && rot90 (x1, 4) == x1 && rot90 (x1, 5) == x2 && rot90 (x1, -1) == x4)); + +%!error rot90 (); + +%!error rot90 (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/shift.m --- a/scripts/general/shift.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/shift.m Tue Jan 22 21:52:26 2008 +0000 @@ -80,5 +80,23 @@ endif y = x(idx{:}); +endfunction -endfunction +%!test +%! a = [1, 2, 3]; +%! b = [4, 5, 6]; +%! c = [7, 8, 9]; +%! +%! r = [a, b, c]; +%! m = [a; b; c]; +%! +%! assert((shift (r, 3) == [c, a, b] +%! && shift (r, -6) == [c, a, b] +%! && shift (r, -3) == [b, c, a] +%! && shift (m, 1) == [c; a; b] +%! && shift (m, -2) == [c; a; b])); + +%!error shift (); + +%!error shift (1, 2, 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/tril.m --- a/scripts/general/tril.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/tril.m Tue Jan 22 21:52:26 2008 +0000 @@ -87,3 +87,23 @@ endfor endfunction + +%!test +%! a = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; +%! +%! l0 = [1, 0, 0; 4, 5, 0; 7, 8, 9; 10, 11, 12]; +%! l1 = [1, 2, 0; 4, 5, 6; 7, 8, 9; 10, 11, 12]; +%! l2 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; +%! lm1 = [0, 0, 0; 4, 0, 0; 7, 8, 0; 10, 11, 12]; +%! lm2 = [0, 0, 0; 0, 0, 0; 7, 0, 0; 10, 11, 0]; +%! lm3 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 10, 0, 0]; +%! lm4 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 0, 0, 0]; +%! +%! assert((tril (a, -4) == lm4 && tril (a, -3) == lm3 +%! && tril (a, -2) == lm2 && tril (a, -1) == lm1 +%! && tril (a) == l0 && tril (a, 1) == l1 && tril (a, 2) == l2)); + +%!error tril (); + +%!error tril (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/general/triu.m --- a/scripts/general/triu.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/general/triu.m Tue Jan 22 21:52:26 2008 +0000 @@ -47,3 +47,23 @@ endfor endfunction + +%!test +%! a = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; +%! +%! u0 = [1, 2, 3; 0, 5, 6; 0, 0, 9; 0, 0, 0]; +%! u1 = [0, 2, 3; 0, 0, 6; 0, 0, 0; 0, 0, 0]; +%! u2 = [0, 0, 3; 0, 0, 0; 0, 0, 0; 0, 0, 0]; +%! u3 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 0, 0, 0]; +%! um1 = [1, 2, 3; 4, 5, 6; 0, 8, 9; 0, 0, 12]; +%! um2 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 0, 11, 12]; +%! um3 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; +%! +%! assert((triu (a, -3) == um3 && triu (a, -2) == um2 +%! && triu (a, -1) == um1 && triu (a) == u0 && triu (a, 1) == u1 +%! && triu (a, 2) == u2 && triu (a, 3) == u3)); + +%!error triu (); + +%!error triu (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/linear-algebra/cond.m --- a/scripts/linear-algebra/cond.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/linear-algebra/cond.m Tue Jan 22 21:52:26 2008 +0000 @@ -55,3 +55,12 @@ endif endfunction + +%!assert(abs (cond ([1, 2; 2, 1]) - 3) < sqrt (eps)); + +%!assert(cond ([1, 2, 3; 4, 5, 6; 7, 8, 9]) > 1.0e+16); + +%!error cond (); + +%!error cond (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/linear-algebra/trace.m --- a/scripts/linear-algebra/trace.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/linear-algebra/trace.m Tue Jan 22 21:52:26 2008 +0000 @@ -38,3 +38,14 @@ endif endfunction + +%!assert(trace ([1, 2; 3, 4]) == 5); + +%!assert(trace ([1, 2; 3, 4; 5, 6]) == 5); + +%!assert(trace ([1, 3, 5; 2, 4, 6]) == 5); + +%!error trace (); + +%!error trace (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/linear-algebra/vec.m --- a/scripts/linear-algebra/vec.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/linear-algebra/vec.m Tue Jan 22 21:52:26 2008 +0000 @@ -39,3 +39,10 @@ v = x(:); endfunction + +%!assert(vec ([1, 2; 3, 4]) == [1; 3; 2; 4] && vec ([1, 3, 2, 4]) == [1; 3; 2; 4]); + +%!error vec (); + +%!error vec (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/linear-algebra/vech.m --- a/scripts/linear-algebra/vech.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/linear-algebra/vech.m Tue Jan 22 21:52:26 2008 +0000 @@ -53,3 +53,10 @@ endfor endfunction + +%!assert(all (vech ([1, 2, 3; 4, 5, 6; 7, 8, 9]) == [1; 4; 7; 5; 8; 9])); + +%!error vech (); + +%!error vech (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/miscellaneous/computer.m --- a/scripts/miscellaneous/computer.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/miscellaneous/computer.m Tue Jan 22 21:52:26 2008 +0000 @@ -72,3 +72,9 @@ endif endfunction + +%!assert((isstr (computer ()) +%! && computer () == octave_config_info ("canonical_host_type"))); + +%!warning a =computer(2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/miscellaneous/ls.m --- a/scripts/miscellaneous/ls.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/miscellaneous/ls.m Tue Jan 22 21:52:26 2008 +0000 @@ -78,3 +78,6 @@ endif endfunction + +%!error ls (1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/miscellaneous/version.m --- a/scripts/miscellaneous/version.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/miscellaneous/version.m Tue Jan 22 21:52:26 2008 +0000 @@ -33,3 +33,8 @@ vs = OCTAVE_VERSION; endfunction + +%!assert(isstr (version ()) && strcmp (version (), OCTAVE_VERSION)); + +%!warning version (1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/compan.m --- a/scripts/polynomial/compan.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/compan.m Tue Jan 22 21:52:26 2008 +0000 @@ -79,3 +79,16 @@ endif endfunction + +%!assert(all (all (compan ([1, 2, 3]) == [-2, -3; 1, 0]))); + +%!assert(all (all (compan ([1; 2; 3]) == [-2, -3; 1, 0]))); + +%!assert(isempty (compan (4))); + +%!assert(all (all (compan ([3, 2, 1]) == [-2/3, -1/3; 1, 0]))); + +%!error compan ([1,2;3,4]); + +%!error compan ([]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/conv.m --- a/scripts/polynomial/conv.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/conv.m Tue Jan 22 21:52:26 2008 +0000 @@ -73,3 +73,16 @@ endif endfunction + +%!assert(all (all (conv (ones (3, 1), ones (3, 1)) == [1, 2, 3, 2, 1]))); + +%!assert(all (all (conv (ones (1, 3), ones (3, 1)) == [1, 2, 3, 2, 1]))); + +%!assert(all (all (conv (3, [1, 2, 3]) == [3, 6, 9]))); + +%!error conv ([1, 2; 3, 4], 3); + +%!assert(conv (2, 3),6); + +%!error conv (2, []); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/deconv.m --- a/scripts/polynomial/deconv.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/deconv.m Tue Jan 22 21:52:26 2008 +0000 @@ -65,3 +65,20 @@ endif endfunction + +%!test +%! [b, r] = deconv ([3, 6, 9, 9], [1, 2, 3]); +%! assert(all (all (b == [3, 0])) && all (all (r == [0, 0, 0, 9]))); + +%!test +%! [b, r] = deconv ([3, 6], [1, 2, 3]); +%! assert(b == 0 && all (all (r == [0, 3, 6]))); + +%!test +%! [b, r] = deconv ([3, 6], [1; 2; 3]); +%! assert(b == 0 && all (all (r == [0, 3, 6]))); + +%!error [b, r] = deconv ([3, 6], [1, 2; 3, 4]);; + +%!error [b, r] = deconv ([3; 6], [1, 2, 3]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/poly.m --- a/scripts/polynomial/poly.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/poly.m Tue Jan 22 21:52:26 2008 +0000 @@ -75,3 +75,12 @@ endif endfunction + +%!assert(all (all (poly ([1, 2, 3]) == [1, -6, 11, -6]))); + +%!assert(all (all (abs (poly ([1, 2; 3, 4]) - [1, -5, -2]) < sqrt (eps)))); + +%!error poly ([1, 2, 3; 4, 5, 6]); + +%!assert(poly ([]),1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/polyderiv.m --- a/scripts/polynomial/polyderiv.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/polyderiv.m Tue Jan 22 21:52:26 2008 +0000 @@ -89,5 +89,13 @@ print_usage (); endif +endfunction -endfunction +%!assert(all (all (polyderiv ([1, 2, 3]) == [2, 2]))); + +%!assert(polyderiv (13) == 0); + +%!error polyderiv ([]); + +%!error polyderiv ([1, 2; 3, 4]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/polyfit.m --- a/scripts/polynomial/polyfit.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/polyfit.m Tue Jan 22 21:52:26 2008 +0000 @@ -104,3 +104,22 @@ p = p.'; endfunction + +%!test +%! x = [-2, -1, 0, 1, 2]; +%! assert(all (all (abs (polyfit (x, x.^2+x+1, 2) - [1, 1, 1]) < sqrt (eps)))); + +%!test +%! x = [-2, -1, 0, 1, 2]; +%! assert(all (all (abs (polyfit (x, x.^2+x+1, 3) - [0, 1, 1, 1]) < sqrt (eps)))); + +%!error polyfit ([1, 2; 3, 4], [1, 2; 3, 4], 4); + +%!test +%! x = [-2, -1, 0, 1, 2]; +%! fail("polyfit (x, x.^2+x+1)"); + +%!test +%! x = [-2, -1, 0, 1, 2]; +%! fail("polyfit (x, x.^2+x+1, [])"); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/polyreduce.m --- a/scripts/polynomial/polyreduce.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/polyreduce.m Tue Jan 22 21:52:26 2008 +0000 @@ -56,3 +56,14 @@ endif endfunction + +%!assert(all (all (polyreduce ([0, 0, 1, 2, 3]) == [1, 2, 3]))); + +%!assert(all (all (polyreduce ([1, 2, 3, 0, 0]) == [1, 2, 3, 0, 0]))); + +%!assert(all (all (polyreduce ([1, 0, 3]) == [1, 0, 3]))); + +%!assert(isempty (polyreduce ([]))); + +%!error polyreduce ([1, 2; 3, 4]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/polyval.m --- a/scripts/polynomial/polyval.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/polyval.m Tue Jan 22 21:52:26 2008 +0000 @@ -61,3 +61,16 @@ endfor endfunction + +%!assert(polyval ([1, 1, 1], 2) == 7); + +%!assert(all (all (polyval ([1, 1, 1], [0; 1; 2]) == [1; 3; 7]))); + +%!assert(isempty (polyval ([1, 1, 1], []))); + +%!assert(all (all (polyval ([1, 1, 1], [-1, 0; 1, 2]) == [1, 1; 3, 7]))); + +%!error polyval ([1, 2; 3, 4], [-1, 0; 1, 2]); + +%!assert(isempty (polyval ([], [-1, 0; 1, 2]))); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/polyvalm.m --- a/scripts/polynomial/polyvalm.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/polyvalm.m Tue Jan 22 21:52:26 2008 +0000 @@ -62,3 +62,8 @@ endif endfunction + +%!assert(isempty (polyvalm ([], [1, 2; 3, 4]))); + +%!error polyvalm ([1, 1, 1], [1, 2; 3, 4; 5, 6]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/polynomial/roots.m --- a/scripts/polynomial/roots.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/polynomial/roots.m Tue Jan 22 21:52:26 2008 +0000 @@ -113,3 +113,10 @@ endif endfunction + +%!assert(all (all (abs (roots ([1, -6, 11, -6]) - [3; 2; 1]) < sqrt (eps)))); + +%!assert(isempty (roots ([]))); + +%!error roots ([1, 2; 3, 4]); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/set/complement.m --- a/scripts/set/complement.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/set/complement.m Tue Jan 22 21:52:26 2008 +0000 @@ -57,3 +57,14 @@ endif endfunction + +%!assert(all (all (complement ([1, 2, 3], [3; 4; 5; 6]) == [4, 5, 6]))); + +%!assert(all (all (complement ([1, 2, 3], [3, 4, 5, 6]) == [4, 5, 6]))); + +%!assert(isempty (complement ([1, 2, 3], [3, 2, 1]))); + +%!error complement (1); + +%!error complement (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/set/create_set.m --- a/scripts/set/create_set.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/set/create_set.m Tue Jan 22 21:52:26 2008 +0000 @@ -60,3 +60,12 @@ endif endfunction + +%!assert(all (all (create_set ([1, 2; 3, 4; 2, 4]) == [1, 2, 3, 4]))); + +%!assert(all (all (create_set ([1; 2; 3; 4; 2; 4]) == [1, 2, 3, 4]))); + +%!assert(isempty (create_set ([]))); + +%!error create_set (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/set/union.m --- a/scripts/set/union.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/set/union.m Tue Jan 22 21:52:26 2008 +0000 @@ -74,3 +74,14 @@ endif endfunction + +%!assert(all (all (union ([1, 2, 4], [2, 3, 5]) == [1, 2, 3, 4, 5]))); + +%!assert(all (all (union ([1; 2; 4], [2, 3, 5]) == [1, 2, 3, 4, 5]))); + +%!assert(all (all (union ([1, 2, 3], [5; 7; 9]) == [1, 2, 3, 5, 7, 9]))); + +%!error union (1); + +%!error union (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/signal/unwrap.m --- a/scripts/signal/unwrap.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/signal/unwrap.m Tue Jan 22 21:52:26 2008 +0000 @@ -93,3 +93,44 @@ retval = a + r; endfunction + +%!function t = xassert(a,b,tol) +%! if (nargin == 1) +%! t = all(a(:)); +%! else +%! if (nargin == 2) +%! tol = 0; +%! endif +%! if (any (size(a) != size(b))) +%! t = 0; +%! elseif (any (abs(a(:) - b(:)) > tol)) +%! t = 0; +%! else +%! t = 1; +%! endif +%! endif +%! +%!test +%! +%! i = 0; +%! t = []; +%! +%! r = [0:100]; # original vector +%! w = r - 2*pi*floor((r+pi)/(2*pi)); # wrapped into [-pi,pi] +%! tol = 1e3*eps; # maximum expected deviation +%! +%! t(++i) = xassert(r, unwrap(w), tol); #unwrap single row +%! t(++i) = xassert(r', unwrap(w'), tol); #unwrap single column +%! t(++i) = xassert([r',r'], unwrap([w',w']), tol); #unwrap 2 columns +%! t(++i) = xassert([r;r], unwrap([w;w],[],2), tol); #verify that dim works +%! t(++i) = xassert(r+10, unwrap(10+w), tol); #verify that r(1)>pi works +%! +%! t(++i) = xassert(w', unwrap(w',[],2)); #unwrap col by rows should not change it +%! t(++i) = xassert(w, unwrap(w,[],1)); #unwrap row by cols should not change it +%! t(++i) = xassert([w;w], unwrap([w;w])); #unwrap 2 rows by cols should not change them +%! +%! ## verify that setting tolerance too low will cause bad results. +%! t(++i) = xassert(any(abs(r - unwrap(w,0.8)) > 100)); +%! +%! assert(all(t)); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/special-matrix/hankel.m --- a/scripts/special-matrix/hankel.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/special-matrix/hankel.m Tue Jan 22 21:52:26 2008 +0000 @@ -106,3 +106,13 @@ %!assert(hankel(1:3,3:6),[1,2,3,4;2,3,4,5;3,4,5,6]); %!assert(hankel(1:3,3:4),[1,2;2,3;3,4]); %!assert(hankel(1:3,4:6),[1,2,3;2,3,5;3,5,6]); + +%!assert((hankel (1) == 1 && hankel ([1, 2]) == [1, 2; 2, 0] +%! && hankel ([1, 2], [2; -1; -3]) == [1, 2, -1; 2, -1, -3])); + +%!error hankel ([1, 2; 3, 4], [1, 2; 3, 4]); + +%!error hankel (); + +%!error hankel (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/special-matrix/hilb.m --- a/scripts/special-matrix/hilb.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/special-matrix/hilb.m Tue Jan 22 21:52:26 2008 +0000 @@ -66,3 +66,11 @@ endif endfunction + +%!assert((hilb (2) == [1, 1/2; 1/2, 1/3] +%! && hilb (3) == [1, 1/2, 1/3; 1/2, 1/3, 1/4; 1/3, 1/4, 1/5])); + +%!error hilb (); + +%!error hilb (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/special-matrix/invhilb.m --- a/scripts/special-matrix/invhilb.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/special-matrix/invhilb.m Tue Jan 22 21:52:26 2008 +0000 @@ -107,3 +107,20 @@ endif endfunction + +%!test +%! result4 = [16, -120, 240, -140; +%! -120, 1200, -2700, 1680; +%! 240, -2700, 6480, -4200; +%! -140, 1680, -4200, 2800]; +%! +%! assert((invhilb (1) == 1 && invhilb (2) == [4, -6; -6, 12] +%! && invhilb (4) == result4 +%! && abs (invhilb (7) * hilb (7) - eye (7)) < sqrt (eps))); + +%!error invhilb ([1, 2]); + +%!error invhilb (); + +%!error invhilb (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/special-matrix/sylvester_matrix.m --- a/scripts/special-matrix/sylvester_matrix.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/special-matrix/sylvester_matrix.m Tue Jan 22 21:52:26 2008 +0000 @@ -51,3 +51,14 @@ endif endfunction + +%!assert((sylvester_matrix (1) == [1, 1; 1, -1] +%! && (sylvester_matrix (2) +%! == [1, 1, 1, 1; 1, -1, 1, -1; 1, 1, -1, -1; 1, -1, -1, 1]))); + +%!error sylvester_matrix ([1, 2; 3, 4]); + +%!error sylvester_matrix (); + +%!error sylvester_matrix (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/special-matrix/toeplitz.m --- a/scripts/special-matrix/toeplitz.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/special-matrix/toeplitz.m Tue Jan 22 21:52:26 2008 +0000 @@ -108,3 +108,14 @@ endfor endfunction + +%!assert((toeplitz (1) == 1 +%! && toeplitz ([1, 2, 3], [1; -3; -5]) == [1, -3, -5; 2, 1, -3; 3, 2, 1] +%! && toeplitz ([1, 2, 3], [1; -3i; -5i]) == [1, -3i, -5i; 2, 1, -3i; 3, 2, 1])); + +%!error toeplitz ([1, 2; 3, 4], 1); + +%!error toeplitz (); + +%!error toeplitz (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/special-matrix/vander.m --- a/scripts/special-matrix/vander.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/special-matrix/vander.m Tue Jan 22 21:52:26 2008 +0000 @@ -70,3 +70,14 @@ %! expect = [0,0,0,1; 1,1,1,1; 8,4,2,1; 27,9,3,1]; %! result = vander(c); %! assert(expect, result); + +%!assert((vander (1) == 1 && vander ([1, 2, 3]) == vander ([1; 2; 3]) +%! && vander ([1, 2, 3]) == [1, 1, 1; 4, 2, 1; 9, 3, 1] +%! && vander ([1, 2, 3]*i) == [-1, i, 1; -4, 2i, 1; -9, 3i, 1])); + +%!error vander ([1, 2; 3, 4]); + +%!error vander (); + +%!error vander (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/corrcoef.m --- a/scripts/statistics/base/corrcoef.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/corrcoef.m Tue Jan 22 21:52:26 2008 +0000 @@ -63,3 +63,15 @@ endif endfunction + +%!test +%! x = rand (10); +%! cc1 = corrcoef (x); +%! cc2 = corrcoef (x, x); +%! assert((size (cc1) == [10, 10] && size (cc2) == [10, 10] +%! && abs (cc1 - cc2) < sqrt (eps))); + +%!error corrcoef (); + +%!error corrcoef (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/cov.m --- a/scripts/statistics/base/cov.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/cov.m Tue Jan 22 21:52:26 2008 +0000 @@ -66,3 +66,14 @@ endif endfunction + +%!test +%! x = rand (10); +%! cx1 = cov (x); +%! cx2 = cov (x, x); +%! assert(size (cx1) == [10, 10] && size (cx2) == [10, 10] && cx1 == cx2); + +%!error cov (); + +%!error cov (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/kurtosis.m --- a/scripts/statistics/base/kurtosis.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/kurtosis.m Tue Jan 22 21:52:26 2008 +0000 @@ -87,3 +87,13 @@ retval(ind) = x(ind) ./ (c * s(ind) .^ 4) - 3; endfunction + +%!test +%! x = [-1; 0; 0; 0; 1]; +%! y = [x, 2*x]; +%! assert(all (abs (kurtosis (y) - [-1.4, -1.4]) < sqrt (eps))); + +%!error kurtosis (); + +%!error kurtosis (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/mahalanobis.m --- a/scripts/statistics/base/mahalanobis.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/mahalanobis.m Tue Jan 22 21:52:26 2008 +0000 @@ -55,3 +55,9 @@ retval = (Xm - Ym) * Winv * (Xm - Ym)'; endfunction + +%!error mahalanobis (); + +%!error mahalanobis (1, 2, 3); + + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/mean.m --- a/scripts/statistics/base/mean.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/mean.m Tue Jan 22 21:52:26 2008 +0000 @@ -116,3 +116,14 @@ endif endfunction + +%!test +%! x = -10:10; +%! y = x'; +%! z = [y, y+10]; +%! assert(mean (x) == 0 && mean (y) == 0 && mean (z) == [0, 10]); + +%!error mean (); + +%!error mean (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/median.m --- a/scripts/statistics/base/median.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/median.m Tue Jan 22 21:52:26 2008 +0000 @@ -94,3 +94,19 @@ endif endfunction + +%!test +%! x = [1, 2, 3, 4, 5, 6]; +%! x2 = x'; +%! y = [1, 2, 3, 4, 5, 6, 7]; +%! y2 = y'; +%! +%! assert((median (x) == median (x2) && median (x) == 3.5 +%! && median (y) == median (y2) && median (y) == 4 +%! && median ([x2, 2*x2]) == [3.5, 7] +%! && median ([y2, 3*y2]) == [4, 12])); + +%!error median (); + +%!error median (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/skewness.m --- a/scripts/statistics/base/skewness.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/skewness.m Tue Jan 22 21:52:26 2008 +0000 @@ -86,3 +86,8 @@ retval(ind) = x(ind) ./ (c * s(ind) .^ 3); endfunction + +%!error skewness (); + +%!error skewness (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/statistics/base/std.m --- a/scripts/statistics/base/std.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/statistics/base/std.m Tue Jan 22 21:52:26 2008 +0000 @@ -90,3 +90,13 @@ endif endfunction + +%!test +%! x = ones (10, 2); +%! y = [1, 3]; +%! assert(std (x) == [0, 0] && abs (std (y) - sqrt (2)) < sqrt (eps)); + +%!error std (); + +%!error std (1, 2, 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/bin2dec.m --- a/scripts/strings/bin2dec.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/bin2dec.m Tue Jan 22 21:52:26 2008 +0000 @@ -49,3 +49,10 @@ endif endfunction + +%!assert(bin2dec ("1110") == 14); + +%!error bin2dec (); + +%!error bin2dec ("str", 1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/blanks.m --- a/scripts/strings/blanks.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/blanks.m Tue Jan 22 21:52:26 2008 +0000 @@ -44,3 +44,10 @@ %!assert(blanks (0), "") %!assert(blanks (5), " ") %!assert(blanks (10), " ") + +%!assert(strcmp (blanks (3), " ")); + +%!error blanks (); + +%!error blanks (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/deblank.m --- a/scripts/strings/deblank.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/deblank.m Tue Jan 22 21:52:26 2008 +0000 @@ -52,3 +52,12 @@ endif endfunction + +%!assert(strcmp (deblank (" f o o "), " f o o")); + +%!error deblank (); + +%!error deblank ("foo", "bar"); + +%!error deblank (1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/dec2bin.m --- a/scripts/strings/dec2bin.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/dec2bin.m Tue Jan 22 21:52:26 2008 +0000 @@ -49,3 +49,12 @@ endif endfunction + +%!assert(strcmp (dec2bin (14), "1110")); + +%!error dec2bin (); + +%!assert(strcmp (dec2bin (14, 6), "001110")); + +%!error dec2bin (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/dec2hex.m --- a/scripts/strings/dec2hex.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/dec2hex.m Tue Jan 22 21:52:26 2008 +0000 @@ -49,3 +49,12 @@ endif endfunction + +%!assert(strcmp (tolower (dec2hex (2748)), "abc")); + +%!error dec2hex (); + +%!assert(strcmp (tolower (dec2hex (2748, 5)), "00abc")); + +%!error dec2hex (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/findstr.m --- a/scripts/strings/findstr.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/findstr.m Tue Jan 22 21:52:26 2008 +0000 @@ -128,3 +128,12 @@ endif endfunction + +%!assert((findstr ("abababa", "a") == [1, 3, 5, 7] +%! && findstr ("abababa", "aba") == [1, 3, 5] +%! && findstr ("abababa", "aba", 0) == [1, 5])); + +%!error findstr (); + +%!error findstr ("foo", "bar", 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/hex2dec.m --- a/scripts/strings/hex2dec.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/hex2dec.m Tue Jan 22 21:52:26 2008 +0000 @@ -45,3 +45,10 @@ endif endfunction + +%!assert(hex2dec ("12b") == 299 && hex2dec ("12B") == 299); + +%!error hex2dec (); + +%!error hex2dec ("str", 1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/index.m --- a/scripts/strings/index.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/index.m Tue Jan 22 21:52:26 2008 +0000 @@ -131,3 +131,11 @@ %!assert(index("astringbstringcstring", "str", "last"), 16) %!assert(index("astringbstringcstring", "string", "last"), 16) %!assert(index("abc---", "abc+++", "last"), 0) + + +%!assert(index ("foobarbaz", "b") == 4 && index ("foobarbaz", "z") == 9); + +%!error index (); + +%!error index ("foo", "bar", 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/rindex.m --- a/scripts/strings/rindex.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/rindex.m Tue Jan 22 21:52:26 2008 +0000 @@ -47,3 +47,10 @@ n = index (s, t, "last"); endfunction + +%!assert(rindex ("foobarbaz", "b") == 7 && rindex ("foobarbaz", "o") == 3); + +%!error rindex (); + +%!error rindex ("foo", "bar", 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/split.m --- a/scripts/strings/split.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/split.m Tue Jan 22 21:52:26 2008 +0000 @@ -98,3 +98,12 @@ endif endfunction + +%!assert(all (all (split ("Test string", "t") == ["Tes "; " s "; "ring"]))); + +%!error split (); + +%!assert(all (strcmp (split ("foo bar baz", " ", 2), ["foo"; "bar baz"]))); + +%!error split ("foo", "bar", 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/str2mat.m --- a/scripts/strings/str2mat.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/str2mat.m Tue Jan 22 21:52:26 2008 +0000 @@ -74,3 +74,10 @@ endfor endfunction + +%!assert(strcmp (str2mat ("a", "bb", "ccc"), ["a "; "bb "; "ccc"])); + +%!error str2mat (); + +%!assert(all (str2mat (1, 2, 3) == setstr ([1; 2; 3]))); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/str2num.m --- a/scripts/strings/str2num.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/str2num.m Tue Jan 22 21:52:26 2008 +0000 @@ -39,3 +39,10 @@ endif endfunction + +%!assert(str2num ("-1.3e2") == -130 && str2num ("[1, 2; 3, 4]") == [1, 2; 3, 4]); + +%!error str2num (); + +%!error str2num ("string", 1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/strcat.m --- a/scripts/strings/strcat.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/strcat.m Tue Jan 22 21:52:26 2008 +0000 @@ -56,3 +56,11 @@ %!assert(strcat("ab ", "ab "), "ab ab ") ## 2d %!assert(strcat(["ab ";"cde"], ["ab ";"cde"]), ["ab ab ";"cdecde"]) + +%!assert((strcmp (strcat ("foo", "bar"), "foobar") +%! && strcmp (strcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"]))); + +%!error strcat (); + +%!error strcat (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/strrep.m --- a/scripts/strings/strrep.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/strrep.m Tue Jan 22 21:52:26 2008 +0000 @@ -88,3 +88,11 @@ endif endfunction + +%!assert(strcmp (strrep ("This is a test string", "is", "&%$"), +%! "Th&%$ &%$ a test string")); + +%!error strrep (); + +%!error strrep ("foo", "bar", 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/strings/substr.m --- a/scripts/strings/substr.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/strings/substr.m Tue Jan 22 21:52:26 2008 +0000 @@ -69,3 +69,10 @@ endif endfunction + +%!assert(strcmp (substr ("This is a test string", 6, 9), "is a test")); + +%!error substr (); + +%!error substr ("foo", 2, 3, 4); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/time/asctime.m --- a/scripts/time/asctime.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/time/asctime.m Tue Jan 22 21:52:26 2008 +0000 @@ -43,3 +43,12 @@ endif endfunction + +%!test +%! t = time (); +%! assert(strcmp (asctime (localtime (t)), ctime (t))); + +%!error asctime (); + +%!error asctime (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/time/clock.m --- a/scripts/time/clock.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/time/clock.m Tue Jan 22 21:52:26 2008 +0000 @@ -48,3 +48,9 @@ retval(6) = tm.sec + tm.usec / 1e6; endfunction + +%!test +%! t1 = clock; +%! t2 = str2num (strftime ("[%Y, %m, %d, %H, %M, %S]", localtime (time ()))); +%! assert(etime (t1, t2) < 1); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/time/ctime.m --- a/scripts/time/ctime.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/time/ctime.m Tue Jan 22 21:52:26 2008 +0000 @@ -43,3 +43,12 @@ endif endfunction + +%!test +%! t = time (); +%! assert(strcmp (asctime (localtime (t)), ctime (t))); + +%!error ctime (); + +%!error ctime (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/time/date.m --- a/scripts/time/date.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/time/date.m Tue Jan 22 21:52:26 2008 +0000 @@ -37,3 +37,6 @@ retval = strftime ("%d-%b-%Y", localtime (time ())); endfunction + +%!assert(strcmp (date (), strftime ("%d-%b-%Y", localtime (time ())))); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/time/etime.m --- a/scripts/time/etime.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/time/etime.m Tue Jan 22 21:52:26 2008 +0000 @@ -56,3 +56,18 @@ %! t1 = [1900,12,31,23,59,59; 1900,2,28,23,59,59]; %! t2 = [1901,1,1,0,0,0; 1900,3,1,0,0,0]; %! assert(etime(t2, t1), [1;1]); + +%!test +%! t1 = [1993, 8, 20, 4, 56, 1]; +%! t2 = [1993, 8, 21, 4, 56, 1]; +%! t3 = [1993, 8, 20, 5, 56, 1]; +%! t4 = [1993, 8, 20, 4, 57, 1]; +%! t5 = [1993, 8, 20, 4, 56, 14]; +%! +%! assert((etime (t2, t1) == 86400 && etime (t3, t1) == 3600 +%! && etime (t4, t1) == 60 && etime (t5, t1) == 13)); + +%!error etime (); + +%!error etime (1, 2, 3); + diff -r 8a3b2ccc4e11 -r 83a8781b529d scripts/time/is_leap_year.m --- a/scripts/time/is_leap_year.m Tue Jan 22 21:34:24 2008 +0000 +++ b/scripts/time/is_leap_year.m Tue Jan 22 21:52:26 2008 +0000 @@ -47,3 +47,10 @@ | rem (year, 400) == 0); endfunction + +%!assert((is_leap_year (2000) == 1 && is_leap_year (1976) == 1 +%! && is_leap_year (1000) == 0 && is_leap_year (1800) == 0 +%! && is_leap_year (1600) == 1)); + +%!error is_leap_year (1, 2); + diff -r 8a3b2ccc4e11 -r 83a8781b529d test/ChangeLog --- a/test/ChangeLog Tue Jan 22 21:34:24 2008 +0000 +++ b/test/ChangeLog Tue Jan 22 21:52:26 2008 +0000 @@ -1,3 +1,9 @@ +2008-01-22 Thomas Weber + + * test_linalg.m, test_matrix.m, test_number.m, test_poly.m, + test_signal.m, test_stats.m, test_string.m, test_system.m: + Move tests to individual source files. + 2008-01-15 Thomas Weber * test_arith.m: Move tests to source files. diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_linalg.m --- a/test/test_linalg.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_linalg.m Tue Jan 22 21:52:26 2008 +0000 @@ -18,18 +18,6 @@ %% Automatically generated from DejaGNU files -%% test/octave.test/linalg/cond-1.m -%!assert(abs (cond ([1, 2; 2, 1]) - 3) < sqrt (eps)); - -%% test/octave.test/linalg/cond-2.m -%!assert(cond ([1, 2, 3; 4, 5, 6; 7, 8, 9]) > 1.0e+16); - -%% test/octave.test/linalg/cond-3.m -%!error cond (); - -%% test/octave.test/linalg/cond-4.m -%!error cond (1, 2); - %% test/octave.test/linalg/det-1.m %!assert(det ([1, 2; 3, 4]) == -2); @@ -103,21 +91,6 @@ %% test/octave.test/linalg/inv-4.m %!error inv ([1, 2; 3, 4; 5, 6]); -%% test/octave.test/linalg/trace-1.m -%!assert(trace ([1, 2; 3, 4]) == 5); - -%% test/octave.test/linalg/trace-2.m -%!assert(trace ([1, 2; 3, 4; 5, 6]) == 5); - -%% test/octave.test/linalg/trace-3.m -%!assert(trace ([1, 3, 5; 2, 4, 6]) == 5); - -%% test/octave.test/linalg/trace-4.m -%!error trace (); - -%% test/octave.test/linalg/trace-5.m -%!error trace (1, 2); - %% test/octave.test/linalg/chol-1.m %!test %! rt2 = sqrt (2); diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_matrix.m --- a/test/test_matrix.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_matrix.m Tue Jan 22 21:52:26 2008 +0000 @@ -48,25 +48,6 @@ %% test/octave.test/matrix/any-3.m %!error any (1, 2, 3); -%% test/octave.test/matrix/diff-1.m -%!assert((diff ([1, 2, 3, 4]) == [1, 1, 1] -%! && diff ([1, 3, 7, 19], 2) == [2, 8] -%! && diff ([1, 2; 5, 4; 8, 7; 9, 6; 3, 1]) == [4, 2; 3, 3; 1, -1; -6, -5] -%! && diff ([1, 2; 5, 4; 8, 7; 9, 6; 3, 1], 3) == [-1, -5; -5, 0] -%! && isempty (diff (1)))); - -%% test/octave.test/matrix/diff-2.m -%!error diff ([1, 2; 3, 4], -1); - -%% test/octave.test/matrix/diff-3.m -%!error diff ("foo"); - -%% test/octave.test/matrix/diff-4.m -%!error diff (); - -%% test/octave.test/matrix/diff-5.m -%!error diff (1, 2, 3, 4); - %% test/octave.test/matrix/find-1.m %!assert((find ([1, 0, 1, 0, 1]) == [1, 3, 5] %! && find ([1; 0; 3; 0; 1]) == [1; 3; 5] @@ -81,48 +62,6 @@ %% test/octave.test/matrix/find-3.m %!error find (); -%% test/octave.test/matrix/fliplr-1.m -%!assert((fliplr ([1, 2; 3, 4]) == [2, 1; 4, 3] -%! && fliplr ([1, 2; 3, 4; 5, 6]) == [2, 1; 4, 3; 6, 5] -%! && fliplr ([1, 2, 3; 4, 5, 6]) == [3, 2, 1; 6, 5, 4])); - -%% test/octave.test/matrix/fliplr-2.m -%!error fliplr(); - -%% test/octave.test/matrix/fliplr-3.m -%!error fliplr (1, 2); - -%% test/octave.test/matrix/flipud-1.m -%!assert((flipud ([1, 2; 3, 4]) == [3, 4; 1, 2] -%! && flipud ([1, 2; 3, 4; 5, 6]) == [5, 6; 3, 4; 1, 2] -%! && flipud ([1, 2, 3; 4, 5, 6]) == [4, 5, 6; 1, 2, 3])); - -%% test/octave.test/matrix/flipud-2.m -%!error flipud (); - -%% test/octave.test/matrix/flipud-3.m -%!error flipud (1, 2); - -%% test/octave.test/matrix/rot90-1.m -%!test -%! x1 = [1, 2; -%! 3, 4]; -%! x2 = [2, 4; -%! 1, 3]; -%! x3 = [4, 3; -%! 2, 1]; -%! x4 = [3, 1; -%! 4, 2]; -%! -%! assert((rot90 (x1)== x2 && rot90 (x1, 2) == x3 && rot90 (x1, 3) == x4 -%! && rot90 (x1, 4) == x1 && rot90 (x1, 5) == x2 && rot90 (x1, -1) == x4)); - -%% test/octave.test/matrix/rot90-2.m -%!error rot90 (); - -%% test/octave.test/matrix/rot90-3.m -%!error rot90 (1, 2, 3); - %% test/octave.test/matrix/reshape-1.m %!assert((size (reshape (rand (4, 4), 2, 8)) == [2, 8] %! && size (reshape (rand (4, 4), 8, 2)) == [8, 2] @@ -140,27 +79,6 @@ %% test/octave.test/matrix/reshape-4.m %!error reshape (1, 2, 3, 4); -%% test/octave.test/matrix/shift-1.m -%!test -%! a = [1, 2, 3]; -%! b = [4, 5, 6]; -%! c = [7, 8, 9]; -%! -%! r = [a, b, c]; -%! m = [a; b; c]; -%! -%! assert((shift (r, 3) == [c, a, b] -%! && shift (r, -6) == [c, a, b] -%! && shift (r, -3) == [b, c, a] -%! && shift (m, 1) == [c; a; b] -%! && shift (m, -2) == [c; a; b])); - -%% test/octave.test/matrix/shift-2.m -%!error shift (); - -%% test/octave.test/matrix/shift-3.m -%!error shift (1, 2, 3, 4); - %% test/octave.test/matrix/sort-1.m %!test %! a = [1, 2; 2, 3; 3, 1]; @@ -175,67 +93,7 @@ %% test/octave.test/matrix/sort-3.m %!error sort (1, 2, 3, 4); -%% test/octave.test/matrix/tril-1.m -%!test -%! a = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; -%! -%! l0 = [1, 0, 0; 4, 5, 0; 7, 8, 9; 10, 11, 12]; -%! l1 = [1, 2, 0; 4, 5, 6; 7, 8, 9; 10, 11, 12]; -%! l2 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; -%! lm1 = [0, 0, 0; 4, 0, 0; 7, 8, 0; 10, 11, 12]; -%! lm2 = [0, 0, 0; 0, 0, 0; 7, 0, 0; 10, 11, 0]; -%! lm3 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 10, 0, 0]; -%! lm4 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 0, 0, 0]; -%! -%! assert((tril (a, -4) == lm4 && tril (a, -3) == lm3 -%! && tril (a, -2) == lm2 && tril (a, -1) == lm1 -%! && tril (a) == l0 && tril (a, 1) == l1 && tril (a, 2) == l2)); -%% test/octave.test/matrix/tril-2.m -%!error tril (); - -%% test/octave.test/matrix/tril-3.m -%!error tril (1, 2, 3); - -%% test/octave.test/matrix/triu-1.m -%!test -%! a = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; -%! -%! u0 = [1, 2, 3; 0, 5, 6; 0, 0, 9; 0, 0, 0]; -%! u1 = [0, 2, 3; 0, 0, 6; 0, 0, 0; 0, 0, 0]; -%! u2 = [0, 0, 3; 0, 0, 0; 0, 0, 0; 0, 0, 0]; -%! u3 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 0, 0, 0]; -%! um1 = [1, 2, 3; 4, 5, 6; 0, 8, 9; 0, 0, 12]; -%! um2 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 0, 11, 12]; -%! um3 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; -%! -%! assert((triu (a, -3) == um3 && triu (a, -2) == um2 -%! && triu (a, -1) == um1 && triu (a) == u0 && triu (a, 1) == u1 -%! && triu (a, 2) == u2 && triu (a, 3) == u3)); - -%% test/octave.test/matrix/triu-2.m -%!error triu (); - -%% test/octave.test/matrix/triu-3.m -%!error triu (1, 2, 3); - -%% test/octave.test/matrix/vec-1.m -%!assert(vec ([1, 2; 3, 4]) == [1; 3; 2; 4] && vec ([1, 3, 2, 4]) == [1; 3; 2; 4]); - -%% test/octave.test/matrix/vec-2.m -%!error vec (); - -%% test/octave.test/matrix/vec-3.m -%!error vec (1, 2); - -%% test/octave.test/matrix/vech-1.m -%!assert(all (vech ([1, 2, 3; 4, 5, 6; 7, 8, 9]) == [1; 4; 7; 5; 8; 9])); - -%% test/octave.test/matrix/vech-2.m -%!error vech (); - -%% test/octave.test/matrix/vech-3.m -%!error vech (1, 2); %% test/octave.test/matrix/eye-1.m %!test @@ -354,108 +212,3 @@ %! warn_fortran_indexing = 1; %! fail("linspace ([1, 2; 3, 4], 5, 6)","warning"); -%% test/octave.test/matrix/logspace-1.m -%!test -%! x1 = logspace (1, 2); -%! x2 = logspace (1, 2, 10); -%! x3 = logspace (1, -2, 10); -%! x4 = logspace (1, pi, 10); -%! assert((size (x1) == [1, 50] && x1(1) == 10 && x1(50) == 100 -%! && size (x2) == [1, 10] && x2(1) == 10 && x2(10) == 100 -%! && size (x3) == [1, 10] && x3(1) == 10 && x3(10) == 0.01 -%! && size (x4) == [1, 10] && x4(1) == 10 && abs (x4(10) - pi) < sqrt (eps))); - -%% test/octave.test/matrix/logspace-2.m -%!error logspace ([1, 2; 3, 4], 5, 6); - -%% test/octave.test/matrix/logspace-3.m -%!error logspace (); - -%% test/octave.test/matrix/logspace-4.m -%!error logspace (1, 2, 3, 4); - -%% test/octave.test/matrix/sylvester_matrix-1.m -%!assert((sylvester_matrix (1) == [1, 1; 1, -1] -%! && (sylvester_matrix (2) -%! == [1, 1, 1, 1; 1, -1, 1, -1; 1, 1, -1, -1; 1, -1, -1, 1]))); - -%% test/octave.test/matrix/sylvester_matrix-2.m -%!error sylvester_matrix ([1, 2; 3, 4]); - -%% test/octave.test/matrix/sylvester_matrix-3.m -%!error sylvester_matrix (); - -%% test/octave.test/matrix/sylvester_matrix-4.m -%!error sylvester_matrix (1, 2); - -%% test/octave.test/matrix/hankel-1.m -%!assert((hankel (1) == 1 && hankel ([1, 2]) == [1, 2; 2, 0] -%! && hankel ([1, 2], [2; -1; -3]) == [1, 2, -1; 2, -1, -3])); - -%% test/octave.test/matrix/hankel-2.m -%!error hankel ([1, 2; 3, 4], [1, 2; 3, 4]); - -%% test/octave.test/matrix/hankel-3.m -%!error hankel (); - -%% test/octave.test/matrix/hankel-4.m -%!error hankel (1, 2, 3); - -%% test/octave.test/matrix/hilb-1.m -%!assert((hilb (2) == [1, 1/2; 1/2, 1/3] -%! && hilb (3) == [1, 1/2, 1/3; 1/2, 1/3, 1/4; 1/3, 1/4, 1/5])); - -%% test/octave.test/matrix/hilb-2.m -%!error hilb (); - -%% test/octave.test/matrix/hilb-3.m -%!error hilb (1, 2); - -%% test/octave.test/matrix/invhilb-1.m -%!test -%! result4 = [16, -120, 240, -140; -%! -120, 1200, -2700, 1680; -%! 240, -2700, 6480, -4200; -%! -140, 1680, -4200, 2800]; -%! -%! assert((invhilb (1) == 1 && invhilb (2) == [4, -6; -6, 12] -%! && invhilb (4) == result4 -%! && abs (invhilb (7) * hilb (7) - eye (7)) < sqrt (eps))); - -%% test/octave.test/matrix/invhilb-2.m -%!error invhilb ([1, 2]); - -%% test/octave.test/matrix/invhilb-3.m -%!error invhilb (); - -%% test/octave.test/matrix/invhilb-4.m -%!error invhilb (1, 2); - -%% test/octave.test/matrix/toeplitz-1.m -%!assert((toeplitz (1) == 1 -%! && toeplitz ([1, 2, 3], [1; -3; -5]) == [1, -3, -5; 2, 1, -3; 3, 2, 1] -%! && toeplitz ([1, 2, 3], [1; -3i; -5i]) == [1, -3i, -5i; 2, 1, -3i; 3, 2, 1])); - -%% test/octave.test/matrix/toeplitz-2.m -%!error toeplitz ([1, 2; 3, 4], 1); - -%% test/octave.test/matrix/toeplitz-3.m -%!error toeplitz (); - -%% test/octave.test/matrix/toeplitz-4.m -%!error toeplitz (1, 2, 3); - -%% test/octave.test/matrix/vander-1.m -%!assert((vander (1) == 1 && vander ([1, 2, 3]) == vander ([1; 2; 3]) -%! && vander ([1, 2, 3]) == [1, 1, 1; 4, 2, 1; 9, 3, 1] -%! && vander ([1, 2, 3]*i) == [-1, i, 1; -4, 2i, 1; -9, 3i, 1])); - -%% test/octave.test/matrix/vander-2.m -%!error vander ([1, 2; 3, 4]); - -%% test/octave.test/matrix/vander-3.m -%!error vander (); - -%% test/octave.test/matrix/vander-4.m -%!error vander (1, 2); - diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_number.m --- a/test/test_number.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_number.m Tue Jan 22 21:52:26 2008 +0000 @@ -58,151 +58,3 @@ %% test/octave.test/number/ismatrix-10.m %!error ismatrix ([1, 2; 3, 4], 2); -%% test/octave.test/number/isvector-1.m -%!assert(isvector (1)); - -%% test/octave.test/number/isvector-2.m -%!assert(isvector ([1; 2; 3])); - -%% test/octave.test/number/isvector-3.m -%!assert(!(isvector ([]))); - -%% test/octave.test/number/isvector-4.m -%!assert(!(isvector ([1, 2; 3, 4]))); - -%% test/octave.test/number/isvector-5.m -%!test -%! warn_str_to_num = 0; -%! assert((isvector ("t"))); - -%% test/octave.test/number/isvector-6.m -%!test -%! warn_str_to_num = 0; -%! assert((isvector ("test"))); - -%% test/octave.test/number/isvector-7.m -%!assert(!(isvector (["test"; "ing"]))); - -%% test/octave.test/number/isvector-8.m -%!test -%! s.a = 1; -%! assert((isvector (s))); - -%% test/octave.test/number/isvector-9.m -%!error isvector (); - -%% test/octave.test/number/isvector-10.m -%!error isvector ([1, 2], 2); - -%% test/octave.test/number/isscalar-1.m -%!assert(isscalar (1)); - -%% test/octave.test/number/isscalar-2.m -%!assert(!(isscalar ([1, 2]))); - -%% test/octave.test/number/isscalar-3.m -%!assert(!(isscalar ([]))); - -%% test/octave.test/number/isscalar-4.m -%!assert(!(isscalar ([1, 2; 3, 4]))); - -%% test/octave.test/number/isscalar-5.m -%!test -%! warn_str_to_num = 0; -%! assert((isscalar ("t"))); - -%% test/octave.test/number/isscalar-6.m -%!assert(!(isscalar ("test"))); - -%% test/octave.test/number/isscalar-7.m -%!assert(!(isscalar (["test"; "ing"]))); - -%% test/octave.test/number/isscalar-8.m -%!test -%! s.a = 1; -%! assert((isscalar (s))); - -%% test/octave.test/number/isscalar-9.m -%!error isscalar (); - -%% test/octave.test/number/isscalar-10.m -%!error isscalar (1, 2); - -%% test/octave.test/number/issquare-1.m -%!assert(issquare (1)); - -%% test/octave.test/number/issquare-2.m -%!assert(!(issquare ([1, 2]))); - -%% test/octave.test/number/issquare-3.m -%!assert(!(issquare ([]))); - -%% test/octave.test/number/issquare-4.m -%!assert(issquare ([1, 2; 3, 4]) == 2); - -%% test/octave.test/number/issquare-5.m -%!test -%! warn_str_to_num = 0; -%! assert(!(issquare ("t"))); - -%% test/octave.test/number/issquare-6.m -%!assert(!(issquare ("test"))); - -%% test/octave.test/number/issquare-7.m -%!test -%! warn_str_to_num = 0; -%! assert(!(issquare (["test"; "ing"; "1"; "2"]))); - -%% test/octave.test/number/issquare-8.m -%!test -%! s.a = 1; -%! assert(!(issquare (s))); - -%% test/octave.test/number/issquare-9.m -%!assert(!(issquare ([1, 2; 3, 4; 5, 6]))); - -%% test/octave.test/number/issquare-10.m -%!error issquare (); - -%% test/octave.test/number/issquare-11.m -%!error issquare ([1, 2; 3, 4], 2); - -%% test/octave.test/number/issymmetric-1.m -%!assert(issymmetric (1)); - -%% test/octave.test/number/issymmetric-2.m -%!assert(!(issymmetric ([1, 2]))); - -%% test/octave.test/number/issymmetric-3.m -%!assert(!(issymmetric ([]))); - -%% test/octave.test/number/issymmetric-4.m -%!assert(issymmetric ([1, 2; 2, 1]) == 2); - -%% test/octave.test/number/issymmetric-5.m -%!test -%! warn_str_to_num = 0; -%! assert(!(issymmetric ("t"))); - -%% test/octave.test/number/issymmetric-6.m -%!assert(!(issymmetric ("test"))); - -%% test/octave.test/number/issymmetric-7.m -%!test -%! warn_str_to_num = 0; -%! assert(!(issymmetric (["te"; "et"]))); - -%% test/octave.test/number/issymmetric-8.m -%!test -%! s.a = 1; -%! assert(!(issymmetric (s))); - -%% test/octave.test/number/issymmetric-9.m -%!assert(issymmetric ([1, 2.1; 2, 1.1], 0.2) == 2); - -%% test/octave.test/number/issymmetric-10.m -%!error issymmetric ([1, 2; 2, 1], 0, 0); - -%% test/octave.test/number/issymmetric-11.m -%!error issymmetric (); - diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_poly.m --- a/test/test_poly.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_poly.m Tue Jan 22 21:52:26 2008 +0000 @@ -18,167 +18,3 @@ %% Automatically generated from DejaGNU files -%% test/octave.test/poly/compan-1.m -%!assert(all (all (compan ([1, 2, 3]) == [-2, -3; 1, 0]))); - -%% test/octave.test/poly/compan-2.m -%!assert(all (all (compan ([1; 2; 3]) == [-2, -3; 1, 0]))); - -%% test/octave.test/poly/compan-3.m -%!assert(isempty (compan (4))); - -%% test/octave.test/poly/compan-4.m -%!assert(all (all (compan ([3, 2, 1]) == [-2/3, -1/3; 1, 0]))); - -%% test/octave.test/poly/compan-5.m -%!error compan ([1,2;3,4]); - -%% test/octave.test/poly/compan-6.m -%!error compan ([]); - -%% test/octave.test/poly/conv-1.m -%!assert(all (all (conv (ones (3, 1), ones (3, 1)) == [1, 2, 3, 2, 1]))); - -%% test/octave.test/poly/conv-2.m -%!assert(all (all (conv (ones (1, 3), ones (3, 1)) == [1, 2, 3, 2, 1]))); - -%% test/octave.test/poly/conv-3.m -%!assert(all (all (conv (3, [1, 2, 3]) == [3, 6, 9]))); - -%% test/octave.test/poly/conv-4.m -%!error conv ([1, 2; 3, 4], 3); - -%% test/octave.test/poly/conv-5.m -%!assert(conv (2, 3),6); - -%% test/octave.test/poly/conv-6.m -%!error conv (2, []); - -%% test/octave.test/poly/deconv-1.m -%!test -%! [b, r] = deconv ([3, 6, 9, 9], [1, 2, 3]); -%! assert(all (all (b == [3, 0])) && all (all (r == [0, 0, 0, 9]))); - -%% test/octave.test/poly/deconv-2.m -%!test -%! [b, r] = deconv ([3, 6], [1, 2, 3]); -%! assert(b == 0 && all (all (r == [0, 3, 6]))); - -%% test/octave.test/poly/deconv-3.m -%!test -%! [b, r] = deconv ([3, 6], [1; 2; 3]); -%! assert(b == 0 && all (all (r == [0, 3, 6]))); - -%% test/octave.test/poly/deconv-4.m -%!error [b, r] = deconv ([3, 6], [1, 2; 3, 4]);; - -%% test/octave.test/poly/deconv-5.m -%!error [b, r] = deconv ([3; 6], [1, 2, 3]); - -%% test/octave.test/poly/poly-1.m -%!assert(all (all (poly ([1, 2, 3]) == [1, -6, 11, -6]))); - -%% test/octave.test/poly/poly-2.m -%!assert(all (all (abs (poly ([1, 2; 3, 4]) - [1, -5, -2]) < sqrt (eps)))); - -%% test/octave.test/poly/poly-3.m -%!error poly ([1, 2, 3; 4, 5, 6]); - -%% test/octave.test/poly/poly-4.m -%!assert(poly ([]),1); - -%% test/octave.test/poly/polyderiv-1.m -%!assert(all (all (polyderiv ([1, 2, 3]) == [2, 2]))); - -%% test/octave.test/poly/polyderiv-2.m -%!assert(polyderiv (13) == 0); - -%% test/octave.test/poly/polyderiv-3.m -%!error polyderiv ([]); - -%% test/octave.test/poly/polyderiv-4.m -%!error polyderiv ([1, 2; 3, 4]); - -%% test/octave.test/poly/polyfit-1.m -%!test -%! x = [-2, -1, 0, 1, 2]; -%! assert(all (all (abs (polyfit (x, x.^2+x+1, 2) - [1, 1, 1]) < sqrt (eps)))); - -%% test/octave.test/poly/polyfit-2.m -%!test -%! x = [-2, -1, 0, 1, 2]; -%! assert(all (all (abs (polyfit (x, x.^2+x+1, 3) - [0, 1, 1, 1]) < sqrt (eps)))); - -%% test/octave.test/poly/polyfit-3.m -%!error polyfit ([1, 2; 3, 4], [1, 2; 3, 4], 4); - -%% test/octave.test/poly/polyfit-4.m -%!test -%! x = [-2, -1, 0, 1, 2]; -%! fail("polyfit (x, x.^2+x+1)"); - -%% test/octave.test/poly/polyfit-5.m -%!test -%! x = [-2, -1, 0, 1, 2]; -%! fail("polyfit (x, x.^2+x+1, [])"); - -%% test/octave.test/poly/polyinteg-1.m -%!assert(all (all (polyinteg ([2, 2]) == [1, 2, 0]))); - -%% test/octave.test/poly/polyinteg-2.m -%!assert(isempty (polyinteg ([]))); - -%% test/octave.test/poly/polyinteg-3.m -%!assert(all (all (polyinteg (3) == [3, 0]))); - -%% test/octave.test/poly/polyinteg-4.m -%!error polyinteg ([1, 2; 3, 4]); - -%% test/octave.test/poly/polyreduce-1.m -%!assert(all (all (polyreduce ([0, 0, 1, 2, 3]) == [1, 2, 3]))); - -%% test/octave.test/poly/polyreduce-2.m -%!assert(all (all (polyreduce ([1, 2, 3, 0, 0]) == [1, 2, 3, 0, 0]))); - -%% test/octave.test/poly/polyreduce-3.m -%!assert(all (all (polyreduce ([1, 0, 3]) == [1, 0, 3]))); - -%% test/octave.test/poly/polyreduce-4.m -%!assert(isempty (polyreduce ([]))); - -%% test/octave.test/poly/polyreduce-5.m -%!error polyreduce ([1, 2; 3, 4]); - -%% test/octave.test/poly/polyval-1.m -%!assert(polyval ([1, 1, 1], 2) == 7); - -%% test/octave.test/poly/polyval-2.m -%!assert(all (all (polyval ([1, 1, 1], [0; 1; 2]) == [1; 3; 7]))); - -%% test/octave.test/poly/polyval-3.m -%!assert(isempty (polyval ([1, 1, 1], []))); - -%% test/octave.test/poly/polyval-4.m -%!assert(all (all (polyval ([1, 1, 1], [-1, 0; 1, 2]) == [1, 1; 3, 7]))); - -%% test/octave.test/poly/polyval-5.m -%!error polyval ([1, 2; 3, 4], [-1, 0; 1, 2]); - -%% test/octave.test/poly/polyval-6.m -%!assert(isempty (polyval ([], [-1, 0; 1, 2]))); - -%% test/octave.test/poly/polyvalm-1.m -%!assert(isempty (polyvalm ([], [1, 2; 3, 4]))); - -%% test/octave.test/poly/polyvalm-2.m -%!error polyvalm ([1, 1, 1], [1, 2; 3, 4; 5, 6]); - -%% test/octave.test/poly/roots-1.m -%!assert(all (all (abs (roots ([1, -6, 11, -6]) - [3; 2; 1]) < sqrt (eps)))); - -%% test/octave.test/poly/roots-2.m -%!assert(isempty (roots ([]))); - -%% test/octave.test/poly/roots-3.m -%!error roots ([1, 2; 3, 4]); - diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_set.m --- a/test/test_set.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_set.m Tue Jan 22 21:52:26 2008 +0000 @@ -18,60 +18,3 @@ %% Automatically generated from DejaGNU files -%% test/octave.test/set/create_set-1.m -%!assert(all (all (create_set ([1, 2; 3, 4; 2, 4]) == [1, 2, 3, 4]))); - -%% test/octave.test/set/create_set-2.m -%!assert(all (all (create_set ([1; 2; 3; 4; 2; 4]) == [1, 2, 3, 4]))); - -%% test/octave.test/set/create_set-3.m -%!assert(isempty (create_set ([]))); - -%% test/octave.test/set/create_set-4.m -%!error create_set (1, 2); - -%% test/octave.test/set/union-1.m -%!assert(all (all (union ([1, 2, 4], [2, 3, 5]) == [1, 2, 3, 4, 5]))); - -%% test/octave.test/set/union-2.m -%!assert(all (all (union ([1; 2; 4], [2, 3, 5]) == [1, 2, 3, 4, 5]))); - -%% test/octave.test/set/union-3.m -%!assert(all (all (union ([1, 2, 3], [5; 7; 9]) == [1, 2, 3, 5, 7, 9]))); - -%% test/octave.test/set/union-4.m -%!error union (1); - -%% test/octave.test/set/union-5.m -%!error union (1, 2, 3); - -%% test/octave.test/set/intersection-1.m -%!assert(all (all (intersection ([1, 2, 3], [2, 3, 5]) == [2, 3]))); - -%% test/octave.test/set/intersection-2.m -%!assert(all (all (intersection ([1; 2; 3], [2, 3, 5]) == [2, 3]))); - -%% test/octave.test/set/intersection-3.m -%!assert(isempty (intersection ([1, 2, 3], [4; 5; 6]))); - -%% test/octave.test/set/intersection-4.m -%!error intersection (1); - -%% test/octave.test/set/intersection-5.m -%!error intersection (1, 2, 5); - -%% test/octave.test/set/complement-1.m -%!assert(all (all (complement ([1, 2, 3], [3; 4; 5; 6]) == [4, 5, 6]))); - -%% test/octave.test/set/complement-2.m -%!assert(all (all (complement ([1, 2, 3], [3, 4, 5, 6]) == [4, 5, 6]))); - -%% test/octave.test/set/complement-3.m -%!assert(isempty (complement ([1, 2, 3], [3, 2, 1]))); - -%% test/octave.test/set/complement-4.m -%!error complement (1); - -%% test/octave.test/set/complement-5.m -%!error complement (1, 2, 3); - diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_signal.m --- a/test/test_signal.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_signal.m Tue Jan 22 21:52:26 2008 +0000 @@ -102,44 +102,4 @@ %! %! assert(all( all( abs(s-answer) < 30*eps ) )); -%% test/octave.test/signal/unwrap-1.m -%!function t = xassert(a,b,tol) -%! if (nargin == 1) -%! t = all(a(:)); -%! else -%! if (nargin == 2) -%! tol = 0; -%! endif -%! if (any (size(a) != size(b))) -%! t = 0; -%! elseif (any (abs(a(:) - b(:)) > tol)) -%! t = 0; -%! else -%! t = 1; -%! endif -%! endif -%! -%!test -%! -%! i = 0; -%! t = []; -%! -%! r = [0:100]; # original vector -%! w = r - 2*pi*floor((r+pi)/(2*pi)); # wrapped into [-pi,pi] -%! tol = 1e3*eps; # maximum expected deviation -%! -%! t(++i) = xassert(r, unwrap(w), tol); #unwrap single row -%! t(++i) = xassert(r', unwrap(w'), tol); #unwrap single column -%! t(++i) = xassert([r',r'], unwrap([w',w']), tol); #unwrap 2 columns -%! t(++i) = xassert([r;r], unwrap([w;w],[],2), tol); #verify that dim works -%! t(++i) = xassert(r+10, unwrap(10+w), tol); #verify that r(1)>pi works -%! -%! t(++i) = xassert(w', unwrap(w',[],2)); #unwrap col by rows should not change it -%! t(++i) = xassert(w, unwrap(w,[],1)); #unwrap row by cols should not change it -%! t(++i) = xassert([w;w], unwrap([w;w])); #unwrap 2 rows by cols should not change them -%! -%! ## verify that setting tolerance too low will cause bad results. -%! t(++i) = xassert(any(abs(r - unwrap(w,0.8)) > 100)); -%! -%! assert(all(t)); diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_stats.m --- a/test/test_stats.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_stats.m Tue Jan 22 21:52:26 2008 +0000 @@ -18,97 +18,3 @@ %% Automatically generated from DejaGNU files -%% test/octave.test/stats/mean-1.m -%!test -%! x = -10:10; -%! y = x'; -%! z = [y, y+10]; -%! assert(mean (x) == 0 && mean (y) == 0 && mean (z) == [0, 10]); - -%% test/octave.test/stats/mean-2.m -%!error mean (); - -%% test/octave.test/stats/mean-3.m -%!error mean (1, 2, 3); - -%% test/octave.test/stats/median-1.m -%!test -%! x = [1, 2, 3, 4, 5, 6]; -%! x2 = x'; -%! y = [1, 2, 3, 4, 5, 6, 7]; -%! y2 = y'; -%! -%! assert((median (x) == median (x2) && median (x) == 3.5 -%! && median (y) == median (y2) && median (y) == 4 -%! && median ([x2, 2*x2]) == [3.5, 7] -%! && median ([y2, 3*y2]) == [4, 12])); - -%% test/octave.test/stats/median-2.m -%!error median (); - -%% test/octave.test/stats/median-3.m -%!error median (1, 2, 3); - -%% test/octave.test/stats/std-1.m -%!test -%! x = ones (10, 2); -%! y = [1, 3]; -%! assert(std (x) == [0, 0] && abs (std (y) - sqrt (2)) < sqrt (eps)); - -%% test/octave.test/stats/std-2.m -%!error std (); - -%% test/octave.test/stats/std-3.m -%!error std (1, 2, 3, 4); - -%% test/octave.test/stats/cov-1.m -%!test -%! x = rand (10); -%! cx1 = cov (x); -%! cx2 = cov (x, x); -%! assert(size (cx1) == [10, 10] && size (cx2) == [10, 10] && cx1 == cx2); - -%% test/octave.test/stats/cov-2.m -%!error cov (); - -%% test/octave.test/stats/cov-3.m -%!error cov (1, 2, 3); - -%% test/octave.test/stats/corrcoef-1.m -%!test -%! x = rand (10); -%! cc1 = corrcoef (x); -%! cc2 = corrcoef (x, x); -%! assert((size (cc1) == [10, 10] && size (cc2) == [10, 10] -%! && abs (cc1 - cc2) < sqrt (eps))); - -%% test/octave.test/stats/corrcoef-2.m -%!error corrcoef (); - -%% test/octave.test/stats/corrcoef-3.m -%!error corrcoef (1, 2, 3); - -%% test/octave.test/stats/kurtosis-1.m -%!test -%! x = [-1; 0; 0; 0; 1]; -%! y = [x, 2*x]; -%! assert(all (abs (kurtosis (y) - [-1.4, -1.4]) < sqrt (eps))); - -%% test/octave.test/stats/kurtosis-2.m -%!error kurtosis (); - -%% test/octave.test/stats/kurtosis-3.m -%!error kurtosis (1, 2, 3); - -%% test/octave.test/stats/mahalanobis-2.m -%!error mahalanobis (); - -%% test/octave.test/stats/mahalanobis-3.m -%!error mahalanobis (1, 2, 3); - -%% test/octave.test/stats/skewness-2.m -%!error skewness (); - -%% test/octave.test/stats/skewness-3.m -%!error skewness (1, 2, 3); - diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_string.m --- a/test/test_string.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_string.m Tue Jan 22 21:52:26 2008 +0000 @@ -164,14 +164,6 @@ %% test/octave.test/string/ischar-11.m %!error ischar ("test", 1); -%% test/octave.test/string/blanks-1.m -%!assert(strcmp (blanks (3), " ")); - -%% test/octave.test/string/blanks-2.m -%!error blanks (); - -%% test/octave.test/string/blanks-3.m -%!error blanks (1, 2); %% test/octave.test/string/char-1.m %!assert(strcmp (char ([65, 83, 67, 73, 73]), "ASCII")); @@ -186,114 +178,6 @@ %! && strcmp (x(2,:), "bar ") %! && strcmp (x(3,:), "foobar"))); -%% test/octave.test/string/int2str-1.m -%!assert(strcmp (int2str (-123), "-123") && strcmp (int2str (1.2), "1")); - -%% test/octave.test/string/int2str-2.m -%!error int2str (); - -%% test/octave.test/string/int2str-3.m -%!error int2str (1, 2); - -%% test/octave.test/string/num2str-1.m -%!assert((strcmp (num2str (123), "123") && strcmp (num2str (1.23), "1.23"))); - -%% test/octave.test/string/num2str-2.m -%!error num2str (); - -%% test/octave.test/string/num2str-3.m -%!error num2str (1, 2, 3); - -%% test/octave.test/string/strcat-1.m -%!assert((strcmp (strcat ("foo", "bar"), "foobar") -%! && strcmp (strcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"]))); - -%% test/octave.test/string/strcat-2.m -%!error strcat (); - -%% test/octave.test/string/strcat-3.m -%!error strcat (1, 2); - -%% test/octave.test/string/str2mat-1.m -%!assert(strcmp (str2mat ("a", "bb", "ccc"), ["a "; "bb "; "ccc"])); - -%% test/octave.test/string/str2mat-2.m -%!error str2mat (); - -%% test/octave.test/string/str2mat-3.m -%!assert(all (str2mat (1, 2, 3) == setstr ([1; 2; 3]))); - -%% test/octave.test/string/deblank-1.m -%!assert(strcmp (deblank (" f o o "), " f o o")); - -%% test/octave.test/string/deblank-2.m -%!error deblank (); - -%% test/octave.test/string/deblank-3.m -%!error deblank ("foo", "bar"); - -%% test/octave.test/string/deblank-4.m -%!error deblank (1); - -%% test/octave.test/string/findstr-1.m -%!assert((findstr ("abababa", "a") == [1, 3, 5, 7] -%! && findstr ("abababa", "aba") == [1, 3, 5] -%! && findstr ("abababa", "aba", 0) == [1, 5])); - -%% test/octave.test/string/findstr-2.m -%!error findstr (); - -%% test/octave.test/string/findstr-3.m -%!error findstr ("foo", "bar", 3, 4); - -%% test/octave.test/string/index-1.m -%!assert(index ("foobarbaz", "b") == 4 && index ("foobarbaz", "z") == 9); - -%% test/octave.test/string/index-2.m -%!error index (); - -%% test/octave.test/string/index-3.m -%!error index ("foo", "bar", 3); - -%% test/octave.test/string/rindex-1.m -%!assert(rindex ("foobarbaz", "b") == 7 && rindex ("foobarbaz", "o") == 3); - -%% test/octave.test/string/rindex-2.m -%!error rindex (); - -%% test/octave.test/string/rindex-3.m -%!error rindex ("foo", "bar", 3); - -%% test/octave.test/string/split-1.m -%!assert(all (all (split ("Test string", "t") == ["Tes "; " s "; "ring"]))); - -%% test/octave.test/string/split-2.m -%!error split (); - -%% test/octave.test/string/split-3.m -%!assert(all (strcmp (split ("foo bar baz", " ", 2), ["foo"; "bar baz"]))); - -%% test/octave.test/string/split-4.m -%!error split ("foo", "bar", 3, 4); - -%% test/octave.test/string/strrep-1.m -%!assert(strcmp (strrep ("This is a test string", "is", "&%$"), -%! "Th&%$ &%$ a test string")); - -%% test/octave.test/string/strrep-2.m -%!error strrep (); - -%% test/octave.test/string/strrep-3.m -%!error strrep ("foo", "bar", 3, 4); - -%% test/octave.test/string/substr-1.m -%!assert(strcmp (substr ("This is a test string", 6, 9), "is a test")); - -%% test/octave.test/string/substr-2.m -%!error substr (); - -%% test/octave.test/string/substr-3.m -%!error substr ("foo", 2, 3, 4); %% test/octave.test/string/strcmp-1.m %!assert(strcmp ("foobar", "foobar") && strcmp ("fooba", "foobar") == 0); @@ -304,57 +188,7 @@ %% test/octave.test/string/strcmp-3.m %!error strcmp ("foo", "bar", 3); -%% test/octave.test/string/bin2dec-1.m -%!assert(bin2dec ("1110") == 14); -%% test/octave.test/string/bin2dec-2.m -%!error bin2dec (); - -%% test/octave.test/string/bin2dec-3.m -%!error bin2dec ("str", 1); - -%% test/octave.test/string/dec2bin-1.m -%!assert(strcmp (dec2bin (14), "1110")); - -%% test/octave.test/string/dec2bin-2.m -%!error dec2bin (); - -%% test/octave.test/string/dec2bin-3.m -%!assert(strcmp (dec2bin (14, 6), "001110") -%! ); - -%% test/octave.test/string/dec2bin-4.m -%!error dec2bin (1, 2, 3); - -%% test/octave.test/string/dec2hex-1.m -%!assert(strcmp (tolower (dec2hex (2748)), "abc")); - -%% test/octave.test/string/dec2hex-2.m -%!error dec2hex (); - -%% test/octave.test/string/dec2hex-3.m -%!assert(strcmp (tolower (dec2hex (2748, 5)), "00abc")); - -%% test/octave.test/string/dec2hex-4.m -%!error dec2hex (1, 2, 3); - -%% test/octave.test/string/hex2dec-1.m -%!assert(hex2dec ("12b") == 299 && hex2dec ("12B") == 299); - -%% test/octave.test/string/hex2dec-2.m -%!error hex2dec (); - -%% test/octave.test/string/hex2dec-3.m -%!error hex2dec ("str", 1); - -%% test/octave.test/string/str2num-1.m -%!assert(str2num ("-1.3e2") == -130 && str2num ("[1, 2; 3, 4]") == [1, 2; 3, 4]); - -%% test/octave.test/string/str2num-2.m -%!error str2num (); - -%% test/octave.test/string/str2num-3.m -%!error str2num ("string", 1); %% test/octave.test/string/undo_string_escapes-1.m %!assert(strcmp (undo_string_escapes ("abc\a\b\n\r\t\v\f123"), diff -r 8a3b2ccc4e11 -r 83a8781b529d test/test_system.m --- a/test/test_system.m Tue Jan 22 21:34:24 2008 +0000 +++ b/test/test_system.m Tue Jan 22 21:52:26 2008 +0000 @@ -21,16 +21,6 @@ %% test/octave.test/system/time-1.m %!assert(time () > 0); -%% test/octave.test/system/ctime-1.m -%!test -%! t = time (); -%! assert(strcmp (asctime (localtime (t)), ctime (t))); - -%% test/octave.test/system/ctime-2.m -%!error ctime (); - -%% test/octave.test/system/ctime-3.m -%!error ctime (1, 2); %% test/octave.test/system/gmtime-1.m %!test @@ -85,16 +75,6 @@ %% test/octave.test/system/mktime-3.m %!error mktime (1, 2, 3); -%% test/octave.test/system/asctime-1.m -%!test -%! t = time (); -%! assert(strcmp (asctime (localtime (t)), ctime (t))); - -%% test/octave.test/system/asctime-2.m -%!error asctime (); - -%% test/octave.test/system/asctime-3.m -%!error asctime (1, 2); %% test/octave.test/system/strftime-1.m %!assert((isstr (strftime ("%%%n%t%H%I%k%l", localtime (time ()))) @@ -109,32 +89,6 @@ %% test/octave.test/system/strftime-3.m %!error strftime ("foo", localtime (time ()), 1); -%% test/octave.test/system/clock-1.m -%!test -%! t1 = clock; -%! t2 = str2num (strftime ("[%Y, %m, %d, %H, %M, %S]", localtime (time ()))); -%! assert(etime (t1, t2) < 1); - -%% test/octave.test/system/date-1.m -%!assert(strcmp (date (), strftime ("%d-%b-%Y", localtime (time ())))); - -%% test/octave.test/system/etime-1.m -%!test -%! t1 = [1993, 8, 20, 4, 56, 1]; -%! t2 = [1993, 8, 21, 4, 56, 1]; -%! t3 = [1993, 8, 20, 5, 56, 1]; -%! t4 = [1993, 8, 20, 4, 57, 1]; -%! t5 = [1993, 8, 20, 4, 56, 14]; -%! -%! assert((etime (t2, t1) == 86400 && etime (t3, t1) == 3600 -%! && etime (t4, t1) == 60 && etime (t5, t1) == 13)); - -%% test/octave.test/system/etime-2.m -%!error etime (); - -%% test/octave.test/system/etime-3.m -%!error etime (1, 2, 3); - %% test/octave.test/system/cputime-1.m %!test %! [t1, u1, s1] = cputime (); @@ -144,13 +98,6 @@ %! [t2, u2, s2] = cputime (); %! assert(t1 == u1 + s1 && t2 == u2 + s2 && t2 >= t1 && u2 >= u2 && s2 >= s2); -%% test/octave.test/system/is_leap_year-1.m -%!assert((is_leap_year (2000) == 1 && is_leap_year (1976) == 1 -%! && is_leap_year (1000) == 0 && is_leap_year (1800) == 0 -%! && is_leap_year (1600) == 1)); - -%% test/octave.test/system/is_leap_year-2.m -%!error is_leap_year (1, 2); %% test/octave.test/system/tic-toc-1.m %!test @@ -480,9 +427,6 @@ %% test/octave.test/system/pwd-1.m %!assert(isstr (pwd ())); -%% test/octave.test/system/ls-1.m -%!error ls (1); - %% test/octave.test/system/getpwent-1.m %!test %! s = getpwent (); @@ -592,22 +536,9 @@ %% test/octave.test/system/endgrent-1.m %!error endgrent (1); -%% test/octave.test/system/computer-1.m -%!assert((isstr (computer ()) -%! && computer () == octave_config_info ("canonical_host_type"))); - -%% test/octave.test/system/computer-2.m -%!warning a =computer(2); - %% test/octave.test/system/isieee-1.m %!assert(isieee () == 1 || isieee () == 0); -%% test/octave.test/system/version-1.m -%!assert(isstr (version ()) && strcmp (version (), OCTAVE_VERSION)); - -%% test/octave.test/system/version-2.m -%!warning version (1); - %% test/octave.test/system/octave_config_info-1.m %!assert(isstruct (octave_config_info ()));