diff options
Diffstat (limited to '')
| -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 | } |
