We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6b4137 commit cc4cdc4Copy full SHA for cc4cdc4
src/lib.rs
@@ -560,6 +560,16 @@ mod tests {
560
assert!(ByteSize::pib(1) < ByteSize::eb(1));
561
}
562
563
+ #[test]
564
+ fn test_conversion() {
565
+ assert_eq!(ByteSize::gb(43).as_kib(), 41992187.5_f64);
566
+ assert_eq!(ByteSize::mib(27).as_gb(), 0.028311552_f64);
567
+ assert_eq!(ByteSize::tib(39).as_pib(), 0.042880953483264_f64);
568
+ assert_eq!(ByteSize::kib(938948).as_mb(), 961.482752_f64);
569
+ assert_eq!(ByteSize::pb(4837).as_eib(), 4.195428726649908_f64);
570
+ assert_eq!(ByteSize::b(2873872874893).as_tib(), 2.613772153284117_f64);
571
+ }
572
+
573
#[track_caller]
574
fn assert_display(expected: &str, b: ByteSize) {
575
assert_eq!(expected, format!("{b}"));
0 commit comments