v2 / vlib / v / tests / structs / struct_eq_op_test.v
12 lines · 10 sloc · 142 bytes · d9158e788546e3d5dcf6895f4eb16a14e367cab5
Raw
1struct MyInt {
2 x int
3}
4
5fn (i1 MyInt) == (i2 MyInt) bool {
6 return i1.x == i2.x
7}
8
9fn test_main() {
10 c := MyInt{30} == MyInt{2}
11 assert !c
12}
13