def test_max_stmt_added(self): repo_summary = RepositorySummary() repoMiner = RepositoryMiner( RepositoryMining(path_to_repo="../test-repos/method-test", from_commit=None, to_commit=None), repo_summary) repoMiner.create_repository_summary("../test-repos/method-test", None, None) table = repo_summary.get_table() self.assertTrue( method_in_commit_has_property( table, "6473c2c63ce09cda65bb11cf1f1bf12f31c185a2", "Foo.java:Foo::someFunction()", MAX_STMT_ADD, 3)) self.assertTrue( method_in_commit_has_property( table, "2e533a7e1a0672ffd9f5c3b18dfadd4e34702bd1", "Foo.java:Foo::someFunction()", MAX_STMT_ADD, 3)) self.assertTrue( method_in_commit_has_property( table, "c155c3ee786f40dca1f4e9c59ab989d0b252df80", "Foo.java:Foo::someFunction2()", MAX_STMT_ADD, 3))
def test_is_bug(self): repo_summary = RepositorySummary() repoMiner = RepositoryMiner( RepositoryMining(path_to_repo="../test-repos/bug-test", from_commit=None, to_commit=None), repo_summary) repoMiner.create_repository_summary("../test-repos/bug-test", None, None) table = repo_summary.get_table() self.assertTrue( method_in_commit_has_property( table, "5447e9ea765dc239c2b36b8460d772a7ace84d01", "Foo.java:Foo::someFunction()", "is_bug", False)) self.assertTrue( method_in_commit_has_property( table, "5447e9ea765dc239c2b36b8460d772a7ace84d01", "Foo.java:Foo::someFunction2()", "is_bug", False)) self.assertTrue( method_in_commit_has_property( table, "5447e9ea765dc239c2b36b8460d772a7ace84d01", "Foo.java:Foo::someFunction3()", "is_bug", False)) self.assertTrue( method_in_commit_has_property( table, "404af96f857d98b619354724ed2d929d5ed665ff", "Foo.java:Foo::someFunction3()", "is_bug", True)) self.assertTrue( method_in_commit_has_property( table, "898c16bda929a7e8c2c16727abf506ff6b871856", "Foo.java:Foo::someFunction2()", "is_bug", True)) self.assertTrue( method_in_commit_has_property( table, "5e1a403401b5add14073e6e20bf601935fa86c50", "Foo.java:Foo::someFunction3()", "is_bug", False)) self.assertTrue( method_in_commit_has_property( table, "69ae7a00f07ab9e446895a4754f8e096c18508c6", "Foo.java:Foo::someFunction2()", "is_bug", False))
def test_declaration_change(self): repo_summary = RepositorySummary() repoMiner = RepositoryMiner( RepositoryMining(path_to_repo="../test-repos/method-test4", from_commit=None, to_commit=None), repo_summary) repoMiner.create_repository_summary("../test-repos/method-test4", None, None) table = repo_summary.get_table() self.assertTrue( method_in_commit_has_property( table, "11c9b69821df256de46ad6d497bed021bb14269b", "Foo.java:Foo::methodNameChangedOnce1()", DECL, 2)) self.assertTrue( method_in_commit_has_property( table, "50f9a5f4094085b360f80dcb3068c7339590c928", "Foo.java:Foo::methodNameAndRetrurnTypeChangeOnceTogether1()", DECL, 2)) self.assertTrue( method_in_commit_has_property( table, "11cf4dcebe1971f480924fd9f670508dc23a704a", "Foo.java:Foo::methodDeclarationNeverChanged()", DECL, 1)) self.assertTrue( method_in_commit_has_property( table, "6987405bfee4de50d2316f817e41b4ad669af66f", "Foo.java:Foo::methodNameAndRetrurnTypeChangeOnceSeperate1()", DECL, 3)) self.assertTrue( method_in_commit_has_property( table, "52ae7f81f5cb8b06b01b33ac2e301dc9e5d6cf60", "Foo.java:Foo::methodVisibilityChangedOnce()", DECL, 2)) self.assertTrue( method_in_commit_has_property( table, "bed7e7dab4f3ee5136077ee8a72bbd0f3904f56d", "Foo.java:Foo::methodChangedThreeTimes3()", DECL, 4))
def test_author_count(self): repo_summary = RepositorySummary() repoMiner = RepositoryMiner( RepositoryMining(path_to_repo="../test-repos/method-test3", from_commit=None, to_commit=None), repo_summary) repoMiner.create_repository_summary("../test-repos/method-test3", None, None) table = repo_summary.get_table() self.assertTrue( method_in_commit_has_property( table, "d992d74a535b4479a86df99cc041b55e38065b2e", "Foo.java:Foo::methodOnlyChangedOne()", "authors", 1)) self.assertTrue( method_in_commit_has_property( table, "bd3291339c9f826bb406288e4ebbc714dd8ae0e9", "Foo.java:Foo::methodChangedByTwo()", "authors", 2)) self.assertTrue( method_in_commit_has_property( table, "6b1293522a60be806c3fc6fd27edf24ebed3655c", "Foo.java:Foo::methodChangedByThree()", "authors", 3)) self.assertTrue( method_in_commit_has_property( table, "03196e778184de0bd53dd4f838861082ae7c245b", "Foo.java:Foo::methodChangedByTwoWithSameNameButDifferentEmail()", "authors", 2)) self.assertTrue( method_in_commit_has_property( table, "dafb1d9ee5e654474a38786587ad7ba8d49b90df", "Foo.java:Foo::methodChangedBySameAuthorTwice()", "authors", 2)) self.assertTrue( method_in_commit_has_property( table, "dafb1d9ee5e654474a38786587ad7ba8d49b90df", "Foo.java:Foo::methodChangedByTwoDifferentTwice()", "authors", 2))