Skip to content

Commit

Permalink
Make sure web testcases all compile
Browse files Browse the repository at this point in the history
  • Loading branch information
colder committed Apr 27, 2015
1 parent 816c06d commit 770ea24
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions testcases/web/demos/01_Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ object Simplifier {
case And(lhs, rhs) => And(simplify(lhs), simplify(rhs))
case Or(lhs, rhs) => And(simplify(lhs), simplify(rhs))
case LessThan(lhs, rhs) => LessThan(simplify(lhs), simplify(rhs))
case Ite(cond, then, elze) => Ite(simplify(cond), simplify(then), simplify(elze))
case Ite(cond, thn, elze) => Ite(simplify(cond), simplify(thn), simplify(elze))
case _ => e
}) ensuring {
res => run(res)(m) == run(e)(m)
Expand All @@ -189,11 +189,11 @@ object Runtime {
case IntLiteral(v) => v
case Var(id) => if (m contains id) m(id) else 0
case LessThan(lhs, rhs) => if (run(lhs) < run(rhs)) 1 else 0
case Ite(cond, then, elze) => if (run(cond) != 0) run(then) else run(elze)
case Ite(cond, thn, elze) => if (run(cond) != 0) run(thn) else run(elze)
}

def test() = {
run(Plus(IntLiteral(42), Var(0)))(Map(0 -> 1))
run(Plus(IntLiteral(42), Var(0)))(Map(BigInt(0) -> BigInt(1)))
}
}

Expand Down
9 changes: 4 additions & 5 deletions testcases/web/demos/05_OpenDays2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import leon.annotation._
object EpflOpenDays {
@library
sealed abstract class Piece {
def valeur = this match {
def valeur: BigInt = this match {
case Cent5 => 5
case Cent10 => 10
case Cent20 => 20
Expand All @@ -18,9 +18,8 @@ object EpflOpenDays {
case Bi50 => 5000
case Bi100 => 10000
case Bi200 => 20000
case Bi1000 => 100000
case Bi1000 => 100000
}

}
case object Cent5 extends Piece
case object Cent10 extends Piece
Expand All @@ -36,7 +35,7 @@ object EpflOpenDays {
case object Bi200 extends Piece
case object Bi1000 extends Piece


@library
sealed abstract class Liste {
def somme: BigInt = {
Expand All @@ -55,7 +54,7 @@ object EpflOpenDays {
else if (v >= Bi200.valeur ) Bi200
else if (v >= Bi100.valeur ) Bi100
else if (v >= Bi50.valeur ) Bi50
else if (v >= Bi20.valeur ) Bi100
else if (v >= Bi20.valeur ) Bi100 // *wink* *wink*
else if (v >= Bi10.valeur ) Bi10
else if (v >= Fr5.valeur ) Fr5
else if (v >= Fr2.valeur ) Fr2
Expand Down
3 changes: 3 additions & 0 deletions testcases/web/sav15/02_Exercise2.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import leon.lang._

object PropositionalLogic {

sealed abstract class Formula
Expand All @@ -21,6 +23,7 @@ object PropositionalLogic {
}) ensuring(isNNF(_))

def isNNF(f: Formula): Boolean = f match {
case _ => false
/* TODO: Implement isNNF */
}

Expand Down

0 comments on commit 770ea24

Please sign in to comment.