Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amdmi3/testing.h
Small and simple single-header library for writing C++ unit tests
https://github.com/amdmi3/testing.h
c-plus-plus header-only testing unit-testing
Last synced: about 2 hours ago
JSON representation
Small and simple single-header library for writing C++ unit tests
- Host: GitHub
- URL: https://github.com/amdmi3/testing.h
- Owner: AMDmi3
- License: other
- Created: 2012-03-13T22:16:23.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-05-19T13:17:00.000Z (over 8 years ago)
- Last Synced: 2023-03-11T16:08:14.596Z (over 1 year ago)
- Topics: c-plus-plus, header-only, testing, unit-testing
- Language: C++
- Homepage:
- Size: 32.2 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# testing.h #
This is a simple C++11 unit test frame work.
## Features ##
* Single header file, no dependencies
* Provides detailed information of which expressions are tested and test results
* Colored outputTo use this in your project, you may just grab testing.h and add it to
your source tree.## Short example ##
```c++
#include "testing.h"BEGIN_TEST()
EXPECT_TRUE(MyFunc() == "foo");
EXPECT_EQUAL(GetSomeStr(), "ExpectedString");
EXPECT_EXCEPTION(MyFunc(), std::runtime_error);
END_TEST()
```Possible output:
```
PASS: MyFunc() == "foo"
FAIL: MyFunc() returned "UnexpectedString" while expected "ExpectedString"
FAIL: MyFunc() hasn't thrown expected exception std::runtime_error
```## Longer example ##
See [demo.cc](demo.cc), which demonstrates almost all framework abilities. You
may compile and run the demo by calling ```make```.## License ##
2-clause BSD, see [COPYING](COPYING) or source files.
## Author ##
Dmitry Marakasov
## Contributors ##
* [Vladimir Gamalian](https://github.com/vladimirgamalian)