示例#1
0
LOAD_TEST(btunittest, vector_test)
{
    TestNS::AgentArrayAccessTest* testAgent = initTestEnvArray("par_test/vector_test", format);
    testAgent->resetProperties();
    testAgent->btexec();

    int Int1 = testAgent->GetVariable<int>("Int");
    CHECK_EQUAL(1, Int1);

    int Int2 = testAgent->Int;
    CHECK_EQUAL(1, Int2);

    int c_Int = testAgent->GetVariable<int>("c_Int");
    CHECK_EQUAL(10, c_Int);

    int Int0 = testAgent->ListInts[0];
    CHECK_EQUAL(110, Int0);

    int c_Count = testAgent->GetVariable<int>("c_Count");
    CHECK_EQUAL(5, c_Count);

    behaviac::vector<int> c_ListInts = testAgent->GetVariable<behaviac::vector<int> >("c_ListInts");
    CHECK_EQUAL(5, c_ListInts.size());
    CHECK_EQUAL(20, c_ListInts[0]);

    finlTestEnvArray(testAgent);
}
LOAD_TEST(btunittest, vector_test)
{
    TestNS::AgentArrayAccessTest* testAgent = initTestEnvArray("par_test/vector_test", format);
    testAgent->resetProperties();
    testAgent->btexec();

    int Int1 = testAgent->GetVariable<int>("Int");
    CHECK_EQUAL(1, Int1);

    int Int2 = testAgent->Int;
    CHECK_EQUAL(1, Int2);

    int c_Int = testAgent->GetVariable<int>("c_Int");
    CHECK_EQUAL(10, c_Int);

    int Int0 = testAgent->ListInts[0];
    CHECK_EQUAL(110, Int0);

    int c_Count = testAgent->GetVariable<int>("c_Count");
    CHECK_EQUAL(5, c_Count);

	behaviac::vector<double> c_douleVec = testAgent->GetVariable<behaviac::vector<double> >("c_douleVec");
	CHECK_EQUAL(103, c_douleVec.size());
	for (int i = 0; i < 100; ++i)
	{
		CHECK_FLOAT_EQUAL(c_douleVec[3 + i], 0.03);
	}

	behaviac::vector<double> c_douleVec2 = testAgent->GetVariable<behaviac::vector<double> >("c_doubleVec2");
	CHECK_EQUAL(103, c_douleVec2.size());
	for (int i = 0; i < 100; ++i)
	{
		CHECK_FLOAT_EQUAL(c_douleVec2[3 + i], 0.05);
	}

    finlTestEnvArray(testAgent);
}