-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BigInt extraction and test for Int->BigInt conversion
- Loading branch information
Showing
3 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package z3.scala | ||
|
||
import org.scalatest.{FunSuite, Matchers} | ||
|
||
class IntExtraction extends FunSuite with Matchers { | ||
|
||
test(s"BigInt extraction") { | ||
val z3 = new Z3Context("MODEL" -> true) | ||
|
||
val i = z3.mkIntSort | ||
val x = z3.mkConst(z3.mkStringSymbol("x"), i) | ||
val m = z3.mkInt(Int.MaxValue, i) | ||
|
||
val solver = z3.mkSolver | ||
|
||
solver.assertCnstr(z3.mkEq(x, z3.mkAdd(m, m))) | ||
|
||
val (sol, model) = solver.checkAndGetModel | ||
|
||
sol should equal(Some(true)) | ||
model.evalAs[BigInt](x) should equal(Some(BigInt(Int.MaxValue) * 2)) | ||
|
||
z3.delete | ||
} | ||
} | ||
|