| 1 | fn test_generics_struct_inst_method_call() { |
| 2 | v1 := V2d[f32]{100} |
| 3 | r1 := v1.in_bounds(tp_lft, bt_rigt) |
| 4 | println(r1) |
| 5 | assert r1 |
| 6 | } |
| 7 | |
| 8 | const tp_lft = V2d[f32]{20} |
| 9 | const bt_rigt = V2d[f32]{650} |
| 10 | |
| 11 | struct V2d[T] { |
| 12 | mut: |
| 13 | x T |
| 14 | } |
| 15 | |
| 16 | pub fn (v1 V2d[T]) unpack() T { |
| 17 | return v1.x |
| 18 | } |
| 19 | |
| 20 | pub fn (v1 V2d[T]) less_than(v2 V2d[T]) V2d[bool] { |
| 21 | return V2d[bool]{v1.x < v2.x} |
| 22 | } |
| 23 | |
| 24 | pub fn (v1 V2d[T]) in_bounds(top_left V2d[T], bottom_right V2d[T]) bool { |
| 25 | v1.less_than(bottom_right).unpack() |
| 26 | return true |
| 27 | } |
| 28 | |