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

Function TestParseIntBoundaryValues

deep_spec_test.go:509–527  ·  view source on GitHub ↗

============================================================================= ParseInt boundary values (SYS-REQ-058, SYS-REQ-059, SYS-REQ-064) ============================================================================= Verifies: SYS-REQ-058 [boundary] ParseInt at exact int64 boundary values shall

(t *testing.T)

Source from the content-addressed store, hash-verified

507// Verifies: SYS-REQ-058 [boundary]
508// ParseInt at exact int64 boundary values shall return correct values.
509func TestParseIntBoundaryValues(t *testing.T) {
510 // int64 max: 9223372036854775807
511 maxVal, err := ParseInt([]byte("9223372036854775807"))
512 if err != nil {
513 t.Fatalf("ParseInt(int64 max) error: %v", err)
514 }
515 if maxVal != math.MaxInt64 {
516 t.Fatalf("ParseInt(int64 max) = %d, want %d", maxVal, int64(math.MaxInt64))
517 }
518
519 // int64 min: -9223372036854775808
520 minVal, err := ParseInt([]byte("-9223372036854775808"))
521 if err != nil {
522 t.Fatalf("ParseInt(int64 min) error: %v", err)
523 }
524 if minVal != math.MinInt64 {
525 t.Fatalf("ParseInt(int64 min) = %d, want %d", minVal, int64(math.MinInt64))
526 }
527}
528
529// Verifies: SYS-REQ-059 [boundary]
530// ParseInt one beyond int64 range shall return OverflowIntegerError.

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…