diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-18 21:27:19 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-18 21:27:19 +0200 |
| commit | 41b3ee4c93182d10d717ab1d7e40c33034a53f7a (patch) | |
| tree | eac76207390b79800a6881ea3ab8ac45b735ca04 /test/nbttest.cpp | |
| parent | 3bab56d8f1e59d921ac7857e6747c7ecbab045f7 (diff) | |
| download | Project-Tick-41b3ee4c93182d10d717ab1d7e40c33034a53f7a.tar.gz Project-Tick-41b3ee4c93182d10d717ab1d7e40c33034a53f7a.zip | |
Add tests for tag::get_ptr and set_ptr
Diffstat (limited to 'test/nbttest.cpp')
| -rw-r--r-- | test/nbttest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/nbttest.cpp b/test/nbttest.cpp index 3e1f040529..89ecdf8f85 100644 --- a/test/nbttest.cpp +++ b/test/nbttest.cpp @@ -202,10 +202,14 @@ void test_value() val1 = int64_t(42); ASSERT(val2 != val1); + EXPECT_EXCEPTION(val2 = int64_t(12), std::bad_cast); ASSERT(int64_t(val2) == 42); + tag_int* ptr = dynamic_cast<tag_int*>(val2.get_ptr().get()); + ASSERT(*ptr == 42); val2 = 52; ASSERT(int32_t(val2) == 52); + ASSERT(*ptr == 52); EXPECT_EXCEPTION(val1["foo"], std::bad_cast); EXPECT_EXCEPTION(val1.at("foo"), std::bad_cast); @@ -240,6 +244,9 @@ void test_value() val2 = val2; ASSERT(!val1); ASSERT(val2 == tag_int(21)); + + val2.set_ptr(make_unique<tag_string>("foo")); + ASSERT(val2 == tag_string("foo")); std::clog << "test_value passed" << std::endl; } |
