Package att.grappa

Examples of att.grappa.Graph


  public Map<ITypeBinding, EclipseCFGNode> getExceptionalExits() {
    return excpReturns;
  }

  public Graph getDotGraph() {
    Graph graph = new Graph(name);
    startNode.addToGraph(graph);
    return graph;
  }
View Full Code Here


  public Map<ITypeBinding, EclipseCFGNode> getExceptionalExits() {
    return excpReturns;
  }

  public Graph getDotGraph() {
    Graph graph = new Graph(name);
    startNode.addToGraph(graph);
    return graph;
  }
View Full Code Here

      throws Exception {
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
        PROJECT);
    IControlFlowGraph cfg = new EclipseNodeFirstCFG(method);
    String className, methodName, testName;
    Graph testGraph;
    File out = null, original, projectRoot;
    FileOutputStream outStream;
    projectRoot = new File(project.getLocationURI());

    className = method.resolveBinding().getDeclaringClass().getName();
    methodName = method.getName().getIdentifier();
    testName = className + "_" + methodName + ".dot";

    out = new File(projectRoot, "test/dotFiles/cfg/last/" + testName);
    testGraph = cfg.getDotGraph();
    outStream = new FileOutputStream(out);

    try {
      testGraph.printGraph(outStream);
      original = new File(projectRoot, "test/dotFiles/cfg/saved/"
          + testName);
      if (!original.exists())
        throw new FileNotFoundException(original.getAbsolutePath());

      Parser graphParser = new Parser(new FileInputStream(original));
      Graph realGraph;

      graphParser.parse();
      realGraph = graphParser.getGraph();
      return areGraphsEqual(testGraph, realGraph);
    } finally {
View Full Code Here

  @Override
  public void analyzeMethod(MethodDeclaration method) {
    IControlFlowGraph cfg = getCFG(method);
    String className, methodName, testName;
    Graph testGraph;
    File out = null, original, projectRoot;
    FileOutputStream outStream;
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
        "CrystalTest");
    projectRoot = new File(project.getLocationURI()); // project.getLocationURI
    // will return null
    // for closed
    // projects.

    try {
      className = method.resolveBinding().getDeclaringClass().getName();
      methodName = method.getName().getIdentifier();
      testName = className + "_" + methodName + ".dot";

      out = new File(projectRoot, "test/lastrun/" + testName);
      testGraph = cfg.getDotGraph();
      outStream = new FileOutputStream(out);
      testGraph.printGraph(outStream);

      original = new File(projectRoot, "test/" + testName);
      if (original.exists()) {
        Parser graphParser = new Parser(new FileInputStream(original));
        Graph realGraph;

        graphParser.parse();
        realGraph = graphParser.getGraph();
        if (!CFGTestUtils.areGraphsEqual(testGraph, realGraph))
          System.err.println("Failed test: " + testName);
View Full Code Here

  static public void runTest(String code, String subFolder, String file,
      boolean doCompare, boolean store) throws Exception {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    CompilationUnit node;
    Graph testGraph;
    OutputStream out;

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setResolveBindings(true);
    // parser.setBindingsRecovery(true);
    parser.setSource(code.toCharArray());
    parser.setUnitName("Foo.java");
    // parser.setProject(JavaCore.create(null));
    node = (CompilationUnit) parser.createAST(null);

    for (IProblem problem : node.getProblems()) {
      System.out.println("Compile problem for " + subFolder + "_" + file);
      System.out.println(problem.getMessage());
    }

    Assert.assertEquals(0, node.getProblems().length);
    List<MethodDeclaration> methods = WorkspaceUtilities
        .scanForMethodDeclarationsFromAST(node);
    Assert.assertEquals(1, methods.size());
    IControlFlowGraph cfg = new EclipseNodeFirstCFG(methods.get(0));

    testGraph = cfg.getDotGraph();
    if (store) {
      out = new FileOutputStream("test/" + subFolder + "_" + file);
    } else {
      out = new FileOutputStream("test/lastrun/" + subFolder + "_" + file);
    }
    testGraph.printGraph(out);
    out.close();

    if (doCompare) {
      InputStream original = new FileInputStream("test/" + subFolder
          + "_" + file);
      Parser graphParser = new Parser(original);
      Graph realGraph;

      graphParser.parse();
      realGraph = graphParser.getGraph();

      Assert
View Full Code Here

  public Map<ITypeBinding, EclipseCFGNode> getExceptionalExits() {
    return excpReturns;
  }

  public Graph getDotGraph() {
    Graph graph = new Graph(name);
    startNode.addToGraph(graph);
    return graph;
  }
View Full Code Here

TOP

Related Classes of att.grappa.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.