Add tests with negative numbers
This commit is contained in:
parent
5bb2c9c8b8
commit
1ea3590fd6
@ -25,6 +25,14 @@ func TestMarshalJSON(t *testing.T) {
|
|||||||
{numeric.MustParse("0.01"), "0.01"},
|
{numeric.MustParse("0.01"), "0.01"},
|
||||||
{numeric.MustParse("0.001"), "0.001"},
|
{numeric.MustParse("0.001"), "0.001"},
|
||||||
{numeric.MustParse("0.0001"), "0.0001"},
|
{numeric.MustParse("0.0001"), "0.0001"},
|
||||||
|
{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("123456789.12345"), "123456789.12345"},
|
||||||
{numeric.MustParse("-1.23"), "-1.23"},
|
{numeric.MustParse("-1.23"), "-1.23"},
|
||||||
@ -67,6 +75,14 @@ func TestParse(t *testing.T) {
|
|||||||
{numeric.FromInt64WithExp(1, -2), `0.01`},
|
{numeric.FromInt64WithExp(1, -2), `0.01`},
|
||||||
{numeric.FromInt64WithExp(1, -3), `0.001`},
|
{numeric.FromInt64WithExp(1, -3), `0.001`},
|
||||||
{numeric.FromInt64WithExp(1, -4), `0.0001`},
|
{numeric.FromInt64WithExp(1, -4), `0.0001`},
|
||||||
|
{numeric.FromInt64WithExp(-1, 0), `-1`},
|
||||||
|
{numeric.FromInt64WithExp(-1, 1), `-10`},
|
||||||
|
{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