From 3d1fb4fac8d4ce47d6e306b33def16ab49445190 Mon Sep 17 00:00:00 2001 From: Pavel Verigo Date: Sun, 3 May 2026 19:03:46 +0200 Subject: [PATCH] stage2-wasm: disable std tests, add failing behavior tests --- test/behavior/bitcast.zig | 39 +++++++++++++++++++++++++++++++++++++++ test/behavior/floatop.zig | 11 +++++++++++ test/tests.zig | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig index 660ace22803ef0c719029757c4436db3f4e8690f..672ce96d8b345fcc0e5787d9fc9edfeafc48e61d 100644 --- a/test/behavior/bitcast.zig +++ b/test/behavior/bitcast.zig @@ -552,3 +552,42 @@ test "@bitCast of extern struct containing pointer" { try S.doTheTest(); try comptime S.doTheTest(); } + +test "@bitCast of extern struct to float" { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; + + const S = struct { + const S = extern struct { + x: u16, + y: u16, + }; + fn doTheTest() !void { + var s: S = .{ .x = 0, .y = 0 }; + _ = &s; + const a: f32 = @bitCast(s); + try expect(a == 0); + } + }; + + try S.doTheTest(); + try comptime S.doTheTest(); +} + +test "@bitCast of float to extern struct" { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; + + const S = struct { + const S = extern struct { + x: u32, + }; + fn doTheTest() !void { + var a: f32 = -0.0; + _ = &a; + const s: S = @bitCast(a); + try expect(s.x == 0x80000000); + } + }; + + try S.doTheTest(); + try comptime S.doTheTest(); +} diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index 38097b69d8f67fab3147f6f25b33a398f11c5387..44e6abe4a2fbb8fcdba707ea5cc211ec02fbcb6f 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -1539,6 +1539,17 @@ fn testNeg(comptime T: type) !void { }; } +test "negate f80" { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; + + var f: f80 = 0.0; + const a: u80 = @bitCast(f); + try expect(a == 0); + f = -f; + const b: u80 = @bitCast(f); + try expect(b == 0x8000_00000000_00000000); +} + test "eval @setFloatMode at compile-time" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/tests.zig b/test/tests.zig index 28cb147cf88f9aca5951e1a86b6d363e2d26b27b..e5d43aa9101cc5d08cd126db49e22c02fc294462 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -1496,7 +1496,7 @@ const module_test_targets = blk: { .os_tag = .wasi, .abi = .none, }, - .skip_modules = &.{"compiler-rt"}, + .skip_modules = &.{ "compiler-rt", "std" }, .use_llvm = false, .use_lld = false, }, -- 2.54.0