import unittest

# local common lib
import common

"""Test APFD metric.

Example is taken from original paper:
title: Test case prioritization: a family of empirical studies
authors: Elbaum, S. and Malishevsky, A.G. and Rothermel, G.
section 3.4 Prioritization Techniques Summary

Consider two orders of these test cases,
order T1: A B C D E F G H I J
order T2: I J E B C D F G H A.
The resulting APFDs for the
two test case orders are 43.75 percent and 90.0 percent,
respectively.
"""


# global test call counter, starts at 0 because mutpy first execs w/o mutants
common.initialize_counter()

class TestSuite(unittest.TestCase):

    # executes before every test suite run
    @classmethod
    def setUpClass(cls):
        cls.call_count = common.get_counter()

    # executes after every test suite run
    @classmethod
    def tearDownClass(cls):
        common.last_test_routine()


    # cannot use 10 in name because it will be the first test
    def test_91_a(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[])

    def test_4_b(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[1, 2])

    def test_5_c(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[1, 2, 3])

    def test_5_d(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[2, 3])

    def test_3_e(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[1, 8])

    def test_7_f(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[8])

    def test_8_g(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[2])

    # cannot use 10 in name because it will be the first test
    def test_90_h(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[4, 8])

    def test_1_i(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[1, 2, 3, 4, 5])

    def test_2_j(self):
        common.simulate_test_case_run(self.call_count, fault_ids_to_detect=[5, 6, 7])