update unit test
This commit is contained in:
parent
d8ce71ac61
commit
e3de22671c
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import depends.deptypes.DependencyType;
|
||||
import depends.extractor.cpp.cdt.CdtCppFileParser;
|
||||
|
||||
public class ContainRelationTest extends CppParserTest{
|
||||
|
@ -55,7 +56,7 @@ public class ContainRelationTest extends CppParserTest{
|
|||
parser.parse();
|
||||
}
|
||||
inferer.resolveAllBindings();
|
||||
assertEquals(2,repo.getEntity("UnderTest").getRelations().size());
|
||||
this.assertContainsRelation(repo.getEntity("UnderTest"), DependencyType.CONTAIN, "Member");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public class CppParameterParserTest extends CppParserTest{
|
|||
CppFileParser parser = createParser(src);
|
||||
parser.parse();
|
||||
inferer.resolveAllBindings();
|
||||
assertEquals(5,repo.getEntity("FunctionParameters.function_with_parameters_same_type").getRelations().size());
|
||||
assertEquals(4,repo.getEntity("FunctionParameters.function_with_parameters_same_type").getRelations().size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.io.IOException;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import depends.deptypes.DependencyType;
|
||||
import depends.entity.Entity;
|
||||
|
||||
public class DuplicateDeclarationTest extends CppParserTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
@ -17,7 +20,7 @@ public class DuplicateDeclarationTest extends CppParserTest {
|
|||
public void duplication_declaration_should_be_resolved() throws IOException {
|
||||
|
||||
String[] srcs = new String[] {
|
||||
"./src/test/resources/cpp-code-examples/DuplicationDeclarationCouldBeResolved.cpp",
|
||||
" ",
|
||||
};
|
||||
|
||||
for (String src:srcs) {
|
||||
|
@ -25,7 +28,13 @@ public class DuplicateDeclarationTest extends CppParserTest {
|
|||
parser.parse();
|
||||
}
|
||||
inferer.resolveAllBindings();
|
||||
assertEquals(8,repo.getEntity("X.invoke").getRelations().size());
|
||||
Entity e = repo.getEntity("X.invoke");
|
||||
this.assertContainsRelation(e, DependencyType.CONTAIN,"DupClass");
|
||||
this.assertContainsRelation(e, DependencyType.CALL,"DupClass");
|
||||
this.assertContainsRelation(e, DependencyType.CREATE,"DupClass");
|
||||
this.assertContainsRelation(e, DependencyType.USE,"DupClass");
|
||||
this.assertContainsRelation(e, DependencyType.USE,"X.invoke.c");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@ import java.io.IOException;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import depends.deptypes.DependencyType;
|
||||
import depends.entity.Entity;
|
||||
import depends.relations.Inferer;
|
||||
|
||||
public class MacroRelationTest extends CppParserTest{
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
@ -24,7 +28,10 @@ public class MacroRelationTest extends CppParserTest{
|
|||
parser.parse();
|
||||
}
|
||||
inferer.resolveAllBindings();
|
||||
assertEquals(4,repo.getEntity("foo").getRelations().size());
|
||||
Entity e = repo.getEntity("foo");
|
||||
this.assertContainsRelation(e, DependencyType.RETURN, Inferer.buildInType.getQualifiedName());
|
||||
this.assertContainsRelation(e, DependencyType.CONTAIN, Inferer.buildInType.getQualifiedName());
|
||||
this.assertContainsRelation(e, DependencyType.USE, Inferer.buildInType.getQualifiedName());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue