v2 / vlib / v / tests / comptime / comptime_value_d_default_test.v
15 lines · 14 sloc · 421 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1const my_f64 = $d('my_f64', 1.0)
2const my_i64 = $d('my_i64', 2)
3const my_string = $d('my_string', 'three')
4const my_bool = $d('my_bool', false)
5const my_char = $d('my_char', `f`)
6
7fn test_default_compile_values() {
8 assert my_f64 == 1.0
9 assert my_i64 == 2
10 assert my_string == 'three'
11 assert my_bool == false
12 assert my_char == `f`
13 my_fixed_size_array := [$d('my_size', 4)]int{}
14 assert my_fixed_size_array.len == 4
15}
16