本文整理汇总了C++中Anonymous::setObjtype方法的典型用法代码示例。如果您正苦于以下问题:C++ Anonymous::setObjtype方法的具体用法?C++ Anonymous::setObjtype怎么用?C++ Anonymous::setObjtype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anonymous
的用法示例。
在下文中一共展示了Anonymous::setObjtype方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_SetOperation_obj_IG
void Admintest::test_SetOperation_obj_IG()
{
Account_SetOperation_called = 0;
long cid = m_id_counter++;
Entity * c = new Entity(compose("%1", cid), cid);
m_account->m_charactersDict.insert(std::make_pair(cid, c));
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId(c->getId());
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(Account_SetOperation_called, m_account);
// The operation returned would have come from Account::SetOperation
// but that is stubbed out
ASSERT_EQUAL(res.size(), 0u);
delete c;
}
示例2: test_GetOperation_obj_IG
void Admintest::test_GetOperation_obj_IG()
{
long cid = m_id_counter++;
std::string cid_str = String::compose("%1", cid);
Entity * to = new Entity(cid_str, cid);
m_server->m_world.addEntity(to);
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId(cid_str);
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
const Operation & reply = res.front();
ASSERT_EQUAL(reply->getClassNo(),
Atlas::Objects::Operation::INFO_NO);
ASSERT_EQUAL(reply->getArgs().size(), 1u);
const Root & reply_arg = reply->getArgs().front();
ASSERT_TRUE(!reply_arg->isDefaultId());
ASSERT_EQUAL(reply_arg->getId(), to->getId());
delete to;
}
示例3: test_GetOperation_rule_found
void Admintest::test_GetOperation_rule_found()
{
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("class");
arg->setId("root");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
const Operation & reply = res.front();
ASSERT_EQUAL(reply->getClassNo(),
Atlas::Objects::Operation::INFO_NO);
ASSERT_EQUAL(reply->getArgs().size(), 1u);
const Root & reply_arg = reply->getArgs().front();
ASSERT_TRUE(!reply_arg->isDefaultId());
ASSERT_EQUAL(reply_arg->getId(), "root");
}
示例4: test_check_pass
// check() description with op_definition objtype
void PropertyRuleHandlertest::test_check_pass()
{
Anonymous description;
description->setObjtype("type");
description->setParents(std::list<std::string>(1, "foo"));
int ret = rh->check(description);
assert(ret == 0);
}
示例5: test_install_noparent
void PropertyRuleHandlertest::test_install_noparent()
{
Anonymous description;
description->setObjtype("type");
std::string dependent, reason;
int ret = rh->install("new_int_type", "int", description, dependent, reason);
assert(ret == 0);
}
示例6: test_install_exists
void PropertyRuleHandlertest::test_install_exists()
{
PropertyManager::instance()->installFactory("existing_int_type",
Root(),
new PropertyFactory<Property<int>>);
Anonymous description;
description->setObjtype("type");
std::string dependent, reason;
int ret = rh->install("existing_int_type", "int", description, dependent, reason);
assert(ret == 0);
}
示例7: test_SetOperation_no_id
void Admintest::test_SetOperation_no_id()
{
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
}
示例8: test_GetOperation_unknown
void Admintest::test_GetOperation_unknown()
{
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("unknownobjtype");
arg->setId("1741");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
}
示例9: test_GetOperation_obj_unconnected
void Admintest::test_GetOperation_obj_unconnected()
{
m_account->m_connection = 0;
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId("9287");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 0u);
}
示例10: test_SetOperation_unknown
void Admintest::test_SetOperation_unknown()
{
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("unimportant_unknown_string");
arg->setId("root");
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
}
示例11: test_SetOperation_rule_unknown
void Admintest::test_SetOperation_rule_unknown()
{
Ruleset_modifyRule_called = false;
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("class");
arg->setId("unimportant_unmatched_string");
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
ASSERT_TRUE(!Ruleset_modifyRule_called);
}
示例12: test_SetOperation_rule_fail
void Admintest::test_SetOperation_rule_fail()
{
Ruleset_modifyRule_called = false;
Ruleset_modifyRule_retval = -1;
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("class");
arg->setId("root");
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
ASSERT_TRUE(Ruleset_modifyRule_called);
}
示例13: test_SetOperation_obj_not_found
void Admintest::test_SetOperation_obj_not_found()
{
Account_SetOperation_called = 0;
long cid = m_id_counter++;
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId(compose("%1", cid));
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_NULL(Account_SetOperation_called);
// FIXME No error? Is that right?
ASSERT_EQUAL(res.size(), 0u);
}
示例14: main
int main()
{
EntityBuilder::init();
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
delete rh;
}
// check() not a class
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
Anonymous description;
description->setParents(std::list<std::string>(1, "foo"));
int ret = rh->check(description);
assert(ret == -1);
delete rh;
}
// check() stub says it's a task
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
stub_isTask_result = true;
Anonymous description;
description->setObjtype("class");
description->setParents(std::list<std::string>(1, "foo"));
int ret = rh->check(description);
assert(ret == -1);
stub_isTask_result = false;
delete rh;
}
// check() stub says it's not a task
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
Anonymous description;
description->setObjtype("class");
description->setParents(std::list<std::string>(1, "foo"));
int ret = rh->check(description);
assert(ret == 0);
delete rh;
}
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
Anonymous description;
description->setId("class_name");
std::string dependent, reason;
int ret = rh->install("class_name", "parent_name",
description, dependent, reason);
assert(ret == 1);
assert(dependent == "parent_name");
delete rh;
}
// Install a rule with addChild rigged to give a correct result
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
Anonymous description;
description->setId("class_name");
std::string dependent, reason;
stub_addChild_result = (TypeNode *) malloc(sizeof(TypeNode));
int ret = rh->install("class_name", "parent_name",
description, dependent, reason);
assert(ret == 1);
assert(dependent == "parent_name");
free(stub_addChild_result);
stub_addChild_result = 0;
delete rh;
}
{
RuleHandler * rh = new EntityRuleHandler(EntityBuilder::instance());
Anonymous description;
int ret = rh->update("", description);
// FIXME Currently does nothing
assert(ret == -1);
delete rh;
//.........这里部分代码省略.........
示例15: main
int main()
{
EntityBuilder eb;
{
RuleHandler * rh = new EntityRuleHandler(&eb);
delete rh;
}
// check() not a class
{
RuleHandler * rh = new EntityRuleHandler(&eb);
Anonymous description;
description->setParent("foo");
int ret = rh->check(description);
assert(ret == -1);
delete rh;
}
// check() stub says it's not a task
{
RuleHandler * rh = new EntityRuleHandler(&eb);
Anonymous description;
description->setObjtype("class");
description->setParent("foo");
int ret = rh->check(description);
assert(ret == 0);
delete rh;
}
{
RuleHandler * rh = new EntityRuleHandler(&eb);
std::map<const TypeNode*, TypeNode::PropertiesUpdate> changes;
Anonymous description;
description->setId("class_name");
std::string dependent, reason;
int ret = rh->install("class_name", "parent_name",
description, dependent, reason, changes);
assert(ret == 1);
assert(dependent == "parent_name");
delete rh;
}
// Install a rule with addChild rigged to give a correct result
{
RuleHandler * rh = new EntityRuleHandler(&eb);
std::map<const TypeNode*, TypeNode::PropertiesUpdate> changes;
Anonymous description;
description->setId("class_name");
std::string dependent, reason;
stub_addChild_result = (TypeNode *) malloc(sizeof(TypeNode));
int ret = rh->install("class_name", "parent_name",
description, dependent, reason, changes);
assert(ret == 1);
assert(dependent == "parent_name");
free(stub_addChild_result);
stub_addChild_result = 0;
delete rh;
}
{
RuleHandler * rh = new EntityRuleHandler(&eb);
std::map<const TypeNode*, TypeNode::PropertiesUpdate> changes;
Anonymous description;
int ret = rh->update("", description, changes);
// FIXME Currently does nothing
assert(ret == -1);
delete rh;
}
}