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

Function TestNewHasher

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

Source from the content-addressed store, hash-verified

2102}
2103
2104func TestNewHasher(t *testing.T) {
2105 t.Run("builtin", func(t *testing.T) {
2106 t.Run("int", func(t *testing.T) { testNewHasher(t, int(100)) })
2107 t.Run("int8", func(t *testing.T) { testNewHasher(t, int8(100)) })
2108 t.Run("int16", func(t *testing.T) { testNewHasher(t, int16(100)) })
2109 t.Run("int32", func(t *testing.T) { testNewHasher(t, int32(100)) })
2110 t.Run("int64", func(t *testing.T) { testNewHasher(t, int64(100)) })
2111
2112 t.Run("uint", func(t *testing.T) { testNewHasher(t, uint(100)) })
2113 t.Run("uint8", func(t *testing.T) { testNewHasher(t, uint8(100)) })
2114 t.Run("uint16", func(t *testing.T) { testNewHasher(t, uint16(100)) })
2115 t.Run("uint32", func(t *testing.T) { testNewHasher(t, uint32(100)) })
2116 t.Run("uint64", func(t *testing.T) { testNewHasher(t, uint64(100)) })
2117
2118 t.Run("string", func(t *testing.T) { testNewHasher(t, "foo") })
2119 //t.Run("byteSlice", func(t *testing.T) { testNewHasher(t, []byte("foo")) })
2120 })
2121
2122 t.Run("reflection", func(t *testing.T) {
2123 type Int int
2124 t.Run("int", func(t *testing.T) { testNewHasher(t, Int(100)) })
2125
2126 type Uint uint
2127 t.Run("uint", func(t *testing.T) { testNewHasher(t, Uint(100)) })
2128
2129 type String string
2130 t.Run("string", func(t *testing.T) { testNewHasher(t, String("foo")) })
2131 })
2132}
2133
2134func testNewHasher[V constraints.Ordered](t *testing.T, v V) {
2135 t.Helper()

Callers

nothing calls this directly

Calls 4

testNewHasherFunction · 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…