I have a C library compiled with MinGW, Eclipse C project. Library consists of many modules, each module can be tested.
What is the best way (using MACROS or something) how to write tests for this library, compile it a run it in Eclipse/CDT IDE?
EDIT: I've seen that some people use
#ifdef TEST
int main(void)
{
...TEST LOGIC...
}
#endif
but don't know how to plug it into Eclipse.
Automated unit testing is a method of testing software. Units (small sections) of the code are rigorously checked to ensure they work correctly. A separate program can be written specifically to test the unit, using every reasonable piece of data the code might encounter in real-world use.
Unit testing can be done manually but is usually automated. Unit testing is a part of the test-driven development (TDD) methodology that requires developers to first write failing unit tests. Then they write code in order to change the application until the test passes.
The most scalable way to write unit tests in C is using a unit testing framework, such as: CppUTest. Unity. Google Test.
Jtest is an automated Java software testing and static analysis product developed by Parasoft. The product includes technology for Data-flow analysis, Unit test-case generation and execution, static analysis, and more.
I'd suggest to use CuTest with a Makefile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With