From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 26 Jul 2018 02:18:03 +0000 (+0900) Subject: [coco] Use ObjectManager inside Op tests (#825) X-Git-Tag: nncc_backup~2298 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71fa61fd0160ee74b0dc478d676061138b2b6c7d;p=platform%2Fcore%2Fml%2Fnnfw.git [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 --- 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); }