@@ -1307,6 +1307,17 @@ test "packed struct equality" {
|
||||
comptime try S.doTest(x, y);
|
||||
}
|
||||
|
||||
test "packed struct equality ignores padding bits" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
|
||||
const S = packed struct { b: bool };
|
||||
var s: S = undefined;
|
||||
s.b = true;
|
||||
try std.testing.expect(s != S{ .b = false });
|
||||
try std.testing.expect(s == S{ .b = true });
|
||||
}
|
||||
|
||||
test "packed struct with signed field" {
|
||||
var s: packed struct {
|
||||
a: i2,
|
||||
|
||||
Reference in New Issue
Block a user