-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestCounter.cpp
More file actions
28 lines (24 loc) · 861 Bytes
/
TestCounter.cpp
File metadata and controls
28 lines (24 loc) · 861 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
#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
using namespace doctest;
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");
context.run();
printf("grade:100\n");
return 0;
}