Improve quota describe output

This commit is contained in:
derekwaynecarr
2015-06-01 23:29:23 -04:00
parent 1845ca88fc
commit 6968a4e0df
3 changed files with 60 additions and 1 deletions

View File

@@ -57,6 +57,26 @@ func TestDec(t *testing.T) {
}
}
// TestQuantityParseZero ensures that when a 0 quantity is passed, its string value is 0
func TestQuantityParseZero(t *testing.T) {
zero := MustParse("0")
if expected, actual := "0", zero.String(); expected != actual {
t.Errorf("Expected %v, actual %v", expected, actual)
}
}
// Verifies that you get 0 as canonical value if internal value is 0, and not 0<suffix>
func TestQuantityCanocicalizeZero(t *testing.T) {
val := MustParse("1000m")
x := val.Amount
y := dec(1, 0)
z := val.Amount.Sub(x, y)
zero := Quantity{z, DecimalSI}
if expected, actual := "0", zero.String(); expected != actual {
t.Errorf("Expected %v, actual %v", expected, actual)
}
}
func TestQuantityParse(t *testing.T) {
table := []struct {
input string