Skip to content
Snippets Groups Projects
Commit c0066341 authored by Régis Blanc's avatar Régis Blanc
Browse files

clean up the code

parent d53a135d
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,6 @@ class TestGeneration(reporter: Reporter) extends Analyser(reporter) { ...@@ -25,7 +25,6 @@ class TestGeneration(reporter: Reporter) extends Analyser(reporter) {
case Waypoint(1, _) => true case Waypoint(1, _) => true
case _ => false case _ => false
})).get })).get
println("Top level function: " + topFunDef)
val testFun = new FunDef(FreshIdentifier("test"), UnitType, Seq()) val testFun = new FunDef(FreshIdentifier("test"), UnitType, Seq())
val funInvocs = testcases.map(testcase => { val funInvocs = testcases.map(testcase => {
...@@ -39,7 +38,6 @@ class TestGeneration(reporter: Reporter) extends Analyser(reporter) { ...@@ -39,7 +38,6 @@ class TestGeneration(reporter: Reporter) extends Analyser(reporter) {
FunctionInvocation(topFunDef, args) FunctionInvocation(topFunDef, args)
}).toSeq }).toSeq
testFun.body = Some(Block(funInvocs, UnitLiteral)) testFun.body = Some(Block(funInvocs, UnitLiteral))
println("The test function:\n" + testFun)
val Program(id, ObjectDef(objId, defs, invariants)) = program val Program(id, ObjectDef(objId, defs, invariants)) = program
val testProgram = Program(id, ObjectDef(objId, testFun +: defs , invariants)) val testProgram = Program(id, ObjectDef(objId, testFun +: defs , invariants))
......
import leon.Utils._
object Diamond {
def foo(x: Int): Int = waypoint(1, if(x < 0) bar(x) else bar(x))
def bar(y: Int): Int = if(y > 5) y else -y
}
import leon.Utils._
object MultiCall {
def a(i: Int): Int = waypoint(1, if(i < 0) b(i) else c(i))
def b(j: Int): Int = if(j == -5) d(j) else e(j)
def c(k: Int): Int = if(k == 5) d(k) else e(k)
def d(l: Int): Int = l
def e(m: Int): Int = m
}
import leon.Utils._
object Sum {
def sum(n: Int): Int = {
waypoint(1, if(n <= 0) 0 else n + sum(n-1))
} ensuring(_ >= 0)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment