def test_020_medium_some_common_comps_exact(self): n_stolen, n_sighted, n_matches, expected = 100, 1000, 5, 99647 self.comparisons_test(n_stolen, n_sighted, n_matches, expected) StatCounter.reset_comparisons() self.internal_comparisons_test(n_stolen, n_sighted, n_matches, quiet=True)
def test_030_large_all_common_comps_exact(self): n_stolen, n_sighted, n_matches, expected = 1000, 20000, 1000, 19077500 self.comparisons_test(n_stolen, n_sighted, n_matches, expected) StatCounter.reset_comparisons() self.internal_comparisons_test(n_stolen, n_sighted, n_matches, quiet=True)
def test_080_small3_all_common_comps_exact(self): n_stolen, n_sighted, n_matches, expected = 10, 1000, 10, 9405 self.comparisons_test(n_stolen, n_sighted, n_matches, expected) StatCounter.reset_comparisons() self.internal_comparisons_test(n_stolen, n_sighted, n_matches, quiet=True)
def test_010_tiny_comps_exact(self): n_stolen, n_sighted, n_matches, expected = 2, 5, 2, 9 self.comparisons_test(n_stolen, n_sighted, n_matches, expected) StatCounter.reset_comparisons() self.internal_comparisons_test(n_stolen, n_sighted, n_matches, quiet=True)
def test_070_small2_all_common_comps_exact(self): n_stolen, n_sighted, n_matches = 100, 100, 100 expected = n_stolen * (n_stolen + 1) // 2 self.comparisons_test(n_stolen, n_sighted, n_matches, expected) StatCounter.reset_comparisons() self.internal_comparisons_test(n_stolen, n_sighted, n_matches, quiet=True)
def test_040_small_all_common_comps_exact(self): n_stolen, n_sighted, n_matches = 10, 10, 10 expected = n_stolen * (n_stolen + 1) // 2 # can you see why expected must be given by the formula above in this case? self.comparisons_test(n_stolen, n_sighted, n_matches, expected) StatCounter.reset_comparisons() self.internal_comparisons_test(n_stolen, n_sighted, n_matches, quiet=True)
def setUp(self): """Runs before every test case""" StatCounter.reset_comparisons()