Skip to content

Commit

Permalink
Fix 64-bit tests on 32-bit systems (#60)
Browse files Browse the repository at this point in the history
We need to cast few constant literals, and change a variable type so that
we do not overflow the int type on 32-bit systems.
  • Loading branch information
guillemj committed Jan 12, 2021
1 parent 20830cf commit 6dae91c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions parser_test.go
Expand Up @@ -869,8 +869,8 @@ func TestParserParse(t *testing.T) {
if err != nil {
t.Fatalf("cannot obtain int64: %s", err)
}
if n != -8838840643388017390 {
t.Fatalf("unexpected value obtained for int64; got %d; want %d", n, -8838840643388017390)
if n != int64(-8838840643388017390) {
t.Fatalf("unexpected value obtained for int64; got %d; want %d", n, int64(-8838840643388017390))
}
s := v.String()
if s != "-8838840643388017390" {
Expand All @@ -887,11 +887,11 @@ func TestParserParse(t *testing.T) {
if tp != TypeNumber || tp.String() != "number" {
t.Fatalf("unexpected type obtained for uint: %#v", v)
}
n, err := v.Uint()
n, err := v.Uint64()
if err != nil {
t.Fatalf("cannot obtain uint64: %s", err)
}
if n != 18446744073709551615 {
if n != uint64(18446744073709551615) {
t.Fatalf("unexpected value obtained for uint; got %d; want %d", n, uint64(18446744073709551615))
}
s := v.String()
Expand Down

0 comments on commit 6dae91c

Please sign in to comment.