diff --git a/math/dec_test.go b/math/dec_test.go index ae897c3ba8cd..bf7d73492088 100644 --- a/math/dec_test.go +++ b/math/dec_test.go @@ -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) diff --git a/math/testdata/decimals.json b/math/testdata/decimals.json new file mode 100644 index 000000000000..3564b597d92b --- /dev/null +++ b/math/testdata/decimals.json @@ -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"] +]