[coco] Test Conv2D's destructor (#1652)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 27 Sep 2018 09:54:39 +0000 (18:54 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 27 Sep 2018 09:54:39 +0000 (18:54 +0900)
This commit introduces a test for Conv2D's destructor.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/src/IR/Conv2D.test.cpp

index 4545939..ae2eba2 100644 (file)
@@ -4,8 +4,12 @@
 #include <vector>
 #include <memory>
 
+#include <nncc/foundation/Memory.h>
+
 #include <gtest/gtest.h>
 
+using nncc::foundation::make_unique;
+
 namespace
 {
 class Conv2DTest : public ::testing::Test
@@ -130,3 +134,19 @@ TEST_F(Conv2DTest, dispose)
   ASSERT_EQ(op->ker(), nullptr);
   ASSERT_EQ(obj->uses()->size(), 0);
 }
+
+TEST_F(Conv2DTest, destructor)
+{
+  // Prepare a kernel object for testing
+  auto obj = obj_mgr.create(nncc::core::ADT::kernel::Shape{1, 1, 3, 3});
+
+  // Create 'Conv2D' op
+  auto op = make_unique<coco::Conv2D>();
+
+  op->ker(obj);
+
+  // Destroy 'Conv2D' op
+  op.reset();
+
+  ASSERT_EQ(obj->uses()->size(), 0);
+}