// $Id: ProgTest.scala,v 1.1 2005/10/28 20:46:16 leavens Exp leavens $
package interp;

import Domains._;
import scala.testing.SUnit.TestCase;
import testing.Expect;

/** Tests for a program, which includes parsing. */
class ProgTest(code: String, res: ExpressedValue)
      extends scala.testing.SUnit.TestCase(code)
{
  /** Parsing hook. */
  def parseProg(code: String): Program = EOPLParsing.parseProgram(code);

  /** The interpreter. */
  private val interpreter = new Interpreter();

  /** Evaluation hook. */
  def evalProg(prog: Program): ExpressedValue = {
    interpreter.evalProgram(prog);
  }

  /** Delegee. */
  private val test = new Expect(code, evalProg(parseProg(code)), res);

  override def runTest(): Unit = test.runTest();
}
