MCPcopy
hub / github.com/go-gorm/gorm / TestToString

Function TestToString

utils/utils_test.go:117–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestToString(t *testing.T) {
118 tests := []struct {
119 name string
120 in interface{}
121 out string
122 }{
123 {"int", math.MaxInt64, "9223372036854775807"},
124 {"int8", int8(math.MaxInt8), "127"},
125 {"int16", int16(math.MaxInt16), "32767"},
126 {"int32", int32(math.MaxInt32), "2147483647"},
127 {"int64", int64(math.MaxInt64), "9223372036854775807"},
128 {"uint", uint(math.MaxUint64), "18446744073709551615"},
129 {"uint8", uint8(math.MaxUint8), "255"},
130 {"uint16", uint16(math.MaxUint16), "65535"},
131 {"uint32", uint32(math.MaxUint32), "4294967295"},
132 {"uint64", uint64(math.MaxUint64), "18446744073709551615"},
133 {"string", "abc", "abc"},
134 {"other", true, ""},
135 }
136 for _, test := range tests {
137 t.Run(test.name, func(t *testing.T) {
138 if out := ToString(test.in); test.out != out {
139 t.Fatalf("ToString(%v) want: %s, got: %s", test.in, test.out, out)
140 }
141 })
142 }
143}
144
145func TestRTrimSlice(t *testing.T) {
146 tests := []struct {

Callers

nothing calls this directly

Calls 1

ToStringFunction · 0.85

Tested by

no test coverage detected