Search in sources :

Example 1 with DecoratedSkeletonFeature

use of edu.rice.cs.caper.bayou.core.dom_driver.DecoratedSkeletonFeature 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;
        }
    });
}
Also used : DecoratedSkeletonFeature(edu.rice.cs.caper.bayou.core.dom_driver.DecoratedSkeletonFeature) HashMap(java.util.HashMap) Multiset(com.google.common.collect.Multiset) File(java.io.File) Map(java.util.Map) HashMap(java.util.HashMap) CFGFeature(edu.rice.cs.caper.bayou.core.dom_driver.CFGFeature) Test(org.junit.Test)

Aggregations

Multiset (com.google.common.collect.Multiset)1 CFGFeature (edu.rice.cs.caper.bayou.core.dom_driver.CFGFeature)1 DecoratedSkeletonFeature (edu.rice.cs.caper.bayou.core.dom_driver.DecoratedSkeletonFeature)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Test (org.junit.Test)1