diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-08-07 15:53:16 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-08-07 15:53:16 +0200 |
commit | afbcd1b330f16294cee32efca1b2f9060874a497 (patch) | |
tree | d0406792478fa58d3c487ff6f72f999c29f25343 /tests/arithm | |
parent | 8407a574992ebd6bccec647a902cf54a4de8db18 (diff) | |
download | Nim-afbcd1b330f16294cee32efca1b2f9060874a497.tar.gz |
int128 on firstOrd, lastOrd and lengthOrd (#11701)
* fixes #11847
Diffstat (limited to 'tests/arithm')
-rw-r--r-- | tests/arithm/tarithm.nim | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/tests/arithm/tarithm.nim b/tests/arithm/tarithm.nim index f27174aef..1150af951 100644 --- a/tests/arithm/tarithm.nim +++ b/tests/arithm/tarithm.nim @@ -29,6 +29,7 @@ block tcast: let rt = ty(exp) const ct = ty(exp) if $rt != $ct: + echo astToStr(exp) echo "Got ", ct echo "Expected ", rt @@ -52,7 +53,7 @@ block tcast: crossCheck(uint8, uint8.high + 5'u8) crossCheck(uint16, uint16.high + 5'u16) crossCheck(uint32, uint32.high + 5'u32) - crossCheck(uint64, (-1).uint64 + 5'u64) + crossCheck(uint64, 0xFFFFFFFFFFFFFFFF'u64 + 5'u64) doAssert $sub1(0'u8) == "255" doAssert $sub1(0'u16) == "65535" @@ -69,12 +70,10 @@ block tcast: crossCheck(int64, high(int8).int16.int32.int64) crossCheck(int64, low(int8).int16.int32.int64) - crossCheck(int64, 0xFFFFFFFFFFFFFFFF'u64) - crossCheck(int32, 0xFFFFFFFFFFFFFFFF'u64) - crossCheck(int16, 0xFFFFFFFFFFFFFFFF'u64) - crossCheck(int8 , 0xFFFFFFFFFFFFFFFF'u64) - - + doAssert not compiles(echo int64(0xFFFFFFFFFFFFFFFF'u64)) + doAssert not compiles(echo int32(0xFFFFFFFFFFFFFFFF'u64)) + doAssert not compiles(echo int16(0xFFFFFFFFFFFFFFFF'u64)) + doAssert not compiles(echo int8(0xFFFFFFFFFFFFFFFF'u64)) block tnot: # Signed types @@ -116,32 +115,6 @@ block tnot: doAssert t7 == 4 - -block tshl: - # Signed types - block: - const t0: int8 = 1'i8 shl 8 - const t1: int16 = 1'i16 shl 16 - const t2: int32 = 1'i32 shl 32 - const t3: int64 = 1'i64 shl 64 - doAssert t0 == 0 - doAssert t1 == 0 - doAssert t2 == 1 - doAssert t3 == 1 - - # Unsigned types - block: - const t0: uint8 = 1'u8 shl 8 - const t1: uint16 = 1'u16 shl 16 - const t2: uint32 = 1'u32 shl 32 - const t3: uint64 = 1'u64 shl 64 - doAssert t0 == 0 - doAssert t1 == 0 - doAssert t2 == 0 - doAssert t3 == 1 - - - block tshr: proc T() = # let VI = -8 |