use crate::prelude::*;
#[quantity]
#[ref_unit(Byte, "B", NONE, "Reference unit of quantity `DataVolume`")]
#[unit(Bit, "b", 0.125, "0.125·B")]
#[unit(Kilobit, "kb", 125, "1000·b")]
#[unit(Kibibit, "Kib", 128, "1024·b")]
#[unit(Kilobyte, "kB", KILO, 1000, "1000·B")]
#[unit(Kibibyte, "KiB", 1024, "1024·B")]
#[unit(Megabit, "Mb", 125000, "1000000·b")]
#[unit(Mebibit, "Mib", 131072, "1048576·b")]
#[unit(Megabyte, "MB", MEGA, 1000000, "1000000·B")]
#[unit(Mebibyte, "MiB", 1048576, "1048576·B")]
#[unit(Gigabit, "Gb", 125000000, "1000000000·b")]
#[unit(Gibibit, "Gib", 134217728, "1073741824·b")]
#[unit(Gigabyte, "GB", GIGA, 1000000000, "1000000000·B")]
#[unit(Gibibyte, "GiB", 1073741824, "1073741824·B")]
#[unit(Terabit, "Tb", 125000000000., "1000000000000·b")]
#[unit(Tebibit, "Tib", 137438953472., "1099511627776·b")]
#[unit(Terabyte, "TB", TERA, 1000000000000., "1000000000000·B")]
#[unit(Tebibyte, "TiB", 1099511627776., "1099511627776·B")]
pub struct DataVolume {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_datavolume() {
let amnt: AmountT = Amnt!(375);
let d = amnt * GIBIBYTE;
assert_eq!(d.amount, amnt);
assert_eq!(d.unit, GIBIBYTE);
#[cfg(feature = "std")]
assert_eq!(d.to_string(), "375 GiB");
let d = d.convert(TERABYTE);
assert_eq!(d.unit, TERABYTE);
assert_eq!(d.amount, Amnt!(0.402653184));
let d = d.convert(KIBIBYTE);
assert_eq!(d.unit, KIBIBYTE);
assert_eq!(d.amount, Amnt!(393216000));
}
}