Skip to content

Commit

Permalink
Merge pull request #80 from cockroachdb/bigint-test
Browse files Browse the repository at this point in the history
Use []string for big int tests
  • Loading branch information
maddyblue authored Oct 17, 2018
2 parents 2676f8e + d3e0584 commit a24032b
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,18 @@ func newDecimal(t *testing.T, c *Context, s string) *Decimal {
}

func TestNewWithBigInt(t *testing.T) {
tests := []struct {
d string
b string
}{
{d: "0", b: "0"},
{d: "1", b: "1"},
{d: "-1", b: "-1"},
tests := []string{
"0",
"1",
"-1",
}
for _, tc := range tests {
t.Run(tc.d, func(t *testing.T) {
expect, _, err := new(Decimal).SetString(tc.d)
t.Run(tc, func(t *testing.T) {
expect, _, err := new(Decimal).SetString(tc)
if err != nil {
t.Fatal(err)
}
b, ok := new(big.Int).SetString(tc.b, 10)
b, ok := new(big.Int).SetString(tc, 10)
if !ok {
t.Fatal("bad bigint")
}
Expand Down

0 comments on commit a24032b

Please sign in to comment.