changeset 14131:c3309e1ec50d stable

test: Use Octave coding and spacing conventions for fixed test scripts * build_bc_overload_tests.sh, build_bc_overloads_expected.m, build_sparse_tests.sh, test_args.m, test_contin.m, test_diag_perm.m, test_error.m, test_eval-catch.m, test_for.m, test_func.m, test_global.m, test_if.m, test_index.m, test_io.m, test_logical_index.m, test_null_assign.m, test_parser.m, test_prefer.m, test_range.m, test_recursion.m, test_return.m, test_slice.m, test_struct.m, test_switch.m, test_system.m, test_transpose.m, test_try.m, test_unwind.m, test_while.m: Use Octave coding and spacing conventions for fixed test scripts.
author Rik <octave@nomad.inbox5.com>
date Sun, 01 Jan 2012 20:04:52 -0800
parents e13bfbc2c4c5
children 09cc39ba8312
files test/build_bc_overload_tests.sh test/build_bc_overloads_expected.m test/build_sparse_tests.sh test/test_args.m test/test_contin.m test/test_diag_perm.m test/test_error.m test/test_eval-catch.m test/test_for.m test/test_func.m test/test_global.m test/test_if.m test/test_index.m test/test_io.m test/test_logical_index.m test/test_null_assign.m test/test_parser.m test/test_prefer.m test/test_range.m test/test_recursion.m test/test_return.m test/test_slice.m test/test_struct.m test/test_switch.m test/test_system.m test/test_transpose.m test/test_try.m test/test_unwind.m test/test_while.m
diffstat 29 files changed, 1601 insertions(+), 1836 deletions(-) [+]
line wrap: on
line diff
--- a/test/build_bc_overload_tests.sh
+++ b/test/build_bc_overload_tests.sh
@@ -47,14 +47,16 @@
   DIR="@$class"
   test -d $DIR || mkdir $DIR || { echo "error: could not create $DIR"; exit; }
   cat > $DIR/tbcover.m << EOF
-% DO NOT EDIT - generated automatically
+% !!! DO NOT EDIT !!!
+% generated automatically by build_bc_overload_tests.sh
 function s = tbcover (x, y)
   s = '$class';
 EOF
 done
 
 cat > tbcover.m << EOF
-% DO NOT EDIT - generated automatically
+% !!! DO NOT EDIT !!!
+% generated automatically by build_bc_overload_tests.sh
 function s = tbcover (x, y)
   s = 'none';
 EOF
@@ -64,8 +66,9 @@
 fi
 
 cat > test_bc_overloads.m << EOF
-## THIS IS AN AUTOMATICALLY GENERATED FILE --- DO NOT EDIT ---
-## instead modify build_bc_overload_tests.sh to generate the tests that you want.
+## !!! DO NOT EDIT !!!
+## THIS IS AN AUTOMATICALLY GENERATED FILE
+## modify build_bc_overload_tests.sh to generate the tests you need.
 
 %!shared ex
 %! ex.double = 1;
--- a/test/build_bc_overloads_expected.m
+++ b/test/build_bc_overloads_expected.m
@@ -1,7 +1,7 @@
 % this script is intended to be Matlab compatible
 % first, run the script
 %
-%   ./build_bc_overloads_tests.sh overloads_onely
+%   ./build_bc_overloads_tests.sh overloads_only
 %
 % to generate the overloaded functions.
 %
--- a/test/build_sparse_tests.sh
+++ b/test/build_sparse_tests.sh
@@ -121,8 +121,9 @@
 
 # create initial file
 cat >$TESTS <<EOF
-## THIS IS AN AUTOMATICALLY GENERATED FILE --- DO NOT EDIT ---
-## instead modify build_sparse_tests.sh to generate the tests that you want.
+## !!! DO NOT EDIT !!!
+## THIS IS AN AUTOMATICALLY GENERATED FILE
+## modify build_sparse_tests.sh to generate the tests you need.
 EOF
 
 
@@ -150,21 +151,21 @@
 gen_eat_zeros() {
 cat >>$TESTS <<EOF
 %% Make sure newly introduced zeros get eaten
-%!assert(nnz(sparse([bf,bf,1]).^realmax),1);
-%!assert(nnz(sparse([1,bf,bf]).^realmax),1);
-%!assert(nnz(sparse([bf,bf,bf]).^realmax),0); 
+%!assert (nnz (sparse ([bf,bf,1]).^realmax), 1)
+%!assert (nnz (sparse ([1,bf,bf]).^realmax), 1)
+%!assert (nnz (sparse ([bf,bf,bf]).^realmax), 0)
 
-%!assert(nnz(sparse([bf;bf;1]).^realmax),1);
-%!assert(nnz(sparse([1;bf;bf]).^realmax),1);
-%!assert(nnz(sparse([0.5;bf;bf]).^realmax),0);
+%!assert (nnz (sparse ([bf;bf;1]).^realmax), 1)
+%!assert (nnz (sparse ([1;bf;bf]).^realmax), 1)
+%!assert (nnz (sparse ([0.5;bf;bf]).^realmax), 0)
 
-%!assert(nnz(sparse([bf,bf,1])*realmin),1);
-%!assert(nnz(sparse([1,bf,bf])*realmin),1);
-%!assert(nnz(sparse([bf,bf,bf])*realmin),0);
+%!assert (nnz (sparse ([bf,bf,1])*realmin), 1)
+%!assert (nnz (sparse ([1,bf,bf])*realmin), 1)
+%!assert (nnz (sparse ([bf,bf,bf])*realmin), 0)
 
-%!assert(nnz(sparse([bf;bf;1])*realmin),1);
-%!assert(nnz(sparse([1;bf;bf])*realmin),1);
-%!assert(nnz(sparse([bf;bf;bf])*realmin),0);
+%!assert (nnz (sparse ([bf;bf;1])*realmin), 1)
+%!assert (nnz (sparse ([1;bf;bf])*realmin), 1)
+%!assert (nnz (sparse ([bf;bf;bf])*realmin), 0)
 
 EOF
 }
@@ -174,25 +175,25 @@
 
 %!test # segfault test from edd@debian.org
 %! n = 510;
-%! sparse(kron((1:n)', ones(n,1)), kron(ones(n,1), (1:n)'), ones(n)); 
+%! sparse (kron ((1:n)', ones(n,1)), kron (ones(n,1), (1:n)'), ones (n)); 
 
 %% segfault tests from Fabian@isas-berlin.de
 %% Note that the last four do not fail, but rather give a warning
 %% of a singular matrix, which is consistent with the full matrix
-%% behaviour. They are therefore disabled.. 
+%% behaviour.  They are therefore disabled.
 %!testif HAVE_UMFPACK
-%! assert(inv(sparse([1,1;1,1+i])),sparse([1-1i,1i;1i,-1i]),10*eps);
-% !error inv( sparse( [1,1;1,1]   ) );
-% !error inv( sparse( [0,0;0,1]   ) );
-% !error inv( sparse( [0,0;0,1+i] ) );
-% !error inv( sparse( [0,0;0,0]   ) );
+%! assert (inv (sparse ([1,1;1,1+i])), sparse([1-1i,1i;1i,-1i]), 10*eps);
+%#!error inv ( sparse ([1,1;1,1]  ) );
+%#!error inv ( sparse ([0,0;0,1]  ) );
+%#!error inv ( sparse ([0,0;0,1+i]) );
+%#!error inv ( sparse ([0,0;0,0]  ) );
 
 %% error handling in constructor
-%!error sparse(1,[2,3],[1,2,3]);
-%!error sparse([1,1],[1,1],[1,2],3,3,"bogus");
-%!error sparse([1,3],[1,-4],[3,5],2,2);
-%!error sparse([1,3],[1,-4],[3,5i],2,2);
-%!error sparse(-1,-1,1);
+%!error sparse (1,[2,3],[1,2,3])
+%!error sparse ([1,1],[1,1],[1,2],3,3,"bogus")
+%!error sparse ([1,3],[1,-4],[3,5],2,2)
+%!error sparse ([1,3],[1,-4],[3,5i],2,2)
+%!error sparse (-1,-1,1)
 EOF
 }
 
@@ -207,17 +208,18 @@
     echo '%!test bf=realmin+realmin*1i;' >> $TESTS
     gen_eat_zeros
     cat >>$TESTS <<EOF
-%!assert(nnz(sparse([-1,realmin,realmin]).^1.5),1);
-%!assert(nnz(sparse([-1,realmin,realmin,1]).^1.5),2);
+%!assert (nnz (sparse ([-1,realmin,realmin]).^1.5), 1)
+%!assert (nnz (sparse ([-1,realmin,realmin,1]).^1.5), 2)
 
-%!assert(nnz(sparse(1,1,0)),0); # Make sure scalar v==0 doesn't confuse matters
-%!assert(nnz(sparse(eye(3))*0),0);
-%!assert(nnz(sparse(eye(3))-sparse(eye(3))),0);
+## Make sure scalar v==0 doesn't confuse matters
+%!assert (nnz (sparse (1,1,0)), 0)
+%!assert (nnz (sparse (eye (3))*0), 0)
+%!assert (nnz (sparse (eye (3))-sparse (eye (3))), 0)
 
 %!test
 %! wdbz = warning ("query", "Octave:divide-by-zero");
 %! warning ("off", "Octave:divide-by-zero");
-%! assert(full(sparse(eye(3))/0),full(eye(3)/0));
+%! assert (full (sparse (eye (3))/0), full (eye (3)/0));
 %! warning (wdbz.state, "Octave:divide-by-zero");
 
 EOF
@@ -234,9 +236,9 @@
 ## test_sparse
 ##
 ##    run preset sparse tests.  All should pass.
-function [passes,tests] = test_sparse
-  disp("writing test output to sptest.log");
-  test("test_sparse","normal","sptest.log");
+function [passes, tests] = test_sparse
+  disp ("writing test output to sptest.log");