MCPcopy Create free account
hub / github.com/benbjohnson/immutable / TestNewComparer

Function TestNewComparer

immutable_test.go:2143–2171  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2141}
2142
2143func TestNewComparer(t *testing.T) {
2144 t.Run("builtin", func(t *testing.T) {
2145 t.Run("int", func(t *testing.T) { testNewComparer(t, int(100), int(101)) })
2146 t.Run("int8", func(t *testing.T) { testNewComparer(t, int8(100), int8(101)) })
2147 t.Run("int16", func(t *testing.T) { testNewComparer(t, int16(100), int16(101)) })
2148 t.Run("int32", func(t *testing.T) { testNewComparer(t, int32(100), int32(101)) })
2149 t.Run("int64", func(t *testing.T) { testNewComparer(t, int64(100), int64(101)) })
2150
2151 t.Run("uint", func(t *testing.T) { testNewComparer(t, uint(100), uint(101)) })
2152 t.Run("uint8", func(t *testing.T) { testNewComparer(t, uint8(100), uint8(101)) })
2153 t.Run("uint16", func(t *testing.T) { testNewComparer(t, uint16(100), uint16(101)) })
2154 t.Run("uint32", func(t *testing.T) { testNewComparer(t, uint32(100), uint32(101)) })
2155 t.Run("uint64", func(t *testing.T) { testNewComparer(t, uint64(100), uint64(101)) })
2156
2157 t.Run("string", func(t *testing.T) { testNewComparer(t, "bar", "foo") })
2158 //t.Run("byteSlice", func(t *testing.T) { testNewComparer(t, []byte("bar"), []byte("foo")) })
2159 })
2160
2161 t.Run("reflection", func(t *testing.T) {
2162 type Int int
2163 t.Run("int", func(t *testing.T) { testNewComparer(t, Int(100), Int(101)) })
2164
2165 type Uint uint
2166 t.Run("uint", func(t *testing.T) { testNewComparer(t, Uint(100), Uint(101)) })
2167
2168 type String string
2169 t.Run("string", func(t *testing.T) { testNewComparer(t, String("bar"), String("foo")) })
2170 })
2171}
2172
2173func testNewComparer[T constraints.Ordered](t *testing.T, x, y T) {
2174 t.Helper()

Callers

nothing calls this directly

Calls 4

testNewComparerFunction · 0.85
IntTypeAlias · 0.85
UintTypeAlias · 0.85
StringTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…