1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Wip on zip serialize fixes

This commit is contained in:
AlexVinS
2015-08-13 03:29:13 +03:00
committed by AlexVinS
parent 27a29bd035
commit f2164abf1b
6 changed files with 32 additions and 9 deletions

View File

@ -19,8 +19,11 @@
#include "../lib/rmg/CMapGenerator.h"
#include "../lib/mapping/MapFormatJson.h"
#include "../lib/VCMIDirs.h"
#include "MapComparer.h"
static const int TEST_RANDOM_SEED = 1337;
static std::unique_ptr<CMap> initialMap;
@ -60,6 +63,17 @@ BOOST_AUTO_TEST_CASE(CMapFormatVCMI_Simple)
CMapSaverJson saver(&serializeBuffer);
saver.saveMap(initialMap);
}
#if 1
{
std::ofstream tmp((VCMIDirs::get().userDataPath()/"temp.zip").string());
tmp.write((const char *)&serializeBuffer.getBuffer()[0],serializeBuffer.getSize());
tmp.flush();
}
#endif // 1
serializeBuffer.seek(0);
{
CMapLoaderJson loader(&serializeBuffer);
@ -71,10 +85,9 @@ BOOST_AUTO_TEST_CASE(CMapFormatVCMI_Simple)
logGlobal->info("CMapFormatVCMI_Simple finish");
}
catch(const std::exception & e)
catch(...)
{
logGlobal->info("CMapFormatVCMI_Simple crash");
logGlobal-> errorStream() << e.what();
throw;
handleException();
BOOST_FAIL("Test case crashed");
}
}