/cxx-tap

Test Anything Protocol (TAP) Producer for C++

Primary LanguageC++MIT LicenseMIT

SYNOPSIS

Test Anything Protocol for C++ based on the TAP 13 Spec.

USAGE

This module is designed to work with the datcxx build tool. To add this module to your project us the following command...

build add heapwolf/cxx-tap

TEST

build test

EXAMPLE

CODE

#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 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