Example #1
0
 def test_same(self):
     # checks if number of alphabets are same in item and target against the given value. In this case it is 3.
     self.assertTrue(word_ladder.same("fine", "mine") == 3)
     # in this case, "this" and "nice" have no alphabets in common at same place.
     self.assertTrue(word_ladder.same("this", "nice") == 0)
     # Checks the number of common alphabets in item and target against the given value. In this case it is 3.
     self.assertEqual(word_ladder.same("lead", "mead"), 3)
Example #2
0
 def test_IDDFSValid2(self):
     start = "hell"
     target = "gold"
     words = ['coal', 'down', 'goad', 'sole', 'foal', 'load', 'loan', 'moan', 'seek']
     seen = {"hell": True}
     path = [start]
     min = len(start) - word_ladder.same(start, target)
     max = len(start) + min
     self.assertFalse(word_ladder.IDDFS(start, target, seen, words, path, min, max))
 def test_same(self):
     #test to see if program counts the right amount of same letters
     self.assertEqual(word_ladder.same("hell", "help"), 3)
     self.assertEqual(word_ladder.same("hide", "seek"), 0)
     self.assertEqual(word_ladder.same("lead", "gold"), 1)
     self.assertEqual(word_ladder.same("super", "duper"), 4)
 def test_same(self):
     self.assertTrue(word_ladder.same("ate", "are") == 2)
     self.assertEqual(word_ladder.same("eat", "ate"), 0)
     self.assertEqual(word_ladder.same("test", "testing"), 4)
     self.assertEqual(word_ladder.same("1", "1"), 1)
     self.assertRaises(TypeError, word_ladder.same("test", "find"), 1)
 def test_same1(self):
     self.assertEqual(same('lead', 'gold'), 1)
 def test_same4(self):
     self.assertEqual(same('frank', 'gold'), 0)
 def test_same3(self):
     self.assertEqual(same('gold', 'gold'), 4)
 def test_same2(self):
     self.assertEqual(same('goad', 'gold'), 3)
 def test_same(self):
     self.assertEqual(same('hide', 'seek'), 0)
     self.assertEqual(same('lead', 'gold'), 1)
     self.assertEqual(same('cat', 'rat'), 2)
     self.assertEqual(same('bats', 'cats'), 3)
 def test_same(self):
     self.assertEqual(word_ladder.same("check", "checking"), 5)
     self.assertTrue(word_ladder.same("beef", "been"), 0)
     self.assertRaises(TypeError, word_ladder.same("test", "pool"), 1)
Example #11
0
 def test_same_function(self):
     self.assertEqual(word_ladder.same("lead", "lead"), 4)
     self.assertEqual(word_ladder.same("lead", "mead"), 3)
     self.assertEqual(word_ladder.same("hello", "there"), 0)
Example #12
0
 def test_sameInvalid1(self):
     self.assertFalse(word_ladder.same("hide", "the"))
Example #13
0
 def test_sameValid2(self):
     self.assertEqual(word_ladder.same("goal", "load"), 2)
Example #14
0
 def test_sameValid1(self):
     self.assertEqual(word_ladder.same("the", "say"), 0)