File tree Expand file tree Collapse file tree 1 file changed +92
-2
lines changed Expand file tree Collapse file tree 1 file changed +92
-2
lines changed Original file line number Diff line number Diff line change 1
1
from ltypes import i32
2
2
3
- def test_issue_1487_1 ():
3
+ def test_issue_1487_1 (): # OR operator: a or b
4
4
a : i32
5
5
b : i32
6
6
x : i32
@@ -20,7 +20,7 @@ def test_issue_1487_1():
20
20
assert or_op2 == 0
21
21
22
22
23
- def test_issue_1487_2 ():
23
+ def test_issue_1487_2 (): # AND operator: a and b
24
24
a : i32
25
25
b : i32
26
26
x : i32
@@ -42,9 +42,99 @@ def test_issue_1487_2():
42
42
assert and_op1 == 100
43
43
44
44
45
+ def test_XOR (): # XOR (exclusive OR) operator: a ^ b
46
+ a : i32
47
+ b : i32
48
+ x : i32
49
+ y : i32
50
+ xor_op1 : i32
51
+ xor_op2 : i32
52
+ a = 8
53
+ b = 4
54
+ x = 100
55
+ y = 0
56
+ xor_op1 = b ^ a
57
+ xor_op2 = y ^ x
58
+ assert xor_op1 == 12
59
+ assert xor_op2 == 100
60
+
61
+
62
+ def test_NOR (): # NOR operator: not(a or b)
63
+ a : i32
64
+ b : i32
65
+ x : i32
66
+ y : i32
67
+ nor_op1 : bool
68
+ nor_op2 : bool
69
+ a = 0
70
+ b = 0
71
+ x = 1
72
+ y = 0
73
+ nor_op1 = not (b or a )
74
+ nor_op2 = not (y or x )
75
+ assert nor_op1 == True
76
+ assert nor_op2 == False
77
+
78
+
79
+ def test_NAND (): # NAND operator: not(a and b)
80
+ a : i32
81
+ b : i32
82
+ x : i32
83
+ y : i32
84
+ nand_op1 : bool
85
+ nand_op2 : bool
86
+ a = 0
87
+ b = 0
88
+ x = 1
89
+ y = 1
90
+ nand_op1 = not (b and a )
91
+ nand_op2 = not (y and x )
92
+ assert nand_op1 == True
93
+ assert nand_op2 == False
94
+
95
+
96
+ def test_XNOR (): # XNOR operator: ==
97
+ a : i32
98
+ b : i32
99
+ x : i32
100
+ y : i32
101
+ xnor_op1 : bool
102
+ xnor_op2 : bool
103
+ a = 0
104
+ b = 0
105
+ x = 1
106
+ y = 0
107
+ xnor_op1 = b == a
108
+ xnor_op2 = y == x
109
+ assert xnor_op1 == True
110
+ assert xnor_op2 == False
111
+
112
+
113
+ def test_implies (): # implies operator: <=
114
+ a : bool
115
+ b : bool
116
+ x : bool
117
+ y : bool
118
+ imp_op1 : bool
119
+ imp_op2 : bool
120
+ a = True
121
+ b = True
122
+ x = False
123
+ y = True
124
+ imp_op1 = b <= a
125
+ imp_op2 = y <= x
126
+ assert imp_op1 == True
127
+ assert imp_op2 == False
128
+
129
+
45
130
def check ():
46
131
test_issue_1487_1 ()
47
132
test_issue_1487_2 ()
133
+ test_XOR ()
134
+ test_NOR ()
135
+ test_NAND ()
136
+ test_XNOR ()
137
+ test_implies ()
48
138
49
139
50
140
check ()
You can’t perform that action at this time.
0 commit comments