STORMM Source Documentation
Loading...
Searching...
No Matches
checklist.h
1// -*-c++-*-
2#ifndef STORMM_CHECKLIST_H
3#define STORMM_CHECKLIST_H
4
5#include <string>
6#include <vector>
7#include "copyright.h"
8#include "unit_test_enumerators.h"
9
10namespace stormm {
11namespace testing {
12
14class CheckList {
15public:
16
18 CheckList();
19
20 // Overload the += operator to act similarly to the logResult member function
21 CheckList& operator+=(CheckResult rhs);
22
26 void logResult(CheckResult result);
27
37 void changeSection(const std::string &section_name);
38 void changeSection(const int section_index);
40
44 int getSectionIndex(const std::string &section_name) const;
45
49 std::string getSectionName(const int section_index) const;
50
52 int getCurrentSection() const;
53
58 int getSuccessCount(int section_index = -1) const;
59
64 int getFailureCount(int section_index = -1) const;
65
70 int getSkipCount(int section_index = -1) const;
71
76 int getIgnoredFailureCount(int section_index = -1) const;
77
81 void printSummary(TestVerbosity verbosity = TestVerbosity::COMPACT) const;
82
84 int getOverallFailureCount() const;
85
87 int getOverallSkipCount() const;
88
89private:
90 int current_section;
92 std::vector<std::string> sections;
93 std::vector<int> successes;
94 std::vector<int> skips;
95 std::vector<int> ignored_failures;
98 std::vector<int> failures;
99};
100
101} // namespace testing
102} // namespace stormm
103
104#endif
int getSectionIndex(const std::string &section_name) const
Get the index of a test section based on its name.
Definition checklist.cpp:166
void changeSection(const std::string &section_name)
Switch to a new (or previously started) section of the test case CheckList.
Definition checklist.cpp:71
int getSuccessCount(int section_index=-1) const
Get the current number of successes in a particular section. The default value of -1 returns the coun...
Definition checklist.cpp:189
int getSkipCount(int section_index=-1) const
Get the current number of skipped tests in a particular section. The default value of -1 returns the ...
Definition checklist.cpp:211
void logResult(CheckResult result)
Log a result in a checklist based on the current section setting.
Definition checklist.cpp:53
int getIgnoredFailureCount(int section_index=-1) const
Get the current number of ignored test failures in a particular section. The default value of -1 retu...
Definition checklist.cpp:222
std::string getSectionName(const int section_index) const
Get the name of a test section based on its index.
Definition checklist.cpp:175
int getOverallFailureCount() const
Get the total number of failures across all sections.
Definition checklist.cpp:233
int getCurrentSection() const
Get the current section number.
Definition checklist.cpp:184
int getOverallSkipCount() const
Get the total number of skipped tests across all sections.
Definition checklist.cpp:243
void printSummary(TestVerbosity verbosity=TestVerbosity::COMPACT) const
Print a summary of test results from this checklist.
Definition checklist.cpp:253
int getFailureCount(int section_index=-1) const
Get the current number of failures in a particular section. The default value of -1 returns the count...
Definition checklist.cpp:200
CheckList()
Constructor for the CheckList object prepares a blank slate.
Definition checklist.cpp:24