public abstract class TestFramework
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected int |
badCount |
|
protected java.lang.String |
currentTestName |
|
protected java.io.PrintStream |
realStandardOutput |
|
protected int |
testCount |
|
protected int |
wrongCount |
Modifier | Constructor | Description |
---|---|---|
protected |
TestFramework() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
captureStandardOutput() |
Start storing up the standard output into a string.
|
protected void |
check(boolean test) |
If TEST is tree, print "PASSED" message.
|
protected void |
check(java.lang.Object correct,
java.lang.Object test) |
Check that CORRECT is equal to TEST, using the "same" test below.
|
protected void |
check(java.lang.String msg,
boolean test) |
If TEST is tree, print "PASSED" message.
|
protected void |
check(java.lang.String msg,
java.lang.Object correct,
java.lang.Object test) |
Check that CORRECT is equal to TEST, using the "same" test below.
|
protected void |
failure(java.lang.String msg) |
Report a "failure" (typically a test that blows up instead of producing
a result).
|
int |
getBadCount() |
Cumulative number of "bad" tests: those causing an exception
|
protected java.lang.String |
getCapturedOutput() |
Return the captured output from the standard output.
|
int |
getErrorCount() |
Cumulative count of tests that fail due to exceptions.
|
int |
getPassedCount() |
Passed tests.
|
int |
getTestCount() |
Cumulative number of calls to check.
|
int |
getWrongCount() |
Cumulative number of calls to where the arguments were not the same.
|
protected void |
report() |
|
protected void |
restoreStandardOutput() |
Stop capturing standard output, and revert to initial behavior.
|
protected abstract void |
runTests() |
Execute all tests.
|
static boolean |
same(java.lang.Object x,
java.lang.Object y) |
True iff X equals Y in the sense that either
1) X and Y are arrays of the same length and their respective
elements are == (if primitive) and (recursively) the same otherwise;
or
2) X and Y are both null.
|
static boolean |
sameArrays(java.lang.Object x,
java.lang.Object y) |
|
protected void |
setTestName(java.lang.String name) |
protected int testCount
protected int wrongCount
protected int badCount
protected java.lang.String currentTestName
protected final java.io.PrintStream realStandardOutput
protected void report()
protected abstract void runTests()
protected void setTestName(java.lang.String name)
protected void captureStandardOutput()
protected void restoreStandardOutput()
protected java.lang.String getCapturedOutput()
protected void check(boolean test)
protected void check(java.lang.String msg, boolean test)
protected void check(java.lang.Object correct, java.lang.Object test)
protected void check(java.lang.String msg, java.lang.Object correct, java.lang.Object test)
protected void failure(java.lang.String msg)
public static boolean same(java.lang.Object x, java.lang.Object y)
public static boolean sameArrays(java.lang.Object x, java.lang.Object y)
public int getTestCount()
public int getPassedCount()
public int getWrongCount()
public int getBadCount()
public int getErrorCount()