https://github.com/fcf-framework/fcftest
Provides the FCF_TEST macro to perform the check in unit tests
https://github.com/fcf-framework/fcftest
cpp unittest
Last synced: 8 months ago
JSON representation
Provides the FCF_TEST macro to perform the check in unit tests
- Host: GitHub
- URL: https://github.com/fcf-framework/fcftest
- Owner: fcf-framework
- License: mit
- Created: 2025-01-21T03:28:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-21T03:56:16.000Z (about 1 year ago)
- Last Synced: 2025-03-15T08:25:39.471Z (about 1 year ago)
- Topics: cpp, unittest
- Language: C++
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fcfTest
Provides the FCF_TEST macro to perform the check in unit tests
The library is distributed as a header file `fcfTest/test.hpp`
## Description of macros
### FCF_TEST(a_expression [, a_observedVariables ...])
The macro performs the "`(a_expression) ==true`" test, and if the result of the calculation does not satisfy the equality, the exception is called std:::runtime_error.
The text of the message contains the file name and the line number where the macro FCF_TEST was called, as well as the values of the additional variables `a_observedVariables`.
### Example
```c++
#include
#include
int main(int a_argc, char* a_argv[]){
std::vector vec;
vec.push_back("test");
FCF_TEST(vec.size() == 2, vec.size());
return 0;
}
```
__Output:__
```stdout
terminate called after throwing an instance of 'std::runtime_error'
what(): Test error: vec.size() == 2 [FILE: /home/phoenix/Development/projects/fcfcpp/fcfMath/libraries/fcfBasis/test/tests/main.cpp:7]
Values:
vec.size(): 1
```