doctest

FORK: The fastest feature-rich C++11/14/17/20 single-header testing framework
git clone https://git.neptards.moe/neptards/doctest.git
Log | Files | Refs | README

hello_world.cpp (322B)


      1 #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
      2 #include "doctest.h"
      3 
      4 int fact(int n) {
      5     return n <= 1 ? n : fact(n - 1) * n;
      6 }
      7 
      8 TEST_CASE("testing the factorial function") {
      9     CHECK(fact(0) == 1); // should fail
     10     CHECK(fact(1) == 1);
     11     CHECK(fact(2) == 2);
     12     CHECK(fact(3) == 6);
     13     CHECK(fact(10) == 3628800);
     14 }