本文整理汇总了C++中boost::optional::function方法的典型用法代码示例。如果您正苦于以下问题:C++ optional::function方法的具体用法?C++ optional::function怎么用?C++ optional::function使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::optional
的用法示例。
在下文中一共展示了optional::function方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logger
: logger(new error::Logger), ft(new ast::FunctionTable),
variableFactory(new ast::test::VariableFactoryMock), builder(logger, ft, variableFactory) { }
};
TEST_F(rask_ast_Builder_buildFunctionDecl, 1)
{
cst::Function cf;
cf.name = cst::Identifier::create(Position("xxx", 1, 2), "asia");
cf.type = cst::Identifier::create(Position(), "void");
boost::optional<ast::FunctionDecl> fd = builder.buildFunctionDecl(cf);
ASSERT_TRUE(fd);
ASSERT_EQ(0u, logger->errors().size());
ast::SharedFunction f = fd->function();
ASSERT_TRUE(ft->getFunction(f->name().value) == f);
ASSERT_EQ(cf.name.position, f->name().position);
ASSERT_EQ(cf.name.value, f->name().value);
}
TEST_F(rask_ast_Builder_buildFunctionDecl, 2)
{
cst::Function cf1;
cf1.name = cst::Identifier::create(Position("xxx", 1, 2), "asia");
cf1.type = cst::Identifier::create(Position(), "void");
cst::Function cf2;
cf2.name = cst::Identifier::create(Position("xxx", 10, 2), "asia");
cf2.type = cst::Identifier::create(Position(), "void");
builder.buildFunctionDecl(cf1);