Skip to content
Snippets Groups Projects
Commit b9b1de59 authored by Regis Blanc's avatar Regis Blanc
Browse files

unit testing default evaluator for division semantics

parent 2485477f
No related branches found
No related tags found
No related merge requests found
...@@ -77,9 +77,66 @@ class DefaultEvaluatorTests extends leon.test.LeonTestSuite { ...@@ -77,9 +77,66 @@ class DefaultEvaluatorTests extends leon.test.LeonTestSuite {
expectSuccessful( expectSuccessful(
defaultEvaluator.eval(Times(InfiniteIntegerLiteral(2), InfiniteIntegerLiteral(3))), defaultEvaluator.eval(Times(InfiniteIntegerLiteral(2), InfiniteIntegerLiteral(3))),
InfiniteIntegerLiteral(6)) InfiniteIntegerLiteral(6))
}
test("Eval of division and modulo semantics for BigInt") {
expectSuccessful(
defaultEvaluator.eval(Division(InfiniteIntegerLiteral(10), InfiniteIntegerLiteral(3))),
InfiniteIntegerLiteral(3))
expectSuccessful( expectSuccessful(
defaultEvaluator.eval(Modulo(InfiniteIntegerLiteral(10), InfiniteIntegerLiteral(3))), defaultEvaluator.eval(Modulo(InfiniteIntegerLiteral(10), InfiniteIntegerLiteral(3))),
InfiniteIntegerLiteral(1)) InfiniteIntegerLiteral(1))
expectSuccessful(
defaultEvaluator.eval(Division(InfiniteIntegerLiteral(-1), InfiniteIntegerLiteral(3))),
InfiniteIntegerLiteral(0))
expectSuccessful(
defaultEvaluator.eval(Modulo(InfiniteIntegerLiteral(-1), InfiniteIntegerLiteral(3))),
InfiniteIntegerLiteral(-1))
expectSuccessful(
defaultEvaluator.eval(Division(InfiniteIntegerLiteral(-1), InfiniteIntegerLiteral(-3))),
InfiniteIntegerLiteral(0))
expectSuccessful(
defaultEvaluator.eval(Modulo(InfiniteIntegerLiteral(-1), InfiniteIntegerLiteral(-3))),
InfiniteIntegerLiteral(-1))
expectSuccessful(
defaultEvaluator.eval(Division(InfiniteIntegerLiteral(1), InfiniteIntegerLiteral(-3))),
InfiniteIntegerLiteral(0))
expectSuccessful(
defaultEvaluator.eval(Modulo(InfiniteIntegerLiteral(1), InfiniteIntegerLiteral(-3))),
InfiniteIntegerLiteral(1))
}
test("Eval of division and modulo semantics for bit vectors") {
expectSuccessful(
defaultEvaluator.eval(BVDivision(IntLiteral(10), IntLiteral(3))),
IntLiteral(3))
expectSuccessful(
defaultEvaluator.eval(BVModulo(IntLiteral(10), IntLiteral(3))),
IntLiteral(1))
expectSuccessful(
defaultEvaluator.eval(BVDivision(IntLiteral(-1), IntLiteral(3))),
IntLiteral(0))
expectSuccessful(
defaultEvaluator.eval(BVModulo(IntLiteral(-1), IntLiteral(3))),
IntLiteral(-1))
expectSuccessful(
defaultEvaluator.eval(BVDivision(IntLiteral(-1), IntLiteral(-3))),
IntLiteral(0))
expectSuccessful(
defaultEvaluator.eval(BVModulo(IntLiteral(-1), IntLiteral(-3))),
IntLiteral(-1))
expectSuccessful(
defaultEvaluator.eval(BVDivision(IntLiteral(1), IntLiteral(-3))),
IntLiteral(0))
expectSuccessful(
defaultEvaluator.eval(BVModulo(IntLiteral(1), IntLiteral(-3))),
IntLiteral(1))
} }
test("Eval of simple boolean operations") { test("Eval of simple boolean operations") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment