13 namespace ElmerModuleDriver{
48 int Test(
int argc,
char *argv[])
50 int com_initialized = COM_initialized();
51 bool com_initialized_pass = (com_initialized <= 0);
53 COM_init(&argc, &argv);
54 if(com_initialized_pass)
55 com_initialized = (COM_initialized() > 0);
57 std::cout <<
"COM not initialized!" << std::endl;
71 int clerr = comline.ProcessOptions();
73 if(!comline.GetOption(
"help").empty()){
75 std::cout << comline.LongUsage() << std::endl;
77 std::cout <<
"ElmerModuleDriver::Test: Exiting test function (success)" << std::endl;
81 std::cout << comline.ErrorReport() << std::endl
82 << std::endl << comline.ShortUsage() << std::endl;
84 std::cout <<
"ElmerModuleDriver::Test: Exiting test function (fail)" << std::endl;
90 std::ostream *Out = &std::cout;
94 std::string OutFileName(comline.GetOption(
"output"));
95 std::string TestName(comline.GetOption(
"name"));
96 std::string ListName(comline.GetOption(
"list"));
97 std::string sverb(comline.GetOption(
"verblevel"));
98 std::string SourcePath(comline.GetOption(
"source"));
103 if(sverb !=
".true."){
104 std::istringstream Istr(sverb);
112 if(!OutFileName.empty()){
113 Ouf.open(OutFileName.c_str());
115 std::cout <<
"ElmerModuleDriver::Test> Error: Could not open output file, "
116 << OutFileName <<
" for test output. Exiting (fail)." << std::endl;
123 std::cout <<
"ElmerModuleDriver::Test: Entering test function" << std::endl;
131 if(!SourcePath.empty()){
136 if(!TestName.empty()){
138 test.
RunTest(TestName,results);
142 else if(!ListName.empty()){
143 std::ifstream ListInf;
144 ListInf.open(ListName.c_str());
146 std::cout <<
"ElmerModuleDriver::Test> Error: Could not open list of tests in file "
147 << ListName <<
". Exiting (fail)." << std::endl;
150 std::string testname;
151 while(std::getline(ListInf,testname))
152 test.
RunTest(testname,results);
161 if(com_initialized_pass)
162 com_initialized_pass = (COM_initialized() <= 0);
164 *Out << results << std::endl;
170 *Out <<
"ElmerModuleDriver::Test: Exiting test function (success)" << std::endl;
176 int main(
int argc,
char *argv[])
virtual void RunTest(const std::string &name, ResultsType &result)
Runs a test specified by name.
void SetSourceDirPath(std::string input)
Sets the string value of the testing source directory.
int Test(int argc, char *argv[])
Drives the ElmerModuleDriver::TestObject.
Project-specific testing object.
ComLineObject for ElmerModuleDriver testing command-line interface.
IRAD::Util::TestResults TestResults
Project-specific test results type.
Testing utilities for ElmerModuleDriver.
virtual void Process(ResultsType &result)