// Media duration and size labels. Storage carries measured zero separately// from an unknown size; inventory and keep-rule planning live in Rust.importCottonKitimport XCTest@testable importCottonUI// MARK: - A size, said the way the app says itfinalclassMediaBytesTests: XCTestCase {func testSaysNothingRatherThanZeroForARowWhoseSizeWasNeverRecorded() {// Every caller writes `?? nothing`: a row that states "0 B" claims the// file is empty, which is a different fact from "nobody wrote a size". XCTAssertNil(MediaBytes.sizeLabel(nil)) XCTAssertNil(MediaBytes.sizeLabel(0)) XCTAssertNil(MediaBytes.sizeLabel(-4)) }func testClimbsThroughBytesKilobytesAndMegabytes() { XCTAssertEqual(MediaBytes.sizeLabel(812), "812 B") XCTAssertEqual(MediaBytes.sizeLabel(45_056), "44 KB") XCTAssertEqual(MediaBytes.sizeLabel(3_355_443), "3.2 MB") XCTAssertEqual(MediaBytes.sizeLabel(432_013_312), "412 MB")// **A GIGABYTE RUNG.** Release assets are where one appears — this// repository's nightly database backups are 2.36 GB each — and// `2418 MB` is a figure a person divides in their head first. The rung// starts at 1024 MB, so nothing under a gigabyte moves. XCTAssertEqual(MediaBytes.sizeLabel(1_000_000_000), "954 MB")// The rung is crossed where the LABEL would read `1024 MB`, never at// the arithmetic: a byte short of a gigabyte is `1.0 GB`, not `1024 MB`. XCTAssertEqual(MediaBytes.sizeLabel(1_073_741_823), "1.0 GB") XCTAssertEqual(MediaBytes.sizeLabel(1_073_741_824), "1.0 GB") XCTAssertEqual(MediaBytes.sizeLabel(2_533_359_206), "2.4 GB") XCTAssertEqual(MediaBytes.sizeLabel(12_884_901_888), "12 GB") }}