47 lines
1.0 KiB
Python
47 lines
1.0 KiB
Python
#!/usr/bin/python
|
|
|
|
import unittest
|
|
|
|
import dictionary
|
|
import solver
|
|
|
|
test_dictionary = dictionary.words()
|
|
|
|
|
|
class TestSolver(unittest.TestCase):
|
|
def test_SimilaritySolver(self):
|
|
"""Minimal end to end test."""
|
|
|
|
solve = solver.SimilaritySolver()
|
|
result = solve.scored_words(test_dictionary)
|
|
|
|
expected = [
|
|
("cares", 139631),
|
|
("sanes", 139129),
|
|
("tares", 138755),
|
|
("bares", 138375),
|
|
("sales", 137491),
|
|
]
|
|
|
|
self.assertListEqual(result[:5], expected)
|
|
|
|
def test_LimitsSolver(self):
|
|
"""Minimal end to end test."""
|
|
|
|
solve = solver.LimitsSolver()
|
|
result = solve.scored_words(test_dictionary)
|
|
|
|
expected = [
|
|
("aahed", 5),
|
|
("aalii", 5),
|
|
("aargh", 5),
|
|
("aaron", 5),
|
|
("abaca", 5),
|
|
]
|
|
|
|
self.assertListEqual(result[:5], expected)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|