1const std = @import("std");
2const expect = std.testing.expect;
3const expectEqual = std.testing.expectEqual;
4
5const Color = enum {
6 auto,
7 off,
8 on,
9};
10
11test "enum literals" {
12 const color1: Color = .auto;
13 const color2 = Color.auto;
14 try expectEqual(color1, color2);
15}
16
17test "switch using enum literals" {
18 const color = Color.on;
19 const result = switch (color) {
20 .auto => false,
21 .on => true,
22 .off => false,
23 };
24 try expect(result);
25}
26
27// test