Skip to content

Commit e9babe3

Browse files
committed
tests: add a test to make sure the operators work
1 parent 8e9c83f commit e9babe3

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/magics/tmagics.nim

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,20 @@ block wrong_finished_result:
6868
# placing the ``finished`` call within the assertion made the test work
6969
doAssert f
7070

71-
test()
71+
test()
72+
73+
block bool_comparison:
74+
# tests for the boolean less-than and less-than-or-equal operators
75+
let t = true
76+
let f = false
77+
78+
doAssert t > f # 'true' is greater than 'false'
79+
doAssert f < t
80+
doAssert not (t > t) # 'true' is not greater or less than itself
81+
doAssert not (t < t)
82+
doAssert not (f > f) # 'false' is not greater or less than itself
83+
doAssert not (f < f)
84+
doAssert t >= t
85+
doAssert t <= t
86+
doAssert f >= f
87+
doAssert f <= f

0 commit comments

Comments
 (0)