diff options
author | 2024-02-27 20:40:43 +0100 | |
---|---|---|
committer | 2024-02-28 19:32:38 -0800 | |
commit | f274394f0e8406c85360b1722136d27a7b82e94a (patch) | |
tree | f1d91452ab29daac6d4972d1dda01a58990fb175 /internal/template/functions_test.go | |
parent | 9a4a942cc44223126c084952938aead01d95b68e (diff) | |
download | v2-f274394f0e8406c85360b1722136d27a7b82e94a.tar.gz v2-f274394f0e8406c85360b1722136d27a7b82e94a.tar.zst v2-f274394f0e8406c85360b1722136d27a7b82e94a.zip |
Simplify formatFileSize
No need to use a loop with divisions and multiplications when we have logarithms.
Diffstat (limited to 'internal/template/functions_test.go')
-rw-r--r-- | internal/template/functions_test.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/template/functions_test.go b/internal/template/functions_test.go index 360d65ae..ddd18a60 100644 --- a/internal/template/functions_test.go +++ b/internal/template/functions_test.go @@ -156,6 +156,8 @@ func TestFormatFileSize(t *testing.T) { input int64 expected string }{ + {0, "0 B"}, + {1, "1 B"}, {500, "500 B"}, {1024, "1.0 KiB"}, {43520, "42.5 KiB"}, |