From 29520933f7e91c1ad343ce1be1049e2a6d56ca22 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 23 Jun 2014 15:10:03 -0400 Subject: [PATCH] add test_Ref.cc --- test/src/test_Ref.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/src/test_Ref.cc diff --git a/test/src/test_Ref.cc b/test/src/test_Ref.cc new file mode 100644 index 0000000..54a9a82 --- /dev/null +++ b/test/src/test_Ref.cc @@ -0,0 +1,24 @@ +#include "gtest/gtest.h" +#include "jes/Ref.h" +#include + +using namespace jes; + +class Foo +{ +}; +typedef Ref FooRef; + +TEST(RefTest, checking_for_null) +{ + FooRef f = NULL; + FooRef f2 = new Foo(); + + EXPECT_TRUE(f == NULL); + EXPECT_TRUE(f.is_null()); + EXPECT_FALSE(f != NULL); + + EXPECT_FALSE(f2 == NULL); + EXPECT_FALSE(f2.is_null()); + EXPECT_TRUE(f2 != NULL); +}