diff options
author | saurabh singh <saurabh8c@gmail.com> | 2017-05-30 20:06:21 +0300 |
---|---|---|
committer | Neil MacIntosh <neilmac@microsoft.com> | 2017-05-30 20:06:21 +0300 |
commit | 23581d4d63e6ed41c9e3a3886f24d526dd7a557d (patch) | |
tree | c907412ee34977d1c706b20d1c84f404cf1d0d9a /tests/notnull_tests.cpp | |
parent | d1032864aa3c44f68c51e62c12ebafa899eb78ab (diff) |
Adding derference operator to not_null (#513)
Diffstat (limited to 'tests/notnull_tests.cpp')
-rw-r--r-- | tests/notnull_tests.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index bb043bb..85ed5b5 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -250,6 +250,21 @@ SUITE(NotNullTests) CHECK((NotNull1(p1) >= NotNull2(p2)) == (p1 >= p2)); CHECK((NotNull2(p2) >= NotNull1(p1)) == (p2 >= p1)); } + + TEST(TestNotNullDereferenceOperator) + { + auto sp1 = std::make_shared<int>(42); + + using NotNullSp1 = not_null<decltype(sp1)>; + + CHECK(*NotNullSp1(sp1) == *sp1); + + int ints[1] = {42}; + CustomPtr<int> p1(&ints[0]); + + using NotNull1 = not_null<decltype(p1)>; + CHECK(*NotNull1(p1) == 42); + } } int main(int, const char* []) { return UnitTest::RunAllTests(); } |