Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions decode_array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"github.com/stretchr/testify/assert"
)

type testSliceInts []int
type testSliceInts []int64

func (t *testSliceInts) UnmarshalJSONArray(dec *Decoder) error {
i := 0
if err := dec.AddInt(&i); err != nil {
var i int64
if err := dec.AddInt64(&i); err != nil {
return err
}
*t = append(*t, i)
Expand Down
21 changes: 11 additions & 10 deletions decode_number_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gojay

import (
"fmt"
"math"
"reflect"
"strings"
"testing"
Expand Down Expand Up @@ -67,8 +68,8 @@ func TestDecoderInt(t *testing.T) {
},
{
name: "basic-big",
json: "9223372036854775807",
expectedResult: 9223372036854775807,
json: fmt.Sprintf("%d", math.MaxInt),
expectedResult: math.MaxInt,
},
{
name: "basic-big-overflow",
Expand Down Expand Up @@ -135,8 +136,8 @@ func TestDecoderInt(t *testing.T) {
},
{
name: "basic-exponent-positive-positive-exp2",
json: "5.01e+10",
expectedResult: 50100000000,
json: "5.01e+08",
expectedResult: 501000000,
},
{
name: "basic-exponent-positive-positive-exp3",
Expand Down Expand Up @@ -369,8 +370,8 @@ func TestDecoderIntNull(t *testing.T) {
},
{
name: "basic-big",
json: "9223372036854775807",
expectedResult: 9223372036854775807,
json: fmt.Sprintf("%d", math.MaxInt),
expectedResult: math.MaxInt,
},
{
name: "basic-big-overflow",
Expand Down Expand Up @@ -437,8 +438,8 @@ func TestDecoderIntNull(t *testing.T) {
},
{
name: "basic-exponent-positive-positive-exp2",
json: "5.01e+10",
expectedResult: 50100000000,
json: "5.01e+08",
expectedResult: 501000000,
},
{
name: "basic-exponent-positive-positive-exp3",
Expand Down Expand Up @@ -652,7 +653,7 @@ func TestDecoderInt64(t *testing.T) {
{
name: "basic-big",
json: "9223372036854775807",
expectedResult: 9223372036854775807,
expectedResult: math.MaxInt64,
},
{
name: "basic-big-overflow",
Expand Down Expand Up @@ -981,7 +982,7 @@ func TestDecoderInt64Null(t *testing.T) {
{
name: "basic-big",
json: "9223372036854775807",
expectedResult: 9223372036854775807,
expectedResult: math.MaxInt64,
},
{
name: "basic-big-overflow",
Expand Down
2 changes: 1 addition & 1 deletion encode_number_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestEncoderNumberEncodeAPI(t *testing.T) {
assert.Nil(t, err, "Error should be nil")
assert.Equal(
t,
fmt.Sprintf("%d", math.MaxInt64),
fmt.Sprintf("%d", int64(math.MaxInt64)),
builder.String(),
"Result of marshalling is different as the one expected")
})
Expand Down