def test_update_global_difficulty_function(self):
        difficulty = 0.25
        solution_count = 10
        predicted_flow = 0
        reported_flow = 1
        expected = 0.2071428571428

        result = parameters_update.update_global_difficulty_function(
            difficulty, solution_count, predicted_flow, reported_flow, None)

        self.assertAlmostEquals(result, expected)
    def test_update_global_difficulty_function(self):
        difficulty = 0.25
        solution_count = 10
        predicted_flow = 0
        reported_flow = 1
        expected = 0.2071428571428

        result = parameters_update.update_global_difficulty_function(
            difficulty, solution_count, predicted_flow, reported_flow, None
        )

        self.assertAlmostEquals(result, expected)
    def test_update_global_difficulty_function_with_forgetting(self):
        """ Retake the task after 1 minute -> small update """
        difficulty = 0.25
        solution_count = 10
        predicted_flow = 0
        reported_flow = 1
        time_delta = 60
        expected = 0.249979375

        result = parameters_update.update_global_difficulty_function(
            difficulty, solution_count, predicted_flow, reported_flow, time_delta)

        self.assertAlmostEquals(result, expected)
    def test_update_global_difficulty_function_with_forgetting(self):
        """ Retake the task after 1 minute -> small update """
        difficulty = 0.25
        solution_count = 10
        predicted_flow = 0
        reported_flow = 1
        time_delta = 60
        expected = 0.249979375

        result = parameters_update.update_global_difficulty_function(
            difficulty, solution_count, predicted_flow, reported_flow, time_delta
        )

        self.assertAlmostEquals(result, expected)