v2 / vlib / v / tests / comptime / comptime_bittness_and_endianess_test.v
25 lines · 24 sloc · 336 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn test_bitness() {
2 mut x := 0
3 $if x32 {
4 println('system is 32 bit')
5 x = 1
6 }
7 $if x64 {
8 println('system is 64 bit')
9 x = 2
10 }
11 assert x > 0
12}
13
14fn test_endianness() {
15 mut x := 0
16 $if little_endian {
17 println('system is little endian')
18 x = 1
19 }
20 $if big_endian {
21 println('system is big endian')
22 x = 2
23 }
24 assert x > 0
25}
26