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

Function TestParseIntOverflowBoundary

deep_spec_test.go:531–543  ·  view source on GitHub ↗

Verifies: SYS-REQ-059 [boundary] ParseInt one beyond int64 range shall return OverflowIntegerError.

(t *testing.T)

Source from the content-addressed store, hash-verified

529// Verifies: SYS-REQ-059 [boundary]
530// ParseInt one beyond int64 range shall return OverflowIntegerError.
531func TestParseIntOverflowBoundary(t *testing.T) {
532 // max + 1: 9223372036854775808
533 _, err := ParseInt([]byte("9223372036854775808"))
534 if !errors.Is(err, OverflowIntegerError) {
535 t.Fatalf("ParseInt(int64 max+1) error = %v, want %v", err, OverflowIntegerError)
536 }
537
538 // min - 1: -9223372036854775809
539 _, err = ParseInt([]byte("-9223372036854775809"))
540 if !errors.Is(err, OverflowIntegerError) {
541 t.Fatalf("ParseInt(int64 min-1) error = %v, want %v", err, OverflowIntegerError)
542 }
543}
544
545// Verifies: SYS-REQ-064 [boundary]
546// ParseInt on empty input shall return MalformedValueError.

Callers

nothing calls this directly

Calls 1

ParseIntFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…