X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftest.cpp;h=bc0692a78325f05ee5fcfb6fac7d2d81b4619081;hb=9f1ae4084d945adb6281eaddc2ae56f488691d8b;hp=6a0e991e201c334d08dca90fba39ffdd6c917b8c;hpb=82855a04ec7a37f2c08c9f565e9d4a44faa691a1;p=dragonfireclient.git diff --git a/src/test.cpp b/src/test.cpp index 6a0e991e2..bc0692a78 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -40,6 +40,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "inventory.h" #include "util/numeric.h" #include "util/serialize.h" +#include "noise.h" // PseudoRandom used for random data for compression +#include "clientserver.h" // LATEST_PROTOCOL_VERSION /* Asserts that the exception occurs @@ -313,6 +315,26 @@ struct TestSerialization: public TestBase } }; +struct TestNodedefSerialization: public TestBase +{ + void Run() + { + ContentFeatures f; + f.name = "default:stone"; + for(int i = 0; i < 6; i++) + f.tiledef[i].name = "default_stone.png"; + f.is_ground_content = true; + std::ostringstream os(std::ios::binary); + f.serialize(os, LATEST_PROTOCOL_VERSION); + verbosestream<<"Test ContentFeatures size: "<setName("main"); UASSERT(!inv.getList("0")); UASSERT(inv.getList("main")); + UASSERT(inv.getList("main")->getWidth() == 3); + inv.getList("main")->setWidth(5); std::ostringstream inv_os(std::ios::binary); inv.serialize(inv_os); UASSERT(inv_os.str() == serialized_inventory_2); @@ -1698,6 +1757,7 @@ void run_tests() TEST(TestSettings); TEST(TestCompress); TEST(TestSerialization); + TEST(TestNodedefSerialization); TESTPARAMS(TestMapNode, ndef); TESTPARAMS(TestVoxelManipulator, ndef); TESTPARAMS(TestVoxelAlgorithms, ndef);