Skip to content

Commit af07f36

Browse files
committed
size_test: add tests for 0.3 + suffix
Such sizes are quite valid but were never tested. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent 519db1e commit af07f36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

size_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func TestFromHumanSize(t *testing.T) {
9898
assertSuccessEquals(t, 32.5*KB, FromHumanSize, "32.5kB")
9999
assertSuccessEquals(t, 32.5*KB, FromHumanSize, "32.5 kB")
100100
assertSuccessEquals(t, 32, FromHumanSize, "32.5 B")
101+
assertSuccessEquals(t, 300, FromHumanSize, "0.3 K")
101102

102103
assertError(t, FromHumanSize, "")
103104
assertError(t, FromHumanSize, "hello")
@@ -128,6 +129,8 @@ func TestRAMInBytes(t *testing.T) {
128129
assertSuccessEquals(t, 32, RAMInBytes, "32.3")
129130
tmp := 32.3 * MiB
130131
assertSuccessEquals(t, int64(tmp), RAMInBytes, "32.3 mb")
132+
tmp = 0.3 * MiB
133+
assertSuccessEquals(t, int64(tmp), RAMInBytes, "0.3MB")
131134

132135
assertError(t, RAMInBytes, "")
133136
assertError(t, RAMInBytes, "hello")

0 commit comments

Comments
 (0)