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

Function TestGetFloat

parser_test.go:1582–1593  ·  view source on GitHub ↗

Verifies: SYS-REQ-004 [example] STK-REQ-003:AC-2:acceptance MCDC SYS-REQ-004: addressed_value_is_number=F, raw_number_token_is_float_parseable=T, returns_getfloat_value=F => TRUE MCDC SYS-REQ-004: addressed_value_is_number=T, raw_number_token_is_float_parseable=F, returns_getfloat_value=F => TRUE MC

(t *testing.T)

Source from the content-addressed store, hash-verified

1580// MCDC SYS-REQ-004: addressed_value_is_number=T, raw_number_token_is_float_parseable=T, returns_getfloat_value=F => FALSE
1581// MCDC SYS-REQ-004: addressed_value_is_number=T, raw_number_token_is_float_parseable=T, returns_getfloat_value=T => TRUE
1582func TestGetFloat(t *testing.T) {
1583 runGetTests(t, "GetFloat()", getFloatTests,
1584 func(test GetTest) (value interface{}, dataType ValueType, err error) {
1585 value, err = GetFloat([]byte(test.json), test.path...)
1586 return value, Number, err
1587 },
1588 func(test GetTest, value interface{}) (bool, interface{}) {
1589 expected := test.data.(float64)
1590 return expected == value.(float64), expected
1591 },
1592 )
1593}
1594
1595// Verifies: SYS-REQ-005 [example]
1596// STK-REQ-003:AC-3:acceptance

Callers

nothing calls this directly

Calls 2

runGetTestsFunction · 0.85
GetFloatFunction · 0.85

Tested by

no test coverage detected