test: Added test cases for precisionMultiplier (#14576)
Co-authored-by: Hyunwoo Lee <denver@Hyunwoos-MacBook-Pro-2.local> Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
parent
67e71980fd
commit
a10ada1ae1
@ -17,9 +17,35 @@ func TestDecimalInternalTestSuite(t *testing.T) {
|
||||
}
|
||||
|
||||
func (s *decimalInternalTestSuite) TestPrecisionMultiplier() {
|
||||
res := precisionMultiplier(5)
|
||||
exp := big.NewInt(10000000000000)
|
||||
s.Require().Equal(0, res.Cmp(exp), "equality was incorrect, res %v, exp %v", res, exp)
|
||||
tests := []struct {
|
||||
prec int64
|
||||
exp *big.Int
|
||||
}{
|
||||
{
|
||||
5,
|
||||
big.NewInt(10000000000000),
|
||||
},
|
||||
{
|
||||
8,
|
||||
big.NewInt(10000000000),
|
||||
},
|
||||
{
|
||||
11,
|
||||
big.NewInt(10000000),
|
||||
},
|
||||
{
|
||||
15,
|
||||
big.NewInt(1000),
|
||||
},
|
||||
{
|
||||
18,
|
||||
big.NewInt(1),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
res := precisionMultiplier(tt.prec)
|
||||
s.Require().Equal(0, res.Cmp(tt.exp), "equality was incorrect, res %v, exp %v", res, tt.exp)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *decimalInternalTestSuite) TestZeroDeserializationJSON() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user