Add more unittests for numeric
This commit is contained in:
parent
9ed4df7053
commit
4f72351ee9
@ -17,6 +17,15 @@ func TestMarshalJSON(t *testing.T) {
|
|||||||
{numeric.Zero(), `0`},
|
{numeric.Zero(), `0`},
|
||||||
{numeric.MustParse("1.23"), "1.23"},
|
{numeric.MustParse("1.23"), "1.23"},
|
||||||
{numeric.MustParse("1,24"), "1.24"},
|
{numeric.MustParse("1,24"), "1.24"},
|
||||||
|
{numeric.MustParse("1"), "1"},
|
||||||
|
{numeric.MustParse("10"), "10"},
|
||||||
|
{numeric.MustParse("100"), "100"},
|
||||||
|
{numeric.MustParse("1000"), "1000"},
|
||||||
|
{numeric.MustParse("0.1"), "0.1"},
|
||||||
|
{numeric.MustParse("0.01"), "0.01"},
|
||||||
|
{numeric.MustParse("0.001"), "0.001"},
|
||||||
|
{numeric.MustParse("0.0001"), "0.0001"},
|
||||||
|
{numeric.MustParse("123456789.12345"), "123456789.12345"},
|
||||||
{numeric.MustParse("123456789.12345"), "123456789.12345"},
|
{numeric.MustParse("123456789.12345"), "123456789.12345"},
|
||||||
{numeric.MustParse("-1.23"), "-1.23"},
|
{numeric.MustParse("-1.23"), "-1.23"},
|
||||||
{numeric.MustParse("-1,24"), "-1.24"},
|
{numeric.MustParse("-1,24"), "-1.24"},
|
||||||
@ -53,6 +62,11 @@ func TestParse(t *testing.T) {
|
|||||||
{numeric.FromInt64WithExp(1, 0), `1`},
|
{numeric.FromInt64WithExp(1, 0), `1`},
|
||||||
{numeric.FromInt64WithExp(1, 1), `10`},
|
{numeric.FromInt64WithExp(1, 1), `10`},
|
||||||
{numeric.FromInt64WithExp(1, 2), `100`},
|
{numeric.FromInt64WithExp(1, 2), `100`},
|
||||||
|
{numeric.FromInt64WithExp(1, 3), `1000`},
|
||||||
|
{numeric.FromInt64WithExp(1, -1), `0.1`},
|
||||||
|
{numeric.FromInt64WithExp(1, -2), `0.01`},
|
||||||
|
{numeric.FromInt64WithExp(1, -3), `0.001`},
|
||||||
|
{numeric.FromInt64WithExp(1, -4), `0.0001`},
|
||||||
{numeric.FromInt64WithExp(123, -2), "1.23"},
|
{numeric.FromInt64WithExp(123, -2), "1.23"},
|
||||||
{numeric.FromInt64WithExp(124, -2), "1,24"},
|
{numeric.FromInt64WithExp(124, -2), "1,24"},
|
||||||
{numeric.FromInt64WithExp(12345678912345, -5), "123456789.12345"},
|
{numeric.FromInt64WithExp(12345678912345, -5), "123456789.12345"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user