MCPcopy Create free account
hub / github.com/buger/jsonparser / TestGetUint64

Function TestGetUint64

len_uint_test.go:167–249  ·  view source on GitHub ↗

Verifies: SYS-REQ-003 (GetInt/typed accessors). reqproof:proptest:skip targeted witness/regression test; not a property-test subject

(t *testing.T)

Source from the content-addressed store, hash-verified

165// Verifies: SYS-REQ-003 (GetInt/typed accessors).
166// reqproof:proptest:skip targeted witness/regression test; not a property-test subject
167func TestGetUint64(t *testing.T) {
168 tests := []struct {
169 name string
170 data string
171 keys []string
172 want uint64
173 wantErr error
174 anyErr bool
175 }{
176 {
177 name: "zero",
178 data: `{"value":0}`,
179 keys: []string{"value"},
180 want: 0,
181 },
182 {
183 name: "one",
184 data: `{"value":1}`,
185 keys: []string{"value"},
186 want: 1,
187 },
188 {
189 name: "max uint64",
190 data: `{"value":18446744073709551615}`,
191 keys: []string{"value"},
192 want: ^uint64(0),
193 },
194 {
195 name: "negative",
196 data: `{"value":-1}`,
197 keys: []string{"value"},
198 wantErr: MalformedValueError,
199 },
200 {
201 name: "max int64",
202 data: `{"value":9223372036854775807}`,
203 keys: []string{"value"},
204 want: uint64(9223372036854775807),
205 },
206 {
207 name: "max uint64 plus one",
208 data: `{"value":18446744073709551616}`,
209 keys: []string{"value"},
210 wantErr: OverflowIntegerError,
211 },
212 {
213 name: "string value",
214 data: `{"value":"1"}`,
215 keys: []string{"value"},
216 anyErr: true,
217 },
218 {
219 name: "missing key",
220 data: `{"value":1}`,
221 keys: []string{"missing"},
222 wantErr: KeyPathNotFoundError,
223 },
224 }

Callers

nothing calls this directly

Calls 1

GetUint64Function · 0.85

Tested by

no test coverage detected