diff options
author | janbridley <bradleyjenj@gmail.com> | 2024-11-07 10:04:00 -0500 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2024-11-08 22:50:03 +0000 |
commit | 7c9e2f18338cbf290613ae1245e7d8f48f0ff0bd (patch) | |
tree | b860e7308473addc9fbf070d88436d88b43ddd0b | |
parent | 1d40ca087062bd1473138fa3be5708e6a8826340 (diff) |
Enable pretty format for petabyte data
-rw-r--r-- | src/display.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/display.rs b/src/display.rs index 84a026c..f429944 100644 --- a/src/display.rs +++ b/src/display.rs @@ -16,7 +16,7 @@ use std::iter::repeat; use std::path::Path; use thousands::Separable; -pub static UNITS: [char; 4] = ['T', 'G', 'M', 'K']; +pub static UNITS: [char; 5] = ['P', 'T', 'G', 'M', 'K']; static BLOCKS: [char; 5] = ['█', '▓', '▒', '░', ' ']; const FILETIME_SHOW_LENGTH: usize = 19; @@ -566,6 +566,8 @@ mod tests { assert_eq!(human_readable_number(1024 * 1024 * 1024 - 1, ""), "1023M"); assert_eq!(human_readable_number(1024 * 1024 * 1024 * 20, ""), "20G"); assert_eq!(human_readable_number(1024 * 1024 * 1024 * 1024, ""), "1.0T"); + assert_eq!(human_readable_number(1024 * 1024 * 1024 * 1024 * 234, ""), "234T"); + assert_eq!(human_readable_number(1024 * 1024 * 1024 * 1024 * 1024, ""), "1.0P"); } #[test] |