From 71fa61fd0160ee74b0dc478d676061138b2b6c7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 26 Jul 2018 11:18:03 +0900 Subject: [PATCH] [coco] Use ObjectManager inside Op tests (#825) This commit revises IR_OP_CONV2D.ker_update to use ObjectManager when it creates a KernelObject instance for testing. This change allows us to reduce the degree of coupling between 'KernelObject' class design and IR_OP_CONV2D.ker_update test implementation. Signed-off-by: Jonghyun Park --- contrib/coco/core/src/IR/Op.test.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/contrib/coco/core/src/IR/Op.test.cpp b/contrib/coco/core/src/IR/Op.test.cpp index 7b26535..ab68ef8 100644 --- a/contrib/coco/core/src/IR/Op.test.cpp +++ b/contrib/coco/core/src/IR/Op.test.cpp @@ -1,4 +1,5 @@ #include "coco/IR/Op.h" +#include "coco/IR/ObjectManager.h" #include @@ -24,11 +25,16 @@ TEST(IR_OP_CONV2D, asConv2D) TEST(IR_OP_CONV2D, ker_update) { + // Prepare a kernel object for testing + coco::PtrLink bag_link; + coco::ObjectManager obj_mgr{&bag_link}; + + auto obj = obj_mgr.create(nncc::core::ADT::kernel::Shape{1, 1, 3, 3}); + + // Test 'Conv2D' class const coco::Conv2D::Param param{}; coco::Conv2D op{param}; - coco::KernelObject obj{nncc::core::ADT::kernel::Shape{1, 1, 3, 3}}; - - op.ker(&obj); - ASSERT_EQ(op.ker(), &obj); + op.ker(obj); + ASSERT_EQ(op.ker(), obj); } -- 2.7.4