示例#1
0
 def testRightJack(self):
     hc = HandCalculator()
     score = hc.calculateScore([
         Card("Hearts", "4"),
         Card("Spade", "J"),
         Card("Club", "6"),
         Card("Club", "7")
     ], Card("Spade", "3"), False)
     self.assertEqual(1, score)
示例#2
0
 def testFlushKittyZero(self):
     hc = HandCalculator()
     score = hc.calculateScore([
         Card("Hearts", "2"),
         Card("Club", "4"),
         Card("Hearts", "6"),
         Card("Hearts", "8")
     ], Card("Hearts", "10"), True)
     self.assertEqual(0, score)
示例#3
0
 def testCalculateScore2(self):
     hc = HandCalculator()
     score = hc.calculateScore([
         Card("Hearts", "4"),
         Card("Hearts", "5"),
         Card("Hearts", "6"),
         Card("Hearts", "6")
     ], Card("Hearts", "6"), True)
     self.assertEqual(26, score)
示例#4
0
 def testFlushHandWithOutCut(self):
     hc = HandCalculator()
     score = hc.calculateScore([
         Card("Hearts", "2"),
         Card("Hearts", "4"),
         Card("Hearts", "6"),
         Card("Hearts", "8")
     ], Card("Club", "10"), False)
     self.assertEqual(4, score)
示例#5
0
 def testCalculateScore29Hand(self):
     hc = HandCalculator()
     score = hc.calculateScore([
         Card("Hearts", "J"),
         Card("Club", "5"),
         Card("Diamond", "5"),
         Card("Spade", "5")
     ], Card("Hearts", "5"), True)
     self.assertEqual(29, score)
示例#6
0
 def testCalculateScore1(self):
     hc = HandCalculator()
     score = hc.calculateScore([
         Card("Hearts", "7"),
         Card("Club", "8"),
         Card("Diamond", "8"),
         Card("Spade", "9")
     ], Card("Hearts", "6"), True)
     self.assertEqual(16, score)
示例#7
0
 def testFindRunsZeroTwoAdjacent(self):
     hcr = HandCalculator()
     score = hcr.calculateRunScore([
         Card("Hearts", "2"),
         Card("Club", "A"),
         Card("Hearts", "Q"),
         Card("Spade", "8"),
         Card("Hearts", "10")
     ])
     self.assertEqual(0, score)
示例#8
0
 def testFifteensAllFive(self):
     hc = HandCalculator()
     score = hc.calculateFifteensScore([
         Card("Hearts", "A"),
         Card("Club", "2"),
         Card("Spade", "3"),
         Card("Diamond", "4"),
         Card("Club", "5")
     ])
     self.assertEqual(2, score)
示例#9
0
 def testFifteensZero(self):
     hc = HandCalculator()
     score = hc.calculateFifteensScore([
         Card("Hearts", "2"),
         Card("Club", "2"),
         Card("Spade", "Q"),
         Card("Diamond", "4"),
         Card("Club", "Q")
     ])
     self.assertEqual(0, score)
示例#10
0
 def testZeroPair(self):
     hc = HandCalculator()
     score = hc.calculatePairScore([
         Card("Hearts", "A"),
         Card("Club", "2"),
         Card("Spade", "3"),
         Card("Diamond", "4"),
         Card("Club", "5")
     ])
     self.assertEqual(0, score)
示例#11
0
 def testFourOfAKind(self):
     hc = HandCalculator()
     score = hc.calculatePairScore([
         Card("Hearts", "A"),
         Card("Club", "2"),
         Card("Spade", "A"),
         Card("Diamond", "A"),
         Card("Club", "A")
     ])
     self.assertEqual(12, score)
示例#12
0
 def testDoubleDoubleRun(self):
     hcr = HandCalculator()
     score = hcr.calculateRunScore([
         Card("Hearts", "A"),
         Card("Club", "2"),
         Card("Spade", "A"),
         Card("Diamond", "3"),
         Card("Club", "3")
     ])
     self.assertEqual(12, score)
示例#13
0
 def testRunofFive(self):
     hcr = HandCalculator()
     score = hcr.calculateRunScore([
         Card("Hearts", "A"),
         Card("Club", "2"),
         Card("Spade", "5"),
         Card("Diamond", "3"),
         Card("Club", "4")
     ])
     self.assertEqual(5, score)
示例#14
0
 def testFindRunsThree(self):
     hcr = HandCalculator()
     score = hcr.calculateRunScore([
         Card("Hearts", "2"),
         Card("Club", "4"),
         Card("Hearts", "3"),
         Card("Spade", "8"),
         Card("Hearts", "10")
     ])
     self.assertEqual(3, score)