summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorawr1 <41453959+awr1@users.noreply.github.com>2020-04-20 07:48:37 -0500
committerGitHub <noreply@github.com>2020-04-20 14:48:37 +0200
commit59aeaa1c98d4546aeb784864fcc660d43fb3da1b (patch)
treea2ede03ae0acb6276d587ced9cd73676288e7455 /tests
parent59f1462b95279dd16f9de5cb7b3de501b33756b7 (diff)
downloadNim-59aeaa1c98d4546aeb784864fcc660d43fb3da1b.tar.gz
Make bitand, bitor, bitxor varargs-friendly (#13985)
* made bitand, bitor, bitxor varargs friendly
* changed new bitops to macros
* changed macro signature for consistency (this technically doesn't matter)
* added tests
* removed redundant assert
* fix literal
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tbitops.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/stdlib/tbitops.nim b/tests/stdlib/tbitops.nim
index 3826cb1f9..d611ce4cc 100644
--- a/tests/stdlib/tbitops.nim
+++ b/tests/stdlib/tbitops.nim
@@ -18,6 +18,8 @@ proc main1() =
   const I64A = 0b01000100_00111111_01111100_10001010_10011001_01001000_01111010_00010001'i64
   const U64B = 0b00110010_11011101_10001111_00101000_00000000_00000000_00000000_00000000'u64
   const I64B = 0b00110010_11011101_10001111_00101000_00000000_00000000_00000000_00000000'i64
+  const U64C = 0b00101010_11110101_10001111_00101000_00000100_00000000_00000100_00000000'u64
+  const I64C = 0b00101010_11110101_10001111_00101000_00000100_00000000_00000100_00000000'i64
 
   doAssert( (U8 and U8) == bitand(U8,U8) )
   doAssert( (I8 and I8) == bitand(I8,I8) )
@@ -27,6 +29,8 @@ proc main1() =
   doAssert( (I32 and I32) == bitand(I32,I32) )
   doAssert( (U64A and U64B) == bitand(U64A,U64B) )
   doAssert( (I64A and I64B) == bitand(I64A,I64B) )
+  doAssert( (U64A and U64B and U64C) == bitand(U64A,U64B,U64C) )
+  doAssert( (I64A and I64B and I64C) == bitand(I64A,I64B,I64C) )
 
   doAssert( (U8 or U8) == bitor(U8,U8) )
   doAssert( (I8 or I8) == bitor(I8,I8) )
@@ -36,6 +40,8 @@ proc main1() =
   doAssert( (I32 or I32) == bitor(I32,I32) )
   doAssert( (U64A or U64B) == bitor(U64A,U64B) )
   doAssert( (I64A or I64B) == bitor(I64A,I64B) )
+  doAssert( (U64A or U64B or U64C) == bitor(U64A,U64B,U64C) )
+  doAssert( (I64A or I64B or I64C) == bitor(I64A,I64B,I64C) )
 
   doAssert( (U8 xor U8) == bitxor(U8,U8) )
   doAssert( (I8 xor I8) == bitxor(I8,I8) )
@@ -45,6 +51,8 @@ proc main1() =
   doAssert( (I32 xor I32) == bitxor(I32,I32) )
   doAssert( (U64A xor U64B) == bitxor(U64A,U64B) )
   doAssert( (I64A xor I64B) == bitxor(I64A,I64B) )
+  doAssert( (U64A xor U64B xor U64C) == bitxor(U64A,U64B,U64C) )
+  doAssert( (I64A xor I64B xor I64C) == bitxor(I64A,I64B,I64C) )
 
   doAssert( not(U8) == bitnot(U8) )
   doAssert( not(I8) == bitnot(I8) )