mirror of
https://github.com/status-im/nim-stint.git
synced 2025-02-19 18:38:13 +00:00
Add tests for negative numbers
This commit is contained in:
parent
b34019c0b5
commit
8b412b879d
@ -13,29 +13,44 @@ suite "Signed int - Testing comparison operators":
|
||||
let
|
||||
a = 10'i16.stint(16)
|
||||
b = 15'i16.stint(16)
|
||||
c = 150'u16
|
||||
c = 150'i16.stint(16)
|
||||
|
||||
test "< operator":
|
||||
check:
|
||||
a < b
|
||||
not (a + b < b)
|
||||
not (a + a + a < b + b)
|
||||
-c < c
|
||||
-c < a
|
||||
-b < -a
|
||||
not(-b < -b)
|
||||
|
||||
test "<= operator":
|
||||
check:
|
||||
a <= b
|
||||
not (a + b <= b)
|
||||
a + a + a <= b + b
|
||||
-c <= c
|
||||
-c <= a
|
||||
-b <= -a
|
||||
-b <= -b
|
||||
|
||||
test "> operator":
|
||||
check:
|
||||
b > a
|
||||
not (b > a + b)
|
||||
not (b + b > a + a + a)
|
||||
c > -c
|
||||
a > -c
|
||||
b > -c
|
||||
not(-b > -b)
|
||||
|
||||
test ">= operator":
|
||||
check:
|
||||
b >= a
|
||||
not (b >= a + b)
|
||||
b + b >= a + a + a
|
||||
|
||||
c >= -c
|
||||
a >= -c
|
||||
b >= -c
|
||||
-b >= -b
|
||||
|
Loading…
x
Reference in New Issue
Block a user