mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Test drafts
This commit is contained in:
@ -110,11 +110,11 @@ BOOST_AUTO_TEST_CASE(CMapEditManager_DrawTerrain_View)
|
|||||||
{
|
{
|
||||||
// Load maps and json config
|
// Load maps and json config
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
// #if defined(__MINGW32__)
|
||||||
const std::string TEST_DATA_DIR = "test/";
|
const std::string TEST_DATA_DIR = "test/";
|
||||||
#else
|
// #else
|
||||||
const std::string TEST_DATA_DIR = ".";
|
// const std::string TEST_DATA_DIR = ".";
|
||||||
#endif // defined
|
// #endif // defined
|
||||||
|
|
||||||
|
|
||||||
auto loader = new CFilesystemLoader("test/", TEST_DATA_DIR);
|
auto loader = new CFilesystemLoader("test/", TEST_DATA_DIR);
|
||||||
|
63
test/CMapFormatTest.cpp
Normal file
63
test/CMapFormatTest.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* CMapFormatTest.cpp, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "StdInc.h"
|
||||||
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
#include "../lib/mapping/CMap.h"
|
||||||
|
#include "../lib/rmg/CMapGenOptions.h"
|
||||||
|
#include "../lib/rmg/CMapGenerator.h"
|
||||||
|
|
||||||
|
static const int TEST_RANDOM_SEED = 1337;
|
||||||
|
|
||||||
|
static CMap * initialMap;
|
||||||
|
|
||||||
|
class CMapTestFixture
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMapTestFixture()
|
||||||
|
{
|
||||||
|
CMapGenOptions opt;
|
||||||
|
|
||||||
|
opt.setHeight(72);
|
||||||
|
opt.setWidth(72);
|
||||||
|
opt.setHasTwoLevels(false);
|
||||||
|
opt.setPlayerCount(2);
|
||||||
|
|
||||||
|
CMapGenerator gen;
|
||||||
|
|
||||||
|
initialMap = gen.generate(&opt, TEST_RANDOM_SEED).release();
|
||||||
|
};
|
||||||
|
~CMapTestFixture()
|
||||||
|
{
|
||||||
|
delete initialMap;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
BOOST_GLOBAL_FIXTURE(CMapTestFixture);
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(CMapFormatVCMI_Simple)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
//TODO: serialize map
|
||||||
|
//TODO: deserialize map
|
||||||
|
//TODO: compare results
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(const std::exception & e)
|
||||||
|
{
|
||||||
|
logGlobal-> errorStream() << e.what();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
<Option platforms="Windows;" />
|
<Option platforms="Windows;" />
|
||||||
<Option output="../Test" prefix_auto="1" extension_auto="1" />
|
<Option output="../Test" prefix_auto="1" extension_auto="1" />
|
||||||
<Option object_output="obj/Debug/x86/" />
|
<Option object_output="obj/Debug/x86/" />
|
||||||
|
<Option working_dir="../." />
|
||||||
<Option type="1" />
|
<Option type="1" />
|
||||||
<Option compiler="gcc" />
|
<Option compiler="gcc" />
|
||||||
<Compiler>
|
<Compiler>
|
||||||
@ -57,6 +58,7 @@
|
|||||||
<Add directory="../" />
|
<Add directory="../" />
|
||||||
</Linker>
|
</Linker>
|
||||||
<Unit filename="CMapEditManagerTest.cpp" />
|
<Unit filename="CMapEditManagerTest.cpp" />
|
||||||
|
<Unit filename="CMapFormatTest.cpp" />
|
||||||
<Unit filename="CVcmiTestConfig.cpp" />
|
<Unit filename="CVcmiTestConfig.cpp" />
|
||||||
<Unit filename="CVcmiTestConfig.h" />
|
<Unit filename="CVcmiTestConfig.h" />
|
||||||
<Unit filename="StdInc.cpp">
|
<Unit filename="StdInc.cpp">
|
||||||
|
Reference in New Issue
Block a user