v2 / vlib / v / tests / enums / enum_hex_test.v
27 lines · 24 sloc · 442 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1enum WHex {
2 a = 0x001
3 b = 0x010
4 c = 0x100
5}
6
7enum WDecimal {
8 a = 1
9 b = 16
10 c = 256
11}
12
13const ca = 1
14const cb = 16
15const cc = 256
16
17fn test_enum_hex() {
18 assert ca == int(WDecimal.a)
19 assert cb == int(WDecimal.b)
20 assert cc == int(WDecimal.c)
21 assert int(WHex.a) == ca
22 assert int(WHex.b) == cb
23 assert int(WHex.c) == cc
24 assert int(WHex.a) == int(WDecimal.a)
25 assert int(WHex.b) == int(WDecimal.b)
26 assert int(WHex.c) == int(WDecimal.c)
27}
28