Cotton code
20 lines · 1.2 KB · SwiftRaw
// The Rolodex's turn window (feaf5fb4d0) was filled when the shown card or// the wheel's card changed, never when a neighbour's record did: a sync that// renamed the next person left the old name on the leaf the wheel turned// up. The deck now refills it from the records this span names.import XCTest@testable import CottonUIfinal class DeckTurnWindowTests: XCTestCase {    /// RULE: the window is the four cards either side of where the wheel stands, inside the deck, and none for a card the deck does not hold.    func testTheWindowIsFourEitherSideOfTheWheelInsideTheDeck() {        XCTAssertEqual(DeckTurnWindow.span(count: 20, at: 10, travel: 0), 6...14)        XCTAssertEqual(DeckTurnWindow.span(count: 20, at: 10, travel: 3), 9...17)        XCTAssertEqual(DeckTurnWindow.span(count: 20, at: 1, travel: -1), 0...4)        XCTAssertEqual(DeckTurnWindow.span(count: 20, at: 18, travel: 5), 15...19, "a wheel past the end stands on the last card")        XCTAssertEqual(DeckTurnWindow.span(count: 1, at: 0, travel: 0), 0...0)        XCTAssertNil(DeckTurnWindow.span(count: 3, at: 3, travel: 0))        XCTAssertNil(DeckTurnWindow.span(count: 0, at: 0, travel: 0))    }}