Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Functions
geometrize::test Namespace Reference

Functions

int runApp (QApplication &app)
 runApp Runs the application in self-test mode. More...
 
void runSelfTests (const std::string &testScriptsDirectory)
 runSelfTests Runs the scripts in the given directory, one by one. More...
 

Function Documentation

int geometrize::test::runApp ( QApplication &  app)

runApp Runs the application in self-test mode.

Parameters
appThe application.
Returns
0 on success, any other return code if there was an error running the tests.
24 {
25  return geometrize::cli::runApp(app);
26 }
int runApp(QApplication &app)
runApp Runs the application in console mode. Note that since Windows does not support dual-mode appli...
Definition: commandlineparser.cpp:104

Here is the call graph for this function:

void geometrize::test::runSelfTests ( const std::string &  testScriptsDirectory)

runSelfTests Runs the scripts in the given directory, one by one.

Parameters
testScriptsDirectoryThe directory of test scripts to execute.
29 {
30  if(!geometrize::util::directoryExists(testScriptsDirectory)) {
31  assert(0 && "Given test scripts directory does not exist");
32  return;
33  }
34 
35  const std::vector<std::string> testScripts{geometrize::util::getScriptsForPath(testScriptsDirectory)};
36 
37  if(testScripts.empty()) {
38  assert(0 && "Did not find any test scripts in the given test directory");
39  return;
40  }
41 
42  for(const auto& scriptPath : testScripts) {
43  const std::string scriptCode = geometrize::util::readFileAsString(scriptPath);
44  if(scriptCode.empty()) {
45  assert(0 && "Failed to read script file or it was empty");
46  }
47 
49  geometrize::script::runScript(scriptCode, *engine.get());
50  }
51 }
std::string readFileAsString(const std::string &filePath)
readFileAsString Reads a file, returning a string containing the contents.
Definition: util.cpp:112
std::vector< std::string > getScriptsForPath(const std::string &dirPath)
getScriptsForPath Gets the absolute file paths to the script files (*.chai) for the given directory...
Definition: util.cpp:193
bool directoryExists(const std::string &dirPath)
directoryExists Checks if a directory exists, returns true if it does.
Definition: util.cpp:92
void runScript(const std::string &code, chaiscript::ChaiScript &runner)
runScript Evaluates the provided script code.
Definition: scriptrunner.cpp:16
std::unique_ptr< chaiscript::ChaiScript > createFunctionalTestRunnerEngine()
createFunctionalTestRunnerEngine Creates a Chaiscript engine object for running functional tests...
Definition: chaiscriptcreator.cpp:94

Here is the call graph for this function: