Make a little macro that helps add tests by the function name.

master
Zed A. Shaw 1 month ago
parent ef8e63e7fb
commit 9ca040d383
  1. 2
      include/fuc2/testing.hpp
  2. 1
      src/testing.cpp
  3. 6
      tests/sample1.cpp
  4. 4
      tests/sample_failing.cpp

@ -5,6 +5,8 @@
#include <functional>
namespace fuc2 {
#define TEST(N) {#N, N}
using Func = std::function<void()>;
using Case = std::pair<std::string, Func>;

@ -4,6 +4,7 @@
#include "fuc2/testing.hpp"
namespace fuc2 {
std::string craft_error(
const std::string& type,
const std::string& test,

@ -59,9 +59,9 @@ namespace sample1 {
.name="std::deque basic operations",
.options={ .fail_fast=false },
.tests={
{"test_push_pop_back", test_push_pop_back},
{"test_push_pop_front", test_push_pop_front},
{"test_push_blows_up", test_push_blows_up},
TEST(test_push_pop_back),
TEST(test_push_pop_front),
TEST(test_push_blows_up),
}
};
}

@ -39,8 +39,8 @@ namespace sample_failing {
.name="std::deque failing ops",
.options={ .fail_fast=false },
.tests={
{"fail_push_pop_back", fail_push_pop_back},
{"fail_blows_up", fail_blows_up},
TEST(fail_push_pop_back),
TEST(fail_blows_up),
}
};
}

Loading…
Cancel
Save