chord/chord/id_test.go
2025-03-07 16:09:48 -05:00

31 lines
568 B
Go

package chord
import "testing"
func TestContains(t *testing.T) {
true := [][3]ID{
{{1}, {1}, {0}},
{{1}, {1}, {1}},
{{1}, {1}, {2}},
{{1}, {2}, {2}},
{{1}, {3}, {2}},
{{3}, {1}, {1}},
{{3}, {1}, {0}},
}
false := [][3]ID{
{{1}, {2}, {0}},
{{1}, {2}, {3}},
{{3}, {1}, {2}},
}
for _, c := range true {
if !contains(c[0], c[1], c[2]) {
t.Errorf("%02x not found inside %02x - %02x", c[2], c[0], c[1])
}
}
for _, c := range false {
if contains(c[0], c[1], c[2]) {
t.Errorf("%02x found inside %02x - %02x", c[2], c[0], c[1])
}
}
}