diff options
| author | David Rubin <87927264+Rexicon226@users.noreply.github.com> | 2024-10-12 20:59:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-12 20:59:12 -0700 |
| commit | e131a2c8e20de13256954cbb38ca3502cdfca07b (patch) | |
| tree | 4734479898bf5a21d931f52d84039136351e17ee /doc/langref/test_packed_struct_equality.zig | |
| parent | ba1331090c19662dc0eff4d38f80df6ec58c675a (diff) | |
| download | zig-e131a2c8e20de13256954cbb38ca3502cdfca07b.tar.gz zig-e131a2c8e20de13256954cbb38ca3502cdfca07b.zip | |
implement packed struct equality (#21679)
Diffstat (limited to 'doc/langref/test_packed_struct_equality.zig')
| -rw-r--r-- | doc/langref/test_packed_struct_equality.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/langref/test_packed_struct_equality.zig b/doc/langref/test_packed_struct_equality.zig new file mode 100644 index 0000000000..d1c755af19 --- /dev/null +++ b/doc/langref/test_packed_struct_equality.zig @@ -0,0 +1,14 @@ +const std = @import("std"); +const expect = std.testing.expect; + +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 expect(x == y); +} + +// test |
