Example #1
0
    def test_division(self):
        ''' test that the algorithm divides correctly '''
        vals = {'red': 10, 'blue': 20, 'green': 30, 'yello': 15, 'orange': 25}
        keys = vals.keys()
        cake = CollectionResource(keys)
        users = []
        users.append(CollectionPreference('mark', vals))
        users.append(CollectionPreference('john', vals))

        algorithm = DivideAndChoose(users, cake)
        divisions = algorithm.divide()
        for user, piece in divisions.items():
            self.assertEqual(50, user.value_of(piece))
    def test_division(self):
        """ test that the algorithm divides correctly """
        vals = {"red": 10, "blue": 20, "green": 30, "yello": 15, "orange": 25}
        keys = vals.keys()
        cake = CollectionResource(keys)
        users = []
        users.append(CollectionPreference("mark", vals))
        users.append(CollectionPreference("john", vals))

        algorithm = DivideAndChoose(users, cake)
        divisions = algorithm.divide()
        for user, piece in divisions.items():
            self.assertEqual(50, user.value_of(piece))