import CottonValues import XCTest @testable import CottonFaces /// The rolodex and the passport write a line's said words in the hand /// (`SaidRun`, CottonFaces' `Rolodex`). final class SaidRunTests: XCTestCase { /// A person's card writes a line's said words in the hand: the words are /// cut where the cards set's template put them, and a line not filled /// from that template is not cut at all. func testTheSaidWordsAreCutWhereTheTemplatePutThem() { XCTAssertEqual(SaidRun.cut("Last spoke 2 weeks ago on WhatsApp", by: "field.reached"), SaidRun(lead: "Last spoke ", said: "2 weeks ago", tail: " on WhatsApp")) XCTAssertEqual(SaidRun.cut("Birthday today", by: "corner.birthday"), SaidRun(lead: "Birthday ", said: "today", tail: "")) XCTAssertEqual(SaidRun.cut("Not reached in 8 months", by: "corner.not_reached")?.said, "8 months") XCTAssertNil(SaidRun.cut("Not reached in 8 months", by: "corner.birthday")) XCTAssertNil(SaidRun.cut("Last spoke on WhatsApp", by: "field.reached"), "no said words, no cut") } }