diff --git a/lib/mapping/MapFormatJson.cpp b/lib/mapping/MapFormatJson.cpp index 6769e6f66..01d2585ab 100644 --- a/lib/mapping/MapFormatJson.cpp +++ b/lib/mapping/MapFormatJson.cpp @@ -1244,7 +1244,7 @@ void CMapSaverJson::writeHeader() addToArchive(header, HEADER_FILE_NAME); } -const std::string CMapSaverJson::writeTerrainTile(const TerrainTile & tile) +std::string CMapSaverJson::writeTerrainTile(const TerrainTile & tile) { using namespace TerrainDetail; diff --git a/lib/mapping/MapFormatJson.h b/lib/mapping/MapFormatJson.h index 053aab85e..4dc36df5a 100644 --- a/lib/mapping/MapFormatJson.h +++ b/lib/mapping/MapFormatJson.h @@ -165,8 +165,6 @@ public: */ std::unique_ptr loadMapHeader() override; -private: - struct MapObjectLoader { MapObjectLoader(CMapLoaderJson * _owner, JsonMap::value_type & json); @@ -193,7 +191,7 @@ private: */ void readMap(); - void readTerrainTile(const std::string & src, TerrainTile & tile); + static void readTerrainTile(const std::string & src, TerrainTile & tile); void readTerrainLevel(const JsonNode & src, const int index); @@ -206,6 +204,7 @@ private: JsonNode getFromArchive(const std::string & archiveFilename); +private: CInputStream * buffer; std::shared_ptr ioApi; @@ -228,7 +227,6 @@ public: * Actually saves the VCMI/Json map into stream. */ void saveMap(const std::unique_ptr & map) override; -private: /** * Saves @data as json file with specified @filename @@ -244,7 +242,7 @@ private: * Encodes one tile into string * @param tile tile to serialize */ - const std::string writeTerrainTile(const TerrainTile & tile); + static std::string writeTerrainTile(const TerrainTile & tile); /** * Saves map level into json @@ -262,6 +260,7 @@ private: */ void writeObjects(); +private: CInputOutputStream * buffer; std::shared_ptr ioApi; CZipSaver saver;///< object to handle zip archive operations diff --git a/test/map/CMapFormatTest.cpp b/test/map/CMapFormatTest.cpp index d889d2192..8b917d62b 100644 --- a/test/map/CMapFormatTest.cpp +++ b/test/map/CMapFormatTest.cpp @@ -107,6 +107,57 @@ static void addToArchive(CZipSaver & saver, const JsonNode & data, const std::st } } +static void saveTestMap(CMemoryBuffer & serializeBuffer, const std::string & filename) +{ + auto path = VCMIDirs::get().userDataPath() / filename; + boost::filesystem::remove(path); + boost::filesystem::ofstream tmp(path, boost::filesystem::ofstream::binary); + + tmp.write((const char *)serializeBuffer.getBuffer().data(), serializeBuffer.getSize()); + tmp.flush(); + tmp.close(); +} + +static std::unique_ptr loadOriginal(const JsonNode & header, const JsonNode & objects, const JsonNode & surface, const JsonNode & underground) +{ + std::unique_ptr map; + + CMemoryBuffer initialBuffer; + + std::shared_ptr originalDataIO(new CProxyIOApi(&initialBuffer)); + + { + CZipSaver initialSaver(originalDataIO, "_"); + + addToArchive(initialSaver, header, "header.json"); + addToArchive(initialSaver, objects, "objects.json"); + addToArchive(initialSaver, surface, "surface_terrain.json"); + addToArchive(initialSaver, underground, "underground_terrain.json"); + } + + initialBuffer.seek(0); + + CMapLoaderJson initialLoader(&initialBuffer); + + return initialLoader.loadMap(); +} + +static void loadActual(CMemoryBuffer * serializeBuffer, const std::unique_ptr & originalMap, JsonNode & header, JsonNode & objects, JsonNode & surface, JsonNode & underground) +{ + { + CMapSaverJson saver(serializeBuffer); + saver.saveMap(originalMap); + } + + std::shared_ptr actualDataIO(new CProxyROIOApi(serializeBuffer)); + CZipLoader actualDataLoader("", "_", actualDataIO); + + header = getFromArchive(actualDataLoader, "header.json"); + objects = getFromArchive(actualDataLoader, "objects.json"); + surface = getFromArchive(actualDataLoader, "surface_terrain.json"); + underground = getFromArchive(actualDataLoader, "underground_terrain.json"); +} + TEST(MapFormat, Objects) { static const std::string MAP_DATA_PATH = "test/ObjectPropertyTest/"; @@ -120,71 +171,67 @@ TEST(MapFormat, Objects) const JsonNode expectedSurface(ResourceID(MAP_DATA_PATH+"surface_terrain.json")); const JsonNode expectedUnderground(ResourceID(MAP_DATA_PATH+"underground_terrain.json")); - std::unique_ptr originalMap; - { - CMemoryBuffer initialBuffer; - - std::shared_ptr originalDataIO(new CProxyIOApi(&initialBuffer)); - - { - CZipSaver initialSaver(originalDataIO, "_"); - - addToArchive(initialSaver, initialHeader, "header.json"); - addToArchive(initialSaver, initialObjects, "objects.json"); - addToArchive(initialSaver, expectedSurface, "surface_terrain.json"); - addToArchive(initialSaver, expectedUnderground, "underground_terrain.json"); - } - - initialBuffer.seek(0); - - { - CMapLoaderJson initialLoader(&initialBuffer); - - originalMap = initialLoader.loadMap(); - } - } + std::unique_ptr originalMap = loadOriginal(initialHeader, initialObjects, expectedSurface, expectedUnderground); CMemoryBuffer serializeBuffer; - { - CMapSaverJson saver(&serializeBuffer); - saver.saveMap(originalMap); - } - std::shared_ptr actualDataIO(new CProxyROIOApi(&serializeBuffer)); - CZipLoader actualDataLoader("", "_", actualDataIO); + JsonNode actualHeader; + JsonNode actualObjects; + JsonNode actualSurface; + JsonNode actualUnderground; - const JsonNode actualHeader = getFromArchive(actualDataLoader, "header.json"); - const JsonNode actualObjects = getFromArchive(actualDataLoader, "objects.json"); - const JsonNode actualSurface = getFromArchive(actualDataLoader, "surface_terrain.json"); - const JsonNode actualUnderground = getFromArchive(actualDataLoader, "underground_terrain.json"); + loadActual(&serializeBuffer, originalMap, actualHeader, actualObjects, actualSurface, actualUnderground); + + saveTestMap(serializeBuffer, "test_object_property.vmap"); { - auto path = VCMIDirs::get().userDataPath()/"test_object_property.vmap"; - boost::filesystem::remove(path); - boost::filesystem::ofstream tmp(path, boost::filesystem::ofstream::binary); - - tmp.write((const char *)serializeBuffer.getBuffer().data(),serializeBuffer.getSize()); - tmp.flush(); - tmp.close(); - } - - { - JsonMapComparer c; + JsonMapComparer c(false); c.compareHeader(actualHeader, expectedHeader); - } - - { - JsonMapComparer c; c.compareObjects(actualObjects, expectedObjects); } { - JsonMapComparer c; - c.compareTerrain("surface", actualSurface, expectedSurface); + JsonMapComparer c(true); + c.compare("surface", actualSurface, expectedSurface); + c.compare("underground", actualUnderground, expectedUnderground); + } +} + +TEST(MapFormat, Terrain) +{ + static const std::string MAP_DATA_PATH = "test/TerrainTest/"; + + const JsonNode initialHeader(ResourceID(MAP_DATA_PATH+"header.json")); + const JsonNode expectedHeader(ResourceID(MAP_DATA_PATH+"header.json")); + + const JsonNode initialObjects(ResourceID(MAP_DATA_PATH+"objects.json")); + const JsonNode expectedObjects(ResourceID(MAP_DATA_PATH+"objects.json")); + + const JsonNode expectedSurface(ResourceID(MAP_DATA_PATH+"surface_terrain.json")); + const JsonNode expectedUnderground(ResourceID(MAP_DATA_PATH+"underground_terrain.json")); + + std::unique_ptr originalMap = loadOriginal(initialHeader, initialObjects, expectedSurface, expectedUnderground); + + CMemoryBuffer serializeBuffer; + + JsonNode actualHeader; + JsonNode actualObjects; + JsonNode actualSurface; + JsonNode actualUnderground; + + loadActual(&serializeBuffer, originalMap, actualHeader, actualObjects, actualSurface, actualUnderground); + + saveTestMap(serializeBuffer, "test_terrain.vmap"); + + { + JsonMapComparer c(false); + c.compareHeader(actualHeader, expectedHeader); + c.compareObjects(actualObjects, expectedObjects); } { - JsonMapComparer c; - c.compareTerrain("underground", actualUnderground, expectedUnderground); + JsonMapComparer c(true); + c.compare("surface", actualSurface, expectedSurface); + c.compare("underground", actualUnderground, expectedUnderground); } } diff --git a/test/map/MapComparer.cpp b/test/map/MapComparer.cpp index 1e2fb6ffe..241dbd533 100644 --- a/test/map/MapComparer.cpp +++ b/test/map/MapComparer.cpp @@ -274,8 +274,8 @@ void MapComparer::operator() (const std::unique_ptr& actual, const std::un } //JsonMapComparer -JsonMapComparer::JsonMapComparer(): - strict(false) +JsonMapComparer::JsonMapComparer(bool strict_) + : strict(strict_) { } @@ -442,23 +442,18 @@ void JsonMapComparer::checkStructField(const JsonMap & actual, const std::string checkEqualJson(actual.at(name), expectedValue); } +void JsonMapComparer::compare(const std::string & name, const JsonNode & actual, const JsonNode & expected) +{ + auto guard = pushName(name); + checkEqualJson(actual, expected); +} + void JsonMapComparer::compareHeader(const JsonNode & actual, const JsonNode & expected) { - strict = false; - auto guard = pushName("hdr"); - checkEqualJson(actual, expected); + compare("hdr", actual, expected); } void JsonMapComparer::compareObjects(const JsonNode & actual, const JsonNode & expected) { - strict = false; - auto guard = pushName("obj"); - checkEqualJson(actual, expected); -} - -void JsonMapComparer::compareTerrain(const std::string & levelName, const JsonNode & actual, const JsonNode & expected) -{ - strict = true; - auto guard = pushName(levelName); - checkEqualJson(actual, expected); + compare("obj", actual, expected); } diff --git a/test/map/MapComparer.h b/test/map/MapComparer.h index e8935ad6f..e0b797bb3 100644 --- a/test/map/MapComparer.h +++ b/test/map/MapComparer.h @@ -45,7 +45,7 @@ struct JsonMapComparer bool strict; std::list namePath; - JsonMapComparer(); + JsonMapComparer(bool strict_); vstd::ScopeGuard pushName(const std::string & name); @@ -68,9 +68,10 @@ struct JsonMapComparer void checkEqualJson(const JsonMap & actual, const JsonMap & expected); void checkEqualJson(const JsonVector & actual, const JsonVector & expected); + void compare(const std::string & name, const JsonNode & actual, const JsonNode & expected); + void compareHeader(const JsonNode & actual, const JsonNode & expected); void compareObjects(const JsonNode & actual, const JsonNode & expected); - void compareTerrain(const std::string & levelName, const JsonNode & actual, const JsonNode & expected); }; diff --git a/test/testdata/TerrainTest/header.json b/test/testdata/TerrainTest/header.json new file mode 100644 index 000000000..c05aa8f78 --- /dev/null +++ b/test/testdata/TerrainTest/header.json @@ -0,0 +1,27 @@ +{ + "allowedAbilities" : {}, + "allowedArtifacts" : {}, + "allowedHeroes" : {}, + "allowedSpells" : {}, + "defeatIconIndex" : 0, + "difficulty" : "NORMAL", + "mapLevels" : { + "surface" : { + "height" : 32, + "index" : 0, + "width" : 32 + }, + "underground" : { + "height" : 32, + "index" : 1, + "width" : 32 + } + }, + "mods" : {}, + "name" : "Untitled", + "players" : {}, + "triggeredEvents" : {}, + "victoryIconIndex" : 0, + "versionMajor" : 1, + "versionMinor" : 0 +} \ No newline at end of file diff --git a/test/testdata/TerrainTest/objects.json b/test/testdata/TerrainTest/objects.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/test/testdata/TerrainTest/objects.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/test/testdata/TerrainTest/surface_terrain.json b/test/testdata/TerrainTest/surface_terrain.json new file mode 100644 index 000000000..da01b9419 --- /dev/null +++ b/test/testdata/TerrainTest/surface_terrain.json @@ -0,0 +1,32 @@ +[["wt14_","wt9|","wt10|","wt8|","wt8|","wt10|","wt18-","wt28_","wt29_","wt26_","wt20_","wt28_","wt26_","wt18_","wt8|","wt8|","wt13-","wt26_","wt27_","wt23_","wt21_","wt23_","wt21_","wt27_","wt25_","wt27_","wt30_","wt26_","wt20_","wt24_","wt25_","wt28_"], +["wt6-","dt0_","dt10_","dt9_","dt9_","dt16-","wt16|","wt18-","wt23_","wt28_","wt27_","wt27_","wt18_","wt16+","sa10_","sa14_","wt4_","wt26_","wt26_","wt22_","wt25_","wt25_","wt18_","wt8|","wt9|","wt9|","wt8|","wt9|","wt13-","wt31_","wt24_","wt21_"], +["wt5-","dt5_","dt21_","dt23_","dt35_","dt18|","dt16-","wt16|","wt18-","wt29_","wt30_","wt29_","wt5-","sa15_","sa21_","sa11_","wt6_","wt28_","wt20_","wt18_","wt8|","wt9|","wt16+","dt16_","dt9_","dt8_","dt10_","dt1-","wt5_","wt21_","wt27_","wt21_"], +["wt6-","dt5_","dt23_","dt39_","dt34_","dt41_","dt18|","dt16-","wt16|","wt10|","wt10|","wt18-","wt4-","sa8_","sa16_","sa4_","wt6_","wt18_","wt9|","wt16+","dt16_","dt9_","dt10_","dt18+","dt30_","dt21_","dt25_","dt5-","wt4_","wt30_","wt23_","wt31_"], +["wt4-","dt16|","dt18-","dt29_","dt33_","dt29_","dt26_","dt18|","dt9_","dt8_","dt16-","wt16|","wt2+","sa16_","sa16_","sa2_","wt1|","wt16+","dt16_","dt8_","dt18+","dt25_","dt23_","dt30_","dt32_","dt41_","dt33_","dt4-","wt5_","wt25_","wt26_","wt20_"], +["wt18|","wt16-","dt16|","dt18-","dt40_","dt24_","dt34_","dt40_","dt21_","dt21_","dt18|","dt16-","sa2_","sa16_","sa16_","dt16_","dt8_","dt8_","dt18+","dt36_","dt26_","dt30_","dt41_","dt37_","dt23_","dt18_","dt8|","dt0+","wt6_","wt29_","wt28_","wt29_"], +["wt24_","wt4-","sa22_","dt16|","dt9|","dt10|","dt8|","dt18-","dt40_","dt24_","dt22_","dt6-","sa19_","sa4_","dt16_","dt18+","dt37_","dt22_","dt25_","dt30_","dt26_","dt34_","dt18_","dt10|","dt8|","dt16+","sa22_","sa13_","wt0|","wt8|","wt8|","wt14-"], +["wt29_","wt4-","sa17_","sa1_","sa21_","sa0_","sa16_","dt16|","dt9|","dt14-","dt18_","dt16+","sa17_","sa15_","dt4_","dt41_","dt22_","dt24_","dt33_","dt35_","dt23_","dt18_","dt16+","wt16_","wt1-","sa7_","sa1_","sa22_","sa3_","sa18_","sa4_","wt4_"], +["wt23_","wt6-","sa4_","sa2_","sa0_","sa21_","sa13_","sa3_","sa20_","dt5_","dt6-","sa6_","sa13_","dt16_","dt18+","dt39_","dt30_","dt31_","dt23_","dt43_","dt22_","dt5-","wt16_","wt18+","wt4-","sa15_","sa4_","sa12_","sa1_","sa19_","sa12_","wt4_"], +["wt29_","wt6-","sa7_","sa2_","sa14_","sa1_","sa11_","sa5_","sa18_","dt2|","dt2+","sa2_","sa20_","dt4_","dt32_","dt35_","dt35_","dt42_","dt31_","dt28_","dt21_","dt4-","wt1|","wt8|","wt2+","sa14_","sa18_","sa1_","sa13_","sa6_","sa20_","wt5_"], +["wt27_","wt6-","sa11_","sa18_","sa19_","sa8_","sa22_","sa6_","sa19_","sa17_","sa15_","sa4_","sa8_pd14_","dt4_","dt18_","dt9|","dt9|rm10_","dt18-","dt26_","dt33_","dt31_","dt18|","dt16-","sa0_","sa22_","sa14_","sa11_","sa12_","sa13_","sa9_","sa1_","wt5_"], +["wt21_","wt6-","sa17_","sa6_pc14_","sa17_","sa19_","sa11_","sa3_pd14_","sa3_","sa3_","sa22_","sa17_","sa14_pd11_","dt0|","dt16+","wt16_","wt16-","dt16|","dt18-","dt24_pg14_","dt23_","dt23_","dt6-","sa12_pg0_","sa2_pg15-","sa15_","sa22_","sa7_","sa15_","sa2_","sa0_","wt4_"], +["wt20_","wt4-","sa0_","sa11_pc14|","sa18_","sa14_","sa20_","sa22_pd7_","sa8_pd9_","sa7_pc8_","sa11_pc15-","sa17_","sa19_pd11_","sa10_","wt16_","wt18+","wt18|","wt16-","dt4_rm12_","dt23_pg0|rm11_","dt38_pg9_rm11_","dt18_pg9_rm12_","dt16+pg12_rm11_","sa14_pg1+rm12_","sa8_rm3-","sa11_","sa12_","sa1_","sa18_","sa5_","wt16_","wt18+"], +["wt28_","wt6-","dt1_","dt9_","dt16-","sa11_","sa1_","sa8_pc7_","sa16_pc8|","sa17_pc7-","sa12_rw11_","sa9_pd3_rw0-","sa4_pd1+","sa4_","wt16|","wt18-","wt18_","wt16+","sw47+","sw8_","sw10_pg6_","sw47|pg7-","sa13_","sa17_","sa8_rm2|","sa9_rm6_","sa20_rm2-","sa22_","sa16_","wt16_","wt18+","wt22_"], +["wt31_","wt6-","dt6_","dt24_pc15_","dt18|pc12_","dt16-pc13_","sa21_pc13_","sa13_pc1+","sa7_","sa2_pd5|","sa20_pd9_","sa18_pd7-rw9_","sa17_","sa17_","sa19_","wt16|","wt16+","sw36_","sw38+","sw33_","sw28|pg7_","sw42-pg7-","sw29_","sw36-","sa21_","sa21_ri7_","sa14_rm5|","sa6_rm11_","sa1_rm12-","wt4_","wt27_","wt24_"], +["wt31_","wt4-","dt4_","dt40_","dt24_","dt18|","dt16-","sa6_","sa7_","sa12_","sa21_pd7_","sa10_pd7-rw10_","sa2_","sa10_","sa16_","sa7_","sa1_","sw36|","sw38-","sw25-pg0_","sa5_pg9|","sw36|pg8|","sw28|pg0-","sw42-","sw36-ri3_","sa13_ri1+","sa20_","dt16_","dt1-","wt6_","wt20_","wt23_"], +["wt27_","wt4-","dt2|","dt10|","dt9|","dt9|","dt2+","sa8_","sa3_","sa22_pd0_","sa18_pd8|","sn22_pd7-rw10_","sn28_","sn21-","sa15_","sa7_","sa3_","sa22_","sw24_","sw25-pg10_","sa16_","sa10_","sa1_pg10_","sw36|ri3_","sw42-ri3+","sw28_","sw48|","dt18+","dt5-","wt4_","wt20_","wt31_"], +["wt25_","wt13|","wt9_","wt8_","wt9_","wt9_","wt2-","sa8_","sa18_","sa8_pd10_","sa16_","sn26_pd3|rw10_","sn70_pg9_","sn24-pg0-","sa3_","sa13_","sa5_","sa19_","sw26_pg0_","sw25-pg1+","sa8_","sa5_","sa9_pg10_ri2_","sa22_ri3+","sw24_","sw61_","sw6-","dt42_","dt4-","wt6_","wt31_","wt21_"], +["wt29_","wt26_","wt26_","wt28_","wt18_","wt9|","wt2+","sa16_","sn36_pd15_","sn29_pd1+","sn28_","sn33+rw10_","sn71_pd0|","sn25-pg9|","sa21_pg13_","sa15_pg0-","sa8_","sa11_","sw26_pg10_","sw26-","sa14_","sa20_ri0_","sa8_pg14|ri3+","sa7_","sw36|","sw38-","sw13|","sw9_","sw47|","wt4_","wt30_","wt28_"], +["wt13_","wt8|","wt8|","wt9|","wt16+","sn36_","sn30_","sn29_","sn38+","sn60_","sn50_","sn52_rw10_","sn67_","sn32|","sn30_","sn28_pg1|","sn30_pg13_","sn48|pg13_","sw45+pg0+","sw38|","sw36-ri2_","sa20_ri1+","sa13_","wt16_","wt16-","sw36|","sw38-","sw66_","sw25-","wt5_","wt23_","wt23_"], +["wt4-","sn20_","sn29_","sn30_","sn28_","sn42_","sn30|","sn28|","sn29|","sn33-","sn49_","sn38_rw9_","sn29|","sn28|","sn30|","sn46-","sn46_","sn48_","sw45-","sw65_","sw24-ri10_","sa7_","wt16_","wt18+","wt18|","wt16-","sw36|","sw28|","sw21+","wt4_","wt29_","wt30_"], +["wt6-","sn20|","sn28|","sn29|","sn29|","sn36+","wt16_","wt9_","wt0-","sn24_","sn38_","sn36+rw10|","wt16_","wt10_","wt1-","sw47+","sw47|","sa14_","sw26_","sw14_","sw47_ri9_","sa14_","wt5_","wt24_","wt26_","wt18|","wt8_","wt8_","wt8_","wt13+","wt20_","wt26_"], +["wt12|","wt9_","wt10_","wt9_","wt10_","wt10_","wt18+","wt21_","wt5-","sn26_","sn24-","wt16_","wt18+","wt25_","wt5-","sw24_","sw34|","sw28_","sw34+","sw6-","rg43+ri9_","rg21-","wt4_","wt26_","wt26_","wt20_","wt23_","wt22_","wt22_","wt20_","wt25_","wt31_"], +["wt31_","wt25_","wt27_","wt18_","wt10|","wt10|","wt10|","wt10|","wt2+","sn47-","sn47_","wt2|","wt9|","wt10|","wt0+","sw47-","sw9|","sw10|","sw10|","sw1+","rg4_ri10_","rg25-","wt0|","wt10|","wt8|","wt10|","wt9|","wt8|","wt14-","wt31_","wt25_","wt23_"], +["wt22_","wt29_","wt18_","wt16+","rg36_","rg29_","rg28_","rg29_","rg30_","rg46+","rg46|rw1_","rg30_rw12-","rg28_","rg28_","rg29_","rg46+","rg8_","rg8_","rg10_","rg9_","rg14+ri10_","rg34|","rg30_","rg30_","rg28_","rg29_","rg28_","rg20-","wt6_","wt24_","wt20_","wt29_"], +["wt21_","wt27_","wt5-","rg36_","rg38+","rg38_","rg28|","rg30|","rg28|","rg28|","rg30|rw9|","rg30|","rg30|","rg28|","rg29|","rg28|","rg38-","rg58_","rg60_","rg55_","rg68_ri9_","rg57_","rg38_","rg30|","rg28|","rg30|","rg28|","rg21+","wt5_","wt24_","wt20_","wt23_"], +["wt29_","wt28_","wt6-","rg21|","rg28|","rg36+","wt16_","wt9_","wt10_","wt8_","wt9_","wt8_","wt8_","wt8_","wt8_","wt16-","rg36|","rg30|","rg28|","rg28|","rg29|ri9|","rg29|","rg36+","wt16_","wt9_","wt9_","wt8_","wt10_","wt14+","wt31_","wt25_","wt24_"], +["wt29_","wt30_","wt12|","wt8_","wt10_","wt8_","wt18+","wt22_","wt26_","wt25_","wt23_","wt22_","wt24_","wt29_","wt22_","wt18|","wt10_","wt10_","wt9_","wt9_","wt9_","wt10_","wt10_","wt18+","wt31_","wt29_","wt31_","wt22_","wt24_","wt21_","wt27_","wt25_"], +["wt27_","wt20_","wt28_","wt28_","wt27_","wt28_","wt25_","wt20_","wt20_","wt27_","wt24_","wt23_","wt28_","wt23_","wt22_","wt22_","wt25_","wt24_","wt31_","wt20_","wt22_","wt29_","wt27_","wt28_","wt27_","wt26_","wt28_","wt25_","wt22_","wt30_","wt31_","wt21_"], +["wt22_","wt31_","wt20_","wt27_","wt30_","wt28_","wt29_","wt24_","wt22_","wt22_","wt22_","wt25_","wt30_","wt25_","wt22_","wt20_","wt29_","wt22_","wt25_","wt30_","wt24_","wt20_","wt27_","wt24_","wt20_","wt28_","wt28_","wt29_","wt20_","wt24_","wt26_","wt31_"], +["wt27_","wt31_","wt30_","wt20_","wt25_","wt27_","wt21_","wt20_","wt26_","wt22_","wt21_","wt22_","wt29_","wt23_","wt29_","wt24_","wt31_","wt22_","wt23_","wt26_","wt29_","wt24_","wt27_","wt20_","wt29_","wt20_","wt21_","wt29_","wt20_","wt24_","wt26_","wt24_"], +["wt30_","wt26_","wt28_","wt26_","wt28_","wt25_","wt24_","wt29_","wt25_","wt25_","wt28_","wt27_","wt31_","wt23_","wt26_","wt26_","wt21_","wt25_","wt23_","wt29_","wt26_","wt20_","wt25_","wt26_","wt26_","wt27_","wt30_","wt25_","wt26_","wt25_","wt29_","wt27_"]] \ No newline at end of file diff --git a/test/testdata/TerrainTest/underground_terrain.json b/test/testdata/TerrainTest/underground_terrain.json new file mode 100644 index 000000000..8b27fbb8d --- /dev/null +++ b/test/testdata/TerrainTest/underground_terrain.json @@ -0,0 +1,32 @@ +[["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc40_","rc22_","rc22_","rc26_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc40_","rc38_","lv36_","lv22-","rc16_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc6_","rc4_","rc4_","rc1_","rc2_","rc5_","rc4_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc40_","rc38_","lv36_rl12_","lv38+rl1-","lv25-","rc16_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc4_","rc1_","rc4_","rc0_","rc5_","rc4_","rc0_","rc4_","rc5_","rc2_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc18_","lv36_","lv38+","lv54_rl3|","lv25-rl0-","rc36_","rc42_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc3_","rc6_","rc6_","rc1_","rc3_","rc3_","rc2_","rc1_","rc0_","rc5_","rc4_","rc1_","rc5_","rc1_","rc2_","rc0_","rc0_"], +["rc40_","rc22_","rc14_","lv24_","lv68_","lv49_","lv38|rl9_","lv36-","rc36_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc42_","rc2_","rc2_","rc4_","rc2_","rc1_","rc0_","rc0_","rc2_","rc4_","rc4_","rc4_","rc3_","rc1_","rc2_","rc0_","rc0_"], +["rc38_","lv36_","lv30_","lv42_pg15_","lv30|pg12_","lv30|pg12_","lv33-pg13_rl3|","lv38|pg12_rl0-","lv29_pg13_","lv28_pg13_","lv28_pg13_","lv28_pg12_","lv29_pg15-","lv29_","lv36-","rc36_","rc22_","rc22_","rc42_","rc6_","rc2_","rc4_","rc0_","rc3_","rc3_","rc4_","rc6_","rc5_","rc0_","rc3_","rc0_","rc0_"], +["lv29_","lv38+","lv38_","lv36+","rc32_","rc10_","lv47-","lv46_rl9_","lv30|","lv28|","lv28|","lv28|","lv30|","lv30|","lv42-","lv28_","lv30_","lv36-","rc36_","rc22_","rc42_","rc5_","rc0_","rc0_","rc4_","rc2_","rc4_","rc3_","rc0_","rc6_","rc0_","rc0_"], +["lv28|","lv29|","lv36+","rc32_","rc46_","rc18_","sb47+","sb47|rl9_","rc8_","rc20_","rc20_","rc20_","rc20_","rc34_","lv36|","lv38-pg15_","lv63_pg12_","lv38|pg1-","lv28_","lv36-","rc36_","rc22_","rc22_","rc42_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc20_","rc20_","rc20_","rc46_","rc0_","rc18_","sb26_","sb25-rl10_","rc36_","rc42_","rc0_","rc0_","rc0_","rc44_","rc34_","lv26_","lv61_rl1_","lv55_pg0|rl12_","lv49_pg12_rl12_","lv34|pg1-rl12_","lv28_rl11-","lv30_","lv36-","rc36_","rc22_","rc42_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc18_","sb26_","sb38|rl10_","sb36-","rc16_","rc0_","rc0_","rc0_","rc40_","rc38_","lv20|rl12_","lv29|rl1+","lv28|","lv29|","lv29|pg0|","lv29|pg15-","lv38-","lv38|","lv28_","lv36-","rc36_","rc22_","rc26_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc18_","sb36|","sb38-rl9_","sb25-","rc36_","rc42_","rc40_","rc22_","rc38_","sb36_","sb22-","rc8_","rc20_","rc20_","rc20_","rc34_","lv36|pg15_","lv30|pg15-","lv38-","lv38|","lv28_","lv21-","rc16_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc44_","rc34_","sb36|rl1|","sb42-rl1-","sb36-","rc36_","rc38_","sb36_rl11_","sb29_rl11-","sb42_","sb36+","rc16_","rc0_","rc0_","rc0_","rc44_","rc20_","rc34_","lv36|","lv28|","lv28|","lv20+","rc16_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc44_","rc34_","sb36|rl0|","sb42-rl3-","sb29_","sb30_rl10_","sb38+","sb51_","sb26-","rc32_","rc46_","rc0_","rc0_","rc0_","rc0_","rc0_","rc44_","rc20_","rc20_","rc20_","rc20_","rc30_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc44_","rc34_","sb26_rl8_","sb65_rl11_","sb54_rl0+","sb67_","sb71_","sb24-","rc12_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc26_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc18_","sb25_rl9_","sb58_","sb38_","sb29|","sb29|","sb21+","sb20_","sb29_","sb30_","sb29_","sb30_","sb30_","sb28_","sb28_","sb30_","sb29_","sb21-","rc16_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc24_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc22_","rc14_","sb21|rl9|","sb29|","sb36+","rc8_","rc20_","rc34_","sb36|","sb28|","sb30|","sb30|","sb30|","sb28|","sb30|","sb28|","sb28|","sb30|","sb22+","rc16_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc18_","wt1_","wt9_","wt8_","wt8_","wt10_","wt8_","wt9_","wt9_","wt10_","wt9_","wt16-","rc36_","rc42_","rc44_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc30_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc18_","wt4_","wt18_","wt10|","wt9|","wt8|","wt10|","wt9|","wt8|","wt8|","wt13-","wt18|","wt16-","rc36_","rc22_","rc22_","rc42_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc18_","wt0|","wt16+","rc32_","rc20_","rc20_","rc20_","rc10_","sb22_","sb22-rl10_","wt5_","wt28_","wt18|","wt9_","wt10_","wt16-","rc36_","rc22_","rc22_","rc22_","rc26_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc28_","rc20_","rc20_","rc46_","rc0_","rc0_","rc0_","rc18_","sb20|","sb21+rl9|","wt1|","wt10|","wt8|","wt9|","wt18-","wt18|","wt8_","wt10_","wt8_","wt1-","rc16_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc28_","rc20_","rc20_","rc20_","rc20_","rc20_","rc34_","wt16|","wt8|","wt10|","wt10|","wt9|","wt0+","rc16_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"], +["rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc44_","rc20_","rc20_","rc20_","rc20_","rc20_","rc20_","rc30_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_","rc0_"]] \ No newline at end of file