DynamicStruct keyed by integer

This commit is contained in:
Aleksandar Fabijanic
2008-11-24 12:36:15 +00:00
parent 721062b0d3
commit d43f4d6164
6 changed files with 325 additions and 222 deletions

View File

@@ -1940,7 +1940,7 @@ void VarTest::testDynamicStructBasics()
}
void VarTest::testDynamicStruct()
void VarTest::testDynamicStructString()
{
DynamicStruct aStruct;
aStruct["First Name"] = "Junior";
@@ -1954,6 +1954,22 @@ void VarTest::testDynamicStruct()
}
void VarTest::testDynamicStructInt()
{
Dynamic::Struct<int> aStruct;
aStruct[0] = "Junior";
aStruct[1] = "POCO";
Var a1(aStruct);
assert (a1[0] == "Junior");
assert (a1[1] == "POCO");
a1[0] = "Senior";
assert (a1[0] == "Senior");
}
void VarTest::testArrayToString()
{
std::string s1("string");
@@ -2380,7 +2396,8 @@ CppUnit::Test* VarTest::suite()
CppUnit_addTest(pSuite, VarTest, testIsArray);
CppUnit_addTest(pSuite, VarTest, testArrayIdxOperator);
CppUnit_addTest(pSuite, VarTest, testDynamicStructBasics);
CppUnit_addTest(pSuite, VarTest, testDynamicStruct);
CppUnit_addTest(pSuite, VarTest, testDynamicStructString);
CppUnit_addTest(pSuite, VarTest, testDynamicStructInt);
CppUnit_addTest(pSuite, VarTest, testArrayToString);
CppUnit_addTest(pSuite, VarTest, testStructToString);
CppUnit_addTest(pSuite, VarTest, testArrayOfStructsToString);