Bladeren bron

Add test for Scale() (#227)

38elements 7 jaren geleden
bovenliggende
commit
cbc9b99bae
1 gewijzigde bestanden met toevoegingen van 3 en 0 verwijderingen
  1. 3
    0
      internal/measurement/measurement_test.go

+ 3
- 0
internal/measurement/measurement_test.go Bestand weergeven

@@ -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)",