def test_auto_bake(self): ingredients = [ "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3" ] solver = SolutionFifteen(ingredients) cookie = solver.bake() self.assertEqual(62842880, cookie.score)
def test_auto_bake(self): ingredients = [ "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3", ] solver = SolutionFifteen(ingredients) cookie = solver.bake() self.assertEqual(62842880, cookie.score)
def test_cookie(self): ingredients = [ "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3" ] solver = SolutionFifteen(ingredients) solver.add_ingredient("Cinnamon", 100) self.assertEqual(100, solver.cookie.spoons) self.assertEqual(-200, solver.cookie.flavor) self.assertEqual(300, solver.cookie.calories)
def test_cookie(self): ingredients = [ "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3", ] solver = SolutionFifteen(ingredients) solver.add_ingredient("Cinnamon", 100) self.assertEqual(100, solver.cookie.spoons) self.assertEqual(-200, solver.cookie.flavor) self.assertEqual(300, solver.cookie.calories)
def test_case(self): ingredients = [ "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3", ] solver = SolutionFifteen(ingredients) solver.add_ingredient("Cinnamon", 56) solver.add_ingredient("Butterscotch", 44) self.assertEqual(44 * -1 + 56 * 2, solver.cookie.capacity) self.assertEqual(44 * -2 + 56 * 3, solver.cookie.durability) self.assertEqual(44 * 6 + 56 * -2, solver.cookie.flavor) self.assertEqual(44 * 3 + 56 * -1, solver.cookie.texture) self.assertEqual(62842880, solver.cookie.score)
def test_case(self): ingredients = [ "Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8", "Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3" ] solver = SolutionFifteen(ingredients) solver.add_ingredient("Cinnamon", 56) solver.add_ingredient("Butterscotch", 44) self.assertEqual(44 * -1 + 56 * 2, solver.cookie.capacity) self.assertEqual(44 * -2 + 56 * 3, solver.cookie.durability) self.assertEqual(44 * 6 + 56 * -2, solver.cookie.flavor) self.assertEqual(44 * 3 + 56 * -1, solver.cookie.texture) self.assertEqual(62842880, solver.cookie.score)
from SolutionFifteen import SolutionFifteen ingredient_descriptions = [ "Frosting: capacity 4, durability -2, flavor 0, texture 0, calories 5", "Candy: capacity 0, durability 5, flavor -1, texture 0, calories 8", "Butterscotch: capacity -1, durability 0, flavor 5, texture 0, calories 6", "Sugar: capacity 0, durability 0, flavor -2, texture 2, calories 1" ] solver = SolutionFifteen(ingredient_descriptions) cookie = solver.bake() print "*********************" print " Winning cookie: %s" % cookie print " Score: %d" % cookie.score print "*********************"