mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Add more unit tests
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
This commit is contained in:
parent
79325b6178
commit
685ae02433
@ -106,6 +106,9 @@ func TestInt64AmountMul(t *testing.T) {
|
||||
{int64Amount{value: mostPositive, scale: -1}, 10, int64Amount{value: mostPositive, scale: -1}, false},
|
||||
{int64Amount{value: mostPositive, scale: -1}, 0, int64Amount{value: 0, scale: 0}, true},
|
||||
{int64Amount{value: mostPositive / 10, scale: 1}, 10, int64Amount{value: mostPositive / 10, scale: 1}, false},
|
||||
{int64Amount{value: mostPositive, scale: 0}, -1, int64Amount{value: -mostPositive, scale: 0}, true},
|
||||
{int64Amount{value: mostNegative, scale: 1}, 0, int64Amount{value: 0, scale: 0}, true},
|
||||
{int64Amount{value: mostNegative, scale: 1}, 1, int64Amount{value: mostNegative, scale: 1}, false},
|
||||
} {
|
||||
c := test.a
|
||||
ok := c.Mul(test.b)
|
||||
|
@ -1151,7 +1151,16 @@ func TestMul(t *testing.T) {
|
||||
{decQuantity(50, 0, DecimalSI), 0, decQuantity(0, 0, DecimalSI), true},
|
||||
{Quantity{Format: DecimalSI}, 0, decQuantity(0, 0, DecimalSI), true},
|
||||
|
||||
{decQuantity(10, 0, DecimalSI), -10, decQuantity(-100, 0, DecimalSI), true},
|
||||
{decQuantity(-10, 0, DecimalSI), 1, decQuantity(-10, 0, DecimalSI), true},
|
||||
{decQuantity(10, 0, BinarySI), -1, decQuantity(-10, 0, BinarySI), true},
|
||||
{decQuantity(-50, 0, DecimalSI), 0, decQuantity(0, 0, DecimalSI), true},
|
||||
{decQuantity(-50, 0, DecimalSI), -50, decQuantity(2500, 0, DecimalSI), true},
|
||||
{Quantity{Format: DecimalSI}, -50, decQuantity(0, 0, DecimalSI), true},
|
||||
|
||||
{decQuantity(mostPositive, 0, DecimalSI), 10, decQuantity(mostPositive, 1, DecimalSI), false},
|
||||
{decQuantity(mostNegative, 0, DecimalSI), 10, decQuantity(mostNegative, 1, DecimalSI), false},
|
||||
{decQuantity(mostPositive, 0, DecimalSI), -10, decQuantity(-mostPositive, 1, DecimalSI), false},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user