mirror of
https://github.com/golang/go.git
synced 2025-10-19 11:03:18 +00:00
hash/maphash: more testcases for maphash.Comparable
This commit extends test suite for maphash.Comparable in order to have at least some instances of pointer types.
This commit is contained in:
parent
1ee053e274
commit
2537216a1e
1 changed files with 5 additions and 0 deletions
|
@ -254,12 +254,17 @@ func TestComparable(t *testing.T) {
|
|||
}
|
||||
testComparable(t, s1, s2)
|
||||
testComparable(t, s1.s, s2.s)
|
||||
c1 := make(chan struct{})
|
||||
c2 := make(chan struct{})
|
||||
testComparable(t, c1, c1)
|
||||
testComparable(t, chan struct{}(nil))
|
||||
testComparable(t, float32(0), negativeZero[float32]())
|
||||
testComparable(t, float64(0), negativeZero[float64]())
|
||||
testComparableNoEqual(t, math.NaN(), math.NaN())
|
||||
testComparableNoEqual(t, [2]string{"a", ""}, [2]string{"", "a"})
|
||||
testComparableNoEqual(t, struct{ a, b string }{"foo", ""}, struct{ a, b string }{"", "foo"})
|
||||
testComparableNoEqual(t, struct{ a, b any }{int(0), struct{}{}}, struct{ a, b any }{struct{}{}, int(0)})
|
||||
testComparableNoEqual(t, c1, c2)
|
||||
}
|
||||
|
||||
func testComparableNoEqual[T comparable](t *testing.T, v1, v2 T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue