| 337 | |
| 338 | #[test] |
| 339 | fn test_to_string_as() { |
| 340 | assert_to_string("215 B", ByteSize::b(215), Format::Iec); |
| 341 | assert_to_string("215 B", ByteSize::b(215), Format::Si); |
| 342 | |
| 343 | assert_to_string("1.0 KiB", ByteSize::kib(1), Format::Iec); |
| 344 | assert_to_string("1.0 kB", ByteSize::kib(1), Format::Si); |
| 345 | |
| 346 | assert_to_string("293.9 KiB", ByteSize::kb(301), Format::Iec); |
| 347 | assert_to_string("301.0 kB", ByteSize::kb(301), Format::Si); |
| 348 | |
| 349 | assert_to_string("1.0 MiB", ByteSize::mib(1), Format::Iec); |
| 350 | assert_to_string("1.0 MB", ByteSize::mib(1), Format::Si); |
| 351 | |
| 352 | assert_to_string("1.9 GiB", ByteSize::mib(1907), Format::Iec); |
| 353 | assert_to_string("2.0 GB", ByteSize::mib(1908), Format::Si); |
| 354 | |
| 355 | assert_to_string("399.6 MiB", ByteSize::mb(419), Format::Iec); |
| 356 | assert_to_string("419.0 MB", ByteSize::mb(419), Format::Si); |
| 357 | |
| 358 | assert_to_string("482.4 GiB", ByteSize::gb(518), Format::Iec); |
| 359 | assert_to_string("518.0 GB", ByteSize::gb(518), Format::Si); |
| 360 | |
| 361 | assert_to_string("741.2 TiB", ByteSize::tb(815), Format::Iec); |
| 362 | assert_to_string("815.0 TB", ByteSize::tb(815), Format::Si); |
| 363 | |
| 364 | assert_to_string("540.9 PiB", ByteSize::pb(609), Format::Iec); |
| 365 | assert_to_string("609.0 PB", ByteSize::pb(609), Format::Si); |
| 366 | } |
| 367 | |
| 368 | #[test] |
| 369 | fn precision() { |