use of edu.rice.cs.caper.bayou.core.dom_driver.CFGFeature in project bayou by capergroup.
the class FeatureTest method testcfg.
@Test
public void testcfg() throws ParseException, IOException {
File srcFolder;
{
File projRoot = new File(System.getProperty("user.dir")).getParentFile().getParentFile().getParentFile();
srcFolder = new File(projRoot.getAbsolutePath() + File.separator + "src");
}
String testDir = srcFolder.getAbsolutePath() + File.separator + "test" + File.separator + "resources" + File.separator + "driver";
String test_filename = "skeleton1.java";
String src = read_file(testDir + File.separator + test_filename);
ASTParser parser = ASTParser.newParser(AST.JLS3);
Map options = new HashMap();
parser.setCompilerOptions(options);
parser.setSource(src.toCharArray());
parser.setKind(ASTParser.K_COMPILATION_UNIT);
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
cu.accept(new ASTVisitor() {
@Override
public boolean visit(MethodDeclaration method) {
CFGFeature feature = new CFGFeature(method);
Multiset<Integer> set = feature.gen_subgraph(4, true);
System.out.println(set.toString());
DecoratedSkeletonFeature sf = new DecoratedSkeletonFeature(method);
System.out.println(sf.toString());
return false;
}
});
}
Aggregations