2021-01-23 18:59:39 +03:00
|
|
|
struct User {
|
|
|
|
name string
|
2021-03-27 20:29:57 +03:00
|
|
|
num int
|
2021-01-23 18:59:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn (u User) == (u1 User) bool {
|
|
|
|
return u.name == u1.name
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_eq_op() {
|
|
|
|
u1 := User{'Joe', 23}
|
|
|
|
u2 := User{'Joe', 24}
|
|
|
|
assert u1 == u2
|
|
|
|
assert (u1 != u2) == false
|
|
|
|
}
|