Skip to content

Commit

Permalink
improve test-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Mar 22, 2023
1 parent bee5242 commit 532f4ce
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1333,18 +1333,9 @@ func TestDecimal(t *testing.T) {
t.Errorf("second test: want '%v' have '%v', \n", want, have)
}
}
}

func TestSingleDecimal(t *testing.T) {
a, _ := FromDecimal("18446744073709551616")
want := a.ToBig().Text(10)
have := a.Dec()
if have != want {
t.Fatalf("want '%v' have '%v', \n", want, have)
}
// Op must not modify the original
if have := a.Dec(); have != want {
t.Fatalf("second test: want '%v' have '%v', \n", want, have)
// test zero-case
if have, want := new(Int).Dec(), new(big.Int).Text(10); have != want {
t.Errorf("have '%v', want '%v'", have, want)
}
}

Expand Down Expand Up @@ -1383,13 +1374,16 @@ func TestPrettyDecimal(t *testing.T) {
have := a.PrettyDec(',')
want := prettyFmtBigInt(a.ToBig())
if have != want {
t.Fatalf("%d: have '%v', want '%v'", i, have, want)
t.Errorf("%d: have '%v', want '%v'", i, have, want)
}
// Op must not modify the original
if have := a.PrettyDec(','); have != want {
t.Errorf("second test: want '%v' have '%v', \n", want, have)
}

}
// test zero-case
if have, want := new(Int).PrettyDec(','), prettyFmtBigInt(new(big.Int)); have != want {
t.Errorf("have '%v', want '%v'", have, want)
}
}

Expand Down

0 comments on commit 532f4ce

Please sign in to comment.