def testDone(self):
        """"Test the Done method.

    Produce a generation with a set of tasks. Set the cost of the task one by
    one and verify that the Done method returns false before setting the cost
    for all the tasks. After the costs of all the tasks are set, the Done method
    should return true.
    """

        random.seed(0)

        testing_tasks = range(NUM_TASKS)

        # The tasks for the generation to be tested.
        tasks = [IdentifierMockTask(TEST_STAGE, t) for t in testing_tasks]

        gen = Generation(set(tasks), None)

        # Permute the list.
        permutation = [(t * STRIDE) % NUM_TASKS for t in range(NUM_TASKS)]
        permuted_tasks = [testing_tasks[index] for index in permutation]

        # The Done method of the Generation should return false before all the tasks
        # in the permuted list are set.
        for testing_task in permuted_tasks:
            assert not gen.Done()

            # Mark a task as done by calling the UpdateTask method of the generation.
            # Send the generation the task as well as its results.
            gen.UpdateTask(IdentifierMockTask(TEST_STAGE, testing_task))

        # The Done method should return true after all the tasks in the permuted
        # list is set.
        assert gen.Done()