clean up of the codebase

This commit is contained in:
ari committed 2026-11-01 13:01:54 -05:00
1 parent 7822529a38
commit 0ac61b4ece
52 files changed
+2545 -2274

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
package units
import "testing"
func TestSizes(t *testing.T) {
for in, want := range map[string]int64{"5G": 5120, "500M": 500, "1.5gb": 1536, "1T": 1048576, "20 GB": 20480} {
if got, err := ParseSizeMB(in); err != nil || got != want {
t.Fatalf("ParseSizeMB(%q) = %d, %v; want %d", in, got, err, want)
}
}
if _, err := ParseSizeMB("+5G"); err == nil {
t.Fatal("a signed size isn't a config size")
}
for mb, want := range map[int64]string{512: "512 MB", 5120: "5 GB", 2560: "2.5 GB", 1258291: "1.2 TB"} {
if got := FormatMB(mb); got != want {
t.Fatalf("FormatMB(%d) = %q, want %q", mb, got, want)
}
}
}