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

This commit is contained in:
Holger Vogt 2018-11-10 11:05:36 +01:00
parent cc4b00f991
commit 4f3b0ca137
3 changed files with 53 additions and 1 deletions

View File

@ -1,7 +1,7 @@
## 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

View File

@ -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

View File

@ -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.