コード例 #1
0
 def test_scoreLetter(self):
     scorer = NameScorer()
     self.assertEqual(1, scorer.scoreLetter("A"))
     self.assertEqual(26, scorer.scoreLetter("Z"))
コード例 #2
0
    def test_scoreFile(self):
        filePath = "data/names.txt"
        expectedScore = 871198282

        scorer = NameScorer()
        self.assertEqual(expectedScore, scorer.scoreFile(filePath))
コード例 #3
0
    def test_scoreName_hannah(self):
        name = "hannah"
        expectedScore = 8 + 1 + 14 + 14 + 1 + 8

        scorer = NameScorer()
        self.assertEqual(expectedScore, scorer.scoreName(name))
コード例 #4
0
    def test_scoreList(self):
        names = ["kyle", "hannah"]
        expectedScore = (46 * 1) + (53 * 2)

        scorer = NameScorer()
        self.assertEqual(expectedScore, scorer.scoreList(names))
コード例 #5
0
    def test_scoreName_kyle(self):
        name = "kyle"
        expectedScore = 11 + 25 + 12 + 5

        scorer = NameScorer()
        self.assertEqual(expectedScore, scorer.scoreName(name))