3#include <test/jtx/TestSuite.h>
5#include <xrpl/basics/contract.h>
7#include <boost/filesystem.hpp>
20 using path = boost::filesystem::path;
32 if (is_directory(toRm) && is_empty(toRm))
35 test_.
log <<
"Expected " << toRm.string() <<
" to be an empty existing directory."
43 using namespace boost::filesystem;
45 static auto subDirCounter = 0;
59 Throw<std::runtime_error>(
"Cannot create directory: " +
subDir_.string());
67 using namespace boost::filesystem;
101 bool useCounter =
true,
116 Throw<std::runtime_error>(
"Refusing to overwrite existing file: " +
file_.string());
124 using namespace boost::filesystem;
132 test_.
log <<
"Expected " <<
file_.string() <<
" to be an existing file."
152 return boost::filesystem::exists(
file_);
log_os< char > log
Logging output stream.
Create a directory and remove it when it's done.
beast::unit_test::suite & test_
DirGuard(beast::unit_test::suite &test, path subDir, bool useCounter=true)
path const & subdir() const
auto rmDir(path const &toRm)
boost::filesystem::path path
Write a file in a directory and remove when done.
path const & file() const
FileDirGuard(beast::unit_test::suite &test, path subDir, path file, std::string const &contents, bool useCounter=true, bool create=true)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.