[24:7] extends: object
The aunit (Aussom Unit) test class implements Aussom unit test framework. It can be used from the CLI but also from within an application such as Hogan.
test ()
Public default constructor.
setName (string Name = ""
)
Sets the name of the unit test suite.
Name
is a string with the test name to set.This
object.getName ()
Gets the name of the unit test suite.
A
string with the test name.setSilent (bool Silent
)
Sets the silent flag.
Silent
is a bool with true for silent and false for not.This
object.getSlient ()
Gets the slient flag.
A
bool with true for silent and false for not.add (string TestName, callback ToCall, bool DieOnFail = false
)
Adds a test function to the test suite.
TestName
is a string with the test name.ToCall
is a callback with the function to call for the test.DieOnFail
is a boolean that when set to true will make the unit test stop on failure. Default is false.This
object.run ()
Runs the test suite.
This
object.getResults ()
Produces a map with the test results including name, total, number ran, number passed, and number failed.
A
map with the results.expect (Item, ToBe
)
Expect helper function compares two items for equality.
Item
is the first item to compare.ToBe
is the second item to compare.A
bool with true if equal and false for not.expectNotNull (Item
)
Expect helper function expects value to not be null.
Item
is the item to check.A
bool with true if not null and false for not.expectNull (Item
)
Expect helper function expects value to be null.
Item
is the item to check.A
bool with true if null and false if not.expectString (Item
)
Expect helper function expects the provided item to be a string.
Item
is the item to check.A
bool with true if the item is a string and false if not.expectBool (Item
)
Expect helper function expects the provided item to be a bool.
Item
is the item to check.A
bool with true if the item is a bool and false if not.expectInt (Item
)
Expect helper function expects the provided item to be an int.
Item
is the item to check.A
bool with true if the item is a int and false if not.expectDouble (Item
)
Expect helper function expects the provided item to be a double.
Item
is the item to check.A
bool with true if the item is a double and false if not.expectNumber (Item
)
Expect helper function expects the provided item to be a type of number.
Item
is the item to check.A
bool with true if the item is a type of number and false if not.expectList (Item
)
Expect helper function expects the provided item to be a list.
Item
is the item to check.A
bool with true if the item is a list and false if not.expectMap (Item
)
Expect helper function expects the provided item to be a map.
Item
is the item to check.A
bool with true if the item is a map and false if not.expectObject (Item, string ClassName
)
Expect helper function expects the provided item to be an object.
Item
is the item to check.A
bool with true if the item is an object and false if not.expectCallback (Item
)
Expect helper function expects the provided item to be a callback.
Item
is the item to check.A
bool with true if the item is a callback and false if not.printResult ()
Prints the test results to standard output.
This
object.