diff --git a/ChangeLog b/ChangeLog index bbc9f2366..9c15d54a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-06-05 Arno W. Peters + + * tests/*: Added a little hierarchy to the tests. Removed + config.sh in favor of check.sh. This script does all checking. + Made names of the tests better reflect the circuit under test. + 2000-06-03 Arno W. Peters * src/include/complex.h, src/include/macros.h, diff --git a/configure.in b/configure.in index 422087b11..b2dfd6d89 100644 --- a/configure.in +++ b/configure.in @@ -244,4 +244,6 @@ src/maths/sparse/Makefile \ src/misc/Makefile \ src/parser/Makefile \ tests/Makefile \ +tests/resistance/Makefile \ +tests/filters/Makefile \ ) diff --git a/tests/Makefile.am b/tests/Makefile.am index 6043f49cb..d68856014 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,20 +1,16 @@ ## Process this file with automake to produce Makefile.in -TESTS = diffpair.sh fourbitadder.sh resistor.sh respart.sh +SUBDIRS = resistance filters -TESTS_ENVIRONMENT = $(SHELL) +TESTS = \ + diffpair.cir \ + fourbitadder.cir + +TESTS_ENVIRONMENT = $(SHELL) check.sh $(top_builddir)/src/ngspice EXTRA_DIST = \ README \ - config.sh \ $(TESTS) \ - diffpair.cir \ - diffpair.out \ - fourbitadder.cir \ - fourbitadder.out \ - resistor.cir \ - resistor.out \ - respart.cir \ - respart.out + $(TESTS:.cir=.out) MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/check.sh b/tests/check.sh new file mode 100644 index 000000000..2a080ac36 --- /dev/null +++ b/tests/check.sh @@ -0,0 +1,15 @@ +#! /bin/sh + +NGSPICE=$1 +TEST=$2 + +DIFFPIPE="Analysis|CPU|memory|Date|Note" + +testname=$(basename $TEST .cir) +testdir=$(dirname $TEST) +$NGSPICE < $testdir/$testname.cir 2>&1 | egrep -v $DIFFPIPE > $testname.test +if diff -u $testdir/$testname.out $testname.test; then + rm $testname.test + exit 0 +fi +exit 1 diff --git a/tests/config.sh b/tests/config.sh deleted file mode 100644 index deedaf3fd..000000000 --- a/tests/config.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh - -NGSPICE=../src/ngspice -DIFFPIPE="Analysis|CPU|memory|Date|Note" - -function spicetest () { - $NGSPICE < $srcdir/$1.cir 2>&1 | egrep -v $DIFFPIPE > $1.test - if diff -u $srcdir/$1.out $1.test; then - rm $1.test - exit 0 - fi - exit 1 -} diff --git a/tests/diffpair.sh b/tests/diffpair.sh deleted file mode 100644 index 7baba1433..000000000 --- a/tests/diffpair.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -. $srcdir/config.sh -spicetest diffpair diff --git a/tests/filters/.cvsignore b/tests/filters/.cvsignore new file mode 100644 index 000000000..3dda72986 --- /dev/null +++ b/tests/filters/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/tests/filters/Makefile.am b/tests/filters/Makefile.am new file mode 100644 index 000000000..702241915 --- /dev/null +++ b/tests/filters/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + +TESTS = \ + lowpass.cir + +TESTS_ENVIRONMENT = $(SHELL) $(srcdir)/../check.sh $(top_builddir)/src/ngspice + +EXTRA_DIST = \ + $(TESTS) \ + $(TESTS:.cir=.out) + +MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/resistance/test1.cir b/tests/filters/lowpass.cir similarity index 100% rename from tests/resistance/test1.cir rename to tests/filters/lowpass.cir diff --git a/tests/filters/lowpass.out b/tests/filters/lowpass.out new file mode 100644 index 000000000..8fb0c1124 --- /dev/null +++ b/tests/filters/lowpass.out @@ -0,0 +1,106 @@ + +Circuit: A Simple AC Run + +Circuit: A Simple AC Run + + +a simple ac run +.op +.ac dec 10 1k 1meg +v1 1 0 dc 0 ac 1 sin 0 1 1k 0 0 distof1 0 distof2 0 +r1 1 2 10k +r2 2 0 10k +c1 2 0 1n +.options list node post trans +.end + +Operating point information: + + Node Voltage + ---- ------- + V(2) 0.000000e+00 + V(1) 0.000000e+00 + + Source Current + ------ ------- + + v1#branch 0.000000e+00 + + Capacitor models (Fixed capacitor) + model C + + cj 0 + cjsw 0 + defw 1e-05 + narrow 0 + + Resistor models (Simple linear resistor) + model R + + rsh 0 + narrow 0 + tc1 0 + tc2 0 + defw 1e-05 + + Capacitor: Fixed capacitor + device c1 + model C +capacitanc 1e-09 + i 2.69e-312 + p 2.69e-312 + + Resistor: Simple linear resistor + device r2 r1 + model R R +resistance 1e+04 1e+04 + ac 0 0 + i 0 0 + p 0 0 + + Vsource: Independent voltage source + device v1 + dc 0 + acmag 1 + i 0 + p -0 + + A Simple AC Run +-------------------------------------------------------------------------------- +Index frequency v(2) +-------------------------------------------------------------------------------- +0 1.000000e+03, 0.000000e+00 4.995070e-01, -1.569248e-02 +1 1.258925e+03, 0.000000e+00 4.992191e-01, -1.974427e-02 +2 1.584893e+03, 0.000000e+00 4.987635e-01, -2.483388e-02 +3 1.995262e+03, 0.000000e+00 4.980431e-01, -3.121884e-02 +4 2.511886e+03, 0.000000e+00 4.969056e-01, -3.921243e-02 +5 3.162278e+03, 0.000000e+00 4.951134e-01, -4.918748e-02 +6 3.981072e+03, 0.000000e+00 4.922993e-01, -6.157141e-02 +7 5.011872e+03, 0.000000e+00 4.879042e-01, -7.682179e-02 +8 6.309573e+03, 0.000000e+00 4.810969e-01, -9.536356e-02 +9 7.943282e+03, 0.000000e+00 4.706888e-01, -1.174583e-01 +10 1.000000e+04, 0.000000e+00 4.550849e-01, -1.429691e-01 +11 1.258925e+04, 0.000000e+00 4.323679e-01, -1.710028e-01 +12 1.584893e+04, 0.000000e+00 4.006689e-01, -1.994966e-01 +13 1.995262e+04, 0.000000e+00 3.589592e-01, -2.250064e-01 +14 2.511886e+04, 0.000000e+00 3.081227e-01, -2.431496e-01 +15 3.162278e+04, 0.000000e+00 2.516406e-01, -2.499946e-01 +16 3.981072e+04, 0.000000e+00 1.949905e-01, -2.438728e-01 +17 5.011872e+04, 0.000000e+00 1.437140e-01, -2.262814e-01 +18 6.309573e+04, 0.000000e+00 1.014372e-01, -2.010698e-01 +19 7.943282e+04, 0.000000e+00 6.918213e-02, -1.726410e-01 +20 1.000000e+05, 0.000000e+00 4.599983e-02, -1.445127e-01 +21 1.258925e+05, 0.000000e+00 3.004398e-02, -1.188249e-01 +22 1.584893e+05, 0.000000e+00 1.938636e-02, -9.652642e-02 +23 1.995262e+05, 0.000000e+00 1.240953e-02, -7.778670e-02 +24 2.511886e+05, 0.000000e+00 7.902266e-03, -6.235934e-02 +25 3.162278e+05, 0.000000e+00 5.015244e-03, -4.982439e-02 +26 3.981072e+05, 0.000000e+00 3.176162e-03, -3.972396e-02 +27 5.011872e+05, 0.000000e+00 2.008732e-03, -3.162801e-02 +28 6.309573e+05, 0.000000e+00 1.269306e-03, -2.516032e-02 +29 7.943282e+05, 0.000000e+00 8.016290e-04, -2.000430e-02 +30 1.000000e+06, 0.000000e+00 5.060931e-04, -1.589938e-02 + + + + diff --git a/tests/fourbitadder.sh b/tests/fourbitadder.sh deleted file mode 100644 index 9bb086f30..000000000 --- a/tests/fourbitadder.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -. $srcdir/config.sh -spicetest fourbitadder diff --git a/tests/resistance/.cvsignore b/tests/resistance/.cvsignore new file mode 100644 index 000000000..3dda72986 --- /dev/null +++ b/tests/resistance/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/tests/resistance/Makefile.am b/tests/resistance/Makefile.am new file mode 100644 index 000000000..b7f5358b2 --- /dev/null +++ b/tests/resistance/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in + +TESTS = \ + res_array.cir \ + res_simple.cir \ + res_partition.cir + +TESTS_ENVIRONMENT = $(SHELL) $(srcdir)/../check.sh $(top_builddir)/src/ngspice + +EXTRA_DIST = \ + $(TESTS) \ + $(TESTS:.sh=.out) + +MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/resistor.cir b/tests/resistance/res_array.cir similarity index 100% rename from tests/resistor.cir rename to tests/resistance/res_array.cir diff --git a/tests/resistor.out b/tests/resistance/res_array.out similarity index 100% rename from tests/resistor.out rename to tests/resistance/res_array.out diff --git a/tests/respart.cir b/tests/resistance/res_partition.cir similarity index 100% rename from tests/respart.cir rename to tests/resistance/res_partition.cir diff --git a/tests/respart.out b/tests/resistance/res_partition.out similarity index 100% rename from tests/respart.out rename to tests/resistance/res_partition.out diff --git a/tests/resistance/res_simple.cir b/tests/resistance/res_simple.cir new file mode 100644 index 000000000..53d885443 --- /dev/null +++ b/tests/resistance/res_simple.cir @@ -0,0 +1,9 @@ +A simple resistor with a voltage source + +R1 1 0 10k +V1 1 0 1 + +.TRAN 1ns 6ns +.PRINT TRAN I(V1) + +.END diff --git a/tests/resistance/res_simple.out b/tests/resistance/res_simple.out new file mode 100644 index 000000000..979d85e20 --- /dev/null +++ b/tests/resistance/res_simple.out @@ -0,0 +1,75 @@ + +Circuit: A simple resistor with a voltage source + +Circuit: A simple resistor with a voltage source + + + A simple resistor with a voltage source +-------------------------------------------------------------------------------- +Index time v1#branch +-------------------------------------------------------------------------------- +0 0.000000e+00 -1.000000e-04 +1 1.200000e-12 -1.000000e-04 +2 2.400000e-12 -1.000000e-04 +3 4.800000e-12 -1.000000e-04 +4 9.600000e-12 -1.000000e-04 +5 1.920000e-11 -1.000000e-04 +6 3.840000e-11 -1.000000e-04 +7 7.680000e-11 -1.000000e-04 +8 1.536000e-10 -1.000000e-04 +9 2.736000e-10 -1.000000e-04 +10 3.936000e-10 -1.000000e-04 +11 5.136000e-10 -1.000000e-04 +12 6.336000e-10 -1.000000e-04 +13 7.536000e-10 -1.000000e-04 +14 8.736000e-10 -1.000000e-04 +15 9.936000e-10 -1.000000e-04 +16 1.113600e-09 -1.000000e-04 +17 1.233600e-09 -1.000000e-04 +18 1.353600e-09 -1.000000e-04 +19 1.473600e-09 -1.000000e-04 +20 1.593600e-09 -1.000000e-04 +21 1.713600e-09 -1.000000e-04 +22 1.833600e-09 -1.000000e-04 +23 1.953600e-09 -1.000000e-04 +24 2.073600e-09 -1.000000e-04 +25 2.193600e-09 -1.000000e-04 +26 2.313600e-09 -1.000000e-04 +27 2.433600e-09 -1.000000e-04 +28 2.553600e-09 -1.000000e-04 +29 2.673600e-09 -1.000000e-04 +30 2.793600e-09 -1.000000e-04 +31 2.913600e-09 -1.000000e-04 +32 3.033600e-09 -1.000000e-04 +33 3.153600e-09 -1.000000e-04 +34 3.273600e-09 -1.000000e-04 +35 3.393600e-09 -1.000000e-04 +36 3.513600e-09 -1.000000e-04 +37 3.633600e-09 -1.000000e-04 +38 3.753600e-09 -1.000000e-04 +39 3.873600e-09 -1.000000e-04 +40 3.993600e-09 -1.000000e-04 +41 4.113600e-09 -1.000000e-04 +42 4.233600e-09 -1.000000e-04 +43 4.353600e-09 -1.000000e-04 +44 4.473600e-09 -1.000000e-04 +45 4.593600e-09 -1.000000e-04 +46 4.713600e-09 -1.000000e-04 +47 4.833600e-09 -1.000000e-04 +48 4.953600e-09 -1.000000e-04 +49 5.073600e-09 -1.000000e-04 +50 5.193600e-09 -1.000000e-04 +51 5.313600e-09 -1.000000e-04 +52 5.433600e-09 -1.000000e-04 +53 5.553600e-09 -1.000000e-04 +54 5.673600e-09 -1.000000e-04 + +Index time v1#branch +-------------------------------------------------------------------------------- +55 5.793600e-09 -1.000000e-04 +56 5.913600e-09 -1.000000e-04 +57 6.000000e-09 -1.000000e-04 + + + + diff --git a/tests/resistor.sh b/tests/resistor.sh deleted file mode 100644 index 769e37207..000000000 --- a/tests/resistor.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -. $srcdir/config.sh -spicetest resistor diff --git a/tests/respart.sh b/tests/respart.sh deleted file mode 100644 index 7b24c8f0d..000000000 --- a/tests/respart.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -. $srcdir/config.sh -spicetest respart