/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#include <catch2/catch_all.hpp>

#ifdef _WIN32
	#include "Host/Windows/ExeAppendedZipResourceLoaderWindows.hpp"
#else
	#include "Host/Linux/ExeAppendedZipResourceLoaderLinux.hpp"
#endif

#include "Base/Logger.hpp"
#include <filesystem>
#include <fstream>

using namespace OpenVulkano;

TEST_CASE("Load zip from exe")
{
	Logger::SetupLogger("", "tests.log");
#ifdef _WIN32
	ExeAppendedZipResourceLoaderWindows loader;
#else
	ExeAppendedZipResourceLoaderLinux loader;
#endif
	auto iconData = loader.GetResource("madvoxel_icon.ico");
	REQUIRE(!iconData.Empty());

	auto txtFile = loader.GetResource("text.txt");
	REQUIRE(!txtFile.Empty());

	std::string s(txtFile.Data(), txtFile.Size());
	REQUIRE(s == "Hello world!");
}
