def test_inversion_count(): # get data from file print("test inversion count.") in_data = [] for line in fileinput.input("../../data/sort1.dat"): in_data.append(int(line)) print("in_data", in_data) from inversion_count import inversion_count ret = inversion_count(in_data) print("ret = ", ret) assert (ret == 16)
def test_of_size_three(self): array_a = [1, 3, 2] array_b = [2, 3, 1] self.assertEqual(inversion_count(array_a, array_b), 3)
def test_of_size_one(self): array_a = [1] array_b = [1] self.assertEqual(inversion_count(array_a, array_b), 0)
def test_of_size_two(self): array_a = [2, 1] array_b = [1, 2] self.assertEqual(inversion_count(array_a, array_b), 1)