How do you do unit tests for the C language project? What tools and frameworks are used?
In addition, may I ask if there are any convenient unit testing techniques for using Clion IDE?
Catch, please look directly at here first:
Introduction to C++ Unit Testing _Catch
Then your second question, how can Clion easily use unit tests? Use Catch directly, why? Because the author of Catch is now working in Clion, it is painless to embed Clion and provides more functions:To Catch a clion
The initial function is not listed, how to use it in the terminal
CatchHow to use it in Clion, the generated result is in the console:
All tests passed (1 assertion in 1 test case)
Since integrated into
ClionInside, it is natural to add some functions that IDE should have:
- Added a separate
Unit test tool, you can view the unit tests that the jump succeeded or failed.
- Support unit test report export view, use case execution time.
Run | Edit Configurations -> “+” -> Catch Test
If you want to know more, read the official documents written by the author directly:
Update a c++ Unit Test Resource Link: Includes c++ Unit Test Framework /TDD Books/Online Courses
If only the algorithm library/standard library is written, then
catchThe most basic functions can meet the requirements. If the code has system calls/databases, mock is required, and priority is given to checking
catchWhether the requirements are met; if not, use