Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitya57/cxxunit
Simple C++ unit testing library
https://github.com/mitya57/cxxunit
cplusplus header-only testing unit-testing
Last synced: 21 days ago
JSON representation
Simple C++ unit testing library
- Host: GitHub
- URL: https://github.com/mitya57/cxxunit
- Owner: mitya57
- Created: 2017-10-14T16:06:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-06T10:31:02.000Z (8 months ago)
- Last Synced: 2024-10-13T17:05:24.741Z (24 days ago)
- Topics: cplusplus, header-only, testing, unit-testing
- Language: C++
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkd
Awesome Lists containing this project
README
This is a simple C++ unit testing library. It requires C++11 or newer.
Usage example:
```c++
#include "testing.hpp"struct test_FirstAndTrivial: TestCase {
void run() override {
unsigned int val = 1;ASSERT_EQUAL((val + 1) / 2, 1);
}
};REGISTER_TEST(test_FirstAndTrivial, "Arithmetic operations");
```In the `run` method, the following macros are supported:
- `ASSERT_TRUE(expression)`;
- `ASSERT_FALSE(expression)`;
- `ASSERT_RELATION(e1, rel, e2)`, for example `ASSERT_RELATION(e1, <=, e2)`;
- `ASSERT_EQUAL(e1, e2)`;
- `ASSERT_ALMOST_EQUAL(e1, e2, precision)`;
- `ASSERT_FLOATS_EQUAL(e1, e2)` — for fuzzy comparison of floats and doubles;
- `ASSERT_STRINGS_EQUAL(e1, e2)` — with better formatted output for strings;
- `ASSERT_THROWS(exception_class, expression)`.