code review refactoring
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
#include <catch2/catch_all.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "Host/Windows/ExeAppendedZipLoaderWindows.hpp"
|
||||
#include "Host/Windows/ExeAppendedZipResourceLoaderWindows.hpp"
|
||||
#else
|
||||
#include "Host/Linux/ExeAppendedZipLoaderLinux.hpp"
|
||||
#include "Host/Linux/ExeAppendedZipResourceLoaderLinux.hpp"
|
||||
#endif
|
||||
|
||||
#include "Base/Logger.hpp"
|
||||
@@ -23,30 +23,16 @@ TEST_CASE("Load zip from exe")
|
||||
{
|
||||
Logger::SetupLogger("", "tests.log");
|
||||
#ifdef _WIN32
|
||||
ExeAppendedZipLoaderWindows loader;
|
||||
ExeAppendedZipResourceLoaderWindows loader;
|
||||
#else
|
||||
ExeAppendedZipLoaderLinux loader;
|
||||
ExeAppendedZipResourceLoaderLinux loader;
|
||||
#endif
|
||||
Array<char> zipData = loader.GetResource(loader.GetCurrentExecutablePath());
|
||||
REQUIRE(!zipData.Empty());
|
||||
auto iconData = loader.GetResource("madvoxel_icon.ico");
|
||||
REQUIRE(!iconData.Empty());
|
||||
|
||||
auto files = loader.GetZipArchiveFiles(loader.GetCurrentExecutablePath());
|
||||
REQUIRE(files.size() == 2);
|
||||
|
||||
int i = 0;
|
||||
for (const auto& [fileDesc, fileData] : files)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
REQUIRE(fileDesc.path == "madvoxel_icon.ico");
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
REQUIRE(fileDesc.path == "text.txt");
|
||||
std::string s(fileData.Data(), fileData.Size());
|
||||
REQUIRE(s == "Hello world!");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
auto txtFile = loader.GetResource("text.txt");
|
||||
REQUIRE(!txtFile.Empty());
|
||||
|
||||
std::string s(txtFile.Data(), txtFile.Size());
|
||||
REQUIRE(s == "Hello world!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user