From 2f557652d41dea81e43d36c3e89258ece620609e Mon Sep 17 00:00:00 2001 From: Arne Döring Date: Wed, 11 Mar 2020 01:01:25 +0100 Subject: fix operators containing percent for VM usage (#13536) * fixes #13513 * merge tarithmetics in tarithm --- tests/arithm/tarithm.nim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/arithm') diff --git a/tests/arithm/tarithm.nim b/tests/arithm/tarithm.nim index fcb78bd7a..99306b3e8 100644 --- a/tests/arithm/tarithm.nim +++ b/tests/arithm/tarithm.nim @@ -12,7 +12,9 @@ int32 4294967295 2 0 +tUnsignedOps OK ''' +nimout: "tUnsignedOps OK" """ import typetraits @@ -167,3 +169,19 @@ block tissue12177: echo(a - b) echo(a * b) echo(a div b) + +block tUnsignedOps: + proc testUnsignedOps() = + let a: int8 = -128 + let b: int8 = 127 + + doAssert b +% 1 == -128 + doAssert b -% -1 == -128 + doAssert b *% 2 == -2 + doAssert a /% 4 == 32 + doAssert a %% 7 == 2 + echo "tUnsignedOps OK" + + testUnsignedOps() + static: + testUnsignedOps() -- cgit 1.4.1-2-gfad0