@@ -456,7 +456,7 @@ func TestDecodeInt32(t *testing.T) {
456456 t .Parallel ()
457457
458458 p := NewBuffer ()
459- v := int32 (- 2147483648 )
459+ v := int32 (2147483647 )
460460 encodeInt32 (p , v )
461461
462462 var value int32
@@ -466,6 +466,15 @@ func TestDecodeInt32(t *testing.T) {
466466 assert .Equal (t , v , value )
467467 assert .Equal (t , 0 , len (remaining ))
468468
469+ v = int32 (- 2147483647 )
470+ p .Reset ()
471+ encodeInt32 (p , v )
472+
473+ remaining , value , err = decodeInt32 (p .Bytes ())
474+ assert .NoError (t , err )
475+ assert .Equal (t , v , value )
476+ assert .Equal (t , 0 , len (remaining ))
477+
469478 _ , _ , err = decodeInt32 ((p .Bytes ())[1 :])
470479 assert .ErrorIs (t , err , InvalidInt32 )
471480
@@ -491,7 +500,7 @@ func TestDecodeInt64(t *testing.T) {
491500 t .Parallel ()
492501
493502 p := NewBuffer ()
494- v := int64 (- 9223372036854775808 )
503+ v := int64 (9223372036854775807 )
495504 encodeInt64 (p , v )
496505
497506 var value int64
@@ -501,6 +510,15 @@ func TestDecodeInt64(t *testing.T) {
501510 assert .Equal (t , v , value )
502511 assert .Equal (t , 0 , len (remaining ))
503512
513+ v = int64 (- 9223372036854775807 )
514+ p .Reset ()
515+ encodeInt64 (p , v )
516+
517+ remaining , value , err = decodeInt64 (p .Bytes ())
518+ assert .NoError (t , err )
519+ assert .Equal (t , v , value )
520+ assert .Equal (t , 0 , len (remaining ))
521+
504522 _ , _ , err = decodeInt64 ((p .Bytes ())[1 :])
505523 assert .ErrorIs (t , err , InvalidInt64 )
506524
0 commit comments