MCPcopy
hub / github.com/buger/jsonparser / TestH2I

Function TestH2I

escape_test.go:10–19  ·  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

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

Callers

nothing calls this directly

Calls 1

h2IFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…