summaryrefslogtreecommitdiff
path: root/src/test.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-11-26 21:40:39 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-11-29 22:08:25 +0200
commit9714612999dc88e67566be91ec41659c5254321f (patch)
tree6a2c873c2cce1169bdbaf15dc0812a617d507e51 /src/test.cpp
parent69cdcea9fc30b9522da3f994e77ec54c5c7547af (diff)
downloadminetest-9714612999dc88e67566be91ec41659c5254321f.tar.gz
minetest-9714612999dc88e67566be91ec41659c5254321f.tar.bz2
minetest-9714612999dc88e67566be91ec41659c5254321f.zip
unit test: TestNodedefSerialization
Diffstat (limited to 'src/test.cpp')
-rw-r--r--src/test.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test.cpp b/src/test.cpp
index f81f2910c..52782fa36 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -314,6 +314,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);
+ verbosestream<<"Test ContentFeatures size: "<<os.str().size()<<std::endl;
+ std::istringstream is(os.str(), std::ios::binary);
+ ContentFeatures f2;
+ f2.deSerialize(is);
+ UASSERT(f.walkable == f2.walkable);
+ UASSERT(f.node_box.type == f2.node_box.type);
+ }
+};
+
struct TestCompress: public TestBase
{
void Run()
@@ -1736,6 +1756,7 @@ void run_tests()
TEST(TestSettings);
TEST(TestCompress);
TEST(TestSerialization);
+ TEST(TestNodedefSerialization);
TESTPARAMS(TestMapNode, ndef);
TESTPARAMS(TestVoxelManipulator, ndef);
TESTPARAMS(TestVoxelAlgorithms, ndef);