diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2010-08-18 16:17:15 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2010-08-18 16:17:15 +0000 |
| commit | 9dc8cc535ef5fc4ea78f967fe285fe4424ff4458 (patch) | |
| tree | a8a267bf5b8f8ca74bc767964fe47a97b33be01a /src/unit | |
| parent | cebb8eca644ff772b169178810372971176ebe9d (diff) | |
| download | libgats-9dc8cc535ef5fc4ea78f967fe285fe4424ff4458.tar.gz libgats-9dc8cc535ef5fc4ea78f967fe285fe4424ff4458.tar.bz2 libgats-9dc8cc535ef5fc4ea78f967fe285fe4424ff4458.tar.xz libgats-9dc8cc535ef5fc4ea78f967fe285fe4424ff4458.zip | |
getting it all tuned up.
Diffstat (limited to 'src/unit')
| -rw-r--r-- | src/unit/basic.unit | 29 |
1 files changed, 29 insertions, 0 deletions
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 | |||
| 119 | unitFailed("Bad string."); | 119 | unitFailed("Bad string."); |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | |||
| 123 | test dictionary | ||
| 124 | { | ||
| 125 | MemBuf mb; | ||
| 126 | |||
| 127 | { | ||
| 128 | Gats::Dictionary dict; | ||
| 129 | dict.insert("bool", true ); | ||
| 130 | dict.insert("int", 33403055 ); | ||
| 131 | dict.insert("str", "Hey there" ); | ||
| 132 | dict.write( mb ); | ||
| 133 | } | ||
| 134 | |||
| 135 | mb.setPos( 0 ); | ||
| 136 | |||
| 137 | { | ||
| 138 | Gats::Object *pRead = Gats::Object::read( mb ); | ||
| 139 | unitTest( pRead != NULL ); | ||
| 140 | Gats::Dictionary *pDict = dynamic_cast<Gats::Dictionary *>(pRead); | ||
| 141 | unitTest( pDict != NULL ); | ||
| 142 | |||
| 143 | unitTest( pDict->getBool("bool") == true ); | ||
| 144 | unitTest( pDict->getInt("int") == 33403055 ); | ||
| 145 | unitTest( pDict->getStr("str") == "Hey there" ); | ||
| 146 | unitTest( pDict->getSize() == 3 ); | ||
| 147 | |||
| 148 | delete pDict; | ||
| 149 | } | ||
| 150 | } | ||
| 122 | } | 151 | } |
