Fix precision handling in validating LimitRange

This commit is contained in:
derekwaynecarr
2015-09-08 14:49:54 -04:00
parent 61a66a95a6
commit ea919f6d1e
4 changed files with 182 additions and 175 deletions

View File

@@ -77,6 +77,26 @@ func TestQuantityCanocicalizeZero(t *testing.T) {
}
}
func TestQuantityCmp(t *testing.T) {
table := []struct {
x string
y string
expect int
}{
{"0", "0", 0},
{"100m", "50m", 1},
{"50m", "100m", -1},
{"10000T", "100Gi", 1},
}
for _, testCase := range table {
q1 := MustParse(testCase.x)
q2 := MustParse(testCase.y)
if result := q1.Cmp(q2); result != testCase.expect {
t.Errorf("X: %v, Y: %v, Expected: %v, Actual: %v", testCase.x, testCase.y, testCase.expect, result)
}
}
}
func TestQuantityParse(t *testing.T) {
table := []struct {
input string