Once again, we need a problem to showcase TDD in action. Since I like to practice development practices using games, I went through the list from Coding Dojo Katas (http://codingdojo.org/kata/PokerHands/) and I picked the poker hands problem for this exercise.
Example – designing a pure function using TDD
The poker hands problem
A description of the problem is as follows—given two or more hands of poker, we need to compare them and return the one that has the higher rank and why it wins.
Each hand has five cards, and the cards are picked from a normal 52-card deck. The deck is formed of four suits—clubs, diamonds, hearts, and spades. Each suit starts with a 2 and ends with an ace, and is denoted as follows...