예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)