Mercurial > hg > octave-lyh
changeset 6730:230f9c49857e
[project @ 2007-06-15 04:22:13 by jwe]
author | jwe |
---|---|
date | Fri, 15 Jun 2007 04:22:13 +0000 |
parents | 9b4c16beea1c |
children | aff0c76321aa |
files | scripts/ChangeLog scripts/set/ismember.m scripts/testfun/test.m test/ChangeLog test/fntests.m |
diffstat | 5 files changed, 45 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,11 @@ +2007-06-15 John W. Eaton <jwe@octave.org> + + * testfun/test.m: Also return number of expected failures. + 2007-06-14 John W. Eaton <jwe@octave.org> + * set/ismember.m: Mark two tests known to fail with xtest. + * plot/__go_draw_axes__.m: Handle text rotation property. 2007-06-14 Paul Kienzle <pkienzle@users.sf.net>
--- a/scripts/set/ismember.m +++ b/scripts/set/ismember.m @@ -120,8 +120,8 @@ %!assert (ismember ({''}, {'abc', 'def'}), false); %!assert (ismember ('abc', {'abc', 'def'}), true); %!assert (isempty (ismember ([], [1, 2])), true); -%!assert (ismember ('', {'abc', 'def'}), false); -%!fail ('ismember ([], {1, 2})', 'error:.*'); +%!xtest assert (ismember ('', {'abc', 'def'}), false); +%!xtest fail ('ismember ([], {1, 2})', 'error:.*'); %!fail ('ismember ({[]}, {1, 2})', 'error:.*'); %!assert (ismember ({'foo', 'bar'}, {'foobar'}), logical ([0, 0])) %!assert (ismember ({'foo'}, {'foobar'}), false)
--- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -53,7 +53,7 @@ ## the current test. ## ## Called with a single output argument @var{success}, @code{test} returns -## true is all of the tests were successful. Called with two output arguments +## true if all of the tests were successful. Called with two output arguments ## @var{n} and @var{max}, the number of sucessful test and the total number ## of tests in the file @var{name} are returned. ## @@ -74,13 +74,15 @@ ## PKG_ADD: mark_as_command test -function [__ret1, __ret2] = test (__name, __flag, __fid) +function [__ret1, __ret2, __ret3] = test (__name, __flag, __fid) ## information from test will be introduced by "key" persistent __signal_fail = "!!!!! "; persistent __signal_empty = "????? "; persistent __signal_block = " ***** "; persistent __signal_file = ">>>>> "; + __xfail = 0; + if (nargin < 2 || isempty (__flag)) __flag = "quiet"; endif @@ -299,7 +301,7 @@ endif ## strip comments off the variables - __idx = find (__vars=="%" | __vars == "#"); + __idx = find (__vars == "%" | __vars == "#"); if (! isempty (__idx)) __vars = __vars(1:__idx(1)-1); endif @@ -438,6 +440,7 @@ catch if (strcmp (__type, "xtest")) __msg = sprintf ("%sknown failure\n%s", __signal_fail, __error_text__); + __xfail++; else __msg = sprintf ("%stest failed\n%s", __signal_fail, __error_text__); __success = 0; @@ -484,7 +487,12 @@ eval (__clear, ""); if (nargout == 0) - printf ("PASSES %d out of %d tests\n", __successes, __tests); + if (__xfail) + printf ("PASSES %d out of %d tests (%d expected failures)\n", + __successes, __tests, __xfail); + else + printf ("PASSES %d out of %d tests\n", __successes, __tests); + endif elseif (__grabdemo) __ret1 = __demo_code; __ret2 = __demo_idx; @@ -493,6 +501,7 @@ else __ret1 = __successes; __ret2 = __tests; + __ret3 = __xfail; endif endfunction
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2007-06-15 John W. Eaton <jwe@octave.org> + + * fntests.m: Also report expected failures in summary. + 2007-06-06 John W. Eaton <jwe@octave.org> * test_signal.m: Rename internal assert function to xassert.
--- a/test/fntests.m +++ b/test/fntests.m @@ -58,11 +58,11 @@ || findstr (str, "%!error") || findstr (str, "%!warning")); endfunction -function [dp, dn] = run_test_dir (fid, d); +function [dp, dn, dxf] = run_test_dir (fid, d); global files_with_tests; global files_with_no_tests; lst = dir (d); - dp = dn = 0; + dp = dn = dxf = 0; for i = 1:length (lst) nm = lst(i).name; if (length (nm) > 5 && strcmp (nm(1:5), "test_") @@ -71,7 +71,7 @@ ffnm = fullfile (d, nm); if (hastests (ffnm)) print_test_file_name (nm); - [p, n] = test (nm(1:(end-2)), "quiet", fid); + [p, n, xf] = test (nm(1:(end-2)), "quiet", fid); print_pass_fail (n, p); files_with_tests(end+1) = ffnm; else @@ -79,24 +79,26 @@ endif dp += p; dn += n; + dxf += xf; endif endfor endfunction -function [dp, dn] = run_test_script (fid, d); +function [dp, dn, dxf] = run_test_script (fid, d); global files_with_tests; global files_with_no_tests; global topsrcdir; global topbuilddir; lst = dir (d); - dp = dn = 0; + dp = dn = dxf = 0; for i = 1:length (lst) nm = lst(i).name; if (lst(i).isdir && ! strcmp (nm, ".") && ! strcmp (nm, "..") && ! strcmp (nm, "CVS")) - [p, n] = run_test_script (fid, [d, "/", nm]); + [p, n, xf] = run_test_script (fid, [d, "/", nm]); dp += p; dn += n; + dxf += xf; endif endfor for i = 1:length (lst) @@ -104,16 +106,17 @@ if ((length (nm) > 3 && strcmp (nm((end-2):end), ".cc")) || (length (nm) > 2 && strcmp (nm((end-1):end), ".m"))) f = fullfile (d, nm); - p = n = 0; + p = n = xf = 0; ## Only run if it contains %!test, %!assert %!error or %!warning if (hastests (f)) tmp = strrep (f, [topsrcdir, "/"], ""); tmp = strrep (tmp, [topbuilddir, "/"], "../"); print_test_file_name (tmp); - [p, n] = test (f, "quiet", fid); + [p, n, xf] = test (f, "quiet", fid); print_pass_fail (n, p); dp += p; dn += n; + dxf += xf; files_with_tests(end+1) = f; else files_with_no_tests(end+1) = f; @@ -150,22 +153,28 @@ error ("could not open fntests.log for writing"); endif test ("", "explain", fid); - dp = dn = 0; + dp = dn = dxf = 0; printf ("\nIntegrated test scripts:\n\n"); for i = 1:length (fundirs) - [p, n] = run_test_script (fid, fundirs{i}); + [p, n, xf] = run_test_script (fid, fundirs{i}); dp += p; dn += n; + dxf += xf; endfor printf ("\nFixed test scripts:\n\n"); for i = 1:length (testdirs) - [p, n] = run_test_dir (fid, testdirs{i}); + [p, n, xf] = run_test_dir (fid, testdirs{i}); dp += p; dn += n; + dxf += xf; endfor printf ("\nSummary:\n\n PASS %6d\n", dp); nfail = dn - dp; printf (" FAIL %6d\n", nfail); + if (dxf > 0) + printf ("\nThere were %d expected failures (see fntests.log for details).\n", + dxf); + endif n_files_with_no_tests = length (files_with_no_tests); n_files = n_files_with_no_tests + length (files_with_tests); printf ("\n%d (of %d) files have no tests. Please help improve Octave by\n",