Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Commit

Permalink
Chapter 3 - Adding a Card enum
Browse files Browse the repository at this point in the history
  • Loading branch information
alblue committed Jan 4, 2016
1 parent b5922f7 commit a1c01ce
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions SingleView/CardsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,21 @@ class CardsTest:XCTestCase {
XCTAssertEqual(Rank.Two.rawValue,2,"Rank.Two.rawValue == 2")
XCTAssertEqual(Rank(rawValue: 14)!,Rank.Ace,"Rank(rawValue:14)! == Rank.Ace")
}
func testCard() {
let aceOfSpades:Card = .Face(.Ace,.Spades)
let theJoker:Card = .Joker

var jokerSeen = false;
var aceOfSpadesSeen = false;

for card in [aceOfSpades,theJoker] {
switch(card) {
case .Face(.Ace,.Spades): aceOfSpadesSeen = true
case .Face(let rank, let suit): XCTFail("Saw a card \(rank) of \(suit)")
case .Joker: jokerSeen = true
}
}
XCTAssert(jokerSeen)
XCTAssert(aceOfSpadesSeen)
}
}

0 comments on commit a1c01ce

Please sign in to comment.