#returned values are same but the test fails
22 messages · Page 1 of 1 (latest)
hmmm
test_record_performance returns true
its the test_pair that returns false
global_ranks underlying type is that
use reflect.TypeOf to log the types of each
those two need to be equal for reflect.DeepEqual to return true
func make_pairs(unpaired_slice []string) (pairs [][]string) {
for i, v := range unpaired_slice {
pairs_slice := unpaired_slice[i+1:]
if len(pairs_slice) == 0 {
break
}
for _, x := range pairs_slice {
pairs = append(pairs, []string{v, x})
}
}
return pairs
}
func Test_make_pairs(t *testing.T) {
s := []string{"a", "b", "c"}
expect := [][]string{{"a", "b"}, {"a", "c"}, {"b", "c"}}
get := make_pairs(s)
expections(t, expect, get, true)
}
i dont see how that those types are relavent here
im just using strings in this test
func expections(t testing.TB, expect, got interface{}, deep bool) {
t.Helper()
if !deep {
if got != expect {
t.Errorf("Got: %v \nWant: %v", got, expect)
}
} else {
if reflect.DeepEqual(expect, got) {
t.Errorf("Got: %v \nWant: %v", got, expect)
}
}
}
oh
wait
LMAO
i messed my expectations func
@broken cypress thanks for catching that
i forgot to add ! in my helper func