| 277 | } |
| 278 | |
| 279 | void ElementXMLTest::testBinaryData() |
| 280 | { |
| 281 | soarxml::ElementXML* pXML1 = createXML1(); |
| 282 | soarxml::ElementXML* pXML2 = createXML2(); |
| 283 | soarxml::ElementXML* pXML4 = createXML4(); |
| 284 | soarxml::ElementXML* pXML5 = createXML5(); |
| 285 | |
| 286 | pXML4->AddChild(pXML1) ; |
| 287 | pXML4->AddChild(pXML2) ; |
| 288 | pXML4->AddChild(pXML5) ; |
| 289 | |
| 290 | char* pStr = pXML4->GenerateXMLString(true) ; |
| 291 | soarxml::ElementXML* pParsedXML = soarxml::ElementXML::ParseXMLFromString(pStr) ; |
| 292 | |
| 293 | CPPUNIT_ASSERT(pParsedXML != NULL) ; |
| 294 | CPPUNIT_ASSERT(pParsedXML->GetNumberChildren() == 3) ; |
| 295 | |
| 296 | soarxml::ElementXML child0(NULL) ; |
| 297 | soarxml::ElementXML const* pChild0 = &child0 ; |
| 298 | CPPUNIT_ASSERT(pParsedXML->GetChild(&child0, 0)); |
| 299 | CPPUNIT_ASSERT(pChild0->GetTagName() != NULL); |
| 300 | CPPUNIT_ASSERT(std::string(pChild0->GetTagName()) == tag1) ; |
| 301 | CPPUNIT_ASSERT(pChild0->GetCharacterData() != NULL); |
| 302 | CPPUNIT_ASSERT(std::string(pChild0->GetCharacterData()) == data1) ; |
| 303 | CPPUNIT_ASSERT(pChild0->GetNumberAttributes() == 2) ; |
| 304 | CPPUNIT_ASSERT(pChild0->GetNumberChildren() == 0) ; |
| 305 | |
| 306 | soarxml::ElementXML child1(NULL) ; |
| 307 | soarxml::ElementXML const* pChild1 = &child1 ; |
| 308 | CPPUNIT_ASSERT(pParsedXML->GetChild(&child1, 1)) ; |
| 309 | CPPUNIT_ASSERT(pChild1->GetTagName() != NULL); |
| 310 | CPPUNIT_ASSERT(std::string(pChild1->GetTagName()) == tag2) ; |
| 311 | CPPUNIT_ASSERT(pChild1->GetCharacterData() != NULL); |
| 312 | CPPUNIT_ASSERT(std::string(pChild1->GetCharacterData()) == data2) ; |
| 313 | CPPUNIT_ASSERT(pChild0->GetNumberChildren() == 0) ; |
| 314 | CPPUNIT_ASSERT(pChild1->GetAttribute(att21.c_str()) != NULL); |
| 315 | CPPUNIT_ASSERT(std::string(pChild1->GetAttribute(att21.c_str())) == val21) ; |
| 316 | |
| 317 | soarxml::ElementXML child2(NULL) ; |
| 318 | soarxml::ElementXML const* pChild2 = &child2 ; |
| 319 | CPPUNIT_ASSERT(pParsedXML->GetChild(&child2, 2)); |
| 320 | CPPUNIT_ASSERT(pChild2->IsCharacterDataBinary()) ; |
| 321 | |
| 322 | const char* pBuffer = pChild2->GetCharacterData() ; |
| 323 | int bufferLen = pChild2->GetCharacterDataLength() ; |
| 324 | |
| 325 | CPPUNIT_ASSERT(bufferLen == BUFFER_LENGTH) ; |
| 326 | CPPUNIT_ASSERT(verifyBuffer(pBuffer)) ; |
| 327 | |
| 328 | soarxml::ElementXML::DeleteString(pStr) ; |
| 329 | |
| 330 | delete pXML4 ; |
| 331 | delete pParsedXML ; |
| 332 | } |
| 333 | |
| 334 | void ElementXMLTest::testEquals() |
| 335 | { |
nothing calls this directly
no test coverage detected