| 1 | enum WHex { |
| 2 | a = 0x001 |
| 3 | b = 0x010 |
| 4 | c = 0x100 |
| 5 | } |
| 6 | |
| 7 | enum WDecimal { |
| 8 | a = 1 |
| 9 | b = 16 |
| 10 | c = 256 |
| 11 | } |
| 12 | |
| 13 | const ca = 1 |
| 14 | const cb = 16 |
| 15 | const cc = 256 |
| 16 | |
| 17 | fn 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 |