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