summaryrefslogtreecommitdiff
path: root/src/unittest/test.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-05-05 11:36:40 -0400
committerkwolekr <kwolekr@minetest.net>2015-05-05 12:00:36 -0400
commitb45df9d6a73d97671cbdd38d77e9b153a80fb458 (patch)
treefbe70ad8b6c5a4646afebb7d55309720f6ae5eb4 /src/unittest/test.cpp
parent1be2d32fd502eeb68bd63fb07b0325b25ee357bd (diff)
downloadminetest-b45df9d6a73d97671cbdd38d77e9b153a80fb458.tar.gz
minetest-b45df9d6a73d97671cbdd38d77e9b153a80fb458.tar.bz2
minetest-b45df9d6a73d97671cbdd38d77e9b153a80fb458.zip
Tests: Add NodeResolver unittests
Minor misc. NodeResolver cleanups Prefix faux content type constants for testing with t_ to avoid confusion or name collisions
Diffstat (limited to 'src/unittest/test.cpp')
-rw-r--r--src/unittest/test.cpp77
1 files changed, 71 insertions, 6 deletions
diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp
index 6fea0b8a0..57843da5e 100644
--- a/src/unittest/test.cpp
+++ b/src/unittest/test.cpp
@@ -25,9 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "itemdef.h"
#include "gamedef.h"
-content_t CONTENT_STONE;
-content_t CONTENT_GRASS;
-content_t CONTENT_TORCH;
+content_t t_CONTENT_STONE;
+content_t t_CONTENT_GRASS;
+content_t t_CONTENT_TORCH;
+content_t t_CONTENT_WATER;
+content_t t_CONTENT_LAVA;
+content_t t_CONTENT_BRICK;
////////////////////////////////////////////////////////////////////////////////
@@ -111,7 +114,7 @@ void TestGameDef::defineSomeNodes()
f.tiledef[i].name = "default_stone.png";
f.is_ground_content = true;
idef->registerItem(itemdef);
- CONTENT_STONE = ndef->set(f.name, f);
+ t_CONTENT_STONE = ndef->set(f.name, f);
//// Grass
itemdef = ItemDefinition();
@@ -131,7 +134,7 @@ void TestGameDef::defineSomeNodes()
f.tiledef[i].name = "default_dirt.png^default_grass_side.png";
f.is_ground_content = true;
idef->registerItem(itemdef);
- CONTENT_GRASS = ndef->set(f.name, f);
+ t_CONTENT_GRASS = ndef->set(f.name, f);
//// Torch (minimal definition for lighting tests)
itemdef = ItemDefinition();
@@ -144,7 +147,69 @@ void TestGameDef::defineSomeNodes()
f.sunlight_propagates = true;
f.light_source = LIGHT_MAX-1;
idef->registerItem(itemdef);
- CONTENT_TORCH = ndef->set(f.name, f);
+ t_CONTENT_TORCH = ndef->set(f.name, f);
+
+ //// Water
+ itemdef = ItemDefinition();
+ itemdef.type = ITEM_NODE;
+ itemdef.name = "default:water";
+ itemdef.description = "Water";
+ itemdef.inventory_image = "[inventorycube"
+ "{default_water.png"
+ "{default_water.png"
+ "{default_water.png";
+ f = ContentFeatures();
+ f.name = itemdef.name;
+ f.alpha = 128;
+ f.liquid_type = LIQUID_SOURCE;
+ f.liquid_viscosity = 4;
+ f.is_ground_content = true;
+ f.groups["liquids"] = 3;
+ for(int i = 0; i < 6; i++)
+ f.tiledef[i].name = "default_water.png";
+ idef->registerItem(itemdef);
+ t_CONTENT_WATER = ndef->set(f.name, f);
+
+ //// Lava
+ itemdef = ItemDefinition();
+ itemdef.type = ITEM_NODE;
+ itemdef.name = "default:lava";
+ itemdef.description = "Lava";
+ itemdef.inventory_image = "[inventorycube"
+ "{default_lava.png"
+ "{default_lava.png"
+ "{default_lava.png";
+ f = ContentFeatures();
+ f.name = itemdef.name;
+ f.alpha = 128;
+ f.liquid_type = LIQUID_SOURCE;
+ f.liquid_viscosity = 7;
+ f.light_source = LIGHT_MAX-1;
+ f.is_ground_content = true;
+ f.groups["liquids"] = 3;
+ for(int i = 0; i < 6; i++)
+ f.tiledef[i].name = "default_lava.png";
+ idef->registerItem(itemdef);
+ t_CONTENT_LAVA = ndef->set(f.name, f);
+
+
+ //// Brick
+ itemdef = ItemDefinition();
+ itemdef.type = ITEM_NODE;
+ itemdef.name = "default:brick";
+ itemdef.description = "Brick";
+ itemdef.groups["cracky"] = 3;
+ itemdef.inventory_image = "[inventorycube"
+ "{default_brick.png"
+ "{default_brick.png"
+ "{default_brick.png";
+ f = ContentFeatures();
+ f.name = itemdef.name;
+ for(int i = 0; i < 6; i++)
+ f.tiledef[i].name = "default_brick.png";
+ f.is_ground_content = true;
+ idef->registerItem(itemdef);
+ t_CONTENT_BRICK = ndef->set(f.name, f);
}
////