Created
December 18, 2009 21:12
-
-
Save aherrman/259765 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By hand: | |
def test_valid_suit_transition_clubs_diamonds | |
c1 = Card.get 10, :clubs | |
c2 = Card.get 9, :diamonds | |
assert SolitaireStack.are_cards_sequential?(c1, c2) | |
end | |
def test_valid_suit_transition_clubs_hearts | |
c1 = Card.get 10, :clubs | |
c2 = Card.get 9, :hearts | |
assert SolitaireStack.are_cards_sequential?(c1, c2) | |
end | |
# ... continue for each possible pair | |
# Automagic: | |
SST.valid_trans.each { |key, value| | |
value.each { |v| | |
s = "" | |
s << " def test_valid_suit_transition_#{key}_#{v}\n" | |
s << " c1 = Card.get 10, :#{key}\n" | |
s << " c2 = Card.get 9, :#{v}\n" | |
s << " assert SolitaireStack.are_cards_sequential?(c1, c2)\n" | |
s << " end\n" | |
eval(s) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment