From 9dc8cc535ef5fc4ea78f967fe285fe4424ff4458 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 18 Aug 2010 16:17:15 +0000 Subject: getting it all tuned up. --- src/unit/basic.unit | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/unit') diff --git a/src/unit/basic.unit b/src/unit/basic.unit index 9389c70..744d679 100644 --- a/src/unit/basic.unit +++ b/src/unit/basic.unit @@ -119,4 +119,33 @@ suite Basic unitFailed("Bad string."); } } + + test dictionary + { + MemBuf mb; + + { + Gats::Dictionary dict; + dict.insert("bool", true ); + dict.insert("int", 33403055 ); + dict.insert("str", "Hey there" ); + dict.write( mb ); + } + + mb.setPos( 0 ); + + { + Gats::Object *pRead = Gats::Object::read( mb ); + unitTest( pRead != NULL ); + Gats::Dictionary *pDict = dynamic_cast(pRead); + unitTest( pDict != NULL ); + + unitTest( pDict->getBool("bool") == true ); + unitTest( pDict->getInt("int") == 33403055 ); + unitTest( pDict->getStr("str") == "Hey there" ); + unitTest( pDict->getSize() == 3 ); + + delete pDict; + } + } } -- cgit v1.2.3