MCPcopy Index your code
hub / github.com/google/go-github / TestStringify_Primitives

Function TestStringify_Primitives

github/strings_test.go:84–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestStringify_Primitives(t *testing.T) {
85 t.Parallel()
86 tests := []struct {
87 in any
88 out string
89 }{
90 // Bool
91 {true, "true"},
92 {false, "false"},
93
94 // Int variants
95 {int(1), "1"},
96 {int8(2), "2"},
97 {int16(3), "3"},
98 {int32(4), "4"},
99 {int64(5), "5"},
100
101 // Uint variants
102 {uint(6), "6"},
103 {uint8(7), "7"},
104 {uint16(8), "8"},
105 {uint32(9), "9"},
106 {uint64(10), "10"},
107 {uintptr(11), "11"},
108
109 // Float variants (Precision Correctness)
110 {float32(1.1), "1.1"},
111 {float64(1.1), "1.1"},
112 {float32(1.0000001), "1.0000001"},
113 {float64(1.000000000000001), "1.000000000000001"},
114
115 // Boundary Cases
116 {int8(-128), "-128"},
117 {int8(127), "127"},
118 {uint64(18446744073709551615), "18446744073709551615"},
119
120 // String Optimization
121 {"hello", `"hello"`},
122 {"", `""`},
123 }
124
125 for i, tt := range tests {
126 s := Stringify(tt.in)
127 if s != tt.out {
128 t.Errorf("%v. Stringify(%T) => %q, want %q", i, tt.in, s, tt.out)
129 }
130 }
131}
132
133func TestStringify_BufferPool(t *testing.T) {
134 t.Parallel()

Callers

nothing calls this directly

Calls 1

StringifyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…