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

Function TestFuzzObjectEachHarnessCoverage

coverage_closure_test.go:74–94  ·  view source on GitHub ↗

Verifies: SYS-REQ-007 [fuzz] MCDC SYS-REQ-007: N/A

(t *testing.T)

Source from the content-addressed store, hash-verified

72// Verifies: SYS-REQ-007 [fuzz]
73// MCDC SYS-REQ-007: N/A
74func TestFuzzObjectEachHarnessCoverage(t *testing.T) {
75 // FuzzObjectEach calls ObjectEach with a no-op callback and returns 1.
76 // Exercise it with various inputs covering both branches.
77
78 // Case 1: well-formed JSON object with entries
79 data := []byte(`{"key1":"value1","key2":42}`)
80 if got := FuzzObjectEach(data); got != 1 {
81 t.Fatalf("FuzzObjectEach with valid object = %d, want 1", got)
82 }
83
84 // Case 2: empty JSON object -- ObjectEach returns nil immediately
85 if got := FuzzObjectEach([]byte(`{}`)); got != 1 {
86 t.Fatalf("FuzzObjectEach with empty object = %d, want 1", got)
87 }
88
89 // Case 3: malformed input -- ObjectEach returns an error, but
90 // the fuzz harness ignores the return value of ObjectEach
91 if got := FuzzObjectEach([]byte(`not json`)); got != 1 {
92 t.Fatalf("FuzzObjectEach with malformed input = %d, want 1", got)
93 }
94}
95
96// =============================================================================
97// MC/DC witness row closure for SYS-REQ-010

Callers

nothing calls this directly

Calls 1

FuzzObjectEachFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…