Module: Toybox.Test
Overview
The Test module provides a testing framework for Monkey C.
The test module provides the tools to implement your own
unit test and asserts in your source code. Unit tests take a
Logger object and allow for different levels of
output. Unit tests are annotated with :test
and ignored if testing is not
run. Asserts do not require the :test
annotation and will be compiled out
in release versions or you Connect IQ Content. A test RESULTS section
is printed to the console with the tests run, test status, and failure rates.
See Also:
Classes Under Namespace
Classes: AssertException, Logger
Instance Method Summary collapse
-
assert(test as Lang.Boolean) as Void
Throws an exception if the test is
false
. -
assertEqual(value1 as Lang.Object, value2 as Lang.Object or Null) as Void
Throws an exception if value1 and value2 are not equal.
-
assertEqualMessage(value1 as Lang.Object, value2 as Lang.Object or Null, message as Lang.String) as Void
Throws an exception if value1 and value2 are not equal followed by a String defined by the developer.
-
assertMessage(test as Lang.Boolean, message as Lang.String) as Void
Throws an exception if the test is
false
followed by a String defined by the developer. -
assertNotEqual(value1 as Lang.Object, value2 as Lang.Object or Null) as Void
Throws an exception if value1 and value2 are equal.
-
assertNotEqualMessage(value1 as Lang.Object, value2 as Lang.Object or Null, message as Lang.String) as Void
Throws an exception if value1 and value2 are equal followed by a String defined by the developer.
Instance Method Details
assert(test as Lang.Boolean) as Void
Throws an exception if the test is false
.
assertEqual(value1 as Lang.Object, value2 as Lang.Object or Null) as Void
Throws an exception if value1 and value2 are not equal.
The objects passed to this function must implement the Object.equals() method which compares both type and value.
assertEqualMessage(value1 as Lang.Object, value2 as Lang.Object or Null, message as Lang.String) as Void
Throws an exception if value1 and value2 are not equal followed by a String defined by the developer.
The objects passed to this function must implement the Object.equals() method which compares both type and value.
assertMessage(test as Lang.Boolean, message as Lang.String) as Void
Throws an exception if the test is false
followed by a
String defined by the developer.
assertNotEqual(value1 as Lang.Object, value2 as Lang.Object or Null) as Void
Throws an exception if value1 and value2 are equal.
The objects passed to this function must implement the Object.equals() method which compares both type and value.
assertNotEqualMessage(value1 as Lang.Object, value2 as Lang.Object or Null, message as Lang.String) as Void
Throws an exception if value1 and value2 are equal followed by a String defined by the developer.
The objects passed to this function must implement the Object.equals() method which compares both type and value.