authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-11 18:38:04+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-11 18:38:04+02:00
logd97981f6fd4e98506404de4259230dc157cc50dd
tree2eb2c40f9b9cf29b485b09d0557bb2e89fec95d6
parentcab1d5c1a320239af5be88571d7989ba230b90be

std: Make a test-case independent of the target endianness


1 files changed, 5 insertions(+), 4 deletions(-)

test/stage1/behavior/cast.zig+5-4
......@@ -17,14 +17,15 @@ test "integer literal to pointer cast" {
1717}
1818
1919test "pointer reinterpret const float to int" {
20 // https://github.com/ziglang/zig/issues/3345
21 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
22
20 // The hex representation is 0x3fe3333333333303.
2321 const float: f64 = 5.99999999999994648725e-01;
2422 const float_ptr = &float;
2523 const int_ptr = @ptrCast(*const i32, float_ptr);
2624 const int_val = int_ptr.*;
27 expect(int_val == 858993411);
25 if (std.builtin.endian == .Little)
26 expect(int_val == 0x33333303)
27 else
28 expect(int_val == 0x3fe33333);
2829}
2930
3031test "implicitly cast indirect pointer to maybe-indirect pointer" {