/*-------------------------Assertion.java-------------------------------
*
* Assertion.assert(test,message) checks to see if test succeeds.
* If test fails, assert() emits message, and halts the program.
*
* See README.TXT in this folder for installation notes.
*
* @author Edwin J. Kay
* Copyright (c), 6 June 2001, for The Universal Computer.
----------------------------------------------------------------------*/
//package UComp; //place class Assertion in package ucomp for general use
public class Assertion
{
/** If test fails, assert() emits message, and halts the program.
An example from class Input:
Assertion.assert(ch>='0' && ch<='9',"Digit expected but '"+ch+"' found");
*/
static public void assert(boolean test, String message)
{ if (!test)
{ System.err.println("Failed assertion: "+message);
System.exit(1);
}
}
}