MCPcopy Index your code
hub / github.com/buger/jsonparser / TestAdditionalFuzzHarnessCoverage

Function TestAdditionalFuzzHarnessCoverage

mcdc_supplement_test.go:435–484  ·  view source on GitHub ↗

Verifies: SYS-REQ-002 [fuzz] MCDC SYS-REQ-002: N/A Verifies: SYS-REQ-003 [fuzz] MCDC SYS-REQ-003: N/A Verifies: SYS-REQ-004 [fuzz] MCDC SYS-REQ-004: N/A Verifies: SYS-REQ-005 [fuzz] MCDC SYS-REQ-005: N/A Verifies: SYS-REQ-011 [fuzz] MCDC SYS-REQ-011: N/A Verifies: SYS-REQ-012 [fuzz] MCDC SYS-REQ-012

(t *testing.T)

Source from the content-addressed store, hash-verified

433// Verifies: SYS-REQ-015 [fuzz]
434// MCDC SYS-REQ-015: N/A
435func TestAdditionalFuzzHarnessCoverage(t *testing.T) {
436 if got := FuzzParseInt([]byte(`12`)); got != 1 {
437 t.Fatalf("FuzzParseInt success path = %d, want 1", got)
438 }
439 if got := FuzzParseInt([]byte(`1.2`)); got != 0 {
440 t.Fatalf("FuzzParseInt failure path = %d, want 0", got)
441 }
442
443 if got := FuzzParseBool([]byte(`true`)); got != 1 {
444 t.Fatalf("FuzzParseBool success path = %d, want 1", got)
445 }
446 if got := FuzzParseBool([]byte(`truthy`)); got != 0 {
447 t.Fatalf("FuzzParseBool failure path = %d, want 0", got)
448 }
449
450 if got := FuzzGetString([]byte(`{"test":"value"}`)); got != 1 {
451 t.Fatalf("FuzzGetString success path = %d, want 1", got)
452 }
453 if got := FuzzGetString([]byte(`{"other":"value"}`)); got != 0 {
454 t.Fatalf("FuzzGetString failure path = %d, want 0", got)
455 }
456
457 if got := FuzzGetFloat([]byte(`{"test":1.5}`)); got != 1 {
458 t.Fatalf("FuzzGetFloat success path = %d, want 1", got)
459 }
460 if got := FuzzGetFloat([]byte(`{"test":"value"}`)); got != 0 {
461 t.Fatalf("FuzzGetFloat failure path = %d, want 0", got)
462 }
463
464 if got := FuzzGetInt([]byte(`{"test":2}`)); got != 1 {
465 t.Fatalf("FuzzGetInt success path = %d, want 1", got)
466 }
467 if got := FuzzGetInt([]byte(`{"test":2.5}`)); got != 0 {
468 t.Fatalf("FuzzGetInt failure path = %d, want 0", got)
469 }
470
471 if got := FuzzGetBoolean([]byte(`{"test":true}`)); got != 1 {
472 t.Fatalf("FuzzGetBoolean success path = %d, want 1", got)
473 }
474 if got := FuzzGetBoolean([]byte(`{"test":1}`)); got != 0 {
475 t.Fatalf("FuzzGetBoolean failure path = %d, want 0", got)
476 }
477
478 if got := FuzzGetUnsafeString([]byte(`{"test":"value"}`)); got != 1 {
479 t.Fatalf("FuzzGetUnsafeString success path = %d, want 1", got)
480 }
481 if got := FuzzGetUnsafeString([]byte(`{"other":"value"}`)); got != 0 {
482 t.Fatalf("FuzzGetUnsafeString failure path = %d, want 0", got)
483 }
484}
485
486// =============================================================================
487// Code MC/DC gap closure tests

Callers

nothing calls this directly

Calls 7

FuzzParseIntFunction · 0.85
FuzzParseBoolFunction · 0.85
FuzzGetStringFunction · 0.85
FuzzGetFloatFunction · 0.85
FuzzGetIntFunction · 0.85
FuzzGetBooleanFunction · 0.85
FuzzGetUnsafeStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…