Package totalcross.unit
Class TestCase
- java.lang.Object
-
- totalcross.unit.TestCase
-
- Direct Known Subclasses:
ImageComparisionTest
public abstract class TestCase extends java.lang.ObjectThis class represents a testcase. Just extend this class and implement the testRun method, calling then the assert methods. The testcase must be added to a TestSuite class using the
-
-
Field Summary
Fields Modifier and Type Field Description protected static intassertionCounterprotected static booleanlearningSet this to true when your code is learning the right answers.
-
Constructor Summary
Constructors Constructor Description TestCase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static voidassertBetween(byte left, byte mid, byte right)protected static voidassertBetween(char left, char mid, char right)protected static voidassertBetween(double left, double mid, double right)protected static voidassertBetween(int left, int mid, int right)protected static voidassertBetween(long left, long mid, long right)protected static voidassertBetween(short left, short mid, short right)protected static voidassertEquals(boolean expected, boolean actual)protected static voidassertEquals(byte[] b1, byte[] b2)protected static voidassertEquals(byte expected, byte actual)protected static voidassertEquals(char expected, char actual)protected static voidassertEquals(double expected, double actual, double delta)protected static voidassertEquals(int[] b1, int[] b2)protected static voidassertEquals(int expected, int actual)protected static voidassertEquals(long expected, long actual)protected static voidassertEquals(short expected, short actual)protected static voidassertEquals(java.lang.Object expected, java.lang.Object actual)protected static voidassertFalse(boolean condition)protected static voidassertGreater(byte left, byte right)protected static voidassertGreater(char left, char right)protected static voidassertGreater(double left, double right)protected static voidassertGreater(int left, int right)protected static voidassertGreater(long left, long right)protected static voidassertGreater(short left, short right)protected static voidassertGreaterOrEqual(byte left, byte right)protected static voidassertGreaterOrEqual(char left, char right)protected static voidassertGreaterOrEqual(double left, double right)protected static voidassertGreaterOrEqual(int left, int right)protected static voidassertGreaterOrEqual(long left, long right)protected static voidassertGreaterOrEqual(short left, short right)protected static voidassertLower(byte left, byte right)protected static voidassertLower(char left, char right)protected static voidassertLower(double left, double right)protected static voidassertLower(int left, int right)protected static voidassertLower(long left, long right)protected static voidassertLower(short left, short right)protected static voidassertLowerOrEqual(byte left, byte right)protected static voidassertLowerOrEqual(char left, char right)protected static voidassertLowerOrEqual(double left, double right)protected static voidassertLowerOrEqual(int left, int right)protected static voidassertLowerOrEqual(long left, long right)protected static voidassertLowerOrEqual(short left, short right)protected static voidassertNotEquals(boolean expected, boolean actual)protected static voidassertNotEquals(byte[] b1, byte[] b2)protected static voidassertNotEquals(byte expected, byte actual)protected static voidassertNotEquals(char expected, char actual)protected static voidassertNotEquals(double expected, double actual, double delta)protected static voidassertNotEquals(int expected, int actual)protected static voidassertNotEquals(long expected, long actual)protected static voidassertNotEquals(short expected, short actual)protected static voidassertNotEquals(java.lang.Object expected, java.lang.Object actual)protected static voidassertNotNull(java.lang.Object object)protected static voidassertNotSame(java.lang.Object expected, java.lang.Object actual)protected static voidassertNull(java.lang.Object object)protected static voidassertSame(java.lang.Object expected, java.lang.Object actual)protected static voidassertTrue(boolean actual)protected static voidfail()protected static voidfail(java.lang.String msg)protected static voidfail(java.lang.Throwable e)protected static voidoutput(java.lang.String s)Shows the text, in the output listbox, after all tests were finished.protected voidrun()protected static voidstatus(java.lang.String s)Shows the text, in a limited (half screen width) region of the TestSuite screen.abstract voidtestRun()protected static voidupdateMem()Updates the label with the available memory.
-
-
-
Field Detail
-
assertionCounter
protected static int assertionCounter
-
learning
protected static boolean learning
Set this to true when your code is learning the right answers. It will not halt at each assertion failure, allowing you to know all the failures at once. When the test ends, it will display "success" even if there were failures.
-
-
Method Detail
-
testRun
public abstract void testRun()
-
run
protected void run()
-
output
protected static void output(java.lang.String s)
Shows the text, in the output listbox, after all tests were finished.
-
status
protected static void status(java.lang.String s)
Shows the text, in a limited (half screen width) region of the TestSuite screen.
-
updateMem
protected static void updateMem()
Updates the label with the available memory.
-
fail
protected static void fail(java.lang.Throwable e)
-
fail
protected static void fail(java.lang.String msg)
-
fail
protected static void fail()
-
assertFalse
protected static void assertFalse(boolean condition)
-
assertNotNull
protected static void assertNotNull(java.lang.Object object)
-
assertNotSame
protected static void assertNotSame(java.lang.Object expected, java.lang.Object actual)
-
assertSame
protected static void assertSame(java.lang.Object expected, java.lang.Object actual)
-
assertNull
protected static void assertNull(java.lang.Object object)
-
assertTrue
protected static void assertTrue(boolean actual)
-
assertEquals
protected static void assertEquals(int expected, int actual)
-
assertEquals
protected static void assertEquals(boolean expected, boolean actual)
-
assertEquals
protected static void assertEquals(java.lang.Object expected, java.lang.Object actual)
-
assertEquals
protected static void assertEquals(byte[] b1, byte[] b2)
-
assertEquals
protected static void assertEquals(int[] b1, int[] b2)
-
assertEquals
protected static void assertEquals(byte expected, byte actual)
-
assertEquals
protected static void assertEquals(char expected, char actual)
-
assertEquals
protected static void assertEquals(double expected, double actual, double delta)
-
assertEquals
protected static void assertEquals(long expected, long actual)
-
assertEquals
protected static void assertEquals(short expected, short actual)
-
assertGreater
protected static void assertGreater(char left, char right)
-
assertGreater
protected static void assertGreater(byte left, byte right)
-
assertGreater
protected static void assertGreater(short left, short right)
-
assertGreater
protected static void assertGreater(int left, int right)
-
assertGreater
protected static void assertGreater(long left, long right)
-
assertGreater
protected static void assertGreater(double left, double right)
-
assertGreaterOrEqual
protected static void assertGreaterOrEqual(char left, char right)
-
assertGreaterOrEqual
protected static void assertGreaterOrEqual(byte left, byte right)
-
assertGreaterOrEqual
protected static void assertGreaterOrEqual(short left, short right)
-
assertGreaterOrEqual
protected static void assertGreaterOrEqual(int left, int right)
-
assertGreaterOrEqual
protected static void assertGreaterOrEqual(long left, long right)
-
assertGreaterOrEqual
protected static void assertGreaterOrEqual(double left, double right)
-
assertLower
protected static void assertLower(char left, char right)
-
assertLower
protected static void assertLower(byte left, byte right)
-
assertLower
protected static void assertLower(short left, short right)
-
assertLower
protected static void assertLower(int left, int right)
-
assertLower
protected static void assertLower(long left, long right)
-
assertLower
protected static void assertLower(double left, double right)
-
assertLowerOrEqual
protected static void assertLowerOrEqual(char left, char right)
-
assertLowerOrEqual
protected static void assertLowerOrEqual(byte left, byte right)
-
assertLowerOrEqual
protected static void assertLowerOrEqual(short left, short right)
-
assertLowerOrEqual
protected static void assertLowerOrEqual(int left, int right)
-
assertLowerOrEqual
protected static void assertLowerOrEqual(long left, long right)
-
assertLowerOrEqual
protected static void assertLowerOrEqual(double left, double right)
-
assertBetween
protected static void assertBetween(char left, char mid, char right)
-
assertBetween
protected static void assertBetween(byte left, byte mid, byte right)
-
assertBetween
protected static void assertBetween(short left, short mid, short right)
-
assertBetween
protected static void assertBetween(int left, int mid, int right)
-
assertBetween
protected static void assertBetween(long left, long mid, long right)
-
assertBetween
protected static void assertBetween(double left, double mid, double right)
-
assertNotEquals
protected static void assertNotEquals(java.lang.Object expected, java.lang.Object actual)
-
assertNotEquals
protected static void assertNotEquals(int expected, int actual)
-
assertNotEquals
protected static void assertNotEquals(boolean expected, boolean actual)
-
assertNotEquals
protected static void assertNotEquals(byte expected, byte actual)
-
assertNotEquals
protected static void assertNotEquals(byte[] b1, byte[] b2)
-
assertNotEquals
protected static void assertNotEquals(char expected, char actual)
-
assertNotEquals
protected static void assertNotEquals(double expected, double actual, double delta)
-
assertNotEquals
protected static void assertNotEquals(long expected, long actual)
-
assertNotEquals
protected static void assertNotEquals(short expected, short actual)
-
-