Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved stack identification, many other changes #71

Merged
merged 15 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 33 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.sys.process.Process
import scala.io.Source

ThisBuild / scalaVersion := "3.1.0"
ThisBuild / version := "0.0.1"
Expand All @@ -8,8 +8,8 @@ val javaTests = "com.novocode" % "junit-interface" % "0.11" % "test"
val scalaTests = "org.scalatest" %% "scalatest" % "3.2.10" % "test"
val scalactic = "org.scalactic" %% "scalactic" % "3.2.10"
val antlrRuntime = "org.antlr" % "antlr4-runtime" % "4.9.3"
val sourceCode = "com.lihaoyi" %% "sourcecode" % "0.3.0"
val mainArgs = "com.lihaoyi" %% "mainargs" % "0.5.1"
val sourceCode = "com.lihaoyi" %% "sourcecode" % "0.3.0"
val mainArgs = "com.lihaoyi" %% "mainargs" % "0.5.1"

lazy val root = project
.in(file("."))
Expand All @@ -18,14 +18,14 @@ lazy val root = project
name := "wptool-boogie",
Antlr4 / antlr4Version := "4.9.3",
Antlr4 / antlr4GenVisitor := true,
Antlr4 / antlr4PackageName := Some("BilParser"),
Antlr4 / antlr4PackageName := Some("Parsers"),
Compile / run / mainClass := Some("Main"),
libraryDependencies += javaTests,
libraryDependencies += antlrRuntime,
libraryDependencies += scalactic,
libraryDependencies += scalaTests,
libraryDependencies += sourceCode,
libraryDependencies += mainArgs
libraryDependencies += mainArgs
)

lazy val updateExpected = taskKey[Unit]("updates .expected for test cases")
Expand All @@ -48,13 +48,40 @@ updateExpected := {
val result = IO.read(resultPath)
val verified = result.strip().equals("Boogie program verifier finished with 0 errors")
if (verified == shouldVerify && outPath.exists()) {
IO.copyFile(outPath, expectedPath)
if (!expectedPath.exists() || !compareFiles(outPath, expectedPath)) {
IO.copyFile(outPath, expectedPath)
}
}
}
}
}
}

def compareFiles(path1: File, path2: File): Boolean = {
val source1 = Source.fromFile(path1)
val source2 = Source.fromFile(path2)
val lines1 = source1.getLines
val lines2 = source2.getLines
while (lines1.hasNext && lines2.hasNext) {
val line1 = lines1.next()
val line2 = lines2.next()
if (line1 != line2) {
source1.close
source2.close
return false
}
}
if (lines1.hasNext || lines2.hasNext) {
source1.close
source2.close
return false
}

source1.close
source2.close
true
}

expectedUpdate(correctPath, true)
expectedUpdate(incorrectPath, false)
}
Expand Down
3,444 changes: 3,444 additions & 0 deletions examples/chase_lev_deque/chase_lev_deque.adt

Large diffs are not rendered by default.

Loading