# HG changeset patch # User John W. Eaton # Date 1435874439 14400 # Node ID dadfb0be8a42f0d65c98760f2189c85b812af28e # Parent 3c87bcf7e0f911d3d27b19707706d18491bbc570 write sparse tests to stdout * test/build-sparse-tests.sh: Write output to stdout. * Makefile.am (sparse.tst): Adapt rule. diff -r 3c87bcf7e0f9 -r dadfb0be8a42 test/Makefile.am --- a/test/Makefile.am Thu Jul 02 17:44:05 2015 -0400 +++ b/test/Makefile.am Thu Jul 02 18:00:39 2015 -0400 @@ -80,7 +80,9 @@ endif sparse.tst: build-sparse-tests.sh - $(AM_V_GEN)$(srcdir)/build-sparse-tests.sh + $(AM_V_GEN)rm -f $@-t $@ && \ + $(srcdir)/build-sparse-tests.sh > $@-t && \ + mv $@-t $@ GENERATED_BC_OVERLOADS_DIRS := \ $(shell $(srcdir)/build-bc-overload-tests.sh --list-dirs) diff -r 3c87bcf7e0f9 -r dadfb0be8a42 test/build-sparse-tests.sh --- a/test/build-sparse-tests.sh Thu Jul 02 17:44:05 2015 -0400 +++ b/test/build-sparse-tests.sh Thu Jul 02 18:00:39 2015 -0400 @@ -113,14 +113,8 @@ *) echo "build-sparse-tests.sh random|preset" && exit 1 ;; esac -if $preset; then - TESTS=sparse.tst -else - TESTS=sprandom.tst -fi - # create initial file -cat >$TESTS <>$TESTS <>$TESTS <>$TESTS <> $TESTS - echo '%!test bf=realmin;' >> $TESTS + echo '%!shared bf' + echo '%!test bf=realmin;' gen_eat_zeros - echo '%!test bf=realmin+realmin*1i;' >> $TESTS + echo '%!test bf=realmin+realmin*1i;' gen_eat_zeros - cat >>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <=bs, sparse (af>=bf)) %!assert (as>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS +echo "%!assert ($1(as), sparse ($1(af)))" } print_real_mapper_test() { - cat >>$TESTS <>$TESTS +echo "%% Unary matrix tests (uses af,as)" print_mapper_test abs print_mapper_test acos print_mapper_test acosh @@ -483,7 +477,7 @@ print_mapper_test tanh # Specific tests for certain mapper functions - cat >>$TESTS <>$TESTS +echo "%% Unary matrix tests (uses af,as)" print_real_mapper_test erf 1 print_real_mapper_test erfc 1 #print_real_mapper_test gamma 1 @@ -511,7 +505,7 @@ #print_real_mapper_test gammaln 1 # Specific tests for certain mapper functions - cat >>$TESTS <>$TESTS <>$TESTS <>$TESTS <> $TESTS - echo '%!test bs = bf;' >> $TESTS + echo '%!test as = sparse (af);' + echo '%!test bs = bf;' gen_elementop_tests gen_ordering_tests - echo '%!test bf = bf+1i;' >>$TESTS - echo '%!test bs = bf;' >> $TESTS + echo '%!test bf = bf+1i;' + echo '%!test bs = bf;' gen_elementop_tests } # test matrix operations: uses af and bf; modifies as,bs gen_rectangular_tests() { - echo '%!test as = sparse(af);' >> $TESTS - echo '%!test bs = sparse(bf);' >>$TESTS + echo '%!test as = sparse(af);' + echo '%!test bs = sparse(bf);' gen_mapper_tests gen_real_mapper_tests gen_unaryop_tests @@ -748,7 +742,7 @@ # gen_divop_tests # Disable rectangular \ and / for now gen_matrixdiag_tests gen_matrixreshape_tests - cat >>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <>$TESTS <> $TESTS +echo '%!shared as,af,bs,bf' if $preset; then - echo '%!test af=[1+1i,2-1i,0,0;0,0,0,3+2i;0,0,0,4];' >> $TESTS - echo '%!test bf=3;' >>$TESTS + echo '%!test af=[1+1i,2-1i,0,0;0,0,0,3+2i;0,0,0,4];' + echo '%!test bf=3;' else - cat >>$TESTS <> $TESTS - echo '%!test bf=[0,1-1i,0,0;2+1i,0,0,0;3-1i,2+3i,0,0];' >> $TESTS + echo '%!test af=[1+1i,2-1i,0,0;0,0,0,3+2i;0,0,0,4];' + echo '%!test bf=[0,1-1i,0,0;2+1i,0,0,0;3-1i,2+3i,0,0];' else - cat >>$TESTS <> $TESTS +echo '%!test bf = real (bf);' gen_rectangular_tests gen_section gen_sparsesparse_ordering_tests gen_section -echo '%!test af = real (af);' >> $TESTS +echo '%!test af = real (af);' gen_rectangular_tests gen_section gen_save_tests gen_section -echo '%!test bf = bf+1i*(bf!=0);' >> $TESTS +echo '%!test bf = bf+1i*(bf!=0);' gen_rectangular_tests gen_section # square operations if $preset; then - echo '%!test af = [1+1i,2-1i,0,0;0,0,0,3+2i;0,0,0,4];' >> $TESTS - echo '%! as = sparse (af);' >> $TESTS - echo '%!test bf = [0,1-1i,0,0;2+1i,0,0,0;3-1i,2+3i,0,0];' >> $TESTS + echo '%!test af = [1+1i,2-1i,0,0;0,0,0,3+2i;0,0,0,4];' + echo '%! as = sparse (af);' + echo '%!test bf = [0,1-1i,0,0;2+1i,0,0,0;3-1i,2+3i,0,0];' else - cat >>$TESTS <>$TESTS <> $TESTS -echo '%! bs = sparse (bf);' >> $TESTS +echo '%!test bf = real (bf);' +echo '%! bs = sparse (bf);' gen_square_tests gen_section -echo '%!test af = real (af);' >> $TESTS -echo '%! as = sparse (af);' >> $TESTS +echo '%!test af = real (af);' +echo '%! as = sparse (af);' gen_square_tests gen_section -echo '%!test bf = bf+1i*(bf!=0);' >> $TESTS -echo '%! bs = sparse (bf);' >> $TESTS +echo '%!test bf = bf+1i*(bf!=0);' +echo '%! bs = sparse (bf);' gen_square_tests gen_section # cholesky tests if $preset; then - echo '%!test bf = [5,0,1+1i,0;0,5,0,1-2i;1-1i,0,5,0;0,1+2i,0,5];' >> $TESTS - echo '%! bs = sparse (bf);' >> $TESTS + echo '%!test bf = [5,0,1+1i,0;0,5,0,1-2i;1-1i,0,5,0;0,1+2i,0,5];' + echo '%! bs = sparse (bf);' else - echo '# This has a small chance of failing to create a positive definite matrix' >> $TESTS - echo '%!test n = floor (lognrnd (8,2)+1)' >> $TESTS - echo '%! bs = n*speye (n,n) + sprandn (n,n,0.3);' >> $TESTS - echo '%! bf = full (bs);' >> $TESTS + echo '# This has a small chance of failing to create a positive definite matrix' + echo '%!test n = floor (lognrnd (8,2)+1)' + echo '%! bs = n*speye (n,n) + sprandn (n,n,0.3);' + echo '%! bf = full (bs);' fi gen_cholesky_tests gen_section -echo '%!test bf = real (bf);' >> $TESTS -echo '%! bs = sparse (bf);' >> $TESTS +echo '%!test bf = real (bf);' +echo '%! bs = sparse (bf);' gen_cholesky_tests gen_section # assembly tests -echo '%!shared r,c,m,n,fsum,funiq' >>$TESTS +echo '%!shared r,c,m,n,fsum,funiq' if $use_preset; then - cat >>$TESTS <>$TESTS <>$TESTS +echo '%!shared ridx,cidx,idx,as,af' if $use_preset; then - cat >>$TESTS <>$TESTS <> $TESTS +echo '%!test af = real (af);' gen_select_tests gen_section -echo '%!shared alpha,beta,df,pdf,lf,plf,uf,puf,bf,cf,bcf,tf,tcf,xf,ds,pds,ls,pls,us,pus,bs,cs,bcs,ts,tcs,xs' >>$TESTS -echo '%!test alpha=1; beta=1;' >> $TESTS +echo '%!shared alpha,beta,df,pdf,lf,plf,uf,puf,bf,cf,bcf,tf,tcf,xf,ds,pds,ls,pls,us,pus,bs,cs,bcs,ts,tcs,xs' +echo '%!test alpha=1; beta=1;' gen_solver_tests -echo '%!test alpha=1; beta=1i;' >> $TESTS +echo '%!test alpha=1; beta=1i;' gen_solver_tests -echo '%!test alpha=1i; beta=1;' >> $TESTS +echo '%!test alpha=1i; beta=1;' gen_solver_tests -echo '%!test alpha=1i; beta=1i;' >> $TESTS +echo '%!test alpha=1i; beta=1i;' gen_solver_tests gen_section