|
@@ -35,6 +35,9 @@ func TestScale(t *testing.T) {
|
35
|
35
|
{1024, "tb", "pb", 1, "PB"},
|
36
|
36
|
{2048, "mb", "auto", 2, "GB"},
|
37
|
37
|
{3.1536e7, "s", "auto", 1, "yrs"},
|
|
38
|
+ {-1, "s", "ms", -1000, "ms"},
|
|
39
|
+ {1, "foo", "count", 1, ""},
|
|
40
|
+ {1, "foo", "bar", 1, "bar"},
|
38
|
41
|
} {
|
39
|
42
|
if gotValue, gotUnit := Scale(tc.value, tc.fromUnit, tc.toUnit); gotValue != tc.wantValue || gotUnit != tc.wantUnit {
|
40
|
43
|
t.Errorf("Scale(%d, %q, %q) = (%f, %q), want (%f, %q)",
|