From 36f4d8684461de5c589bcd87bbba93b929dda32e Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Mon, 27 Jul 2015 08:33:47 +0300 Subject: [PATCH 001/105] Test drafts --- test/CMapEditManagerTest.cpp | 8 ++--- test/CMapFormatTest.cpp | 63 ++++++++++++++++++++++++++++++++++++ test/Test.cbp | 2 ++ 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 test/CMapFormatTest.cpp diff --git a/test/CMapEditManagerTest.cpp b/test/CMapEditManagerTest.cpp index 394bdaded..cccf7356d 100644 --- a/test/CMapEditManagerTest.cpp +++ b/test/CMapEditManagerTest.cpp @@ -110,11 +110,11 @@ BOOST_AUTO_TEST_CASE(CMapEditManager_DrawTerrain_View) { // Load maps and json config - #if defined(__MINGW32__) +// #if defined(__MINGW32__) const std::string TEST_DATA_DIR = "test/"; - #else - const std::string TEST_DATA_DIR = "."; - #endif // defined +// #else +// const std::string TEST_DATA_DIR = "."; +// #endif // defined auto loader = new CFilesystemLoader("test/", TEST_DATA_DIR); diff --git a/test/CMapFormatTest.cpp b/test/CMapFormatTest.cpp new file mode 100644 index 000000000..6d6cbff98 --- /dev/null +++ b/test/CMapFormatTest.cpp @@ -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 + +#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; + } +} diff --git a/test/Test.cbp b/test/Test.cbp index 67ace151e..be4d35ad6 100644 --- a/test/Test.cbp +++ b/test/Test.cbp @@ -10,6 +10,7 @@