Uh oh!
There was an error while loading. Please reload this page.
forked from ameer2158/NoteBook_2
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRunner.cpp
More file actions
Latest commit
26 lines (20 loc) · 822 Bytes
/
Copy pathTestRunner.cpp
File metadata and controls
26 lines (20 loc) · 822 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
#defineDOCTEST_CONFIG_IMPLEMENT
#include"doctest.h"
usingnamespacedoctest;
constintMIN_TESTS = 20;
structReporterGrader: publicConsoleReporter {
ReporterGrader(const ContextOptions& input_options)
: ConsoleReporter(input_options) {}
voidtest_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);
intmain(int argc, char** argv) {
Context context;
context.addFilter("reporters", "grader");
return context.run();
}