aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorCody Tapscott <topolarity@tapscott.me>2022-10-28 08:51:15 -0700
committerCody Tapscott <topolarity@tapscott.me>2022-10-28 12:41:15 -0700
commit40b7792a4c815868bafe882cc77d89a67c08571b (patch)
treeadb7867f928e1b4a9bb50788aaaf17b0909bc573 /test/behavior
parent03ed0a59e337d89c9650cc8a70ff431b66ee8671 (diff)
downloadzig-40b7792a4c815868bafe882cc77d89a67c08571b.tar.gz
zig-40b7792a4c815868bafe882cc77d89a67c08571b.zip
Enable bitcast test now that #13214 is resolved.
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/bitcast.zig17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig
index b225c31858..728e8fe62a 100644
--- a/test/behavior/bitcast.zig
+++ b/test/behavior/bitcast.zig
@@ -375,12 +375,19 @@ test "comptime @bitCast packed struct to int and back" {
}
}
-test "comptime bitcast with fields following a float" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO: https://github.com/ziglang/zig/issues/13214
+test "comptime bitcast with fields following f80" {
+ if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
+ const FloatT = extern struct { f: f80, x: u128 align(16) };
+ const x: FloatT = .{ .f = 0.5, .x = 123 };
+ var x_as_uint: u256 = comptime @bitCast(u256, x);
- const FloatT = extern struct { f: f80, x: u128 };
- var x: FloatT = .{ .f = 0.5, .x = 123 };
- try expect(@bitCast(u256, x) == comptime @bitCast(u256, @as(FloatT, .{ .f = 0.5, .x = 123 })));
+ try expect(x.f == @bitCast(FloatT, x_as_uint).f);
+ try expect(x.x == @bitCast(FloatT, x_as_uint).x);
}
test "bitcast vector to integer and back" {