# HG changeset patch # User John W. Eaton # Date 1263408177 18000 # Node ID ffc5426c85a43d1db0231386115cdf15666c2cfc # Parent eb8ac0eed9f1c442e4a95e29d10f53f2603000c7 build_bc_overload_tests.sh: accept expected results file as argument diff --git a/test/ChangeLog b/test/ChangeLog --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2010-01-13 John W. Eaton + + * Makefile.am (test_bc_overloads.m): Accept expected results + file as argument. Style fixes. + 2010-01-13 Jaroslav Hajek * build_bc_overload_tests.sh: New shell script. diff --git a/test/Makefile.am b/test/Makefile.am --- a/test/Makefile.am +++ b/test/Makefile.am @@ -69,7 +69,7 @@ $(srcdir)/build_sparse_tests.sh test_bc_overloads.m: build_bc_overload_tests.sh bc_overloads_expected - $(srcdir)/build_bc_overload_tests.sh + $(srcdir)/build_bc_overload_tests.sh $(srcdir)/bc_overloads_expected EXTRA_DIST = \ ChangeLog \ diff --git a/test/build_bc_overload_tests.sh b/test/build_bc_overload_tests.sh --- a/test/build_bc_overload_tests.sh +++ b/test/build_bc_overload_tests.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh # Copyright (C) 2010 VZLU Prague # @@ -18,30 +18,52 @@ # along with Octave; see the file COPYING. If not, see # . -CLASSES="double single char logical int8 int16 int32 int64 \ -uint8 uint16 uint32 uint64 struct cell function_handle" +CLASSES=" + double + single + char + logical + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + struct + cell + function_handle +" -for class in $CLASSES ; do - DIR=\@$class - test -d $DIR || mkdir $DIR || { echo "error: could not create $DIR" ; exit ; } - cat > $DIR/tbcover.m <&2 + exit 1 +fi + +for class in $CLASSES; do + DIR="@$class" + test -d $DIR || mkdir $DIR || { echo "error: could not create $DIR"; exit; } + cat > $DIR/tbcover.m << EOF % DO NOT EDIT - generated automatically function s = tbcover (x, y) s = '$class'; -end +EOF done -cat > tbcover.m < tbcover.m << EOF % DO NOT EDIT - generated automatically function s = tbcover (x, y) s = 'none'; -end +EOF if test "$1" == "overloads_only" ; then - exit + exit fi -cat > test_bc_overloads.m < 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. @@ -62,20 +84,20 @@ %! ex.struct = struct (); %! ex.function_handle = @numel; -end +EOF -cat bc_overloads_expected |\ +cat $expected_results_file | \ while read cl1 cl2 clr ; do - cat >> test_bc_overloads.m <> test_bc_overloads.m << EOF %% Name call %!assert (tbcover (ex.$cl1, ex.$cl2), "$clr") %% Handle call %!assert ((@tbcover) (ex.$cl1, ex.$cl2), "$clr") -end +EOF done -cat >> test_bc_overloads.m <> test_bc_overloads.m << EOF %%test handles through cellfun %!test %! f = fieldnames (ex); @@ -89,4 +111,4 @@ %! endfor %! endfor %! assert (cellfun (@tbcover, c1, c2, "uniformoutput", false), s); -end +EOF