Parcourir la source

Add test for Scale() (#227)

38elements il y a 7 ans
Parent
révision
cbc9b99bae
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3
    0
      internal/measurement/measurement_test.go

+ 3
- 0
internal/measurement/measurement_test.go Voir le fichier

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