use of kodkod.engine.config.Options in project org.alloytools.alloy by AlloyTools.
the class IncrementalOverflowNumTest method testBasic.
@Test
public void testBasic() {
Options opt = new Options();
opt.setNoOverflow(true);
opt.setBitwidth(2);
IncrementalSolver solver = IncrementalSolver.solver(opt);
Universe univ = new Universe("-2", "-1", "0", "1");
Bounds b = new Bounds(univ);
TupleFactory factory = univ.factory();
b.boundExactly(-2, factory.range(factory.tuple("-2"), factory.tuple("-2")));
b.boundExactly(-1, factory.range(factory.tuple("-1"), factory.tuple("-1")));
b.boundExactly(0, factory.range(factory.tuple("0"), factory.tuple("0")));
b.boundExactly(1, factory.range(factory.tuple("1"), factory.tuple("1")));
Variable n = Variable.unary("n");
Formula f = n.sum().plus(IntConstant.constant(1)).lte(n.sum()).forSome(n.oneOf(Expression.INTS));
Solution sol = solver.solve(f, b);
assertNoInstance(sol);
}
use of kodkod.engine.config.Options in project org.alloytools.alloy by AlloyTools.
the class OverflowNumTest method setupOptions.
protected void setupOptions() {
options = new Options();
options.setNoOverflow(true);
options.setBitwidth(bw());
options.setSolver(SATFactory.MiniSat);
}
use of kodkod.engine.config.Options in project org.alloytools.alloy by AlloyTools.
the class OverflowSigTest method createOptions.
protected void createOptions(int bw) {
this.options = new Options();
options.setNoOverflow(true);
options.setBitwidth(bw);
options.setSolver(SATFactory.MiniSat);
}
use of kodkod.engine.config.Options in project org.alloytools.alloy by AlloyTools.
the class OverflowTheoremTest method setupOptions.
protected void setupOptions() {
options = new Options();
options.setNoOverflow(true);
options.setBitwidth(bw);
options.setSolver(SATFactory.MiniSat);
options.setSkolemDepth(0);
}
use of kodkod.engine.config.Options in project org.alloytools.alloy by AlloyTools.
the class IntTest method testComparisonOps.
/**
* Tests all comparison ops for this.solver.options and range of vals.
*
* @requires this.solver.options.intEncoding = binary
* @requires vals contains int expressions that represent all integers allowed
* by this.solver.options, in proper sequence
*/
private final void testComparisonOps(IntExpression[] vals) {
final Options options = solver.options();
final IntRange range = options.integers();
final int min = range.min(), max = range.max();
for (int i = min; i <= max; i++) {
IntExpression vi = vals[i - min];
for (int j = min; j <= max; j++) {
IntExpression vj = vals[j - min];
testCompOp(EQ, vi, vj, i, j, i == j);
testCompOp(LT, vi, vj, i, j, i < j);
testCompOp(LTE, vi, vj, i, j, i <= j);
testCompOp(GT, vi, vj, i, j, i > j);
testCompOp(GTE, vi, vj, i, j, i >= j);
}
}
}
Aggregations