Scala 2.5.0-final

API Specification

This document is the API specification for Scala Library Documentation

Class Summary
trait Benchmark extends AnyRef

Benchmark can be used to quickly turn an existing class into a benchmark. Here is a short example:

  object sort1 extends Sorter with Benchmark {
    def run = sort(List.range(1, 1000))
  }
  

The run method has to be defined by the user, who will perform the timed operation there. Run the benchmark as follows:

  > scala sort1 5 times.log
  

This will run the benchmark 5 times and log the execution times in a file called times.log

Object Summary
object SUnit extends AnyRef

Unit testing methods in the spirit of JUnit framework.

Use these classes like this:

 import scala.testing.SUnit
 import SUnit._

 class MyTest(n: String) extends TestCase(n) {

   override def runTest() = n match {
     case "myTest1" => assertTrue(true)
     case "myTest2" => assertTrue("hello", false)
   }
 }

 val r = new TestResult()
 suite.run(r)
 for (tf <- r.failures()) {
   Console.println(tf.toString())
 }
 

The trait TestConsoleMain contains this code as a main method, for convenience.

object UnitTest extends AnyRef
Some simple methods to support unit testing with assertions to contain more JUnit style assertions which use Scala's features.