Friday, 10 June 2016

How to use Unity for testing code

Unit tests are important for testing code. Unity is a library for testing C code.

To use unity add this header.

The main function starts Unity. Runs the test_stuff(). Then stops Unity.

The function for testing code. This tests if the condition is true.

This tests if the 32 bit int is equal to 10.

Function to test null pointers. If the pointer is null then it will fail and give a message.

No comments:

Post a Comment