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

Function TestH2I

escape_test.go:12–21  ·  view source on GitHub ↗

Verifies: SYS-REQ-014 [boundary] MCDC SYS-REQ-014: N/A

(t *testing.T)

Source from the content-addressed store, hash-verified

10// Verifies: SYS-REQ-014 [boundary]
11// MCDC SYS-REQ-014: N/A
12func TestH2I(t *testing.T) {
13 hexChars := []byte{'0', '9', 'A', 'F', 'a', 'f', 'x', '\000'}
14 hexValues := []int{0, 9, 10, 15, 10, 15, -1, -1}
15
16 for i, c := range hexChars {
17 if v := h2I(c); v != hexValues[i] {
18 t.Errorf("h2I('%c') returned wrong value (obtained %d, expected %d)", c, v, hexValues[i])
19 }
20 }
21}
22
23type escapedUnicodeRuneTest struct {
24 in string

Callers

nothing calls this directly

Calls 1

h2IFunction · 0.85

Tested by

no test coverage detected