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

Function TestEqual

bytes_unsafe_test.go:34–54  ·  view source on GitHub ↗

Verifies: SYS-REQ-001 MCDC SYS-REQ-001: N/A

(t *testing.T)

Source from the content-addressed store, hash-verified

32// Verifies: SYS-REQ-001
33// MCDC SYS-REQ-001: N/A
34func TestEqual(t *testing.T) {
35 if !equalStr(&[]byte{}, "") {
36 t.Errorf(`equalStr("", ""): expected true, obtained false`)
37 return
38 }
39
40 longstr := strings.Repeat("a", 1000)
41 for i := 0; i < len(longstr); i++ {
42 s1, s2 := longstr[:i]+"1", longstr[:i]+"2"
43 b1 := []byte(s1)
44
45 if !equalStr(&b1, s1) {
46 t.Errorf(`equalStr("a"*%d + "1", "a"*%d + "1"): expected true, obtained false`, i, i)
47 break
48 }
49 if equalStr(&b1, s2) {
50 t.Errorf(`equalStr("a"*%d + "1", "a"*%d + "2"): expected false, obtained true`, i, i)
51 break
52 }
53 }
54}
55
56// Verifies: SYS-REQ-001
57// MCDC SYS-REQ-001: N/A

Callers

nothing calls this directly

Calls 1

equalStrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…