Skip to content

Commit

Permalink
[unit_test]: add enum test
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Feb 4, 2024
1 parent 9824e02 commit b985df7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/uint-test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,18 @@ test "tuple wirte and read" {
try expect(std.meta.eql(val, test_val));
}

test "enum write and read" {
var arr: [0xffff]u8 = std.mem.zeroes([0xffff]u8);
var buf = Buffer{ .arr = &arr };
var p = packType{ .context = &buf };

const test_enum = enum { A, B, C, D };

try p.write_enum(test_enum, test_enum.A);
const val = try p.read_enum(test_enum);
try expect(val == test_enum.A);
}

test "ext write and read" {
var arr: [0xffff]u8 = std.mem.zeroes([0xffff]u8);
var buf = Buffer{ .arr = &arr };
Expand Down

0 comments on commit b985df7

Please sign in to comment.