test_packed_struct_equality.zig (274B) - Raw
1 const std = @import("std"); 2 const expect = std.testing.expect; 3 4 test "packed struct equality" { 5 const S = packed struct { 6 a: u4, 7 b: u4, 8 }; 9 const x: S = .{ .a = 1, .b = 2 }; 10 const y: S = .{ .b = 2, .a = 1 }; 11 try expect(x == y); 12 } 13 14 // test