BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FolderBasedTest Class Reference

Convenience class which creates a directory on disk for test content. More...

Inheritance diagram for FolderBasedTest:
[legend]
Collaboration diagram for FolderBasedTest:
[legend]

Public Member Functions

 FolderBasedTest (const std::string &test_dir)
 
 ~FolderBasedTest ()
 
std::string createEmptyDir (const std::string &subdir) const
 Creates an empty directory in main test folder. More...
 
std::string testDir () const
 
std::string testPath () const
 Return full path to the test folder. Located in CMAKE_BINARY_DIR/test_output/<m_test_dir>. More...
 

Protected Attributes

std::string m_test_dir
 

Detailed Description

Convenience class which creates a directory on disk for test content.

Definition at line 23 of file folderbasedtest.h.

Constructor & Destructor Documentation

◆ FolderBasedTest()

FolderBasedTest::FolderBasedTest ( const std::string &  test_dir)

Definition at line 19 of file folderbasedtest.cpp.

19  : m_test_dir(test_dir)
20 {
22 }
std::string m_test_dir
std::string CreateTestDirectory(const std::string &test_sub_dir)
Creates test directory in main test folder and returns full path.
Definition: test_utils.cpp:40

References TestUtils::CreateTestDirectory(), and m_test_dir.

Here is the call graph for this function:

◆ ~FolderBasedTest()

FolderBasedTest::~FolderBasedTest ( )
default

Member Function Documentation

◆ createEmptyDir()

std::string FolderBasedTest::createEmptyDir ( const std::string &  subdir) const

Creates an empty directory in main test folder.

Remove recursively previous one with the same name, if exist.

Definition at line 39 of file folderbasedtest.cpp.

40 {
41  auto path = ModelView::Utils::join(testPath(), subdir);
44  return path;
45 }
std::string testPath() const
Return full path to the test folder. Located in CMAKE_BINARY_DIR/test_output/<m_test_dir>.
MVVM_MODEL_EXPORT void remove_all(const std::string &path)
Removes directory with all its content.
Definition: fileutils.cpp:67
MVVM_MODEL_EXPORT std::string join(const std::string &part1, const std::string &part2)
Joins two path elements into the path.
Definition: fileutils.cpp:37
MVVM_MODEL_EXPORT bool create_directory(const std::string &path)
Create directory, parent directory must exist.
Definition: fileutils.cpp:47

References ModelView::Utils::create_directory(), ModelView::Utils::join(), ModelView::Utils::remove_all(), and testPath().

Here is the call graph for this function:

◆ testDir()

std::string FolderBasedTest::testDir ( ) const

Definition at line 24 of file folderbasedtest.cpp.

25 {
26  return m_test_dir;
27 }

References m_test_dir.

◆ testPath()

std::string FolderBasedTest::testPath ( ) const

Return full path to the test folder. Located in CMAKE_BINARY_DIR/test_output/<m_test_dir>.

Definition at line 31 of file folderbasedtest.cpp.

32 {
34 }
std::string TestDirectoryPath(const std::string &test_sub_dir)
Returns full path to the main test folder in CMAKE_BINARY_DIR.
Definition: test_utils.cpp:47

References m_test_dir, and TestUtils::TestDirectoryPath().

Referenced by createEmptyDir().

Here is the call graph for this function:

Member Data Documentation

◆ m_test_dir

std::string FolderBasedTest::m_test_dir
protected

Definition at line 35 of file folderbasedtest.h.

Referenced by FolderBasedTest(), testDir(), and testPath().


The documentation for this class was generated from the following files: