Cotton code
21 lines · 921 B · SwiftRaw
@testable import CottonUIimport XCTest/// RULE: no figure iOS gives for the time left in the back ever traps — the/// owner's phone crashed on build 269 converting `DBL_MAX` to milliseconds/// (`SyncHold.begin`, 13 Oct 2026). A figure that is no time box (infinite,/// NaN, or above anything iOS grants in the back) answers nil; a real one/// answers a little under it.final class SyncHoldBudgetTests: XCTestCase {    func testNoFigureIOSGivesTraps() {        for left in [Double.infinity, -Double.infinity, Double.nan, Double.greatestFiniteMagnitude, 181] {            XCTAssertNil(SyncHoldBudget.milliseconds(left: left), "\(left)")        }    }    func testARealFigureIsBoxedALittleUnderIt() {        XCTAssertEqual(SyncHoldBudget.milliseconds(left: 30), 28_000)        XCTAssertEqual(SyncHoldBudget.milliseconds(left: 1), 0)        XCTAssertEqual(SyncHoldBudget.milliseconds(left: 0), 0)    }}