v2 / vlib / v / tests / translated_test.v
47 lines · 38 sloc · 735 bytes · 7b77f2ee5b6cc362ed9223e50dadaaae6e6fb695
Raw
1@[translated]
2module main
3
4fn test_NotSnakeCaseFunction() {
5 assert true
6 assert 8 == 2 * 4
7 assert 2 * 3 == 6
8}
9
10const ssf = [1, 2, 3]!
11
12fn test_const_name_without_main_prefix() {
13 assert ssf[0] == 1
14}
15
16struct ASMOperand {
17 constraint [2]i8
18}
19
20fn test_pointer_assign_without_memcpy() {
21 op := ASMOperand{
22 constraint: [i8(5), 4]!
23 }
24 str := &i8(0)
25 str = op.constraint
26 assert !isnil(str)
27
28 ops := [3]ASMOperand{}
29 pop := &ASMOperand(0)
30 pop = ops
31 assert pop[1].constraint[0] == 0
32}
33
34struct StubIndex {
35pub mut:
36 data [5][5]map[string]string
37}
38
39fn test_pointer_assign_with_memcpy() {
40 mut s := StubIndex{}
41 s.data[1] = [5]map[string]string{}
42
43 mut data := s.data[1]
44 data[0]['abc'] = '123'
45 k := data[0]['abc']
46 assert k == '123'
47}
48