Add tests for negative numbers

This commit is contained in:
mratsim 2018-04-25 17:58:55 +02:00
parent b34019c0b5
commit 8b412b879d

View File

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