zig/doc/langref/test_packed_struct_equality.zig

14 lines
287 B
Zig

const std = @import("std");
const expectEqual = std.testing.expectEqual;
test "packed struct equality" {
const S = packed struct {
a: u4,
b: u4,
};
const x: S = .{ .a = 1, .b = 2 };
const y: S = .{ .b = 2, .a = 1 };
try expectEqual(x, y);
}
// test