MCPcopy
hub / github.com/go-sql-driver/mysql / TestConvertUnsignedIntegers

Function TestConvertUnsignedIntegers

statement_test.go:108–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestConvertUnsignedIntegers(t *testing.T) {
109 values := []any{
110 uint8(42),
111 uint16(42),
112 uint32(42),
113 uint64(42),
114 uint(42),
115 myUint64{uint64(42)},
116 }
117
118 for _, value := range values {
119 output, err := converter{}.ConvertValue(value)
120 if err != nil {
121 t.Fatalf("%T type not convertible %s", value, err)
122 }
123
124 if output != uint64(42) {
125 t.Fatalf("%T type not converted, got %#v %T", value, output, output)
126 }
127 }
128
129 output, err := converter{}.ConvertValue(^uint64(0))
130 if err != nil {
131 t.Fatal("uint64 high-bit not convertible", err)
132 }
133
134 if output != ^uint64(0) {
135 t.Fatalf("uint64 high-bit converted, got %#v %T", output, output)
136 }
137}
138
139func TestConvertJSON(t *testing.T) {
140 raw := json.RawMessage("{}")

Callers

nothing calls this directly

Calls 1

ConvertValueMethod · 0.80

Tested by

no test coverage detected