[infer][clang] fix name collision in the C tests

Summary:
There was a name collision between two files which was preventing to run the tests based on Makefile
master
Jeremy Dubreil 10 years ago
parent 9b63476805
commit 902e5afa61

@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
int divide_by_zero() {
int arith_divide_by_zero() {
int x = 0;
int y = 5;
return y / x;

@ -6,7 +6,8 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
int divide_by_zero() {
int init_divide_by_zero() {
int t[2][3][2] = {{{1,1},{2,2},{3,3}},{{4,4},{5,5},{1,0}}};
return t[0][1][0]/t[1][2][1];
}

@ -37,7 +37,7 @@ public class DivideByZeroTest {
@Test
public void whenInferRunsOnDivideByZeroThenDivideByZeroIsFound()
throws InterruptedException, IOException, InferException {
String[] procedures = {"divide_by_zero"};
String[] procedures = {"arith_divide_by_zero"};
assertThat(
"Results should contain divide by zero error",
inferResults,

@ -10,7 +10,7 @@
package endtoend.c;
import static org.hamcrest.MatcherAssert.assertThat;
import static utils.matchers.ResultContainsErrorInMethod.contains;
import static utils.matchers.ResultContainsExactly.containsExactly;
import com.google.common.collect.ImmutableList;
@ -27,33 +27,31 @@ import utils.InferRunner;
public class InitListExprTest {
public static final String initlistexpr_file =
"infer/tests/" +
"codetoanalyze/c/errors/initialization/initlistexpr.c";
private static ImmutableList<String> inferCmd;
public static final String SOURCE_FILE =
"initialization/initlistexpr.c";
public static final String DIVIDE_BY_ZERO = "DIVIDE_BY_ZERO";
@ClassRule
public static DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
private static InferResults inferResults;
@BeforeClass
public static void runInfer() throws InterruptedException, IOException {
inferCmd = InferRunner.createCInferCommand(folder, initlistexpr_file);
public static void loadResults() throws InterruptedException, IOException {
inferResults = InferResults.loadCInferResults(InitListExprTest.class, SOURCE_FILE);
}
@Test
public void whenInferRunsOnInitListExprThenDivideByZeroIsFound()
throws InterruptedException, IOException, InferException {
InferResults inferResults = InferRunner.runInferC(inferCmd);
String[] methods = {
"init_divide_by_zero"
};
assertThat(
"Results should contain divide by zero error",
"Results should contain " + DIVIDE_BY_ZERO,
inferResults,
contains(
containsExactly(
DIVIDE_BY_ZERO,
initlistexpr_file,
"divide_by_zero"
SOURCE_FILE,
methods
)
);
}

Loading…
Cancel
Save