diff --git a/infer/tests/codetoanalyze/cpp/frontend/builtin/new.dot b/infer/tests/codetoanalyze/cpp/frontend/builtin/new.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/builtin/new.dot rename to infer/tests/codetoanalyze/cpp/frontend/builtin/new.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.dot b/infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.dot rename to infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.dot b/infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.dot rename to infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.dot b/infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.dot rename to infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/casts.dot b/infer/tests/codetoanalyze/cpp/frontend/types/casts.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/types/casts.dot rename to infer/tests/codetoanalyze/cpp/frontend/types/casts.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/functions.dot b/infer/tests/codetoanalyze/cpp/frontend/types/functions.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/types/functions.dot rename to infer/tests/codetoanalyze/cpp/frontend/types/functions.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.dot b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/types/inheritance.dot rename to infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/struct.dot b/infer/tests/codetoanalyze/cpp/frontend/types/struct.cpp.dot similarity index 100% rename from infer/tests/codetoanalyze/cpp/frontend/types/struct.dot rename to infer/tests/codetoanalyze/cpp/frontend/types/struct.cpp.dot diff --git a/infer/tests/frontend/cpp/CastsTest.java b/infer/tests/frontend/cpp/CastsTest.java index 696f8d8de..3273ddb05 100644 --- a/infer/tests/frontend/cpp/CastsTest.java +++ b/infer/tests/frontend/cpp/CastsTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class CastsTest { @@ -32,20 +26,8 @@ public class CastsTest { @Test public void whenCaptureRunCommaThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { - String literal_src = + String src = "infer/tests/codetoanalyze/cpp/frontend/types/casts.cpp"; - - String literal_dotty = - "infer/tests/codetoanalyze/cpp/frontend/types/casts.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - literal_src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + literal_src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(literal_dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/ClassTest.java b/infer/tests/frontend/cpp/ClassTest.java index 5e286facf..bbe07adc4 100644 --- a/infer/tests/frontend/cpp/ClassTest.java +++ b/infer/tests/frontend/cpp/ClassTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class ClassTest { @@ -32,20 +26,8 @@ public class ClassTest { @Test public void whenCaptureRunCommaThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { - String literal_src = + String src = "infer/tests/codetoanalyze/cpp/frontend/types/struct.cpp"; - - String literal_dotty = - "infer/tests/codetoanalyze/cpp/frontend/types/struct.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - literal_src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + literal_src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(literal_dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/FunctionsTest.java b/infer/tests/frontend/cpp/FunctionsTest.java index 177f07fa2..7b6ad4889 100644 --- a/infer/tests/frontend/cpp/FunctionsTest.java +++ b/infer/tests/frontend/cpp/FunctionsTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class FunctionsTest { @@ -32,20 +26,8 @@ public class FunctionsTest { @Test public void whenCaptureRunCommaThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { - String literal_src = + String src = "infer/tests/codetoanalyze/cpp/frontend/types/functions.cpp"; - - String literal_dotty = - "infer/tests/codetoanalyze/cpp/frontend/types/functions.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - literal_src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + literal_src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(literal_dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/InheritanceTest.java b/infer/tests/frontend/cpp/InheritanceTest.java index 25669b2ee..68744004f 100644 --- a/infer/tests/frontend/cpp/InheritanceTest.java +++ b/infer/tests/frontend/cpp/InheritanceTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class InheritanceTest { @@ -34,18 +28,6 @@ public class InheritanceTest { throws InterruptedException, IOException, InferException { String src = "infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp"; - - String dotty = - "infer/tests/codetoanalyze/cpp/frontend/types/inheritance.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/LiteralsTest.java b/infer/tests/frontend/cpp/LiteralsTest.java index 2a2287b4a..7f1ad31d1 100644 --- a/infer/tests/frontend/cpp/LiteralsTest.java +++ b/infer/tests/frontend/cpp/LiteralsTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class LiteralsTest { @@ -32,20 +26,8 @@ public class LiteralsTest { @Test public void whenCaptureRunCommaThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { - String literal_src = + String src = "infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.cpp"; - - String literal_dotty = - "infer/tests/codetoanalyze/cpp/frontend/literals/nullptr.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - literal_src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + literal_src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(literal_dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/NamespaceTest.java b/infer/tests/frontend/cpp/NamespaceTest.java index 14cc0fadc..9090f946f 100644 --- a/infer/tests/frontend/cpp/NamespaceTest.java +++ b/infer/tests/frontend/cpp/NamespaceTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class NamespaceTest { @@ -32,20 +26,8 @@ public class NamespaceTest { @Test public void whenCaptureRunCommaThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { - String switch_src = + String src = "infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.cpp"; - - String switch_dotty = - "infer/tests/codetoanalyze/cpp/frontend/namespace/namespace.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - switch_src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + switch_src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(switch_dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/NewTest.java b/infer/tests/frontend/cpp/NewTest.java index 904753629..20606c0e8 100644 --- a/infer/tests/frontend/cpp/NewTest.java +++ b/infer/tests/frontend/cpp/NewTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class NewTest { @@ -34,18 +28,6 @@ public class NewTest { throws InterruptedException, IOException, InferException { String src = "infer/tests/codetoanalyze/cpp/frontend/builtin/new.cpp"; - - String dotty = - "infer/tests/codetoanalyze/cpp/frontend/builtin/new.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } } diff --git a/infer/tests/frontend/cpp/SelfParameterTest.java b/infer/tests/frontend/cpp/SelfParameterTest.java index 3b311ab87..f1a4f2b93 100644 --- a/infer/tests/frontend/cpp/SelfParameterTest.java +++ b/infer/tests/frontend/cpp/SelfParameterTest.java @@ -9,20 +9,14 @@ package frontend.cpp; -import static org.hamcrest.MatcherAssert.assertThat; -import static utils.matchers.DotFilesEqual.dotFileEqualTo; - -import com.google.common.collect.ImmutableList; - import org.junit.Rule; import org.junit.Test; -import java.io.File; import java.io.IOException; import utils.DebuggableTemporaryFolder; import utils.InferException; -import utils.InferRunner; +import utils.ClangFrontendUtils; public class SelfParameterTest { @@ -34,18 +28,6 @@ public class SelfParameterTest { throws InterruptedException, IOException, InferException { String src = "infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.cpp"; - - String dotty = - "infer/tests/codetoanalyze/cpp/frontend/keywords/self_parameter.dot"; - - ImmutableList inferCmd = - InferRunner.createCPPInferCommandFrontend( - folder, - src); - File newDotFile = InferRunner.runInferFrontend(inferCmd); - assertThat( - "In the capture of " + src + - " the dotty files should be the same.", - newDotFile, dotFileEqualTo(dotty)); + ClangFrontendUtils.createAndCompareCppDotFiles(folder, src); } }