Skip to content

Commit

Permalink
test(math): fix FormatDec test (#15215)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Feb 28, 2023
1 parent 17ba80d commit 1273c05
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion math/dec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func BenchmarkLegacyQuoRoundupMut(b *testing.B) {
func TestFormatDec(t *testing.T) {
type decimalTest []string
var testcases []decimalTest
raw, err := os.ReadFile("../x/tx/textual/internal/testdata/decimals.json")
raw, err := os.ReadFile("./testdata/decimals.json")
require.NoError(t, err)
err = json.Unmarshal(raw, &testcases)
require.NoError(t, err)
Expand Down
47 changes: 47 additions & 0 deletions math/testdata/decimals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[
["0", "0"],
["1", "1"],
["12", "12"],
["123", "123"],
["1234", "1'234"],
["0.1", "0.1"],
["0.01", "0.01"],
["0.001", "0.001"],
["0.0001", "0.0001"],
["0.00001", "0.00001"],
["0.000001", "0.000001"],
["0.0000001", "0.0000001"],
["0.00000001", "0.00000001"],
["0.000000001", "0.000000001"],
["0.0000000001", "0.0000000001"],
["0.00000000001", "0.00000000001"],
["0.000000000001", "0.000000000001"],
["0.0000000000001", "0.0000000000001"],
["0.00000000000001", "0.00000000000001"],
["0.000000000000001", "0.000000000000001"],
["0.0000000000000001", "0.0000000000000001"],
["0.00000000000000001", "0.00000000000000001"],
["0.000000000000000001", "0.000000000000000001"],
["0.100000000000000000", "0.1"],
["0.010000000000000000", "0.01"],
["0.001000000000000000", "0.001"],
["0.000100000000000000", "0.0001"],
["0.000010000000000000", "0.00001"],
["0.000001000000000000", "0.000001"],
["0.000000100000000000", "0.0000001"],
["0.000000010000000000", "0.00000001"],
["0.000000001000000000", "0.000000001"],
["0.000000000100000000", "0.0000000001"],
["0.000000000010000000", "0.00000000001"],
["0.000000000001000000", "0.000000000001"],
["0.000000000000100000", "0.0000000000001"],
["0.000000000000010000", "0.00000000000001"],
["0.000000000000001000", "0.000000000000001"],
["0.000000000000000100", "0.0000000000000001"],
["0.000000000000000010", "0.00000000000000001"],
["0.000000000000000001", "0.000000000000000001"],
["-10.0", "-10"],
["-10000", "-10'000"],
["-9999", "-9'999"],
["-999999999999", "-999'999'999'999"]
]

0 comments on commit 1273c05

Please sign in to comment.