parent
8407a57499
commit
afbcd1b330
34 changed files with 530 additions and 314 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue