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

Function TestCodeMCDC_ArrayEachNormalIteration

mcdc_supplement_test.go:629–643  ·  view source on GitHub ↗

Verifies: SYS-REQ-006 [boundary] Code MC/DC gap: parser.go:1073 ArrayEach o == 0 (FALSE branch) and parser.go:1077 ArrayEach t != NotExist (TRUE branch) Normal ArrayEach iteration has o > 0 and t != NotExist.

(t *testing.T)

Source from the content-addressed store, hash-verified

627// and parser.go:1077 ArrayEach t != NotExist (TRUE branch)
628// Normal ArrayEach iteration has o > 0 and t != NotExist.
629func TestCodeMCDC_ArrayEachNormalIteration(t *testing.T) {
630 var values []string
631 _, err := ArrayEach([]byte(`[1,2,3]`), func(value []byte, dataType ValueType, offset int, err error) {
632 values = append(values, string(value))
633 })
634 if err != nil {
635 t.Fatalf("ArrayEach error: %v", err)
636 }
637 if len(values) != 3 {
638 t.Fatalf("ArrayEach count = %d, want 3", len(values))
639 }
640 if values[0] != "1" || values[1] != "2" || values[2] != "3" {
641 t.Fatalf("ArrayEach values = %v, want [1 2 3]", values)
642 }
643}
644
645// Verifies: SYS-REQ-006 [boundary]
646// Code MC/DC gap: parser.go:1081 ArrayEach e != nil (FALSE branch)

Callers

nothing calls this directly

Calls 1

ArrayEachFunction · 0.85

Tested by

no test coverage detected