1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/fixed_array_of_interfaces_equality_test.v

32 lines
388 B
V

interface IObject {
foo()
}
struct Foo {}
fn (f Foo) foo() {
}
struct Array {
mut:
array [1]IObject
}
fn (a Array) contains(x IObject) bool {
for element in a.array {
if element == x {
return true
}
}
return false
}
fn test_fixed_array_of_interfaces_equality() {
foo := Foo{}
mut ary := Array{}
ary.array[0] = foo
ret := ary.contains(foo)
println(ret)
assert ret
}