import XCTest import CoreGraphics @testable import NetworkCityCore final class LatencyLayoutTests: XCTestCase { func testZeroRTTSitsAtInnerRadius() { XCTAssertEqual(LatencyLayout.radius(forRTT: 0), LatencyLayout.minRadius, accuracy: 0.001) } func testCeilingSitsAtOuterEdge() { XCTAssertEqual(LatencyLayout.radius(forRTT: 250), LatencyLayout.maxRadius, accuracy: 0.001) } func testClampsBeyondCeiling() { XCTAssertEqual(LatencyLayout.radius(forRTT: 5000), LatencyLayout.maxRadius, accuracy: 0.001) } func testMonotonicAndWithinBounds() { var last = LatencyLayout.radius(forRTT: 0) for rtt in stride(from: 5.0, through: 250.0, by: 5) { let r = LatencyLayout.radius(forRTT: rtt) XCTAssertGreaterThan(r, last) // farther RTT -> farther out XCTAssertLessThanOrEqual(r, LatencyLayout.maxRadius) last = r } } func testNearRangeSpreadsOut() { // The log curve should give the 1–50ms band real separation, not a clump. let r10 = LatencyLayout.radius(forRTT: 10) let r50 = LatencyLayout.radius(forRTT: 50) XCTAssertGreaterThan(r50 - r10, 40) // meaningfully far apart on screen } }