mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
447 B
C++
34 lines
447 B
C++
6 years ago
|
#ifndef TEST_UTIL_HPP
|
||
|
#define TEST_UTIL_HPP
|
||
|
|
||
|
#include <util/fs.hpp>
|
||
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
namespace test
|
||
|
{
|
||
|
std::string
|
||
|
randFilename();
|
||
|
|
||
|
struct FileGuard
|
||
|
{
|
||
|
const fs::path &p;
|
||
|
|
||
|
explicit FileGuard(const fs::path &_p) : p(_p)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
~FileGuard()
|
||
|
{
|
||
|
if(fs::exists(fs::status(p)))
|
||
|
{
|
||
|
fs::remove(p);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
} // namespace test
|
||
|
} // namespace llarp
|
||
|
|
||
|
#endif
|