diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-09-18 09:04:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-18 09:04:37 +0200 |
commit | 638a4d9d9fdec0f0d22f86eae872422b97be0159 (patch) | |
tree | a172ee5164c88065c193757e7f64e3eadac5f108 /tests | |
parent | 93f74e4f937ac84e4fbac47f3c7e35c58f849301 (diff) | |
download | Nim-638a4d9d9fdec0f0d22f86eae872422b97be0159.tar.gz |
rename cast opcodes, fix for 32bit cast, fix python pretty printer (#12207)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vm/tcastint.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/vm/tcastint.nim b/tests/vm/tcastint.nim index c64dbc666..35d15b08b 100644 --- a/tests/vm/tcastint.nim +++ b/tests/vm/tcastint.nim @@ -281,14 +281,27 @@ proc test_float32_cast = let xf = cast[float32](xx) doAssert(xf == 16.0'f32, $xf) +proc test_float32_castB() = + let a: float32 = -123.125 + let b = cast[int32](a) + let c = cast[uint32](a) + doAssert b == -1024049152 + doAssert cast[uint64](b) == 18446744072685502464'u64 + doAssert c == 3270918144'u32 + # ensure the unsused bits in the internal representation don't have + # any surprising content. + doAssert cast[uint64](c) == 3270918144'u64 + test() test_float_cast() test_float32_cast() free_integer_casting() +test_float32_castB() static: test() test_float_cast() test_float32_cast() free_integer_casting() + test_float32_castB() echo "OK" |