Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/test/scala/Manifest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,34 @@ class ProfileCache extends FlatSpec with Matchers {
}

class SingleTest extends FlatSpec with Matchers {
it should "just werk" in {
it should "just work" in {
TestRunner.run(Manifest.singleTestOptions) should be(true)
}
}

// Test by command: "testOnly FiveStage.AllBasicTests"
class AllBasicTests extends FlatSpec with Matchers {
it should "just work" in {
val works = getAllBasicNames.filterNot(_ == "convolution.s").map{testname =>
say(s"testing basic $testname")
val opts = Manifest.allTestOptions(testname)
(testname, TestRunner.run(opts))
}
if(works.foldLeft(true)(_ && _._2))
say(Console.GREEN + "All tests successful!" + Console.RESET)
else {
val success = works.map(x => if(x._2) 1 else 0).sum
val total = works.size
say(s"$success/$total tests successful")
works.foreach{ case(name, success) =>
val msg = if(success) Console.GREEN + s"$name successful" + Console.RESET
else Console.RED + s"$name failed" + Console.RESET
say(msg)
}
}
}
}


class AllTests extends FlatSpec with Matchers {
it should "just werk" in {
Expand Down
8 changes: 8 additions & 0 deletions src/test/scala/fileUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,19 @@ object fileUtils {
def getTestDir: File =
new File(getClass.getClassLoader.getResource("tests").getPath)

def getBasicDir: File =
new File(getClass.getClassLoader.getResource("tests/basic").getPath)

def getAllTests: List[File] = getListOfFilesRecursive(getTestDir.getPath)
.filter( f => f.getPath.endsWith(".s") )

def getAllBasic: List[File] = getListOfFilesRecursive(getBasicDir.getPath)
.filter( f => f.getPath.endsWith(".s") )

def getAllTestNames: List[String] = getAllTests.map(_.toString.split("/").takeRight(1).mkString)

def getAllBasicNames: List[String] = getAllBasic.map(_.toString.split("/").takeRight(1).mkString)

// Not tested.
def getAllWindowsTestNames: List[String] = getAllTests.map(_.toString.split("\\\\").takeRight(1).mkString)

Expand Down