Mercurial > hg > octave-lojdl
changeset 14039:e98140f84ae0 stable
test: Rewrite %!tests to preserve warning state.
* iscolumn.m, isrow.m, isscalar.m, isvector.m, example.m:
Rewrite %!tests to preserve warning state.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 12 Dec 2011 21:40:07 -0800 |
parents | b0cdd60db5e5 |
children | a64f8b6f63e9 |
files | scripts/general/iscolumn.m scripts/general/isrow.m scripts/general/isscalar.m scripts/general/isvector.m scripts/testfun/example.m |
diffstat | 5 files changed, 46 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/iscolumn.m +++ b/scripts/general/iscolumn.m @@ -35,26 +35,22 @@ endfunction -%!assert(iscolumn ([1, 2, 3]), false); -%!assert(iscolumn ([1; 2; 3])); -%!assert(iscolumn (1)); -%!assert(iscolumn ([]), false); -%!assert(iscolumn ([1, 2; 3, 4]), false); -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert((iscolumn ("t"))); -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert(!(iscolumn ("test"))); +%!assert (iscolumn ([1, 2, 3]), false) +%!assert (iscolumn ([1; 2; 3])) +%!assert (iscolumn (1)) +%!assert (iscolumn ([]), false) +%!assert (iscolumn ([1, 2; 3, 4]), false) -%!assert(!(iscolumn (["test"; "ing"]))); +%!assert (iscolumn ("t")) +%!assert (iscolumn ("test"), false) +%!assert (iscolumn (["test"; "ing"]), false) %!test %! s.a = 1; -%! assert((iscolumn (s))); +%! assert (iscolumn (s)); %% Test input validation -%!error iscolumn (); -%!error iscolumn ([1, 2], 2); +%!error iscolumn () +%!error iscolumn ([1, 2], 2)
--- a/scripts/general/isrow.m +++ b/scripts/general/isrow.m @@ -35,26 +35,22 @@ endfunction -%!assert(isrow ([1, 2, 3])); -%!assert(isrow ([1; 2; 3]), false); -%!assert(isrow (1)); -%!assert(isrow ([]), false); -%!assert(isrow ([1, 2; 3, 4]), false); -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert((isrow ("t"))); -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert((isrow ("test"))); +%!assert (isrow ([1, 2, 3])) +%!assert (isrow ([1; 2; 3]), false) +%!assert (isrow (1)) +%!assert (isrow ([]), false) +%!assert (isrow ([1, 2; 3, 4]), false) -%!assert(!(isrow (["test"; "ing"]))); +%!assert (isrow ("t")) +%!assert (isrow ("test")) +%!assert (isrow (["test"; "ing"]), false) %!test %! s.a = 1; -%! assert((isrow (s))); +%! assert (isrow (s)); %% Test input validation -%!error isrow (); -%!error isrow ([1, 2], 2); +%!error isrow () +%!error isrow ([1, 2], 2)
--- a/scripts/general/isscalar.m +++ b/scripts/general/isscalar.m @@ -34,23 +34,21 @@ endfunction -%!assert(isscalar (1)); -%!assert(!(isscalar ([1, 2]))); -%!assert(!(isscalar ([]))); -%!assert(!(isscalar ([1, 2; 3, 4]))); -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert((isscalar ("t"))); +%!assert (isscalar (1)) +%!assert (isscalar ([1, 2]), false) +%!assert (isscalar ([]), false) +%!assert (isscalar ([1, 2; 3, 4]), false) -%!assert(!(isscalar ("test"))); -%!assert(!(isscalar (["test"; "ing"]))); +%!assert (isscalar ("t")) +%!assert (isscalar ("test"), false) +%!assert (isscalar (["test"; "ing"]), false) %!test %! s.a = 1; -%! assert((isscalar (s))); +%! assert (isscalar (s)); %% Test input validation -%!error isscalar (); -%!error isscalar (1, 2); +%!error isscalar () +%!error isscalar (1, 2)
--- a/scripts/general/isvector.m +++ b/scripts/general/isvector.m @@ -37,26 +37,21 @@ endfunction -%!assert(isvector (1)); -%!assert(isvector ([1; 2; 3])); -%!assert(!(isvector ([]))); -%!assert(!(isvector ([1, 2; 3, 4]))); -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert((isvector ("t"))); +%!assert (isvector (1)) +%!assert (isvector ([1; 2; 3])) +%!assert (isvector ([]), false) +%!assert (isvector ([1, 2; 3, 4]), false) -%!test -%! warning ("off", "Octave:str-to-num"); -%! assert((isvector ("test"))); - -%!assert(!(isvector (["test"; "ing"]))); +%!assert (isvector ("t")) +%!assert (isvector ("test")) +%!assert (isvector (["test"; "ing"]), false) %!test %! s.a = 1; -%! assert((isvector (s))); +%! assert (isvector (s)); %% Test input validation -%!error isvector (); -%!error isvector ([1, 2], 2); +%!error isvector () +%!error isvector ([1, 2], 2)
--- a/scripts/testfun/example.m +++ b/scripts/testfun/example.m @@ -83,6 +83,7 @@ endfunction + %!## warning: don't modify the demos without modifying the tests! %!demo %! example ('example'); @@ -98,5 +99,6 @@ %! assert (idx, [1, 23, 63]); %% Test input validation -%!error example; -%!error example('example', 3, 5) +%!error example +%!error example ('example', 3, 5) +