1#include <test/unit_test/FileDirGuard.h>
3#include <xrpl/basics/ByteUtilities.h>
4#include <xrpl/basics/FileUtilities.h>
5#include <xrpl/beast/unit_test.h>
16 using namespace boost::system;
18 constexpr char const* expectedContents =
19 "This file is very short. That's all we need.";
25 "This is temporary text that should get overwritten");
28 auto const path = file.
file();
37 BEAST_EXPECT(good == expectedContents);
44 BEAST_EXPECT(good == expectedContents);
51 ec && ec.value() == boost::system::errc::file_too_large);
52 BEAST_EXPECT(bad.empty());
63BEAST_DEFINE_TESTSUITE(FileUtilities, basics,
ripple);
void testGetFileContents()
void run() override
Runs the suite.
Write a file in a directory and remove when done.
path const & file() const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr auto kilobytes(T value) noexcept
std::string getFileContents(boost::system::error_code &ec, boost::filesystem::path const &sourcePath, std::optional< std::size_t > maxSize=std::nullopt)
void writeFileContents(boost::system::error_code &ec, boost::filesystem::path const &destPath, std::string const &contents)