Add negative testcases
This commit is contained in:
parent
f445f19233
commit
253ecd1720
@ -17,6 +17,9 @@ func TestMarshalJSON(t *testing.T) {
|
||||
{numeric.MustParse("1.23"), "1.23"},
|
||||
{numeric.MustParse("1,24"), "1.24"},
|
||||
{numeric.MustParse("123456789.12345"), "123456789.12345"},
|
||||
{numeric.MustParse("-1.23"), "-1.23"},
|
||||
{numeric.MustParse("-1,24"), "-1.24"},
|
||||
{numeric.MustParse("-123456789.12345"), "-123456789.12345"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.Result, func(t *testing.T) {
|
||||
@ -49,6 +52,13 @@ func TestParse(t *testing.T) {
|
||||
{numeric.FromInt64WithExp(123, -2), "1.23"},
|
||||
{numeric.FromInt64WithExp(124, -2), "1,24"},
|
||||
{numeric.FromInt64WithExp(12345678912345, -5), "123456789.12345"},
|
||||
{numeric.FromInt64WithExp(0, 0), `-0`},
|
||||
{numeric.FromInt64WithExp(-1, 0), `-1`},
|
||||
{numeric.FromInt64WithExp(-1, 1), `-10`},
|
||||
{numeric.FromInt64WithExp(-1, 2), `-100`},
|
||||
{numeric.FromInt64WithExp(-123, -2), "-1.23"},
|
||||
{numeric.FromInt64WithExp(-124, -2), "-1,24"},
|
||||
{numeric.FromInt64WithExp(-12345678912345, -5), "-123456789.12345"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.Value, func(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user