11.2.5.1.5 Step 5. Write a Testrunner
Rewrite your main.c and add tests to it. For information on how to write more advanced tests see: https://github.com/ThrowTheSwitch/Unity/blob/master/docs/UnityGettingStartedGuide.md.
For example:
#define F_CPU 1000000UL
#include "mcc_generated_files/mcc.h"
#include <util/delay.h>
#include "unity.h"
void test_function1() {
// Simple demo of working test
TEST_ASSERT_TRUE(1);
}
void test_function2() {
// Simple demo of failing test
TEST_ASSERT_FALSE(1);
}
int run_unit_tests(void)
{
UnityBegin("main.c");
RUN_TEST(test_function1);
RUN_TEST(test_function2);
UnityEnd();
return 0;
}
int main(void)
{
// Initialize drivers from MCC
SYSTEM_Initialize();
_delay_ms(1000);
run_unit_tests();
}
void setUp (void) {}
void tearDown (void) {}