forked from cpp-exercises/CardWar_B
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestRunner.cpp
26 lines (20 loc) · 822 Bytes
/
TestRunner.cpp
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
#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
using namespace doctest;
const int MIN_TESTS = 20;
struct ReporterGrader: public ConsoleReporter {
ReporterGrader(const ContextOptions& input_options)
: ConsoleReporter(input_options) {}
void test_run_end(const TestRunStats& run_stats) override {
ConsoleReporter::test_run_end(run_stats);
int numAsserts = run_stats.numAsserts >= MIN_TESTS? run_stats.numAsserts: MIN_TESTS;
float grade = (run_stats.numAsserts - run_stats.numAssertsFailed) * 100 / numAsserts;
// std::cout << "Grade: " << grade << std::endl;
}
};
REGISTER_REPORTER("grader", /*priority=*/1, ReporterGrader);
int main(int argc, char** argv) {
Context context;
context.addFilter("reporters", "grader");
return context.run();
}