From c8aac123745d775911b4207d050109f9e0f56976 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 10 Jun 2017 11:28:03 +0200 Subject: [PATCH] regression test for device.c "alter" --- configure.ac | 1 + tests/regression/Makefile.am | 2 +- tests/regression/pipe/Makefile.am | 13 ++++ tests/regression/pipe/alter-1.cmd | 100 ++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 tests/regression/pipe/Makefile.am create mode 100644 tests/regression/pipe/alter-1.cmd diff --git a/configure.ac b/configure.ac index 5644bc362..babc72ef9 100644 --- a/configure.ac +++ b/configure.ac @@ -1194,6 +1194,7 @@ AC_CONFIG_FILES([Makefile tests/regression/misc/Makefile tests/regression/sens/Makefile tests/regression/temper/Makefile + tests/regression/pipe/Makefile tests/regression/pz/Makefile tests/sensitivity/Makefile tests/transient/Makefile diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am index c48fe0afe..e199d3bd6 100644 --- a/tests/regression/Makefile.am +++ b/tests/regression/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = lib-processing parser subckt-processing func model misc sens temper pz +SUBDIRS = lib-processing parser subckt-processing func model misc sens temper pipe pz MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/regression/pipe/Makefile.am b/tests/regression/pipe/Makefile.am new file mode 100644 index 000000000..b60d4c0d5 --- /dev/null +++ b/tests/regression/pipe/Makefile.am @@ -0,0 +1,13 @@ +## Process this file with automake to produce Makefile.in + +TESTS = alter-1.cmd + +TESTS_ENVIRONMENT = \ + SPICE_SCRIPTS=$(top_srcdir)/tests/bin \ + ngspice_vpath=$(srcdir) \ + $(SHELL) -c '$(top_builddir)/src/ngspice -p < $$1' -- + +EXTRA_DIST = \ + $(TESTS) + +MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/regression/pipe/alter-1.cmd b/tests/regression/pipe/alter-1.cmd new file mode 100644 index 000000000..2010fff3e --- /dev/null +++ b/tests/regression/pipe/alter-1.cmd @@ -0,0 +1,100 @@ +set prompt = "" +let fail_count = 0 +source alter-1.cir +op + +if @v1[sin][2] <> 100meg + echo "ERROR: tst100 failed" + let fail_count = fail_count + 1 +end + +# space after '[' is mandatory +# alter @v1[sin] = [0 1 113meg] +# +# if @v1[sin][2] <> 113meg +# echo "ERROR: tst113 failed" +# let fail_count = fail_count + 1 +# end + +alter @v1[sin] = [ 0 1 114meg ] +if @v1[sin][2] <> 114meg + echo "ERROR: tst114 failed" + let fail_count = fail_count + 1 +end + +alter @v1[sin]=[ 0 1 115meg ] + +if @v1[sin][2] <> 115meg + echo "ERROR: tst115 failed" + let fail_count = fail_count + 1 +end + +alter @v1[sin] =[ 0 1 116meg ] + +if @v1[sin][2] <> 116meg + echo "ERROR: tst116 failed" + let fail_count = fail_count + 1 +end + +alter @v1[sin]= [ 0 1 117meg ] + +if @v1[sin][2] <> 117meg + echo "ERROR: tst117 failed" + let fail_count = fail_count + 1 +end + +# this will cause a warning, because +# the first ']' will be a separate word +# instead of beeing fused with the "[sin" +alter @v1[sin ]= [ 0 1 118meg ] + +if @v1[sin][2] <> 118meg + echo "ERROR: tst118 failed" + let fail_count = fail_count + 1 +end + +# check old syntax without '=' too +alter v1 sin [ 0 1 119meg ] + +if @v1[sin][2] <> 119meg + print @v1[sin] + echo "ERROR: tst119 failed" + let fail_count = fail_count + 1 +end + +# check old syntax with '=' too +alter v1 sin = [ 0 1 120meg ] + +if @v1[sin][2] <> 120meg + echo "ERROR: tst120 failed" + let fail_count = fail_count + 1 +end + +alter v1 sin =[ 0 1 121meg ] + +if @v1[sin][2] <> 121meg + echo "ERROR: tst121 failed" + let fail_count = fail_count + 1 +end + +alter v1 sin= [ 0 1 122meg ] + +if @v1[sin][2] <> 122meg + echo "ERROR: tst122 failed" + let fail_count = fail_count + 1 +end + +alter v1 sin=[ 0 1 123meg ] + +if @v1[sin][2] <> 123meg + echo "ERROR: tst123 failed" + let fail_count = fail_count + 1 +end + +if fail_count > 0 + echo "ERROR: $&fail_count tests failed" + quit 1 +else + echo "INFO: all tests passed" + quit 0 +end