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

Function TestDecoderFloat64

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

Source from the content-addressed store, hash-verified

11)
12
13func TestDecoderFloat64(t *testing.T) {
14 testCases := []struct {
15 name string
16 json string
17 expectedResult float64
18 skipResult bool
19 err bool
20 errType interface{}
21 }{
22 {
23 name: "basic-float",
24 json: "1.1",
25 expectedResult: 1.1,
26 },
27 {
28 name: "basic-exponent-positive-positive-exp",
29 json: "1e2",
30 expectedResult: 100,
31 },
32 {
33 name: "basic-exponent-positive-positive-exp2",
34 json: "5e+06",
35 expectedResult: 5000000,
36 },
37 {
38 name: "basic-exponent-positive-positive-exp3",
39 json: "3e+3",
40 expectedResult: 3000,
41 },
42 {
43 name: "basic-null",
44 json: "null",
45 expectedResult: 0,
46 },
47 {
48 name: "basic-null-err",
49 json: "nxll",
50 expectedResult: 0,
51 err: true,
52 errType: InvalidJSONError(""),
53 },
54 {
55 name: "basic-negative-err",
56 json: "-",
57 expectedResult: 0,
58 err: true,
59 errType: InvalidJSONError(""),
60 },
61 {
62 name: "basic-negative-err",
63 json: "-q",
64 expectedResult: 0,
65 err: true,
66 errType: InvalidJSONError(""),
67 },
68 {
69 name: "basic-null-err",
70 json: "trua",

Callers

nothing calls this directly

Calls 8

ReleaseMethod · 0.95
DecodeFloat64Method · 0.95
InvalidJSONErrorTypeAlias · 0.85
InvalidUnmarshalErrorTypeAlias · 0.85
UnmarshalFunction · 0.85
NewDecoderFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…