test-utils.h 558 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <boost/filesystem.hpp>
  3. namespace syncspirit::test {
  4. namespace bfs = boost::filesystem;
  5. namespace sys = boost::system;
  6. struct path_guard_t {
  7. bfs::path& path;
  8. path_guard_t(bfs::path& path_): path{path_}{}
  9. ~path_guard_t() {
  10. bfs::remove_all(path);
  11. }
  12. };
  13. bfs::path file_path(const char* test_file);
  14. std::string read_file(const char* test_file);
  15. std::string read_file(const bfs::path& path);
  16. void write_file(const bfs::path& path, std::string_view content);
  17. std::string device_id2sha256(const char* device_id);
  18. }