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

start some unit testing of function closure

parent 9a247d1d
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ object FunctionClosure extends TransformationPhase {
* The strategy is as follows: Remove one layer of nested FunDef's, then call
* close recursively on the new functions.
*/
private def close(fd: FunDef): Seq[FunDef] = {
def close(fd: FunDef): Seq[FunDef] = {
// Directly nested functions with their p.c.
val nestedWithPathsFull = {
......
/* Copyright 2009-2016 EPFL, Lausanne */
package leon.unit.utils
import leon.test._
import leon.purescala.Common._
import leon.purescala.Expressions._
import leon.purescala.Types._
import leon.purescala.TypeOps.isSubtypeOf
import leon.purescala.Definitions._
import leon.purescala.ExprOps._
import leon.purescala.FunctionClosure
import org.scalatest._
class FunctionClosureSuite extends FunSuite with helpers.ExpressionsDSL {
val fd1 = new FunDef(FreshIdentifier("f"), Seq(), Seq(ValDef(x.id)), IntegerType)
fd1.body = Some(x)
test("close does not modify a function without nested functions") {
val cfd1 = FunctionClosure.close(fd1)
assert(cfd1.size === 1)
assert(fd1 === cfd1.head)
assert(fd1.body === cfd1.head.body)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment