The second issue is that you probably shouldn't use the Test module outside of test functions (those annotated with (:test)). The reason is that the Testmodule doesn't exist in release builds, and attempts to call into it will result in Symbol Not Found errors.
Asserts are a useful way to check for conditions at critical points in your code.
Assert code requires no special compiler commands to execute within the simulator, and are removed by the compiler when building release code.
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.
// Asserts can be called outside of test calls
function assertWithoutLogger(x, y) {
Test.assertEqual(x, y);
}
function compute(info) {
Test.assert(true);
return 5;
}
Error: Symbol Not Found Error
Details: 'Failed invoking <symbol>'