diff options
author | Mark D. Roth <roth@google.com> | 2018-01-12 12:29:09 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2018-01-12 12:29:09 -0800 |
commit | 94dad609783b0e67c9b4b1de079330e19cf813c2 (patch) | |
tree | 37bfae3e7a328917f267b1667573ae66e13a0929 /test | |
parent | 324703db51b43e150d9d8ffbcceb9d2096e26a9f (diff) |
Add equality operators to RefCountedPtr.
Diffstat (limited to 'test')
-rw-r--r-- | test/core/support/ref_counted_ptr_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/core/support/ref_counted_ptr_test.cc b/test/core/support/ref_counted_ptr_test.cc index 1830edc4e5..ce4975d347 100644 --- a/test/core/support/ref_counted_ptr_test.cc +++ b/test/core/support/ref_counted_ptr_test.cc @@ -138,6 +138,19 @@ TEST(RefCountedPtr, DerefernceOperators) { foo_ref.value(); } +TEST(RefCountedPtr, EqualityOperators) { + RefCountedPtr<Foo> foo(New<Foo>()); + RefCountedPtr<Foo> bar = foo; + RefCountedPtr<Foo> empty; + // Test equality between RefCountedPtrs. + EXPECT_EQ(foo, bar); + EXPECT_NE(foo, empty); + // Test equality with bare pointers. + EXPECT_EQ(foo, foo.get()); + EXPECT_EQ(empty, nullptr); + EXPECT_NE(foo, nullptr); +} + TEST(MakeRefCounted, NoArgs) { RefCountedPtr<Foo> foo = MakeRefCounted<Foo>(); EXPECT_EQ(0, foo->value()); |