Browse Source

add .if ... .endif test to misc in regression

pre-master-46
Holger Vogt 7 years ago
parent
commit
4f3b0ca137
  1. 2
      tests/regression/misc/Makefile.am
  2. 43
      tests/regression/misc/if-elseif.cir
  3. 9
      tests/regression/misc/if-elseif.out

2
tests/regression/misc/Makefile.am

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
TESTS = bugs-1.cir bugs-2.cir dollar-1.cir empty-1.cir resume-1.cir log-functions-1.cir alter-vec.cir test-noise-2.cir test-noise-3.cir ac-zero.cir asrc-tc-1.cir asrc-tc-2.cir
TESTS = bugs-1.cir bugs-2.cir dollar-1.cir empty-1.cir resume-1.cir log-functions-1.cir alter-vec.cir test-noise-2.cir test-noise-3.cir ac-zero.cir asrc-tc-1.cir asrc-tc-2.cir if-elseif.cir
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice

43
tests/regression/misc/if-elseif.cir

@ -0,0 +1,43 @@
multiple .elseif, nested .if
.param select = 3
.param select2 = 3
V1 1 0 1
.if (select == 1)
R1 1 0 1
.elseif (select == 2)
R1 1 0 10
.elseif (select == 3)
.if (select2 == 1)
R1 1 0 100
.elseif (select2 = 2)
R1 1 0 200
.elseif (select2 = 3) $ <----- selected
R1 1 0 300
.else
R1 1 0 400
.endif
.elseif (select == 4)
R1 1 0 1000
.else
R1 1 0 10000
.endif
.control
define mismatch(a,b,err) abs(a-b)>err
op
let out = -1/v1#branch
print out > test.log
if mismatch(out, 300, 1e-9)
echo "ERROR: nested .if test failed"
quit 1
else
echo "INFO: nested .if test o.k."
quit 0
end
.endc
.end

9
tests/regression/misc/if-elseif.out

@ -0,0 +1,9 @@
Circuit: multiple .elseif, nested .if
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
No. of Data Rows : 1
INFO: nested .if test o.k.
Loading…
Cancel
Save