Skip to content

Commit 983fe52

Browse files
Added Java test case for JavaSMT bug sosy-lab/java-smt#347
1 parent 2b01848 commit 983fe52

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

Diff for: test/unit/api/java/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ set(java_test_src_files
3636
${CMAKE_CURRENT_SOURCE_DIR}/SynthResultTest.java
3737
${CMAKE_CURRENT_SOURCE_DIR}/TermTest.java
3838
${CMAKE_CURRENT_SOURCE_DIR}/ProofTest.java
39+
${CMAKE_CURRENT_SOURCE_DIR}/JavaSmtBug437.java
3940
)
4041

4142
# build junit tests
@@ -82,5 +83,6 @@ cvc5_add_java_api_test(SymbolManagerTest)
8283
cvc5_add_java_api_test(SynthResultTest)
8384
cvc5_add_java_api_test(TermTest)
8485
cvc5_add_java_api_test(ProofTest)
86+
cvc5_add_java_api_test(JavaSmtBug437)
8587

8688
cvc5_add_unit_test_white(UncoveredTest api/java)

Diff for: test/unit/api/java/JavaSmtBug437.java

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/******************************************************************************
2+
* Top contributors (to current version):
3+
* Andrew Reynolds, Mudathir Mohamed
4+
*
5+
* This file is part of the cvc5 project.
6+
*
7+
* Copyright (c) 2009-2023 by the authors listed in the file AUTHORS
8+
* in the top-level source directory and their institutional affiliations.
9+
* All rights reserved. See the file COPYING in the top-level source
10+
* directory for licensing information.
11+
* ****************************************************************************
12+
*
13+
* Test for JavaSMT bug #347
14+
* https://github.com/sosy-lab/java-smt/issues/347
15+
*/
16+
17+
package tests;
18+
19+
import io.github.cvc5.*;
20+
import org.junit.jupiter.api.Test;
21+
22+
class JavaSmtBug437 {
23+
private class Task extends Thread {
24+
@Override
25+
public void run() {
26+
try {
27+
Solver solver = new Solver();
28+
Term formula = solver.mkBoolean(false);
29+
30+
solver.push();
31+
solver.assertFormula(formula);
32+
33+
assert !solver.checkSat().isSat();
34+
35+
solver.deletePointer(); // Remove this line to fix
36+
37+
} catch (CVC5ApiException pE) {
38+
throw new RuntimeException(pE);
39+
}
40+
}
41+
}
42+
43+
@Test
44+
public void bug347BrokenTest() throws InterruptedException {
45+
for (int k = 0; k < 100; k++) {
46+
System.out.println(k);
47+
48+
Task t1 = new Task();
49+
t1.start();
50+
51+
Task t2 = new Task();
52+
t2.start();
53+
54+
t1.join();
55+
t2.join();
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)