forked from AfikPeretz/NumberWithUnits.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCounter.cpp
More file actions
30 lines (24 loc) · 783 Bytes
/
TestCounter.cpp
File metadata and controls
30 lines (24 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
using namespace doctest;
const int MIN_TESTS = 20;
int return_code = -1;
struct ReporterCounter: public ConsoleReporter {
ReporterCounter(const ContextOptions& input_options)
: ConsoleReporter(input_options) {}
void test_run_end(const TestRunStats& run_stats) override {
if (run_stats.numAsserts >= MIN_TESTS) {
return_code = 0;
} else {
std::cout << "Please write at least " << MIN_TESTS << " tests! " << std::endl;
return_code = 1;
}
}
};
REGISTER_REPORTER("counter", 1, ReporterCounter);
int main(int argc, char** argv) {
Context context;
context.addFilter("reporters", "counter");
context.run();
return return_code;
}