https://github.com/heapwolf/cxx-tap
Test Anything Protocol (TAP) Producer for C++
https://github.com/heapwolf/cxx-tap
assertions tap test testing
Last synced: 8 months ago
JSON representation
Test Anything Protocol (TAP) Producer for C++
- Host: GitHub
- URL: https://github.com/heapwolf/cxx-tap
- Owner: heapwolf
- License: mit
- Created: 2015-06-05T12:56:48.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2021-06-24T12:17:59.000Z (almost 5 years ago)
- Last Synced: 2025-03-29T19:22:27.391Z (about 1 year ago)
- Topics: assertions, tap, test, testing
- Language: C++
- Homepage:
- Size: 4.9 MB
- Stars: 27
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
Test Anything Protocol for `C++` based on the [TAP 13][1] Spec.
# USAGE
This module is designed to work with the [`datcxx`][0] build tool. To add this
module to your project us the following command...
```bash
build add heapwolf/cxx-tap
```
# TEST
```bash
build test
```
# EXAMPLE
### CODE
```c++
#include "deps/heapwolf/cxx-tap/index.hxx"
int main () {
TAP::Test t;
t.test("Bazz", [&](auto a) {
a->ok(true, "true is true");
a->test("Quxx", [&] (auto b) {
b->ok(true, "nested");
b->end();
a->end();
});
});
t.test("Foo", [&](auto t) {
float a = 2.23;
int b = 2;
t->equal(a, b, "a float is not an int");
t->ok(false, "true is also true");
t->end(); // t is not automatically called for children.
});
// t.end(); // is automatically called by t's destructor.
}
```
### OUTPUT
```tap
TAP version 13
ok 1 - true is true
ok 2 - nested
not ok 3 - a float is not an int
---
operator: equal
expected: 2
actual: 2.23
...
not ok 4 - true is also true
---
operator: ok
expected: false
actual: true
...
1..3
# tests 3
# pass 2
# fail 1
```
[0]:https://github.com/datcxx/build
[1]:https://testanything.org/tap-version-13-specification.html