mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fix hexadecimal constants + freestanding fixes
This commit is contained in:
committed by
Alexander Medvednikov
parent
92f920b2b8
commit
5c217b9e61
33
vlib/compiler/tests/enum_hex_test.v
Normal file
33
vlib/compiler/tests/enum_hex_test.v
Normal file
@@ -0,0 +1,33 @@
|
||||
enum w_hex {
|
||||
a = 0x001
|
||||
b = 0x010
|
||||
c = 0x100
|
||||
}
|
||||
|
||||
enum w_decimal {
|
||||
a = 1
|
||||
b = 16
|
||||
c = 256
|
||||
}
|
||||
|
||||
const (
|
||||
ca = 1
|
||||
cb = 16
|
||||
cc = 256
|
||||
)
|
||||
|
||||
|
||||
fn test_enum_hex() {
|
||||
assert ca == int(w_decimal.a)
|
||||
assert cb == int(w_decimal.b)
|
||||
assert cc == int(w_decimal.c)
|
||||
|
||||
assert int(w_hex.a) == ca
|
||||
assert int(w_hex.b) == cb
|
||||
assert int(w_hex.c) == cc
|
||||
|
||||
assert int(w_hex.a) == int(w_decimal.a)
|
||||
assert int(w_hex.b) == int(w_decimal.b)
|
||||
assert int(w_hex.c) == int(w_decimal.c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user