def test_scaled_tag_order_dev_is_correct_when_elements_are_missing(self): golden_bo = [] compare_bo = [] golden_bo.append(BuildOrderElement(1, 'Probe', 12, 0, 0)) golden_bo.append(BuildOrderElement(2, 'Pylon', 14, 20, 90)) golden_bo.append(BuildOrderElement(3, 'Assimilator', 15, 50, 200)) compare_bo.append(BuildOrderElement(1, 'Probe', 12, 0, 0)) compare_bo.append(BuildOrderElement(2, 'Probe', 12, 0, 0)) compare_bo.append(BuildOrderElement(3, 'Assimilator', 15, 50, 200)) bo_dev = BuildOrderDeviation(golden_bo) bo_dev.calculate_deviations(compare_bo) self.assertEqual(1 / 6, bo_dev.get_scaled_tag_order_dev(uc.SUPPLY_TAG))
def test_scaled_tag_order_dev_is_zero_when_tag_has_not_occurred_in_build( self): golden_bo = [] compare_bo = [] golden_bo.append(BuildOrderElement(1, 'Probe', 12, 0, 0)) golden_bo.append(BuildOrderElement(2, 'Pylon', 14, 20, 90)) golden_bo.append(BuildOrderElement(3, 'Assimilator', 15, 50, 200)) compare_bo.append(BuildOrderElement(1, 'Probe', 12, 0, 0)) compare_bo.append(BuildOrderElement(2, 'Probe', 12, 0, 0)) compare_bo.append(BuildOrderElement(3, 'Pylon', 14, 20, 90)) compare_bo.append(BuildOrderElement(4, 'Assimilator', 15, 50, 200)) bo_dev = BuildOrderDeviation(golden_bo) bo_dev.calculate_deviations(compare_bo) self.assertEqual(0, bo_dev.get_scaled_tag_order_dev(uc.ARMY_TAG))