Skip to content

Commit

Permalink
Adding some test on creation, schema access and value access
Browse files Browse the repository at this point in the history
  • Loading branch information
theod committed Jul 3, 2013
1 parent ab0e7f7 commit 0b0af8a
Showing 1 changed file with 51 additions and 4 deletions.
55 changes: 51 additions & 4 deletions Foundation/library/tests/TTDictionary.test.cpp
Expand Up @@ -31,10 +31,57 @@ TTDictionaryTest::~TTDictionaryTest()
void TTDictionaryTestBasic(int& errorCount, int& testAssertionCount)
{
TTTestLog("\n");
TTTestLog("Testing something");

TTTestAssertion("TTDictionary: Test fails if ...",
NO,
TTTestLog("Testing dictionary creation");

// creation using a random name
TTDictionary d1;

TTTestAssertion("TTDictionary random name : Test fails if the dictionary have no name",
d1.name() != kTTSymEmpty,
testAssertionCount,
errorCount);

// creation using a specific string name
//TTDictionary d2("dictionary2"); // theo - is this should be possible ?

// creation using a specific symbol name
//TTDictionary d3(kTTSym_symbol); // theo - is this should be possible ?



TTTestLog("\n");
TTTestLog("Testing dictionary schema");

TTTestAssertion("TTDictionary schema : Test fails if the dictionary schema is not empty",
d1.getSchema() == kTTSymEmpty,
testAssertionCount,
errorCount);

d1.setSchema(TTSymbol("aSchemaName"));

TTTestAssertion("TTDictionary schema : Test fails if the dictionary schema is not \"aSchemaName\"",
d1.getSchema() == TTSymbol("aSchemaName"),
testAssertionCount,
errorCount);



TTTestLog("\n");
TTTestLog("Testing dictionary value");

TTValue v;
d1.getValue(v);

TTTestAssertion("TTDictionary value : Test fails if the dictionary value is not empty",
v == kTTValNONE,
testAssertionCount,
errorCount);

d1.setValue(kTTVal1);
d1.getValue(v);

TTTestAssertion("TTDictionary value : Test fails if the dictionary value is not kTTVal1",
v == kTTVal1,
testAssertionCount,
errorCount);
}
Expand Down

0 comments on commit 0b0af8a

Please sign in to comment.