#include "coco/IR/Instr.h"
+#include "coco/IR/ObjectManager.h"
#include <gtest/gtest.h>
TEST(IR_FEATURE_INSTR, ifm_update)
{
+ // Prepare a feature object for testing
+ coco::PtrLink<coco::Bag, coco::BagInfo> bag_link;
+ coco::ObjectManager obj_mgr{&bag_link};
+
+ auto obj = obj_mgr.create(nncc::core::ADT::feature::Shape{1, 3, 3});
+
+ // Test 'FeatureInstr' class
coco::PtrLink<coco::Instr, coco::Block> link;
coco::FeatureInstr ins{&link};
- coco::FeatureObject obj{nncc::core::ADT::feature::Shape{1, 3, 3}};
// 'ifm(FeatureObject *)' method should affect 'ifm()' method
- ins.ifm(&obj);
- ASSERT_EQ(ins.ifm(), &obj);
+ ins.ifm(obj);
+ ASSERT_EQ(ins.ifm(), obj);
}
TEST(IR_FEATURE_INSTR, ofm_update)
{
+ // Prepare a feature object for testing
+ coco::PtrLink<coco::Bag, coco::BagInfo> bag_link;
+ coco::ObjectManager obj_mgr{&bag_link};
+
+ auto obj = obj_mgr.create(nncc::core::ADT::feature::Shape{1, 3, 3});
+
+ // Test 'FeatureInstr' class
coco::PtrLink<coco::Instr, coco::Block> link;
coco::FeatureInstr ins{&link};
- coco::FeatureObject obj{nncc::core::ADT::feature::Shape{1, 3, 3}};
// 'ofm(FeatureObject *)' method should affect 'ofm()' method
- ins.ofm(&obj);
- ASSERT_EQ(ins.ofm(), &obj);
+ ins.ofm(obj);
+ ASSERT_EQ(ins.ofm(), obj);
}
#include "coco/IR/Op.h"