Commit 125aaaa2 authored by Sergio Pérez's avatar Sergio Pérez
Browse files

Cambios para tests Sergio

parent 387e36e8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public abstract class GraphLog<G extends Graph> {
    }

    public void generateImages(String imageName, Format format) throws IOException {
        this.imageName = imageName + "-" + graph.getClass().getName();
        this.imageName = imageName + "-" + graph.getClass().getSimpleName().toLowerCase();
        this.format = format;
        generated = true;
        File tmpDot = File.createTempFile("graph-source-", ".dot");
@@ -77,9 +77,10 @@ public abstract class GraphLog<G extends Graph> {
            graph.getDOTExporter().exportGraph(graph, w);
        }
        // Execute dot
        ProcessBuilder pb = new ProcessBuilder("dot",
        ProcessBuilder pb = new ProcessBuilder("/usr/local/bin/dot",
            tmpDot.getAbsolutePath(), "-T" + format.getExt(),
            "-o", getImageFile().getAbsolutePath());
        getImageFile().getParentFile().mkdirs();
        try {
            int result = pb.start().waitFor();
            if (result == 0)
+4 −3
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.body.MethodDeclaration;
import tfm.graphs.cfg.CFG;
import tfm.graphs.Graph;
import tfm.graphs.augmented.APDG;
import tfm.graphs.pdg.PDG;
import tfm.graphs.sdg.SDG;
import tfm.utils.Logger;
@@ -17,8 +18,8 @@ import java.util.Optional;

public class Main {

    public static final String PROGRAM = Utils.PROGRAMS_FOLDER + "cfg/Eval_4.java";
    public static final String GRAPH = GraphLog.SDG;
    public static final String PROGRAM = "/Users/serperu/Desktop/LCTES2020/problem1/TestBreak.java";
    public static final String GRAPH = GraphLog.PDG;
    public static final String METHOD = "main";

    public static void main(String[] args) throws IOException {
@@ -61,7 +62,7 @@ public class Main {
                cfg.build(method);
                return cfg;
            case GraphLog.PDG:
                PDG pdg = new PDG();
                PDG pdg = new APDG();
                pdg.build(method);
                return pdg;
            case GraphLog.SDG:
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public class PDGTests {

    @ParameterizedTest(name = "[{index}] {0} ({1})")
    @MethodSource("tfm.utils.FileFinder#findAllMethodDeclarations")
    public void pdgCompare(File file, String methodName, MethodDeclaration root) {
    public void pdgCompare(File file, String methodName, MethodDeclaration root) throws IOException {
        ControlDependencyBuilder ctrlDepBuilder;

        if (containsUnsupportedStatements(root)) {
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ import java.util.Collections;
import java.util.List;

public class FileFinder {
    private static final String TEST_FILES = "./src/test/res/";
    private static final String TEST_FILES = "/Users/serperu/Desktop/LCTES2020/problem1/";
    private static final String DOT_JAVA = ".java";

    public static Collection<Arguments> findFiles(File directory, String suffix) throws FileNotFoundException {