Skip to content

Commit

Permalink
test cleanup 🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
CTC97 committed Nov 15, 2024
1 parent 4b41c29 commit ef19e52
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions spec/std/humanize_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,13 @@ describe Number do
it { assert_prints 1.0e+34.humanize, "10,000Q" }
it { assert_prints 1.0e+35.humanize, "100,000Q" }

it { assert_prints 0.humanize(unit_separator: "_"), "0.0" }
it { assert_prints 0.123_456_78.humanize(5, unit_separator: "\u00A0"), "123.46\u00A0m" }
it { assert_prints 1.0e-14.humanize(unit_separator: " "), "10.0 f" }
it { assert_prints 1.0e+9.humanize(unit_separator: "\t"), "1.0\tG" }
it { assert_prints 1.0e+35.humanize(unit_separator: "-"), "100,000-Q" }
it { assert_prints 0.000_001.humanize(unit_separator: "\u2009"), "1.0\u2009µ" }
it { assert_prints 0.humanize(unit_separator: '_'), "0.0" }
it { assert_prints 0.123_456_78.humanize(5, unit_separator: '\u00A0'), "123.46\u00A0m" }
it { assert_prints 1.0e-14.humanize(unit_separator: ' '), "10.0 f" }
it { assert_prints 0.000_001.humanize(unit_separator: '\u2009'), "1.0\u2009µ" }
it { assert_prints 0.000_000_001.humanize(unit_separator: "."), "1.0.n" }
it { assert_prints 1_000_000_000_000.humanize(unit_separator: "__"), "1.0__T" }
it { assert_prints 123_456_789_012.humanize(unit_separator: ","), "123,G" }
it { assert_prints 123_456_789_012.humanize(unit_separator: '-'), "123-G" }
it { assert_prints 0.000_000_001.humanize(unit_separator: "."), "1.0.n" }
it { assert_prints 1.0e+9.humanize(unit_separator: "\t"), "1.0\tG" }
it { assert_prints 123_456_789_012.humanize(unit_separator: 0), "1230G" }
it { assert_prints 123_456_789_012.humanize(unit_separator: nil), "123G" }

Expand Down Expand Up @@ -275,7 +271,7 @@ describe Number do
it { assert_prints 1.0e+8.humanize(prefixes: CUSTOM_PREFIXES), "100d" }
it { assert_prints 1.0e+9.humanize(prefixes: CUSTOM_PREFIXES), "1,000d" }
it { assert_prints 1.0e+10.humanize(prefixes: CUSTOM_PREFIXES), "10,000d" }
it { assert_prints 1.0e+10.humanize(prefixes: CUSTOM_PREFIXES, unit_separator: "\u00A0"), "10,000\u00A0d" }
it { assert_prints 1.0e+10.humanize(prefixes: CUSTOM_PREFIXES, unit_separator: '\u00A0'), "10,000\u00A0d" }
end
end
end
Expand All @@ -296,7 +292,7 @@ describe Int do
it { assert_prints 1025.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "1.0KB" }
it { assert_prints 1026.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "1.01KB" }
it { assert_prints 2048.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "2.0KB" }
it { assert_prints 2048.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC, unit_separator: "\u202F"), "2.0\u202FKB" }
it { assert_prints 2048.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC, unit_separator: '\u202F'), "2.0\u202FKB" }

it { assert_prints 1536.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "1.5KB" }
it { assert_prints 524288.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "512KB" }
Expand All @@ -305,7 +301,7 @@ describe Int do
it { assert_prints 1099511627776.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "1.0TB" }
it { assert_prints 1125899906842624.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "1.0PB" }
it { assert_prints 1152921504606846976.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC), "1.0EB" }
it { assert_prints 1152921504606846976.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC, unit_separator: "\u2009"), "1.0\u2009EB" }
it { assert_prints 1152921504606846976.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC, unit_separator: '\u2009'), "1.0\u2009EB" }

it { assert_prints 1024.humanize_bytes(format: Int::BinaryPrefixFormat::IEC), "1.0kiB" }
it { assert_prints 1073741824.humanize_bytes(format: Int::BinaryPrefixFormat::IEC), "1.0GiB" }
Expand Down

0 comments on commit ef19e52

Please sign in to comment.