当前位置: 首页>>代码示例>>C++>>正文


C++ AgentNodeTest::btexec方法代码示例

本文整理汇总了C++中AgentNodeTest::btexec方法的典型用法代码示例。如果您正苦于以下问题:C++ AgentNodeTest::btexec方法的具体用法?C++ AgentNodeTest::btexec怎么用?C++ AgentNodeTest::btexec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AgentNodeTest的用法示例。


在下文中一共展示了AgentNodeTest::btexec方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initTestEnvNode

LOAD_TEST(btunittest, selector_loop_ut_8)
{
	AgentNodeTest* myTestAgent = initTestEnvNode("node_test/selector_loop_ut_8", format);
	myTestAgent->resetProperties();

	myTestAgent->testVar_0 = 10;
	myTestAgent->m_bCanSee = false;

	behaviac::EBTStatus s = myTestAgent->btexec();
	CHECK_EQUAL(behaviac::BT_RUNNING, s);
	CHECK_EQUAL(2, myTestAgent->testVar_0);
	CHECK_EQUAL(1, myTestAgent->testVar_1);

	myTestAgent->testVar_0 = 10;
	s = myTestAgent->btexec();
	CHECK_EQUAL(behaviac::BT_RUNNING, s);
	CHECK_EQUAL(2, myTestAgent->testVar_0);
	CHECK_EQUAL(2, myTestAgent->testVar_1);

	s = myTestAgent->btexec();
	CHECK_EQUAL(behaviac::BT_SUCCESS, s);
	CHECK_EQUAL(2, myTestAgent->testVar_0);
	CHECK_EQUAL(101, myTestAgent->testVar_1);

    finlTestEnvNode(myTestAgent);
}
开发者ID:Evilcoolkings,项目名称:behaviac,代码行数:26,代码来源:NodeUnitTest.cpp

示例2: initTestEnvNode

LOAD_TEST(btunittest, parallel_ut_4)
{
	AgentNodeTest* myTestAgent = initTestEnvNode("node_test/parallel_ut_4", format);
	myTestAgent->resetProperties();
	myTestAgent->btexec();
	CHECK_EQUAL(2, myTestAgent->testVar_0);
	myTestAgent->resetProperties();
	myTestAgent->btexec();
	CHECK_EQUAL(2, myTestAgent->testVar_0);
	finlTestEnvNode(myTestAgent);
}
开发者ID:CodeBees,项目名称:behaviac,代码行数:11,代码来源:ParallelNodeUnitTest.cpp

示例3: initTestEnvNode

LOAD_TEST(btunittest, predicate_action_ut_3)
{
    AgentNodeTest* myTestAgent = initTestEnvNode("node_test/predicate_action_ut_3", format);
    myTestAgent->resetProperties();
    behaviac::EBTStatus status = myTestAgent->btexec();
    CHECK_EQUAL(behaviac::BT_RUNNING, status);
    CHECK_EQUAL(0, myTestAgent->testVar_0);
    status = myTestAgent->btexec();
    CHECK_EQUAL(0, myTestAgent->testVar_0);
    CHECK_EQUAL(behaviac::BT_FAILURE, status);
    finlTestEnvNode(myTestAgent);
}
开发者ID:1414648814,项目名称:behaviac,代码行数:12,代码来源:PredicateUnitTest.cpp

示例4:

LOAD_TEST(btunittest, selector_probability_ut_4)
{
	const char* tree = "node_test/selector_probability_ut_4";

	behaviac::Profiler::CreateInstance();
	behaviac::Config::SetSocketing(false);
	behaviac::Config::SetLogging(false);

	//behaviac::Agent::Register<AgentNodeTest>();
	registerAllTypes();
	AgentNodeTest* myTestAgent = AgentNodeTest::DynamicCast(behaviac::Agent::Create<AgentNodeTest>());
	behaviac::Agent::SetIdMask(1);
	myTestAgent->SetIdFlag(1);
	myTestAgent->btload(tree);
	myTestAgent->btsetcurrent(tree);
	myTestAgent->resetProperties();

	behaviac::Workspace::GetInstance()->SetTimeSinceStartup(0.0);

	for (int i = 0; i < 10; ++i) {
		myTestAgent->btexec();
		if (myTestAgent->testVar_0 != -1) {
			CHECK_EQUAL(0, myTestAgent->testVar_0);
			CHECK_EQUAL(-1, myTestAgent->testVar_1);
			CHECK_FLOAT_EQUAL(0.0f, myTestAgent->testVar_2);
		}
		else {
			CHECK_EQUAL(-1, myTestAgent->testVar_0);
			CHECK_EQUAL(0, myTestAgent->testVar_1);
			CHECK_FLOAT_EQUAL(-1, myTestAgent->testVar_2);
		}

		behaviac::Workspace::GetInstance()->SetTimeSinceStartup(behaviac::Workspace::GetInstance()->GetTimeSinceStartup() + 0.1);
	}

	behaviac::Workspace::GetInstance()->SetTimeSinceStartup(behaviac::Workspace::GetInstance()->GetTimeSinceStartup() + 0.1);
	myTestAgent->btexec();

	CHECK_EQUAL(-1, myTestAgent->testVar_0);
	CHECK_EQUAL(-1, myTestAgent->testVar_1);


	unregisterAllTypes();
	BEHAVIAC_DELETE(myTestAgent);
	//behaviac::Agent::UnRegister<AgentNodeTest>();

	behaviac::Profiler::DestroyInstance();
}
开发者ID:Evilcoolkings,项目名称:behaviac,代码行数:48,代码来源:NodeUnitTest.cpp

示例5: initTestEnvNode

LOAD_TEST(btunittest, decoration_successuntil_ut_1)
{
    AgentNodeTest* myTestAgent = initTestEnvNode("node_test/decoration_successuntil_ut_1", format);
    myTestAgent->resetProperties();
    int loopCount = 0;

    while (loopCount < 5)
    {
        behaviac::EBTStatus status = myTestAgent->btexec();

        if (loopCount < 4)
        {
            CHECK_EQUAL(behaviac::BT_SUCCESS, status);

        }
        else
        {
            CHECK_EQUAL(behaviac::BT_FAILURE, status);
        }

        ++loopCount;
    }

    finlTestEnvNode(myTestAgent);
}
开发者ID:1414648814,项目名称:behaviac,代码行数:25,代码来源:DecorationNodeUnitTest.cpp

示例6: initTestEnvNode

LOAD_TEST(btunittest, decoration_countlimit_ut_2)
{
    AgentNodeTest* myTestAgent = initTestEnvNode("node_test/decoration_countlimit_ut_2", format);
    myTestAgent->resetProperties();
    int loopCount = 0;
    while (loopCount < 11)
    {
        if (loopCount == 5)
        {
            myTestAgent->testVar_1 = 0;
            myTestAgent->testVar_2 = 0.0f;
        }

        myTestAgent->btexec();
        myTestAgent->testVar_1 = -1;
        if (loopCount < 10)
        {
            CHECK_EQUAL(0, myTestAgent->testVar_0);
        }
        else
        {
            CHECK_EQUAL(1, myTestAgent->testVar_0);
        }
        ++loopCount;
    }
    finlTestEnvNode(myTestAgent);
}
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:27,代码来源:DecorationNodeUnitTest.cpp

示例7: registerAllTypes

//< Wait For Frames Tests
LOAD_TEST(btunittest, action_waitframes_ut_0)
{
    behaviac::Profiler::CreateInstance();
    behaviac::Config::SetSocketing(false);
    behaviac::Config::SetLogging(false);

    //behaviac::Agent::Register<AgentNodeTest>();
    registerAllTypes();
    AgentNodeTest* myTestAgent = AgentNodeTest::DynamicCast(behaviac::Agent::Create<AgentNodeTest>());
    behaviac::Agent::SetIdMask(1);
    myTestAgent->SetIdFlag(1);
    myTestAgent->btload("node_test/action_waitframes_ut_0");
    myTestAgent->btsetcurrent("node_test/action_waitframes_ut_0");
    myTestAgent->resetProperties();

    int loopCount = 0;

	behaviac::Workspace::GetInstance()->SetFrameSinceStartup(0);

    while (loopCount < 5)
    {
        myTestAgent->btexec();

        if (loopCount < 4)
        {
            CHECK_EQUAL(1, myTestAgent->testVar_0);
        }
        else
        {
            CHECK_EQUAL(2, myTestAgent->testVar_0);
        }

        ++loopCount;
		behaviac::Workspace::GetInstance()->SetFrameSinceStartup(behaviac::Workspace::GetInstance()->GetFrameSinceStartup() + 1);
    }

    myTestAgent->resetProperties();
    myTestAgent->btexec();
    CHECK_EQUAL(1, myTestAgent->testVar_0);

    BEHAVIAC_DELETE(myTestAgent);
    behaviac::Agent::UnRegister<AgentNodeTest>();

    behaviac::Profiler::DestroyInstance();

    unregisterAllTypes();
}
开发者ID:Evilcoolkings,项目名称:behaviac,代码行数:48,代码来源:NodeUnitTest.cpp

示例8: initTestEnvNode

LOAD_TEST(btunittest, event_ut_1)
{
	AgentNodeTest* myTestAgent = initTestEnvNode("node_test/event_ut_1", format);

	myTestAgent->resetProperties();

	behaviac::EBTStatus status = myTestAgent->btexec();
	CHECK_EQUAL(behaviac::BT_RUNNING, status);

	myTestAgent->FireEvent("event_test_int", 13);
	CHECK_EQUAL(13, myTestAgent->event_test_var_int);
			
	status = myTestAgent->btexec();
	CHECK_EQUAL(behaviac::BT_RUNNING, status);
	
	finlTestEnvNode(myTestAgent);
}
开发者ID:AdamHyl,项目名称:behaviac,代码行数:17,代码来源:EventUnitTest.cpp


注:本文中的AgentNodeTest::btexec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。