mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
Fixed random map format test crash
This commit is contained in:
parent
bb0f388f23
commit
02ae95aca3
@ -79,13 +79,13 @@ si64 CZipOutputStream::write(const ui8 * data, si64 size)
|
||||
}
|
||||
|
||||
///CZipSaver
|
||||
CZipSaver::CZipSaver(std::shared_ptr<CIOApi> api, const std::string & path):
|
||||
CZipSaver::CZipSaver(std::shared_ptr<CIOApi> api, const boost::filesystem::path & path):
|
||||
ioApi(api),
|
||||
zipApi(ioApi->getApiStructure()),
|
||||
handle(nullptr),
|
||||
activeStream(nullptr)
|
||||
{
|
||||
handle = zipOpen2_64(path.c_str(), APPEND_STATUS_CREATE, nullptr, &zipApi);
|
||||
handle = zipOpen2_64((const void *) & path, APPEND_STATUS_CREATE, nullptr, &zipApi);
|
||||
|
||||
if (handle == nullptr)
|
||||
throw new std::runtime_error("CZipSaver: Failed to create archive");
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
class DLL_LINKAGE CZipSaver
|
||||
{
|
||||
public:
|
||||
explicit CZipSaver(std::shared_ptr<CIOApi> api, const std::string & path);
|
||||
explicit CZipSaver(std::shared_ptr<CIOApi> api, const boost::filesystem::path & path);
|
||||
virtual ~CZipSaver();
|
||||
|
||||
std::unique_ptr<COutputStream> addFile(const std::string & archiveFilename);
|
||||
|
@ -204,7 +204,7 @@ zlib_filefunc64_def CProxyROIOApi::getApiStructure()
|
||||
|
||||
CInputStream * CProxyROIOApi::openFile(const boost::filesystem::path& filename, int mode)
|
||||
{
|
||||
logGlobal->traceStream() << "CProxyIOApi: stream opened for " <<filename.string() <<" with mode "<<mode;
|
||||
logGlobal->traceStream() << "CProxyROIOApi: stream opened for " <<filename.string() <<" with mode "<<mode;
|
||||
|
||||
data->seek(0);
|
||||
return data;
|
||||
|
@ -21,7 +21,9 @@
|
||||
#include "../lib/CRandomGenerator.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CMapEditManager_DrawTerrain_Type)
|
||||
BOOST_AUTO_TEST_SUITE(CMapEditManager_Suite)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DrawTerrain_Type)
|
||||
{
|
||||
logGlobal->info("CMapEditManager_DrawTerrain_Type start");
|
||||
try
|
||||
@ -110,7 +112,7 @@ BOOST_AUTO_TEST_CASE(CMapEditManager_DrawTerrain_Type)
|
||||
logGlobal->info("CMapEditManager_DrawTerrain_Type finish");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CMapEditManager_DrawTerrain_View)
|
||||
BOOST_AUTO_TEST_CASE(DrawTerrain_View)
|
||||
{
|
||||
logGlobal->info("CMapEditManager_DrawTerrain_View start");
|
||||
try
|
||||
@ -178,3 +180,5 @@ BOOST_AUTO_TEST_CASE(CMapEditManager_DrawTerrain_View)
|
||||
}
|
||||
logGlobal->info("CMapEditManager_DrawTerrain_View finish");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
static const int TEST_RANDOM_SEED = 1337;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MapFormat_Random)
|
||||
BOOST_AUTO_TEST_SUITE(MapFormat_Suite)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Random)
|
||||
{
|
||||
logGlobal->info("MapFormat_Random start");
|
||||
BOOST_TEST_CHECKPOINT("MapFormat_Random start");
|
||||
@ -115,7 +117,7 @@ static void addToArchive(CZipSaver & saver, const JsonNode & data, const std::st
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MapFormat_Objects)
|
||||
BOOST_AUTO_TEST_CASE(Objects)
|
||||
{
|
||||
logGlobal->info("MapFormat_Objects start");
|
||||
|
||||
@ -202,3 +204,5 @@ BOOST_AUTO_TEST_CASE(MapFormat_Objects)
|
||||
|
||||
logGlobal->info("MapFormat_Objects finish");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
@ -9,18 +9,17 @@
|
||||
*
|
||||
*/
|
||||
#include "StdInc.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "../lib/filesystem/CMemoryBuffer.h"
|
||||
|
||||
|
||||
struct CMemoryBufferFixture
|
||||
{
|
||||
CMemoryBuffer subject;
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(CMemoryBuffer_Empty, CMemoryBufferFixture)
|
||||
BOOST_AUTO_TEST_SUITE(CMemoryBuffer_Suite)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(empty, CMemoryBufferFixture)
|
||||
{
|
||||
BOOST_REQUIRE_EQUAL(0, subject.tell());
|
||||
BOOST_REQUIRE_EQUAL(0, subject.getSize());
|
||||
@ -34,7 +33,7 @@ BOOST_FIXTURE_TEST_CASE(CMemoryBuffer_Empty, CMemoryBufferFixture)
|
||||
BOOST_CHECK_EQUAL(0, subject.tell());
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(CMemoryBuffer_Write, CMemoryBufferFixture)
|
||||
BOOST_FIXTURE_TEST_CASE(write, CMemoryBufferFixture)
|
||||
{
|
||||
const si32 initial = 1337;
|
||||
|
||||
@ -50,3 +49,5 @@ BOOST_FIXTURE_TEST_CASE(CMemoryBuffer_Write, CMemoryBufferFixture)
|
||||
BOOST_CHECK_EQUAL(initial, current);
|
||||
BOOST_CHECK_EQUAL(4, subject.tell());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user