Skip to content
Snippets Groups Projects
Commit 3d8c3346 authored by Xu Cheng's avatar Xu Cheng
Browse files

test_utils: add test_disk_usage_readable and test_number_readable

parent d043b9d4
No related branches found
No related tags found
No related merge requests found
......@@ -62,4 +62,19 @@ class UtilTests < Homebrew::TestCase
assert_equal "s", plural(42)
assert_equal "", plural(42, "")
end
def test_disk_usage_readable
assert_equal "1B", disk_usage_readable(1)
assert_equal "1000B", disk_usage_readable(1000)
assert_equal "1K", disk_usage_readable(1024)
assert_equal "1K", disk_usage_readable(1025)
assert_equal "4.2M", disk_usage_readable(4_404_020)
assert_equal "4.2G", disk_usage_readable(4_509_715_660)
end
def test_number_readable
assert_equal "1", number_readable(1)
assert_equal "1,000", number_readable(1_000)
assert_equal "1,000,000", number_readable(1_000_000)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment