MCPcopy Create free account
hub / github.com/francoispqt/gojay / TestDecoderFloat64Null

Function TestDecoderFloat64Null

decode_number_float_test.go:336–653  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

334}
335
336func TestDecoderFloat64Null(t *testing.T) {
337 testCases := []struct {
338 name string
339 json string
340 expectedResult float64
341 resultIsNil bool
342 err bool
343 errType interface{}
344 }{
345 {
346 name: "basic-float",
347 json: "1.1",
348 expectedResult: 1.1,
349 },
350 {
351 name: "basic-exponent-positive-positive-exp",
352 json: " 1e2",
353 expectedResult: 100,
354 },
355 {
356 name: "basic-exponent-positive-positive-exp2",
357 json: "5e+06",
358 expectedResult: 5000000,
359 },
360 {
361 name: "basic-exponent-positive-positive-exp3",
362 json: "3e+3",
363 expectedResult: 3000,
364 },
365 {
366 name: "basic-null",
367 json: "null",
368 expectedResult: 0,
369 resultIsNil: true,
370 },
371 {
372 name: "basic-null-err",
373 json: "nxll",
374 expectedResult: 0,
375 err: true,
376 errType: InvalidJSONError(""),
377 resultIsNil: true,
378 },
379 {
380 name: "basic-negative-err",
381 json: "-",
382 expectedResult: 0,
383 err: true,
384 errType: InvalidJSONError(""),
385 resultIsNil: true,
386 },
387 {
388 name: "basic-negative-err",
389 json: "-q",
390 expectedResult: 0,
391 err: true,
392 errType: InvalidJSONError(""),
393 resultIsNil: true,

Callers

nothing calls this directly

Calls 7

InvalidJSONErrorTypeAlias · 0.85
InvalidUnmarshalErrorTypeAlias · 0.85
UnmarshalFunction · 0.85
NewDecoderFunction · 0.85
FloatNullMethod · 0.80
AddFloat64NullMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…