diff --git a/paddle/framework/net_op_test.cc b/paddle/framework/net_op_test.cc index d61233a8b4071728bf63d7fde58b8301596a8da9..814f397c7da0b44256ba6e41476c229552ff2710 100644 --- a/paddle/framework/net_op_test.cc +++ b/paddle/framework/net_op_test.cc @@ -32,6 +32,7 @@ void AssertSameVectorWithoutOrder(const std::vector& expected, } class PlainNetTest : public testing::Test { + public: virtual void SetUp() { net_ = std::make_shared(); ASSERT_NE(net_, nullptr); @@ -50,6 +51,8 @@ class PlainNetTest : public testing::Test { virtual void TearDown() {} + virtual void TestBody() {} + void TestOpKernel() { AssertSameVectorWithoutOrder({"x", "w1", "b1", "w2", "b2"}, net_->inputs_); AssertSameVectorWithoutOrder({"y", "z"}, net_->outputs_); @@ -67,6 +70,7 @@ class PlainNetTest : public testing::Test { ASSERT_EQ(2, infer_shape_cnt); ASSERT_EQ(2, run_cnt); + auto op2 = std::make_shared(); ASSERT_THROW(net_->AddOp(op2), EnforceNotMet); } @@ -83,12 +87,12 @@ class PlainNetTest : public testing::Test { TEST(OpKernel, all) { PlainNetTest net; - net->TestOpKernel(); + net.TestOpKernel(); } TEST(AddBackwardOp, TestAddBackwardOp) { PlainNetTest net; - net->TestAddBackwardOp(); + net.TestAddBackwardOp(); } } // namespace framework