sys: Fixed unit test building
This commit is contained in:
parent
6a517feda3
commit
96e9400761
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(OS_MACOS)
|
||||
#include <hex/helpers/paths.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
|
||||
namespace hex {
|
||||
std::string getMacExecutableDirectoryPath();
|
||||
|
@ -6,25 +6,25 @@
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
TEST_SEQUENCE("FileAccess") {
|
||||
const auto FilePath = hex::fs::current_path() / "file.txt";
|
||||
const auto FilePath = std::fs::current_path() / "file.txt";
|
||||
const auto FileContent = "Hello World";
|
||||
|
||||
{
|
||||
hex::File file(FilePath, hex::File::Mode::Create);
|
||||
hex::fs::File file(FilePath, hex::fs::File::Mode::Create);
|
||||
TEST_ASSERT(file.isValid());
|
||||
|
||||
file.write(FileContent);
|
||||
}
|
||||
|
||||
{
|
||||
hex::File file(FilePath, hex::File::Mode::Read);
|
||||
hex::fs::File file(FilePath, hex::fs::File::Mode::Read);
|
||||
TEST_ASSERT(file.isValid());
|
||||
|
||||
TEST_ASSERT(file.readString() == FileContent);
|
||||
}
|
||||
|
||||
{
|
||||
hex::File file(FilePath, hex::File::Mode::Write);
|
||||
hex::fs::File file(FilePath, hex::fs::File::Mode::Write);
|
||||
TEST_ASSERT(file.isValid());
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ TEST_SEQUENCE("FileAccess") {
|
||||
}
|
||||
|
||||
{
|
||||
hex::File file(FilePath, hex::File::Mode::Read);
|
||||
hex::fs::File file(FilePath, hex::fs::File::Mode::Read);
|
||||
if (file.isValid())
|
||||
TEST_FAIL();
|
||||
}
|
||||
|
@ -37,13 +37,13 @@ TEST_SEQUENCE("TipsAPI") {
|
||||
TEST_SEQUENCE("ContentAPI") {
|
||||
hex::Net net;
|
||||
|
||||
const auto FilePath = hex::fs::current_path() / "elf.hexpat";
|
||||
const auto FilePath = std::fs::current_path() / "elf.hexpat";
|
||||
|
||||
auto result = net.downloadFile("https://api.werwolv.net/content/imhex/patterns/elf.hexpat", FilePath).get();
|
||||
|
||||
TEST_ASSERT(result.code == 200);
|
||||
|
||||
hex::File file(FilePath, hex::File::Mode::Read);
|
||||
hex::fs::File file(FilePath, hex::fs::File::Mode::Read);
|
||||
if (!file.isValid())
|
||||
TEST_FAIL();
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace hex::test {
|
||||
|
||||
class TestProvider : public prv::Provider {
|
||||
public:
|
||||
TestProvider() : Provider(), m_testFile(File("test_data", File::Mode::Read)) {
|
||||
TestProvider() : Provider(), m_testFile(fs::File("test_data", fs::File::Mode::Read)) {
|
||||
if (!this->m_testFile.isValid() || this->m_testFile.getSize() == 0) {
|
||||
hex::log::fatal("Failed to open test data!");
|
||||
throw std::runtime_error("");
|
||||
@ -49,7 +49,7 @@ namespace hex::test {
|
||||
void close() override { }
|
||||
|
||||
private:
|
||||
File m_testFile;
|
||||
fs::File m_testFile;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user