Mercurial > hg > octave-nkf
changeset 17314:7f27a3cbdb41
Use Octave coding convention of 1 space after '%!' test prefix.
* scripts/signal/fftconv.m, scripts/signal/fftshift.m,
scripts/testfun/assert.m, test/args.tst:
Use Octave coding convention of 1 space after '%!' test prefix.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 21 Aug 2013 20:41:05 -0700 |
parents | 1e1d42f0f332 |
children | 3abed16370ad |
files | scripts/signal/fftconv.m scripts/signal/fftshift.m scripts/testfun/assert.m test/args.tst |
diffstat | 4 files changed, 85 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/signal/fftconv.m +++ b/scripts/signal/fftconv.m @@ -67,36 +67,36 @@ %% FIXME: Borrow tests from conv.m. May need a tolerance on the assert comparison %!test -%! x = ones (3,1); -%! y = ones (1,3); -%! b = 2; -%! c = 3; -%! assert (fftconv (x, x), [1; 2; 3; 2; 1], 5*eps); -%! assert (fftconv (y, y), [1, 2, 3, 2, 1], 5*eps); -%! assert (fftconv (x, y), [1, 2, 3, 2, 1], 5*eps); -%! assert (fftconv (y, x), [1; 2; 3; 2; 1], 5*eps); -%! assert (fftconv (c, x), [3; 3; 3], 5*eps); -%! assert (fftconv (c, y), [3, 3, 3], 5*eps); -%! assert (fftconv (x, c), [3; 3; 3], 5*eps); -%! assert (fftconv (y, c), [3, 3, 3], 5*eps); -%! assert (fftconv (b, c), 6, 5*eps); +%! x = ones (3,1); +%! y = ones (1,3); +%! b = 2; +%! c = 3; +%! assert (fftconv (x, x), [1; 2; 3; 2; 1], 5*eps); +%! assert (fftconv (y, y), [1, 2, 3, 2, 1], 5*eps); +%! assert (fftconv (x, y), [1, 2, 3, 2, 1], 5*eps); +%! assert (fftconv (y, x), [1; 2; 3; 2; 1], 5*eps); +%! assert (fftconv (c, x), [3; 3; 3], 5*eps); +%! assert (fftconv (c, y), [3, 3, 3], 5*eps); +%! assert (fftconv (x, c), [3; 3; 3], 5*eps); +%! assert (fftconv (y, c), [3, 3, 3], 5*eps); +%! assert (fftconv (b, c), 6, 5*eps); %!test -%! a = 1:10; -%! b = 1:3; -%! assert (size (conv (a,b)), [1, numel(a)+numel(b)-1]) -%! assert (size (conv (b,a)), [1, numel(a)+numel(b)-1]) +%! a = 1:10; +%! b = 1:3; +%! assert (size (conv (a,b)), [1, numel(a)+numel(b)-1]); +%! assert (size (conv (b,a)), [1, numel(a)+numel(b)-1]); -%! a = (1:10).'; -%! b = 1:3; -%! assert (size (conv (a,b)), [numel(a)+numel(b)-1, 1]) -%! assert (size (conv (b,a)), [numel(a)+numel(b)-1, 1]) +%! a = (1:10).'; +%! b = 1:3; +%! assert (size (conv (a,b)), [numel(a)+numel(b)-1, 1]); +%! assert (size (conv (b,a)), [numel(a)+numel(b)-1, 1]); %!test -%! a = 1:10; -%! b = (1:3).'; -%! assert (size (conv (a,b)), [1, numel(a)+numel(b)-1]) -%! assert (size (conv (b,a)), [1, numel(a)+numel(b)-1]) +%! a = 1:10; +%! b = (1:3).'; +%! assert (size (conv (a,b)), [1, numel(a)+numel(b)-1]); +%! assert (size (conv (b,a)), [1, numel(a)+numel(b)-1]); %% Test input validation %!error fftconv (1)
--- a/scripts/signal/fftshift.m +++ b/scripts/signal/fftshift.m @@ -85,47 +85,47 @@ %!test -%! x = [0:7]; -%! y = fftshift (x); -%! assert (y, [4 5 6 7 0 1 2 3]); -%! assert (fftshift (y), x); +%! x = [0:7]; +%! y = fftshift (x); +%! assert (y, [4 5 6 7 0 1 2 3]); +%! assert (fftshift (y), x); %!test -%! x = [0:6]; -%! y = fftshift (x); -%! assert (y, [4 5 6 0 1 2 3]); -%! assert (fftshift (y), [1 2 3 4 5 6 0]); +%! x = [0:6]; +%! y = fftshift (x); +%! assert (y, [4 5 6 0 1 2 3]); +%! assert (fftshift (y), [1 2 3 4 5 6 0]); %!test -%! x = [0:7]'; -%! y = fftshift (x); -%! assert (y, [4;5;6;7;0;1;2;3]); -%! assert (fftshift (y), x); +%! x = [0:7]'; +%! y = fftshift (x); +%! assert (y, [4;5;6;7;0;1;2;3]); +%! assert (fftshift (y), x); %!test -%! x = [0:6]'; -%! y = fftshift (x); -%! assert (y, [4;5;6;0;1;2;3]); -%! assert (fftshift (y), [1;2;3;4;5;6;0]); +%! x = [0:6]'; +%! y = fftshift (x); +%! assert (y, [4;5;6;0;1;2;3]); +%! assert (fftshift (y), [1;2;3;4;5;6;0]); %!test -%! x = [0:3]; -%! x = [x;2*x;3*x+1;4*x+1]; -%! y = fftshift (x); -%! assert (y, [[7 10 1 4];[9 13 1 5];[2 3 0 1];[4 6 0 2]]); -%! assert (fftshift (y), x); +%! x = [0:3]; +%! x = [x;2*x;3*x+1;4*x+1]; +%! y = fftshift (x); +%! assert (y, [[7 10 1 4];[9 13 1 5];[2 3 0 1];[4 6 0 2]]); +%! assert (fftshift (y), x); %!test -%! x = [0:3]; -%! x = [x;2*x;3*x+1;4*x+1]; -%! y = fftshift (x,1); -%! assert (y, [[1 4 7 10];[1 5 9 13];[0 1 2 3];[0 2 4 6]]); -%! assert (fftshift (y,1), x); +%! x = [0:3]; +%! x = [x;2*x;3*x+1;4*x+1]; +%! y = fftshift (x,1); +%! assert (y, [[1 4 7 10];[1 5 9 13];[0 1 2 3];[0 2 4 6]]); +%! assert (fftshift (y,1), x); %!test -%! x = [0:3]; -%! x = [x;2*x;3*x+1;4*x+1]; -%! y = fftshift (x,2); -%! assert (y, [[2 3 0 1];[4 6 0 2];[7 10 1 4];[9 13 1 5]]); -%! assert (fftshift (y,2), x); +%! x = [0:3]; +%! x = [x;2*x;3*x+1;4*x+1]; +%! y = fftshift (x,2); +%! assert (y, [[2 3 0 1];[4 6 0 2];[7 10 1 4];[9 13 1 5]]); +%! assert (fftshift (y,2), x);
--- a/scripts/testfun/assert.m +++ b/scripts/testfun/assert.m @@ -549,21 +549,22 @@ ## structures %!error <Expected struct, but observed double> assert (1, struct ("a", 1)) %!error <Structure sizes don't match> -%! x(1,2,3).a = 1; -%! y(1,2).a = 1; -%! assert (x,y); +%! x(1,2,3).a = 1; +%! y(1,2).a = 1; +%! assert (x,y); %!error <Structure sizes don't match> -%! x(1,2,3).a = 1; -%! y(3,2,2).a = 1; -%! assert (x,y); +%! x(1,2,3).a = 1; +%! y(3,2,2).a = 1; +%! assert (x,y); %!error <Structure sizes don't match> -%! x.a = 1; x.b = 1; -%! y.a = 1; -%! assert (x,y); +%! x.a = 1; +%! x.b = 1; +%! y.a = 1; +%! assert (x,y); %!error <'b' is not an expected field> -%! x.b = 1; -%! y.a = 1; -%! assert (x,y); +%! x.b = 1; +%! y.a = 1; +%! assert (x,y); %!test %! x.a = 1; x.b=[2, 2];
--- a/test/args.tst +++ b/test/args.tst @@ -123,98 +123,98 @@ %! assert (x, 0); %!endfunction %!test -%! f() +%! f() ## numeric vector (spaces) %!function f (x = [0 1 2]) %! assert (x, [0 1 2]); %!endfunction %!test -%! f() +%! f() ## numeric vector (range) %!function f (x = 1:3) %! assert (x, 1:3); %!endfunction %!test -%! f() +%! f() ## numeric vector (commas) %!function f (x = [0,1,2]) %! assert (x, [0 1 2]); %!endfunction %!test -%! f() +%! f() ## numeric vector (commas and spaces) %!function f (x = [0, 1, 2]) %! assert (x, [0 1 2]); %!endfunction %!test -%! f() +%! f() ## numeric matrix %!function f (x = [0, 1, 2;3, 4, 5]) %! assert (x, [0 1 2;3 4 5]); %!endfunction %!test -%! f() +%! f() ## empty cell %!function f (x = {}) %! assert (x, {}); %!endfunction %!test -%! f() +%! f() ## full cell %!function f (x = {1}) %! assert (x, {1}); %!endfunction %!test -%! f() +%! f() ## many cells %!function f (x = {1 'a' "b" 2.0 struct("a", 3)}) %! assert (x, {1 'a' "b" 2.0 struct("a", 3)}); %!endfunction %!test -%! f() +%! f() ## struct %!function f (x = struct("a", 3)) %! assert (x, struct ("a", 3)); %!endfunction %!test -%! f() +%! f() ## char (double quotes) %!function f (x = "a") %! assert (x, "a"); %!endfunction %!test -%! f() +%! f() ## char (single quotes) %!function f (x = 'a') %! assert (x, "a"); %!endfunction %!test -%! f() +%! f() ## char (string, double quotes) %!function f (x = "abc123") %! assert (x, "abc123"); %!endfunction %!test -%! f() +%! f() ## char (string, double quotes, punctuation) %!function f (x = "abc123`1234567890-=~!@#$%^&*()_+[]{}|;':\",./<>?\\") %! assert (x, "abc123`1234567890-=~!@#$%^&*()_+[]{}|;':\",./<>?\\"); %!endfunction %!test -%! f() +%! f() ## Function handle (builtin) %!function f (x = @sin) @@ -223,7 +223,7 @@ %! assert (isa (x, "function_handle") && strcmp (fname, "sin")); %!endfunction %!test -%! f() +%! f() ## Function handle (anonymous) %!function f (x = @(x) x.^2) @@ -232,5 +232,5 @@ %! assert (isa (x, "function_handle") && strcmp (ftype, "anonymous")); %!endfunction %!test -%! f() +%! f()