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

Function TestCodeMCDC_TokenStartDirect

mcdc_code_supplement_test.go:24–42  ·  view source on GitHub ↗

============================================================================= Code-level MC/DC supplement tests. ============================================================================= These tests drive specific branch combinations reported as gaps by `proof mcdc report --view hotspots`. They

(t *testing.T)

Source from the content-addressed store, hash-verified

22
23// Verifies: SYS-REQ-001 [mcdc]
24func TestCodeMCDC_TokenStartDirect(t *testing.T) {
25 // Each input ends with the targeted delimiter byte, so tokenStart's
26 // for-loop returns that index with the corresponding c != <delim>
27 // operand as the independent flipper.
28 cases := map[byte]int{
29 '\n': tokenStart([]byte("abc\n")), // 10
30 '\r': tokenStart([]byte("abc\r")), // 13
31 '\t': tokenStart([]byte("abc\t")), // 9
32 }
33 for delim, got := range cases {
34 if got != 3 {
35 t.Errorf("tokenStart with trailing %q returned %d, want 3", delim, got)
36 }
37 }
38 // Baseline row: no delimiter present, falls through to return 0.
39 if got := tokenStart([]byte("abc")); got != 0 {
40 t.Errorf("tokenStart(abc) = %d, want 0", got)
41 }
42}
43
44// Verifies: SYS-REQ-001 [mcdc]
45func TestCodeMCDC_TokenEndDirect(t *testing.T) {

Callers

nothing calls this directly

Calls 1

tokenStartFunction · 0.85

Tested by

no test coverage detected