diff options
Diffstat (limited to 'test/nbttest.cpp')
| -rw-r--r-- | test/nbttest.cpp | 21 |
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(); } |
