Skip to content

Commit

Permalink
decimal: reduce corpus to improve performace
Browse files Browse the repository at this point in the history
  • Loading branch information
eapenkin committed Aug 12, 2023
1 parent b3f91ea commit a72a490
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: go test -fuzztime 20s -fuzz ^FuzzDecimal_Mul_FintVsSint$ github.com/govalues/decimal

- name: Run fuzzing for fused multiply-addidtion
run: go test -fuzztime 20s -fuzz ^FuzzDecimal_FMA_FintVsSint$ github.com/govalues/decimal
run: go test -fuzztime 40s -fuzz ^FuzzDecimal_FMA_FintVsSint$ github.com/govalues/decimal

- name: Run fuzzing for division
run: go test -fuzztime 20s -fuzz ^FuzzDecimal_Quo_FintVsSint$ github.com/govalues/decimal
Expand Down
34 changes: 13 additions & 21 deletions decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2333,32 +2333,24 @@ var corpus = []struct {
scale int
coef uint64
}{
{false, 0, 9999999999999999999},
{false, 1, 9999999999999999999},
{false, 0, 1000000000000000000},
{false, 19, 9999999999999999999},
{false, 0, 7},
{false, 0, 3},
{false, 0, 2},
// zero
{false, 0, 0},

// positive
{false, 0, 1},
{false, 18, 1000000000000000001},
{false, 0, 3},
{false, 0, 9999999999999999999},
{false, 19, 3},
{false, 19, 2},
{false, 19, 1},
{false, 0, 0},
{false, 19, 0},
{true, 0, 9999999999999999999},
{true, 1, 9999999999999999999},
{true, 0, 1000000000000000000},
{true, 19, 9999999999999999999},
{true, 0, 7},
{true, 0, 3},
{true, 0, 2},
{false, 19, 9999999999999999999},

// negative
{true, 0, 1},
{true, 18, 1000000000000000001},
{true, 19, 3},
{true, 19, 2},
{true, 0, 3},
{true, 0, 9999999999999999999},
{true, 19, 1},
{true, 19, 3},
{true, 19, 9999999999999999999},
}

func FuzzParse(f *testing.F) {
Expand Down

0 comments on commit a72a490

Please sign in to comment.