I'm currently trying to grasp the concept of unit testing, particularly in the context of c program. I've gone through some resources, but I'm still struggling to fully understand how to apply it practically.
Embedded C/C++ Unit Testing Basics - GeeksforGeeks
From what I gather, unit testing is important for identifying bugs and errors in code. However, I'm having trouble figuring out the process of implementing unit testing for a program.
Take a simple example
Code:
#include<stdio.h>
int ADD ( int x, int y);
int main()
{
int a = 10;
int b = 2;
int result;
result = ADD ( a, b);
printf(" Result : %d", result);
return 0;
}
int ADD ( int x, int y)
{
int r = x + y;
return r;
}
Could someone kindly provide a straightforward explanation or perhaps a simple example to illustrate how unit testing works?