STORMM Source Documentation
Loading...
Searching...
No Matches
test_environment.h
1// -*-c++-*-
2#ifndef STORMM_TEST_ENVIRONMENT_H
3#define STORMM_TEST_ENVIRONMENT_H
4
5#include <string>
6#include <vector>
7#include "copyright.h"
8#include "Constants/behavior.h"
9#include "Namelists/command_line_parser.h"
10#include "unit_test_enumerators.h"
11
12namespace stormm {
13namespace testing {
14
15using constants::ExceptionResponse;
16using namelist::CommandLineParser;
17
22public:
23
37 TestEnvironment(int argc, const char* argv[], CommandLineParser *clip,
38 TmpdirStatus tmpdir_required = TmpdirStatus::NOT_REQUIRED,
39 ExceptionResponse policy = ExceptionResponse::WARN);
40
41 TestEnvironment(int argc, const char* argv[],
42 TmpdirStatus tmpdir_required = TmpdirStatus::NOT_REQUIRED,
43 ExceptionResponse policy = ExceptionResponse::WARN);
44
45 TestEnvironment(int argc, const char* argv[], ExceptionResponse policy);
47
55
57 TestVerbosity getVerbosity() const;
58
62 double getTolerance() const;
63
66 int getRandomSeed() const;
67
69 std::string getStormmHomePath() const;
70
72 std::string getStormmSourcePath() const;
73
75 std::string getTemporaryDirectoryPath() const;
76
78 bool getTemporaryDirectoryAccess() const;
79
81 bool doIntensiveTests() const;
82
86 std::vector<std::string> getListOfFilesCreated() const;
87
90 SnapshotOperation takeSnapshot() const;
91
93 bool getDisplayTimingsOrder() const;
94
98 void setFileRemoval(const bool remove_files_in);
99
107 void logFileCreated(const std::string &path);
108
122 void logDirectoryCreated(const std::string &path);
123 void logDirectoryCreated(const std::vector<std::string> &paths);
125
126private:
127
129 CommandLineParser user_mods;
130
132 TestVerbosity verbose_level;
133
136 double general_tolerance;
137
140 int random_seed;
141
143 std::string stormm_home_path;
144
146 std::string stormm_source_path;
147
150 std::string tmpdir_path;
151
155 bool tmpdir_created;
156
159 bool tmpdir_writeable;
160
164 std::vector<std::string> files_created;
165
167 std::vector<std::string> directories_created;
168
170 bool remove_files;
171
174 bool do_intensive_tests;
175
180 SnapshotOperation snapshot_behavior;
181
183 bool display_time;
184};
185
186} // namespace testing
187} // namespace stormm
188
189#endif
A class for collecting command line information. The class object will function somewhat like a namel...
Definition command_line_parser.h:30
double getTolerance() const
Get the general tolerance that can be applied in blanket fashion across many tests....
Definition test_environment.cpp:344
std::vector< std::string > getListOfFilesCreated() const
Get the list of files that this test program has been given responsibility. It will assume that these...
Definition test_environment.cpp:379
void logFileCreated(const std::string &path)
Catalog that a file has been created by the program. This function will not actually check that the f...
Definition test_environment.cpp:399
std::string getStormmSourcePath() const
Get the STORMM source root path.
Definition test_environment.cpp:359
bool getTemporaryDirectoryAccess() const
Check whether the temporary directory is accessible to the program.
Definition test_environment.cpp:369
TestEnvironment(int argc, const char *argv[], CommandLineParser *clip, TmpdirStatus tmpdir_required=TmpdirStatus::NOT_REQUIRED, ExceptionResponse policy=ExceptionResponse::WARN)
The TestEnvironment constructor takes command line arguments but also searches for native environment...
Definition test_environment.cpp:32
bool getDisplayTimingsOrder() const
Return the directive on displaying timings at the end of a test program.
Definition test_environment.cpp:389
SnapshotOperation takeSnapshot() const
Return whether to record a snapshot of the current data into the named file, or compare the data to a...
Definition test_environment.cpp:384
bool doIntensiveTests() const
Get the directives as to intensive unit test execution.
Definition test_environment.cpp:374
void logDirectoryCreated(const std::string &path)
Catalog that a directory has been created by the program. As above, this function will take the devel...
Definition test_environment.cpp:416
void setFileRemoval(const bool remove_files_in)
Set the file removal flag.
Definition test_environment.cpp:394
TestVerbosity getVerbosity() const
Get the verbosity level requested for this test environment.
Definition test_environment.cpp:339
int getRandomSeed() const
Get the random seed from the test environment. Separate random seeds can be supplied to any random nu...
Definition test_environment.cpp:349
std::string getStormmHomePath() const
Get the STORMM home (test executable and installed library) path.
Definition test_environment.cpp:354
~TestEnvironment()
Destructor for the TestEnvironment object must delete the temporary directory if it was created by th...
Definition test_environment.cpp:320
std::string getTemporaryDirectoryPath() const
Get the temporary directory path that the test environment can use to store files.
Definition test_environment.cpp:364