Skip to content

Commit 34ffe95

Browse files
kfriedbergerbaierd
authored andcommitted
Test: improve and extend some documentation.
And fix a typo.
1 parent 4250bbf commit 34ffe95

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/org/sosy_lab/java_smt/test/SolverThreadLocalityTest.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ public void allLocalTest() throws InterruptedException, SolverException {
6969
}
7070

7171
@Test
72-
public void nonlocalContextTest()
72+
public void nonLocalContextTest()
7373
throws ExecutionException, InterruptedException, SolverException {
7474
requireIntegers();
7575
assume().that(solverToUse()).isNotEqualTo(Solvers.CVC5);
7676

77+
// generate a new context in another thread, i.e., non-locally
7778
Future<SolverContext> result = executor.submit(() -> factory.generateContext());
7879

7980
try (SolverContext newContext = result.get()) {
@@ -103,11 +104,12 @@ public void nonlocalContextTest()
103104
}
104105

105106
@Test
106-
public void nonlocalFormulaTest()
107+
public void nonLocalFormulaTest()
107108
throws InterruptedException, SolverException, ExecutionException {
108109
requireIntegers();
109110
assume().that(solverToUse()).isNotEqualTo(Solvers.CVC5);
110111

112+
// generate a new formula in another thread, i.e., non-locally
111113
Future<BooleanFormula> result =
112114
executor.submit(
113115
() -> {
@@ -132,13 +134,14 @@ public void nonlocalFormulaTest()
132134
}
133135

134136
@Test
135-
public void nonlocalProverTest() throws InterruptedException, ExecutionException {
137+
public void nonLocalProverTest() throws InterruptedException, ExecutionException {
136138
requireIntegers();
137139
assume().that(solverToUse()).isNotEqualTo(Solvers.CVC5);
138140

139141
BooleanFormula formula = hardProblem.generate(DEFAULT_PROBLEM_SIZE);
140142

141143
try (BasicProverEnvironment<?> prover = context.newProverEnvironment()) {
144+
// generate a new prover in another thread, i.e., non-locally
142145
Future<?> task =
143146
executor.submit(
144147
() -> {
@@ -206,7 +209,7 @@ public <T> void localInterpolationTest() throws InterruptedException, SolverExce
206209

207210
@SuppressWarnings({"unchecked", "resource"})
208211
@Test
209-
public <T> void nonlocalInterpolationTest() throws InterruptedException, ExecutionException {
212+
public <T> void nonLocalInterpolationTest() throws InterruptedException, ExecutionException {
210213
requireIntegers();
211214
requireInterpolation();
212215
assume().that(solverToUse()).isNotEqualTo(Solvers.CVC5);
@@ -218,6 +221,7 @@ public <T> void nonlocalInterpolationTest() throws InterruptedException, Executi
218221
(InterpolatingProverEnvironment<T>) context.newProverEnvironmentWithInterpolation()) {
219222
T id1 = prover.push(f1);
220223

224+
// push a formula in another thread, i.e., non-locally
221225
Future<?> task1 =
222226
executor.submit(
223227
() -> {
@@ -240,6 +244,7 @@ public <T> void nonlocalInterpolationTest() throws InterruptedException, Executi
240244

241245
assert task1.get() == null;
242246

247+
// compute/check interpolants in different threads, i.e., non-locally
243248
Future<BooleanFormula> task2 =
244249
executor.submit(
245250
() -> {
@@ -260,6 +265,7 @@ public <T> void nonlocalInterpolationTest() throws InterruptedException, Executi
260265
BooleanFormula itp = task2.get();
261266
prover.pop();
262267

268+
// use interpolants in another thread, i.e., non-locally
263269
Future<?> task4 =
264270
executor.submit(
265271
() -> {
@@ -311,6 +317,11 @@ public void wrongContextTest()
311317
// key not found: i@15
312318
// Boolector crashes with a segfault:
313319
// boolector_assert: argument 'exp' belongs to different Boolector instance
320+
//
321+
// To fix this issue, we would need to track which formula was created in which context,
322+
// which might result in quite some management and memory overhead.
323+
// We might want to see this as very low priority, as there is no real benefit for the user,
324+
// except having a nice error message.
314325

315326
// Boolector does not support integer, so we have to use two different versions for this test.
316327
BooleanFormula formula =

0 commit comments

Comments
 (0)