| 1 | #include "@VMODROOT/vlib/v/gen/c/testdata/multiple_c_cources/file3.c" |
| 2 | |
| 3 | @[typedef] |
| 4 | struct C.CStruct { |
| 5 | mut: |
| 6 | c char |
| 7 | i int |
| 8 | f f32 |
| 9 | } |
| 10 | |
| 11 | type C.PCStruct = &C.CStruct |
| 12 | |
| 13 | struct WrapperStruct { |
| 14 | mut: |
| 15 | arr_fixed_c_type [2]C.PCStruct |
| 16 | } |
| 17 | |
| 18 | fn test_main() { |
| 19 | s1 := &C.CStruct{ |
| 20 | c: char(`A`) |
| 21 | f: 3.14 |
| 22 | i: 42 |
| 23 | } |
| 24 | s2 := &C.CStruct{ |
| 25 | c: char(`B`) |
| 26 | f: 1.4142 |
| 27 | i: 2 |
| 28 | } |
| 29 | mut w := WrapperStruct{} |
| 30 | w.arr_fixed_c_type[0] = s1 |
| 31 | w.arr_fixed_c_type[1] = s2 |
| 32 | dump(w) |
| 33 | assert w.arr_fixed_c_type[0].c == char(`A`) |
| 34 | assert w.arr_fixed_c_type[1].c == char(`B`) |
| 35 | assert w.arr_fixed_c_type[0].f == 3.14 |
| 36 | assert w.arr_fixed_c_type[1].f == 1.4142 |
| 37 | assert w.arr_fixed_c_type[0].i == 42 |
| 38 | assert w.arr_fixed_c_type[1].i == 2 |
| 39 | } |
| 40 | |