Skip to content

Instantly share code, notes, and snippets.

@aherrman
Created December 18, 2009 21:12
Show Gist options
  • Save aherrman/259765 to your computer and use it in GitHub Desktop.
Save aherrman/259765 to your computer and use it in GitHub Desktop.
# 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