Hardware Reference
In-Depth Information
Using the Basic Functions
With these functions, you can create custom test suites and verify your code or project. The code in Listing 13-5 is an
example that forces a result to be TRUE or FALSE . It is important to keep track of all test results, but especially failure
conditions. This way at a glance the test issue can be found quickly. The failure condition can be described in the test
name, and the result would be TRUE , which will appear as OK in the result.
Listing 13-5. Bare-Bones Test Sketch
#include <ArduinoTestSuite.h>
//************************************************************************
void setup()
{
boolean result;
ATS_begin("Arduino", "My bare bones tests");
result = true;
ATS_PrintTestStatus("My bare bones test", result);
result = false;
ATS_PrintTestStatus("1. My bare bones test", result);
ATS_end();
}
void loop()
{
}
Here is the test result:
info.MANUFACTURER = Arduino
info.CPU-NAME = ATmega328P
info.GCC-Version = 4.3.2
info.AVR-LibC-Ver = 1.6.4
info.Compiled-date = Oct 20 2010
info.Test-Suite-Name = My bare bones tests
info.Free-memory = 1442 bytes
My bare bones test ... ok
1. My bare bones test ... FAIL
--------------------------
Ran 2 tests in 1.443s
FAILED (failures=1)
Once the test is complete, you will be able to see how many test were run, how long the tests took, and how many
failures occurred. You can examine the tests to identify what happened. Additionally, you will get information about
how much memory was available when you ran the tests. In this case, info.Free-memory shows that 1442 bytes were
free in this test run.
 
Search WWH ::




Custom Search