Skip to content
Snippets Groups Projects
Commit 1298e558 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Remove TestUtils, don't look in innexistent directories

parent e40e99cd
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ package leon.test ...@@ -2,6 +2,8 @@ package leon.test
import scala.io.Source import scala.io.Source
import org.scalatest._ import org.scalatest._
import java.io.File
trait LeonTestSuite extends FunSuite { trait LeonTestSuite extends FunSuite {
def now() = { def now() = {
System.currentTimeMillis System.currentTimeMillis
...@@ -83,4 +85,20 @@ trait LeonTestSuite extends FunSuite { ...@@ -83,4 +85,20 @@ trait LeonTestSuite extends FunSuite {
storeStats(id, stats.withValue(total)) storeStats(id, stats.withValue(total))
} }
} }
private val all : String=>Boolean = (s : String) => true
def filesInResourceDir(dir : String, filter : String=>Boolean = all) : Iterable[File] = {
import scala.collection.JavaConversions._
val d = this.getClass.getClassLoader.getResource(dir)
if(d == null || d.getProtocol != "file") {
assert(false, "Tests have to be run from within `sbt`, for otherwise the test files will be harder to access (and we dislike that).")
}
val asFile = new File(d.toURI())
asFile.listFiles().filter(f => filter(f.getPath()))
}
} }
/* Copyright 2009-2013 EPFL, Lausanne */
package leon
package test
import java.io.File
object TestUtils {
private val all : String=>Boolean = (s : String) => true
def filesInResourceDir(dir : String, filter : String=>Boolean = all) : Iterable[File] = {
import scala.collection.JavaConversions._
val d = this.getClass.getClassLoader.getResource(dir)
if(d == null || d.getProtocol != "file") {
assert(false, "Tests have to be run from within `sbt`, for otherwise the test files will be harder to access (and we dislike that).")
}
val asFile = new File(d.toURI())
asFile.listFiles().filter(f => filter(f.getPath()))
}
}
...@@ -15,8 +15,6 @@ import leon.synthesis.utils._ ...@@ -15,8 +15,6 @@ import leon.synthesis.utils._
import java.io.File import java.io.File
import TestUtils._
class SynthesisRegressionSuite extends LeonTestSuite { class SynthesisRegressionSuite extends LeonTestSuite {
private def forEachFileIn(path : String)(block : File => Unit) { private def forEachFileIn(path : String)(block : File => Unit) {
val fs = filesInResourceDir(path, _.endsWith(".scala")) val fs = filesInResourceDir(path, _.endsWith(".scala"))
...@@ -63,11 +61,11 @@ class SynthesisRegressionSuite extends LeonTestSuite { ...@@ -63,11 +61,11 @@ class SynthesisRegressionSuite extends LeonTestSuite {
testSynthesis("List", f, 200) testSynthesis("List", f, 200)
} }
forEachFileIn("regression/synthesis/SortedList/") { f => //forEachFileIn("regression/synthesis/SortedList/") { f =>
testSynthesis("SortedList", f, 400) // testSynthesis("SortedList", f, 400)
} //}
forEachFileIn("regression/synthesis/StrictSortedList/") { f => //forEachFileIn("regression/synthesis/StrictSortedList/") { f =>
testSynthesis("StrictSortedList", f, 400) // testSynthesis("StrictSortedList", f, 400)
} //}
} }
...@@ -8,8 +8,6 @@ import leon.verification.{AnalysisPhase,VerificationReport} ...@@ -8,8 +8,6 @@ import leon.verification.{AnalysisPhase,VerificationReport}
import java.io.File import java.io.File
import TestUtils._
class PureScalaVerificationRegression extends LeonTestSuite { class PureScalaVerificationRegression extends LeonTestSuite {
private var counter : Int = 0 private var counter : Int = 0
private def nextInt() : Int = { private def nextInt() : Int = {
......
...@@ -8,8 +8,6 @@ import leon.verification.{AnalysisPhase,VerificationReport} ...@@ -8,8 +8,6 @@ import leon.verification.{AnalysisPhase,VerificationReport}
import java.io.File import java.io.File
import TestUtils._
class XLangVerificationRegression extends LeonTestSuite { class XLangVerificationRegression extends LeonTestSuite {
private var counter : Int = 0 private var counter : Int = 0
private def nextInt() : Int = { private def nextInt() : Int = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment