// // const_propogating_ptr.t.h // pointers // // Created by Sam Jaffe on 1/5/17. // #include "pointers/const_propogating_ptr.hpp" #include #include #include "test_stubs.h" using namespace pointers; TEST(ConstPropogatingPtrTest, NonConstCPPCallsNonConstMethods) { std::shared_ptr p{new const_tracking_stub}; const_propogating_ptr> cp{p}; EXPECT_FALSE(cp->is_const()); } TEST(ConstPropogatingPtrTest, ConstCPPCallsConstMethods) { std::shared_ptr p{new const_tracking_stub}; const_propogating_ptr> const cp{p}; EXPECT_TRUE(cp->is_const()); } TEST(ConstPropogatingPtrTest, DoesNotDeleteRawPtr) { bool has_delete{false}; destructor_sentinal * test_struct = new destructor_sentinal{has_delete}; const_propogating_ptr{test_struct}; EXPECT_FALSE(has_delete); delete test_struct; EXPECT_TRUE(has_delete); }