BSP430
20141115
Board Support Package for MSP430 microcontrollers
|
The <bsp430/utility/unittest.h> header provides a simple way to provide unit tests on MSP430. The core functionality provides a standard header emitted to the console, execution of code interspersed with validation of expected results, and a standard footer. External scripts can be used to automate the test infrastructure. In addition to text output, pass and fail states are demonstrated using LEDs.
Output from the following example is:
# sync... # sync... # sync... # sync... # sync... FAIL [29]: unconditional pass [31]: 1 == 1 pass [32]: 1 != 2 pass [33]: NOT 1 != 1 pass [34]: NOT 1 == 2 FAIL [37]: 1==rv: 1 != 42 # FAIL 2 pass 4 # ...done # ...done # ...done # ...done # ...done
When compiled using:
make PLATFORM=exp430f5438 realclean EXT_CPPFLAGS=-DAPP_ONLY_PASSING install
the output is:
# sync... # sync... # sync... # sync... # sync... pass [31]: 1 == 1 pass [32]: 1 != 2 pass [33]: NOT 1 != 1 pass [34]: NOT 1 == 2 # PASSED 4 # ...done # ...done # ...done # ...done # ...done