Skip to content
Snippets Groups Projects
Commit 53078306 authored by jad's avatar jad
Browse files

added pretty printing for termination checker

parent df965290
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,6 @@ object TerminationPhase extends SimpleLeonPhase[Program, TerminationReport] { ...@@ -30,6 +30,6 @@ object TerminationPhase extends SimpleLeonPhase[Program, TerminationReport] {
} }
val endTime = System.currentTimeMillis val endTime = System.currentTimeMillis
new TerminationReport(ctx, results, (endTime - startTime).toDouble / 1000.0d) new TerminationReport(ctx, tc.program, results, (endTime - startTime).toDouble / 1000.0d)
} }
} }
...@@ -6,8 +6,10 @@ package termination ...@@ -6,8 +6,10 @@ package termination
import purescala.Definitions._ import purescala.Definitions._
import utils.Report import utils.Report
import utils.ASCIIHelpers._ import utils.ASCIIHelpers._
import leon.purescala.PrettyPrinter
import leon.purescala.SelfPrettyPrinter
case class TerminationReport(ctx: LeonContext, results : Seq[(FunDef,TerminationGuarantee)], time : Double) extends Report { case class TerminationReport(ctx: LeonContext, program: Program, results : Seq[(FunDef,TerminationGuarantee)], time : Double) extends Report {
def summaryString : String = { def summaryString : String = {
var t = Table("Termination summary") var t = Table("Termination summary")
...@@ -18,7 +20,10 @@ case class TerminationReport(ctx: LeonContext, results : Seq[(FunDef,Termination ...@@ -18,7 +20,10 @@ case class TerminationReport(ctx: LeonContext, results : Seq[(FunDef,Termination
val result = if (g.isGuaranteed) "\u2713" else "\u2717" val result = if (g.isGuaranteed) "\u2713" else "\u2717"
val verdict = g match { val verdict = g match {
case LoopsGivenInputs(reason, args) => case LoopsGivenInputs(reason, args) =>
"Non-terminating for call: " + args.mkString(fd.id + "(", ",", ")") val niceArgs = args.map { v =>
SelfPrettyPrinter.print(v, PrettyPrinter(v))(ctx, program)
}
"Non-terminating for call: " + niceArgs.mkString(fd.id + "(", ",", ")")
case CallsNonTerminating(funDefs) => case CallsNonTerminating(funDefs) =>
"Calls non-terminating functions " + funDefs.map(_.id).mkString(",") "Calls non-terminating functions " + funDefs.map(_.id).mkString(",")
case Terminates(reason) => case Terminates(reason) =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment