diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-01-22 04:22:18 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-01-22 04:22:18 +0000 |
commit | dd7b0034f18fe2adb98d89bc2d4eeaa7dbd099a2 (patch) | |
tree | f7681478921146427edb73e4e70162d18bdfa0b4 /libutils/StrongPointer_test.cpp | |
parent | 5e8b40f3bb00ced5da858e373345795c519e74dc (diff) | |
parent | daec2f4f88253e2e6c9ac38c1903e9ef0e1c07fe (diff) |
Snap for 6152176 from daec2f4f88253e2e6c9ac38c1903e9ef0e1c07fe to rvc-release
Change-Id: Icf074761856709508e65f435e25a8f64aeab708d
Diffstat (limited to 'libutils/StrongPointer_test.cpp')
-rw-r--r-- | libutils/StrongPointer_test.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libutils/StrongPointer_test.cpp b/libutils/StrongPointer_test.cpp index 153cf9683..7b2e37f27 100644 --- a/libutils/StrongPointer_test.cpp +++ b/libutils/StrongPointer_test.cpp @@ -56,3 +56,18 @@ TEST(StrongPointer, move) { } ASSERT_TRUE(isDeleted) << "foo was leaked!"; } + +TEST(StrongPointer, NullptrComparison) { + sp<SPFoo> foo; + ASSERT_EQ(foo, nullptr); + ASSERT_EQ(nullptr, foo); +} + +TEST(StrongPointer, PointerComparison) { + bool isDeleted; + sp<SPFoo> foo = new SPFoo(&isDeleted); + ASSERT_EQ(foo.get(), foo); + ASSERT_EQ(foo, foo.get()); + ASSERT_NE(nullptr, foo); + ASSERT_NE(foo, nullptr); +} |