From 2b3f7e4b90b5787dbe8b4b40dcfc806bcb3f014e Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Tue, 23 Jun 2015 22:14:00 +0200 Subject: Create tag_string.h --- test/nbttest.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') 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(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(); } -- cgit 0.0.5-2-1-g0f52