summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/control_structs/if-test-1.cir
blob: 41927bdf54e4ea282b4c12e4521a6dd3d19cc02b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
test if conditions

* test behaviour in special circumstances

v1  1 0  dc 42
R1  1 0  1k


.control

echo "expect Error: missing if condition"
* does not enter cp_istrue()
if
  echo "FAIL: you should not see this"
else
  echo "nonetheless evaluated as FALSE"
end
echo

set testvar_b=""
echo "expect |false|"
* in cp_istrue(): wl!=NULL names==NULL v==NULL
if $testvar_b
  echo "FAIL: you should not see this"
else
  echo "|false|"
end
echo

set testvar_c
echo "expect testvar_c=|TRUE|"
* in cp_istrue(): wl!=NULL names!=NULL v!=NULL
if $testvar_c
  echo "testvar_c=|$testvar_c|"
end
echo

echo "expect Error: testvar_d: no such variable."
* in cp_istrue(): wl!=NULL then wl==NULL names==NULL v==NULL
if $testvar_d
  echo "FAIL: you should not see this"
else
  echo "nonetheless evaluated as FALSE"
end
echo

echo "expect Error(parse.c--checkvalid): testvar_e: no such vector."
* in cp_istrue(): wl!=NULL names==NULL v==NULL
if testvar_e = 3.3
  echo "FAIL: you should not see this"
else
  echo "nonetheless evaluated as FALSE"
end
echo

let testvar_f = 3.5

echo "expect |false|"
if testvar_f = 3.3
  echo "FAIL: you should not see this"
else
  echo "|false|"
end
echo

echo "expect |true|"
if testvar_f = 3.5
  echo "|true|"
else
  echo "FAIL: you should not see this"
end
echo

op
print v(1)

.endc
.end