# HG changeset patch # User John W. Eaton # Date 1204788475 18000 # Node ID c827f5673321ea4398d0bb6b209944fa6075a954 # Parent a938cd7869b250b35561d7623087412ca007344b move tests to individual source files diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2008-03-06 John W. Eaton + + * parse.y: Move tests here from test/test_eval.m. + * DLD-FUNCTIONS/fft.cc: Move tests here from test/test_signal.m. + * DLD-FUNCTIONS/dassl.cc: Move tests here from test/test_diffeq.m. + * DLD-FUNCTIONS/lsode.cc: Move tests here from test/test_diffeq.m. + * DLD-FUNCTIONS/quad.cc: Move tests here from test/test_quad.m. + * DLD-FUNCTIONS/time.cc: Move tests here from test/test_system.m. + 2008-03-06 Alexander Barth * DLD-FUNCTIONS/__lin_interpn__.cc (lookup): diff --git a/src/DLD-FUNCTIONS/dassl.cc b/src/DLD-FUNCTIONS/dassl.cc --- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -488,6 +488,87 @@ } /* + +%% dassl-1.m +%% +%% Test dassl() function +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 20 May 1998 +%% +%% Problem +%% +%% y1' = -y2, y1(0) = 1 +%% y2' = y1, y2(0) = 0 +%% +%% Solution +%% +%% y1(t) = cos(t) +%% y2(t) = sin(t) +%!function res = f (x, xdot, t) +%! res = [xdot(1)+x(2); xdot(2)-x(1)]; +%!test +%! +%! x0 = [1; 0]; +%! xdot0 = [0; 1]; +%! t = (0:1:10)'; +%! +%! tol = 100 * dassl_options ("relative tolerance"); +%! +%! +%! [x, xdot] = dassl ("f", x0, xdot0, t); +%! +%! y = [cos(t), sin(t)]; +%! +%! assert(all (all (abs (x - y) < tol))); + +%% dassl-2.m +%% +%% Test dassl() function +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 20 May 1998 +%% +%% Based on SLATEC quick check for DASSL by Linda Petzold +%% +%% Problem +%% +%% x1' + 10*x1 = 0, x1(0) = 1 +%% x1 + x2 = 1, x2(0) = 0 +%% +%% +%% Solution +%% +%% x1(t) = exp(-10*t) +%% x2(t) = 1 - x(1) +%!function res = f (x, xdot, t) +%! res = [xdot(1)+10*x(1); x(1)+x(2)-1]; +%!test +%! +%! x0 = [1; 0]; +%! xdot0 = [-10; 10]; +%! t = (0:0.2:1)'; +%! +%! tol = 500 * dassl_options ("relative tolerance"); +%! +%! +%! [x, xdot] = dassl ("f", x0, xdot0, t); +%! +%! y = [exp(-10*t), 1-exp(-10*t)]; +%! +%! assert(all (all (abs (x - y) < tol))); + +%!test +%! dassl_options ("absolute tolerance", eps); +%! assert(dassl_options ("absolute tolerance") == eps); + +%!error dassl_options ("foo", 1, 2); + +*/ + +/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** diff --git a/src/DLD-FUNCTIONS/fft.cc b/src/DLD-FUNCTIONS/fft.cc --- a/src/DLD-FUNCTIONS/fft.cc +++ b/src/DLD-FUNCTIONS/fft.cc @@ -212,6 +212,90 @@ } /* + +%% fft-1.m +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 02 May 2000 +%!test +%! N=64; +%! n=4; +%! t = 2*pi*(0:1:N-1)/N; +%! s = cos(n*t); +%! S = fft(s); +%! +%! answer = 0*t; +%! answer(n+1) = N/2; +%! answer(N-n+1) = N/2; +%! +%! assert(all( abs(S-answer) < 4*N*eps )); + +%% ifft-1.m +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 02 May 2000 +%!test +%! N=64; +%! n=7; +%! t = 2*pi*(0:1:N-1)/N; +%! s = cos(n*t); +%! +%! S = 0*t; +%! S(n+1) = N/2; +%! S(N-n+1) = N/2; +%! +%! assert(all( abs(ifft(S)-s) < 4*N*eps )); + +%% fft2-1.m +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 02 May 2000 +%!test +%! M=16; +%! N=8; +%! +%! m=5; +%! n=3; +%! +%! x = 2*pi*(0:1:M-1)/M; +%! y = 2*pi*(0:1:N-1)/N; +%! sx = cos(m*x); +%! sy = sin(n*y); +%! s=kron(sx',sy); +%! S = fft2(s); +%! answer = kron(fft(sx)',fft(sy)); +%! assert(all( all( abs(S-answer) < 4*M*N*eps ) )); + +%% ifft2-1.m +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 02 May 2000 +%!test +%! M=12; +%! N=7; +%! +%! m=3; +%! n=2; +%! +%! x = 2*pi*(0:1:M-1)/M; +%! y = 2*pi*(0:1:N-1)/N; +%! +%! sx = cos(m*x); +%! sy = cos(n*y); +%! +%! S = kron(fft(sx)',fft(sy)); +%! answer=kron(sx',sy); +%! s = ifft2(S); +%! +%! assert(all( all( abs(s-answer) < 30*eps ) )); + +*/ + +/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** diff --git a/src/DLD-FUNCTIONS/lsode.cc b/src/DLD-FUNCTIONS/lsode.cc --- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -475,6 +475,78 @@ } /* + +%% dassl-1.m +%% +%% Test lsode() function +%% +%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +%% Comalco Research and Technology +%% 20 May 1998 +%% +%% Problem +%% +%% y1' = -y2, y1(0) = 1 +%% y2' = y1, y2(0) = 0 +%% +%% Solution +%% +%% y1(t) = cos(t) +%% y2(t) = sin(t) +%!function xdot = f (x, t) +%! xdot = [-x(2); x(1)]; +%!test +%! +%! x0 = [1; 0]; +%! xdot0 = [0; 1]; +%! t = (0:1:10)'; +%! +%! tol = 500 * lsode_options ("relative tolerance"); +%! +%! +%! x = lsode ("f", x0, t); +%! +%! y = [cos(t), sin(t)]; +%! +%! assert(all (all (abs (x - y) < tol))); + +%!function xdotdot = f (x, t) +%! xdotdot = [x(2); -x(1)]; +%!test +%! +%! x0 = [1; 0]; +%! t = [0; 2*pi]; +%! tol = 100 * dassl_options ("relative tolerance"); +%! +%! x = lsode ("f", x0, t); +%! +%! y = [1, 0; 1, 0]; +%! +%! assert(all (all (abs (x - y) < tol))); + +%!function xdot = f (x, t) +%! xdot = x; +%!test +%! +%! x0 = 1; +%! t = [0; 1]; +%! tol = 100 * dassl_options ("relative tolerance"); +%! +%! x = lsode ("f", x0, t); +%! +%! y = [1; e]; +%! +%! assert(all (all (abs (x - y) < tol))); + +%!test +%! lsode_options ("absolute tolerance", eps); +%! assert(lsode_options ("absolute tolerance") == eps); + +%!error lsode_options ("foo", 1, 2); + +*/ + +/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** diff --git a/src/DLD-FUNCTIONS/quad.cc b/src/DLD-FUNCTIONS/quad.cc --- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -320,6 +320,33 @@ } /* + +%!function y = f (x) +%! y = x + 1; +%!test +%! [v, ier, nfun, err] = quad ("f", 0, 5); +%! assert(ier == 0 && abs (v - 17.5) < sqrt (eps) && nfun > 0 && +%! err < sqrt (eps)) + +%!function y = f (x) +%! y = x .* sin (1 ./ x) .* sqrt (abs (1 - x)); +%!test +%! [v, ier, nfun, err] = quad ("f", 0.001, 3); +%! assert((ier == 0 || ier == 1) && abs (v - 1.98194120273598) < sqrt (eps) && nfun > 0); + +%!error quad (); + +%!error quad ("f", 1, 2, 3, 4, 5); + +%!test +%! quad_options ("absolute tolerance", eps); +%! assert(quad_options ("absolute tolerance") == eps); + +%!error quad_options (1, 2, 3); + +*/ + +/* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** diff --git a/src/DLD-FUNCTIONS/time.cc b/src/DLD-FUNCTIONS/time.cc --- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -96,6 +96,12 @@ return retval; } +/* + +%!assert(time () > 0); + +*/ + DEFUN_DLD (gmtime, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} gmtime (@var{t})\n\ @@ -138,6 +144,28 @@ return retval; } +/* + +%!test +%! ts = gmtime (time ()); +%! assert((isstruct (ts) +%! && struct_contains (ts, "usec") +%! && struct_contains (ts, "year") +%! && struct_contains (ts, "mon") +%! && struct_contains (ts, "mday") +%! && struct_contains (ts, "sec") +%! && struct_contains (ts, "min") +%! && struct_contains (ts, "wday") +%! && struct_contains (ts, "hour") +%! && struct_contains (ts, "isdst") +%! && struct_contains (ts, "yday"))); + +%!error gmtime (); + +%!error gmtime (1, 2); + +*/ + DEFUN_DLD (localtime, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} localtime (@var{t})\n\ @@ -180,6 +208,28 @@ return retval; } +/* + +%!test +%! ts = localtime (time ()); +%! assert((isstruct (ts) +%! && struct_contains (ts, "usec") +%! && struct_contains (ts, "year") +%! && struct_contains (ts, "mon") +%! && struct_contains (ts, "mday") +%! && struct_contains (ts, "sec") +%! && struct_contains (ts, "min") +%! && struct_contains (ts, "wday") +%! && struct_contains (ts, "hour") +%! && struct_contains (ts, "isdst") +%! && struct_contains (ts, "yday"))); + +%!error localtime (); + +%!error localtime (1, 2); + +*/ + DEFUN_DLD (mktime, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} mktime (@var{tm_struct})\n\ @@ -219,6 +269,18 @@ return retval; } +/* + +%!test +%! t = time (); +%! assert(fix (mktime (localtime (t))) == fix (t)); + +%!error mktime (); + +%!error mktime (1, 2, 3); + +*/ + DEFUN_DLD (strftime, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} strftime (@var{fmt}, @var{tm_struct})\n\ @@ -403,6 +465,20 @@ return retval; } +/* + +%!assert((isstr (strftime ("%%%n%t%H%I%k%l", localtime (time ()))) +%! && isstr (strftime ("%M%p%r%R%s%S%T", localtime (time ()))) +%! && isstr (strftime ("%X%Z%z%a%A%b%B", localtime (time ()))) +%! && isstr (strftime ("%c%C%d%e%D%h%j", localtime (time ()))) +%! && isstr (strftime ("%m%U%w%W%x%y%Y", localtime (time ()))))); + +%!error strftime (); + +%!error strftime ("foo", localtime (time ()), 1); + +*/ + DEFUN_DLD (strptime, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{tm_struct}, @var{nchars}] =} strptime (@var{str}, @var{fmt})\n\ diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -3983,6 +3983,89 @@ return retval; } +/* + +%% test/octave.test/eval/eval-1.m +%!#test +%! x = 1; +%! assert(eval ("x"),1); + +%% test/octave.test/eval/eval-2.m +%!test +%! x = 1; +%! assert(eval ("x;")); + +%% test/octave.test/eval/eval-3.m +%!test +%! x = 1; +%! assert(eval ("x;"),1); + +%% FIXME +%% Disable this test as adding the ";" is redundant with eval-1 and +%% in any case is a syntax error with assert +%% test/octave.test/eval/eval-4.m +%!#test +%! x = 1; +%! assert(eval ("x");,1); + +%% test/octave.test/eval/eval-5.m +%!test +%! eval ("flipud = 2;"); +%! assert(flipud,2); + +%% test/octave.test/eval/eval-6.m +%!function y = f () +%! eval ("flipud = 2;"); +%! y = flipud; +%!test +%! assert(f,2); + +%% test/octave.test/eval/eval-7.m +%!#test +%! eval ("x = 1"); +%! assert(x,1); + +%% test/octave.test/eval/eval-8.m +%!test +%! eval ("x = 1;") +%! assert(x,1); + +%% test/octave.test/eval/eval-9.m +%!test +%! eval ("x = 1;"); +%! assert(x,1); + +%% test/octave.test/eval/eval-10.m +%!#test +%! eval ("x = 1") +%! assert(x,1); + +%% test/octave.test/eval/eval-11.m +%!test +%! x = 1; +%! y = eval ("x"); +%! assert(y,1); + +%% test/octave.test/eval/eval-12.m +%!test +%! x = 1; +%! y = eval ("x;"); +%! assert(y,1); + +%% test/octave.test/eval/eval-13.m +%!test +%! x = 1; +%! y = eval ("x;"); +%! assert(y,1); + +%% test/octave.test/eval/eval-14.m +%!test +%! x = 1; +%! y = eval ("x"); +%! assert(y,1); + +*/ + DEFUN (assignin, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} assignin (@var{context}, @var{varname}, @var{value})\n\ diff --git a/test/ChangeLog b/test/ChangeLog --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2008-03-06 John W. Eaton + + * test_eval.m, test_diffeq.m, test_quad.m, test_signal.m: + Delete files with no tests. + 2008-02-25 Ben Abbott * test_eval-catch.m, test_io.m, test_try.m: Use cstrcat instead of diff --git a/test/test_diffeq.m b/test/test_diffeq.m deleted file mode 100644 --- a/test/test_diffeq.m +++ /dev/null @@ -1,174 +0,0 @@ -## Copyright (C) 2006, 2007 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -%% Automatically generated from DejaGNU files - -%% test/octave.test/diffeq/lsode-1.m -%% dassl-1.m -%% -%% Test lsode() function -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 20 May 1998 -%% -%% Problem -%% -%% y1' = -y2, y1(0) = 1 -%% y2' = y1, y2(0) = 0 -%% -%% Solution -%% -%% y1(t) = cos(t) -%% y2(t) = sin(t) -%!function xdot = f (x, t) -%! xdot = [-x(2); x(1)]; -%!test -%! -%! x0 = [1; 0]; -%! xdot0 = [0; 1]; -%! t = (0:1:10)'; -%! -%! tol = 500 * lsode_options ("relative tolerance"); -%! -%! -%! x = lsode ("f", x0, t); -%! -%! y = [cos(t), sin(t)]; -%! -%! assert(all (all (abs (x - y) < tol))); - -%% test/octave.test/diffeq/lsode-2.m -%!function xdotdot = f (x, t) -%! xdotdot = [x(2); -x(1)]; -%!test -%! -%! x0 = [1; 0]; -%! t = [0; 2*pi]; -%! tol = 100 * dassl_options ("relative tolerance"); -%! -%! x = lsode ("f", x0, t); -%! -%! y = [1, 0; 1, 0]; -%! -%! assert(all (all (abs (x - y) < tol))); - -%% test/octave.test/diffeq/lsode-3.m -%!function xdot = f (x, t) -%! xdot = x; -%!test -%! -%! x0 = 1; -%! t = [0; 1]; -%! tol = 100 * dassl_options ("relative tolerance"); -%! -%! x = lsode ("f", x0, t); -%! -%! y = [1; e]; -%! -%! assert(all (all (abs (x - y) < tol))); - -%% test/octave.test/diffeq/lsode_options-1.m -%!test -%! lsode_options ("absolute tolerance", eps); -%! assert(lsode_options ("absolute tolerance") == eps); - -%% test/octave.test/diffeq/lsode_options-3.m -%!error lsode_options ("foo", 1, 2); - -%% test/octave.test/diffeq/dassl-1.m -%% dassl-1.m -%% -%% Test dassl() function -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 20 May 1998 -%% -%% Problem -%% -%% y1' = -y2, y1(0) = 1 -%% y2' = y1, y2(0) = 0 -%% -%% Solution -%% -%% y1(t) = cos(t) -%% y2(t) = sin(t) -%!function res = f (x, xdot, t) -%! res = [xdot(1)+x(2); xdot(2)-x(1)]; -%!test -%! -%! x0 = [1; 0]; -%! xdot0 = [0; 1]; -%! t = (0:1:10)'; -%! -%! tol = 100 * dassl_options ("relative tolerance"); -%! -%! -%! [x, xdot] = dassl ("f", x0, xdot0, t); -%! -%! y = [cos(t), sin(t)]; -%! -%! assert(all (all (abs (x - y) < tol))); - -%% test/octave.test/diffeq/dassl-2.m -%% dassl-2.m -%% -%% Test dassl() function -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 20 May 1998 -%% -%% Based on SLATEC quick check for DASSL by Linda Petzold -%% -%% Problem -%% -%% x1' + 10*x1 = 0, x1(0) = 1 -%% x1 + x2 = 1, x2(0) = 0 -%% -%% -%% Solution -%% -%% x1(t) = exp(-10*t) -%% x2(t) = 1 - x(1) -%!function res = f (x, xdot, t) -%! res = [xdot(1)+10*x(1); x(1)+x(2)-1]; -%!test -%! -%! x0 = [1; 0]; -%! xdot0 = [-10; 10]; -%! t = (0:0.2:1)'; -%! -%! tol = 500 * dassl_options ("relative tolerance"); -%! -%! -%! [x, xdot] = dassl ("f", x0, xdot0, t); -%! -%! y = [exp(-10*t), 1-exp(-10*t)]; -%! -%! assert(all (all (abs (x - y) < tol))); - -%% test/octave.test/diffeq/dassl_options-1.m -%!test -%! dassl_options ("absolute tolerance", eps); -%! assert(dassl_options ("absolute tolerance") == eps); - -%% test/octave.test/diffeq/dassl_options-3.m -%!error dassl_options ("foo", 1, 2); - diff --git a/test/test_eval.m b/test/test_eval.m deleted file mode 100644 --- a/test/test_eval.m +++ /dev/null @@ -1,99 +0,0 @@ -## Copyright (C) 2006, 2007 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -%% Automatically generated from DejaGNU files - -%% test/octave.test/eval/eval-1.m -%!#test -%! x = 1; -%! assert(eval ("x"),1); - -%% test/octave.test/eval/eval-2.m -%!test -%! x = 1; -%! assert(eval ("x;")); - -%% test/octave.test/eval/eval-3.m -%!test -%! x = 1; -%! assert(eval ("x;"),1); - -%% FIXME -%% Disable this test as adding the ";" is redundant with eval-1 and -%% in any case is a syntax error with assert -%% test/octave.test/eval/eval-4.m -%!#test -%! x = 1; -%! assert(eval ("x");,1); - -%% test/octave.test/eval/eval-5.m -%!test -%! eval ("flipud = 2;"); -%! assert(flipud,2); - -%% test/octave.test/eval/eval-6.m -%!function y = f () -%! eval ("flipud = 2;"); -%! y = flipud; -%!test -%! assert(f,2); - -%% test/octave.test/eval/eval-7.m -%!#test -%! eval ("x = 1"); -%! assert(x,1); - -%% test/octave.test/eval/eval-8.m -%!test -%! eval ("x = 1;") -%! assert(x,1); - -%% test/octave.test/eval/eval-9.m -%!test -%! eval ("x = 1;"); -%! assert(x,1); - -%% test/octave.test/eval/eval-10.m -%!#test -%! eval ("x = 1") -%! assert(x,1); - -%% test/octave.test/eval/eval-11.m -%!test -%! x = 1; -%! y = eval ("x"); -%! assert(y,1); - -%% test/octave.test/eval/eval-12.m -%!test -%! x = 1; -%! y = eval ("x;"); -%! assert(y,1); - -%% test/octave.test/eval/eval-13.m -%!test -%! x = 1; -%! y = eval ("x;"); -%! assert(y,1); - -%% test/octave.test/eval/eval-14.m -%!test -%! x = 1; -%! y = eval ("x"); -%! assert(y,1); - diff --git a/test/test_quad.m b/test/test_quad.m deleted file mode 100644 --- a/test/test_quad.m +++ /dev/null @@ -1,49 +0,0 @@ -## Copyright (C) 2006, 2007 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -%% Automatically generated from DejaGNU files - -%% test/octave.test/quad/quad-1.m -%!function y = f (x) -%! y = x + 1; -%!test -%! [v, ier, nfun, err] = quad ("f", 0, 5); -%! assert(ier == 0 && abs (v - 17.5) < sqrt (eps) && nfun > 0 && -%! err < sqrt (eps)) - -%% test/octave.test/quad/quad-2.m -%!function y = f (x) -%! y = x .* sin (1 ./ x) .* sqrt (abs (1 - x)); -%!test -%! [v, ier, nfun, err] = quad ("f", 0.001, 3); -%! assert((ier == 0 || ier == 1) && abs (v - 1.98194120273598) < sqrt (eps) && nfun > 0); - -%% test/octave.test/quad/quad-3.m -%!error quad (); - -%% test/octave.test/quad/quad-4.m -%!error quad ("f", 1, 2, 3, 4, 5); - -%% test/octave.test/quad/quad_options-1.m -%!test -%! quad_options ("absolute tolerance", eps); -%! assert(quad_options ("absolute tolerance") == eps); - -%% test/octave.test/quad/quad_options-3.m -%!error quad_options (1, 2, 3); - diff --git a/test/test_signal.m b/test/test_signal.m deleted file mode 100644 --- a/test/test_signal.m +++ /dev/null @@ -1,105 +0,0 @@ -## Copyright (C) 2006, 2007 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -%% Automatically generated from DejaGNU files - -%% test/octave.test/signal/fft-1.m -%% fft-1.m -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 02 May 2000 -%!test -%! N=64; -%! n=4; -%! t = 2*pi*(0:1:N-1)/N; -%! s = cos(n*t); -%! S = fft(s); -%! -%! answer = 0*t; -%! answer(n+1) = N/2; -%! answer(N-n+1) = N/2; -%! -%! assert(all( abs(S-answer) < 4*N*eps )); - -%% test/octave.test/signal/ifft-1.m -%% ifft-1.m -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 02 May 2000 -%!test -%! N=64; -%! n=7; -%! t = 2*pi*(0:1:N-1)/N; -%! s = cos(n*t); -%! -%! S = 0*t; -%! S(n+1) = N/2; -%! S(N-n+1) = N/2; -%! -%! assert(all( abs(ifft(S)-s) < 4*N*eps )); - -%% test/octave.test/signal/fft2-1.m -%% fft2-1.m -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 02 May 2000 -%!test -%! M=16; -%! N=8; -%! -%! m=5; -%! n=3; -%! -%! x = 2*pi*(0:1:M-1)/M; -%! y = 2*pi*(0:1:N-1)/N; -%! sx = cos(m*x); -%! sy = sin(n*y); -%! s=kron(sx',sy); -%! S = fft2(s); -%! answer = kron(fft(sx)',fft(sy)); -%! assert(all( all( abs(S-answer) < 4*M*N*eps ) )); - -%% test/octave.test/signal/ifft2-1.m -%% ifft2-1.m -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 02 May 2000 -%!test -%! M=12; -%! N=7; -%! -%! m=3; -%! n=2; -%! -%! x = 2*pi*(0:1:M-1)/M; -%! y = 2*pi*(0:1:N-1)/N; -%! -%! sx = cos(m*x); -%! sy = cos(n*y); -%! -%! S = kron(fft(sx)',fft(sy)); -%! answer=kron(sx',sy); -%! s = ifft2(S); -%! -%! assert(all( all( abs(s-answer) < 30*eps ) )); - - diff --git a/test/test_system.m b/test/test_system.m --- a/test/test_system.m +++ b/test/test_system.m @@ -18,77 +18,6 @@ %% Automatically generated from DejaGNU files -%% test/octave.test/system/time-1.m -%!assert(time () > 0); - - -%% test/octave.test/system/gmtime-1.m -%!test -%! ts = gmtime (time ()); -%! assert((isstruct (ts) -%! && struct_contains (ts, "usec") -%! && struct_contains (ts, "year") -%! && struct_contains (ts, "mon") -%! && struct_contains (ts, "mday") -%! && struct_contains (ts, "sec") -%! && struct_contains (ts, "min") -%! && struct_contains (ts, "wday") -%! && struct_contains (ts, "hour") -%! && struct_contains (ts, "isdst") -%! && struct_contains (ts, "yday"))); - -%% test/octave.test/system/gmtime-2.m -%!error gmtime (); - -%% test/octave.test/system/gmtime-3.m -%!error gmtime (1, 2); - -%% test/octave.test/system/localtime-1.m -%!test -%! ts = localtime (time ()); -%! assert((isstruct (ts) -%! && struct_contains (ts, "usec") -%! && struct_contains (ts, "year") -%! && struct_contains (ts, "mon") -%! && struct_contains (ts, "mday") -%! && struct_contains (ts, "sec") -%! && struct_contains (ts, "min") -%! && struct_contains (ts, "wday") -%! && struct_contains (ts, "hour") -%! && struct_contains (ts, "isdst") -%! && struct_contains (ts, "yday"))); - -%% test/octave.test/system/localtime-2.m -%!error localtime (); - -%% test/octave.test/system/localtime-3.m -%!error localtime (1, 2); - -%% test/octave.test/system/mktime-1.m -%!test -%! t = time (); -%! assert(fix (mktime (localtime (t))) == fix (t)); - -%% test/octave.test/system/mktime-2.m -%!error mktime (); - -%% test/octave.test/system/mktime-3.m -%!error mktime (1, 2, 3); - - -%% test/octave.test/system/strftime-1.m -%!assert((isstr (strftime ("%%%n%t%H%I%k%l", localtime (time ()))) -%! && isstr (strftime ("%M%p%r%R%s%S%T", localtime (time ()))) -%! && isstr (strftime ("%X%Z%z%a%A%b%B", localtime (time ()))) -%! && isstr (strftime ("%c%C%d%e%D%h%j", localtime (time ()))) -%! && isstr (strftime ("%m%U%w%W%x%y%Y", localtime (time ()))))); - -%% test/octave.test/system/strftime-2.m -%!error strftime (); - -%% test/octave.test/system/strftime-3.m -%!error strftime ("foo", localtime (time ()), 1); - %% test/octave.test/system/cputime-1.m %!test %! [t1, u1, s1] = cputime ();