summary refs log tree commit diff stats
path: root/tests/arithm
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2020-03-11 01:01:25 +0100
committerGitHub <noreply@github.com>2020-03-11 01:01:25 +0100
commit2f557652d41dea81e43d36c3e89258ece620609e (patch)
tree0cac1d487c4cc8d0818abbaaebeee75ec959eea4 /tests/arithm
parente64f1c7ee4a25a1df837617f4a79ce7e515b9e0d (diff)
downloadNim-2f557652d41dea81e43d36c3e89258ece620609e.tar.gz
fix operators containing percent for VM usage (#13536)
* fixes #13513
* merge tarithmetics in tarithm
Diffstat (limited to 'tests/arithm')
-rw-r--r--tests/arithm/tarithm.nim18
1 files changed, 18 insertions, 0 deletions
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()