summaryrefslogtreecommitdiff
path: root/test/nbttest.cpp
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-06-23 22:14:00 +0200
committerljfa-ag <ljfa-ag@web.de>2015-06-23 22:20:02 +0200
commit2b3f7e4b90b5787dbe8b4b40dcfc806bcb3f014e (patch)
treeac2d13d74b7290c6e02435139c4df7f69314595b /test/nbttest.cpp
parent50d94e7d513f68d25cd5e72de880bb6f78de50e7 (diff)
downloadProject-Tick-2b3f7e4b90b5787dbe8b4b40dcfc806bcb3f014e.tar.gz
Project-Tick-2b3f7e4b90b5787dbe8b4b40dcfc806bcb3f014e.zip
Create tag_string.h
Diffstat (limited to 'test/nbttest.cpp')
-rw-r--r--test/nbttest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/nbttest.cpp b/test/nbttest.cpp
index 482e28ab64..24846e84da 100644
--- a/test/nbttest.cpp
+++ b/test/nbttest.cpp
@@ -49,8 +49,29 @@ void test_tag_primitive()
ASSERT(tag_double() == 0.0);
}
+void test_tag_string()
+{
+ tag_string tag("foo");
+ ASSERT(tag.get() == "foo");
+ std::string& ref = tag;
+ ref = "bar";
+ ASSERT(tag == "bar");
+ ASSERT(tag != "foo");
+ tag.set("baz");
+ ASSERT(ref == "baz");
+ tag = "quux";
+ ASSERT("quux" == static_cast<std::string>(tag));
+ std::string str("foo");
+ tag = str;
+ ASSERT(tag == str);
+
+ ASSERT(tag_string(str) == "foo");
+ ASSERT(tag_string() == "");
+}
+
int main()
{
test_get_type();
test_tag_primitive();
+ test_tag_string();
}