diff --git a/.gitignore b/.gitignore index 15ea1113c..b1334b654 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ # Gradle # ########## .gradle/ +**/guild/ **/gradle/ **/options.txt **/output.txt diff --git a/CppParser/testsuite/src/AttributesParserTest.cpp b/CppParser/testsuite/src/AttributesParserTest.cpp index 2ef6b68a3..ab8c91df7 100644 --- a/CppParser/testsuite/src/AttributesParserTest.cpp +++ b/CppParser/testsuite/src/AttributesParserTest.cpp @@ -36,7 +36,7 @@ void AttributesParserTest::testParser1() std::istringstream istr(""); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.begin() == attrs.end()); + assertTrue (attrs.begin() == attrs.end()); } @@ -46,7 +46,7 @@ void AttributesParserTest::testParser2() std::istringstream istr("name=value"); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.getString("name") == "value"); + assertTrue (attrs.getString("name") == "value"); } @@ -56,8 +56,8 @@ void AttributesParserTest::testParser3() std::istringstream istr("name=value, name2=100"); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.getString("name") == "value"); - assert (attrs.getInt("name2") == 100); + assertTrue (attrs.getString("name") == "value"); + assertTrue (attrs.getInt("name2") == 100); } @@ -67,9 +67,9 @@ void AttributesParserTest::testParser4() std::istringstream istr("name=value, name2=100, name3"); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.getString("name") == "value"); - assert (attrs.getInt("name2") == 100); - assert (attrs.getBool("name3")); + assertTrue (attrs.getString("name") == "value"); + assertTrue (attrs.getInt("name2") == 100); + assertTrue (attrs.getBool("name3")); } @@ -79,9 +79,9 @@ void AttributesParserTest::testParser5() std::istringstream istr("name.a=value, name.b=100, name.c"); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.getString("name.a") == "value"); - assert (attrs.getInt("name.b") == 100); - assert (attrs.getBool("name.c")); + assertTrue (attrs.getString("name.a") == "value"); + assertTrue (attrs.getInt("name.b") == 100); + assertTrue (attrs.getBool("name.c")); } @@ -91,9 +91,9 @@ void AttributesParserTest::testParser6() std::istringstream istr("name = {a=value, b=100, c}"); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.getString("name.a") == "value"); - assert (attrs.getInt("name.b") == 100); - assert (attrs.getBool("name.c")); + assertTrue (attrs.getString("name.a") == "value"); + assertTrue (attrs.getInt("name.b") == 100); + assertTrue (attrs.getBool("name.c")); } @@ -103,10 +103,10 @@ void AttributesParserTest::testParser7() std::istringstream istr("name = {a=value, b=100, c}, name2=\"foo\""); AttributesParser parser(attrs, istr); parser.parse(); - assert (attrs.getString("name.a") == "value"); - assert (attrs.getInt("name.b") == 100); - assert (attrs.getBool("name.c")); - assert (attrs.getString("name2") == "foo"); + assertTrue (attrs.getString("name.a") == "value"); + assertTrue (attrs.getInt("name.b") == 100); + assertTrue (attrs.getBool("name.c")); + assertTrue (attrs.getString("name2") == "foo"); } diff --git a/CppParser/testsuite/src/CppParserTest.cpp b/CppParser/testsuite/src/CppParserTest.cpp index 1fbda465e..2c6bb13cd 100644 --- a/CppParser/testsuite/src/CppParserTest.cpp +++ b/CppParser/testsuite/src/CppParserTest.cpp @@ -69,47 +69,47 @@ void CppParserTest::testExtractName() { std::string decl("int _var"); std::string name = Symbol::extractName(decl); - assert (name == "_var"); + assertTrue (name == "_var"); decl = "void func(int arg1, int arg2)"; name = Symbol::extractName(decl); - assert (name == "func"); + assertTrue (name == "func"); decl = "const std::vector* var"; name = Symbol::extractName(decl); - assert (name == "var"); + assertTrue (name == "var"); decl = "const std::vector* func(int arg) = 0"; name = Symbol::extractName(decl); - assert (name == "func"); + assertTrue (name == "func"); decl = "int (*func)(int, const std::string&)"; name = Symbol::extractName(decl); - assert (name == "func"); + assertTrue (name == "func"); decl = "int ( * func )(int, const std::string&)"; name = Symbol::extractName(decl); - assert (name == "func"); + assertTrue (name == "func"); decl = "template B func(A a, B b)"; name = Symbol::extractName(decl); - assert (name == "func"); + assertTrue (name == "func"); decl = "template class Class"; name = Symbol::extractName(decl); - assert (name == "Class"); + assertTrue (name == "Class"); decl = "template <> class Class"; name = Symbol::extractName(decl); - assert (name == "Class"); + assertTrue (name == "Class"); decl = "template <> class Class "; name = Symbol::extractName(decl); - assert (name == "Class"); + assertTrue (name == "Class"); decl = "template <> class Class >"; name = Symbol::extractName(decl); - assert (name == "Class"); + assertTrue (name == "Class"); } diff --git a/CppUnit/include/CppUnit/TestCase.h b/CppUnit/include/CppUnit/TestCase.h index 37e2e536a..2444aac28 100644 --- a/CppUnit/include/CppUnit/TestCase.h +++ b/CppUnit/include/CppUnit/TestCase.h @@ -220,10 +220,16 @@ inline std::string TestCase::toString() // and file name at the point of an error. // Just goes to show that preprocessors do have some // redeeming qualities. + +// for backward compatibility only +// (may conflict with C assert, use at your own risk) #undef assert #define assert(condition) \ (this->assertImplementation((condition), (#condition), __LINE__, __FILE__)) +#define assertTrue(condition) \ + (this->assertImplementation((condition), (#condition), __LINE__, __FILE__)) + #define loop_1_assert(data1line, condition) \ (this->loop1assertImplementation((condition), (#condition), __LINE__, data1line, __FILE__)) diff --git a/Crypto/testsuite/src/CryptoTest.cpp b/Crypto/testsuite/src/CryptoTest.cpp index 89d92b1fa..830cdf8ef 100644 --- a/Crypto/testsuite/src/CryptoTest.cpp +++ b/Crypto/testsuite/src/CryptoTest.cpp @@ -74,7 +74,7 @@ void CryptoTest::testEncryptDecrypt() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_NONE); std::string result = pCipher->decryptString(out, Cipher::ENC_NONE); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -82,7 +82,7 @@ void CryptoTest::testEncryptDecrypt() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BASE64); std::string result = pCipher->decryptString(out, Cipher::ENC_BASE64); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -90,7 +90,7 @@ void CryptoTest::testEncryptDecrypt() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BINHEX); std::string result = pCipher->decryptString(out, Cipher::ENC_BINHEX); - assert (in == result); + assertTrue (in == result); } } @@ -105,7 +105,7 @@ void CryptoTest::testEncryptDecryptWithSalt() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_NONE); std::string result = pCipher2->decryptString(out, Cipher::ENC_NONE); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -113,7 +113,7 @@ void CryptoTest::testEncryptDecryptWithSalt() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BASE64); std::string result = pCipher2->decryptString(out, Cipher::ENC_BASE64); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -121,7 +121,7 @@ void CryptoTest::testEncryptDecryptWithSalt() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BINHEX); std::string result = pCipher2->decryptString(out, Cipher::ENC_BINHEX); - assert (in == result); + assertTrue (in == result); } } @@ -138,7 +138,7 @@ void CryptoTest::testEncryptDecryptWithSaltSha1() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_NONE); std::string result = pCipher2->decryptString(out, Cipher::ENC_NONE); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -146,7 +146,7 @@ void CryptoTest::testEncryptDecryptWithSaltSha1() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BASE64); std::string result = pCipher2->decryptString(out, Cipher::ENC_BASE64); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -154,7 +154,7 @@ void CryptoTest::testEncryptDecryptWithSaltSha1() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BINHEX); std::string result = pCipher2->decryptString(out, Cipher::ENC_BINHEX); - assert (in == result); + assertTrue (in == result); } } @@ -168,7 +168,7 @@ void CryptoTest::testEncryptDecryptDESECB() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_NONE); std::string result = pCipher->decryptString(out, Cipher::ENC_NONE); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -176,7 +176,7 @@ void CryptoTest::testEncryptDecryptDESECB() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BASE64); std::string result = pCipher->decryptString(out, Cipher::ENC_BASE64); - assert (in == result); + assertTrue (in == result); } for (std::size_t n = 1; n < MAX_DATA_SIZE; n++) @@ -184,7 +184,7 @@ void CryptoTest::testEncryptDecryptDESECB() std::string in(n, 'x'); std::string out = pCipher->encryptString(in, Cipher::ENC_BINHEX); std::string result = pCipher->decryptString(out, Cipher::ENC_BINHEX); - assert (in == result); + assertTrue (in == result); } } @@ -206,7 +206,7 @@ void CryptoTest::testEncryptDecryptGCM() std::string in(n, 'x'); encryptorStream << in; encryptorStream.close(); - assert (encryptorStream.good()); + assertTrue (encryptorStream.good()); std::string tag = pEncryptor->getTag(); @@ -216,7 +216,7 @@ void CryptoTest::testEncryptDecryptGCM() std::string out; decryptorStream >> out; - assert (in == out); + assertTrue (in == out); } } @@ -230,7 +230,7 @@ void CryptoTest::testPassword() base64KeyEnc.write(reinterpret_cast(&key.getKey()[0]), key.keySize()); base64KeyEnc.close(); std::string base64Key = keyStream.str(); - assert (base64Key == "hIzxBt58GDd7/6mRp88bewKk42lM4QwaF78ek0FkVoA="); + assertTrue (base64Key == "hIzxBt58GDd7/6mRp88bewKk42lM4QwaF78ek0FkVoA="); } @@ -256,8 +256,8 @@ void CryptoTest::testPasswordSha1() // openssl enc -e -a -md sha1 -aes256 -k password -S 73616c7473616c74 -P // (where "salt" == 73616c74 in Hex, doubled for an 8 bytes salt, openssl padds the salt with 0 // whereas Poco's implementation padds with the existing bytes using a modulo operation) - assert (hexIv == "c96049b0edc0b67af61ecc43d3de8898"); - assert (hexKey == "cab86dd6261710891e8cb56ee3625691a75df344f0bff4c12cf3596fc00b39c7"); + assertTrue (hexIv == "c96049b0edc0b67af61ecc43d3de8898"); + assertTrue (hexKey == "cab86dd6261710891e8cb56ee3625691a75df344f0bff4c12cf3596fc00b39c7"); } @@ -268,7 +268,7 @@ void CryptoTest::testEncryptInterop() const std::string plainText = "This is a secret message."; const std::string expectedCipherText = "9HITTPaU3A/LaZzldbdnRZ109DKlshouKren/n8BsHc="; std::string cipherText = pCipher->encryptString(plainText, Cipher::ENC_BASE64); - assert (cipherText == expectedCipherText); + assertTrue (cipherText == expectedCipherText); } @@ -279,7 +279,7 @@ void CryptoTest::testDecryptInterop() const std::string expectedPlainText = "This is a secret message."; const std::string cipherText = "9HITTPaU3A/LaZzldbdnRZ109DKlshouKren/n8BsHc="; std::string plainText = pCipher->decryptString(cipherText, Cipher::ENC_BASE64); - assert (plainText == expectedPlainText); + assertTrue (plainText == expectedPlainText); } @@ -298,18 +298,18 @@ void CryptoTest::testStreams() std::string result; Poco::StreamCopier::copyToString(decryptor, result); - assert (result == SECRET_MESSAGE); - assert (decryptor.eof()); - assert (!decryptor.bad()); + assertTrue (result == SECRET_MESSAGE); + assertTrue (decryptor.eof()); + assertTrue (!decryptor.bad()); std::istringstream emptyStream; DecryptingInputStream badDecryptor(emptyStream, *pCipher); Poco::StreamCopier::copyToString(badDecryptor, result); - assert (badDecryptor.fail()); - assert (badDecryptor.bad()); - assert (!badDecryptor.eof()); + assertTrue (badDecryptor.fail()); + assertTrue (badDecryptor.bad()); + assertTrue (!badDecryptor.eof()); } @@ -327,22 +327,22 @@ void CryptoTest::testCertificate() std::string organizationName(cert.subjectName(X509Certificate::NID_ORGANIZATION_NAME)); std::string organizationUnitName(cert.subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME)); - assert (subjectName == "/CN=appinf.com/O=Applied Informatics Software Engineering GmbH/OU=Development/ST=Carinthia/C=AT/L=St. Jakob im Rosental/emailAddress=guenter.obiltschnig@appinf.com"); - assert (issuerName == subjectName); - assert (commonName == "appinf.com"); - assert (country == "AT"); - assert (localityName == "St. Jakob im Rosental"); - assert (stateOrProvince == "Carinthia"); - assert (organizationName == "Applied Informatics Software Engineering GmbH"); - assert (organizationUnitName == "Development"); + assertTrue (subjectName == "/CN=appinf.com/O=Applied Informatics Software Engineering GmbH/OU=Development/ST=Carinthia/C=AT/L=St. Jakob im Rosental/emailAddress=guenter.obiltschnig@appinf.com"); + assertTrue (issuerName == subjectName); + assertTrue (commonName == "appinf.com"); + assertTrue (country == "AT"); + assertTrue (localityName == "St. Jakob im Rosental"); + assertTrue (stateOrProvince == "Carinthia"); + assertTrue (organizationName == "Applied Informatics Software Engineering GmbH"); + assertTrue (organizationUnitName == "Development"); // fails with recent OpenSSL versions: - // assert (cert.issuedBy(cert)); + // assertTrue (cert.issuedBy(cert)); std::istringstream otherCertStream(APPINF_PEM); X509Certificate otherCert(otherCertStream); - assert (cert.equals(otherCert)); + assertTrue (cert.equals(otherCert)); } diff --git a/Crypto/testsuite/src/DigestEngineTest.cpp b/Crypto/testsuite/src/DigestEngineTest.cpp index d4c033600..bedba5b97 100644 --- a/Crypto/testsuite/src/DigestEngineTest.cpp +++ b/Crypto/testsuite/src/DigestEngineTest.cpp @@ -34,26 +34,26 @@ void DigestEngineTest::testMD5() // test vectors from RFC 1321 engine.update(""); - assert (DigestEngine::digestToHex(engine.digest()) == "d41d8cd98f00b204e9800998ecf8427e"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "d41d8cd98f00b204e9800998ecf8427e"); engine.update("a"); - assert (DigestEngine::digestToHex(engine.digest()) == "0cc175b9c0f1b6a831c399e269772661"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "0cc175b9c0f1b6a831c399e269772661"); engine.update("abc"); - assert (DigestEngine::digestToHex(engine.digest()) == "900150983cd24fb0d6963f7d28e17f72"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "900150983cd24fb0d6963f7d28e17f72"); engine.update("message digest"); - assert (DigestEngine::digestToHex(engine.digest()) == "f96b697d7cb7938d525a2f31aaf161d0"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "f96b697d7cb7938d525a2f31aaf161d0"); engine.update("abcdefghijklmnopqrstuvwxyz"); - assert (DigestEngine::digestToHex(engine.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); engine.update("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); engine.update("abcdefghijklmnopqrstuvwxyz0123456789"); - assert (DigestEngine::digestToHex(engine.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f"); engine.update("12345678901234567890123456789012345678901234567890123456789012345678901234567890"); - assert (DigestEngine::digestToHex(engine.digest()) == "57edf4a22be3c955ac49da2e2107b67a"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "57edf4a22be3c955ac49da2e2107b67a"); } void DigestEngineTest::testSHA1() @@ -63,14 +63,14 @@ void DigestEngineTest::testSHA1() // test vectors from FIPS 180-1 engine.update("abc"); - assert (DigestEngine::digestToHex(engine.digest()) == "a9993e364706816aba3e25717850c26c9cd0d89d"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "a9993e364706816aba3e25717850c26c9cd0d89d"); engine.update("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); - assert (DigestEngine::digestToHex(engine.digest()) == "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); for (int i = 0; i < 1000000; ++i) engine.update('a'); - assert (DigestEngine::digestToHex(engine.digest()) == "34aa973cd4c4daa4f61eeb2bdbad27316534016f"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "34aa973cd4c4daa4f61eeb2bdbad27316534016f"); } void DigestEngineTest::setUp() diff --git a/Crypto/testsuite/src/ECTest.cpp b/Crypto/testsuite/src/ECTest.cpp index 943e3ecc6..98308f036 100644 --- a/Crypto/testsuite/src/ECTest.cpp +++ b/Crypto/testsuite/src/ECTest.cpp @@ -57,7 +57,7 @@ void ECTest::testECNewKeys() std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } else std::cerr << "No elliptic curves found!" << std::endl; @@ -94,7 +94,7 @@ void ECTest::testECNewKeysNoPassphrase() std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } else std::cerr << "No elliptic curves found!" << std::endl; @@ -128,7 +128,7 @@ void ECTest::testECDSASignSha256() ECKey keyPub(&iPub); ECDSADigestEngine eng2(keyPub, "SHA256"); eng2.update(msg.c_str(), static_cast(msg.length())); - assert(eng2.verify(sig)); + assertTrue(eng2.verify(sig)); } else std::cerr << "No elliptic curves found!" << std::endl; @@ -164,7 +164,7 @@ void ECTest::testECDSASignManipulated() ECKey keyPub(&iPub); ECDSADigestEngine eng2(keyPub, "SHA256"); eng2.update(msgManip.c_str(), static_cast(msgManip.length())); - assert (!eng2.verify(sig)); + assertTrue (!eng2.verify(sig)); } else std::cerr << "No elliptic curves found!" << std::endl; diff --git a/Crypto/testsuite/src/EVPTest.cpp b/Crypto/testsuite/src/EVPTest.cpp index 9ae91ab1a..4375c329b 100644 --- a/Crypto/testsuite/src/EVPTest.cpp +++ b/Crypto/testsuite/src/EVPTest.cpp @@ -42,29 +42,29 @@ void EVPTest::testRSAEVPPKey() try { RSAKey* key = new RSAKey(RSAKey::KL_1024, RSAKey::EXP_SMALL); - assert(key->type() == Poco::Crypto::KeyPair::KT_RSA); + assertTrue(key->type() == Poco::Crypto::KeyPair::KT_RSA); // construct EVPPKey from RSAKey* EVPPKey* pKey = new EVPPKey(key); // EVPPKey increments reference count, so freeing the original must be ok delete key; - assert (!pKey->isSupported(0)); - assert (!pKey->isSupported(-1)); - assert (pKey->isSupported(pKey->type())); - assert (pKey->type() == EVP_PKEY_RSA); + assertTrue (!pKey->isSupported(0)); + assertTrue (!pKey->isSupported(-1)); + assertTrue (pKey->isSupported(pKey->type())); + assertTrue (pKey->type() == EVP_PKEY_RSA); // construct RSAKey from const EVPPKey& key = new RSAKey(*pKey); delete pKey; - assert(key->type() == Poco::Crypto::KeyPair::KT_RSA); + assertTrue(key->type() == Poco::Crypto::KeyPair::KT_RSA); // construct EVPPKey from RSAKey* pKey = new EVPPKey(key); - assert (pKey->type() == EVP_PKEY_RSA); + assertTrue (pKey->type() == EVP_PKEY_RSA); BIO* bioPriv1 = BIO_new(BIO_s_mem()); BIO* bioPub1 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub1, *pKey)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub1, *pKey)); char* pPrivData1; long sizePriv1 = BIO_get_mem_data(bioPriv1, &pPrivData1); char* pPubData1; @@ -74,39 +74,39 @@ void EVPTest::testRSAEVPPKey() EVPPKey evpPKey(pKey->operator EVP_PKEY*()); // EVPPKey makes duplicate, so freeing the original must be ok delete pKey; - assert (evpPKey.type() == EVP_PKEY_RSA); + assertTrue (evpPKey.type() == EVP_PKEY_RSA); BIO* bioPriv2 = BIO_new(BIO_s_mem()); BIO* bioPub2 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey)); char* pPrivData2; long sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2); char* pPubData2; long sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2); - assert (sizePriv1 && (sizePriv1 == sizePriv2)); - assert (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); - assert (sizePub1 && (sizePub1 == sizePub2)); - assert (0 == memcmp(pPubData1, pPubData2, sizePub1)); + assertTrue (sizePriv1 && (sizePriv1 == sizePriv2)); + assertTrue (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); + assertTrue (sizePub1 && (sizePub1 == sizePub2)); + assertTrue (0 == memcmp(pPubData1, pPubData2, sizePub1)); BIO_free(bioPub2); BIO_free(bioPriv2); // copy EVPPKey evpPKey2(evpPKey); - assert (evpPKey2.type() == EVP_PKEY_RSA); + assertTrue (evpPKey2.type() == EVP_PKEY_RSA); bioPriv2 = BIO_new(BIO_s_mem()); bioPub2 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey2)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey2)); sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2); sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2); - assert (sizePriv1 && (sizePriv1 == sizePriv2)); - assert (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); - assert (sizePub1 && (sizePub1 == sizePub2)); - assert (0 == memcmp(pPubData1, pPubData2, sizePub1)); + assertTrue (sizePriv1 && (sizePriv1 == sizePriv2)); + assertTrue (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); + assertTrue (sizePub1 && (sizePub1 == sizePub2)); + assertTrue (0 == memcmp(pPubData1, pPubData2, sizePub1)); #ifdef POCO_ENABLE_CPP11 @@ -115,18 +115,18 @@ void EVPTest::testRSAEVPPKey() // move EVPPKey evpPKey3(std::move(evpPKey2)); - assert (evpPKey3.type() == EVP_PKEY_RSA); + assertTrue (evpPKey3.type() == EVP_PKEY_RSA); bioPriv2 = BIO_new(BIO_s_mem()); bioPub2 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey3)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey3)); sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2); sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2); - assert (sizePriv1 && (sizePriv1 == sizePriv2)); - assert (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); - assert (sizePub1 && (sizePub1 == sizePub2)); - assert (0 == memcmp(pPubData1, pPubData2, sizePub1)); + assertTrue (sizePriv1 && (sizePriv1 == sizePriv2)); + assertTrue (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); + assertTrue (sizePub1 && (sizePub1 == sizePub2)); + assertTrue (0 == memcmp(pPubData1, pPubData2, sizePub1)); #endif // POCO_ENABLE_CPP11 @@ -158,25 +158,25 @@ void EVPTest::testRSAEVPSaveLoadStream() std::istringstream iPriv(privKey); EVPPKey key2(&iPub, &iPriv, "testpwd"); - assert (key == key2); - assert (!(key != key2)); + assertTrue (key == key2); + assertTrue (!(key != key2)); RSAKey rsaKeyNE(RSAKey::KL_1024, RSAKey::EXP_LARGE); EVPPKey keyNE(&rsaKeyNE); - assert (key != keyNE); - assert (!(key == keyNE)); - assert (key2 != keyNE);; - assert (!(key2 == keyNE)); + assertTrue (key != keyNE); + assertTrue (!(key == keyNE)); + assertTrue (key2 != keyNE);; + assertTrue (!(key2 == keyNE)); std::ostringstream strPub2; std::ostringstream strPriv2; key2.save(&strPub2, &strPriv2, "testpwd"); - assert (strPub2.str() == pubKey); + assertTrue (strPub2.str() == pubKey); std::istringstream iPriv2(strPriv2.str()); EVPPKey key3(0, &iPriv2, "testpwd"); std::ostringstream strPub3; key3.save(&strPub3); - assert (strPub3.str() == pubKey); + assertTrue (strPub3.str() == pubKey); } @@ -195,21 +195,21 @@ void EVPTest::testRSAEVPSaveLoadStreamNoPass() std::istringstream iPriv(privKey); EVPPKey key2(&iPub, &iPriv); - assert (key == key2); - assert (!(key != key2)); + assertTrue (key == key2); + assertTrue (!(key != key2)); RSAKey rsaKeyNE(RSAKey::KL_1024, RSAKey::EXP_LARGE); EVPPKey keyNE(&rsaKeyNE); - assert (key != keyNE); - assert (!(key == keyNE)); - assert (key2 != keyNE);; - assert (!(key2 == keyNE)); + assertTrue (key != keyNE); + assertTrue (!(key == keyNE)); + assertTrue (key2 != keyNE);; + assertTrue (!(key2 == keyNE)); std::istringstream iPriv2(privKey); EVPPKey key3(0, &iPriv2); std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } @@ -221,16 +221,16 @@ void EVPTest::testECEVPPKey() if (!curveName.empty()) { EVPPKey* pKey = new EVPPKey(curveName); - assert (pKey != 0); - assert (!pKey->isSupported(0)); - assert (!pKey->isSupported(-1)); - assert (pKey->isSupported(pKey->type())); - assert (pKey->type() == EVP_PKEY_EC); + assertTrue (pKey != 0); + assertTrue (!pKey->isSupported(0)); + assertTrue (!pKey->isSupported(-1)); + assertTrue (pKey->isSupported(pKey->type())); + assertTrue (pKey->type() == EVP_PKEY_EC); BIO* bioPriv1 = BIO_new(BIO_s_mem()); BIO* bioPub1 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub1, *pKey)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv1, *pKey, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub1, *pKey)); char* pPrivData1; long sizePriv1 = BIO_get_mem_data(bioPriv1, &pPrivData1); char* pPubData1; @@ -238,41 +238,41 @@ void EVPTest::testECEVPPKey() // construct EVPPKey from EVP_PKEY* EVPPKey evpPKey(pKey->operator EVP_PKEY*()); - assert (evpPKey.type() == EVP_PKEY_EC); + assertTrue (evpPKey.type() == EVP_PKEY_EC); // EVPPKey makes duplicate, so freeing the original must be ok delete pKey; BIO* bioPriv2 = BIO_new(BIO_s_mem()); BIO* bioPub2 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey)); char* pPrivData2; long sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2); char* pPubData2; long sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2); - assert (sizePriv1 && (sizePriv1 == sizePriv2)); - assert (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); - assert (sizePub1 && (sizePub1 == sizePub2)); - assert (0 == memcmp(pPubData1, pPubData2, sizePub1)); + assertTrue (sizePriv1 && (sizePriv1 == sizePriv2)); + assertTrue (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); + assertTrue (sizePub1 && (sizePub1 == sizePub2)); + assertTrue (0 == memcmp(pPubData1, pPubData2, sizePub1)); BIO_free(bioPub2); BIO_free(bioPriv2); // copy EVPPKey evpPKey2(evpPKey); - assert (evpPKey2.type() == EVP_PKEY_EC); + assertTrue (evpPKey2.type() == EVP_PKEY_EC); bioPriv2 = BIO_new(BIO_s_mem()); bioPub2 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey2)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey2, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey2)); sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2); sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2); - assert (sizePriv1 && (sizePriv1 == sizePriv2)); - assert (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); - assert (sizePub1 && (sizePub1 == sizePub2)); - assert (0 == memcmp(pPubData1, pPubData2, sizePub1)); + assertTrue (sizePriv1 && (sizePriv1 == sizePriv2)); + assertTrue (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); + assertTrue (sizePub1 && (sizePub1 == sizePub2)); + assertTrue (0 == memcmp(pPubData1, pPubData2, sizePub1)); #ifdef POCO_ENABLE_CPP11 @@ -281,18 +281,18 @@ void EVPTest::testECEVPPKey() // move EVPPKey evpPKey3(std::move(evpPKey2)); - assert (evpPKey3.type() == EVP_PKEY_EC); + assertTrue (evpPKey3.type() == EVP_PKEY_EC); bioPriv2 = BIO_new(BIO_s_mem()); bioPub2 = BIO_new(BIO_s_mem()); - assert (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, NULL, NULL, 0, 0, NULL)); - assert (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey3)); + assertTrue (0 != PEM_write_bio_PrivateKey(bioPriv2, evpPKey3, NULL, NULL, 0, 0, NULL)); + assertTrue (0 != PEM_write_bio_PUBKEY(bioPub2, evpPKey3)); sizePriv2 = BIO_get_mem_data(bioPriv2, &pPrivData2); sizePub2 = BIO_get_mem_data(bioPub2, &pPubData2); - assert (sizePriv1 && (sizePriv1 == sizePriv2)); - assert (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); - assert (sizePub1 && (sizePub1 == sizePub2)); - assert (0 == memcmp(pPubData1, pPubData2, sizePub1)); + assertTrue (sizePriv1 && (sizePriv1 == sizePriv2)); + assertTrue (0 == memcmp(pPrivData1, pPrivData2, sizePriv1)); + assertTrue (sizePub1 && (sizePub1 == sizePub2)); + assertTrue (0 == memcmp(pPubData1, pPubData2, sizePub1)); #endif // POCO_ENABLE_CPP11 BIO_free(bioPub2); @@ -333,27 +333,27 @@ void EVPTest::testECEVPSaveLoadStream() std::ostringstream strPubE; std::ostringstream strPrivE; key2.save(&strPubE, &strPrivE, "testpwd"); - assert (strPubE.str() == pubKey); - assert (key == key2); - assert (!(key != key2)); + assertTrue (strPubE.str() == pubKey); + assertTrue (key == key2); + assertTrue (!(key != key2)); ECKey ecKeyNE(curveName); EVPPKey keyNE(&ecKeyNE); - assert (key != keyNE); - assert (!(key == keyNE)); - assert (key2 != keyNE); - assert (!(key2 == keyNE)); + assertTrue (key != keyNE); + assertTrue (!(key == keyNE)); + assertTrue (key2 != keyNE); + assertTrue (!(key2 == keyNE)); std::ostringstream strPub2; std::ostringstream strPriv2; key2.save(&strPub2, &strPriv2, "testpwd"); - assert (strPub2.str() == pubKey); + assertTrue (strPub2.str() == pubKey); std::istringstream iPriv2(strPriv2.str()); EVPPKey key3(0, &iPriv2, "testpwd"); std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } else std::cerr << "No elliptic curves found!" << std::endl; @@ -388,28 +388,28 @@ void EVPTest::testECEVPSaveLoadStreamNoPass() std::ostringstream strPubE; std::ostringstream strPrivE; key2.save(&strPubE, &strPrivE); - assert (strPubE.str() == pubKey); - assert (key == key2); - assert (!(key != key2)); + assertTrue (strPubE.str() == pubKey); + assertTrue (key == key2); + assertTrue (!(key != key2)); ECKey ecKeyNE(curveName); EVPPKey keyNE(&ecKeyNE); - assert (key != keyNE); - assert (!(key == keyNE)); - assert (key2 != keyNE); - assert (!(key2 == keyNE)); + assertTrue (key != keyNE); + assertTrue (!(key == keyNE)); + assertTrue (key2 != keyNE); + assertTrue (!(key2 == keyNE)); std::ostringstream strPub2; std::ostringstream strPriv2; key2.save(&strPub2, &strPriv2); - assert (strPub2.str() == pubKey); - assert (strPriv2.str() == privKey); + assertTrue (strPub2.str() == pubKey); + assertTrue (strPriv2.str() == privKey); std::istringstream iPriv2(privKey); EVPPKey key3(0, &iPriv2); std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } else std::cerr << "No elliptic curves found!" << std::endl; @@ -445,26 +445,26 @@ void EVPTest::testECEVPSaveLoadFile() std::ostringstream strPubE; std::ostringstream strPrivE; key2.save(&strPubE, &strPrivE, "testpwd"); - assert (strPubE.str() == pubKey); - assert (key == key2); - assert (!(key != key2)); + assertTrue (strPubE.str() == pubKey); + assertTrue (key == key2); + assertTrue (!(key != key2)); ECKey ecKeyNE(curveName); EVPPKey keyNE(&ecKeyNE); - assert (key != keyNE); - assert (!(key == keyNE)); - assert (key2 != keyNE); - assert (!(key2 == keyNE)); + assertTrue (key != keyNE); + assertTrue (!(key == keyNE)); + assertTrue (key2 != keyNE); + assertTrue (!(key2 == keyNE)); std::ostringstream strPub2; std::ostringstream strPriv2; key2.save(&strPub2, &strPriv2, "testpwd"); - assert (strPub2.str() == pubKey); + assertTrue (strPub2.str() == pubKey); EVPPKey key3("", filePriv.path(), "testpwd"); std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } else std::cerr << "No elliptic curves found!" << std::endl; @@ -499,13 +499,13 @@ void EVPTest::testECEVPSaveLoadFileNoPass() std::ostringstream strPub2; std::ostringstream strPriv2; key2.save(&strPub2, &strPriv2); - assert (strPub2.str() == pubKey); + assertTrue (strPub2.str() == pubKey); EVPPKey key3("", filePriv.path()); std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } else std::cerr << "No elliptic curves found!" << std::endl; diff --git a/Crypto/testsuite/src/PKCS12ContainerTest.cpp b/Crypto/testsuite/src/PKCS12ContainerTest.cpp index 2dfe051ff..fab454fd9 100644 --- a/Crypto/testsuite/src/PKCS12ContainerTest.cpp +++ b/Crypto/testsuite/src/PKCS12ContainerTest.cpp @@ -80,16 +80,16 @@ void PKCS12ContainerTest::testFullPKCS12() void PKCS12ContainerTest::full(const PKCS12Container& pkcs12) { - assert ("vally" == pkcs12.getFriendlyName()); + assertTrue ("vally" == pkcs12.getFriendlyName()); - assert (pkcs12.hasKey()); + assertTrue (pkcs12.hasKey()); EVPPKey pKey = pkcs12.getKey(); - assert (EVP_PKEY_RSA == pKey.type()); + assertTrue (EVP_PKEY_RSA == pKey.type()); RSAKey rsa(pkcs12); - assert (rsa.impl()->type() == KeyPairImpl::KT_RSA_IMPL); + assertTrue (rsa.impl()->type() == KeyPairImpl::KT_RSA_IMPL); - assert (pkcs12.hasX509Certificate()); + assertTrue (pkcs12.hasX509Certificate()); fullCert(pkcs12.getX509Certificate()); std::vector certOrder; @@ -111,18 +111,18 @@ void PKCS12ContainerTest::fullCert(const X509Certificate& x509) std::string emailAddress(x509.subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS)); std::string serialNumber(x509.serialNumber()); - assert (subjectName == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Server"); - assert (issuerName == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3"); - assert (commonName == "CV Server"); - assert (country == "CH"); - assert (localityName.empty()); - assert (stateOrProvince == "Zug"); - assert (organizationName == "Crypto Vally"); - assert (organizationUnitName.empty()); - assert (emailAddress.empty()); - assert (serialNumber == "1000"); - assert (x509.version() == 3); - assert (x509.signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (subjectName == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Server"); + assertTrue (issuerName == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3"); + assertTrue (commonName == "CV Server"); + assertTrue (country == "CH"); + assertTrue (localityName.empty()); + assertTrue (stateOrProvince == "Zug"); + assertTrue (organizationName == "Crypto Vally"); + assertTrue (organizationUnitName.empty()); + assertTrue (emailAddress.empty()); + assertTrue (serialNumber == "1000"); + assertTrue (x509.version() == 3); + assertTrue (x509.signatureAlgorithm() == "sha256WithRSAEncryption"); } @@ -130,40 +130,40 @@ void PKCS12ContainerTest::fullList(const PKCS12Container::CAList& caList, const PKCS12Container::CANameList& caNamesList, const std::vector& certOrder) { - assert (certOrder.size() == caList.size()); - assert ((0 == caNamesList.size()) || (certOrder.size() == caNamesList.size())); + assertTrue (certOrder.size() == caList.size()); + assertTrue ((0 == caNamesList.size()) || (certOrder.size() == caNamesList.size())); if (caNamesList.size()) { - assert (caNamesList[certOrder[0]].empty()); - assert (caNamesList[certOrder[1]].empty()); + assertTrue (caNamesList[certOrder[0]].empty()); + assertTrue (caNamesList[certOrder[1]].empty()); } - assert (caList[certOrder[0]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); - assert (caList[certOrder[0]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); - assert (caList[certOrder[0]].commonName() == "CV Root CA v3"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[0]].serialNumber() == "C3ECA1FCEAA16055"); - assert (caList[certOrder[0]].version() == 3); - assert (caList[certOrder[0]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[0]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); + assertTrue (caList[certOrder[0]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); + assertTrue (caList[certOrder[0]].commonName() == "CV Root CA v3"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[0]].serialNumber() == "C3ECA1FCEAA16055"); + assertTrue (caList[certOrder[0]].version() == 3); + assertTrue (caList[certOrder[0]].signatureAlgorithm() == "sha256WithRSAEncryption"); - assert (caList[certOrder[1]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3"); - assert (caList[certOrder[1]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); - assert (caList[certOrder[1]].commonName() == "CV Intermediate CA v3"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[1]].serialNumber() == "1000"); - assert (caList[certOrder[1]].version() == 3); - assert (caList[certOrder[1]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[1]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3"); + assertTrue (caList[certOrder[1]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); + assertTrue (caList[certOrder[1]].commonName() == "CV Intermediate CA v3"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[1]].serialNumber() == "1000"); + assertTrue (caList[certOrder[1]].version() == 3); + assertTrue (caList[certOrder[1]].signatureAlgorithm() == "sha256WithRSAEncryption"); } @@ -187,9 +187,9 @@ void PKCS12ContainerTest::testCertsOnlyPKCS12() void PKCS12ContainerTest::certsOnly(const PKCS12Container& pkcs12) { - assert (!pkcs12.hasKey()); - assert (!pkcs12.hasX509Certificate()); - assert (pkcs12.getFriendlyName().empty()); + assertTrue (!pkcs12.hasKey()); + assertTrue (!pkcs12.hasX509Certificate()); + assertTrue (pkcs12.getFriendlyName().empty()); std::vector certOrder; for (int i = 0; i < 5; ++i) certOrder.push_back(i); @@ -200,82 +200,82 @@ void PKCS12ContainerTest::certsOnly(const PKCS12Container& pkcs12) void PKCS12ContainerTest::certsOnlyList(const PKCS12Container::CAList& caList, const PKCS12Container::CANameList& caNamesList, const std::vector& certOrder) { - assert (certOrder.size() == caList.size()); - assert ((0 == caNamesList.size()) || (certOrder.size() == caNamesList.size())); + assertTrue (certOrder.size() == caList.size()); + assertTrue ((0 == caNamesList.size()) || (certOrder.size() == caNamesList.size())); if (caNamesList.size()) { - assert (caNamesList[certOrder[0]].empty()); - assert (caNamesList[certOrder[1]].empty()); - assert (caNamesList[certOrder[2]].empty()); - assert (caNamesList[certOrder[3]] == "vally-ca"); - assert (caNamesList[certOrder[4]] == "vally-ca"); + assertTrue (caNamesList[certOrder[0]].empty()); + assertTrue (caNamesList[certOrder[1]].empty()); + assertTrue (caNamesList[certOrder[2]].empty()); + assertTrue (caNamesList[certOrder[3]] == "vally-ca"); + assertTrue (caNamesList[certOrder[4]] == "vally-ca"); } - assert (caList[certOrder[0]].subjectName() == "/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3"); - assert (caList[certOrder[0]].issuerName() == "/C=US/O=Internet Security Research Group/CN=ISRG Root X1"); - assert (caList[certOrder[0]].commonName() == "Let's Encrypt Authority X3"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_COUNTRY) == "US"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE).empty()); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Let's Encrypt"); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[0]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[0]].serialNumber() == "D3B17226342332DCF40528512AEC9C6A"); - assert (caList[certOrder[0]].version() == 3); - assert (caList[certOrder[0]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[0]].subjectName() == "/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3"); + assertTrue (caList[certOrder[0]].issuerName() == "/C=US/O=Internet Security Research Group/CN=ISRG Root X1"); + assertTrue (caList[certOrder[0]].commonName() == "Let's Encrypt Authority X3"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_COUNTRY) == "US"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE).empty()); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Let's Encrypt"); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[0]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[0]].serialNumber() == "D3B17226342332DCF40528512AEC9C6A"); + assertTrue (caList[certOrder[0]].version() == 3); + assertTrue (caList[certOrder[0]].signatureAlgorithm() == "sha256WithRSAEncryption"); - assert (caList[certOrder[1]].subjectName() == "/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3"); - assert (caList[certOrder[1]].issuerName() == "/O=Digital Signature Trust Co./CN=DST Root CA X3"); - assert (caList[certOrder[1]].commonName() == "Let's Encrypt Authority X3"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_COUNTRY) == "US"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE).empty()); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Let's Encrypt"); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[1]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[1]].serialNumber() == "0A0141420000015385736A0B85ECA708"); - assert (caList[certOrder[1]].version() == 3); - assert (caList[certOrder[1]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[1]].subjectName() == "/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3"); + assertTrue (caList[certOrder[1]].issuerName() == "/O=Digital Signature Trust Co./CN=DST Root CA X3"); + assertTrue (caList[certOrder[1]].commonName() == "Let's Encrypt Authority X3"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_COUNTRY) == "US"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE).empty()); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Let's Encrypt"); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[1]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[1]].serialNumber() == "0A0141420000015385736A0B85ECA708"); + assertTrue (caList[certOrder[1]].version() == 3); + assertTrue (caList[certOrder[1]].signatureAlgorithm() == "sha256WithRSAEncryption"); - assert (caList[certOrder[2]].subjectName() == "/C=US/O=Internet Security Research Group/CN=ISRG Root X1"); - assert (caList[certOrder[2]].issuerName() == "/C=US/O=Internet Security Research Group/CN=ISRG Root X1"); - assert (caList[certOrder[2]].commonName() == "ISRG Root X1"); - assert (caList[certOrder[2]].subjectName(X509Certificate::NID_COUNTRY) == "US"); - assert (caList[certOrder[2]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[2]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE).empty()); - assert (caList[certOrder[2]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Internet Security Research Group"); - assert (caList[certOrder[2]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[2]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[2]].serialNumber() == "8210CFB0D240E3594463E0BB63828B00"); - assert (caList[certOrder[2]].version() == 3); - assert (caList[certOrder[2]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[2]].subjectName() == "/C=US/O=Internet Security Research Group/CN=ISRG Root X1"); + assertTrue (caList[certOrder[2]].issuerName() == "/C=US/O=Internet Security Research Group/CN=ISRG Root X1"); + assertTrue (caList[certOrder[2]].commonName() == "ISRG Root X1"); + assertTrue (caList[certOrder[2]].subjectName(X509Certificate::NID_COUNTRY) == "US"); + assertTrue (caList[certOrder[2]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[2]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE).empty()); + assertTrue (caList[certOrder[2]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Internet Security Research Group"); + assertTrue (caList[certOrder[2]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[2]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[2]].serialNumber() == "8210CFB0D240E3594463E0BB63828B00"); + assertTrue (caList[certOrder[2]].version() == 3); + assertTrue (caList[certOrder[2]].signatureAlgorithm() == "sha256WithRSAEncryption"); - assert (caList[certOrder[3]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); - assert (caList[certOrder[3]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); - assert (caList[certOrder[3]].commonName() == "CV Root CA v3"); - assert (caList[certOrder[3]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); - assert (caList[certOrder[3]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[3]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); - assert (caList[certOrder[3]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); - assert (caList[certOrder[3]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[3]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[3]].serialNumber() == "C3ECA1FCEAA16055"); - assert (caList[certOrder[3]].version() == 3); - assert (caList[certOrder[3]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[3]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); + assertTrue (caList[certOrder[3]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); + assertTrue (caList[certOrder[3]].commonName() == "CV Root CA v3"); + assertTrue (caList[certOrder[3]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); + assertTrue (caList[certOrder[3]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[3]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); + assertTrue (caList[certOrder[3]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); + assertTrue (caList[certOrder[3]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[3]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[3]].serialNumber() == "C3ECA1FCEAA16055"); + assertTrue (caList[certOrder[3]].version() == 3); + assertTrue (caList[certOrder[3]].signatureAlgorithm() == "sha256WithRSAEncryption"); - assert (caList[certOrder[4]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3"); - assert (caList[certOrder[4]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); - assert (caList[certOrder[4]].commonName() == "CV Intermediate CA v3"); - assert (caList[certOrder[4]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); - assert (caList[certOrder[4]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); - assert (caList[certOrder[4]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); - assert (caList[certOrder[4]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); - assert (caList[certOrder[4]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); - assert (caList[certOrder[4]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); - assert (caList[certOrder[4]].serialNumber()== "1000"); - assert (caList[certOrder[4]].version() == 3); - assert (caList[certOrder[4]].signatureAlgorithm() == "sha256WithRSAEncryption"); + assertTrue (caList[certOrder[4]].subjectName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Intermediate CA v3"); + assertTrue (caList[certOrder[4]].issuerName() == "/C=CH/ST=Zug/O=Crypto Vally/CN=CV Root CA v3"); + assertTrue (caList[certOrder[4]].commonName() == "CV Intermediate CA v3"); + assertTrue (caList[certOrder[4]].subjectName(X509Certificate::NID_COUNTRY) == "CH"); + assertTrue (caList[certOrder[4]].subjectName(X509Certificate::NID_LOCALITY_NAME).empty()); + assertTrue (caList[certOrder[4]].subjectName(X509Certificate::NID_STATE_OR_PROVINCE) == "Zug"); + assertTrue (caList[certOrder[4]].subjectName(X509Certificate::NID_ORGANIZATION_NAME) == "Crypto Vally"); + assertTrue (caList[certOrder[4]].subjectName(X509Certificate::NID_ORGANIZATION_UNIT_NAME).empty()); + assertTrue (caList[certOrder[4]].subjectName(X509Certificate::NID_PKCS9_EMAIL_ADDRESS).empty()); + assertTrue (caList[certOrder[4]].serialNumber()== "1000"); + assertTrue (caList[certOrder[4]].version() == 3); + assertTrue (caList[certOrder[4]].signatureAlgorithm() == "sha256WithRSAEncryption"); } @@ -285,7 +285,7 @@ void PKCS12ContainerTest::testPEMReadWrite() { std::string file = getTestFilesPath("certs-only", "pem"); X509Certificate::List certsOnly = X509Certificate::readPEM(file); - assert (certsOnly.size() == 5); + assertTrue (certsOnly.size() == 5); // PEM is written by openssl in reverse order from p12 std::vector certOrder; for(int i = (int)certsOnly.size() - 1; i >= 0; --i) certOrder.push_back(i); @@ -300,10 +300,10 @@ void PKCS12ContainerTest::testPEMReadWrite() file = getTestFilesPath("full", "pem"); X509Certificate::List full = X509Certificate::readPEM(file); - assert (full.size() == 3); + assertTrue (full.size() == 3); fullCert(full[0]); full.erase(full.begin()); - assert (full.size() == 2); + assertTrue (full.size() == 2); certOrder.clear(); for(int i = (int)full.size() - 1; i >= 0; --i) certOrder.push_back(i); diff --git a/Crypto/testsuite/src/RSATest.cpp b/Crypto/testsuite/src/RSATest.cpp index 23356075a..5ea1eda8b 100644 --- a/Crypto/testsuite/src/RSATest.cpp +++ b/Crypto/testsuite/src/RSATest.cpp @@ -102,7 +102,7 @@ void RSATest::testNewKeys() std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } @@ -125,7 +125,7 @@ void RSATest::testNewKeysNoPassphrase() std::ostringstream strPub3; key3.save(&strPub3); std::string pubFromPrivate = strPub3.str(); - assert (pubFromPrivate == pubKey); + assertTrue (pubFromPrivate == pubKey); } @@ -146,7 +146,7 @@ void RSATest::testSign() RSAKey keyPub(&iPub); RSADigestEngine eng2(keyPub); eng2.update(msg.c_str(), static_cast(msg.length())); - assert (eng2.verify(sig)); + assertTrue (eng2.verify(sig)); } @@ -167,7 +167,7 @@ void RSATest::testSignSha256() RSAKey keyPub(&iPub); RSADigestEngine eng2(keyPub, "SHA256"); eng2.update(msg.c_str(), static_cast(msg.length())); - assert (eng2.verify(sig)); + assertTrue (eng2.verify(sig)); } @@ -189,7 +189,7 @@ void RSATest::testSignManipulated() RSAKey keyPub(&iPub); RSADigestEngine eng2(keyPub); eng2.update(msgManip.c_str(), static_cast(msgManip.length())); - assert (!eng2.verify(sig)); + assertTrue (!eng2.verify(sig)); } @@ -201,7 +201,7 @@ void RSATest::testRSACipher() std::string val(n, 'x'); std::string enc = pCipher->encryptString(val); std::string dec = pCipher->decryptString(enc); - assert (dec == val); + assertTrue (dec == val); } } @@ -228,7 +228,7 @@ void RSATest::testRSACipherLarge() std::string val(*it, 'x'); std::string enc = pCipher->encryptString(val); std::string dec = pCipher->decryptString(enc); - assert (dec == val); + assertTrue (dec == val); } } @@ -246,7 +246,7 @@ void RSATest::testCertificate() std::string enc = pCipher->encryptString(val); std::string dec = pCipher2->decryptString(enc); - assert (dec == val); + assertTrue (dec == val); } diff --git a/Data/MySQL/testsuite/src/MySQLTest.cpp b/Data/MySQL/testsuite/src/MySQLTest.cpp index 6b86304c4..d9baab6e3 100644 --- a/Data/MySQL/testsuite/src/MySQLTest.cpp +++ b/Data/MySQL/testsuite/src/MySQLTest.cpp @@ -576,30 +576,30 @@ void MySQLTest::testNullableInt() int count = 0; *_pSession << "SELECT COUNT(*) FROM NullableIntTest", into(count), now; - assert (count == 3); + assertTrue (count == 3); Nullable ci1; Nullable ci2; Nullable ci3; id = 1; *_pSession << "SELECT Value FROM NullableIntTest WHERE Id = ?", into(ci1), use(id), now; - assert (ci1 == i1); + assertTrue (ci1 == i1); id = 2; *_pSession << "SELECT Value FROM NullableIntTest WHERE Id = ?", into(ci2), use(id), now; - assert (ci2.isNull()); - assert (!(0 == ci2)); - assert (0 != ci2); - assert (!(ci2 == 0)); - assert (ci2 != 0); + assertTrue (ci2.isNull()); + assertTrue (!(0 == ci2)); + assertTrue (0 != ci2); + assertTrue (!(ci2 == 0)); + assertTrue (ci2 != 0); ci2 = 10; - assert (10 == ci2); - assert (ci2 == 10); - assert (!ci2.isNull()); + assertTrue (10 == ci2); + assertTrue (ci2 == 10); + assertTrue (!ci2.isNull()); id = 3; *_pSession << "SELECT Value FROM NullableIntTest WHERE Id = ?", into(ci3), use(id), now; - assert (!ci3.isNull()); - assert (ci3 == 3); - assert (3 == ci3); + assertTrue (!ci3.isNull()); + assertTrue (ci3 == 3); + assertTrue (3 == ci3); } @@ -621,18 +621,18 @@ void MySQLTest::testNullableString() Nullable resAddress; Nullable resAge; *_pSession << "SELECT Address, Age FROM NullableStringTest WHERE Id = ?", into(resAddress), into(resAge), use(id), now; - assert(resAddress == address); - assert(resAge == age); - assert(resAddress.isNull()); - assert(null == resAddress); - assert(resAddress == null); + assertTrue (resAddress == address); + assertTrue (resAge == age); + assertTrue (resAddress.isNull()); + assertTrue (null == resAddress); + assertTrue (resAddress == null); resAddress = std::string("Test"); - assert(!resAddress.isNull()); - assert(resAddress == std::string("Test")); - assert(std::string("Test") == resAddress); - assert(null != resAddress); - assert(resAddress != null); + assertTrue (!resAddress.isNull()); + assertTrue (resAddress == std::string("Test")); + assertTrue (std::string("Test") == resAddress); + assertTrue (null != resAddress); + assertTrue (resAddress != null); } @@ -667,23 +667,23 @@ void MySQLTest::testTupleWithNullable() *_pSession << "SELECT Id, Address, Age FROM NullableStringTest", into(result), now; - assert(result[0].get<1>() == std::string("Address")); - assert(result[0].get<2>() == 10); + assertTrue (result[0].get<1>() == std::string("Address")); + assertTrue (result[0].get<2>() == 10); - assert(result[1].get<1>() == null); - assert(result[1].get<2>() == 10); + assertTrue (result[1].get<1>() == null); + assertTrue (result[1].get<2>() == 10); - assert(result[2].get<1>() == std::string("Address!")); - assert(result[2].get<2>() == null); + assertTrue (result[2].get<1>() == std::string("Address!")); + assertTrue (result[2].get<2>() == null); - assert(result[3].get<1>() == std::string("A")); - assert(result[3].get<2>() == 0); + assertTrue (result[3].get<1>() == std::string("A")); + assertTrue (result[3].get<2>() == 0); - assert(result[4].get<1>() == null); - assert(result[4].get<2>() == 12); + assertTrue (result[4].get<1>() == null); + assertTrue (result[4].get<2>() == 12); - assert(result[5].get<1>() == std::string("B")); - assert(result[5].get<2>() == null); + assertTrue (result[5].get<1>() == std::string("B")); + assertTrue (result[5].get<2>() == null); } diff --git a/Data/MySQL/testsuite/src/SQLExecutor.cpp b/Data/MySQL/testsuite/src/SQLExecutor.cpp index c76fbf5ce..aa246f084 100644 --- a/Data/MySQL/testsuite/src/SQLExecutor.cpp +++ b/Data/MySQL/testsuite/src/SQLExecutor.cpp @@ -157,27 +157,27 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch { int rc; MYSQL* hsession = mysql_init(0); - assert (hsession != 0); + assertTrue (hsession != 0); MYSQL* tmp = mysql_real_connect(hsession, host, user, pwd, db, port, 0, 0); - assert(tmp == hsession); + assertTrue (tmp == hsession); MYSQL_STMT* hstmt = mysql_stmt_init(hsession); - assert(hstmt != 0); + assertTrue (hstmt != 0); std::string sql = "DROP TABLE Test"; mysql_real_query(hsession, sql.c_str(), static_cast(sql.length())); sql = tableCreateString; rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); - assert(rc == 0); + assertTrue (rc == 0); rc = mysql_stmt_execute(hstmt); - assert(rc == 0); + assertTrue (rc == 0); sql = "INSERT INTO Test VALUES (?,?,?,?,?)"; rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); - assert(rc == 0); + assertTrue (rc == 0); std::string str[3] = { "111", "222", "333" }; int fourth = 4; @@ -204,14 +204,14 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch bind_param[4].buffer_type = MYSQL_TYPE_FLOAT; rc = mysql_stmt_bind_param(hstmt, bind_param); - assert (rc == 0); + assertTrue (rc == 0); rc = mysql_stmt_execute(hstmt); - assert (rc == 0); + assertTrue (rc == 0); sql = "SELECT * FROM Test"; rc = mysql_stmt_prepare(hstmt, sql.c_str(), static_cast(sql.length())); - assert (rc == 0); + assertTrue (rc == 0); char chr[3][5] = {{ 0 }}; unsigned long lengths[5] = { 0 }; @@ -244,25 +244,25 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch bind_result[4].length = &lengths[4]; rc = mysql_stmt_bind_result(hstmt, bind_result); - assert (rc == 0); + assertTrue (rc == 0); rc = mysql_stmt_execute(hstmt); - assert (rc == 0); + assertTrue (rc == 0); rc = mysql_stmt_fetch(hstmt); - assert (rc == 0); + assertTrue (rc == 0); - assert (0 == std::strncmp("111", chr[0], 3)); - assert (0 == std::strncmp("222", chr[1], 3)); - assert (0 == std::strncmp("333", chr[2], 3)); - assert (4 == fourth); - assert (1.5 == fifth); + assertTrue (0 == std::strncmp("111", chr[0], 3)); + assertTrue (0 == std::strncmp("222", chr[1], 3)); + assertTrue (0 == std::strncmp("333", chr[2], 3)); + assertTrue (4 == fourth); + assertTrue (1.5 == fifth); rc = mysql_stmt_close(hstmt); - assert(rc == 0); + assertTrue (rc == 0); sql = "DROP TABLE Test"; rc = mysql_real_query(hsession, sql.c_str(), static_cast(sql.length())); - assert(rc == 0); + assertTrue (rc == 0); mysql_close(hsession); } @@ -292,17 +292,17 @@ void SQLExecutor::simpleAccess() catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { *_pSession << "SELECT LastName FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (lastName == result); + assertTrue (lastName == result); try { *_pSession << "SELECT Age FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == age); + assertTrue (count == age); } @@ -324,14 +324,14 @@ void SQLExecutor::complexType() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person c1; Person c2; try { *_pSession << "SELECT * FROM Person WHERE LastName = 'LN1'", into(c1), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (c1 == p1); + assertTrue (c1 == p1); } @@ -361,7 +361,7 @@ void SQLExecutor::simpleAccessVector() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector lastNamesR; std::vector firstNamesR; @@ -370,10 +370,10 @@ void SQLExecutor::simpleAccessVector() try { *_pSession << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -392,13 +392,13 @@ void SQLExecutor::complexTypeVector() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -417,7 +417,7 @@ void SQLExecutor::insertVector() try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } @@ -425,13 +425,13 @@ void SQLExecutor::insertVector() try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } count = 0; try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } @@ -460,19 +460,19 @@ void SQLExecutor::insertSingleBulk() for (x = 0; x < 100; ++x) { std::size_t i = stmt.execute(); - assert (i == 1); + assertTrue (i == 1); } int count = 0; try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 100); + assertTrue (count == 100); try { *_pSession << "SELECT SUM(str) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == ((0+99)*100/2)); + assertTrue (count == ((0+99)*100/2)); } @@ -490,12 +490,12 @@ void SQLExecutor::unsignedInts() try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { *_pSession << "SELECT str FROM Strings", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ret == data); + assertTrue (ret == data); } @@ -513,12 +513,12 @@ void SQLExecutor::floats() try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { *_pSession << "SELECT str FROM Strings", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ret == data); + assertTrue (ret == data); } @@ -536,12 +536,12 @@ void SQLExecutor::doubles() try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { *_pSession << "SELECT str FROM Strings", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ret == data); + assertTrue (ret == data); } @@ -561,11 +561,11 @@ void SQLExecutor::insertSingleBulkVec() catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 100); + assertTrue (count == 100); try { *_pSession << "SELECT SUM(str) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == ((0+99)*100/2)); + assertTrue (count == ((0+99)*100/2)); } @@ -586,10 +586,10 @@ void SQLExecutor::limits() try { *_pSession << "SELECT * FROM Strings", into(retData), limit(50), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (retData.size() == 50); + assertTrue (retData.size() == 50); for (int x = 0; x < 50; ++x) { - assert(data[x] == retData[x]); + assertTrue (data[x] == retData[x]); } } @@ -611,7 +611,7 @@ void SQLExecutor::limitZero() try { *_pSession << "SELECT * FROM Strings", into(retData), limit(0), now; }// stupid test, but at least we shouldn't crash catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (retData.size() == 0); + assertTrue (retData.size() == 0); } @@ -630,18 +630,18 @@ void SQLExecutor::limitOnce() std::vector retData; Statement stmt = (*_pSession << "SELECT * FROM Strings", into(retData), limit(50), now); - assert (!stmt.done()); - assert (retData.size() == 50); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 50); stmt.execute(); - assert (!stmt.done()); - assert (retData.size() == 100); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 100); stmt.execute(); - assert (stmt.done()); - assert (retData.size() == 101); + assertTrue (stmt.done()); + assertTrue (retData.size() == 101); for (int x = 0; x < 101; ++x) { - assert(data[x] == retData[x]); + assertTrue (data[x] == retData[x]); } } @@ -661,26 +661,26 @@ void SQLExecutor::limitPrepare() std::vector retData; Statement stmt = (*_pSession << "SELECT * FROM Strings", into(retData), limit(50)); - assert (retData.size() == 0); - assert (!stmt.done()); + assertTrue (retData.size() == 0); + assertTrue (!stmt.done()); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (!stmt.done()); - assert (retData.size() == 50); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 50); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (stmt.done()); - assert (retData.size() == 100); + assertTrue (stmt.done()); + assertTrue (retData.size() == 100); try { stmt.execute(); }// will restart execution! catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (!stmt.done()); - assert (retData.size() == 150); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 150); for (int x = 0; x < 150; ++x) { - assert(data[x%100] == retData[x]); + assertTrue (data[x%100] == retData[x]); } } @@ -703,7 +703,7 @@ void SQLExecutor::prepare() try { *_pSession << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); } @@ -732,7 +732,7 @@ void SQLExecutor::setSimple() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::set lastNamesR; std::set firstNamesR; @@ -741,10 +741,10 @@ void SQLExecutor::setSimple() try { *_pSession << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -762,13 +762,13 @@ void SQLExecutor::setComplex() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::set result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -791,15 +791,15 @@ void SQLExecutor::setComplexUnique() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::set result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result.size() == 2); - assert (*result.begin() == p1); - assert (*++result.begin() == p2); + assertTrue (result.size() == 2); + assertTrue (*result.begin() == p1); + assertTrue (*++result.begin() == p2); } void SQLExecutor::multiSetSimple() @@ -827,7 +827,7 @@ void SQLExecutor::multiSetSimple() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::multiset lastNamesR; std::multiset firstNamesR; @@ -836,10 +836,10 @@ void SQLExecutor::multiSetSimple() try { *_pSession << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ages.size() == agesR.size()); - assert (lastNames.size() == lastNamesR.size()); - assert (firstNames.size() == firstNamesR.size()); - assert (addresses.size() == addressesR.size()); + assertTrue (ages.size() == agesR.size()); + assertTrue (lastNames.size() == lastNamesR.size()); + assertTrue (firstNames.size() == firstNamesR.size()); + assertTrue (addresses.size() == addressesR.size()); } @@ -862,13 +862,13 @@ void SQLExecutor::multiSetComplex() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::multiset result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result.size() == people.size()); + assertTrue (result.size() == people.size()); } @@ -888,13 +888,13 @@ void SQLExecutor::mapComplex() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::map result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -917,13 +917,13 @@ void SQLExecutor::mapComplexUnique() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::map result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result.size() == 2); + assertTrue (result.size() == 2); } @@ -946,13 +946,13 @@ void SQLExecutor::multiMapComplex() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::multimap result; try { *_pSession << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result.size() == people.size()); + assertTrue (result.size() == people.size()); } @@ -972,12 +972,12 @@ void SQLExecutor::selectIntoSingle() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { *_pSession << "SELECT * FROM Person", into(result), limit(1), now; }// will return 1 object into one single result catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result == p1); + assertTrue (result == p1); } @@ -998,15 +998,15 @@ void SQLExecutor::selectIntoSingleStep() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); - assert (result == p1); - assert (!stmt.done()); + assertTrue (result == p1); + assertTrue (!stmt.done()); stmt.execute(); - assert (result == p2); - assert (stmt.done()); + assertTrue (result == p2); + assertTrue (stmt.done()); } @@ -1026,7 +1026,7 @@ void SQLExecutor::selectIntoSingleFail() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), limit(2, true), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1056,7 +1056,7 @@ void SQLExecutor::lowerLimitOk() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1086,15 +1086,15 @@ void SQLExecutor::singleSelect() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); - assert (result == p1); - assert (!stmt.done()); + assertTrue (result == p1); + assertTrue (!stmt.done()); stmt.execute(); - assert (result == p2); - assert (stmt.done()); + assertTrue (result == p2); + assertTrue (stmt.done()); } @@ -1114,7 +1114,7 @@ void SQLExecutor::lowerLimitFail() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1143,14 +1143,14 @@ void SQLExecutor::combinedLimits() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { *_pSession << "SELECT * FROM Person", into(result), lowerLimit(2), upperLimit(2), now; }// will return 2 objects catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result.size() == 2); - assert (result[0] == p1); - assert (result[1] == p2); + assertTrue (result.size() == 2); + assertTrue (result[0] == p1); + assertTrue (result[1] == p2); } @@ -1171,14 +1171,14 @@ void SQLExecutor::ranges() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { *_pSession << "SELECT * FROM Person", into(result), range(2, 2), now; }// will return 2 objects catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (result.size() == 2); - assert (result[0] == p1); - assert (result[1] == p2); + assertTrue (result.size() == 2); + assertTrue (result[0] == p1); + assertTrue (result[1] == p2); } @@ -1198,7 +1198,7 @@ void SQLExecutor::combinedIllegalLimits() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1227,7 +1227,7 @@ void SQLExecutor::illegalRange() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1247,13 +1247,13 @@ void SQLExecutor::emptyDB() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); Person result; Statement stmt = (*_pSession << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); - assert (result.firstName.empty()); - assert (stmt.done()); + assertTrue (result.firstName.empty()); + assertTrue (stmt.done()); } @@ -1272,14 +1272,14 @@ void SQLExecutor::dateTime() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); DateTime bd; - assert (bd != birthday); + assertTrue (bd != birthday); try { *_pSession << "SELECT Birthday FROM Person", into(bd), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (bd == birthday); + assertTrue (bd == birthday); std::cout << std::endl << RecordSet(*_pSession, "SELECT * FROM Person"); } @@ -1300,14 +1300,14 @@ void SQLExecutor::date() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); Date bd; - assert (bd != birthday); + assertTrue (bd != birthday); try { *_pSession << "SELECT Birthday FROM Person", into(bd), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (bd == birthday); + assertTrue (bd == birthday); std::cout << std::endl << RecordSet(*_pSession, "SELECT * FROM Person"); } @@ -1328,14 +1328,14 @@ void SQLExecutor::time() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); Time bd; - assert (bd != birthday); + assertTrue (bd != birthday); try { *_pSession << "SELECT Birthday FROM Person", into(bd), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (bd == birthday); + assertTrue (bd == birthday); std::cout << std::endl << RecordSet(*_pSession, "SELECT * FROM Person"); } @@ -1356,20 +1356,20 @@ void SQLExecutor::blob(unsigned int bigSize) try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); Poco::Data::CLOB res; - assert (res.size() == 0); + assertTrue (res.size() == 0); try { *_pSession << "SELECT Image FROM Person", into(res), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (res == img); + assertTrue (res == img); Poco::Data::CLOB big; std::vector v(bigSize, 'x'); big.assignRaw(&v[0], (std::size_t) v.size()); - assert (big.size() == (std::size_t) bigSize); + assertTrue (big.size() == (std::size_t) bigSize); try { *_pSession << "DELETE FROM Person", now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } @@ -1382,7 +1382,7 @@ void SQLExecutor::blob(unsigned int bigSize) try { *_pSession << "SELECT Image FROM Person", into(res), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (res == big); + assertTrue (res == big); } @@ -1400,15 +1400,15 @@ void SQLExecutor::blobStmt() try { *_pSession << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); Poco::Data::CLOB res; - poco_assert (res.size() == 0); + poco_assertTrue (res.size() == 0); Statement stmt = (*_pSession << "SELECT Image FROM Person", into(res)); try { stmt.execute(); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - poco_assert (res == blob); + poco_assertTrue (res == blob); } @@ -1423,11 +1423,11 @@ void SQLExecutor::tuples() catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } TupleType ret(-10,-11,-12,-13,-14,-15,-16,-17,-18,-19); - assert (ret != t); + assertTrue (ret != t); try { *_pSession << "SELECT * FROM Tuples", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ret == t); + assertTrue (ret == t); } @@ -1452,13 +1452,13 @@ void SQLExecutor::tupleVector() try { *_pSession << "SELECT COUNT(*) FROM Tuples", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (v.size() == (std::size_t) count); + assertTrue (v.size() == (std::size_t) count); std::vector > ret; try { *_pSession << "SELECT * FROM Tuples", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (ret == v); + assertTrue (ret == v); } @@ -1480,55 +1480,55 @@ void SQLExecutor::internalExtraction() Statement stmt = (*_pSession << "SELECT * FROM Vectors", now); RecordSet rset(stmt); - assert (3 == rset.columnCount()); - assert (4 == rset.rowCount()); + assertTrue (3 == rset.columnCount()); + assertTrue (4 == rset.rowCount()); int curVal = 3; do { - assert (rset["str0"] == curVal); + assertTrue (rset["str0"] == curVal); ++curVal; } while (rset.moveNext()); rset.moveFirst(); - assert (rset["str0"] == "3"); + assertTrue (rset["str0"] == "3"); rset.moveLast(); - assert (rset["str0"] == "6"); + assertTrue (rset["str0"] == "6"); RecordSet rset2(rset); - assert (3 == rset2.columnCount()); - assert (4 == rset2.rowCount()); + assertTrue (3 == rset2.columnCount()); + assertTrue (4 == rset2.rowCount()); int i = rset.value(0,0); - assert (1 == i); + assertTrue (1 == i); std::string s = rset.value(0,0); - assert ("1" == s); + assertTrue ("1" == s); int a = rset.value(0,2); - assert (3 == a); + assertTrue (3 == a); try { double d = rset.value(1,1); - assert (2.5 == d); + assertTrue (2.5 == d); } catch (BadCastException&) { float f = rset.value(1,1); - assert (2.5 == f); + assertTrue (2.5 == f); } s = rset.value(2,2); - assert ("5" == s); + assertTrue ("5" == s); i = rset.value("str0", 2); - assert (5 == i); + assertTrue (5 == i); const Column& col = rset.column(0); Column::Iterator it = col.begin(); Column::Iterator end = col.end(); for (int i = 1; it != end; ++it, ++i) - assert (*it == i); + assertTrue (*it == i); rset = (*_pSession << "SELECT COUNT(*) AS cnt FROM Vectors", now); @@ -1537,7 +1537,7 @@ void SQLExecutor::internalExtraction() { //this is what most drivers will return int i = rset.value(0,0); - assert (4 == i); + assertTrue (4 == i); } catch(BadCastException&) { @@ -1545,18 +1545,18 @@ void SQLExecutor::internalExtraction() { //this is for Oracle double i = rset.value(0,0); - assert (4 == int(i)); + assertTrue (4 == int(i)); } catch(BadCastException&) { //this is for PostgreSQL Poco::Int64 big = rset.value(0,0); - assert (4 == big); + assertTrue (4 == big); } } s = rset.value("cnt", 0).convert(); - assert ("4" == s); + assertTrue ("4" == s); try { const Column& col1 = rset.column(100); fail ("must fail"); } catch (RangeException&) { } @@ -1589,28 +1589,28 @@ void SQLExecutor::doNull() try { *_pSession << "SELECT COUNT(*) FROM Vectors", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); int i0 = 0; Statement stmt1 = (*_pSession << "SELECT i0 FROM Vectors", into(i0, Poco::Data::Position(0), -1)); try { stmt1.execute(); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - poco_assert (i0 == -1); + poco_assertTrue (i0 == -1); float flt0 = 0; Statement stmt2 = (*_pSession << "SELECT flt0 FROM Vectors", into(flt0, Poco::Data::Position(0), 3.25f)); try { stmt2.execute(); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - poco_assert (flt0 == 3.25); + poco_assertTrue (flt0 == 3.25); std::string str0("string"); Statement stmt3 = (*_pSession << "SELECT str0 FROM Vectors", into(str0, Poco::Data::Position(0), std::string("DEFAULT"))); try { stmt3.execute(); } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - poco_assert (str0 == "DEFAULT"); + poco_assertTrue (str0 == "DEFAULT"); } @@ -1625,11 +1625,11 @@ void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti) Transaction t(session, false); t.setIsolation(ti); - assert (ti == t.getIsolation()); - assert (t.isIsolation(ti)); + assertTrue (ti == t.getIsolation()); + assertTrue (t.isIsolation(ti)); - assert (ti == session.getTransactionIsolation()); - assert (session.isTransactionIsolation(ti)); + assertTrue (ti == session.getTransactionIsolation()); + assertTrue (session.isTransactionIsolation(ti)); } catch(Poco::Exception& e){ std::cout << funct << ':' << e.displayText() << std::endl;} } @@ -1685,9 +1685,9 @@ void SQLExecutor::sessionTransaction(const std::string& connect) bool autoCommit = _pSession->getFeature("autoCommit"); _pSession->setFeature("autoCommit", true); - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); _pSession->setFeature("autoCommit", false); - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); setTransactionIsolation((*_pSession), Session::TRANSACTION_READ_UNCOMMITTED); setTransactionIsolation((*_pSession), Session::TRANSACTION_REPEATABLE_READ); @@ -1696,51 +1696,51 @@ void SQLExecutor::sessionTransaction(const std::string& connect) setTransactionIsolation((*_pSession), Session::TRANSACTION_READ_COMMITTED); _pSession->begin(); - assert (_pSession->isTransaction()); + assertTrue (_pSession->isTransaction()); try { (*_pSession) << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (_pSession->isTransaction()); + assertTrue (_pSession->isTransaction()); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); try { (*_pSession) << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (2 == count); - assert (_pSession->isTransaction()); + assertTrue (2 == count); + assertTrue (_pSession->isTransaction()); _pSession->rollback(); - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (0 == count); - assert (!_pSession->isTransaction()); + assertTrue (0 == count); + assertTrue (!_pSession->isTransaction()); _pSession->begin(); try { (*_pSession) << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (_pSession->isTransaction()); + assertTrue (_pSession->isTransaction()); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); _pSession->commit(); - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (2 == locCount); + assertTrue (2 == locCount); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); _pSession->setFeature("autoCommit", autoCommit); } @@ -1780,37 +1780,37 @@ void SQLExecutor::transaction(const std::string& connect) bool autoCommit = _pSession->getFeature("autoCommit"); _pSession->setFeature("autoCommit", true); - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); _pSession->setFeature("autoCommit", false); - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); _pSession->setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED); { Transaction trans((*_pSession)); - assert (trans.isActive()); - assert (_pSession->isTransaction()); + assertTrue (trans.isActive()); + assertTrue (_pSession->isTransaction()); try { (*_pSession) << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (_pSession->isTransaction()); - assert (trans.isActive()); + assertTrue (_pSession->isTransaction()); + assertTrue (trans.isActive()); try { (*_pSession) << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (2 == count); - assert (_pSession->isTransaction()); - assert (trans.isActive()); + assertTrue (2 == count); + assertTrue (_pSession->isTransaction()); + assertTrue (trans.isActive()); } - assert (!_pSession->isTransaction()); + assertTrue (!_pSession->isTransaction()); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (0 == count); - assert (!_pSession->isTransaction()); + assertTrue (0 == count); + assertTrue (!_pSession->isTransaction()); { Transaction trans((*_pSession)); @@ -1819,21 +1819,21 @@ void SQLExecutor::transaction(const std::string& connect) catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); - assert (_pSession->isTransaction()); - assert (trans.isActive()); + assertTrue (_pSession->isTransaction()); + assertTrue (trans.isActive()); trans.commit(); - assert (!_pSession->isTransaction()); - assert (!trans.isActive()); + assertTrue (!_pSession->isTransaction()); + assertTrue (!trans.isActive()); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (2 == locCount); + assertTrue (2 == locCount); } try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); _pSession->begin(); try { (*_pSession) << "DELETE FROM Person", now; } @@ -1841,16 +1841,16 @@ void SQLExecutor::transaction(const std::string& connect) catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (2 == locCount); + assertTrue (2 == locCount); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); _pSession->commit(); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); std::string sql1 = format("INSERT INTO Person VALUES ('%s','%s','%s',%d)", lastNames[0], firstNames[0], addresses[0], ages[0]); std::string sql2 = format("INSERT INTO Person VALUES ('%s','%s','%s',%d)", lastNames[1], firstNames[1], addresses[1], ages[1]); @@ -1864,35 +1864,35 @@ void SQLExecutor::transaction(const std::string& connect) try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (1 == count); + assertTrue (1 == count); trans.execute(sql2, false); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); trans.rollback(); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); trans.execute(sql); local << "SELECT COUNT(*) FROM Person", into(locCount), now; - assert (2 == locCount); + assertTrue (2 == locCount); try { (*_pSession) << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); _pSession->setFeature("autoCommit", autoCommit); } @@ -1916,24 +1916,24 @@ void SQLExecutor::reconnect() try { (*_pSession) << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); - assert (_pSession->isConnected()); + assertTrue (_pSession->isConnected()); _pSession->close(); - assert (!_pSession->isConnected()); + assertTrue (!_pSession->isConnected()); try { (*_pSession) << "SELECT LastName FROM Person", into(result), now; fail ("must fail"); } catch(NotConnectedException&){ } - assert (!_pSession->isConnected()); + assertTrue (!_pSession->isConnected()); _pSession->open(); - assert (_pSession->isConnected()); + assertTrue (_pSession->isConnected()); try { (*_pSession) << "SELECT Age FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); } - assert (count == age); - assert (_pSession->isConnected()); + assertTrue (count == age); + assertTrue (_pSession->isConnected()); } diff --git a/Data/ODBC/testsuite/src/ODBCAccessTest.cpp b/Data/ODBC/testsuite/src/ODBCAccessTest.cpp index dfc5cd553..12bea3710 100644 --- a/Data/ODBC/testsuite/src/ODBCAccessTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCAccessTest.cpp @@ -70,17 +70,17 @@ void ODBCAccessTest::testSimpleAccess() try { *_pSession << "SELECT COUNT(*) FROM PERSON", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("testSimpleAccess()"); } catch(StatementException& ex){ std::cout << ex.toString() << std::endl; fail ("testSimpleAccess()"); } - assert (count == 1); + assertTrue (count == 1); try { *_pSession << "SELECT LastName FROM PERSON", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("testSimpleAccess()"); } catch(StatementException& ex){ std::cout << ex.toString() << std::endl; fail ("testSimpleAccess()"); } - assert (lastName == result); + assertTrue (lastName == result); try { *_pSession << "SELECT Age FROM PERSON", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("testSimpleAccess()"); } catch(StatementException& ex){ std::cout << ex.toString() << std::endl; fail ("testSimpleAccess()"); } - assert (count == age); + assertTrue (count == age); } diff --git a/Data/ODBC/testsuite/src/ODBCDB2Test.cpp b/Data/ODBC/testsuite/src/ODBCDB2Test.cpp index 47c5fc86c..f5c2ff79f 100644 --- a/Data/ODBC/testsuite/src/ODBCDB2Test.cpp +++ b/Data/ODBC/testsuite/src/ODBCDB2Test.cpp @@ -176,7 +176,7 @@ void ODBCDB2Test::testStoredProcedure() int i = 0; *_pSession << "{call storedProcedure(?)}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("PROCEDURE", "storedProcedure"); *_pSession << "CREATE PROCEDURE storedProcedure(inParam INTEGER, OUT outParam INTEGER) " @@ -188,7 +188,7 @@ void ODBCDB2Test::testStoredProcedure() i = 2; int j = 0; *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == j); + assertTrue (4 == j); dropObject("PROCEDURE", "storedProcedure"); *_pSession << "CREATE PROCEDURE storedProcedure(INOUT ioParam INTEGER) " @@ -198,7 +198,7 @@ void ODBCDB2Test::testStoredProcedure() i = 2; *_pSession << "{call storedProcedure(?)}", io(i), now; - assert(4 == i); + assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); //TIMESTAMP is not supported as stored procedure parameter in DB2 @@ -221,7 +221,7 @@ void ODBCDB2Test::testStoredProcedure() "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; std::string outParam; *_pSession << "{call storedProcedure(?,?)}", in(inParam), out(outParam), now; - assert(inParam == outParam); + assertTrue (inParam == outParam); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -247,7 +247,7 @@ void ODBCDB2Test::testStoredProcedureAny() "END" , now; *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == AnyCast(j)); + assertTrue (4 == AnyCast(j)); *_pSession << "DROP PROCEDURE storedProcedure;", now; *_pSession << "CREATE PROCEDURE storedProcedure(INOUT ioParam INTEGER) " @@ -257,7 +257,7 @@ void ODBCDB2Test::testStoredProcedureAny() i = 2; *_pSession << "{call storedProcedure(?)}", io(i), now; - assert(4 == AnyCast(i)); + assertTrue (4 == AnyCast(i)); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -282,7 +282,7 @@ void ODBCDB2Test::testStoredProcedureDynamicAny() "END" , now; *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == j); + assertTrue (4 == j); *_pSession << "DROP PROCEDURE storedProcedure;", now; *_pSession << "CREATE PROCEDURE storedProcedure(INOUT ioParam INTEGER) " @@ -292,7 +292,7 @@ void ODBCDB2Test::testStoredProcedureDynamicAny() i = 2; *_pSession << "{call storedProcedure(?)}", io(i), now; - assert(4 == i); + assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -317,7 +317,7 @@ void ODBCDB2Test::testStoredFunction() int i = 0; *_pSession << "{? = call storedFunction()}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("PROCEDURE", "storedFunction"); *_pSession << "CREATE PROCEDURE storedFunction(inParam INTEGER) " @@ -328,7 +328,7 @@ void ODBCDB2Test::testStoredFunction() i = 2; int result = 0; *_pSession << "{? = call storedFunction(?)}", out(result), in(i), now; - assert(4 == result); + assertTrue (4 == result); dropObject("PROCEDURE", "storedFunction"); *_pSession << "CREATE PROCEDURE storedFunction(inParam INTEGER, OUT outParam INTEGER) " @@ -341,8 +341,8 @@ void ODBCDB2Test::testStoredFunction() int j = 0; result = 0; *_pSession << "{? = call storedFunction(?, ?)}", out(result), in(i), out(j), now; - assert(4 == j); - assert(j == result); + assertTrue (4 == j); + assertTrue (j == result); dropObject("PROCEDURE", "storedFunction"); *_pSession << "CREATE PROCEDURE storedFunction(INOUT param1 INTEGER, INOUT param2 INTEGER) " @@ -358,18 +358,18 @@ void ODBCDB2Test::testStoredFunction() j = 2; result = 0; *_pSession << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now; - assert(1 == j); - assert(2 == i); - assert(3 == result); + assertTrue (1 == j); + assertTrue (2 == i); + assertTrue (3 == result); Tuple params(1, 2); - assert(1 == params.get<0>()); - assert(2 == params.get<1>()); + assertTrue (1 == params.get<0>()); + assertTrue (2 == params.get<1>()); result = 0; *_pSession << "{? = call storedFunction(?, ?)}", out(result), io(params), now; - assert(1 == params.get<1>()); - assert(2 == params.get<0>()); - assert(3 == result); + assertTrue (1 == params.get<1>()); + assertTrue (2 == params.get<0>()); + assertTrue (3 == result); dropObject("PROCEDURE", "storedFunction"); @@ -385,8 +385,8 @@ void ODBCDB2Test::testStoredFunction() std::string outParam; int ret; *_pSession << "{? = call storedFunction(?,?)}", out(ret), in(inParam), out(outParam), now; - assert(inParam == outParam); - assert(ret == inParam.size()); + assertTrue (inParam == outParam); + assertTrue (ret == inParam.size()); dropObject("PROCEDURE", "storedFunction"); k += 2; diff --git a/Data/ODBC/testsuite/src/ODBCOracleTest.cpp b/Data/ODBC/testsuite/src/ODBCOracleTest.cpp index 4d1dbfe69..dbf805811 100644 --- a/Data/ODBC/testsuite/src/ODBCOracleTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCOracleTest.cpp @@ -240,7 +240,7 @@ void ODBCOracleTest::testStoredProcedure() int i = 0; *_pSession << "{call storedProcedure(?)}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("PROCEDURE", "storedProcedure"); *_pSession << "CREATE OR REPLACE " @@ -251,7 +251,7 @@ void ODBCOracleTest::testStoredProcedure() i = 2; int j = 0; *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == j); + assertTrue (4 == j); *_pSession << "DROP PROCEDURE storedProcedure;", now; *_pSession << "CREATE OR REPLACE " @@ -261,7 +261,7 @@ void ODBCOracleTest::testStoredProcedure() i = 2; *_pSession << "{call storedProcedure(?)}", io(i), now; - assert(4 == i); + assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); *_pSession << "CREATE OR REPLACE " @@ -271,7 +271,7 @@ void ODBCOracleTest::testStoredProcedure() DateTime dt(1965, 6, 18, 5, 35, 1); *_pSession << "{call storedProcedure(?)}", io(dt), now; - assert(19 == dt.day()); + assertTrue (19 == dt.day()); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -298,7 +298,7 @@ void ODBCOracleTest::testStoredProcedure() "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; std::string outParam; *_pSession << "{call storedProcedure(?,?)}", in(inParam), out(outParam), now; - assert(inParam == outParam); + assertTrue (inParam == outParam); dropObject("PROCEDURE", "storedProcedure"); } @@ -319,7 +319,7 @@ void ODBCOracleTest::testStoredProcedureAny() "END storedProcedure;" , now; *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == AnyCast(j)); + assertTrue (4 == AnyCast(j)); *_pSession << "DROP PROCEDURE storedProcedure;", now; *_pSession << "CREATE OR REPLACE " @@ -329,7 +329,7 @@ void ODBCOracleTest::testStoredProcedureAny() i = 2; *_pSession << "{call storedProcedure(?)}", io(i), now; - assert(4 == AnyCast(i)); + assertTrue (4 == AnyCast(i)); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -352,7 +352,7 @@ void ODBCOracleTest::testStoredProcedureDynamicAny() "END storedProcedure;" , now; *_pSession << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == j); + assertTrue (4 == j); *_pSession << "DROP PROCEDURE storedProcedure;", now; *_pSession << "CREATE OR REPLACE " @@ -362,7 +362,7 @@ void ODBCOracleTest::testStoredProcedureDynamicAny() i = 2; *_pSession << "{call storedProcedure(?)}", io(i), now; - assert(4 == i); + assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -400,16 +400,16 @@ void ODBCOracleTest::testCursorStoredProcedure() *_pSession << "{call storedCursorProcedure(?)}", in(age), into(people), now; - assert (2 == people.size()); - assert (Person("Simpson", "Bart", "Springfield", 12) == people[0]); - assert (Person("Simpson", "Lisa", "Springfield", 10) == people[1]); + assertTrue (2 == people.size()); + assertTrue (Person("Simpson", "Bart", "Springfield", 12) == people[0]); + assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people[1]); Statement stmt = ((*_pSession << "{call storedCursorProcedure(?)}", in(age), now)); RecordSet rs(stmt); - assert (rs["LastName"] == "Simpson"); - assert (rs["FirstName"] == "Bart"); - assert (rs["Address"] == "Springfield"); - assert (rs["Age"] == 12); + assertTrue (rs["LastName"] == "Simpson"); + assertTrue (rs["FirstName"] == "Bart"); + assertTrue (rs["Address"] == "Springfield"); + assertTrue (rs["Age"] == 12); dropObject("TABLE", "Person"); dropObject("PROCEDURE", "storedCursorProcedure"); @@ -435,7 +435,7 @@ void ODBCOracleTest::testStoredFunction() int i = 0; *_pSession << "{? = call storedFunction()}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("FUNCTION", "storedFunction"); @@ -447,7 +447,7 @@ void ODBCOracleTest::testStoredFunction() i = 2; int result = 0; *_pSession << "{? = call storedFunction(?)}", out(result), in(i), now; - assert(4 == result); + assertTrue (4 == result); dropObject("FUNCTION", "storedFunction"); *_pSession << "CREATE OR REPLACE " @@ -459,8 +459,8 @@ void ODBCOracleTest::testStoredFunction() int j = 0; result = 0; *_pSession << "{? = call storedFunction(?, ?)}", out(result), in(i), out(j), now; - assert(4 == j); - assert(j == result); + assertTrue (4 == j); + assertTrue (j == result); dropObject("FUNCTION", "storedFunction"); *_pSession << "CREATE OR REPLACE " @@ -473,18 +473,18 @@ void ODBCOracleTest::testStoredFunction() j = 2; result = 0; *_pSession << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now; - assert(1 == j); - assert(2 == i); - assert(3 == result); + assertTrue (1 == j); + assertTrue (2 == i); + assertTrue (3 == result); Tuple params(1, 2); - assert(1 == params.get<0>()); - assert(2 == params.get<1>()); + assertTrue (1 == params.get<0>()); + assertTrue (2 == params.get<1>()); result = 0; *_pSession << "{? = call storedFunction(?, ?)}", out(result), io(params), now; - assert(1 == params.get<1>()); - assert(2 == params.get<0>()); - assert(3 == result); + assertTrue (1 == params.get<1>()); + assertTrue (2 == params.get<0>()); + assertTrue (3 == result); dropObject("FUNCTION", "storedFunction"); k += 2; @@ -501,9 +501,9 @@ void ODBCOracleTest::testStoredFunction() std::string outParam; std::string ret; *_pSession << "{? = call storedFunction(?,?)}", out(ret), in(inParam), out(outParam), now; - assert("123" == inParam); - assert(inParam == outParam); - assert(ret == outParam); + assertTrue ("123" == inParam); + assertTrue (inParam == outParam); + assertTrue (ret == outParam); dropObject("PROCEDURE", "storedFunction"); } @@ -540,16 +540,16 @@ void ODBCOracleTest::testCursorStoredFunction() *_pSession << "{call storedCursorFunction(?)}", in(age), into(people), now; - assert (2 == people.size()); - assert (Person("Simpson", "Bart", "Springfield", 12) == people[0]); - assert (Person("Simpson", "Lisa", "Springfield", 10) == people[1]); + assertTrue (2 == people.size()); + assertTrue (Person("Simpson", "Bart", "Springfield", 12) == people[0]); + assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people[1]); Statement stmt = ((*_pSession << "{call storedCursorFunction(?)}", in(age), now)); RecordSet rs(stmt); - assert (rs["LastName"] == "Simpson"); - assert (rs["FirstName"] == "Bart"); - assert (rs["Address"] == "Springfield"); - assert (rs["Age"] == 12); + assertTrue (rs["LastName"] == "Simpson"); + assertTrue (rs["FirstName"] == "Bart"); + assertTrue (rs["Address"] == "Springfield"); + assertTrue (rs["Age"] == 12); dropObject("TABLE", "Person"); dropObject("FUNCTION", "storedCursorFunction"); @@ -598,17 +598,17 @@ void ODBCOracleTest::testAutoTransaction() session().setFeature("autoCommit", true); session() << "INSERT INTO Strings VALUES (1)", now; localSession << "SELECT count(*) FROM Strings", into(count), now; - assert (1 == count); + assertTrue (1 == count); session() << "INSERT INTO Strings VALUES (2)", now; localSession << "SELECT count(*) FROM Strings", into(count), now; - assert (2 == count); + assertTrue (2 == count); session() << "INSERT INTO Strings VALUES (3)", now; localSession << "SELECT count(*) FROM Strings", into(count), now; - assert (3 == count); + assertTrue (3 == count); session() << "DELETE FROM Strings", now; localSession << "SELECT count(*) FROM Strings", into(count), now; - assert (0 == count); + assertTrue (0 == count); session().setFeature("autoCommit", false); @@ -621,7 +621,7 @@ void ODBCOracleTest::testAutoTransaction() } catch (Poco::Exception&) {} session() << "SELECT count(*) FROM Strings", into(count), now; - assert (0 == count); + assertTrue (0 == count); AutoTransaction at(session()); @@ -630,12 +630,12 @@ void ODBCOracleTest::testAutoTransaction() session() << "INSERT INTO Strings VALUES (3)", now; localSession << "SELECT count(*) FROM Strings", into(count), now; - assert (0 == count); + assertTrue (0 == count); at.commit(); localSession << "SELECT count(*) FROM Strings", into(count), now; - assert (3 == count); + assertTrue (3 == count); session().setFeature("autoCommit", ac); } diff --git a/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp b/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp index 323c1b7d1..2c2f1cf34 100644 --- a/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.cpp @@ -220,7 +220,7 @@ void ODBCPostgreSQLTest::testStoredFunction() int i = 0; session() << "{? = call storedFunction()}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("FUNCTION", "storedFunction()"); try @@ -237,7 +237,7 @@ void ODBCPostgreSQLTest::testStoredFunction() i = 2; int result = 0; session() << "{? = call storedFunction(?)}", out(result), in(i), now; - assert(4 == result); + assertTrue (4 == result); dropObject("FUNCTION", "storedFunction(INTEGER)"); dropObject("FUNCTION", "storedFunction(TIMESTAMP)"); @@ -255,7 +255,7 @@ void ODBCPostgreSQLTest::testStoredFunction() DateTime dtIn(1965, 6, 18, 5, 35, 1); DateTime dtOut; session() << "{? = call storedFunction(?)}", out(dtOut), in(dtIn), now; - assert(dtOut == dtIn); + assertTrue (dtOut == dtIn); dropObject("FUNCTION", "storedFunction(TIMESTAMP)"); dropObject("FUNCTION", "storedFunction(TEXT, TEXT)"); @@ -280,7 +280,7 @@ void ODBCPostgreSQLTest::testStoredFunction() catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (func); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (func); } - assert(ret == "Hello, world!"); + assertTrue (ret == "Hello, world!"); dropObject("FUNCTION", "storedFunction(TEXT, TEXT)"); k += 2; @@ -304,7 +304,7 @@ void ODBCPostgreSQLTest::testStoredFunctionAny() Any i = 2; Any result = 0; session() << "{? = call storedFunction(?)}", out(result), in(i), now; - assert(4 == AnyCast(result)); + assertTrue (4 == AnyCast(result)); k += 2; } @@ -329,7 +329,7 @@ void ODBCPostgreSQLTest::testStoredFunctionDynamicAny() DynamicAny i = 2; DynamicAny result = 0; session() << "{? = call storedFunction(?)}", out(result), in(i), now; - assert(4 == result); + assertTrue (4 == result); k += 2; } diff --git a/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp b/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp index cfe91e492..b15d7d847 100644 --- a/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp +++ b/Data/ODBC/testsuite/src/ODBCSQLServerTest.cpp @@ -257,7 +257,7 @@ void ODBCSQLServerTest::testStoredProcedure() int i = 0; session() << "{call storedProcedure(?)}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("PROCEDURE", "storedProcedure"); session() << "CREATE PROCEDURE storedProcedure(@inParam int, @outParam int OUTPUT) AS " @@ -269,7 +269,7 @@ void ODBCSQLServerTest::testStoredProcedure() i = 2; int j = 0; session() << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == j); + assertTrue (4 == j); dropObject("PROCEDURE", "storedProcedure"); session() << "CREATE PROCEDURE storedProcedure(@ioParam int OUTPUT) AS " @@ -280,7 +280,7 @@ void ODBCSQLServerTest::testStoredProcedure() i = 2; session() << "{call storedProcedure(?)}", io(i), now; - assert(4 == i); + assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); session() << "CREATE PROCEDURE storedProcedure(@ioParam DATETIME OUTPUT) AS " @@ -290,7 +290,7 @@ void ODBCSQLServerTest::testStoredProcedure() DateTime dt(1965, 6, 18, 5, 35, 1); session() << "{call storedProcedure(?)}", io(dt), now; - assert(19 == dt.day()); + assertTrue (19 == dt.day()); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -313,7 +313,7 @@ Deprecated types are not supported as output parameters. Use current large obje try{ session() << "{call storedProcedure(?, ?)}", in(inParam), out(outParam), now; }catch(StatementException& ex){std::cout << ex.toString();} - assert(outParam == inParam); + assertTrue (outParam == inParam); dropObject("PROCEDURE", "storedProcedure"); */ } @@ -349,16 +349,16 @@ void ODBCSQLServerTest::testCursorStoredProcedure() session() << "{call storedCursorProcedure(?)}", in(age), into(people), now; - assert (2 == people.size()); - assert (Person("Simpson", "Bart", "Springfield", 12) == people[0]); - assert (Person("Simpson", "Lisa", "Springfield", 10) == people[1]); + assertTrue (2 == people.size()); + assertTrue (Person("Simpson", "Bart", "Springfield", 12) == people[0]); + assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people[1]); Statement stmt = ((session() << "{call storedCursorProcedure(?)}", in(age), now)); RecordSet rs(stmt); - assert (rs["LastName"] == "Simpson"); - assert (rs["FirstName"] == "Bart"); - assert (rs["Address"] == "Springfield"); - assert (rs["Age"] == 12); + assertTrue (rs["LastName"] == "Simpson"); + assertTrue (rs["FirstName"] == "Bart"); + assertTrue (rs["Address"] == "Springfield"); + assertTrue (rs["Age"] == 12); dropObject("TABLE", "Person"); dropObject("PROCEDURE", "storedCursorProcedure"); @@ -385,7 +385,7 @@ void ODBCSQLServerTest::testStoredProcedureAny() , now; session() << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == AnyCast(j)); + assertTrue (4 == AnyCast(j)); session() << "DROP PROCEDURE storedProcedure;", now; session() << "CREATE PROCEDURE storedProcedure(@ioParam int OUTPUT) AS " @@ -396,7 +396,7 @@ void ODBCSQLServerTest::testStoredProcedureAny() i = 2; session() << "{call storedProcedure(?)}", io(i), now; - assert(4 == AnyCast(i)); + assertTrue (4 == AnyCast(i)); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -420,7 +420,7 @@ void ODBCSQLServerTest::testStoredProcedureDynamicAny() , now; session() << "{call storedProcedure(?, ?)}", in(i), out(j), now; - assert(4 == j); + assertTrue (4 == j); session() << "DROP PROCEDURE storedProcedure;", now; session() << "CREATE PROCEDURE storedProcedure(@ioParam int OUTPUT) AS " @@ -431,7 +431,7 @@ void ODBCSQLServerTest::testStoredProcedureDynamicAny() i = 2; session() << "{call storedProcedure(?)}", io(i), now; - assert(4 == i); + assertTrue (4 == i); dropObject("PROCEDURE", "storedProcedure"); k += 2; @@ -457,7 +457,7 @@ void ODBCSQLServerTest::testStoredFunction() int i = 0; session() << "{? = call storedFunction}", out(i), now; - assert(-1 == i); + assertTrue (-1 == i); dropObject("PROCEDURE", "storedFunction"); @@ -470,7 +470,7 @@ void ODBCSQLServerTest::testStoredFunction() i = 2; int result = 0; session() << "{? = call storedFunction(?)}", out(result), in(i), now; - assert(4 == result); + assertTrue (4 == result); dropObject("PROCEDURE", "storedFunction"); @@ -485,8 +485,8 @@ void ODBCSQLServerTest::testStoredFunction() int j = 0; result = 0; session() << "{? = call storedFunction(?, ?)}", out(result), in(i), out(j), now; - assert(4 == j); - assert(j == result); + assertTrue (4 == j); + assertTrue (j == result); dropObject("PROCEDURE", "storedFunction"); @@ -504,18 +504,18 @@ void ODBCSQLServerTest::testStoredFunction() j = 2; result = 0; session() << "{? = call storedFunction(?, ?)}", out(result), io(i), io(j), now; - assert(1 == j); - assert(2 == i); - assert(3 == result); + assertTrue (1 == j); + assertTrue (2 == i); + assertTrue (3 == result); Tuple params(1, 2); - assert(1 == params.get<0>()); - assert(2 == params.get<1>()); + assertTrue (1 == params.get<0>()); + assertTrue (2 == params.get<1>()); result = 0; session() << "{? = call storedFunction(?, ?)}", out(result), io(params), now; - assert(1 == params.get<1>()); - assert(2 == params.get<0>()); - assert(3 == result); + assertTrue (1 == params.get<1>()); + assertTrue (2 == params.get<0>()); + assertTrue (3 == result); dropObject("PROCEDURE", "storedFunction"); diff --git a/Data/ODBC/testsuite/src/SQLExecutor.cpp b/Data/ODBC/testsuite/src/SQLExecutor.cpp index d05904f96..b38ecae47 100644 --- a/Data/ODBC/testsuite/src/SQLExecutor.cpp +++ b/Data/ODBC/testsuite/src/SQLExecutor.cpp @@ -350,7 +350,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString, poco_odbc_check_stmt (rc, hstmt); rc = SQLFetch(hstmt); - assert (SQL_SUCCEEDED(rc) || SQL_NO_DATA == rc); + assertTrue (SQL_SUCCEEDED(rc) || SQL_NO_DATA == rc); SQLULEN dateTimeColSize = 0; SQLSMALLINT dateTimeDecDigits = 0; @@ -362,7 +362,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString, rc = SQLGetData(hstmt, 14, SQL_C_SSHORT, &dateTimeDecDigits, sizeof(SQLSMALLINT), &ind); poco_odbc_check_stmt (rc, hstmt); - assert (sizeof(SQL_TIMESTAMP_STRUCT) <= dateTimeColSize); + assertTrue (sizeof(SQL_TIMESTAMP_STRUCT) <= dateTimeColSize); } else if (SQL_NO_DATA == rc) std::cerr << '[' << name() << ']' << " Warning: no SQL_TYPE_TIMESTAMP data type info returned by driver." << std::endl; @@ -511,7 +511,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString, poco_odbc_check_stmt (rc, hstmt); rc = SQLExecute(hstmt); - assert (SQL_NEED_DATA == rc || SQL_SUCCEEDED(rc)); + assertTrue (SQL_NEED_DATA == rc || SQL_SUCCEEDED(rc)); if (SQL_NEED_DATA == rc) { @@ -537,7 +537,7 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString, else if (pParam == (SQLPOINTER) &sixth) dataSize = (SQLINTEGER) sizeof(sixth); - assert (0 != dataSize); + assertTrue (0 != dataSize); rc = SQLPutData(hstmt, pParam, dataSize); poco_odbc_check_stmt (rc, hstmt); } @@ -680,27 +680,27 @@ void SQLExecutor::bareboneODBCTest(const std::string& dbConnString, poco_odbc_check_stmt (rc, hstmt); } - assert (0 == std::strncmp(str[0].c_str(), chr[0], str[0].size())); - assert (0 == std::strncmp(str[1].c_str(), chr[1], str[1].size())); - assert (0 == std::strncmp(str[2].c_str(), chr[2], str[2].size())); - assert (4 == fourth); - assert (1.5 == fifth); + assertTrue (0 == std::strncmp(str[0].c_str(), chr[0], str[0].size())); + assertTrue (0 == std::strncmp(str[1].c_str(), chr[1], str[1].size())); + assertTrue (0 == std::strncmp(str[2].c_str(), chr[2], str[2].size())); + assertTrue (4 == fourth); + assertTrue (1.5 == fifth); - assert (1965 == sixth.year); - assert (6 == sixth.month); - assert (18 == sixth.day); + assertTrue (1965 == sixth.year); + assertTrue (6 == sixth.month); + assertTrue (18 == sixth.day); if (doTime) { - assert (5 == sixth.hour); - assert (34 == sixth.minute); + assertTrue (5 == sixth.hour); + assertTrue (34 == sixth.minute); if (sixth.fraction) // MySQL rounds fraction { - assert(58 == sixth.second); - assert(997000000 == sixth.fraction); + assertTrue (58 == sixth.second); + assertTrue (997000000 == sixth.fraction); } else { - assert(59 == sixth.second); + assertTrue (59 == sixth.second); } } @@ -789,7 +789,7 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString, { SQLLEN rowCount = 0; SQLRowCount(hstmt, &rowCount); - assert (1 == rowCount); + assertTrue (1 == rowCount); } while (SQL_NO_DATA != SQLMoreResults(hstmt)); // make sure all five rows made it in @@ -826,7 +826,7 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString, &length); poco_odbc_check_stmt (rc, hstmt); } - assert (5 == count); + assertTrue (5 == count); rc = SQLCloseCursor(hstmt); poco_odbc_check_stmt (rc, hstmt); @@ -908,15 +908,15 @@ void SQLExecutor::bareboneODBCMultiResultTest(const std::string& dbConnString, poco_odbc_check_stmt (rc, hstmt); } - assert (one++ == chr[0]); - assert (two++ == second); - assert (three == third); + assertTrue (one++ == chr[0]); + assertTrue (two++ == second); + assertTrue (three == third); three += 1.0; ++count; } while (SQL_NO_DATA != SQLMoreResults(hstmt)); - assert (5 == count); + assertTrue (5 == count); sql = "DROP TABLE Test"; pStr = (SQLCHAR*) sql.c_str(); @@ -949,7 +949,7 @@ void SQLExecutor::execute(const std::string& sql) void SQLExecutor::zeroRows() { Statement stmt = (session() << "SELECT * FROM Person WHERE 0 = 1"); - assert(0 == stmt.execute()); + assertTrue (0 == stmt.execute()); } @@ -971,17 +971,17 @@ void SQLExecutor::simpleAccess() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { session() << "SELECT LastName FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (lastName == result); + assertTrue (lastName == result); try { session() << "SELECT Age FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == age); + assertTrue (count == age); } @@ -1003,13 +1003,13 @@ void SQLExecutor::complexType() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person c1; try { session() << "SELECT * FROM Person WHERE LastName = 'LN1'", into(c1), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (c1 == p1); + assertTrue (c1 == p1); } @@ -1025,11 +1025,11 @@ void SQLExecutor::complexTypeTuple() catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } Tuple ret; - assert (ret != t); + assertTrue (ret != t); try { *_pSession << "SELECT * FROM Person", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ret == t); + assertTrue (ret == t); } @@ -1059,7 +1059,7 @@ void SQLExecutor::simpleAccessVector() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector lastNamesR; std::vector firstNamesR; @@ -1068,10 +1068,10 @@ void SQLExecutor::simpleAccessVector() try { session() << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -1090,13 +1090,13 @@ void SQLExecutor::complexTypeVector() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -1115,15 +1115,15 @@ void SQLExecutor::sharedPtrComplexTypeVector() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == result.size()); - assert (result[0] == *people[0]); - assert (result[1] == *people[1]); + assertTrue (2 == result.size()); + assertTrue (result[0] == *people[0]); + assertTrue (result[1] == *people[1]); } @@ -1142,21 +1142,21 @@ void SQLExecutor::autoPtrComplexTypeVector() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == result.size()); - assert (result[0].address == people[0]->address); - assert (result[0].age == people[0]->age); - assert (result[0].firstName == people[0]->firstName); - assert (result[0].lastName == people[0]->lastName); - assert (result[1].address == people[1]->address); - assert (result[1].age == people[1]->age); - assert (result[1].firstName == people[1]->firstName); - assert (result[1].lastName == people[1]->lastName); + assertTrue (2 == result.size()); + assertTrue (result[0].address == people[0]->address); + assertTrue (result[0].age == people[0]->age); + assertTrue (result[0].firstName == people[0]->firstName); + assertTrue (result[0].lastName == people[0]->lastName); + assertTrue (result[1].address == people[1]->address); + assertTrue (result[1].age == people[1]->age); + assertTrue (result[1].firstName == people[1]->firstName); + assertTrue (result[1].lastName == people[1]->lastName); } @@ -1175,7 +1175,7 @@ void SQLExecutor::insertVector() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -1183,13 +1183,13 @@ void SQLExecutor::insertVector() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } count = 0; try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } @@ -1235,7 +1235,7 @@ void SQLExecutor::simpleAccessList() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::list lastNamesR; std::list firstNamesR; @@ -1244,10 +1244,10 @@ void SQLExecutor::simpleAccessList() try { session() << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -1266,13 +1266,13 @@ void SQLExecutor::complexTypeList() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::list result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -1291,7 +1291,7 @@ void SQLExecutor::insertList() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -1299,13 +1299,13 @@ void SQLExecutor::insertList() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } count = 0; try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } @@ -1351,7 +1351,7 @@ void SQLExecutor::simpleAccessDeque() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::deque lastNamesR; std::deque firstNamesR; @@ -1360,10 +1360,10 @@ void SQLExecutor::simpleAccessDeque() try { session() << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -1382,13 +1382,13 @@ void SQLExecutor::complexTypeDeque() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::deque result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -1407,7 +1407,7 @@ void SQLExecutor::insertDeque() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -1415,13 +1415,13 @@ void SQLExecutor::insertDeque() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } count = 0; try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 4); + assertTrue (count == 4); } @@ -1452,21 +1452,21 @@ void SQLExecutor::affectedRows(const std::string& whereClause) Statement stmt1((session() << "INSERT INTO Strings VALUES(?)", use(str))); session() << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); - assert (4 == stmt1.execute()); + assertTrue (count == 0); + assertTrue (4 == stmt1.execute()); session() << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 4); + assertTrue (count == 4); Statement stmt2(session() << "UPDATE Strings SET str = 's4' WHERE str = 's3'"); - assert (2 == stmt2.execute()); + assertTrue (2 == stmt2.execute()); Statement stmt3(session() << "DELETE FROM Strings WHERE str = 's1'"); - assert (1 == stmt3.execute()); + assertTrue (1 == stmt3.execute()); std::string sql; format(sql, "DELETE FROM Strings %s", whereClause); Statement stmt4(session() << sql); - assert (3 == stmt4.execute()); + assertTrue (3 == stmt4.execute()); } @@ -1479,18 +1479,18 @@ void SQLExecutor::insertSingleBulk() for (x = 0; x < 100; ++x) { std::size_t i = stmt.execute(); - assert (1 == i); + assertTrue (1 == i); } int count = 0; try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 100); + assertTrue (count == 100); try { session() << "SELECT SUM(str) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == ((0+99)*100/2)); + assertTrue (count == ((0+99)*100/2)); } @@ -1508,12 +1508,12 @@ void SQLExecutor::floats() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { session() << "SELECT str FROM Strings", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ret == data); + assertTrue (ret == data); } @@ -1531,12 +1531,12 @@ void SQLExecutor::doubles() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); try { session() << "SELECT str FROM Strings", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ret == data); + assertTrue (ret == data); } @@ -1556,11 +1556,11 @@ void SQLExecutor::insertSingleBulkVec() catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 100); + assertTrue (count == 100); try { session() << "SELECT SUM(str) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == ((0+99)*100/2)); + assertTrue (count == ((0+99)*100/2)); } @@ -1581,10 +1581,10 @@ void SQLExecutor::limits() try { session() << "SELECT * FROM Strings", into(retData), limit(50), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (retData.size() == 50); + assertTrue (retData.size() == 50); for (int x = 0; x < 50; ++x) { - assert(data[x] == retData[x]); + assertTrue (data[x] == retData[x]); } } @@ -1606,7 +1606,7 @@ void SQLExecutor::limitZero() try { session() << "SELECT * FROM Strings", into(retData), limit(0), now; }// stupid test, but at least we shouldn't crash catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (retData.size() == 0); + assertTrue (retData.size() == 0); } @@ -1625,18 +1625,18 @@ void SQLExecutor::limitOnce() std::vector retData; Statement stmt = (session() << "SELECT * FROM Strings", into(retData), limit(50), now); - assert (!stmt.done()); - assert (retData.size() == 50); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 50); stmt.execute(); - assert (!stmt.done()); - assert (retData.size() == 100); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 100); stmt.execute(); - assert (stmt.done()); - assert (retData.size() == 101); + assertTrue (stmt.done()); + assertTrue (retData.size() == 101); for (int x = 0; x < 101; ++x) { - assert(data[x] == retData[x]); + assertTrue (data[x] == retData[x]); } } @@ -1653,34 +1653,34 @@ void SQLExecutor::limitPrepare() try { Statement stmt = (session() << "INSERT INTO Strings VALUES (?)", use(data)); - assert (100 == stmt.execute()); + assertTrue (100 == stmt.execute()); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } std::vector retData; Statement stmt = (session() << "SELECT * FROM Strings", into(retData), limit(50)); - assert (retData.size() == 0); - assert (!stmt.done()); + assertTrue (retData.size() == 0); + assertTrue (!stmt.done()); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (!stmt.done()); - assert (retData.size() == 50); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 50); try { stmt.execute(); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (stmt.done()); - assert (retData.size() == 100); + assertTrue (stmt.done()); + assertTrue (retData.size() == 100); try { stmt.execute(); }// will restart execution! catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (!stmt.done()); - assert (retData.size() == 150); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 150); for (int x = 0; x < 150; ++x) { - assert(data[x%100] == retData[x]); + assertTrue (data[x%100] == retData[x]); } } @@ -1703,7 +1703,7 @@ void SQLExecutor::prepare() try { session() << "SELECT COUNT(*) FROM Strings", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); } @@ -1783,7 +1783,7 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size) time = sw.elapsed() / 1000.0; - assert (ints.size() == size); + assertTrue (ints.size() == size); ints.clear(); strings.clear(); @@ -1805,7 +1805,7 @@ void SQLExecutor::doBulkPerformance(Poco::UInt32 size) bulkTime = sw.elapsed() / 1000.0; - assert (ints.size() == size); + assertTrue (ints.size() == size); if (0.0 == bulkTime) { @@ -1848,7 +1848,7 @@ void SQLExecutor::setSimple() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::set lastNamesR; std::set firstNamesR; @@ -1857,10 +1857,10 @@ void SQLExecutor::setSimple() try { session() << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -1878,13 +1878,13 @@ void SQLExecutor::setComplex() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::set result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -1907,15 +1907,15 @@ void SQLExecutor::setComplexUnique() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::set result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result.size() == 2); - assert (*result.begin() == p1); - assert (*++result.begin() == p2); + assertTrue (result.size() == 2); + assertTrue (*result.begin() == p1); + assertTrue (*++result.begin() == p2); } void SQLExecutor::multiSetSimple() @@ -1943,7 +1943,7 @@ void SQLExecutor::multiSetSimple() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::multiset lastNamesR; std::multiset firstNamesR; @@ -1952,10 +1952,10 @@ void SQLExecutor::multiSetSimple() try { session() << "SELECT * FROM Person", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ages.size() == agesR.size()); - assert (lastNames.size() == lastNamesR.size()); - assert (firstNames.size() == firstNamesR.size()); - assert (addresses.size() == addressesR.size()); + assertTrue (ages.size() == agesR.size()); + assertTrue (lastNames.size() == lastNamesR.size()); + assertTrue (firstNames.size() == firstNamesR.size()); + assertTrue (addresses.size() == addressesR.size()); } @@ -1978,13 +1978,13 @@ void SQLExecutor::multiSetComplex() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::multiset result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result.size() == people.size()); + assertTrue (result.size() == people.size()); } @@ -2004,13 +2004,13 @@ void SQLExecutor::mapComplex() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::map result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result == people); + assertTrue (result == people); } @@ -2033,13 +2033,13 @@ void SQLExecutor::mapComplexUnique() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::map result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result.size() == 2); + assertTrue (result.size() == 2); } @@ -2062,13 +2062,13 @@ void SQLExecutor::multiMapComplex() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 5); + assertTrue (count == 5); std::multimap result; try { session() << "SELECT * FROM Person", into(result), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result.size() == people.size()); + assertTrue (result.size() == people.size()); } @@ -2088,12 +2088,12 @@ void SQLExecutor::selectIntoSingle() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { session() << "SELECT * FROM Person ORDER BY LastName", into(result), limit(1), now; }// will return 1 object into one single result catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result == p1); + assertTrue (result == p1); } @@ -2114,15 +2114,15 @@ void SQLExecutor::selectIntoSingleStep() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; Statement stmt = (session() << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); - assert (result == p1); - assert (!stmt.done()); + assertTrue (result == p1); + assertTrue (!stmt.done()); stmt.execute(); - assert (result == p2); - assert (stmt.done()); + assertTrue (result == p2); + assertTrue (stmt.done()); } @@ -2142,7 +2142,7 @@ void SQLExecutor::selectIntoSingleFail() try { session() << "SELECT COUNT(*) FROM Person", into(count), limit(2, true), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -2172,7 +2172,7 @@ void SQLExecutor::lowerLimitOk() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -2202,15 +2202,15 @@ void SQLExecutor::singleSelect() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; Statement stmt = (session() << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); - assert (result == p1); - assert (!stmt.done()); + assertTrue (result == p1); + assertTrue (!stmt.done()); stmt.execute(); - assert (result == p2); - assert (stmt.done()); + assertTrue (result == p2); + assertTrue (stmt.done()); } @@ -2230,7 +2230,7 @@ void SQLExecutor::lowerLimitFail() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -2259,14 +2259,14 @@ void SQLExecutor::combinedLimits() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { session() << "SELECT * FROM Person", into(result), lowerLimit(2), upperLimit(2), now; }// will return 2 objects catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result.size() == 2); - assert (result[0] == p1); - assert (result[1] == p2); + assertTrue (result.size() == 2); + assertTrue (result[0] == p1); + assertTrue (result[1] == p2); } @@ -2287,14 +2287,14 @@ void SQLExecutor::ranges() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); std::vector result; try { session() << "SELECT * FROM Person", into(result), range(2, 2), now; }// will return 2 objects catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (result.size() == 2); - assert (result[0] == p1); - assert (result[1] == p2); + assertTrue (result.size() == 2); + assertTrue (result[0] == p1); + assertTrue (result[1] == p2); } @@ -2314,7 +2314,7 @@ void SQLExecutor::combinedIllegalLimits() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -2343,7 +2343,7 @@ void SQLExecutor::illegalRange() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -2363,13 +2363,13 @@ void SQLExecutor::emptyDB() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 0); + assertTrue (count == 0); Person result; Statement stmt = (session() << "SELECT * FROM Person", into(result), limit(1)); stmt.execute(); - assert (result.firstName.empty()); - assert (stmt.done()); + assertTrue (result.firstName.empty()); + assertTrue (stmt.done()); } @@ -2389,20 +2389,20 @@ void SQLExecutor::blob(int bigSize, const std::string& blobPlaceholder) try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); CLOB res; - assert (res.size() == 0); + assertTrue (res.size() == 0); try { session() << "SELECT Image FROM Person", into(res), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (res == img); + assertTrue (res == img); CLOB big; std::vector v(bigSize, 'x'); big.assignRaw(&v[0], v.size()); - assert (big.size() == bigSize); + assertTrue (big.size() == bigSize); try { session() << "DELETE FROM Person", now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } @@ -2416,7 +2416,7 @@ void SQLExecutor::blob(int bigSize, const std::string& blobPlaceholder) try { session() << "SELECT Image FROM Person", into(res), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (res == big); + assertTrue (res == big); } @@ -2434,15 +2434,15 @@ void SQLExecutor::blobStmt() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); CLOB res; - poco_assert (res.size() == 0); + poco_assertTrue (res.size() == 0); Statement stmt = (session() << "SELECT Image FROM Person", into(res)); try { stmt.execute(); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - poco_assert (res == blob); + poco_assertTrue (res == blob); } @@ -2461,19 +2461,19 @@ void SQLExecutor::dateTime() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch (ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail(funct); } catch (StatementException& se){ std::cout << se.toString() << std::endl; fail(funct); } - assert(count == 1); + assertTrue (count == 1); DateTime res; try { session() << "SELECT Born FROM Person", into(res), now; } catch (ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail(funct); } catch (StatementException& se){ std::cout << se.toString() << std::endl; fail(funct); } - assert(res == born); + assertTrue (res == born); Statement stmt = (session() << "SELECT Born FROM Person", now); RecordSet rset(stmt); res = rset["Born"].convert(); - assert(res == born); + assertTrue (res == born); } @@ -2497,14 +2497,14 @@ void SQLExecutor::date() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); Date d; Time t; try { session() << "SELECT BornDate FROM Person", into(d), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (d == bornDate); + assertTrue (d == bornDate); Statement stmt = (session() << "SELECT BornDate FROM Person", now); RecordSet rset(stmt); @@ -2512,7 +2512,7 @@ void SQLExecutor::date() DateTime dt1 = rset["BornDate"].convert(); Date d2(dt1); - assert (d2 == bornDate); + assertTrue (d2 == bornDate); } @@ -2536,21 +2536,21 @@ void SQLExecutor::time() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); Date d; Time t; try { session() << "SELECT BornTime FROM Person", into(t), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (t == bornTime); + assertTrue (t == bornTime); Statement stmt = (session() << "SELECT BornTime FROM Person", now); RecordSet rset(stmt); DateTime dt2 = rset["BornTime"].convert(); Time t2(dt2); - assert (t2 == bornTime); + assertTrue (t2 == bornTime); } @@ -2565,11 +2565,11 @@ void SQLExecutor::tuples() catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } TupleType ret(-10,-11,-12,-13,-14,-15,-16,-17,-18,-19); - assert (ret != t); + assertTrue (ret != t); try { session() << "SELECT * FROM Tuples", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ret == t); + assertTrue (ret == t); } void SQLExecutor::tupleVector() @@ -2593,13 +2593,13 @@ void SQLExecutor::tupleVector() try { session() << "SELECT COUNT(*) FROM Tuples", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; try { session() << "SELECT * FROM Tuples", into(ret), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (ret == v); + assertTrue (ret == v); } @@ -2621,43 +2621,43 @@ void SQLExecutor::internalExtraction() Statement stmt = (session() << "SELECT * FROM Vectors", now); RecordSet rset(stmt); - assert (3 == rset.columnCount()); - assert (4 == rset.rowCount()); + assertTrue (3 == rset.columnCount()); + assertTrue (4 == rset.rowCount()); int curVal = 3; do { - assert (rset["str0"] == curVal); + assertTrue (rset["str0"] == curVal); ++curVal; } while (rset.moveNext()); rset.moveFirst(); - assert (rset["str0"] == "3"); + assertTrue (rset["str0"] == "3"); rset.moveLast(); - assert(rset["str0"] == "6"); + assertTrue (rset["str0"] == "6"); RecordSet rset2(rset); - assert (3 == rset2.columnCount()); - assert (4 == rset2.rowCount()); + assertTrue (3 == rset2.columnCount()); + assertTrue (4 == rset2.rowCount()); int i = rset.value(0,0); - assert (1 == i); + assertTrue (1 == i); std::string s = rset.value(0,0).convert(); - assert ("1" == s); + assertTrue ("1" == s); int a = rset.value(0,2); - assert (3 == a); + assertTrue (3 == a); try { double d = rset.value(1,1); - assert (2.5 == d); + assertTrue (2.5 == d); } catch (BadCastException&) { float f = rset.value(1,1); - assert (2.5 == f); + assertTrue (2.5 == f); } try @@ -2669,16 +2669,16 @@ void SQLExecutor::internalExtraction() UTF16String us = rset.value(2, 2); Poco::UnicodeConverter::convert(us, s); } - assert("5" == s); + assertTrue ("5" == s); i = rset.value("str0", 2); - assert (5 == i); + assertTrue (5 == i); const Column >& col = rset.column >(0); Column >::Iterator it = col.begin(); Column >::Iterator end = col.end(); for (int i = 1; it != end; ++it, ++i) - assert (*it == i); + assertTrue (*it == i); rset = (session() << "SELECT COUNT(*) AS cnt FROM Vectors", now); @@ -2687,7 +2687,7 @@ void SQLExecutor::internalExtraction() { //this is what most drivers will return int i = rset.value(0,0); - assert (4 == i); + assertTrue (4 == i); } catch(BadCastException&) { @@ -2695,18 +2695,18 @@ void SQLExecutor::internalExtraction() { //this is for Oracle double i = rset.value(0,0); - assert (4 == int(i)); + assertTrue (4 == int(i)); } catch(BadCastException&) { //this is for PostgreSQL Poco::Int64 big = rset.value(0,0); - assert (4 == big); + assertTrue (4 == big); } } s = rset.value("cnt", 0).convert(); - assert ("4" == s); + assertTrue ("4" == s); try { rset.column >(100); fail ("must fail"); } catch (RangeException&) { } @@ -2742,11 +2742,11 @@ void SQLExecutor::filter(const std::string& query, const std::string& intFldName { Statement stmt = (session() << query, now); RecordSet rset(stmt); - assert (rset.totalRowCount() == 4); + assertTrue (rset.totalRowCount() == 4); RowFilter::Ptr pRF = new RowFilter(&rset); - assert (pRF->isEmpty()); + assertTrue (pRF->isEmpty()); pRF->add(intFldName, RowFilter::VALUE_EQUAL, 1); - assert (!pRF->isEmpty()); + assertTrue (!pRF->isEmpty()); Var da; try @@ -2756,49 +2756,49 @@ void SQLExecutor::filter(const std::string& query, const std::string& intFldName } catch (InvalidAccessException&) { da = rset.value(0, 1, false); - assert (2 == da); + assertTrue (2 == da); da = rset.value(0, 0); - assert (1 == da); + assertTrue (1 == da); } - assert (rset.rowCount() == 1); - assert (rset.moveFirst()); - assert (1 == rset[intFldName]); - assert (!rset.moveNext()); + assertTrue (rset.rowCount() == 1); + assertTrue (rset.moveFirst()); + assertTrue (1 == rset[intFldName]); + assertTrue (!rset.moveNext()); pRF->add("flt0", RowFilter::VALUE_LESS_THAN_OR_EQUAL, 3.5f); - assert (rset.rowCount() == 3); - assert (rset.moveNext()); - assert (2.5 == rset["flt0"]); - assert (rset.moveNext()); - assert (3.5 == rset["flt0"]); - assert (!rset.moveNext()); + assertTrue (rset.rowCount() == 3); + assertTrue (rset.moveNext()); + assertTrue (2.5 == rset["flt0"]); + assertTrue (rset.moveNext()); + assertTrue (3.5 == rset["flt0"]); + assertTrue (!rset.moveNext()); pRF->add("str0", RowFilter::VALUE_EQUAL, 6); - assert (rset.rowCount() == 4); - assert (rset.moveLast()); - assert ("6" == rset["str0"]); + assertTrue (rset.rowCount() == 4); + assertTrue (rset.moveLast()); + assertTrue ("6" == rset["str0"]); pRF->remove("flt0"); - assert (rset.rowCount() == 2); - assert (rset.moveFirst()); - assert ("3" == rset["str0"]); - assert (rset.moveNext()); - assert ("6" == rset["str0"]); + assertTrue (rset.rowCount() == 2); + assertTrue (rset.moveFirst()); + assertTrue ("3" == rset["str0"]); + assertTrue (rset.moveNext()); + assertTrue ("6" == rset["str0"]); pRF->remove(intFldName); pRF->remove("str0"); - assert (pRF->isEmpty()); + assertTrue (pRF->isEmpty()); pRF->add("str0", "!=", 3); - assert (rset.rowCount() == 3); + assertTrue (rset.rowCount() == 3); RowFilter::Ptr pRF1 = new RowFilter(pRF, RowFilter::OP_AND); pRF1->add(intFldName, "==", 2); - assert (rset.rowCount() == 1); + assertTrue (rset.rowCount() == 1); pRF1->add(intFldName, "<", 2); - assert (rset.rowCount() == 1); + assertTrue (rset.rowCount() == 1); pRF1->add(intFldName, ">", 3); - assert (rset.rowCount() == 2); + assertTrue (rset.rowCount() == 2); pRF->removeFilter(pRF1); pRF->remove("str0"); - assert (pRF->isEmpty()); - assert (rset.rowCount() == 4); + assertTrue (pRF->isEmpty()); + assertTrue (rset.rowCount() == 4); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -2838,15 +2838,15 @@ void SQLExecutor::internalBulkExtraction() { Statement stmt = (session() << "SELECT * FROM Person", bulk(size), now); RecordSet rset(stmt); - assert (size == rset.rowCount()); - assert("LN0" == rset["LastName"]); - assert (0 == rset["Age"]); + assertTrue (size == rset.rowCount()); + assertTrue ("LN0" == rset["LastName"]); + assertTrue (0 == rset["Age"]); rset.moveNext(); - assert("LN1" == rset["LastName"]); - assert(1 == rset["Age"]); + assertTrue ("LN1" == rset["LastName"]); + assertTrue (1 == rset["Age"]); rset.moveLast(); - assert (std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); - assert (size - 1 == rset["Age"]); + assertTrue (std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); + assertTrue (size - 1 == rset["Age"]); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -2855,12 +2855,12 @@ void SQLExecutor::internalBulkExtraction() { Statement stmt = (session() << "SELECT * FROM Person", limit(size), bulk, now); RecordSet rset(stmt); - assert (size == rset.rowCount()); - assert ("LN0" == rset["LastName"]); - assert (0 == rset["Age"]); + assertTrue (size == rset.rowCount()); + assertTrue ("LN0" == rset["LastName"]); + assertTrue (0 == rset["Age"]); rset.moveLast(); - assert (std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); - assert (size - 1 == rset["Age"]); + assertTrue (std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); + assertTrue (size - 1 == rset["Age"]); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -2900,15 +2900,15 @@ void SQLExecutor::internalBulkExtractionUTF16() { Statement stmt = (session() << "SELECT * FROM Person", bulk(size), now); RecordSet rset(stmt); - assert(size == rset.rowCount()); - assert(Poco::UnicodeConverter::to("LN0") == rset["LastName"]); - assert(0 == rset["Age"]); + assertTrue (size == rset.rowCount()); + assertTrue (Poco::UnicodeConverter::to("LN0") == rset["LastName"]); + assertTrue (0 == rset["Age"]); rset.moveNext(); - assert(Poco::UnicodeConverter::to("LN1") == rset["LastName"]); - assert(1 == rset["Age"]); + assertTrue (Poco::UnicodeConverter::to("LN1") == rset["LastName"]); + assertTrue (1 == rset["Age"]); rset.moveLast(); - assert(std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); - assert(size - 1 == rset["Age"]); + assertTrue (std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); + assertTrue (size - 1 == rset["Age"]); } catch (ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail(funct); } catch (StatementException& se){ std::cout << se.toString() << std::endl; fail(funct); } @@ -2917,12 +2917,12 @@ void SQLExecutor::internalBulkExtractionUTF16() { Statement stmt = (session() << "SELECT * FROM Person", limit(size), bulk, now); RecordSet rset(stmt); - assert(size == rset.rowCount()); - assert("LN0" == rset["LastName"]); - assert(0 == rset["Age"]); + assertTrue (size == rset.rowCount()); + assertTrue ("LN0" == rset["LastName"]); + assertTrue (0 == rset["Age"]); rset.moveLast(); - assert(std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); - assert(size - 1 == rset["Age"]); + assertTrue (std::string("LN") + NumberFormatter::format(size - 1) == rset["LastName"]); + assertTrue (size - 1 == rset["Age"]); } catch (ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail(funct); } catch (StatementException& se){ std::cout << se.toString() << std::endl; fail(funct); } @@ -2957,20 +2957,20 @@ void SQLExecutor::internalStorageType() Statement stmt = (session() << "SELECT * FROM Vectors", *it, now); RecordSet rset(stmt); - assert (3 == rset.columnCount()); - assert (4 == rset.rowCount()); + assertTrue (3 == rset.columnCount()); + assertTrue (4 == rset.rowCount()); int curVal = 3; do { - assert (rset["str0"] == curVal); + assertTrue (rset["str0"] == curVal); ++curVal; } while (rset.moveNext()); rset.moveFirst(); - assert (rset["str0"] == "3"); + assertTrue (rset["str0"] == "3"); rset.moveLast(); - assert (rset["str0"] == "6"); + assertTrue (rset["str0"] == "6"); try { @@ -3029,19 +3029,19 @@ void SQLExecutor::nulls() catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } RecordSet rs(session(), "SELECT * FROM NullTest"); - assert (1 == rs.rowCount()); + assertTrue (1 == rs.rowCount()); rs.moveFirst(); - assert (rs.isNull("i")); - assert (rs["i"] != 0); - assert (rs.isNull("r")); - assert (rs.isNull("v")); - assert (rs["v"] != ""); - assert (rs.nvl("i") == 0); - assert (rs.nvl("i", -1) == -1); - assert (rs.nvl("r") == double()); - assert (rs.nvl("r", -1.5) == -1.5); - assert (rs.nvl("v") == ""); - assert (rs.nvl("v", "123") == "123"); + assertTrue (rs.isNull("i")); + assertTrue (rs["i"] != 0); + assertTrue (rs.isNull("r")); + assertTrue (rs.isNull("v")); + assertTrue (rs["v"] != ""); + assertTrue (rs.nvl("i") == 0); + assertTrue (rs.nvl("i", -1) == -1); + assertTrue (rs.nvl("r") == double()); + assertTrue (rs.nvl("r", -1.5) == -1.5); + assertTrue (rs.nvl("v") == ""); + assertTrue (rs.nvl("v", "123") == "123"); try { session() << "DELETE FROM NullTest", now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -3054,19 +3054,19 @@ void SQLExecutor::nulls() catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } rs = (session() << "SELECT * FROM NullTest", now); - assert (1 == rs.rowCount()); + assertTrue (1 == rs.rowCount()); rs.moveFirst(); - assert (!rs.isNull("i")); - assert (rs["i"] == 1); - assert (!rs.isNull("v")); - assert (!rs.isNull("r")); - assert (rs["v"] == "123"); - assert (rs.nvl("i") == 1); - assert (rs.nvl("i", -1) == 1); - assert (rs.nvl("r") == 1.5); - assert (rs.nvl("r", -1.5) == 1.5); - assert (rs.nvl("v") == "123"); - assert (rs.nvl("v", "456") == "123"); + assertTrue (!rs.isNull("i")); + assertTrue (rs["i"] == 1); + assertTrue (!rs.isNull("v")); + assertTrue (!rs.isNull("r")); + assertTrue (rs["v"] == "123"); + assertTrue (rs.nvl("i") == 1); + assertTrue (rs.nvl("i", -1) == 1); + assertTrue (rs.nvl("r") == 1.5); + assertTrue (rs.nvl("r", -1.5) == 1.5); + assertTrue (rs.nvl("v") == "123"); + assertTrue (rs.nvl("v", "456") == "123"); try { session() << "UPDATE NullTest SET v = ? WHERE i = ?", use(null), use(i), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } @@ -3076,20 +3076,20 @@ void SQLExecutor::nulls() catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } rs = (session() << "SELECT i, r, v FROM NullTest ORDER BY i ASC", now); - assert (2 == rs.rowCount()); + assertTrue (2 == rs.rowCount()); rs.moveFirst(); - assert (!rs.isNull("i")); - assert (rs["i"] == 1); - assert (!rs.isNull("r")); - assert (rs.isNull("v")); - assert (rs["v"] != ""); + assertTrue (!rs.isNull("i")); + assertTrue (rs["i"] == 1); + assertTrue (!rs.isNull("r")); + assertTrue (rs.isNull("v")); + assertTrue (rs["v"] != ""); - assert (rs.moveNext()); - assert (!rs.isNull("i")); - assert (rs["i"] == 2); - assert (rs.isNull("r")); - assert (rs.isNull("v")); - assert (rs["v"] != ""); + assertTrue (rs.moveNext()); + assertTrue (!rs.isNull("i")); + assertTrue (rs["i"] == 2); + assertTrue (rs.isNull("r")); + assertTrue (rs.isNull("v")); + assertTrue (rs["v"] != ""); try { session() << "DELETE FROM NullTest", now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } @@ -3112,18 +3112,18 @@ void SQLExecutor::nulls() session().setFeature("forceEmptyString", false); RecordSet rs1(session(), "SELECT v FROM NullTest"); - assert (1 == rs1.rowCount()); + assertTrue (1 == rs1.rowCount()); rs1.moveFirst(); - assert (rs1.isNull("v")); - assert (!(rs["v"] == "")); + assertTrue (rs1.isNull("v")); + assertTrue (!(rs["v"] == "")); session().setFeature("emptyStringIsNull", false); session().setFeature("forceEmptyString", true); RecordSet rs2(session(), "SELECT v FROM NullTest"); - assert (1 == rs2.rowCount()); + assertTrue (1 == rs2.rowCount()); rs2.moveFirst(); - assert (!rs2.isNull("v")); - assert ((rs2["v"] == "")); + assertTrue (!rs2.isNull("v")); + assertTrue ((rs2["v"] == "")); try { @@ -3150,7 +3150,7 @@ void SQLExecutor::rowIterator() catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } RecordSet rset0(session(), "SELECT * FROM Vectors"); - assert (rset0.begin() == rset0.end()); + assertTrue (rset0.begin() == rset0.end()); try { session() << "INSERT INTO Vectors VALUES (?,?,?)", use(v), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } @@ -3163,25 +3163,25 @@ void SQLExecutor::rowIterator() RecordSet::Iterator end = rset.end(); for (int i = 1; it != end; ++it, ++i) { - assert (it->get(0) == i); + assertTrue (it->get(0) == i); osLoop << *it; } - assert (!osLoop.str().empty()); + assertTrue (!osLoop.str().empty()); std::ostringstream osCopy; std::copy(rset.begin(), rset.end(), std::ostream_iterator(osCopy)); - assert (osLoop.str() == osCopy.str()); + assertTrue (osLoop.str() == osCopy.str()); RowFilter::Ptr pRF = new RowFilter(&rset); - assert (pRF->isEmpty()); + assertTrue (pRF->isEmpty()); pRF->add("str0", RowFilter::VALUE_EQUAL, "3"); - assert (!pRF->isEmpty()); + assertTrue (!pRF->isEmpty()); it = rset.begin(); end = rset.end(); for (int i = 1; it != end; ++it, ++i) { - assert (it->get(0) == i); - assert (1 == i); + assertTrue (it->get(0) == i); + assertTrue (1 == i); } } @@ -3197,7 +3197,7 @@ void SQLExecutor::stdVectorBool() b = true; session() << "SELECT * FROM BoolTest", into(b), now; - assert (false == b); + assertTrue (false == b); session() << "DELETE FROM BoolTest", now; b = true; @@ -3207,7 +3207,7 @@ void SQLExecutor::stdVectorBool() b = false; session() << "SELECT * FROM BoolTest", into(b), now; - assert (true == b); + assertTrue (true == b); session() << "DELETE FROM BoolTest", now; std::vector v; @@ -3223,13 +3223,13 @@ void SQLExecutor::stdVectorBool() v.clear(); session() << "SELECT * FROM BoolTest", into(v), now; - assert (4 == v.size()); + assertTrue (4 == v.size()); std::vector::iterator it = v.begin(); std::vector::iterator end = v.end(); int t = 0; for (; it != end; ++it) t += *it ? 1 : 0; - assert (2 == t); + assertTrue (2 == t); try { session() << "SELECT * FROM BoolTest WHERE b = ?", out(v), now; fail("must fail"); } catch (BindingException&) { } @@ -3242,7 +3242,7 @@ void SQLExecutor::stdVectorBool() t = 0; for (int i = 0; i < 4; ++i) t += rset.value(0, i) ? 1 : 0; - assert (2 == t); + assertTrue (2 == t); } @@ -3253,12 +3253,12 @@ void SQLExecutor::asynchronous(int rowCount) std::vector data(rowCount); Statement stmt = (tmp << "INSERT INTO Strings VALUES(?)", use(data)); Statement::Result result = stmt.executeAsync(); - assert (!stmt.isAsync()); + assertTrue (!stmt.isAsync()); result.wait(); Statement stmt1 = (tmp << "SELECT * FROM Strings", into(data), async, now); - assert (stmt1.isAsync()); - assert (stmt1.wait() == rowCount); + assertTrue (stmt1.isAsync()); + assertTrue (stmt1.wait() == rowCount); // +++ if this part of the test case fails, increase the rowCount until achieved // that first execute is still executing when the second one is called @@ -3275,9 +3275,9 @@ void SQLExecutor::asynchronous(int rowCount) // --- stmt = tmp << "SELECT * FROM Strings", into(data), async, now; - assert (stmt.isAsync()); + assertTrue (stmt.isAsync()); stmt.wait(); - assert (stmt.execute() == 0); + assertTrue (stmt.execute() == 0); // +++ if this part of the test case fails, increase the rowCount until achieved // that first execute is still executing when the second one is called @@ -3286,49 +3286,49 @@ void SQLExecutor::asynchronous(int rowCount) fail ("executeAsync() must fail"); } catch (InvalidAccessException&) { - assert (stmt.isAsync()); + assertTrue (stmt.isAsync()); stmt.wait(); result = stmt.executeAsync(); } // --- - assert (stmt.wait() == rowCount); - assert (result.data() == rowCount); + assertTrue (stmt.wait() == rowCount); + assertTrue (result.data() == rowCount); stmt.setAsync(false); - assert (!stmt.isAsync()); - assert (stmt.execute() == rowCount); + assertTrue (!stmt.isAsync()); + assertTrue (stmt.execute() == rowCount); stmt = tmp << "SELECT * FROM Strings", into(data), sync, now; - assert (!stmt.isAsync()); - assert (stmt.wait() == 0); - assert (stmt.execute() == rowCount); + assertTrue (!stmt.isAsync()); + assertTrue (stmt.wait() == 0); + assertTrue (stmt.execute() == rowCount); result = stmt.executeAsync(); - assert (!stmt.isAsync()); + assertTrue (!stmt.isAsync()); result.wait(); - assert (result.data() == rowCount); + assertTrue (result.data() == rowCount); - assert (0 == rowCount % 10); + assertTrue (0 == rowCount % 10); int step = (int) (rowCount/10); data.clear(); Statement stmt2 = (tmp << "SELECT * FROM Strings", into(data), async, limit(step)); - assert (data.size() == 0); - assert (!stmt2.done()); + assertTrue (data.size() == 0); + assertTrue (!stmt2.done()); std::size_t rows = 0; for (int i = 0; !stmt2.done(); i += step) { stmt2.execute(); rows = stmt2.wait(); - assert (step == rows); - assert (step + i == data.size()); + assertTrue (step == rows); + assertTrue (step + i == data.size()); } - assert (stmt2.done()); - assert (rowCount == data.size()); + assertTrue (stmt2.done()); + assertTrue (rowCount == data.size()); stmt2 = tmp << "SELECT * FROM Strings", reset; - assert (!stmt2.isAsync()); - assert ("deque" == stmt2.getStorage()); - assert (stmt2.execute() == rowCount); + assertTrue (!stmt2.isAsync()); + assertTrue ("deque" == stmt2.getStorage()); + assertTrue (stmt2.execute() == rowCount); } @@ -3349,26 +3349,26 @@ void SQLExecutor::any() int count = 0; tmp << "SELECT COUNT(*) FROM Anys", into(count), now; - assert (1 == count); + assertTrue (1 == count); i = 0; f = 0.0; s = std::string(""); tmp << "SELECT * FROM Anys", into(i), into(f), into(s), now; - assert (AnyCast(i) == 42); - assert (AnyCast(f) == 42.5); + assertTrue (AnyCast(i) == 42); + assertTrue (AnyCast(f) == 42.5); #ifdef POCO_ODBC_UNICODE // drivers may behave differently here try { - assert(AnyCast(s) == us); + assertTrue (AnyCast(s) == us); } catch (BadCastException&) { - assert (AnyCast(s) == "42"); + assertTrue (AnyCast(s) == "42"); } #else - assert (AnyCast(s) == "42"); + assertTrue (AnyCast(s) == "42"); #endif } @@ -3384,15 +3384,15 @@ void SQLExecutor::dynamicAny() int count = 0; tmp << "SELECT COUNT(*) FROM Anys", into(count), now; - assert (1 == count); + assertTrue (1 == count); i = 0; f = 0.0; s = std::string(""); tmp << "SELECT * FROM Anys", into(i), into(f), into(s), now; - assert (42 == i); - assert (42.5 == f); - assert ("42" == s); + assertTrue (42 == i); + assertTrue (42.5 == f); + assertTrue ("42" == s); } @@ -3419,12 +3419,12 @@ void SQLExecutor::multipleResults(const std::string& sql) , into(aBart, pos1) , into(people2, from(pos2)), use(aLisa), use(aHomer); - assert (4 == stmt.execute()); - assert (Person("Simpson", "Homer", "Springfield", 42) == pHomer); - assert (10 == aBart); - assert (2 == people2.size()); - assert (Person("Simpson", "Lisa", "Springfield", 8) == people2[0]); - assert (Person("Simpson", "Homer", "Springfield", 42) == people2[1]); + assertTrue (4 == stmt.execute()); + assertTrue (Person("Simpson", "Homer", "Springfield", 42) == pHomer); + assertTrue (10 == aBart); + assertTrue (2 == people2.size()); + assertTrue (Person("Simpson", "Lisa", "Springfield", 8) == people2[0]); + assertTrue (Person("Simpson", "Homer", "Springfield", 42) == people2[1]); } @@ -3448,18 +3448,18 @@ void SQLExecutor::sqlChannel(const std::string& connect) pChannel->log(msgWarnS); RecordSet rs(session(), "SELECT * FROM T_POCO_LOG ORDER by Text"); - assert (4 == rs.rowCount()); - assert ("InformationSource" == rs["Source"]); - assert ("a Informational async message" == rs["Text"]); + assertTrue (4 == rs.rowCount()); + assertTrue ("InformationSource" == rs["Source"]); + assertTrue ("a Informational async message" == rs["Text"]); rs.moveNext(); - assert ("WarningSource" == rs["Source"]); - assert ("b Warning async message" == rs["Text"]); + assertTrue ("WarningSource" == rs["Source"]); + assertTrue ("b Warning async message" == rs["Text"]); rs.moveNext(); - assert ("InformationSource" == rs["Source"]); - assert ("c Informational sync message" == rs["Text"]); + assertTrue ("InformationSource" == rs["Source"]); + assertTrue ("c Informational sync message" == rs["Text"]); rs.moveNext(); - assert ("WarningSource" == rs["Source"]); - assert ("d Warning sync message" == rs["Text"]); + assertTrue ("WarningSource" == rs["Source"]); + assertTrue ("d Warning sync message" == rs["Text"]); Thread::sleep(3000); @@ -3469,17 +3469,17 @@ void SQLExecutor::sqlChannel(const std::string& connect) pChannel->log(msgWarnA); RecordSet rs1(session(), "SELECT * FROM T_POCO_LOG_ARCHIVE"); - assert (4 == rs1.rowCount()); + assertTrue (4 == rs1.rowCount()); pChannel->setProperty("keep", ""); - assert ("forever" == pChannel->getProperty("keep")); + assertTrue ("forever" == pChannel->getProperty("keep")); RecordSet rs2(session(), "SELECT * FROM T_POCO_LOG ORDER by Text"); - assert (2 == rs2.rowCount()); - assert ("InformationSource" == rs2["Source"]); - assert ("e Informational sync message" == rs2["Text"]); + assertTrue (2 == rs2.rowCount()); + assertTrue ("InformationSource" == rs2["Source"]); + assertTrue ("e Informational sync message" == rs2["Text"]); rs2.moveNext(); - assert ("WarningSource" == rs2["Source"]); - assert ("f Warning sync message" == rs2["Text"]); + assertTrue ("WarningSource" == rs2["Source"]); + assertTrue ("f Warning sync message" == rs2["Text"]); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("sqlChannel()"); } @@ -3501,12 +3501,12 @@ void SQLExecutor::sqlLogger(const std::string& connect) Thread::sleep(100); RecordSet rs(session(), "SELECT * FROM T_POCO_LOG ORDER by Text"); - assert (2 == rs.rowCount()); - assert ("TestSQLChannel" == rs["Source"]); - assert ("a Informational message" == rs["Text"]); + assertTrue (2 == rs.rowCount()); + assertTrue ("TestSQLChannel" == rs["Source"]); + assertTrue ("a Informational message" == rs["Text"]); rs.moveNext(); - assert ("TestSQLChannel" == rs["Source"]); - assert ("b Warning message" == rs["Text"]); + assertTrue ("TestSQLChannel" == rs["Source"]); + assertTrue ("b Warning message" == rs["Text"]); } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail ("sqlLogger()"); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail ("sqlLogger()"); } @@ -3524,11 +3524,11 @@ void SQLExecutor::setTransactionIsolation(Session& session, Poco::UInt32 ti) Transaction t(session, false); t.setIsolation(ti); - assert (ti == t.getIsolation()); - assert (t.isIsolation(ti)); + assertTrue (ti == t.getIsolation()); + assertTrue (t.isIsolation(ti)); - assert (ti == session.getTransactionIsolation()); - assert (session.isTransactionIsolation(ti)); + assertTrue (ti == session.getTransactionIsolation()); + assertTrue (session.isTransactionIsolation(ti)); } catch(Poco::Exception& e){ std::cout << funct << ':' << e.displayText() << std::endl;} } @@ -3584,9 +3584,9 @@ void SQLExecutor::sessionTransaction(const std::string& connect) bool autoCommit = session().getFeature("autoCommit"); session().setFeature("autoCommit", true); - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); session().setFeature("autoCommit", false); - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); setTransactionIsolation(session(), Session::TRANSACTION_READ_UNCOMMITTED); setTransactionIsolation(session(), Session::TRANSACTION_REPEATABLE_READ); @@ -3595,49 +3595,49 @@ void SQLExecutor::sessionTransaction(const std::string& connect) setTransactionIsolation(session(), Session::TRANSACTION_READ_COMMITTED); session().begin(); - assert (session().isTransaction()); + assertTrue (session().isTransaction()); try { session() << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (session().isTransaction()); + assertTrue (session().isTransaction()); Statement stmt = (local << "SELECT COUNT(*) FROM Person", into(locCount), async, now); try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == count); - assert (session().isTransaction()); + assertTrue (2 == count); + assertTrue (session().isTransaction()); session().rollback(); - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); stmt.wait(); - assert (0 == locCount); + assertTrue (0 == locCount); try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); - assert (!session().isTransaction()); + assertTrue (0 == count); + assertTrue (!session().isTransaction()); session().begin(); try { session() << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (session().isTransaction()); + assertTrue (session().isTransaction()); Statement stmt1 = (local << "SELECT COUNT(*) FROM Person", into(locCount), async, now); session().commit(); - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); stmt1.wait(); - assert (2 == locCount); + assertTrue (2 == locCount); try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); session().setFeature("autoCommit", autoCommit); } @@ -3680,37 +3680,37 @@ void SQLExecutor::transaction(const std::string& connect) bool autoCommit = session().getFeature("autoCommit"); session().setFeature("autoCommit", true); - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); session().setFeature("autoCommit", false); - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); session().setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED); { Transaction trans(session()); - assert (trans.isActive()); - assert (session().isTransaction()); + assertTrue (trans.isActive()); + assertTrue (session().isTransaction()); try { session() << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (session().isTransaction()); - assert (trans.isActive()); + assertTrue (session().isTransaction()); + assertTrue (trans.isActive()); try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == count); - assert (session().isTransaction()); - assert (trans.isActive()); + assertTrue (2 == count); + assertTrue (session().isTransaction()); + assertTrue (trans.isActive()); } - assert (!session().isTransaction()); + assertTrue (!session().isTransaction()); try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); - assert (!session().isTransaction()); + assertTrue (0 == count); + assertTrue (!session().isTransaction()); { Transaction trans(session()); @@ -3720,20 +3720,20 @@ void SQLExecutor::transaction(const std::string& connect) Statement stmt1 = (local << "SELECT COUNT(*) FROM Person", into(locCount), async, now); - assert (session().isTransaction()); - assert (trans.isActive()); + assertTrue (session().isTransaction()); + assertTrue (trans.isActive()); trans.commit(); - assert (!session().isTransaction()); - assert (!trans.isActive()); + assertTrue (!session().isTransaction()); + assertTrue (!trans.isActive()); stmt1.wait(); - assert (2 == locCount); + assertTrue (2 == locCount); } try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); try { session() << "DELETE FROM Person", now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } @@ -3744,12 +3744,12 @@ void SQLExecutor::transaction(const std::string& connect) try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); try { stmt1.wait(5000); if (local.getTransactionIsolation() == Session::TRANSACTION_READ_UNCOMMITTED) - assert (0 == locCount); + assertTrue (0 == locCount); } catch (TimeoutException&) { std::cerr << '[' << name() << ']' << " Warning: async query timed out." << std::endl; } session().commit(); @@ -3758,7 +3758,7 @@ void SQLExecutor::transaction(const std::string& connect) { stmt1.wait(); local << "SELECT count(*) FROM Person", into(locCount), now; - assert (0 == locCount); + assertTrue (0 == locCount); } std::string sql1 = format("INSERT INTO Person VALUES ('%s','%s','%s',%d)", lastNames[0], firstNames[0], addresses[0], ages[0]); @@ -3773,34 +3773,34 @@ void SQLExecutor::transaction(const std::string& connect) try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (1 == count); + assertTrue (1 == count); trans.execute(sql2, false); try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); Statement stmt2 = (local << "SELECT COUNT(*) FROM Person", into(locCount), async, now); trans.rollback(); stmt2.wait(); - assert (0 == locCount); + assertTrue (0 == locCount); try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); trans.execute(sql); Statement stmt3 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now); - assert (2 == locCount); + assertTrue (2 == locCount); try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (2 == count); + assertTrue (2 == count); session().setFeature("autoCommit", autoCommit); } @@ -3840,7 +3840,7 @@ void SQLExecutor::transactor() try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (1 == count); + assertTrue (1 == count); try { session() << "DELETE FROM Person", now; session().commit();} catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } @@ -3849,7 +3849,7 @@ void SQLExecutor::transactor() try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); try { @@ -3861,7 +3861,7 @@ void SQLExecutor::transactor() try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); try { @@ -3874,7 +3874,7 @@ void SQLExecutor::transactor() try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); try { @@ -3887,7 +3887,7 @@ void SQLExecutor::transactor() try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); try { @@ -3900,7 +3900,7 @@ void SQLExecutor::transactor() try { session() << "SELECT count(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (0 == count); + assertTrue (0 == count); session().setFeature("autoCommit", autoCommit); } @@ -3917,42 +3917,42 @@ void SQLExecutor::nullable() Nullable s = std::string("abc"); Nullable d = DateTime(); - assert (!i.isNull()); - assert (!f.isNull()); - assert (!s.isNull()); - assert (!d.isNull()); + assertTrue (!i.isNull()); + assertTrue (!f.isNull()); + assertTrue (!s.isNull()); + assertTrue (!d.isNull()); session() << "SELECT EmptyString, EmptyInteger, EmptyFloat, EmptyDateTime FROM NullableTest", into(s), into(i), into(f), into(d), now; - assert (i.isNull()); - assert (f.isNull()); - assert (s.isNull()); - assert (d.isNull()); + assertTrue (i.isNull()); + assertTrue (f.isNull()); + assertTrue (s.isNull()); + assertTrue (d.isNull()); RecordSet rs(session(), "SELECT * FROM NullableTest"); rs.moveFirst(); - assert (rs.isNull("EmptyString")); - assert (rs.isNull("EmptyInteger")); - assert (rs.isNull("EmptyFloat")); - assert (rs.isNull("EmptyDateTime")); + assertTrue (rs.isNull("EmptyString")); + assertTrue (rs.isNull("EmptyInteger")); + assertTrue (rs.isNull("EmptyFloat")); + assertTrue (rs.isNull("EmptyDateTime")); Var di = 1; Var df = 1.5; Var ds = "abc"; Var dd = DateTime(); - assert (!di.isEmpty()); - assert (!df.isEmpty()); - assert (!ds.isEmpty()); - assert (!dd.isEmpty()); + assertTrue (!di.isEmpty()); + assertTrue (!df.isEmpty()); + assertTrue (!ds.isEmpty()); + assertTrue (!dd.isEmpty()); Statement stmt = (session() << "SELECT EmptyString, EmptyInteger, EmptyFloat, EmptyDateTime FROM NullableTest", into(ds), into(di), into(df), into(dd), now); - assert (di.isEmpty()); - assert (df.isEmpty()); - assert (ds.isEmpty()); - assert (dd.isEmpty()); + assertTrue (di.isEmpty()); + assertTrue (df.isEmpty()); + assertTrue (ds.isEmpty()); + assertTrue (dd.isEmpty()); } @@ -3974,26 +3974,26 @@ void SQLExecutor::reconnect() try { session() << "SELECT COUNT(*) FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == 1); + assertTrue (count == 1); - assert (session().isConnected()); + assertTrue (session().isConnected()); session().close(); - assert (!session().isConnected()); + assertTrue (!session().isConnected()); try { session() << "SELECT LastName FROM Person", into(result), now; fail ("must fail"); } catch(NotConnectedException&){ } - assert (!session().isConnected()); + assertTrue (!session().isConnected()); session().open(); - assert (session().isConnected()); + assertTrue (session().isConnected()); try { session() << "SELECT Age FROM Person", into(count), now; } catch(ConnectionException& ce){ std::cout << ce.toString() << std::endl; fail (funct); } catch(StatementException& se){ std::cout << se.toString() << std::endl; fail (funct); } - assert (count == age); - assert (session().isConnected()); + assertTrue (count == age); + assertTrue (session().isConnected()); } @@ -4009,5 +4009,5 @@ void SQLExecutor::unicode(const std::string& dbConnString) text.clear(); session() << "SELECT str FROM UnicodeTable", into(wtext), now; Poco::UnicodeConverter::convert(wtext, text); - assert(text == std::string((const char*)supp)); + assertTrue (text == std::string((const char*)supp)); } \ No newline at end of file diff --git a/Data/SQLite/testsuite/src/SQLiteTest.cpp b/Data/SQLite/testsuite/src/SQLiteTest.cpp index 5ff0e824e..45ff58b93 100644 --- a/Data/SQLite/testsuite/src/SQLiteTest.cpp +++ b/Data/SQLite/testsuite/src/SQLiteTest.cpp @@ -254,10 +254,10 @@ SQLiteTest::~SQLiteTest() void SQLiteTest::testBinding() { Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.getConnectionTimeout() == Session::LOGIN_TIMEOUT_DEFAULT); + assertTrue (tmp.getConnectionTimeout() == Session::LOGIN_TIMEOUT_DEFAULT); tmp.setConnectionTimeout(5); - assert (tmp.getConnectionTimeout() == 5); - assert (tmp.isConnected()); + assertTrue (tmp.getConnectionTimeout() == 5); + assertTrue (tmp.isConnected()); std::string tableName("Simpsons"); std::string lastName("Simpson"); std::string firstName("Bart"); @@ -280,7 +280,7 @@ void SQLiteTest::testBinding() tmp << "DROP TABLE IF EXISTS Simpsons", now; tmp << "CREATE TABLE IF NOT EXISTS Simpsons (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now; - assert (result == tableName); + assertTrue (result == tableName); // following should not compile: //tmp << "INSERT INTO Simpsons VALUES(?, ?, ?, ?)", use("Simpson"), use("Bart"), use("Springfield"), use(age), now; @@ -296,7 +296,7 @@ void SQLiteTest::testBinding() tmp << "INSERT INTO Simpsons VALUES(?, ?, ?, ?)", bind(crLastName), bind(crFirstName), bind(crAddress), bind(crAge), now; tmp << "SELECT COUNT(*) FROM Simpsons", into(count), now; - assert (6 == count); + assertTrue (6 == count); } @@ -306,14 +306,14 @@ void SQLiteTest::testZeroRows() tmp << "DROP TABLE IF EXISTS ZeroTest", now; tmp << "CREATE TABLE IF NOT EXISTS ZeroTest (zt INTEGER(3))", now; Statement stmt = (tmp << "SELECT * FROM ZeroTest"); - assert(0 == stmt.execute()); + assertTrue (0 == stmt.execute()); } void SQLiteTest::testSimpleAccess() { Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.isConnected()); + assertTrue (tmp.isConnected()); std::string tableName("Person"); std::string lastName("lastname"); std::string firstName("firstname"); @@ -324,27 +324,27 @@ void SQLiteTest::testSimpleAccess() tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now; - assert (result == tableName); + assertTrue (result == tableName); tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); tmp << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); tmp << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); + assertTrue (count == age); tmp << "UPDATE PERSON SET Age = -1", now; tmp << "SELECT Age FROM PERSON", into(age), now; - assert (-1 == age); + assertTrue (-1 == age); tmp.close(); - assert (!tmp.isConnected()); + assertTrue (!tmp.isConnected()); } void SQLiteTest::testInMemory() { Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.isConnected()); + assertTrue (tmp.isConnected()); std::string tableName("Person"); std::string lastName("lastname"); std::string firstName("firstname"); @@ -355,45 +355,45 @@ void SQLiteTest::testInMemory() tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now; - assert (result == tableName); + assertTrue (result == tableName); tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; // load db from file to memory Session mem (Poco::Data::SQLite::Connector::KEY, ":memory:"); - assert (Poco::Data::SQLite::Utility::fileToMemory(mem, "dummy.db")); + assertTrue (Poco::Data::SQLite::Utility::fileToMemory(mem, "dummy.db")); mem << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); mem << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); mem << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); + assertTrue (count == age); mem << "UPDATE PERSON SET Age = -1", now; mem << "SELECT Age FROM PERSON", into(age), now; - assert (-1 == age); + assertTrue (-1 == age); // save db from memory to file on the disk Session dsk (Poco::Data::SQLite::Connector::KEY, "dsk.db"); - assert (Poco::Data::SQLite::Utility::memoryToFile("dsk.db", mem)); + assertTrue (Poco::Data::SQLite::Utility::memoryToFile("dsk.db", mem)); dsk << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); dsk << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); dsk << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); + assertTrue (count == age); dsk << "UPDATE PERSON SET Age = -1", now; dsk << "SELECT Age FROM PERSON", into(age), now; - assert (-1 == age); + assertTrue (-1 == age); tmp.close(); mem.close(); dsk.close(); - assert (!tmp.isConnected()); - assert (!mem.isConnected()); - assert (!dsk.isConnected()); + assertTrue (!tmp.isConnected()); + assertTrue (!mem.isConnected()); + assertTrue (!dsk.isConnected()); } @@ -414,11 +414,11 @@ void SQLiteTest::testNullCharPointer() bind(0), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); tmp << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); tmp << "SELECT Age FROM PERSON", into(age), now; - assert (0 == age); + assertTrue (0 == age); try { @@ -431,11 +431,11 @@ void SQLiteTest::testNullCharPointer() } catch (NullPointerException&) { } tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); tmp << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); tmp << "SELECT Age FROM PERSON", into(age), now; - assert (0 == age); + assertTrue (0 == age); } @@ -469,14 +469,14 @@ void SQLiteTest::testInsertCharPointer() bind(133132)); std::free((void*) pc); pc = 0; - assert (1 == stmt.execute()); + assertTrue (1 == stmt.execute()); tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); tmp << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); tmp << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); + assertTrue (count == age); } @@ -499,14 +499,14 @@ void SQLiteTest::testInsertCharPointer2() bind("Address"), bind(133132), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); Statement stmt1 = (tmp << "SELECT LastName FROM PERSON", into(result)); stmt1.execute(); - assert (lastName == result); + assertTrue (lastName == result); count = 0; Statement stmt2 = (tmp << "SELECT Age FROM PERSON", into(count)); stmt2.execute(); - assert (count == age); + assertTrue (count == age); } @@ -521,12 +521,12 @@ void SQLiteTest::testComplexType() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(p2), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person c1; Person c2; tmp << "SELECT * FROM PERSON WHERE LASTNAME = :ln", into(c1), useRef(p1.getLastName()), now; - assert (c1 == p1); + assertTrue (c1 == p1); tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName1 VARCHAR(30), FirstName1 VARCHAR, Address1 VARCHAR, Age1 INTEGER(3)," @@ -537,9 +537,9 @@ void SQLiteTest::testComplexType() tmp << "INSERT INTO PERSON VALUES(:ln1, :fn1, :ad1, :age1, :ln2, :fn2, :ad2, :age2)", use(t), now; Tuple ret; - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM PERSON", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -567,17 +567,17 @@ void SQLiteTest::testSimpleAccessVector() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastNames), use(firstNames), use(addresses), use(ages), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::vector lastNamesR; std::vector firstNamesR; std::vector addressesR; std::vector agesR; tmp << "SELECT * FROM PERSON", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -592,11 +592,11 @@ void SQLiteTest::testComplexTypeVector() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::vector result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result == people); + assertTrue (result == people); } @@ -611,12 +611,12 @@ void SQLiteTest::testSharedPtrComplexTypeVector() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::vector > result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (*result[0] == *people[0]); - assert (*result[1] == *people[1]); + assertTrue (*result[0] == *people[0]); + assertTrue (*result[1] == *people[1]); } @@ -634,14 +634,14 @@ void SQLiteTest::testInsertVector() { Statement stmt((tmp << "INSERT INTO Strings VALUES(:str)", use(str))); tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); + assertTrue (count == 0); stmt.execute(); tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 4); + assertTrue (count == 4); } count = 0; tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 4); + assertTrue (count == 4); } @@ -678,40 +678,40 @@ void SQLiteTest::testAffectedRows() Statement stmt((tmp << "INSERT INTO Strings VALUES(:str)", use(str))); count = -1; tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); - assert (4 == stmt.execute()); + assertTrue (count == 0); + assertTrue (4 == stmt.execute()); tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 4); + assertTrue (count == 4); Statement stmt0(tmp << "DELETE FROM Strings"); - assert (4 == stmt0.execute()); + assertTrue (4 == stmt0.execute()); tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); + assertTrue (count == 0); Statement stmt1((tmp << "SELECT * FROM Strings")); tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); - assert (0 == stmt1.execute()); + assertTrue (count == 0); + assertTrue (0 == stmt1.execute()); Statement stmt2((tmp << "INSERT INTO Strings VALUES(:str)", use(str))); count = -1; tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); - assert (4 == stmt2.execute()); + assertTrue (count == 0); + assertTrue (4 == stmt2.execute()); tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 4); + assertTrue (count == 4); Statement stmt3(tmp << "UPDATE Strings SET str = 's4' WHERE str = 's3'"); - assert (2 == stmt3.execute()); + assertTrue (2 == stmt3.execute()); Statement stmt4(tmp << "DELETE FROM Strings WHERE str = 's1'"); - assert (1 == stmt4.execute()); + assertTrue (1 == stmt4.execute()); Statement stmt5(tmp << "DELETE FROM Strings WHERE str = 'bad value'"); - assert (0 == stmt5.execute()); + assertTrue (0 == stmt5.execute()); Statement stmt6(tmp << "DELETE FROM Strings"); - assert (3 == stmt6.execute()); + assertTrue (3 == stmt6.execute()); } @@ -726,14 +726,14 @@ void SQLiteTest::testInsertSingleBulk() for (std::size_t i = 0; x < 100; ++x) { i = stmt.execute(); - assert (1 == i); + assertTrue (1 == i); } int count = 0; tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 100); + assertTrue (count == 100); tmp << "SELECT SUM(str) FROM Strings", into(count), now; - assert (count == ((0+99)*100/2)); + assertTrue (count == ((0+99)*100/2)); } @@ -756,9 +756,9 @@ void SQLiteTest::testInsertSingleBulkVec() } int count = 0; tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 100); + assertTrue (count == 100); tmp << "SELECT SUM(str) FROM Strings", into(count), now; - assert (count == ((0+99)*100/2)); + assertTrue (count == ((0+99)*100/2)); } @@ -776,10 +776,10 @@ void SQLiteTest::testLimit() tmp << "INSERT INTO Strings VALUES(:str)", use(data), now; std::vector retData; tmp << "SELECT * FROM Strings", into(retData), limit(50), now; - assert (retData.size() == 50); + assertTrue (retData.size() == 50); for (int x = 0; x < 50; ++x) { - assert(data[x] == retData[x]); + assertTrue (data[x] == retData[x]); } } @@ -798,7 +798,7 @@ void SQLiteTest::testLimitZero() tmp << "INSERT INTO Strings VALUES(:str)", use(data), now; std::vector retData; tmp << "SELECT * FROM Strings", into(retData), limit(0), now; // stupid test, but at least we shouldn't crash - assert (retData.size() == 0); + assertTrue (retData.size() == 0); } @@ -816,18 +816,18 @@ void SQLiteTest::testLimitOnce() tmp << "INSERT INTO Strings VALUES(:str)", use(data), now; std::vector retData; Statement stmt = (tmp << "SELECT * FROM Strings", into(retData), limit(50), now); - assert (!stmt.done()); - assert (retData.size() == 50); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 50); stmt.execute(); - assert (!stmt.done()); - assert (retData.size() == 100); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 100); stmt.execute(); - assert (stmt.done()); - assert (retData.size() == 101); + assertTrue (stmt.done()); + assertTrue (retData.size() == 101); for (int x = 0; x < 101; ++x) { - assert(data[x] == retData[x]); + assertTrue (data[x] == retData[x]); } } @@ -844,27 +844,27 @@ void SQLiteTest::testLimitPrepare() } Statement stmtIns = (tmp << "INSERT INTO Strings VALUES(:str)", use(data)); - assert (100 == stmtIns.execute()); + assertTrue (100 == stmtIns.execute()); std::vector retData; Statement stmt = (tmp << "SELECT * FROM Strings", into(retData), limit(50)); - assert (retData.size() == 0); - assert (!stmt.done()); + assertTrue (retData.size() == 0); + assertTrue (!stmt.done()); std::size_t rows = stmt.execute(); - assert (50 == rows); - assert (!stmt.done()); - assert (retData.size() == 50); + assertTrue (50 == rows); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 50); rows = stmt.execute(); - assert (50 == rows); - assert (stmt.done()); - assert (retData.size() == 100); + assertTrue (50 == rows); + assertTrue (stmt.done()); + assertTrue (retData.size() == 100); rows = stmt.execute(); // will restart execution! - assert (50 == rows); - assert (!stmt.done()); - assert (retData.size() == 150); + assertTrue (50 == rows); + assertTrue (!stmt.done()); + assertTrue (retData.size() == 150); for (int x = 0; x < 150; ++x) { - assert(data[x%100] == retData[x]); + assertTrue (data[x%100] == retData[x]); } } @@ -887,7 +887,7 @@ void SQLiteTest::testPrepare() // stmt should not have been executed when destroyed int count = 100; tmp << "SELECT COUNT(*) FROM Strings", into(count), now; - assert (count == 0); + assertTrue (count == 0); } @@ -914,17 +914,17 @@ void SQLiteTest::testSetSimple() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastNames), use(firstNames), use(addresses), use(ages), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::set lastNamesR; std::set firstNamesR; std::set addressesR; std::set agesR; tmp << "SELECT * FROM PERSON", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; - assert (ages == agesR); - assert (lastNames == lastNamesR); - assert (firstNames == firstNamesR); - assert (addresses == addressesR); + assertTrue (ages == agesR); + assertTrue (lastNames == lastNamesR); + assertTrue (firstNames == firstNamesR); + assertTrue (addresses == addressesR); } @@ -939,11 +939,11 @@ void SQLiteTest::testSetComplex() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::set result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result == people); + assertTrue (result == people); } @@ -964,13 +964,13 @@ void SQLiteTest::testSetComplexUnique() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 5); + assertTrue (count == 5); std::set result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result.size() == 2); - assert (*result.begin() == p1); - assert (*++result.begin() == p2); + assertTrue (result.size() == 2); + assertTrue (*result.begin() == p1); + assertTrue (*++result.begin() == p2); } void SQLiteTest::testMultiSetSimple() @@ -996,17 +996,17 @@ void SQLiteTest::testMultiSetSimple() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastNames), use(firstNames), use(addresses), use(ages), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::multiset lastNamesR; std::multiset firstNamesR; std::multiset addressesR; std::multiset agesR; tmp << "SELECT * FROM PERSON", into(lastNamesR), into(firstNamesR), into(addressesR), into(agesR), now; - assert (ages.size() == agesR.size()); - assert (lastNames.size() == lastNamesR.size()); - assert (firstNames.size() == firstNamesR.size()); - assert (addresses.size() == addressesR.size()); + assertTrue (ages.size() == agesR.size()); + assertTrue (lastNames.size() == lastNamesR.size()); + assertTrue (firstNames.size() == firstNamesR.size()); + assertTrue (addresses.size() == addressesR.size()); } @@ -1027,11 +1027,11 @@ void SQLiteTest::testMultiSetComplex() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 5); + assertTrue (count == 5); std::multiset result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result.size() == people.size()); + assertTrue (result.size() == people.size()); } @@ -1048,11 +1048,11 @@ void SQLiteTest::testMapComplex() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::map result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result == people); + assertTrue (result == people); } @@ -1072,11 +1072,11 @@ void SQLiteTest::testMapComplexUnique() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 5); + assertTrue (count == 5); std::map result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result.size() == 2); + assertTrue (result.size() == 2); } @@ -1096,11 +1096,11 @@ void SQLiteTest::testMultiMapComplex() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 5); + assertTrue (count == 5); std::multimap result; tmp << "SELECT * FROM PERSON", into(result), now; - assert (result.size() == people.size()); + assertTrue (result.size() == people.size()); } @@ -1117,10 +1117,10 @@ void SQLiteTest::testSelectIntoSingle() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; tmp << "SELECT * FROM PERSON", into(result), limit(1), now; // will return 1 object into one single result - assert (result == p1); + assertTrue (result == p1); } @@ -1137,15 +1137,15 @@ void SQLiteTest::testSelectIntoSingleStep() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; Statement stmt = (tmp << "SELECT * FROM PERSON", into(result), limit(1)); stmt.execute(); - assert (result == p1); - assert (!stmt.done()); + assertTrue (result == p1); + assertTrue (!stmt.done()); stmt.execute(); - assert (result == p2); - assert (stmt.done()); + assertTrue (result == p2); + assertTrue (stmt.done()); } @@ -1162,7 +1162,7 @@ void SQLiteTest::testSelectIntoSingleFail() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), limit(2, true), now; - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1188,7 +1188,7 @@ void SQLiteTest::testLowerLimitOk() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1214,15 +1214,15 @@ void SQLiteTest::testSingleSelect() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; Statement stmt = (tmp << "SELECT * FROM PERSON", into(result), limit(1)); stmt.execute(); - assert (result == p1); - assert (!stmt.done()); + assertTrue (result == p1); + assertTrue (!stmt.done()); stmt.execute(); - assert (result == p2); - assert (stmt.done()); + assertTrue (result == p2); + assertTrue (stmt.done()); } @@ -1239,7 +1239,7 @@ void SQLiteTest::testLowerLimitFail() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1267,16 +1267,16 @@ void SQLiteTest::testCombinedLimits() std::string a, b, c; Statement stmt = (tmp << "SELECT LastName, FirstName, Address FROM Person WHERE Address = 'invalid value'", into(a), into(b), into(c), limit(1)); - assert (!stmt.done() && stmt.execute() == 0); + assertTrue (!stmt.done() && stmt.execute() == 0); int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::vector result; tmp << "SELECT * FROM PERSON", into(result), lowerLimit(2), upperLimit(2), now; // will return 2 objects - assert (result.size() == 2); - assert (result[0] == p1); - assert (result[1] == p2); + assertTrue (result.size() == 2); + assertTrue (result[0] == p1); + assertTrue (result[1] == p2); } @@ -1294,12 +1294,12 @@ void SQLiteTest::testRange() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); std::vector result; tmp << "SELECT * FROM PERSON", into(result), range(2, 2), now; // will return 2 objects - assert (result.size() == 2); - assert (result[0] == p1); - assert (result[1] == p2); + assertTrue (result.size() == 2); + assertTrue (result[0] == p1); + assertTrue (result[1] == p2); } @@ -1316,7 +1316,7 @@ void SQLiteTest::testCombinedIllegalLimits() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1343,7 +1343,7 @@ void SQLiteTest::testIllegalRange() tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(people), now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 2); + assertTrue (count == 2); Person result; try { @@ -1364,12 +1364,12 @@ void SQLiteTest::testEmptyDB() tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; int count = 0; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 0); + assertTrue (count == 0); Person result; Statement stmt = (tmp << "SELECT * FROM PERSON", into(result), limit(1)); stmt.execute(); - assert (result.getFirstName().empty()); - assert (stmt.done()); + assertTrue (result.getFirstName().empty()); + assertTrue (stmt.done()); } @@ -1385,12 +1385,12 @@ void SQLiteTest::testCLOB() int count = 0; tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :img)", use(lastName), use(firstName), use(address), use(img), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); CLOB res; - poco_assert (res.size() == 0); + poco_assertTrue (res.size() == 0); tmp << "SELECT Image FROM Person WHERE LastName == :ln", bind("lastname"), into(res), now; - poco_assert (res == img); + poco_assertTrue (res == img); tmp << "DROP TABLE IF EXISTS BlobTest", now; std::vector resVec; @@ -1409,10 +1409,10 @@ void SQLiteTest::testCLOB() tmp << "INSERT INTO BlobTest VALUES(?, ?)", use(i), use(img), now; } tmp << "SELECT Image FROM BlobTest", into(resVec), now; - poco_assert(resVec.size() == arrSize); + poco_assertTrue (resVec.size() == arrSize); for (int i = 0; i < arrSize; ++i) { - poco_assert(*resVec[i].begin() == (char) (0x30 + i)); + poco_assertTrue (*resVec[i].begin() == (char) (0x30 + i)); } } @@ -1430,9 +1430,9 @@ void SQLiteTest::testTuple10() tmp << "INSERT INTO Tuples VALUES (?,?,?,?,?,?,?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13,-14,-15,-16,-17,-18,-19); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1456,12 +1456,12 @@ void SQLiteTest::testTupleVector10() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1478,9 +1478,9 @@ void SQLiteTest::testTuple9() tmp << "INSERT INTO Tuples VALUES (?,?,?,?,?,?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13,-14,-15,-16,-17,-18); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1504,12 +1504,12 @@ void SQLiteTest::testTupleVector9() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1526,9 +1526,9 @@ void SQLiteTest::testTuple8() tmp << "INSERT INTO Tuples VALUES (?,?,?,?,?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13,-14,-15,-16,-17); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1552,12 +1552,12 @@ void SQLiteTest::testTupleVector8() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1573,9 +1573,9 @@ void SQLiteTest::testTuple7() tmp << "INSERT INTO Tuples VALUES (?,?,?,?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13,-14,-15,-16); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1598,12 +1598,12 @@ void SQLiteTest::testTupleVector7() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1619,9 +1619,9 @@ void SQLiteTest::testTuple6() tmp << "INSERT INTO Tuples VALUES (?,?,?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13,-14,-15); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1644,12 +1644,12 @@ void SQLiteTest::testTupleVector6() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1665,9 +1665,9 @@ void SQLiteTest::testTuple5() tmp << "INSERT INTO Tuples VALUES (?,?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13,-14); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1690,12 +1690,12 @@ void SQLiteTest::testTupleVector5() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1711,9 +1711,9 @@ void SQLiteTest::testTuple4() tmp << "INSERT INTO Tuples VALUES (?,?,?,?)", use(t), now; Tuple ret(-10,-11,-12,-13); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1736,12 +1736,12 @@ void SQLiteTest::testTupleVector4() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1757,9 +1757,9 @@ void SQLiteTest::testTuple3() tmp << "INSERT INTO Tuples VALUES (?,?,?)", use(t), now; Tuple ret(-10,-11,-12); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1782,12 +1782,12 @@ void SQLiteTest::testTupleVector3() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1802,9 +1802,9 @@ void SQLiteTest::testTuple2() tmp << "INSERT INTO Tuples VALUES (?,?)", use(t), now; Tuple ret(-10,-11); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1826,12 +1826,12 @@ void SQLiteTest::testTupleVector2() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1846,9 +1846,9 @@ void SQLiteTest::testTuple1() tmp << "INSERT INTO Tuples VALUES (?)", use(t), now; Tuple ret(-10); - assert (ret != t); + assertTrue (ret != t); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == t); + assertTrue (ret == t); } @@ -1870,12 +1870,12 @@ void SQLiteTest::testTupleVector1() int count = 0; tmp << "SELECT COUNT(*) FROM Tuples", into(count), now; - assert (v.size() == count); + assertTrue (v.size() == count); std::vector > ret; - assert (ret != v); + assertTrue (ret != v); tmp << "SELECT * FROM Tuples", into(ret), now; - assert (ret == v); + assertTrue (ret == v); } @@ -1889,9 +1889,9 @@ void SQLiteTest::testDateTime() tmp << "INSERT INTO DateTimes VALUES (?)", use(dt), now; DateTime rdt; - assert (rdt != dt); + assertTrue (rdt != dt); tmp << "SELECT * FROM DateTimes", into(rdt), now; - assert (rdt == dt); + assertTrue (rdt == dt); tmp << "DELETE FROM DateTimes", now; @@ -1899,9 +1899,9 @@ void SQLiteTest::testDateTime() tmp << "INSERT INTO DateTimes VALUES (?)", use(d), now; Date rd; - assert (rd != d); + assertTrue (rd != d); tmp << "SELECT * FROM DateTimes", into(rd), now; - assert (rd == d); + assertTrue (rd == d); tmp << "DELETE FROM DateTimes", now; @@ -1909,9 +1909,9 @@ void SQLiteTest::testDateTime() tmp << "INSERT INTO DateTimes VALUES (?)", use(t), now; Time rt; - assert (rt != t); + assertTrue (rt != t); tmp << "SELECT * FROM DateTimes", into(rt), now; - assert (rt == t); + assertTrue (rt == t); } @@ -1931,47 +1931,47 @@ void SQLiteTest::testInternalExtraction() Statement stmt = (tmp << "SELECT * FROM Vectors", now); RecordSet rset(stmt); - assert (3 == rset.columnCount()); - assert (4 == rset.rowCount()); + assertTrue (3 == rset.columnCount()); + assertTrue (4 == rset.rowCount()); RecordSet rset2(rset); - assert (3 == rset2.columnCount()); - assert (4 == rset2.rowCount()); + assertTrue (3 == rset2.columnCount()); + assertTrue (4 == rset2.rowCount()); Int32 a = rset.value(0,2); - assert (3 == a); + assertTrue (3 == a); int c = rset2.value(0); - assert (1 == c); + assertTrue (1 == c); Int32 b = rset2.value("InT0",2); - assert (3 == b); + assertTrue (3 == b); double d = rset.value(1,0); - assert (1.5 == d); + assertTrue (1.5 == d); std::string s = rset.value(2,1); - assert ("4" == s); + assertTrue ("4" == s); typedef std::deque IntDeq; const Column& col = rset.column(0); - assert (col[0] == 1); + assertTrue (col[0] == 1); try { rset.column(100); fail ("must fail"); } catch (RangeException&) { } const Column& col1 = rset.column(0); - assert ("int0" == col1.name()); + assertTrue ("int0" == col1.name()); Column::Iterator it = col1.begin(); Column::Iterator itEnd = col1.end(); int counter = 1; for (; it != itEnd; ++it, ++counter) - assert (counter == *it); + assertTrue (counter == *it); rset = (tmp << "SELECT COUNT(*) FROM Vectors", now); s = rset.value(0,0); - assert ("4" == s); + assertTrue ("4" == s); stmt = (tmp << "DELETE FROM Vectors", now); rset = stmt; @@ -2025,42 +2025,42 @@ void SQLiteTest::testNullable() Nullable s = std::string("abc"); Nullable d = DateTime(); - assert (!i.isNull()); - assert (!f.isNull()); - assert (!s.isNull()); - assert (!d.isNull()); + assertTrue (!i.isNull()); + assertTrue (!f.isNull()); + assertTrue (!s.isNull()); + assertTrue (!d.isNull()); ses << "SELECT i, r, s, d FROM NullableTest", into(i), into(f), into(s), into(d), now; - assert (i.isNull()); - assert (f.isNull()); - assert (s.isNull()); - assert (d.isNull()); + assertTrue (i.isNull()); + assertTrue (f.isNull()); + assertTrue (s.isNull()); + assertTrue (d.isNull()); RecordSet rs(ses, "SELECT * FROM NullableTest"); rs.moveFirst(); - assert (rs.isNull("i")); - assert (rs.isNull("r")); - assert (rs.isNull("s")); - assert (rs.isNull("d")); + assertTrue (rs.isNull("i")); + assertTrue (rs.isNull("r")); + assertTrue (rs.isNull("s")); + assertTrue (rs.isNull("d")); Var di = 1; Var df = 1.5; Var ds = "abc"; Var dd = DateTime(); - assert (!di.isEmpty()); - assert (!df.isEmpty()); - assert (!ds.isEmpty()); - assert (!dd.isEmpty()); + assertTrue (!di.isEmpty()); + assertTrue (!df.isEmpty()); + assertTrue (!ds.isEmpty()); + assertTrue (!dd.isEmpty()); ses << "SELECT i, r, s, d FROM NullableTest", into(di), into(df), into(ds), into(dd), now; - assert (di.isEmpty()); - assert (df.isEmpty()); - assert (ds.isEmpty()); - assert (dd.isEmpty()); + assertTrue (di.isEmpty()); + assertTrue (df.isEmpty()); + assertTrue (ds.isEmpty()); + assertTrue (dd.isEmpty()); } @@ -2084,17 +2084,17 @@ void SQLiteTest::testNulls() RecordSet rs(ses, "SELECT i, r, v, null as e FROM NullTest"); rs.moveFirst(); - assert (rs.isNull("i")); - assert (rs["i"].isEmpty()); - assert (rs.isNull("r")); - assert (rs.isNull("v")); - assert (rs["v"].isEmpty()); - assert (rs["e"].isEmpty()); + assertTrue (rs.isNull("i")); + assertTrue (rs["i"].isEmpty()); + assertTrue (rs.isNull("r")); + assertTrue (rs.isNull("v")); + assertTrue (rs["v"].isEmpty()); + assertTrue (rs["e"].isEmpty()); - assert (rs[0].isEmpty()); - assert (rs[1].isEmpty()); - assert (rs[2].isEmpty()); - assert (rs[3].isEmpty()); + assertTrue (rs[0].isEmpty()); + assertTrue (rs[1].isEmpty()); + assertTrue (rs[2].isEmpty()); + assertTrue (rs[3].isEmpty()); ses << "DROP TABLE IF EXISTS NullTest", now; ses << "CREATE TABLE NullTest (i INTEGER, r REAL, v VARCHAR)", now; @@ -2105,11 +2105,11 @@ void SQLiteTest::testNulls() ses << "INSERT INTO NullTest (i, r, v) VALUES (:i, :r, :v)", use(i), use(f), use(s), now; rs = (ses << "SELECT * FROM NullTest", now); rs.moveFirst(); - assert (!rs.isNull("i")); - assert (rs["i"] == 1); - assert (!rs.isNull("v")); - assert (!rs.isNull("r")); - assert (rs["v"] == "123"); + assertTrue (!rs.isNull("i")); + assertTrue (rs["i"] == 1); + assertTrue (!rs.isNull("v")); + assertTrue (!rs.isNull("r")); + assertTrue (rs["v"] == "123"); ses << "UPDATE NullTest SET v = :n WHERE i == :i", use(null), use(i), now; i = 2; @@ -2117,26 +2117,26 @@ void SQLiteTest::testNulls() ses << "INSERT INTO NullTest (i, r, v) VALUES (:i, :r, :v)", use(i), use(null), use(null), now; rs = (ses << "SELECT i, r, v FROM NullTest ORDER BY i ASC", now); rs.moveFirst(); - assert (!rs.isNull("i")); - assert (rs["i"] == 1); - assert (!rs.isNull("r")); - assert (rs.isNull("v")); - assert (rs["v"].isEmpty()); + assertTrue (!rs.isNull("i")); + assertTrue (rs["i"] == 1); + assertTrue (!rs.isNull("r")); + assertTrue (rs.isNull("v")); + assertTrue (rs["v"].isEmpty()); - assert (rs.moveNext()); - assert (!rs.isNull("i")); - assert (rs["i"] == 2); + assertTrue (rs.moveNext()); + assertTrue (!rs.isNull("i")); + assertTrue (rs["i"] == 2); Poco::Int64 i64 = 0; - assert (rs.nvl("i", i64) == 2); - assert (rs.nvl("i", 123) == 2); + assertTrue (rs.nvl("i", i64) == 2); + assertTrue (rs.nvl("i", 123) == 2); - assert (rs.isNull("r")); - assert (rs.nvl("r", 123) == 123); - assert (rs.nvl("r", 1.5) == 1.5); + assertTrue (rs.isNull("r")); + assertTrue (rs.nvl("r", 123) == 123); + assertTrue (rs.nvl("r", 1.5) == 1.5); - assert (rs.isNull("v")); - assert (rs["v"].isEmpty()); - assert (rs.nvl("v", s) == "123"); + assertTrue (rs.isNull("v")); + assertTrue (rs["v"].isEmpty()); + assertTrue (rs.nvl("v", s) == "123"); } @@ -2161,14 +2161,14 @@ void SQLiteTest::testRowIterator() RecordSet::ConstIterator end = rset.end(); for (int i = 1; it != end; ++it, ++i) { - assert (it->get(0) == i); + assertTrue (it->get(0) == i); osLoop << *it; } - assert (!osLoop.str().empty()); + assertTrue (!osLoop.str().empty()); std::ostringstream osCopy; std::copy(rset.begin(), rset.end(), std::ostream_iterator(osCopy)); - assert (osLoop.str() == osCopy.str()); + assertTrue (osLoop.str() == osCopy.str()); } @@ -2182,13 +2182,13 @@ void SQLiteTest::testAsync() std::vector data(rowCount); Statement stmt = (tmp << "INSERT INTO Strings VALUES(:str)", use(data)); Statement::Result result = stmt.executeAsync(); - assert (!stmt.isAsync()); + assertTrue (!stmt.isAsync()); result.wait(); - assert (500 == result.data()); + assertTrue (500 == result.data()); Statement stmt1 = (tmp << "SELECT * FROM Strings", into(data), async, now); - assert (stmt1.isAsync()); - assert (stmt1.wait() == rowCount); + assertTrue (stmt1.isAsync()); + assertTrue (stmt1.wait() == rowCount); stmt1.execute(); try @@ -2204,11 +2204,11 @@ void SQLiteTest::testAsync() } stmt = tmp << "SELECT * FROM Strings", into(data), async, now; - assert (stmt.isAsync()); + assertTrue (stmt.isAsync()); stmt.wait(); - assert (stmt.execute() == 0); - assert (stmt.isAsync()); + assertTrue (stmt.execute() == 0); + assertTrue (stmt.isAsync()); try { result = stmt.executeAsync(); @@ -2220,43 +2220,43 @@ void SQLiteTest::testAsync() result = stmt.executeAsync(); } - assert (stmt.wait() == rowCount); - assert (result.data() == rowCount); + assertTrue (stmt.wait() == rowCount); + assertTrue (result.data() == rowCount); stmt.setAsync(false); - assert (!stmt.isAsync()); - assert (stmt.execute() == rowCount); + assertTrue (!stmt.isAsync()); + assertTrue (stmt.execute() == rowCount); stmt = tmp << "SELECT * FROM Strings", into(data), sync, now; - assert (!stmt.isAsync()); - assert (stmt.wait() == 0); - assert (stmt.execute() == rowCount); + assertTrue (!stmt.isAsync()); + assertTrue (stmt.wait() == 0); + assertTrue (stmt.execute() == rowCount); result = stmt.executeAsync(); - assert (!stmt.isAsync()); + assertTrue (!stmt.isAsync()); result.wait(); - assert (result.data() == rowCount); + assertTrue (result.data() == rowCount); - assert (0 == rowCount % 10); + assertTrue (0 == rowCount % 10); int step = (int) (rowCount/10); data.clear(); Statement stmt2 = (tmp << "SELECT * FROM Strings", into(data), async, limit(step)); - assert (data.size() == 0); - assert (!stmt2.done()); + assertTrue (data.size() == 0); + assertTrue (!stmt2.done()); std::size_t rows = 0; for (int i = 0; !stmt2.done(); i += step) { stmt2.execute(); rows = stmt2.wait(); - assert (step == rows); - assert (step + i == data.size()); + assertTrue (step == rows); + assertTrue (step + i == data.size()); } - assert (stmt2.done()); - assert (rowCount == data.size()); + assertTrue (stmt2.done()); + assertTrue (rowCount == data.size()); stmt2 = tmp << "SELECT * FROM Strings", reset; - assert (!stmt2.isAsync()); - assert ("deque" == stmt2.getStorage()); - assert (stmt2.execute() == rowCount); + assertTrue (!stmt2.isAsync()); + assertTrue ("deque" == stmt2.getStorage()); + assertTrue (stmt2.execute() == rowCount); } @@ -2274,15 +2274,15 @@ void SQLiteTest::testAny() int count = 0; tmp << "SELECT COUNT(*) FROM Anys", into(count), now; - assert (1 == count); + assertTrue (1 == count); i = 0; f = 0.0; s = std::string(""); tmp << "SELECT * FROM Anys", into(i), into(f), into(s), now; - assert (AnyCast(i) == 42); - assert (AnyCast(f) == 42.5); - assert (AnyCast(s) == "42"); + assertTrue (AnyCast(i) == 42); + assertTrue (AnyCast(f) == 42.5); + assertTrue (AnyCast(s) == "42"); } @@ -2296,31 +2296,31 @@ void SQLiteTest::testDynamicAny() DynamicAny f = double(42.5); DynamicAny s = std::string("42"); DynamicAny e; - assert (e.isEmpty()); + assertTrue (e.isEmpty()); tmp << "INSERT INTO Anys VALUES (?, ?, ?, null)", use(i), use(f), use(s), now; int count = 0; tmp << "SELECT COUNT(*) FROM Anys", into(count), now; - assert (1 == count); + assertTrue (1 == count); i = 0; f = 0.0; s = std::string(""); e = 1; - assert (!e.isEmpty()); + assertTrue (!e.isEmpty()); tmp << "SELECT * FROM Anys", into(i), into(f), into(s), into(e), now; - assert (42 == i); - assert (42.5 == f); - assert ("42" == s); - assert (e.isEmpty()); + assertTrue (42 == i); + assertTrue (42.5 == f); + assertTrue ("42" == s); + assertTrue (e.isEmpty()); } void SQLiteTest::testPair() { Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.isConnected()); + assertTrue (tmp.isConnected()); std::string tableName("Simpsons"); std::pair junior = std::make_pair("Junior", 12); std::pair senior = std::make_pair("Senior", 99); @@ -2331,21 +2331,21 @@ void SQLiteTest::testPair() tmp << "DROP TABLE IF EXISTS Simpsons", now; tmp << "CREATE TABLE IF NOT EXISTS Simpsons (LastName VARCHAR(30), Age INTEGER(3))", now; tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now; - assert (result == tableName); + assertTrue (result == tableName); // these are fine tmp << "INSERT INTO Simpsons VALUES(?, ?)", use(junior), now; tmp << "INSERT INTO Simpsons VALUES(?, ?)", useRef(senior), now; tmp << "SELECT COUNT(*) FROM Simpsons", into(count), now; - assert (2 == count); + assertTrue (2 == count); std::vector > ret; tmp << "SELECT * FROM Simpsons", into(ret), range(2,2), now; - assert (ret[0].second == 12 || ret[1].second == 12); - assert (ret[0].second == 99 || ret[1].second == 99); - assert (ret[0].first == "Junior" || ret[1].first == "Junior"); - assert (ret[0].first == "Senior" || ret[1].first == "Senior"); + assertTrue (ret[0].second == 12 || ret[1].second == 12); + assertTrue (ret[0].second == 99 || ret[1].second == 99); + assertTrue (ret[0].first == "Junior" || ret[1].first == "Junior"); + assertTrue (ret[0].first == "Senior" || ret[1].first == "Senior"); } @@ -2388,18 +2388,18 @@ void SQLiteTest::testSQLChannel() pChannel->log(msgWarnS); RecordSet rs(tmp, "SELECT * FROM T_POCO_LOG ORDER by Text"); - assert (4 == rs.rowCount()); - assert ("InformationSource" == rs["Source"]); - assert ("a Informational async message" == rs["Text"]); + assertTrue (4 == rs.rowCount()); + assertTrue ("InformationSource" == rs["Source"]); + assertTrue ("a Informational async message" == rs["Text"]); rs.moveNext(); - assert ("WarningSource" == rs["Source"]); - assert ("b Warning async message" == rs["Text"]); + assertTrue ("WarningSource" == rs["Source"]); + assertTrue ("b Warning async message" == rs["Text"]); rs.moveNext(); - assert ("InformationSource" == rs["Source"]); - assert ("c Informational sync message" == rs["Text"]); + assertTrue ("InformationSource" == rs["Source"]); + assertTrue ("c Informational sync message" == rs["Text"]); rs.moveNext(); - assert ("WarningSource" == rs["Source"]); - assert ("d Warning sync message" == rs["Text"]); + assertTrue ("WarningSource" == rs["Source"]); + assertTrue ("d Warning sync message" == rs["Text"]); Thread::sleep(3000); @@ -2409,17 +2409,17 @@ void SQLiteTest::testSQLChannel() pChannel->log(msgWarnA); RecordSet rs1(tmp, "SELECT * FROM T_POCO_LOG_ARCHIVE"); - assert (4 == rs1.rowCount()); + assertTrue (4 == rs1.rowCount()); pChannel->setProperty("keep", ""); - assert ("forever" == pChannel->getProperty("keep")); + assertTrue ("forever" == pChannel->getProperty("keep")); RecordSet rs2(tmp, "SELECT * FROM T_POCO_LOG ORDER by Text"); - assert (2 == rs2.rowCount()); - assert ("InformationSource" == rs2["Source"]); - assert ("e Informational sync message" == rs2["Text"]); + assertTrue (2 == rs2.rowCount()); + assertTrue ("InformationSource" == rs2["Source"]); + assertTrue ("e Informational sync message" == rs2["Text"]); rs2.moveNext(); - assert ("WarningSource" == rs2["Source"]); - assert ("f Warning sync message" == rs2["Text"]); + assertTrue ("WarningSource" == rs2["Source"]); + assertTrue ("f Warning sync message" == rs2["Text"]); } @@ -2449,12 +2449,12 @@ void SQLiteTest::testSQLLogger() Thread::sleep(100); RecordSet rs(tmp, "SELECT * FROM T_POCO_LOG ORDER by DateTime"); - assert (2 == rs.rowCount()); - assert ("TestSQLChannel" == rs["Source"]); - assert ("Informational message" == rs["Text"]); + assertTrue (2 == rs.rowCount()); + assertTrue ("TestSQLChannel" == rs["Source"]); + assertTrue ("Informational message" == rs["Text"]); rs.moveNext(); - assert ("TestSQLChannel" == rs["Source"]); - assert ("Warning message" == rs["Text"]); + assertTrue ("TestSQLChannel" == rs["Source"]); + assertTrue ("Warning message" == rs["Text"]); } @@ -2481,16 +2481,16 @@ void SQLiteTest::testExternalBindingAndExtraction() extraction.push_back(into(b)); extraction.push_back(into(c)); tmp << "SELECT * FROM Ints", into(extraction), now; - assert (a == x); - assert (b == y); - assert (c == z); + assertTrue (a == x); + assertTrue (b == y); + assertTrue (c == z); a = 0, b = 0, c = 0; extractionVec.push_back(extraction); tmp << "SELECT * FROM Ints", into(extractionVec), now; - assert (a == x); - assert (b == y); - assert (c == z); + assertTrue (a == x); + assertTrue (b == y); + assertTrue (c == z); } @@ -2510,7 +2510,7 @@ void SQLiteTest::testBindingCount() try { tmp << "SELECT int0 from Ints where int0 = ?", into(i), now; fail("must fail"); } catch (ParameterCountMismatchException&) { } tmp << "SELECT int0 from Ints where int0 = ?", bind(42), into(i), now; - assert (42 == i); + assertTrue (42 == i); tmp << "DROP TABLE IF EXISTS Ints", now; tmp << "CREATE TABLE Ints (int0 INTEGER, int1 INTEGER, int2 INTEGER)", now; @@ -2553,12 +2553,12 @@ void SQLiteTest::testMultipleResults() , into(aBart, pos1) , into(people2, from(pos2)), use(aLisa), use(aHomer); - assert (7 == stmt.execute()); - assert (Person("Simpson", "Homer", "Springfield", 42) == pHomer); - assert (12 == aBart); - assert (2 == people2.size()); - assert (Person("Simpson", "Lisa", "Springfield", 10) == people2[0]); - assert (Person("Simpson", "Homer", "Springfield", 42) == people2[1]); + assertTrue (7 == stmt.execute()); + assertTrue (Person("Simpson", "Homer", "Springfield", 42) == pHomer); + assertTrue (12 == aBart); + assertTrue (2 == people2.size()); + assertTrue (Person("Simpson", "Lisa", "Springfield", 10) == people2[0]); + assertTrue (Person("Simpson", "Homer", "Springfield", 42) == people2[1]); } @@ -2583,24 +2583,24 @@ void SQLiteTest::testReconnect() count = 0; session << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); + assertTrue (count == 1); - assert (session.isConnected()); + assertTrue (session.isConnected()); session.close(); - assert (!session.isConnected()); + assertTrue (!session.isConnected()); try { session << "SELECT LastName FROM PERSON", into(result), now; fail ("must fail"); } catch(NotConnectedException&){ } - assert (!session.isConnected()); + assertTrue (!session.isConnected()); session.open(); - assert (session.isConnected()); + assertTrue (session.isConnected()); session << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); - assert (session.isConnected()); + assertTrue (count == age); + assertTrue (session.isConnected()); } @@ -2609,8 +2609,8 @@ void SQLiteTest::testThreadModes() using namespace Poco::Data::SQLite; typedef std::vector ModeVec; - assert (Utility::isThreadSafe()); - assert (Utility::getThreadMode() == Utility::THREAD_MODE_SERIAL); + assertTrue (Utility::isThreadSafe()); + assertTrue (Utility::getThreadMode() == Utility::THREAD_MODE_SERIAL); const int datasize = 100; ModeVec mode; @@ -2624,7 +2624,7 @@ void SQLiteTest::testThreadModes() for (; it != end; ++it) { sw.restart(); - assert (Utility::setThreadMode(*it)); + assertTrue (Utility::setThreadMode(*it)); { Session tmp (Connector::KEY, "dummy.db"); std::vector iv(datasize); @@ -2634,13 +2634,13 @@ void SQLiteTest::testThreadModes() tmp << "CREATE TABLE IF NOT EXISTS Ints (theInt INTEGER)", now; Statement stmt((tmp << "INSERT INTO Ints VALUES(?)", use(iv))); tmp << "SELECT COUNT(*) FROM Ints", into(count), now; - assert (count == 0); + assertTrue (count == 0); stmt.execute(); tmp << "SELECT COUNT(*) FROM Ints", into(count), now; - assert (count == datasize); + assertTrue (count == datasize); count = 0; tmp << "SELECT COUNT(*) FROM Ints", into(count), now; - assert (count == datasize); + assertTrue (count == datasize); } sw.stop(); std::cout << "Mode: " << ((*it == Utility::THREAD_MODE_SINGLE) ? "single," @@ -2649,9 +2649,9 @@ void SQLiteTest::testThreadModes() : "unknown,") << " Time: " << sw.elapsed() / 1000.0 << " [ms]" << std::endl; } - assert (Utility::setThreadMode(Utility::THREAD_MODE_SERIAL)); - assert (Utility::isThreadSafe()); - assert (Utility::getThreadMode() == Utility::THREAD_MODE_SERIAL); + assertTrue (Utility::setThreadMode(Utility::THREAD_MODE_SERIAL)); + assertTrue (Utility::isThreadSafe()); + assertTrue (Utility::getThreadMode() == Utility::THREAD_MODE_SERIAL); } @@ -2661,22 +2661,22 @@ void SQLiteTest::sqliteUpdateCallbackFn(void* pVal, int opCode, const char* pDB, Poco::Int64* pV = reinterpret_cast(pVal); if (opCode == Utility::OPERATION_INSERT) { - poco_assert (*pV == 2); - poco_assert (row == 1); + poco_assertTrue (*pV == 2); + poco_assertTrue (row == 1); std::cout << "Inserted " << pDB << '.' << pTable << ", RowID=" << row << std::endl; ++_insertCounter; } else if (opCode == Utility::OPERATION_UPDATE) { - poco_assert (*pV == 3); - poco_assert (row == 1); + poco_assertTrue (*pV == 3); + poco_assertTrue (row == 1); std::cout << "Updated " << pDB << '.' << pTable << ", RowID=" << row << std::endl; ++_updateCounter; } else if (opCode == Utility::OPERATION_DELETE) { - poco_assert (*pV == 4); - poco_assert (row == 1); + poco_assertTrue (*pV == 4); + poco_assertTrue (row == 1); std::cout << "Deleted " << pDB << '.' << pTable << ", RowID=" << row << std::endl; ++_deleteCounter; } @@ -2691,9 +2691,9 @@ void SQLiteTest::testUpdateCallback() _deleteCounter = 0; Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.isConnected()); + assertTrue (tmp.isConnected()); Poco::Int64 val = 1; - assert (Utility::registerUpdateHandler(tmp, &sqliteUpdateCallbackFn, &val)); + assertTrue (Utility::registerUpdateHandler(tmp, &sqliteUpdateCallbackFn, &val)); std::string tableName("Person"); std::string lastName("lastname"); @@ -2705,40 +2705,40 @@ void SQLiteTest::testUpdateCallback() tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now; - assert (result == tableName); + assertTrue (result == tableName); // insert val = 2; tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); - assert (_insertCounter == 1); + assertTrue (count == 1); + assertTrue (_insertCounter == 1); tmp << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); tmp << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); + assertTrue (count == age); // update val = 3; tmp << "UPDATE PERSON SET Age = -1", now; tmp << "SELECT Age FROM PERSON", into(age), now; - assert (-1 == age); - assert (_updateCounter == 1); + assertTrue (-1 == age); + assertTrue (_updateCounter == 1); // delete val =4; tmp << "DELETE FROM Person WHERE Age = -1", now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 0); - assert (_deleteCounter == 1); + assertTrue (count == 0); + assertTrue (_deleteCounter == 1); // disarm callback and do the same drill - assert (Utility::registerUpdateHandler(tmp, (Utility::UpdateCallbackType) 0, &val)); + assertTrue (Utility::registerUpdateHandler(tmp, (Utility::UpdateCallbackType) 0, &val)); tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now; - assert (result == tableName); + assertTrue (result == tableName); // must remain zero now _insertCounter = 0; @@ -2748,27 +2748,27 @@ void SQLiteTest::testUpdateCallback() // insert tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 1); - assert (_insertCounter == 0); + assertTrue (count == 1); + assertTrue (_insertCounter == 0); tmp << "SELECT LastName FROM PERSON", into(result), now; - assert (lastName == result); + assertTrue (lastName == result); tmp << "SELECT Age FROM PERSON", into(count), now; - assert (count == age); + assertTrue (count == age); // update tmp << "UPDATE PERSON SET Age = -1", now; tmp << "SELECT Age FROM PERSON", into(age), now; - assert (-1 == age); - assert (_updateCounter == 0); + assertTrue (-1 == age); + assertTrue (_updateCounter == 0); // delete tmp << "DELETE FROM Person WHERE Age = -1", now; tmp << "SELECT COUNT(*) FROM PERSON", into(count), now; - assert (count == 0); - assert (_deleteCounter == 0); + assertTrue (count == 0); + assertTrue (_deleteCounter == 0); tmp.close(); - assert (!tmp.isConnected()); + assertTrue (!tmp.isConnected()); } @@ -2776,7 +2776,7 @@ int SQLiteTest::sqliteCommitCallbackFn(void* pVal) { poco_check_ptr(pVal); Poco::Int64* pV = reinterpret_cast(pVal); - poco_assert ((*pV) == 1); + poco_assertTrue ((*pV) == 1); ++(*pV); return 0; } @@ -2785,9 +2785,9 @@ int SQLiteTest::sqliteCommitCallbackFn(void* pVal) void SQLiteTest::testCommitCallback() { Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.isConnected()); + assertTrue (tmp.isConnected()); Poco::Int64 val = 1; - assert (Utility::registerUpdateHandler(tmp, &sqliteCommitCallbackFn, &val)); + assertTrue (Utility::registerUpdateHandler(tmp, &sqliteCommitCallbackFn, &val)); std::string tableName("Person"); std::string lastName("lastname"); @@ -2800,16 +2800,16 @@ void SQLiteTest::testCommitCallback() tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp.commit(); - assert (val == 2); + assertTrue (val == 2); - assert (Utility::registerUpdateHandler(tmp, (Utility::CommitCallbackType) 0, &val)); + assertTrue (Utility::registerUpdateHandler(tmp, (Utility::CommitCallbackType) 0, &val)); val = 0; tmp.begin(); tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp.commit(); - assert (val == 0); + assertTrue (val == 0); } @@ -2818,7 +2818,7 @@ void SQLiteTest::sqliteRollbackCallbackFn(void* pVal) { poco_check_ptr(pVal); Poco::Int64* pV = reinterpret_cast(pVal); - poco_assert ((*pV) == 1); + poco_assertTrue ((*pV) == 1); ++(*pV); } @@ -2826,9 +2826,9 @@ void SQLiteTest::sqliteRollbackCallbackFn(void* pVal) void SQLiteTest::testRollbackCallback() { Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (tmp.isConnected()); + assertTrue (tmp.isConnected()); Poco::Int64 val = 1; - assert (Utility::registerUpdateHandler(tmp, &sqliteRollbackCallbackFn, &val)); + assertTrue (Utility::registerUpdateHandler(tmp, &sqliteRollbackCallbackFn, &val)); std::string tableName("Person"); std::string lastName("lastname"); @@ -2841,23 +2841,23 @@ void SQLiteTest::testRollbackCallback() tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp.rollback(); - assert (val == 2); + assertTrue (val == 2); - assert (Utility::registerUpdateHandler(tmp, (Utility::RollbackCallbackType) 0, &val)); + assertTrue (Utility::registerUpdateHandler(tmp, (Utility::RollbackCallbackType) 0, &val)); val = 0; tmp.begin(); tmp << "DROP TABLE IF EXISTS Person", now; tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now; tmp.rollback(); - assert (val == 0); + assertTrue (val == 0); } void SQLiteTest::testNotifier() { Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (session.isConnected()); + assertTrue (session.isConnected()); session << "DROP TABLE IF EXISTS Person", now; session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; @@ -2871,31 +2871,31 @@ void SQLiteTest::testNotifier() _deleteCounter = 0; session << "INSERT INTO PERSON VALUES('Simpson', 'Bart', 'Springfield', 12)", now; - assert (_insertCounter == 1); - assert (notifier.getRow() == 1); + assertTrue (_insertCounter == 1); + assertTrue (notifier.getRow() == 1); session << "INSERT INTO PERSON VALUES('Simpson', 'Lisa', 'Springfield', 10)", now; - assert (_insertCounter == 2); - assert (notifier.getRow() == 2); + assertTrue (_insertCounter == 2); + assertTrue (notifier.getRow() == 2); session << "INSERT INTO PERSON VALUES('Simpson', 'Homer', 'Springfield', 42)", now; - assert (_insertCounter == 3); - assert (notifier.getRow() == 3); + assertTrue (_insertCounter == 3); + assertTrue (notifier.getRow() == 3); session << "UPDATE PERSON SET Age = 11 WHERE FirstName = 'Bart'", now; - assert (_updateCounter == 1); - assert (notifier.getRow() == 1); + assertTrue (_updateCounter == 1); + assertTrue (notifier.getRow() == 1); session << "UPDATE PERSON SET Age = 9 WHERE FirstName = 'Lisa'", now; - assert (_updateCounter == 2); - assert (notifier.getRow() == 2); + assertTrue (_updateCounter == 2); + assertTrue (notifier.getRow() == 2); session << "UPDATE PERSON SET Age = 41 WHERE FirstName = 'Homer'", now; - assert (_updateCounter == 3); - assert (notifier.getRow() == 3); + assertTrue (_updateCounter == 3); + assertTrue (notifier.getRow() == 3); notifier.setRow(0); // SQLite optimizes DELETE so here we must have // the WHERE clause to trigger per-row notifications session << "DELETE FROM PERSON WHERE 1=1", now; - assert (_deleteCounter == 3); - assert (notifier.getRow() == 3); + assertTrue (_deleteCounter == 3); + assertTrue (notifier.getRow() == 3); notifier.insert -= delegate(this, &SQLiteTest::onInsert); notifier.update -= delegate(this, &SQLiteTest::onUpdate); @@ -2911,8 +2911,8 @@ void SQLiteTest::testNotifier() session << "INSERT INTO PERSON VALUES('Simpson', 'Lisa', 'Springfield', 10)", now; session << "INSERT INTO PERSON VALUES('Simpson', 'Homer', 'Springfield', 42)", now; session.commit(); - assert (_commitCounter == 1); - assert (notifier.getRow() == 0); + assertTrue (_commitCounter == 1); + assertTrue (notifier.getRow() == 0); notifier.commit -= delegate(this, &SQLiteTest::onCommit); session << "DELETE FROM PERSON", now; @@ -2925,8 +2925,8 @@ void SQLiteTest::testNotifier() session << "INSERT INTO PERSON VALUES('Simpson', 'Lisa', 'Springfield', 10)", now; session << "INSERT INTO PERSON VALUES('Simpson', 'Homer', 'Springfield', 42)", now; session.rollback(); - assert (_rollbackCounter == 1); - assert (notifier.getRow() == 0); + assertTrue (_rollbackCounter == 1); + assertTrue (notifier.getRow() == 0); notifier.rollback -= delegate(this, &SQLiteTest::onRollback); } @@ -2982,11 +2982,11 @@ void SQLiteTest::setTransactionIsolation(Session& session, Poco::UInt32 ti) Transaction t(session, false); t.setIsolation(ti); - assert (ti == t.getIsolation()); - assert (t.isIsolation(ti)); + assertTrue (ti == t.getIsolation()); + assertTrue (t.isIsolation(ti)); - assert (ti == session.getTransactionIsolation()); - assert (session.isTransactionIsolation(ti)); + assertTrue (ti == session.getTransactionIsolation()); + assertTrue (session.isTransactionIsolation(ti)); } catch(Poco::Exception& e){ std::cout << funct << ':' << e.displayText() << std::endl;} } @@ -3014,7 +3014,7 @@ void SQLiteTest::setTransactionIsolation(Session& session, Poco::UInt32 ti) void SQLiteTest::testSessionTransaction() { Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (session.isConnected()); + assertTrue (session.isConnected()); session << "DROP TABLE IF EXISTS Person", now; session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; @@ -3026,7 +3026,7 @@ void SQLiteTest::testSessionTransaction() } Session local (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (local.isConnected()); + assertTrue (local.isConnected()); try { @@ -3034,7 +3034,7 @@ void SQLiteTest::testSessionTransaction() fail ("Setting SQLite auto-commit explicitly must fail!"); } catch (NotImplementedException&) { } - assert (local.getFeature("autoCommit")); + assertTrue (local.getFeature("autoCommit")); std::string funct = "transaction()"; std::vector lastNames; @@ -3056,61 +3056,61 @@ void SQLiteTest::testSessionTransaction() setTransactionIsolation(session, Session::TRANSACTION_READ_COMMITTED); session.begin(); - assert (!session.getFeature("autoCommit")); - assert (session.isTransaction()); + assertTrue (!session.getFeature("autoCommit")); + assertTrue (session.isTransaction()); session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; - assert (session.isTransaction()); + assertTrue (session.isTransaction()); Statement stmt = (local << "SELECT COUNT(*) FROM Person", into(locCount), async, now); session << "SELECT COUNT(*) FROM Person", into(count), now; - assert (2 == count); - assert (session.isTransaction()); + assertTrue (2 == count); + assertTrue (session.isTransaction()); session.rollback(); - assert (!session.isTransaction()); - assert (session.getFeature("autoCommit")); + assertTrue (!session.isTransaction()); + assertTrue (session.getFeature("autoCommit")); stmt.wait(); - assert (0 == locCount); + assertTrue (0 == locCount); session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); - assert (!session.isTransaction()); + assertTrue (0 == count); + assertTrue (!session.isTransaction()); session.begin(); session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; - assert (session.isTransaction()); - assert (!session.getFeature("autoCommit")); + assertTrue (session.isTransaction()); + assertTrue (!session.getFeature("autoCommit")); Statement stmt1 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now); - assert (0 == locCount); + assertTrue (0 == locCount); session << "SELECT count(*) FROM Person", into(count), now; - assert (2 == count); + assertTrue (2 == count); session.commit(); - assert (!session.isTransaction()); - assert (session.getFeature("autoCommit")); + assertTrue (!session.isTransaction()); + assertTrue (session.getFeature("autoCommit")); session << "SELECT count(*) FROM Person", into(count), now; - assert (2 == count); + assertTrue (2 == count); /* TODO: see http://www.sqlite.org/pragma.html#pragma_read_uncommitted setTransactionIsolation(session, Session::TRANSACTION_READ_UNCOMMITTED); */ session.close(); - assert (!session.isConnected()); + assertTrue (!session.isConnected()); local.close(); - assert (!local.isConnected()); + assertTrue (!local.isConnected()); } void SQLiteTest::testTransaction() { Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (session.isConnected()); + assertTrue (session.isConnected()); session << "DROP TABLE IF EXISTS Person", now; session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; @@ -3146,25 +3146,25 @@ void SQLiteTest::testTransaction() { Transaction trans(session); - assert (trans.isActive()); - assert (session.isTransaction()); + assertTrue (trans.isActive()); + assertTrue (session.isTransaction()); session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now; - assert (session.isTransaction()); - assert (trans.isActive()); + assertTrue (session.isTransaction()); + assertTrue (trans.isActive()); session << "SELECT COUNT(*) FROM Person", into(count), now; - assert (2 == count); - assert (session.isTransaction()); - assert (trans.isActive()); + assertTrue (2 == count); + assertTrue (session.isTransaction()); + assertTrue (trans.isActive()); // no explicit commit, so transaction RAII must roll back here } - assert (!session.isTransaction()); + assertTrue (!session.isTransaction()); session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); - assert (!session.isTransaction()); + assertTrue (0 == count); + assertTrue (!session.isTransaction()); { Transaction trans(session); @@ -3172,18 +3172,18 @@ void SQLiteTest::testTransaction() Statement stmt1 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now); - assert (session.isTransaction()); - assert (trans.isActive()); + assertTrue (session.isTransaction()); + assertTrue (trans.isActive()); trans.commit(); - assert (!session.isTransaction()); - assert (!trans.isActive()); - assert (0 == locCount); + assertTrue (!session.isTransaction()); + assertTrue (!trans.isActive()); + assertTrue (0 == locCount); } session << "SELECT count(*) FROM Person", into(count), now; - assert (2 == count); + assertTrue (2 == count); local << "SELECT count(*) FROM Person", into(count), now; - assert (2 == count); + assertTrue (2 == count); session << "DELETE FROM Person", now; @@ -3197,32 +3197,32 @@ void SQLiteTest::testTransaction() trans.execute(sql1, false); session << "SELECT count(*) FROM Person", into(count), now; - assert (1 == count); + assertTrue (1 == count); trans.execute(sql2, false); session << "SELECT count(*) FROM Person", into(count), now; - assert (2 == count); + assertTrue (2 == count); Statement stmt2 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now); - assert (0 == locCount); + assertTrue (0 == locCount); trans.rollback(); session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); + assertTrue (0 == count); trans.execute(sql); Statement stmt3 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now); - assert (2 == locCount); + assertTrue (2 == locCount); session << "SELECT count(*) FROM Person", into(count), now; - assert (2 == count); + assertTrue (2 == count); session.close(); - assert (!session.isConnected()); + assertTrue (!session.isConnected()); local.close(); - assert (!local.isConnected()); + assertTrue (!local.isConnected()); } @@ -3248,7 +3248,7 @@ struct TestRollbackTransactor void SQLiteTest::testTransactor() { Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert (session.isConnected()); + assertTrue (session.isConnected()); session << "DROP TABLE IF EXISTS Person", now; session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now; @@ -3256,18 +3256,18 @@ void SQLiteTest::testTransactor() std::string funct = "transaction()"; int count = 0; - assert (session.getFeature("autoCommit")); + assertTrue (session.getFeature("autoCommit")); session.setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED); TestCommitTransactor ct; Transaction t1(session, ct); session << "SELECT count(*) FROM Person", into(count), now; - assert (1 == count); + assertTrue (1 == count); session << "DELETE FROM Person", now; session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); + assertTrue (0 == count); try { @@ -3277,7 +3277,7 @@ void SQLiteTest::testTransactor() } catch (Poco::Exception&) { } session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); + assertTrue (0 == count); try { @@ -3288,7 +3288,7 @@ void SQLiteTest::testTransactor() } catch (Poco::Exception&) { } session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); + assertTrue (0 == count); try { @@ -3299,7 +3299,7 @@ void SQLiteTest::testTransactor() } catch (Poco::Exception&) { } session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); + assertTrue (0 == count); try { @@ -3310,10 +3310,10 @@ void SQLiteTest::testTransactor() } catch (Poco::Exception&) { } session << "SELECT count(*) FROM Person", into(count), now; - assert (0 == count); + assertTrue (0 == count); session.close(); - assert (!session.isConnected()); + assertTrue (!session.isConnected()); } @@ -3321,7 +3321,7 @@ void SQLiteTest::testFTS3() { #ifdef SQLITE_ENABLE_FTS3 Session session(Poco::Data::SQLite::Connector::KEY, "dummy.db"); - assert(session.isConnected()); + assertTrue (session.isConnected()); session << "DROP TABLE IF EXISTS docs", now; session << "CREATE VIRTUAL TABLE docs USING fts3()", now; @@ -3332,30 +3332,30 @@ void SQLiteTest::testFTS3() int docid = 0; session << "SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database'", into(docid), now; - assert(docid == 3); + assertTrue (docid == 3); docid = 0; session << "SELECT docid FROM docs WHERE docs MATCH 'database sqlite'", into(docid), now; - assert(docid == 3); + assertTrue (docid == 3); std::vector docids; session << "SELECT docid FROM docs WHERE docs MATCH 'sqlite OR database' ORDER BY docid", into(docids), now; - assert(docids.size() == 3); - assert(docids[0] == 1); - assert(docids[1] == 2); - assert(docids[2] == 3); + assertTrue (docids.size() == 3); + assertTrue (docids[0] == 1); + assertTrue (docids[1] == 2); + assertTrue (docids[2] == 3); std::string content; docid = 0; session << "SELECT docid, content FROM docs WHERE docs MATCH 'database NOT sqlite'", into(docid), into(content), now; - assert(docid == 1); - assert(content == "a database is a software system"); + assertTrue (docid == 1); + assertTrue (content == "a database is a software system"); docid = 0; session << "SELECT count(*) FROM docs WHERE docs MATCH 'database and sqlite'", into(docid), now; - assert(docid == 0); + assertTrue (docid == 0); #else std::cout << "SQLite FTS not enabled, test not executed." << std::endl; #endif // SQLITE_ENABLE_FTS3 diff --git a/Data/testsuite/src/DataTest.cpp b/Data/testsuite/src/DataTest.cpp index b399919f3..d837538c1 100644 --- a/Data/testsuite/src/DataTest.cpp +++ b/Data/testsuite/src/DataTest.cpp @@ -88,19 +88,19 @@ DataTest::~DataTest() void DataTest::testSession() { Session sess(SessionFactory::instance().create("test", "cs")); - assert ("test" == sess.impl()->connectorName()); - assert (sess.connector() == sess.impl()->connectorName()); - assert ("cs" == sess.impl()->connectionString()); - assert ("test:///cs" == sess.uri()); + assertTrue ("test" == sess.impl()->connectorName()); + assertTrue (sess.connector() == sess.impl()->connectorName()); + assertTrue ("cs" == sess.impl()->connectionString()); + assertTrue ("test:///cs" == sess.uri()); - assert (sess.getLoginTimeout() == Session::LOGIN_TIMEOUT_DEFAULT); + assertTrue (sess.getLoginTimeout() == Session::LOGIN_TIMEOUT_DEFAULT); sess.setLoginTimeout(123); - assert (sess.getLoginTimeout() == 123); + assertTrue (sess.getLoginTimeout() == 123); Session sess2(SessionFactory::instance().create("TeSt:///Cs")); - assert ("test" == sess2.impl()->connectorName()); - assert ("Cs" == sess2.impl()->connectionString()); - assert ("test:///Cs" == sess2.uri()); + assertTrue ("test" == sess2.impl()->connectorName()); + assertTrue ("Cs" == sess2.impl()->connectionString()); + assertTrue ("test:///Cs" == sess2.uri()); sess << "DROP TABLE IF EXISTS Test", now; int count; @@ -111,8 +111,8 @@ void DataTest::testSession() stmt.execute(); sess.close(); - assert (!sess.getFeature("connected")); - assert (!sess.isConnected()); + assertTrue (!sess.getFeature("connected")); + assertTrue (!sess.isConnected()); try { @@ -127,15 +127,15 @@ void DataTest::testSession() } catch (NotConnectedException&) { } sess.open(); - assert (sess.getFeature("connected")); - assert (sess.isConnected()); + assertTrue (sess.getFeature("connected")); + assertTrue (sess.isConnected()); sess << "SELECT * FROM Strings", now; stmt.execute(); sess.reconnect(); - assert (sess.getFeature("connected")); - assert (sess.isConnected()); + assertTrue (sess.getFeature("connected")); + assertTrue (sess.isConnected()); sess << "SELECT * FROM Strings", now; stmt.execute(); @@ -149,7 +149,7 @@ void DataTest::testStatementFormatting() Statement stmt = (sess << "SELECT %s%c%s,%d,%u,%f,%s FROM Person WHERE Name LIKE 'Simp%%'", "'",'a',"'",-1, 1u, 1.5, "42", now); - assert ("SELECT 'a',-1,1,1.500000,42 FROM Person WHERE Name LIKE 'Simp%'" == stmt.toString()); + assertTrue ("SELECT 'a',-1,1,1.500000,42 FROM Person WHERE Name LIKE 'Simp%'" == stmt.toString()); } @@ -158,8 +158,8 @@ void DataTest::testFeatures() Session sess(SessionFactory::instance().create("test", "cs")); sess.setFeature("f1", true); - assert (sess.getFeature("f1")); - assert (sess.getFeature("f2")); + assertTrue (sess.getFeature("f1")); + assertTrue (sess.getFeature("f2")); try { @@ -170,7 +170,7 @@ void DataTest::testFeatures() } sess.setFeature("f3", false); - assert (!sess.getFeature("f2")); + assertTrue (!sess.getFeature("f2")); try { @@ -196,9 +196,9 @@ void DataTest::testProperties() sess.setProperty("p1", 1); Poco::Any v1 = sess.getProperty("p1"); - assert (Poco::AnyCast(v1) == 1); + assertTrue (Poco::AnyCast(v1) == 1); Poco::Any v2 = sess.getProperty("p2"); - assert (Poco::AnyCast(v2) == 1); + assertTrue (Poco::AnyCast(v2) == 1); try { @@ -210,7 +210,7 @@ void DataTest::testProperties() sess.setProperty("p3", 2); v1 = sess.getProperty("p2"); - assert (Poco::AnyCast(v1) == 2); + assertTrue (Poco::AnyCast(v1) == 2); try { @@ -245,17 +245,17 @@ void DataTest::testLOB() vec.push_back(9); Poco::Data::LOB lobNum1(&vec[0], vec.size()); - assert (lobNum1.size() == vec.size()); - assert (0 == std::memcmp(&vec[0], lobNum1.rawContent(), lobNum1.size() * sizeof(int))); - assert (*lobNum1.begin() == 0); + assertTrue (lobNum1.size() == vec.size()); + assertTrue (0 == std::memcmp(&vec[0], lobNum1.rawContent(), lobNum1.size() * sizeof(int))); + assertTrue (*lobNum1.begin() == 0); Poco::Data::LOB::Iterator it1 = lobNum1.end(); - assert (*(--it1) == 9); + assertTrue (*(--it1) == 9); Poco::Data::LOB lobNum2(lobNum1); - assert (lobNum2.size() == lobNum1.size()); - assert (lobNum2 == lobNum1); + assertTrue (lobNum2.size() == lobNum1.size()); + assertTrue (lobNum2 == lobNum1); lobNum1.swap(lobNum2); - assert (lobNum2 == lobNum1); + assertTrue (lobNum2 == lobNum1); } @@ -267,63 +267,63 @@ void DataTest::testCLOB() std::vector vecDigit(strDigit.begin(), strDigit.end()); CLOB blobNumStr(strDigit.c_str(), strDigit.size()); - assert (blobNumStr.size() == strDigit.size()); - assert (0 == std::strncmp(strDigit.c_str(), blobNumStr.rawContent(), blobNumStr.size())); - assert (*blobNumStr.begin() == '1'); + assertTrue (blobNumStr.size() == strDigit.size()); + assertTrue (0 == std::strncmp(strDigit.c_str(), blobNumStr.rawContent(), blobNumStr.size())); + assertTrue (*blobNumStr.begin() == '1'); CLOB::Iterator itNumStr = blobNumStr.end(); - assert (*(--itNumStr) == '0'); + assertTrue (*(--itNumStr) == '0'); CLOB blobNumVec(vecDigit); - assert (blobNumVec.size() == vecDigit.size()); - assert (blobNumVec == blobNumStr); + assertTrue (blobNumVec.size() == vecDigit.size()); + assertTrue (blobNumVec == blobNumStr); blobNumVec.swap(blobNumStr); - assert (blobNumVec.size() == blobNumStr.size()); - assert (blobNumVec == blobNumStr); + assertTrue (blobNumVec.size() == blobNumStr.size()); + assertTrue (blobNumVec == blobNumStr); CLOB blobChrStr(strAlpha.c_str(), strAlpha.size()); CLOB blobChrVec(vecAlpha); - assert (blobChrStr.size() == strAlpha.size()); - assert (0 == std::strncmp(strAlpha.c_str(), blobChrStr.rawContent(), blobChrStr.size())); - assert (*blobChrStr.begin() == 'a'); + assertTrue (blobChrStr.size() == strAlpha.size()); + assertTrue (0 == std::strncmp(strAlpha.c_str(), blobChrStr.rawContent(), blobChrStr.size())); + assertTrue (*blobChrStr.begin() == 'a'); CLOB::Iterator itChrStr = blobChrStr.end(); - assert (*(--itChrStr) == 'z'); - assert (blobChrStr == blobChrVec); + assertTrue (*(--itChrStr) == 'z'); + assertTrue (blobChrStr == blobChrVec); blobNumStr.swap(blobChrStr); - assert (blobNumStr != blobChrStr); - assert (&blobNumStr != &blobChrStr); - assert (blobNumStr.content() != blobChrStr.content()); - assert (&blobNumStr.content() != &blobChrStr.content()); - assert (blobNumStr == blobChrVec); + assertTrue (blobNumStr != blobChrStr); + assertTrue (&blobNumStr != &blobChrStr); + assertTrue (blobNumStr.content() != blobChrStr.content()); + assertTrue (&blobNumStr.content() != &blobChrStr.content()); + assertTrue (blobNumStr == blobChrVec); Poco::Data::swap(blobNumStr, blobChrVec); - assert (blobNumStr == blobChrVec); + assertTrue (blobNumStr == blobChrVec); std::swap(blobNumStr, blobChrVec); - assert (blobNumStr == blobChrVec); + assertTrue (blobNumStr == blobChrVec); - assert (blobChrStr != blobNumStr); + assertTrue (blobChrStr != blobNumStr); Var vLOB = blobNumStr; std::string sss = vLOB.convert(); blobChrStr = CLOB(sss); - assert (blobChrStr == blobNumStr); + assertTrue (blobChrStr == blobNumStr); std::string xyz = "xyz"; vLOB = xyz; blobChrStr = sss = vLOB.convert(); - assert (0 == std::strncmp(xyz.c_str(), blobChrStr.rawContent(), blobChrStr.size())); + assertTrue (0 == std::strncmp(xyz.c_str(), blobChrStr.rawContent(), blobChrStr.size())); } void DataTest::testCLOBStreams() { CLOB blob; - assert (0 == blob.size()); + assertTrue (0 == blob.size()); CLOBOutputStream bos(blob); BinaryWriter bw(bos); - assert (0 == blob.size()); + assertTrue (0 == blob.size()); writeToCLOB(bw); - assert (blob.size() > 0); + assertTrue (blob.size() > 0); CLOBInputStream bis(blob); BinaryReader br(bis); @@ -377,90 +377,90 @@ void DataTest::readFromCLOB(BinaryReader& reader) { bool b = false; reader >> b; - assert (b); + assertTrue (b); reader >> b; - assert (!b); + assertTrue (!b); char c = ' '; reader >> c; - assert (c == 'a'); + assertTrue (c == 'a'); short shortv = 0; reader >> shortv; - assert (shortv == -100); + assertTrue (shortv == -100); unsigned short ushortv = 0; reader >> ushortv; - assert (ushortv == 50000); + assertTrue (ushortv == 50000); int intv = 0; reader >> intv; - assert (intv == -123456); + assertTrue (intv == -123456); unsigned uintv = 0; reader >> uintv; - assert (uintv == 123456); + assertTrue (uintv == 123456); long longv = 0; reader >> longv; - assert (longv == -1234567890); + assertTrue (longv == -1234567890); unsigned long ulongv = 0; reader >> ulongv; - assert (ulongv == 1234567890); + assertTrue (ulongv == 1234567890); Int64 int64v = 0; reader >> int64v; - assert (int64v == -1234567890); + assertTrue (int64v == -1234567890); UInt64 uint64v = 0; reader >> uint64v; - assert (uint64v == 1234567890); + assertTrue (uint64v == 1234567890); float floatv = 0.0; reader >> floatv; - assert (floatv == 1.5); + assertTrue (floatv == 1.5); double doublev = 0.0; reader >> doublev; - assert (doublev == -1.5); + assertTrue (doublev == -1.5); std::string str; reader >> str; - assert (str == "foo"); + assertTrue (str == "foo"); reader >> str; - assert (str == ""); + assertTrue (str == ""); reader >> str; - assert (str == "bar"); + assertTrue (str == "bar"); reader >> str; - assert (str == ""); + assertTrue (str == ""); UInt32 uint32v; reader.read7BitEncoded(uint32v); - assert (uint32v == 100); + assertTrue (uint32v == 100); reader.read7BitEncoded(uint32v); - assert (uint32v == 1000); + assertTrue (uint32v == 1000); reader.read7BitEncoded(uint32v); - assert (uint32v == 10000); + assertTrue (uint32v == 10000); reader.read7BitEncoded(uint32v); - assert (uint32v == 100000); + assertTrue (uint32v == 100000); reader.read7BitEncoded(uint32v); - assert (uint32v == 1000000); + assertTrue (uint32v == 1000000); reader.read7BitEncoded(uint64v); - assert (uint64v == 100); + assertTrue (uint64v == 100); reader.read7BitEncoded(uint64v); - assert (uint64v == 1000); + assertTrue (uint64v == 1000); reader.read7BitEncoded(uint64v); - assert (uint64v == 10000); + assertTrue (uint64v == 10000); reader.read7BitEncoded(uint64v); - assert (uint64v == 100000); + assertTrue (uint64v == 100000); reader.read7BitEncoded(uint64v); - assert (uint64v == 1000000); + assertTrue (uint64v == 1000000); reader.readRaw(3, str); - assert (str == "RAW"); + assertTrue (str == "RAW"); } @@ -468,12 +468,12 @@ void DataTest::testColumnVector() { MetaColumn mc(0, "mc", MetaColumn::FDT_DOUBLE, 2, 3, true); - assert (mc.name() == "mc"); - assert (mc.position() == 0); - assert (mc.length() == 2); - assert (mc.precision() == 3); - assert (mc.type() == MetaColumn::FDT_DOUBLE); - assert (mc.isNullable()); + assertTrue (mc.name() == "mc"); + assertTrue (mc.position() == 0); + assertTrue (mc.length() == 2); + assertTrue (mc.precision() == 3); + assertTrue (mc.type() == MetaColumn::FDT_DOUBLE); + assertTrue (mc.isNullable()); std::vector* pData = new std::vector; pData->push_back(1); @@ -484,17 +484,17 @@ void DataTest::testColumnVector() Column > c(mc, pData); - assert (c.rowCount() == 5); - assert (c[0] == 1); - assert (c[1] == 2); - assert (c[2] == 3); - assert (c[3] == 4); - assert (c[4] == 5); - assert (c.name() == "mc"); - assert (c.position() == 0); - assert (c.length() == 2); - assert (c.precision() == 3); - assert (c.type() == MetaColumn::FDT_DOUBLE); + assertTrue (c.rowCount() == 5); + assertTrue (c[0] == 1); + assertTrue (c[1] == 2); + assertTrue (c[2] == 3); + assertTrue (c[3] == 4); + assertTrue (c[4] == 5); + assertTrue (c.name() == "mc"); + assertTrue (c.position() == 0); + assertTrue (c.length() == 2); + assertTrue (c.precision() == 3); + assertTrue (c.type() == MetaColumn::FDT_DOUBLE); try { @@ -505,35 +505,35 @@ void DataTest::testColumnVector() Column > c1 = c; - assert (c1.rowCount() == 5); - assert (c1[0] == 1); - assert (c1[1] == 2); - assert (c1[2] == 3); - assert (c1[3] == 4); - assert (c1[4] == 5); + assertTrue (c1.rowCount() == 5); + assertTrue (c1[0] == 1); + assertTrue (c1[1] == 2); + assertTrue (c1[2] == 3); + assertTrue (c1[3] == 4); + assertTrue (c1[4] == 5); Column > c2(c1); - assert (c2.rowCount() == 5); - assert (c2[0] == 1); - assert (c2[1] == 2); - assert (c2[2] == 3); - assert (c2[3] == 4); - assert (c2[4] == 5); + assertTrue (c2.rowCount() == 5); + assertTrue (c2[0] == 1); + assertTrue (c2[1] == 2); + assertTrue (c2[2] == 3); + assertTrue (c2[3] == 4); + assertTrue (c2[4] == 5); std::vector vi; vi.assign(c.begin(), c.end()); - assert (vi.size() == 5); - assert (vi[0] == 1); - assert (vi[1] == 2); - assert (vi[2] == 3); - assert (vi[3] == 4); - assert (vi[4] == 5); + assertTrue (vi.size() == 5); + assertTrue (vi[0] == 1); + assertTrue (vi[1] == 2); + assertTrue (vi[2] == 3); + assertTrue (vi[3] == 4); + assertTrue (vi[4] == 5); c.reset(); - assert (c.rowCount() == 0); - assert (c1.rowCount() == 0); - assert (c2.rowCount() == 0); + assertTrue (c.rowCount() == 0); + assertTrue (c1.rowCount() == 0); + assertTrue (c2.rowCount() == 0); std::vector* pV1 = new std::vector; pV1->push_back(1); @@ -551,30 +551,30 @@ void DataTest::testColumnVector() Column > c4(mc, pV2); Poco::Data::swap(c3, c4); - assert (c3[0] == 5); - assert (c3[1] == 4); - assert (c3[2] == 3); - assert (c3[3] == 2); - assert (c3[4] == 1); + assertTrue (c3[0] == 5); + assertTrue (c3[1] == 4); + assertTrue (c3[2] == 3); + assertTrue (c3[3] == 2); + assertTrue (c3[4] == 1); - assert (c4[0] == 1); - assert (c4[1] == 2); - assert (c4[2] == 3); - assert (c4[3] == 4); - assert (c4[4] == 5); + assertTrue (c4[0] == 1); + assertTrue (c4[1] == 2); + assertTrue (c4[2] == 3); + assertTrue (c4[3] == 4); + assertTrue (c4[4] == 5); std::swap(c3, c4); - assert (c3[0] == 1); - assert (c3[1] == 2); - assert (c3[2] == 3); - assert (c3[3] == 4); - assert (c3[4] == 5); + assertTrue (c3[0] == 1); + assertTrue (c3[1] == 2); + assertTrue (c3[2] == 3); + assertTrue (c3[3] == 4); + assertTrue (c3[4] == 5); - assert (c4[0] == 5); - assert (c4[1] == 4); - assert (c4[2] == 3); - assert (c4[3] == 2); - assert (c4[4] == 1); + assertTrue (c4[0] == 5); + assertTrue (c4[1] == 4); + assertTrue (c4[2] == 3); + assertTrue (c4[3] == 2); + assertTrue (c4[4] == 1); } @@ -591,13 +591,13 @@ void DataTest::testColumnVectorBool() Column > c(mc, pData); - assert (c.rowCount() == 5); - assert (c[0] == true); - assert (c[1] == false); - assert (c[2] == true); - assert (c[3] == false); - assert (c[4] == true); - assert (c.type() == MetaColumn::FDT_BOOL); + assertTrue (c.rowCount() == 5); + assertTrue (c[0] == true); + assertTrue (c[1] == false); + assertTrue (c[2] == true); + assertTrue (c[3] == false); + assertTrue (c[4] == true); + assertTrue (c.type() == MetaColumn::FDT_BOOL); try { @@ -608,35 +608,35 @@ void DataTest::testColumnVectorBool() Column > c1 = c; - assert (c1.rowCount() == 5); - assert (c1[0] == true); - assert (c1[1] == false); - assert (c1[2] == true); - assert (c1[3] == false); - assert (c1[4] == true); + assertTrue (c1.rowCount() == 5); + assertTrue (c1[0] == true); + assertTrue (c1[1] == false); + assertTrue (c1[2] == true); + assertTrue (c1[3] == false); + assertTrue (c1[4] == true); Column > c2(c1); - assert (c2.rowCount() == 5); - assert (c2[0] == true); - assert (c2[1] == false); - assert (c2[2] == true); - assert (c2[3] == false); - assert (c2[4] == true); + assertTrue (c2.rowCount() == 5); + assertTrue (c2[0] == true); + assertTrue (c2[1] == false); + assertTrue (c2[2] == true); + assertTrue (c2[3] == false); + assertTrue (c2[4] == true); std::vector vi; vi.assign(c.begin(), c.end()); - assert (vi.size() == 5); - assert (vi[0] == true); - assert (vi[1] == false); - assert (vi[2] == true); - assert (vi[3] == false); - assert (vi[4] == true); + assertTrue (vi.size() == 5); + assertTrue (vi[0] == true); + assertTrue (vi[1] == false); + assertTrue (vi[2] == true); + assertTrue (vi[3] == false); + assertTrue (vi[4] == true); c.reset(); - assert (c.rowCount() == 0); - assert (c1.rowCount() == 0); - assert (c2.rowCount() == 0); + assertTrue (c.rowCount() == 0); + assertTrue (c1.rowCount() == 0); + assertTrue (c2.rowCount() == 0); } @@ -647,12 +647,12 @@ void DataTest::testColumnDeque() MetaColumn mc(0, "mc", MetaColumn::FDT_DOUBLE, 2, 3, true); - assert (mc.name() == "mc"); - assert (mc.position() == 0); - assert (mc.length() == 2); - assert (mc.precision() == 3); - assert (mc.type() == MetaColumn::FDT_DOUBLE); - assert (mc.isNullable()); + assertTrue (mc.name() == "mc"); + assertTrue (mc.position() == 0); + assertTrue (mc.length() == 2); + assertTrue (mc.precision() == 3); + assertTrue (mc.type() == MetaColumn::FDT_DOUBLE); + assertTrue (mc.isNullable()); ContainerType* pData = new ContainerType; pData->push_back(1); @@ -663,17 +663,17 @@ void DataTest::testColumnDeque() ColumnType c(mc, pData); - assert (c.rowCount() == 5); - assert (c[0] == 1); - assert (c[1] == 2); - assert (c[2] == 3); - assert (c[3] == 4); - assert (c[4] == 5); - assert (c.name() == "mc"); - assert (c.position() == 0); - assert (c.length() == 2); - assert (c.precision() == 3); - assert (c.type() == MetaColumn::FDT_DOUBLE); + assertTrue (c.rowCount() == 5); + assertTrue (c[0] == 1); + assertTrue (c[1] == 2); + assertTrue (c[2] == 3); + assertTrue (c[3] == 4); + assertTrue (c[4] == 5); + assertTrue (c.name() == "mc"); + assertTrue (c.position() == 0); + assertTrue (c.length() == 2); + assertTrue (c.precision() == 3); + assertTrue (c.type() == MetaColumn::FDT_DOUBLE); try { @@ -684,35 +684,35 @@ void DataTest::testColumnDeque() ColumnType c1 = c; - assert (c1.rowCount() == 5); - assert (c1[0] == 1); - assert (c1[1] == 2); - assert (c1[2] == 3); - assert (c1[3] == 4); - assert (c1[4] == 5); + assertTrue (c1.rowCount() == 5); + assertTrue (c1[0] == 1); + assertTrue (c1[1] == 2); + assertTrue (c1[2] == 3); + assertTrue (c1[3] == 4); + assertTrue (c1[4] == 5); ColumnType c2(c1); - assert (c2.rowCount() == 5); - assert (c2[0] == 1); - assert (c2[1] == 2); - assert (c2[2] == 3); - assert (c2[3] == 4); - assert (c2[4] == 5); + assertTrue (c2.rowCount() == 5); + assertTrue (c2[0] == 1); + assertTrue (c2[1] == 2); + assertTrue (c2[2] == 3); + assertTrue (c2[3] == 4); + assertTrue (c2[4] == 5); ContainerType vi; vi.assign(c.begin(), c.end()); - assert (vi.size() == 5); - assert (vi[0] == 1); - assert (vi[1] == 2); - assert (vi[2] == 3); - assert (vi[3] == 4); - assert (vi[4] == 5); + assertTrue (vi.size() == 5); + assertTrue (vi[0] == 1); + assertTrue (vi[1] == 2); + assertTrue (vi[2] == 3); + assertTrue (vi[3] == 4); + assertTrue (vi[4] == 5); c.reset(); - assert (c.rowCount() == 0); - assert (c1.rowCount() == 0); - assert (c2.rowCount() == 0); + assertTrue (c.rowCount() == 0); + assertTrue (c1.rowCount() == 0); + assertTrue (c2.rowCount() == 0); ContainerType* pV1 = new ContainerType; pV1->push_back(1); @@ -730,30 +730,30 @@ void DataTest::testColumnDeque() Column c4(mc, pV2); Poco::Data::swap(c3, c4); - assert (c3[0] == 5); - assert (c3[1] == 4); - assert (c3[2] == 3); - assert (c3[3] == 2); - assert (c3[4] == 1); + assertTrue (c3[0] == 5); + assertTrue (c3[1] == 4); + assertTrue (c3[2] == 3); + assertTrue (c3[3] == 2); + assertTrue (c3[4] == 1); - assert (c4[0] == 1); - assert (c4[1] == 2); - assert (c4[2] == 3); - assert (c4[3] == 4); - assert (c4[4] == 5); + assertTrue (c4[0] == 1); + assertTrue (c4[1] == 2); + assertTrue (c4[2] == 3); + assertTrue (c4[3] == 4); + assertTrue (c4[4] == 5); std::swap(c3, c4); - assert (c3[0] == 1); - assert (c3[1] == 2); - assert (c3[2] == 3); - assert (c3[3] == 4); - assert (c3[4] == 5); + assertTrue (c3[0] == 1); + assertTrue (c3[1] == 2); + assertTrue (c3[2] == 3); + assertTrue (c3[3] == 4); + assertTrue (c3[4] == 5); - assert (c4[0] == 5); - assert (c4[1] == 4); - assert (c4[2] == 3); - assert (c4[3] == 2); - assert (c4[4] == 1); + assertTrue (c4[0] == 5); + assertTrue (c4[1] == 4); + assertTrue (c4[2] == 3); + assertTrue (c4[3] == 2); + assertTrue (c4[4] == 1); } @@ -764,12 +764,12 @@ void DataTest::testColumnList() MetaColumn mc(0, "mc", MetaColumn::FDT_DOUBLE, 2, 3, true); - assert (mc.name() == "mc"); - assert (mc.position() == 0); - assert (mc.length() == 2); - assert (mc.precision() == 3); - assert (mc.type() == MetaColumn::FDT_DOUBLE); - assert (mc.isNullable()); + assertTrue (mc.name() == "mc"); + assertTrue (mc.position() == 0); + assertTrue (mc.length() == 2); + assertTrue (mc.precision() == 3); + assertTrue (mc.type() == MetaColumn::FDT_DOUBLE); + assertTrue (mc.isNullable()); ContainerType* pData = new ContainerType; pData->push_back(1); @@ -780,17 +780,17 @@ void DataTest::testColumnList() ColumnType c(mc, pData); - assert (c.rowCount() == 5); - assert (c[0] == 1); - assert (c[1] == 2); - assert (c[2] == 3); - assert (c[3] == 4); - assert (c[4] == 5); - assert (c.name() == "mc"); - assert (c.position() == 0); - assert (c.length() == 2); - assert (c.precision() == 3); - assert (c.type() == MetaColumn::FDT_DOUBLE); + assertTrue (c.rowCount() == 5); + assertTrue (c[0] == 1); + assertTrue (c[1] == 2); + assertTrue (c[2] == 3); + assertTrue (c[3] == 4); + assertTrue (c[4] == 5); + assertTrue (c.name() == "mc"); + assertTrue (c.position() == 0); + assertTrue (c.length() == 2); + assertTrue (c.precision() == 3); + assertTrue (c.type() == MetaColumn::FDT_DOUBLE); try { @@ -801,33 +801,33 @@ void DataTest::testColumnList() ColumnType c1 = c; - assert (c1.rowCount() == 5); - assert (c1[0] == 1); - assert (c1[1] == 2); - assert (c1[2] == 3); - assert (c1[3] == 4); - assert (c1[4] == 5); + assertTrue (c1.rowCount() == 5); + assertTrue (c1[0] == 1); + assertTrue (c1[1] == 2); + assertTrue (c1[2] == 3); + assertTrue (c1[3] == 4); + assertTrue (c1[4] == 5); ColumnType c2(c1); - assert (c2.rowCount() == 5); - assert (c2[0] == 1); - assert (c2[1] == 2); - assert (c2[2] == 3); - assert (c2[3] == 4); - assert (c2[4] == 5); + assertTrue (c2.rowCount() == 5); + assertTrue (c2[0] == 1); + assertTrue (c2[1] == 2); + assertTrue (c2[2] == 3); + assertTrue (c2[3] == 4); + assertTrue (c2[4] == 5); ContainerType vi; vi.assign(c.begin(), c.end()); - assert (vi.size() == 5); + assertTrue (vi.size() == 5); ContainerType::const_iterator it = vi.begin(); ContainerType::const_iterator end = vi.end(); for (int i = 1; it != end; ++it, ++i) - assert (*it == i); + assertTrue (*it == i); c.reset(); - assert (c.rowCount() == 0); - assert (c1.rowCount() == 0); - assert (c2.rowCount() == 0); + assertTrue (c.rowCount() == 0); + assertTrue (c1.rowCount() == 0); + assertTrue (c2.rowCount() == 0); ContainerType* pV1 = new ContainerType; pV1->push_back(1); @@ -845,30 +845,30 @@ void DataTest::testColumnList() Column c4(mc, pV2); Poco::Data::swap(c3, c4); - assert (c3[0] == 5); - assert (c3[1] == 4); - assert (c3[2] == 3); - assert (c3[3] == 2); - assert (c3[4] == 1); + assertTrue (c3[0] == 5); + assertTrue (c3[1] == 4); + assertTrue (c3[2] == 3); + assertTrue (c3[3] == 2); + assertTrue (c3[4] == 1); - assert (c4[0] == 1); - assert (c4[1] == 2); - assert (c4[2] == 3); - assert (c4[3] == 4); - assert (c4[4] == 5); + assertTrue (c4[0] == 1); + assertTrue (c4[1] == 2); + assertTrue (c4[2] == 3); + assertTrue (c4[3] == 4); + assertTrue (c4[4] == 5); std::swap(c3, c4); - assert (c3[0] == 1); - assert (c3[1] == 2); - assert (c3[2] == 3); - assert (c3[3] == 4); - assert (c3[4] == 5); + assertTrue (c3[0] == 1); + assertTrue (c3[1] == 2); + assertTrue (c3[2] == 3); + assertTrue (c3[3] == 4); + assertTrue (c3[4] == 5); - assert (c4[0] == 5); - assert (c4[1] == 4); - assert (c4[2] == 3); - assert (c4[3] == 2); - assert (c4[4] == 1); + assertTrue (c4[0] == 5); + assertTrue (c4[1] == 4); + assertTrue (c4[2] == 3); + assertTrue (c4[3] == 2); + assertTrue (c4[4] == 1); } @@ -881,23 +881,23 @@ void DataTest::testRow() row.append("field3", 3); row.append("field4", 4); - assert (row["field0"] == 0); - assert (row["field1"] == 1); - assert (row["field2"] == 2); - assert (row["field3"] == 3); - assert (row["field4"] == 4); + assertTrue (row["field0"] == 0); + assertTrue (row["field1"] == 1); + assertTrue (row["field2"] == 2); + assertTrue (row["field3"] == 3); + assertTrue (row["field4"] == 4); - assert (row["FIELD0"] == 0); - assert (row["FIELD1"] == 1); - assert (row["FIELD2"] == 2); - assert (row["FIELD3"] == 3); - assert (row["FIELD4"] == 4); + assertTrue (row["FIELD0"] == 0); + assertTrue (row["FIELD1"] == 1); + assertTrue (row["FIELD2"] == 2); + assertTrue (row["FIELD3"] == 3); + assertTrue (row["FIELD4"] == 4); - assert (row[0] == 0); - assert (row[1] == 1); - assert (row[2] == 2); - assert (row[3] == 3); - assert (row[4] == 4); + assertTrue (row[0] == 0); + assertTrue (row[1] == 1); + assertTrue (row[2] == 2); + assertTrue (row[3] == 3); + assertTrue (row[4] == 4); try { @@ -911,17 +911,17 @@ void DataTest::testRow() fail ("must fail"); }catch (NotFoundException&) {} - assert (5 == row.fieldCount()); - assert (row[0] == 0); - assert (row["field0"] == 0); - assert (row[1] == 1); - assert (row["field1"] == 1); - assert (row[2] == 2); - assert (row["field2"] == 2); - assert (row[3] == 3); - assert (row["field3"] == 3); - assert (row[4] == 4); - assert (row["field4"] == 4); + assertTrue (5 == row.fieldCount()); + assertTrue (row[0] == 0); + assertTrue (row["field0"] == 0); + assertTrue (row[1] == 1); + assertTrue (row["field1"] == 1); + assertTrue (row[2] == 2); + assertTrue (row["field2"] == 2); + assertTrue (row[3] == 3); + assertTrue (row["field3"] == 3); + assertTrue (row[4] == 4); + assertTrue (row["field4"] == 4); Row row2; @@ -931,7 +931,7 @@ void DataTest::testRow() row2.append("field3", 2); row2.append("field4", 1); - assert (row != row2); + assertTrue (row != row2); Row row3; @@ -941,8 +941,8 @@ void DataTest::testRow() row3.append("field3", 3); row3.append("field4", 4); - assert (row3 == row); - assert (!(row < row3 || row3 < row)); + assertTrue (row3 == row); + assertTrue (!(row < row3 || row3 < row)); Row row4(row3.names()); try @@ -956,15 +956,15 @@ void DataTest::testRow() row4.set("field2", 2); row4.set("field3", 3); row4.set("field4", 4); - assert (row3 == row4); + assertTrue (row3 == row4); try { row4.set(5, 0); fail ("must fail"); }catch (RangeException&) {} row4.set("field0", 1); - assert (row3 != row4); - assert (row3 < row4); + assertTrue (row3 != row4); + assertTrue (row3 < row4); } @@ -988,9 +988,9 @@ void DataTest::testRowSort() rowSet1.insert(row1); rowSet1.insert(row2); std::multiset::iterator it1 = rowSet1.begin(); - assert (row1 == *it1); + assertTrue (row1 == *it1); ++it1; - assert (row2 == *it1); + assertTrue (row2 == *it1); Row row3; row3.append("0", 1); @@ -1010,9 +1010,9 @@ void DataTest::testRowSort() rowSet2.insert(row4); rowSet2.insert(row3); std::set::iterator it2 = rowSet2.begin(); - assert (row4 == *it2); + assertTrue (row4 == *it2); ++it2; - assert (row3 == *it2); + assertTrue (row3 == *it2); Row row5; row5.append("0", 2); @@ -1051,11 +1051,11 @@ void DataTest::testRowSort() rowSet3.insert(row7); std::set::iterator it3 = rowSet3.begin(); - assert (row7 == *it3); + assertTrue (row7 == *it3); ++it3; - assert (row6 == *it3); + assertTrue (row6 == *it3); ++it3; - assert (row5 == *it3); + assertTrue (row5 == *it3); row5.replaceSortField("0", "2"); row6.replaceSortField("0", "2"); @@ -1067,11 +1067,11 @@ void DataTest::testRowSort() rowSet3.insert(row5); it3 = rowSet3.begin(); - assert (row5 == *it3); + assertTrue (row5 == *it3); ++it3; - assert (row6 == *it3); + assertTrue (row6 == *it3); ++it3; - assert (row7 == *it3); + assertTrue (row7 == *it3); row5.resetSort(); row6.resetSort(); @@ -1083,11 +1083,11 @@ void DataTest::testRowSort() rowSet3.insert(row7); it3 = rowSet3.begin(); - assert (row7 == *it3); + assertTrue (row7 == *it3); ++it3; - assert (row6 == *it3); + assertTrue (row6 == *it3); ++it3; - assert (row5 == *it3); + assertTrue (row5 == *it3); Row row8; row8.append("0", "2"); @@ -1146,9 +1146,9 @@ void DataTest::testRowSort() void DataTest::testRowStrictWeak(const Row& row1, const Row& row2, const Row& row3) { - assert (row1 < row2 && !(row2 < row1)); // antisymmetric - assert (row1 < row2 && row2 < row3 && row1 < row3); // transitive - assert (!(row1 < row1)); // irreflexive + assertTrue (row1 < row2 && !(row2 < row1)); // antisymmetric + assertTrue (row1 < row2 && row2 < row3 && row1 < row3); // transitive + assertTrue (!(row1 < row1)); // irreflexive } @@ -1179,7 +1179,7 @@ void DataTest::testRowFormat() << spacer << std::setw(sz) << "field4" << std::endl << line << std::endl; - assert (row1.namesToString() == os.str()); + assertTrue (row1.namesToString() == os.str()); os.str(""); os << std::right @@ -1192,7 +1192,7 @@ void DataTest::testRowFormat() << std::setw(sz) << "3" << spacer << std::setw(sz) << "4" << std::endl; - assert (row1.valuesToString() == os.str()); + assertTrue (row1.valuesToString() == os.str()); } @@ -1202,41 +1202,41 @@ void DataTest::testDateAndTime() Date d(dt); Time t(dt); - assert (dt.year() == d.year()); - assert (dt.month() == d.month()); - assert (dt.day() == d.day()); + assertTrue (dt.year() == d.year()); + assertTrue (dt.month() == d.month()); + assertTrue (dt.day() == d.day()); - assert (dt.hour() == t.hour()); - assert (dt.minute() == t.minute()); - assert (dt.second() == t.second()); + assertTrue (dt.hour() == t.hour()); + assertTrue (dt.minute() == t.minute()); + assertTrue (dt.second() == t.second()); Date d1(2007, 6, 15); d1.assign(d.year() - 1, d.month(), (d.month() == 2 && d.day() == 29) ? 28 : d.day()); - assert (d1 < d); assert (d1 != d); + assertTrue (d1 < d); assertTrue (d1 != d); d1.assign(d.year() - 1, 12, d.day()); - assert (d1 < d); assert (d1 != d); + assertTrue (d1 < d); assertTrue (d1 != d); if (d.day() > 1) { d1.assign(d.year(), d.month(), d.day() - 1); - assert (d1 < d); assert (d1 != d); + assertTrue (d1 < d); assertTrue (d1 != d); } d1.assign(d.year() + 1, d.month(), (d.month() == 2 && d.day() == 29) ? 28 : d.day()); - assert (d1 > d); assert (d1 != d); + assertTrue (d1 > d); assertTrue (d1 != d); d1.assign(d.year() + 1, 1, d.day()); - assert (d1 > d); assert (d1 != d); + assertTrue (d1 > d); assertTrue (d1 != d); if (d.day() < dt.daysOfMonth(dt.year(), dt.month())) { d1.assign(d.year(), d.month(), d.day() + 1); - assert (d1 > d); assert (d1 != d); + assertTrue (d1 > d); assertTrue (d1 != d); } d1.assign(d.year(), d.month(), d.day()); - assert (d1 == d); + assertTrue (d1 == d); try { d1.assign(-1, 1, 1); fail ("must fail"); } catch (InvalidArgumentException&) { } @@ -1250,41 +1250,41 @@ void DataTest::testDateAndTime() if (t.hour() > 1) { t1.assign(t.hour() - 1, t.minute(), t.second()); - assert (t1 < t); assert (t1 != t); + assertTrue (t1 < t); assertTrue (t1 != t); } if (t.minute() > 1) { t1.assign(t.hour(), t.minute() - 1, t.second()); - assert (t1 < t); assert (t1 != t); + assertTrue (t1 < t); assertTrue (t1 != t); } if (t.second() > 1) { t1.assign(t.hour(), t.minute(), t.second() - 1); - assert (t1 < t); assert (t1 != t); + assertTrue (t1 < t); assertTrue (t1 != t); } if (t.hour() < 23) { t1.assign(t.hour() + 1, t.minute(), t.second()); - assert (t1 > t); assert (t1 != t); + assertTrue (t1 > t); assertTrue (t1 != t); } if (t.minute() < 59) { t1.assign(t.hour(), t.minute() + 1, t.second()); - assert (t1 > t); assert (t1 != t); + assertTrue (t1 > t); assertTrue (t1 != t); } if (t.second() < 59) { t1.assign(t.hour(), t.minute(), t.second() + 1); - assert (t1 > t); assert (t1 != t); + assertTrue (t1 > t); assertTrue (t1 != t); } t1.assign(t.hour(), t.minute(), t.second()); - assert (t1 == t); + assertTrue (t1 == t); try { t1.assign(-1, 0, 0); fail ("must fail"); } catch (InvalidArgumentException&) { } @@ -1294,24 +1294,24 @@ void DataTest::testDateAndTime() catch (InvalidArgumentException&) { } d1 = dt; - assert (d1 == dt); + assertTrue (d1 == dt); t1 = dt; - assert (t1 == dt); + assertTrue (t1 == dt); d.assign(2007, 6, 15); d1.assign(2007, 6, 16); - assert (d != d1); + assertTrue (d != d1); Var vDate = d; d1 = vDate; - assert (d == d1); + assertTrue (d == d1); t.assign(12, 30, 15); t1.assign(12, 30, 16); - assert (t != t1); + assertTrue (t != t1); Var vTime = t; t1 = vTime; - assert (t == t1); + assertTrue (t == t1); } @@ -1322,39 +1322,39 @@ void DataTest::testExternalBindingAndExtraction() int i; AbstractExtraction::Ptr pExt1 = into(i); AbstractExtraction::Ptr pExt2 = into(i); - assert (1 == pExt1.referenceCount()); - assert (1 == pExt2.referenceCount()); + assertTrue (1 == pExt1.referenceCount()); + assertTrue (1 == pExt2.referenceCount()); { Statement stmt(tmp); stmt.addExtract(pExt1); - assert (2 == pExt1.referenceCount()); + assertTrue (2 == pExt1.referenceCount()); } - assert (1 == pExt1.referenceCount()); - assert (1 == pExt2.referenceCount()); + assertTrue (1 == pExt1.referenceCount()); + assertTrue (1 == pExt2.referenceCount()); AbstractBinding::Ptr pBind1 = use(i, "mybind1"); AbstractBinding::Ptr pBind2 = use(i, "mybind2"); AbstractBinding::Ptr pBind3 = use(i, "mybind3"); - assert (1 == pBind1.referenceCount()); - assert (1 == pBind2.referenceCount()); - assert (1 == pBind3.referenceCount()); + assertTrue (1 == pBind1.referenceCount()); + assertTrue (1 == pBind2.referenceCount()); + assertTrue (1 == pBind3.referenceCount()); { Statement stmt(tmp); stmt.addBind(pBind1); - assert (2 == pBind1.referenceCount()); + assertTrue (2 == pBind1.referenceCount()); stmt.removeBind(pBind1->name()); - assert (1 == pBind1.referenceCount()); + assertTrue (1 == pBind1.referenceCount()); stmt.addBind(pBind2); - assert (2 == pBind2.referenceCount()); + assertTrue (2 == pBind2.referenceCount()); stmt.addBind(pBind3); - assert (2 == pBind3.referenceCount()); + assertTrue (2 == pBind3.referenceCount()); try { stmt.removeBind("a bad name"); fail("must fail"); } catch (NotFoundException&) { } } - assert (1 == pBind1.referenceCount()); - assert (1 == pBind2.referenceCount()); - assert (1 == pBind3.referenceCount()); + assertTrue (1 == pBind1.referenceCount()); + assertTrue (1 == pBind2.referenceCount()); + assertTrue (1 == pBind3.referenceCount()); } diff --git a/Data/testsuite/src/SessionPoolTest.cpp b/Data/testsuite/src/SessionPoolTest.cpp index a20ed8049..e9ed87c04 100644 --- a/Data/testsuite/src/SessionPoolTest.cpp +++ b/Data/testsuite/src/SessionPoolTest.cpp @@ -49,25 +49,25 @@ void SessionPoolTest::testSessionPool() SessionPool pool("test", "cs", 1, 4, 2); pool.setFeature("f1", true); - assert (pool.getFeature("f1")); + assertTrue (pool.getFeature("f1")); try { pool.getFeature("g1"); fail ("must fail"); } catch ( Poco::NotFoundException& ) { } pool.setProperty("p1", 1); - assert (1 == Poco::AnyCast(pool.getProperty("p1"))); + assertTrue (1 == Poco::AnyCast(pool.getProperty("p1"))); try { pool.getProperty("r1"); fail ("must fail"); } catch ( Poco::NotFoundException& ) { } - assert (pool.capacity() == 4); - assert (pool.allocated() == 0); - assert (pool.idle() == 0); - assert (pool.available() == 4); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 0); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 4); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); Session s1(pool.get()); - assert (s1.getFeature("f1")); - assert (1 == Poco::AnyCast(s1.getProperty("p1"))); + assertTrue (s1.getFeature("f1")); + assertTrue (1 == Poco::AnyCast(s1.getProperty("p1"))); try { pool.setFeature("f1", true); fail ("must fail"); } catch ( Poco::InvalidAccessException& ) { } @@ -75,63 +75,63 @@ void SessionPoolTest::testSessionPool() try { pool.setProperty("p1", 1); fail ("must fail"); } catch ( Poco::InvalidAccessException& ) { } - assert (pool.capacity() == 4); - assert (pool.allocated() == 1); - assert (pool.idle() == 0); - assert (pool.available() == 3); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 1); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 3); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); Session s2(pool.get("f1", false)); - assert (!s2.getFeature("f1")); - assert (1 == Poco::AnyCast(s2.getProperty("p1"))); + assertTrue (!s2.getFeature("f1")); + assertTrue (1 == Poco::AnyCast(s2.getProperty("p1"))); - assert (pool.capacity() == 4); - assert (pool.allocated() == 2); - assert (pool.idle() == 0); - assert (pool.available() == 2); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 2); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 2); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); { Session s3(pool.get("p1", 2)); - assert (s3.getFeature("f1")); - assert (2 == Poco::AnyCast(s3.getProperty("p1"))); + assertTrue (s3.getFeature("f1")); + assertTrue (2 == Poco::AnyCast(s3.getProperty("p1"))); - assert (pool.capacity() == 4); - assert (pool.allocated() == 3); - assert (pool.idle() == 0); - assert (pool.available() == 1); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 3); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 1); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); } - assert (pool.capacity() == 4); - assert (pool.allocated() == 3); - assert (pool.idle() == 1); - assert (pool.available() == 2); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 3); + assertTrue (pool.idle() == 1); + assertTrue (pool.available() == 2); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); Session s4(pool.get()); - assert (s4.getFeature("f1")); - assert (1 == Poco::AnyCast(s4.getProperty("p1"))); + assertTrue (s4.getFeature("f1")); + assertTrue (1 == Poco::AnyCast(s4.getProperty("p1"))); - assert (pool.capacity() == 4); - assert (pool.allocated() == 3); - assert (pool.idle() == 0); - assert (pool.available() == 1); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 3); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 1); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); Session s5(pool.get()); - assert (pool.capacity() == 4); - assert (pool.allocated() == 4); - assert (pool.idle() == 0); - assert (pool.available() == 0); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 4); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 0); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); try { @@ -141,12 +141,12 @@ void SessionPoolTest::testSessionPool() catch (SessionPoolExhaustedException&) { } s5.close(); - assert (pool.capacity() == 4); - assert (pool.allocated() == 4); - assert (pool.idle() == 1); - assert (pool.available() == 1); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 4); + assertTrue (pool.idle() == 1); + assertTrue (pool.available() == 1); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); try { @@ -156,45 +156,45 @@ void SessionPoolTest::testSessionPool() catch (SessionUnavailableException&) { } s4.close(); - assert (pool.capacity() == 4); - assert (pool.allocated() == 4); - assert (pool.idle() == 2); - assert (pool.available() == 2); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 4); + assertTrue (pool.idle() == 2); + assertTrue (pool.available() == 2); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); Thread::sleep(5000); // time to clean up idle sessions - assert (pool.capacity() == 4); - assert (pool.allocated() == 2); - assert (pool.idle() == 0); - assert (pool.available() == 2); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 2); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 2); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); Session s6(pool.get()); - assert (pool.capacity() == 4); - assert (pool.allocated() == 3); - assert (pool.idle() == 0); - assert (pool.available() == 1); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 3); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 1); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); s6.setFeature("connected", false); - assert (pool.dead() == 1); + assertTrue (pool.dead() == 1); s6.close(); - assert (pool.capacity() == 4); - assert (pool.allocated() == 2); - assert (pool.idle() == 0); - assert (pool.available() == 2); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 2); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 2); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); - assert (pool.isActive()); + assertTrue (pool.isActive()); pool.shutdown(); - assert (!pool.isActive()); + assertTrue (!pool.isActive()); try { Session s7(pool.get()); @@ -202,12 +202,12 @@ void SessionPoolTest::testSessionPool() } catch (InvalidAccessException&) { } - assert (pool.capacity() == 4); - assert (pool.allocated() == 0); - assert (pool.idle() == 0); - assert (pool.available() == 0); - assert (pool.dead() == 0); - assert (pool.allocated() == pool.used() + pool.idle()); + assertTrue (pool.capacity() == 4); + assertTrue (pool.allocated() == 0); + assertTrue (pool.idle() == 0); + assertTrue (pool.available() == 0); + assertTrue (pool.dead() == 0); + assertTrue (pool.allocated() == pool.used() + pool.idle()); } @@ -216,36 +216,36 @@ void SessionPoolTest::testSessionPoolContainer() SessionPoolContainer spc; AutoPtr pPool = new SessionPool("TeSt", "Cs"); spc.add(pPool); - assert (pPool->isActive()); - assert (spc.isActive("test", "cs")); - assert (spc.isActive("test:///cs")); - assert (spc.has("test:///cs")); - assert (1 == spc.count()); + assertTrue (pPool->isActive()); + assertTrue (spc.isActive("test", "cs")); + assertTrue (spc.isActive("test:///cs")); + assertTrue (spc.has("test:///cs")); + assertTrue (1 == spc.count()); Poco::Data::Session sess = spc.get("test:///cs"); - assert ("test" == sess.impl()->connectorName()); - assert ("Cs" == sess.impl()->connectionString()); - assert ("test:///Cs" == sess.uri()); + assertTrue ("test" == sess.impl()->connectorName()); + assertTrue ("Cs" == sess.impl()->connectionString()); + assertTrue ("test:///Cs" == sess.uri()); try { spc.add(pPool); fail ("must fail"); } catch (SessionPoolExistsException&) { } pPool->shutdown(); - assert (!pPool->isActive()); - assert (!spc.isActive("test", "cs")); - assert (!spc.isActive("test:///cs")); + assertTrue (!pPool->isActive()); + assertTrue (!spc.isActive("test", "cs")); + assertTrue (!spc.isActive("test:///cs")); spc.remove(pPool->name()); - assert (!spc.has("test:///cs")); - assert (!spc.isActive("test", "cs")); - assert (!spc.isActive("test:///cs")); - assert (0 == spc.count()); + assertTrue (!spc.has("test:///cs")); + assertTrue (!spc.isActive("test", "cs")); + assertTrue (!spc.isActive("test:///cs")); + assertTrue (0 == spc.count()); try { spc.get("test"); fail ("must fail"); } catch (NotFoundException&) { } spc.add("tEsT", "cs"); spc.add("TeSt", "cs");//duplicate request, must be silently ignored - assert (1 == spc.count()); + assertTrue (1 == spc.count()); spc.remove("TesT:///cs"); - assert (0 == spc.count()); + assertTrue (0 == spc.count()); try { spc.get("test"); fail ("must fail"); } catch (NotFoundException&) { } } diff --git a/Encodings/testsuite/src/DoubleByteEncodingTest.cpp b/Encodings/testsuite/src/DoubleByteEncodingTest.cpp index d265b58c7..7234ffb20 100644 --- a/Encodings/testsuite/src/DoubleByteEncodingTest.cpp +++ b/Encodings/testsuite/src/DoubleByteEncodingTest.cpp @@ -29,18 +29,18 @@ void DoubleByteEncodingTest::testSingleByte() { Poco::ISO8859_4Encoding enc; - assert (std::string(enc.canonicalName()) == "ISO-8859-4"); - assert (enc.isA("Latin4")); + assertTrue (std::string(enc.canonicalName()) == "ISO-8859-4"); + assertTrue (enc.isA("Latin4")); unsigned char seq1[] = { 0xF8 }; // 0x00F8 LATIN SMALL LETTER O WITH STROKE - assert (enc.convert(seq1) == 0x00F8); - assert (enc.queryConvert(seq1, 1) == 0x00F8); - assert (enc.sequenceLength(seq1, 1) == 1); + assertTrue (enc.convert(seq1) == 0x00F8); + assertTrue (enc.queryConvert(seq1, 1) == 0x00F8); + assertTrue (enc.sequenceLength(seq1, 1) == 1); unsigned char seq2[] = { 0xF9 }; // 0x0173 LATIN SMALL LETTER U WITH OGONEK - assert (enc.convert(seq2) == 0x0173); - assert (enc.queryConvert(seq2, 1) == 0x0173); - assert (enc.sequenceLength(seq2, 1) == 1); + assertTrue (enc.convert(seq2) == 0x0173); + assertTrue (enc.queryConvert(seq2, 1) == 0x0173); + assertTrue (enc.sequenceLength(seq2, 1) == 1); } @@ -50,13 +50,13 @@ void DoubleByteEncodingTest::testSingleByteReverse() unsigned char seq[2]; - assert (enc.convert(0x00F8, seq, 2) == 1); - assert (seq[0] == 0xF8); + assertTrue (enc.convert(0x00F8, seq, 2) == 1); + assertTrue (seq[0] == 0xF8); - assert (enc.convert(0x0173, seq, 2) == 1); - assert (seq[0] == 0xF9); + assertTrue (enc.convert(0x0173, seq, 2) == 1); + assertTrue (seq[0] == 0xF9); - assert (enc.convert(0x3000, seq, 2) == 0); + assertTrue (enc.convert(0x3000, seq, 2) == 0); } @@ -64,26 +64,26 @@ void DoubleByteEncodingTest::testDoubleByte() { Poco::Windows950Encoding enc; - assert (std::string(enc.canonicalName()) == "windows-950"); - assert (enc.isA("Windows-950")); - assert (enc.isA("cp950")); + assertTrue (std::string(enc.canonicalName()) == "windows-950"); + assertTrue (enc.isA("Windows-950")); + assertTrue (enc.isA("cp950")); unsigned char seq1[] = { 0x41 }; // 0x0041 LATIN CAPITAL LETTER A - assert (enc.convert(seq1) == 0x0041); - assert (enc.queryConvert(seq1, 1) == 0x0041); - assert (enc.sequenceLength(seq1, 1) == 1); + assertTrue (enc.convert(seq1) == 0x0041); + assertTrue (enc.queryConvert(seq1, 1) == 0x0041); + assertTrue (enc.sequenceLength(seq1, 1) == 1); unsigned char seq2[] = { 0xA1, 0x40 }; // 0x3000 IDEOGRAPHIC SPACE - assert (enc.convert(seq2) == 0x3000); - assert (enc.queryConvert(seq2, 1) == -2); - assert (enc.queryConvert(seq2, 2) == 0x3000); - assert (enc.sequenceLength(seq2, 1) == 2); - assert (enc.sequenceLength(seq2, 2) == 2); + assertTrue (enc.convert(seq2) == 0x3000); + assertTrue (enc.queryConvert(seq2, 1) == -2); + assertTrue (enc.queryConvert(seq2, 2) == 0x3000); + assertTrue (enc.sequenceLength(seq2, 1) == 2); + assertTrue (enc.sequenceLength(seq2, 2) == 2); unsigned char seq3[] = { 0x92 }; // invalid - assert (enc.convert(seq3) == -1); - assert (enc.queryConvert(seq3, 1) == -1); - assert (enc.sequenceLength(seq3, 1) == -1); + assertTrue (enc.convert(seq3) == -1); + assertTrue (enc.queryConvert(seq3, 1) == -1); + assertTrue (enc.sequenceLength(seq3, 1) == -1); } @@ -93,14 +93,14 @@ void DoubleByteEncodingTest::testDoubleByteReverse() unsigned char seq[2]; - assert (enc.convert(0x0041, seq, 2) == 1); - assert (seq[0] == 0x41); + assertTrue (enc.convert(0x0041, seq, 2) == 1); + assertTrue (seq[0] == 0x41); - assert (enc.convert(0x3000, seq, 2) == 2); - assert (seq[0] == 0xA1); - assert (seq[1] == 0x40); + assertTrue (enc.convert(0x3000, seq, 2) == 2); + assertTrue (seq[0] == 0xA1); + assertTrue (seq[1] == 0x40); - assert (enc.convert(0x3004, seq, 2) == 0); + assertTrue (enc.convert(0x3004, seq, 2) == 0); } diff --git a/Foundation/Foundation_vs140.sln b/Foundation/Foundation_vs140.sln index e270ad521..f82a82b56 100644 --- a/Foundation/Foundation_vs140.sln +++ b/Foundation/Foundation_vs140.sln @@ -1,8 +1,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2015 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "Foundation_vs140.vcxproj", "{B01196CC-B693-4548-8464-2FF60499E73F}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs140.vcxproj", "{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs140.vcxproj", "{F1EE93DF-347F-4CB3-B191-C4E63F38E972}" ProjectSection(ProjectDependencies) = postProject {B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F} EndProjectSection @@ -10,49 +12,49 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug_shared|Win32 = debug_shared|Win32 - release_shared|Win32 = release_shared|Win32 - debug_static_mt|Win32 = debug_static_mt|Win32 - release_static_mt|Win32 = release_static_mt|Win32 debug_static_md|Win32 = debug_static_md|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_shared|Win32 = release_shared|Win32 release_static_md|Win32 = release_static_md|Win32 + release_static_mt|Win32 = release_static_mt|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|Win32.Build.0 = debug_shared|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.ActiveCfg = release_shared|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Build.0 = release_shared|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Deploy.0 = release_shared|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 - {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Build.0 = release_shared|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Deploy.0 = release_shared|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|Win32.Build.0 = release_static_md|Win32 {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|Win32.Build.0 = debug_shared|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.ActiveCfg = release_shared|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.Build.0 = release_shared|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.Deploy.0 = release_shared|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|Win32.Build.0 = release_static_md|Win32 - {C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_shared|Win32.Build.0 = release_shared|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {F1EE93DF-347F-4CB3-B191-C4E63F38E972}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Foundation/testsuite/src/ActiveDispatcherTest.cpp b/Foundation/testsuite/src/ActiveDispatcherTest.cpp index 818ae2570..35544fa70 100644 --- a/Foundation/testsuite/src/ActiveDispatcherTest.cpp +++ b/Foundation/testsuite/src/ActiveDispatcherTest.cpp @@ -102,12 +102,12 @@ void ActiveDispatcherTest::testWait() { ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); - assert (!result.available()); + assertTrue (!result.available()); activeObj.cont(); result.wait(); - assert (result.available()); - assert (result.data() == 123); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (result.data() == 123); + assertTrue (!result.failed()); } @@ -115,7 +115,7 @@ void ActiveDispatcherTest::testWaitInterval() { ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); - assert (!result.available()); + assertTrue (!result.available()); try { result.wait(100); @@ -126,9 +126,9 @@ void ActiveDispatcherTest::testWaitInterval() } activeObj.cont(); result.wait(10000); - assert (result.available()); - assert (result.data() == 123); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (result.data() == 123); + assertTrue (!result.failed()); } @@ -136,13 +136,13 @@ void ActiveDispatcherTest::testTryWait() { ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); - assert (!result.available()); - assert (!result.tryWait(200)); + assertTrue (!result.available()); + assertTrue (!result.tryWait(200)); activeObj.cont(); - assert (result.tryWait(10000)); - assert (result.available()); - assert (result.data() == 123); - assert (!result.failed()); + assertTrue (result.tryWait(10000)); + assertTrue (result.available()); + assertTrue (result.data() == 123); + assertTrue (!result.failed()); } @@ -151,10 +151,10 @@ void ActiveDispatcherTest::testFailure() ActiveObject activeObj; ActiveResult result = activeObj.testMethod(100); result.wait(); - assert (result.available()); - assert (result.failed()); + assertTrue (result.available()); + assertTrue (result.failed()); std::string msg = result.error(); - assert (msg == "n == 100"); + assertTrue (msg == "n == 100"); } @@ -162,11 +162,11 @@ void ActiveDispatcherTest::testVoid() { ActiveObject activeObj; ActiveResult result = activeObj.testVoid(123); - assert (!result.available()); + assertTrue (!result.available()); activeObj.cont(); result.wait(); - assert (result.available()); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (!result.failed()); } @@ -174,11 +174,11 @@ void ActiveDispatcherTest::testVoidInOut() { ActiveObject activeObj; ActiveResult result = activeObj.testVoidInOut(); - assert (!result.available()); + assertTrue (!result.available()); activeObj.cont(); result.wait(); - assert (result.available()); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (!result.failed()); } @@ -186,12 +186,12 @@ void ActiveDispatcherTest::testVoidIn() { ActiveObject activeObj; ActiveResult result = activeObj.testVoidIn(); - assert (!result.available()); + assertTrue (!result.available()); activeObj.cont(); result.wait(); - assert (result.available()); - assert (!result.failed()); - assert (result.data() == 123); + assertTrue (result.available()); + assertTrue (!result.failed()); + assertTrue (result.data() == 123); } diff --git a/Foundation/testsuite/src/ActiveMethodTest.cpp b/Foundation/testsuite/src/ActiveMethodTest.cpp index 0d186095d..8c70c0819 100644 --- a/Foundation/testsuite/src/ActiveMethodTest.cpp +++ b/Foundation/testsuite/src/ActiveMethodTest.cpp @@ -104,12 +104,12 @@ void ActiveMethodTest::testWait() { ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); - assert (!result.available()); + assertTrue (!result.available()); activeObj.cont(); result.wait(); - assert (result.available()); - assert (result.data() == 123); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (result.data() == 123); + assertTrue (!result.failed()); } @@ -119,37 +119,37 @@ void ActiveMethodTest::testCopy() ActiveObject::IntIntType ii = activeObj.testMethod; ActiveResult rii = ii(123); - assert (!rii.available()); + assertTrue (!rii.available()); activeObj.cont(); rii.wait(); - assert (rii.available()); - assert (rii.data() == 123); - assert (!rii.failed()); + assertTrue (rii.available()); + assertTrue (rii.data() == 123); + assertTrue (!rii.failed()); ActiveObject::VoidIntType vi = activeObj.testVoid; ActiveResult rvi = vi(123); - assert (!rvi.available()); + assertTrue (!rvi.available()); activeObj.cont(); rvi.wait(); - assert (rvi.available()); - assert (!rvi.failed()); + assertTrue (rvi.available()); + assertTrue (!rvi.failed()); ActiveObject::VoidVoidType vv = activeObj.testVoidInOut; ActiveResult rvv = vv(); - assert (!rvv.available()); + assertTrue (!rvv.available()); activeObj.cont(); rvv.wait(); - assert (rvv.available()); - assert (!rvv.failed()); + assertTrue (rvv.available()); + assertTrue (!rvv.failed()); ActiveObject::IntVoidType iv = activeObj.testVoidIn; ActiveResult riv = iv(); - assert (!riv.available()); + assertTrue (!riv.available()); activeObj.cont(); riv.wait(); - assert (riv.available()); - assert (riv.data() == 123); - assert (!riv.failed()); + assertTrue (riv.available()); + assertTrue (riv.data() == 123); + assertTrue (!riv.failed()); } @@ -157,7 +157,7 @@ void ActiveMethodTest::testWaitInterval() { ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); - assert (!result.available()); + assertTrue (!result.available()); try { result.wait(100); @@ -168,9 +168,9 @@ void ActiveMethodTest::testWaitInterval() } activeObj.cont(); result.wait(10000); - assert (result.available()); - assert (result.data() == 123); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (result.data() == 123); + assertTrue (!result.failed()); } @@ -178,13 +178,13 @@ void ActiveMethodTest::testTryWait() { ActiveObject activeObj; ActiveResult result = activeObj.testMethod(123); - assert (!result.available()); - assert (!result.tryWait(200)); + assertTrue (!result.available()); + assertTrue (!result.tryWait(200)); activeObj.cont(); - assert (result.tryWait(10000)); - assert (result.available()); - assert (result.data() == 123); - assert (!result.failed()); + assertTrue (result.tryWait(10000)); + assertTrue (result.available()); + assertTrue (result.data() == 123); + assertTrue (!result.failed()); } @@ -193,10 +193,10 @@ void ActiveMethodTest::testFailure() ActiveObject activeObj; ActiveResult result = activeObj.testMethod(100); result.wait(); - assert (result.available()); - assert (result.failed()); + assertTrue (result.available()); + assertTrue (result.failed()); std::string msg = result.error(); - assert (msg == "n == 100"); + assertTrue (msg == "n == 100"); } @@ -206,8 +206,8 @@ void ActiveMethodTest::testVoidOut() ActiveResult result = activeObj.testVoid(101); activeObj.cont(); result.wait(); - assert (result.available()); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (!result.failed()); } @@ -217,8 +217,8 @@ void ActiveMethodTest::testVoidInOut() ActiveResult result = activeObj.testVoidInOut(); activeObj.cont(); result.wait(); - assert (result.available()); - assert (!result.failed()); + assertTrue (result.available()); + assertTrue (!result.failed()); } @@ -228,9 +228,9 @@ void ActiveMethodTest::testVoidIn() ActiveResult result = activeObj.testVoidIn(); activeObj.cont(); result.wait(); - assert (result.available()); - assert (!result.failed()); - assert (result.data() == 123); + assertTrue (result.available()); + assertTrue (!result.failed()); + assertTrue (result.data() == 123); } diff --git a/Foundation/testsuite/src/ActivityTest.cpp b/Foundation/testsuite/src/ActivityTest.cpp index ba4630a0c..7be1cdc41 100644 --- a/Foundation/testsuite/src/ActivityTest.cpp +++ b/Foundation/testsuite/src/ActivityTest.cpp @@ -71,14 +71,14 @@ ActivityTest::~ActivityTest() void ActivityTest::testActivity() { ActiveObject activeObj; - assert (activeObj.activity().isStopped()); + assertTrue (activeObj.activity().isStopped()); activeObj.activity().start(); - assert (!activeObj.activity().isStopped()); + assertTrue (!activeObj.activity().isStopped()); Thread::sleep(1000); - assert (activeObj.activity().isRunning()); + assertTrue (activeObj.activity().isRunning()); activeObj.activity().stop(); activeObj.activity().wait(); - assert (activeObj.count() > 0); + assertTrue (activeObj.count() > 0); } diff --git a/Foundation/testsuite/src/AnyTest.cpp b/Foundation/testsuite/src/AnyTest.cpp index 468db91b6..4cab77b4f 100644 --- a/Foundation/testsuite/src/AnyTest.cpp +++ b/Foundation/testsuite/src/AnyTest.cpp @@ -54,9 +54,9 @@ void AnyTest::testDefaultCtor() { const Any value; - assert (value.empty()); - assert (0 == AnyCast(&value)); - assert (value.type() == typeid(void)); + assertTrue (value.empty()); + assertTrue (0 == AnyCast(&value)); + assertTrue (value.type() == typeid(void)); } @@ -65,12 +65,12 @@ void AnyTest::testConvertingCtor() std::string text = "test message"; Any value = text; - assert (!value.empty()); - assert (value.type() == typeid(std::string)); - assert (0 == AnyCast(&value)); - assert (0 != AnyCast(&value)); - assert (AnyCast(value) == text); - assert (AnyCast(&value) != &text); + assertTrue (!value.empty()); + assertTrue (value.type() == typeid(std::string)); + assertTrue (0 == AnyCast(&value)); + assertTrue (0 != AnyCast(&value)); + assertTrue (AnyCast(value) == text); + assertTrue (AnyCast(&value) != &text); } @@ -79,11 +79,11 @@ void AnyTest::testCopyCtor() std::string text = "test message"; Any original = text, copy = original; - assert (!copy.empty()); - assert (original.type() == copy.type()); - assert (AnyCast(original) == AnyCast(copy)); - assert (text == AnyCast(copy)); - assert (AnyCast(&original) != AnyCast(©)); + assertTrue (!copy.empty()); + assertTrue (original.type() == copy.type()); + assertTrue (AnyCast(original) == AnyCast(copy)); + assertTrue (text == AnyCast(copy)); + assertTrue (AnyCast(&original) != AnyCast(©)); } @@ -93,19 +93,19 @@ void AnyTest::testCopyAssign() Any original = text, copy; Any* assignResult = &(copy = original); - assert (!copy.empty()); - assert (original.type() == copy.type()); - assert (AnyCast(original) == AnyCast(copy)); - assert (text == AnyCast(copy)); - assert (AnyCast(&original) != AnyCast(©)); - assert (assignResult == ©); + assertTrue (!copy.empty()); + assertTrue (original.type() == copy.type()); + assertTrue (AnyCast(original) == AnyCast(copy)); + assertTrue (text == AnyCast(copy)); + assertTrue (AnyCast(&original) != AnyCast(©)); + assertTrue (assignResult == ©); // test self assignment Any& ref = original; original = ref; - assert (AnyCast(original) == AnyCast(copy)); + assertTrue (AnyCast(original) == AnyCast(copy)); original = original; - assert (AnyCast(original) == AnyCast(copy)); + assertTrue (AnyCast(original) == AnyCast(copy)); } @@ -115,13 +115,13 @@ void AnyTest::testConvertingAssign() Any value; Any* assignResult = &(value = text); - assert (!value.empty()); - assert (value.type() == typeid(std::string)); - assert (0 == AnyCast(&value)); - assert (0 != AnyCast(&value)); - assert (AnyCast(value) == text); - assert (AnyCast(&value) != &text); - assert (assignResult == &value); + assertTrue (!value.empty()); + assertTrue (value.type() == typeid(std::string)); + assertTrue (0 == AnyCast(&value)); + assertTrue (0 != AnyCast(&value)); + assertTrue (AnyCast(value) == text); + assertTrue (AnyCast(&value) != &text); + assertTrue (assignResult == &value); } @@ -136,17 +136,17 @@ void AnyTest::testCastToReference() int const volatile& ra_cv = AnyCast(a); // cv references to same obj - assert (&ra == &ra_c && &ra == &ra_v && &ra == &ra_cv); + assertTrue (&ra == &ra_c && &ra == &ra_v && &ra == &ra_cv); int const & rb_c = AnyCast(b); int const volatile & rb_cv = AnyCast(b); - assert (&rb_c == &rb_cv); // cv references to copied const obj - assert (&ra != &rb_c); // copies hold different objects + assertTrue (&rb_c == &rb_cv); // cv references to copied const obj + assertTrue (&ra != &rb_c); // copies hold different objects ++ra; int incremented = AnyCast(a); - assert (incremented == 138); // increment by reference changes value + assertTrue (incremented == 138); // increment by reference changes value try { @@ -185,15 +185,15 @@ void AnyTest::testSwap() std::string* originalPtr = AnyCast(&original); Any* swapResult = &original.swap(swapped); - assert (original.empty()); - assert (!swapped.empty()); - assert (swapped.type() == typeid(std::string)); - assert (text == AnyCast(swapped)); - assert (0 != originalPtr); + assertTrue (original.empty()); + assertTrue (!swapped.empty()); + assertTrue (swapped.type() == typeid(std::string)); + assertTrue (text == AnyCast(swapped)); + assertTrue (0 != originalPtr); #ifdef POCO_NO_SOO // pointers only match when heap-allocated - assert (originalPtr == AnyCast(&swapped)); + assertTrue (originalPtr == AnyCast(&swapped)); #endif - assert (swapResult == &original); + assertTrue (swapResult == &original); } @@ -203,29 +203,29 @@ void AnyTest::testEmptyCopy() Any copied = null, assigned; assigned = null; - assert (null.empty()); - assert (copied.empty()); - assert (assigned.empty()); + assertTrue (null.empty()); + assertTrue (copied.empty()); + assertTrue (assigned.empty()); } void AnyTest::testInt() { Any e; - assert (e.empty()); + assertTrue (e.empty()); Any a = 13; - assert (a.type() == typeid(int)); + assertTrue (a.type() == typeid(int)); int* i = AnyCast(&a); - assert (*i == 13); + assertTrue (*i == 13); Any b = a; - assert (b.type() == typeid(int)); + assertTrue (b.type() == typeid(int)); int *cpyI = AnyCast(&b); - assert (*cpyI == *i); + assertTrue (*cpyI == *i); *cpyI = 20; - assert (*cpyI != *i); + assertTrue (*cpyI != *i); std::string* s = AnyCast(&a); - assert (s == NULL); + assertTrue (s == NULL); int POCO_UNUSED tmp = AnyCast(a); const Any c = a; @@ -238,14 +238,14 @@ void AnyTest::testComplexType() SomeClass str(13,std::string("hello")); Any a = str; Any b = a; - assert (a.type() == typeid(SomeClass)); - assert (b.type() == typeid(SomeClass)); + assertTrue (a.type() == typeid(SomeClass)); + assertTrue (b.type() == typeid(SomeClass)); SomeClass str2 = AnyCast(a); - assert (str == str2); + assertTrue (str == str2); const SomeClass& strCRef = RefAnyCast(a); - assert (str == strCRef); + assertTrue (str == strCRef); SomeClass& strRef = RefAnyCast(a); - assert (str == strRef); + assertTrue (str == strRef); } @@ -256,17 +256,17 @@ void AnyTest::testVector() tmp.push_back(2); tmp.push_back(3); Any a = tmp; - assert (a.type() == typeid(std::vector)); + assertTrue (a.type() == typeid(std::vector)); std::vector tmp2 = AnyCast >(a); - assert (tmp2.size() == 3); + assertTrue (tmp2.size() == 3); const std::vector& vecCRef = RefAnyCast >(a); std::vector& vecRef = RefAnyCast >(a); - assert (vecRef[0] == 1); - assert (vecRef[1] == 2); - assert (vecRef[2] == 3); + assertTrue (vecRef[0] == 1); + assertTrue (vecRef[1] == 2); + assertTrue (vecRef[2] == 3); vecRef[0] = 0; - assert (vecRef[0] == vecCRef[0]); + assertTrue (vecRef[0] == vecCRef[0]); } diff --git a/Foundation/testsuite/src/ArrayTest.cpp b/Foundation/testsuite/src/ArrayTest.cpp index a7a2de766..ec19b419f 100644 --- a/Foundation/testsuite/src/ArrayTest.cpp +++ b/Foundation/testsuite/src/ArrayTest.cpp @@ -45,7 +45,7 @@ void ArrayTest::testConstruction() FloatArray b(a); FloatArray c; c = a; - assert (a==b && a==c); + assertTrue (a==b && a==c); typedef Poco::Array DArray; typedef Poco::Array IArray; @@ -63,7 +63,7 @@ void ArrayTest::testConstruction() } for (unsigned i=0; i Array; Array a = {{1, 2}}; - assert(a[0] == 1); - assert(a[1] == 2); + assertTrue (a[0] == 1); + assertTrue (a[1] == 2); typedef std::vector ArrayVec; ArrayVec container; container.push_back(a); container.push_back(a); - assert(container[0][0] == 1); - assert(container[0][1] == 2); - assert(container[1][0] == 1); - assert(container[1][1] == 2); + assertTrue (container[0][0] == 1); + assertTrue (container[0][1] == 2); + assertTrue (container[1][0] == 1); + assertTrue (container[1][1] == 2); } void ArrayTest::testIterator() @@ -164,14 +164,14 @@ void ArrayTest::testAlgorithm() } for (unsigned i=0; i()); // operation for (unsigned i=0; i ptr = new TestObj; - assert (ptr->rc() == 1); + assertTrue (ptr->rc() == 1); AutoPtr ptr2 = ptr; - assert (ptr->rc() == 2); + assertTrue (ptr->rc() == 2); ptr2 = new TestObj; - assert (ptr->rc() == 1); + assertTrue (ptr->rc() == 1); AutoPtr ptr3; ptr3 = ptr2; - assert (ptr2->rc() == 2); + assertTrue (ptr2->rc() == 2); ptr3 = new TestObj; - assert (ptr2->rc() == 1); + assertTrue (ptr2->rc() == 1); ptr3 = ptr2; - assert (ptr2->rc() == 2); - assert (TestObj::count() > 0); + assertTrue (ptr2->rc() == 2); + assertTrue (TestObj::count() > 0); } - assert (TestObj::count() == 0); + assertTrue (TestObj::count() == 0); } @@ -109,59 +109,59 @@ void AutoPtrTest::testOps() pTO1 = pTO2; pTO2 = pTmp; } - assert (pTO1 < pTO2); + assertTrue (pTO1 < pTO2); ptr1 = pTO1; AutoPtr ptr2 = pTO2; AutoPtr ptr3 = ptr1; AutoPtr ptr4; - assert (ptr1.get() == pTO1); - assert (ptr1 == pTO1); - assert (ptr2.get() == pTO2); - assert (ptr2 == pTO2); - assert (ptr3.get() == pTO1); - assert (ptr3 == pTO1); + assertTrue (ptr1.get() == pTO1); + assertTrue (ptr1 == pTO1); + assertTrue (ptr2.get() == pTO2); + assertTrue (ptr2 == pTO2); + assertTrue (ptr3.get() == pTO1); + assertTrue (ptr3 == pTO1); - assert (ptr1 == pTO1); - assert (ptr1 != pTO2); - assert (ptr1 < pTO2); - assert (ptr1 <= pTO2); - assert (ptr2 > pTO1); - assert (ptr2 >= pTO1); + assertTrue (ptr1 == pTO1); + assertTrue (ptr1 != pTO2); + assertTrue (ptr1 < pTO2); + assertTrue (ptr1 <= pTO2); + assertTrue (ptr2 > pTO1); + assertTrue (ptr2 >= pTO1); - assert (ptr1 == ptr3); - assert (ptr1 != ptr2); - assert (ptr1 < ptr2); - assert (ptr1 <= ptr2); - assert (ptr2 > ptr1); - assert (ptr2 >= ptr1); + assertTrue (ptr1 == ptr3); + assertTrue (ptr1 != ptr2); + assertTrue (ptr1 < ptr2); + assertTrue (ptr1 <= ptr2); + assertTrue (ptr2 > ptr1); + assertTrue (ptr2 >= ptr1); ptr1 = pTO1; ptr2 = pTO2; ptr1.swap(ptr2); - assert (ptr2.get() == pTO1); - assert (ptr1.get() == pTO2); + assertTrue (ptr2.get() == pTO1); + assertTrue (ptr1.get() == pTO2); try { - assert (ptr4->rc() > 0); + assertTrue (ptr4->rc() > 0); fail ("must throw NullPointerException"); } catch (NullPointerException&) { } - assert (!(ptr4 == ptr1)); - assert (!(ptr4 == ptr2)); - assert (ptr4 != ptr1); - assert (ptr4 != ptr2); + assertTrue (!(ptr4 == ptr1)); + assertTrue (!(ptr4 == ptr2)); + assertTrue (ptr4 != ptr1); + assertTrue (ptr4 != ptr2); ptr4 = ptr2; - assert (ptr4 == ptr2); - assert (!(ptr4 != ptr2)); + assertTrue (ptr4 == ptr2); + assertTrue (!(ptr4 != ptr2)); - assert (!(!ptr1)); + assertTrue (!(!ptr1)); ptr1 = 0; - assert (!ptr1); + assertTrue (!ptr1); } diff --git a/Foundation/testsuite/src/AutoReleasePoolTest.cpp b/Foundation/testsuite/src/AutoReleasePoolTest.cpp index 1b18692e8..2bc8d3ba0 100644 --- a/Foundation/testsuite/src/AutoReleasePoolTest.cpp +++ b/Foundation/testsuite/src/AutoReleasePoolTest.cpp @@ -78,9 +78,9 @@ void AutoReleasePoolTest::testAutoReleasePool() AutoReleasePool arp; arp.add(new TestObj); arp.add(new TestObj); - assert (TestObj::count() == 2); + assertTrue (TestObj::count() == 2); arp.release(); - assert (TestObj::count() == 0); + assertTrue (TestObj::count() == 0); } diff --git a/Foundation/testsuite/src/Base32Test.cpp b/Foundation/testsuite/src/Base32Test.cpp index f79648a6f..6ccc58525 100644 --- a/Foundation/testsuite/src/Base32Test.cpp +++ b/Foundation/testsuite/src/Base32Test.cpp @@ -39,35 +39,35 @@ void Base32Test::testEncoder() Base32Encoder encoder(str); encoder << std::string("\00\01\02\03\04\05", 6); encoder.close(); - assert (str.str() == "AAAQEAYEAU======"); + assertTrue (str.str() == "AAAQEAYEAU======"); } { std::ostringstream str; Base32Encoder encoder(str); encoder << std::string("\00\01\02\03", 4); encoder.close(); - assert (str.str() == "AAAQEAY="); + assertTrue (str.str() == "AAAQEAY="); } { std::ostringstream str; Base32Encoder encoder(str, false); encoder << "ABCDEF"; encoder.close(); - assert (str.str() == "IFBEGRCFIY"); + assertTrue (str.str() == "IFBEGRCFIY"); } { std::ostringstream str; Base32Encoder encoder(str); encoder << "ABCDEF"; encoder.close(); - assert (str.str() == "IFBEGRCFIY======"); + assertTrue (str.str() == "IFBEGRCFIY======"); } { std::ostringstream str; Base32Encoder encoder(str); encoder << "ABCDE"; encoder.close(); - assert (str.str() == "IFBEGRCF"); + assertTrue (str.str() == "IFBEGRCF"); } } @@ -77,41 +77,41 @@ void Base32Test::testDecoder() { std::istringstream istr("AAAQEAYEAU======"); Base32Decoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == 5); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == 5); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAAQEAYE"); Base32Decoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAAQEAY="); Base32Decoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("IFBEGRCFIY======"); Base32Decoder decoder(istr); std::string s; decoder >> s; - assert (s == "ABCDEF"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "ABCDEF"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } { std::istringstream istr("QUJD#REVG"); @@ -120,12 +120,12 @@ void Base32Test::testDecoder() try { decoder >> s; - assert (decoder.bad()); + assertTrue (decoder.bad()); } catch (DataFormatException&) { } - assert (!decoder.eof()); + assertTrue (!decoder.eof()); } } @@ -142,7 +142,7 @@ void Base32Test::testEncodeDecode() std::string s; int c = decoder.get(); while (c != -1) { s += char(c); c = decoder.get(); } - assert (s == "The quick brown fox jumped over the lazy dog."); + assertTrue (s == "The quick brown fox jumped over the lazy dog."); } { std::string src; @@ -155,7 +155,7 @@ void Base32Test::testEncodeDecode() std::string s; int c = decoder.get(); while (c != -1) { s += char(c); c = decoder.get(); } - assert (s == src); + assertTrue (s == src); } } diff --git a/Foundation/testsuite/src/Base64Test.cpp b/Foundation/testsuite/src/Base64Test.cpp index af34f4ac2..dcde59181 100644 --- a/Foundation/testsuite/src/Base64Test.cpp +++ b/Foundation/testsuite/src/Base64Test.cpp @@ -39,28 +39,28 @@ void Base64Test::testEncoder() Base64Encoder encoder(str); encoder << std::string("\00\01\02\03\04\05", 6); encoder.close(); - assert (str.str() == "AAECAwQF"); + assertTrue (str.str() == "AAECAwQF"); } { std::ostringstream str; Base64Encoder encoder(str); encoder << std::string("\00\01\02\03", 4); encoder.close(); - assert (str.str() == "AAECAw=="); + assertTrue (str.str() == "AAECAw=="); } { std::ostringstream str; Base64Encoder encoder(str); encoder << "ABCDEF"; encoder.close(); - assert (str.str() == "QUJDREVG"); + assertTrue (str.str() == "QUJDREVG"); } { std::ostringstream str; Base64Encoder encoder(str); encoder << "!@#$%^&*()_~<>"; encoder.close(); - assert (str.str() == "IUAjJCVeJiooKV9+PD4="); + assertTrue (str.str() == "IUAjJCVeJiooKV9+PD4="); } } @@ -72,28 +72,28 @@ void Base64Test::testEncoderURL() Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING); encoder << std::string("\00\01\02\03\04\05", 6); encoder.close(); - assert (str.str() == "AAECAwQF"); + assertTrue (str.str() == "AAECAwQF"); } { std::ostringstream str; Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING); encoder << std::string("\00\01\02\03", 4); encoder.close(); - assert (str.str() == "AAECAw=="); + assertTrue (str.str() == "AAECAw=="); } { std::ostringstream str; Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING); encoder << "ABCDEF"; encoder.close(); - assert (str.str() == "QUJDREVG"); + assertTrue (str.str() == "QUJDREVG"); } { std::ostringstream str; Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING); encoder << "!@#$%^&*()_~<>"; encoder.close(); - assert (str.str() == "IUAjJCVeJiooKV9-PD4="); + assertTrue (str.str() == "IUAjJCVeJiooKV9-PD4="); } } @@ -105,28 +105,28 @@ void Base64Test::testEncoderNoPadding() Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING | Poco::BASE64_NO_PADDING); encoder << std::string("\00\01\02\03\04\05", 6); encoder.close(); - assert (str.str() == "AAECAwQF"); + assertTrue (str.str() == "AAECAwQF"); } { std::ostringstream str; Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING | Poco::BASE64_NO_PADDING); encoder << std::string("\00\01\02\03", 4); encoder.close(); - assert (str.str() == "AAECAw"); + assertTrue (str.str() == "AAECAw"); } { std::ostringstream str; Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING | Poco::BASE64_NO_PADDING); encoder << "ABCDEF"; encoder.close(); - assert (str.str() == "QUJDREVG"); + assertTrue (str.str() == "QUJDREVG"); } { std::ostringstream str; Base64Encoder encoder(str, Poco::BASE64_URL_ENCODING | Poco::BASE64_NO_PADDING); encoder << "!@#$%^&*()_~<>"; encoder.close(); - assert (str.str() == "IUAjJCVeJiooKV9-PD4"); + assertTrue (str.str() == "IUAjJCVeJiooKV9-PD4"); } } @@ -136,50 +136,50 @@ void Base64Test::testDecoder() { std::istringstream istr("AAECAwQF"); Base64Decoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == 5); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == 5); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAECAwQ="); Base64Decoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAECAw=="); Base64Decoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("QUJDREVG"); Base64Decoder decoder(istr); std::string s; decoder >> s; - assert (s == "ABCDEF"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "ABCDEF"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } { std::istringstream istr("QUJ\r\nDRE\r\nVG"); Base64Decoder decoder(istr); std::string s; decoder >> s; - assert (s == "ABCDEF"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "ABCDEF"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } { std::istringstream istr("QUJD#REVG"); @@ -188,12 +188,12 @@ void Base64Test::testDecoder() try { decoder >> s; - assert (decoder.bad()); + assertTrue (decoder.bad()); } catch (DataFormatException&) { } - assert (!decoder.eof()); + assertTrue (!decoder.eof()); } } @@ -203,41 +203,41 @@ void Base64Test::testDecoderURL() { std::istringstream istr("AAECAwQF"); Base64Decoder decoder(istr, Poco::BASE64_URL_ENCODING); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == 5); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == 5); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAECAwQ="); Base64Decoder decoder(istr, Poco::BASE64_URL_ENCODING); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAECAw=="); Base64Decoder decoder(istr, Poco::BASE64_URL_ENCODING); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("QUJDREVG"); Base64Decoder decoder(istr, Poco::BASE64_URL_ENCODING); std::string s; decoder >> s; - assert (s == "ABCDEF"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "ABCDEF"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } { std::istringstream istr("QUJ\r\nDRE\r\nVG"); @@ -246,7 +246,7 @@ void Base64Test::testDecoderURL() { std::string s; decoder >> s; - assert (decoder.bad()); + assertTrue (decoder.bad()); } catch (DataFormatException&) { @@ -259,21 +259,21 @@ void Base64Test::testDecoderURL() try { decoder >> s; - assert (decoder.bad()); + assertTrue (decoder.bad()); } catch (DataFormatException&) { } - assert (!decoder.eof()); + assertTrue (!decoder.eof()); } { std::istringstream istr("IUAjJCVeJiooKV9-PD4="); Base64Decoder decoder(istr, Poco::BASE64_URL_ENCODING); std::string s; decoder >> s; - assert (s == "!@#$%^&*()_~<>"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "!@#$%^&*()_~<>"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } } @@ -283,32 +283,32 @@ void Base64Test::testDecoderNoPadding() { std::istringstream istr("AAECAwQF"); Base64Decoder decoder(istr, Poco::BASE64_NO_PADDING); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == 5); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == 5); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAECAwQ"); Base64Decoder decoder(istr, Poco::BASE64_NO_PADDING); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("AAECAw"); Base64Decoder decoder(istr, Poco::BASE64_NO_PADDING); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == -1); } } @@ -325,7 +325,7 @@ void Base64Test::testEncodeDecode() std::string s; int c = decoder.get(); while (c != -1) { s += char(c); c = decoder.get(); } - assert (s == "The quick brown fox jumped over the lazy dog."); + assertTrue (s == "The quick brown fox jumped over the lazy dog."); } { std::string src; @@ -338,7 +338,7 @@ void Base64Test::testEncodeDecode() std::string s; int c = decoder.get(); while (c != -1) { s += char(c); c = decoder.get(); } - assert (s == src); + assertTrue (s == src); } } diff --git a/Foundation/testsuite/src/BasicEventTest.cpp b/Foundation/testsuite/src/BasicEventTest.cpp index e31faa5ca..bdf314644 100644 --- a/Foundation/testsuite/src/BasicEventTest.cpp +++ b/Foundation/testsuite/src/BasicEventTest.cpp @@ -39,61 +39,61 @@ void BasicEventTest::testNoDelegate() int tmp = 0; EventArgs args; - assert (_count == 0); - assert (Void.empty()); + assertTrue (_count == 0); + assertTrue (Void.empty()); Void.notify(this); - assert (_count == 0); + assertTrue (_count == 0); Void += delegate(this, &BasicEventTest::onVoid); - assert (!Void.empty()); + assertTrue (!Void.empty()); Void -= delegate(this, &BasicEventTest::onVoid); - assert (Void.empty()); + assertTrue (Void.empty()); Void.notify(this); - assert (_count == 0); - assert (Simple.empty()); + assertTrue (_count == 0); + assertTrue (Simple.empty()); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimple); - assert (!Simple.empty()); + assertTrue (!Simple.empty()); Simple -= delegate(this, &BasicEventTest::onSimple); - assert (Simple.empty()); + assertTrue (Simple.empty()); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimpleNoSender); Simple -= delegate(this, &BasicEventTest::onSimpleNoSender); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); ConstSimple += delegate(this, &BasicEventTest::onConstSimple); ConstSimple -= delegate(this, &BasicEventTest::onConstSimple); ConstSimple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); //Note: passing &args will not work due to & EventArgs* pArgs = &args; Complex += delegate(this, &BasicEventTest::onComplex); Complex -= delegate(this, &BasicEventTest::onComplex); Complex.notify(this, pArgs); - assert (_count == 0); + assertTrue (_count == 0); Complex2 += delegate(this, &BasicEventTest::onComplex2); Complex2 -= delegate(this, &BasicEventTest::onComplex2); Complex2.notify(this, args); - assert (_count == 0); + assertTrue (_count == 0); const EventArgs* pCArgs = &args; ConstComplex += delegate(this, &BasicEventTest::onConstComplex); ConstComplex -= delegate(this, &BasicEventTest::onConstComplex); ConstComplex.notify(this, pCArgs); - assert (_count == 0); + assertTrue (_count == 0); Const2Complex += delegate(this, &BasicEventTest::onConst2Complex); Const2Complex -= delegate(this, &BasicEventTest::onConst2Complex); Const2Complex.notify(this, pArgs); - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(&BasicEventTest::onStaticSimple); Simple += delegate(&BasicEventTest::onStaticSimple); @@ -101,14 +101,14 @@ void BasicEventTest::testNoDelegate() Simple += delegate(&BasicEventTest::onStaticSimple3); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); Simple -= delegate(BasicEventTest::onStaticSimple); Void += delegate(&BasicEventTest::onStaticVoid); Void += delegate(&BasicEventTest::onStaticVoid); Void.notify(this); - assert (_count == 5); + assertTrue (_count == 5); Void -= delegate(BasicEventTest::onStaticVoid); } @@ -117,40 +117,40 @@ void BasicEventTest::testSingleDelegate() int tmp = 0; EventArgs args; - assert (_count == 0); + assertTrue (_count == 0); Void += delegate(this, &BasicEventTest::onVoid); Void.notify(this); - assert (_count == 1); + assertTrue (_count == 1); Simple += delegate(this, &BasicEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); ConstSimple += delegate(this, &BasicEventTest::onConstSimple); ConstSimple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); EventArgs* pArgs = &args; Complex += delegate(this, &BasicEventTest::onComplex); Complex.notify(this, pArgs); - assert (_count == 4); + assertTrue (_count == 4); Complex2 += delegate(this, &BasicEventTest::onComplex2); Complex2.notify(this, args); - assert (_count == 5); + assertTrue (_count == 5); const EventArgs* pCArgs = &args; ConstComplex += delegate(this, &BasicEventTest::onConstComplex); ConstComplex.notify(this, pCArgs); - assert (_count == 6); + assertTrue (_count == 6); Const2Complex += delegate(this, &BasicEventTest::onConst2Complex); Const2Complex.notify(this, pArgs); - assert (_count == 7); + assertTrue (_count == 7); // check if 2nd notify also works Const2Complex.notify(this, pArgs); - assert (_count == 8); + assertTrue (_count == 8); } @@ -158,15 +158,15 @@ void BasicEventTest::testDuplicateRegister() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimple); Simple += delegate(this, &BasicEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); Simple -= delegate(this, &BasicEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } @@ -175,15 +175,15 @@ void BasicEventTest::testNullMutex() Poco::BasicEvent ev; int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); ev += delegate(this, &BasicEventTest::onSimple); ev += delegate(this, &BasicEventTest::onSimple); ev.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); ev -= delegate(this, &BasicEventTest::onSimple); ev.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } @@ -192,91 +192,91 @@ void BasicEventTest::testDuplicateUnregister() // duplicate unregister shouldn't give an error, int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple -= delegate(this, &BasicEventTest::onSimple); // should work Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= delegate(this, &BasicEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= delegate(this, &BasicEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } void BasicEventTest::testDisabling() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimple); Simple.disable(); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple.enable(); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); // unregister should also work with disabled event Simple.disable(); Simple -= delegate(this, &BasicEventTest::onSimple); Simple.enable(); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } void BasicEventTest::testExpire() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimple, 500); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Poco::Thread::sleep(700); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple += delegate(&BasicEventTest::onStaticSimple, 400); Simple += delegate(&BasicEventTest::onStaticSimple, 400); Simple += delegate(&BasicEventTest::onStaticSimple2, 400); Simple += delegate(&BasicEventTest::onStaticSimple3, 400); Simple.notify(this, tmp); - assert (_count == 4); + assertTrue (_count == 4); Poco::Thread::sleep(700); Simple.notify(this, tmp); - assert (_count == 4); + assertTrue (_count == 4); } void BasicEventTest::testExpireReRegister() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &BasicEventTest::onSimple, 500); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Poco::Thread::sleep(200); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); // renew registration Simple += delegate(this, &BasicEventTest::onSimple, 600); Poco::Thread::sleep(400); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); Poco::Thread::sleep(300); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } void BasicEventTest::testReturnParams() @@ -286,7 +286,7 @@ void BasicEventTest::testReturnParams() int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 1); + assertTrue (tmp == 1); } void BasicEventTest::testOverwriteDelegate() @@ -297,22 +297,22 @@ void BasicEventTest::testOverwriteDelegate() int tmp = 0; // onsimple requires 0 as input Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); } void BasicEventTest::testAsyncNotify() { Poco::BasicEvent* pSimple= new Poco::BasicEvent(); (*pSimple) += delegate(this, &BasicEventTest::onAsync); - assert (_count == 0); + assertTrue (_count == 0); int tmp = 0; Poco::ActiveResultretArg = pSimple->notifyAsync(this, tmp); delete pSimple; // must work even when the event got deleted! pSimple = NULL; - assert (_count == 0); + assertTrue (_count == 0); retArg.wait(); - assert (retArg.data() == tmp); - assert (_count == LARGEINC); + assertTrue (retArg.data() == tmp); + assertTrue (_count == LARGEINC); } void BasicEventTest::onStaticVoid(const void* pSender) diff --git a/Foundation/testsuite/src/BinaryReaderWriterTest.cpp b/Foundation/testsuite/src/BinaryReaderWriterTest.cpp index f10b41320..74c82af46 100644 --- a/Foundation/testsuite/src/BinaryReaderWriterTest.cpp +++ b/Foundation/testsuite/src/BinaryReaderWriterTest.cpp @@ -53,11 +53,11 @@ void BinaryReaderWriterTest::testBigEndian() std::stringstream sstream; BinaryWriter writer(sstream, BinaryWriter::BIG_ENDIAN_BYTE_ORDER); BinaryReader reader(sstream, BinaryReader::UNSPECIFIED_BYTE_ORDER); - assert (writer.byteOrder() == BinaryWriter::BIG_ENDIAN_BYTE_ORDER); + assertTrue (writer.byteOrder() == BinaryWriter::BIG_ENDIAN_BYTE_ORDER); writer.writeBOM(); write(writer); reader.readBOM(); - assert (reader.byteOrder() == BinaryReader::BIG_ENDIAN_BYTE_ORDER); + assertTrue (reader.byteOrder() == BinaryReader::BIG_ENDIAN_BYTE_ORDER); read(reader); } @@ -67,11 +67,11 @@ void BinaryReaderWriterTest::testLittleEndian() std::stringstream sstream; BinaryWriter writer(sstream, BinaryWriter::LITTLE_ENDIAN_BYTE_ORDER); BinaryReader reader(sstream, BinaryReader::UNSPECIFIED_BYTE_ORDER); - assert (writer.byteOrder() == BinaryWriter::LITTLE_ENDIAN_BYTE_ORDER); + assertTrue (writer.byteOrder() == BinaryWriter::LITTLE_ENDIAN_BYTE_ORDER); writer.writeBOM(); write(writer); reader.readBOM(); - assert (reader.byteOrder() == BinaryReader::LITTLE_ENDIAN_BYTE_ORDER); + assertTrue (reader.byteOrder() == BinaryReader::LITTLE_ENDIAN_BYTE_ORDER); read(reader); } @@ -130,100 +130,100 @@ void BinaryReaderWriterTest::read(BinaryReader& reader) { bool b; reader >> b; - assert (b); + assertTrue (b); reader >> b; - assert (!b); + assertTrue (!b); char c; reader >> c; - assert (c == 'a'); + assertTrue (c == 'a'); short shortv; reader >> shortv; - assert (shortv == -100); + assertTrue (shortv == -100); unsigned short ushortv; reader >> ushortv; - assert (ushortv == 50000); + assertTrue (ushortv == 50000); int intv; reader >> intv; - assert (intv == -123456); + assertTrue (intv == -123456); unsigned uintv; reader >> uintv; - assert (uintv == 123456); + assertTrue (uintv == 123456); long longv; reader >> longv; - assert (longv == -1234567890); + assertTrue (longv == -1234567890); unsigned long ulongv; reader >> ulongv; - assert (ulongv == 1234567890); + assertTrue (ulongv == 1234567890); #if defined(POCO_HAVE_INT64) Int64 int64v; reader >> int64v; - assert (int64v == -1234567890); + assertTrue (int64v == -1234567890); UInt64 uint64v; reader >> uint64v; - assert (uint64v == 1234567890); + assertTrue (uint64v == 1234567890); #endif float floatv; reader >> floatv; - assert (floatv == 1.5); + assertTrue (floatv == 1.5); double doublev; reader >> doublev; - assert (doublev == -1.5); + assertTrue (doublev == -1.5); std::string str; reader >> str; - assert (str == "foo"); + assertTrue (str == "foo"); reader >> str; - assert (str == ""); + assertTrue (str == ""); reader >> str; - assert (str == "bar"); + assertTrue (str == "bar"); reader >> str; - assert (str == ""); + assertTrue (str == ""); UInt32 uint32v; reader.read7BitEncoded(uint32v); - assert (uint32v == 100); + assertTrue (uint32v == 100); reader.read7BitEncoded(uint32v); - assert (uint32v == 1000); + assertTrue (uint32v == 1000); reader.read7BitEncoded(uint32v); - assert (uint32v == 10000); + assertTrue (uint32v == 10000); reader.read7BitEncoded(uint32v); - assert (uint32v == 100000); + assertTrue (uint32v == 100000); reader.read7BitEncoded(uint32v); - assert (uint32v == 1000000); + assertTrue (uint32v == 1000000); #if defined(POCO_HAVE_INT64) reader.read7BitEncoded(uint64v); - assert (uint64v == 100); + assertTrue (uint64v == 100); reader.read7BitEncoded(uint64v); - assert (uint64v == 1000); + assertTrue (uint64v == 1000); reader.read7BitEncoded(uint64v); - assert (uint64v == 10000); + assertTrue (uint64v == 10000); reader.read7BitEncoded(uint64v); - assert (uint64v == 100000); + assertTrue (uint64v == 100000); reader.read7BitEncoded(uint64v); - assert (uint64v == 1000000); + assertTrue (uint64v == 1000000); #endif std::vector vec; reader >> vec; - assert (vec.size() == 3); - assert (vec[0] == 1); - assert (vec[1] == 2); - assert (vec[2] == 3); + assertTrue (vec.size() == 3); + assertTrue (vec[0] == 1); + assertTrue (vec[1] == 2); + assertTrue (vec[2] == 3); reader.readRaw(3, str); - assert (str == "RAW"); + assertTrue (str == "RAW"); } @@ -240,14 +240,14 @@ void BinaryReaderWriterTest::testWrappers() writer << -1; MemoryBinaryReader reader(writer.data()); - reader >> b; assert (b); - reader >> b; assert (!b); - reader >> c; assert ('a' == c); - assert(reader.available() == sizeof(i) * 2); - reader >> i; assert (1 == i); - assert(reader.available() == sizeof(i)); - reader >> i; assert (-1 == i); - assert(reader.available() == 0); + reader >> b; assertTrue (b); + reader >> b; assertTrue (!b); + reader >> c; assertTrue ('a' == c); + assertTrue (reader.available() == sizeof(i) * 2); + reader >> i; assertTrue (1 == i); + assertTrue (reader.available() == sizeof(i)); + reader >> i; assertTrue (-1 == i); + assertTrue (reader.available() == 0); reader.setExceptions(std::istream::eofbit); try diff --git a/Foundation/testsuite/src/ByteOrderTest.cpp b/Foundation/testsuite/src/ByteOrderTest.cpp index 63484ee05..bea2adba7 100644 --- a/Foundation/testsuite/src/ByteOrderTest.cpp +++ b/Foundation/testsuite/src/ByteOrderTest.cpp @@ -40,45 +40,45 @@ void ByteOrderTest::testByteOrderFlip() { Int16 norm = (Int16) 0xAABB; Int16 flip = ByteOrder::flipBytes(norm); - assert (UInt16(flip) == 0xBBAA); + assertTrue (UInt16(flip) == 0xBBAA); flip = ByteOrder::flipBytes(flip); - assert (flip == norm); + assertTrue (flip == norm); } { UInt16 norm = (UInt16) 0xAABB; UInt16 flip = ByteOrder::flipBytes(norm); - assert (flip == 0xBBAA); + assertTrue (flip == 0xBBAA); flip = ByteOrder::flipBytes(flip); - assert (flip == norm); + assertTrue (flip == norm); } { Int32 norm = 0xAABBCCDD; Int32 flip = ByteOrder::flipBytes(norm); - assert (UInt32(flip) == 0xDDCCBBAA); + assertTrue (UInt32(flip) == 0xDDCCBBAA); flip = ByteOrder::flipBytes(flip); - assert (flip == norm); + assertTrue (flip == norm); } { UInt32 norm = 0xAABBCCDD; UInt32 flip = ByteOrder::flipBytes(norm); - assert (flip == 0xDDCCBBAA); + assertTrue (flip == 0xDDCCBBAA); flip = ByteOrder::flipBytes(flip); - assert (flip == norm); + assertTrue (flip == norm); } #if defined(POCO_HAVE_INT64) { Int64 norm = (Int64(0x8899AABB) << 32) + 0xCCDDEEFF; Int64 flip = ByteOrder::flipBytes(norm); - assert (flip == (Int64(0xFFEEDDCC) << 32) + 0xBBAA9988); + assertTrue (flip == (Int64(0xFFEEDDCC) << 32) + 0xBBAA9988); flip = ByteOrder::flipBytes(flip); - assert (flip == norm); + assertTrue (flip == norm); } { UInt64 norm = (UInt64(0x8899AABB) << 32) + 0xCCDDEEFF; UInt64 flip = ByteOrder::flipBytes(norm); - assert (flip == (UInt64(0xFFEEDDCC) << 32) + 0xBBAA9988); + assertTrue (flip == (UInt64(0xFFEEDDCC) << 32) + 0xBBAA9988); flip = ByteOrder::flipBytes(flip); - assert (flip == norm); + assertTrue (flip == norm); } #endif } @@ -93,66 +93,66 @@ void ByteOrderTest::testByteOrderBigEndian() { Int16 norm = 4; Int16 flip = ByteOrder::toBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #endif { Int16 norm = 4; Int16 flip = ByteOrder::fromBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::fromBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::fromBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::fromBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::fromBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::fromBigEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #endif #else @@ -162,90 +162,90 @@ void ByteOrderTest::testByteOrderBigEndian() { Int16 norm = 4; Int16 flip = ByteOrder::toBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #endif { Int16 norm = 4; Int16 flip = ByteOrder::fromBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::fromBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::fromBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::fromBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::fromBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::fromBigEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #endif #endif @@ -261,66 +261,66 @@ void ByteOrderTest::testByteOrderLittleEndian() { Int16 norm = 4; Int16 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #endif { Int16 norm = 4; Int16 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toLittleEndian(norm); - assert (norm == flip); + assertTrue (norm == flip); } #endif #else @@ -330,90 +330,90 @@ void ByteOrderTest::testByteOrderLittleEndian() { Int16 norm = 4; Int16 flip = ByteOrder::toLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #endif { Int16 norm = 4; Int16 flip = ByteOrder::fromLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::fromLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::fromLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::fromLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::fromLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::fromLittleEndian(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #endif #endif @@ -429,66 +429,66 @@ void ByteOrderTest::testByteOrderNetwork() { Int16 norm = 4; Int16 flip = ByteOrder::toNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } #endif { Int16 norm = 4; Int16 flip = ByteOrder::fromNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::fromNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::fromNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::fromNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::fromNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::fromNetwork(norm); - assert (norm == flip); + assertTrue (norm == flip); } #endif #else @@ -498,90 +498,90 @@ void ByteOrderTest::testByteOrderNetwork() { Int16 norm = 4; Int16 flip = ByteOrder::toNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::toNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::toNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::toNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::toNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::toNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #endif { Int16 norm = 4; Int16 flip = ByteOrder::fromNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt16 norm = 4; UInt16 flip = ByteOrder::fromNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { Int32 norm = 4; Int32 flip = ByteOrder::fromNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt32 norm = 4; UInt32 flip = ByteOrder::fromNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #if defined(POCO_HAVE_INT64) { Int64 norm = 4; Int64 flip = ByteOrder::fromNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } { UInt64 norm = 4; UInt64 flip = ByteOrder::fromNetwork(norm); - assert (norm != flip); + assertTrue (norm != flip); flip = ByteOrder::flipBytes(flip); - assert (norm == flip); + assertTrue (norm == flip); } #endif #endif diff --git a/Foundation/testsuite/src/ChannelTest.cpp b/Foundation/testsuite/src/ChannelTest.cpp index 0fb9c802e..a12a31477 100644 --- a/Foundation/testsuite/src/ChannelTest.cpp +++ b/Foundation/testsuite/src/ChannelTest.cpp @@ -63,7 +63,7 @@ void ChannelTest::testSplitter() pSplitter->addChannel(pChannel.get()); Message msg; pSplitter->log(msg); - assert (pChannel->list().size() == 2); + assertTrue (pChannel->list().size() == 2); } @@ -76,7 +76,7 @@ void ChannelTest::testAsync() pAsync->log(msg); pAsync->log(msg); pAsync->close(); - assert (pChannel->list().size() == 2); + assertTrue (pChannel->list().size() == 2); } @@ -87,8 +87,8 @@ void ChannelTest::testFormatting() AutoPtr pFormatterChannel = new FormattingChannel(pFormatter, pChannel.get()); Message msg("Source", "Text", Message::PRIO_INFORMATION); pFormatterChannel->log(msg); - assert (pChannel->list().size() == 1); - assert (pChannel->list().begin()->getText() == "Source: Text"); + assertTrue (pChannel->list().size() == 1); + assertTrue (pChannel->list().begin()->getText() == "Source: Text"); } @@ -110,7 +110,7 @@ void ChannelTest::testStream() AutoPtr pFormatterChannel = new FormattingChannel(pFormatter, pChannel.get()); Message msg("Source", "Text", Message::PRIO_INFORMATION); pFormatterChannel->log(msg); - assert (str.str().find("Source: Text") == 0); + assertTrue (str.str().find("Source: Text") == 0); } diff --git a/Foundation/testsuite/src/ClassLoaderTest.cpp b/Foundation/testsuite/src/ClassLoaderTest.cpp index 6ea707fbe..02a583896 100644 --- a/Foundation/testsuite/src/ClassLoaderTest.cpp +++ b/Foundation/testsuite/src/ClassLoaderTest.cpp @@ -42,11 +42,11 @@ void ClassLoaderTest::testClassLoader1() ClassLoader cl; - assert (cl.begin() == cl.end()); + assertTrue (cl.begin() == cl.end()); assertNullPtr (cl.findClass("PluginA")); assertNullPtr (cl.findManifest(path)); - assert (!cl.isLibraryLoaded(path)); + assertTrue (!cl.isLibraryLoaded(path)); try { @@ -84,41 +84,41 @@ void ClassLoaderTest::testClassLoader2() ClassLoader cl; cl.loadLibrary(path); - assert (cl.begin() != cl.end()); + assertTrue (cl.begin() != cl.end()); assertNotNullPtr (cl.findClass("PluginA")); assertNotNullPtr (cl.findClass("PluginB")); assertNotNullPtr (cl.findClass("PluginC")); assertNotNullPtr (cl.findManifest(path)); - assert (cl.isLibraryLoaded(path)); - assert (cl.manifestFor(path).size() == 3); + assertTrue (cl.isLibraryLoaded(path)); + assertTrue (cl.manifestFor(path).size() == 3); ClassLoader::Iterator it = cl.begin(); - assert (it != cl.end()); - assert (it->first == path); - assert (it->second->size() == 3); + assertTrue (it != cl.end()); + assertTrue (it->first == path); + assertTrue (it->second->size() == 3); ++it; - assert (it == cl.end()); + assertTrue (it == cl.end()); TestPlugin* pPluginA = cl.classFor("PluginA").create(); - assert (pPluginA->name() == "PluginA"); - assert (!cl.classFor("PluginA").isAutoDelete(pPluginA)); + assertTrue (pPluginA->name() == "PluginA"); + assertTrue (!cl.classFor("PluginA").isAutoDelete(pPluginA)); delete pPluginA; TestPlugin* pPluginB = cl.classFor("PluginB").create(); - assert (pPluginB->name() == "PluginB"); + assertTrue (pPluginB->name() == "PluginB"); delete pPluginB; pPluginB = cl.create("PluginB"); - assert (pPluginB->name() == "PluginB"); + assertTrue (pPluginB->name() == "PluginB"); delete pPluginB; - assert (cl.canCreate("PluginA")); - assert (cl.canCreate("PluginB")); - assert (!cl.canCreate("PluginC")); + assertTrue (cl.canCreate("PluginA")); + assertTrue (cl.canCreate("PluginB")); + assertTrue (!cl.canCreate("PluginC")); TestPlugin& pluginC = cl.instance("PluginC"); - assert (pluginC.name() == "PluginC"); + assertTrue (pluginC.name() == "PluginC"); try { @@ -149,7 +149,7 @@ void ClassLoaderTest::testClassLoader2() } const AbstractMetaObject& meta1 = cl.classFor("PluginC"); - assert (meta1.isAutoDelete(&(meta1.instance()))); + assertTrue (meta1.isAutoDelete(&(meta1.instance()))); // the following must not produce memory leaks const AbstractMetaObject& meta2 = cl.classFor("PluginA"); @@ -158,9 +158,9 @@ void ClassLoaderTest::testClassLoader2() TestPlugin* pPlugin = meta2.create(); meta2.autoDelete(pPlugin); - assert (meta2.isAutoDelete(pPlugin)); + assertTrue (meta2.isAutoDelete(pPlugin)); meta2.destroy(pPlugin); - assert (!meta2.isAutoDelete(pPlugin)); + assertTrue (!meta2.isAutoDelete(pPlugin)); cl.unloadLibrary(path); } @@ -176,14 +176,14 @@ void ClassLoaderTest::testClassLoader3() cl.loadLibrary(path); cl.unloadLibrary(path); - assert (cl.manifestFor(path).size() == 3); + assertTrue (cl.manifestFor(path).size() == 3); ClassLoader::Iterator it = cl.begin(); - assert (it != cl.end()); - assert (it->first == path); - assert (it->second->size() == 3); + assertTrue (it != cl.end()); + assertTrue (it->first == path); + assertTrue (it->second->size() == 3); ++it; - assert (it == cl.end()); + assertTrue (it == cl.end()); cl.unloadLibrary(path); assertNullPtr (cl.findManifest(path)); diff --git a/Foundation/testsuite/src/ClockTest.cpp b/Foundation/testsuite/src/ClockTest.cpp index 01bc84382..04e25f679 100644 --- a/Foundation/testsuite/src/ClockTest.cpp +++ b/Foundation/testsuite/src/ClockTest.cpp @@ -36,32 +36,32 @@ void ClockTest::testClock() Thread::sleep(200); Clock t2; Clock t3 = t2; - assert (t1 != t2); - assert (!(t1 == t2)); - assert (t2 > t1); - assert (t2 >= t1); - assert (!(t1 > t2)); - assert (!(t1 >= t2)); - assert (t2 == t3); - assert (!(t2 != t3)); - assert (t2 >= t3); - assert (t2 <= t3); + assertTrue (t1 != t2); + assertTrue (!(t1 == t2)); + assertTrue (t2 > t1); + assertTrue (t2 >= t1); + assertTrue (!(t1 > t2)); + assertTrue (!(t1 >= t2)); + assertTrue (t2 == t3); + assertTrue (!(t2 != t3)); + assertTrue (t2 >= t3); + assertTrue (t2 <= t3); Clock::ClockDiff d = (t2 - t1); - assert (d >= 180000 && d <= 300000); + assertTrue (d >= 180000 && d <= 300000); Clock::ClockDiff acc = Clock::accuracy(); - assert (acc > 0 && acc < Clock::resolution()); + assertTrue (acc > 0 && acc < Clock::resolution()); std::cout << "Clock accuracy: " << acc << std::endl; t1.swap(t2); - assert (t1 > t2); + assertTrue (t1 > t2); t2.swap(t1); Clock now; Thread::sleep(201); - assert (now.elapsed() >= 200000); - assert (now.isElapsed(200000)); - assert (!now.isElapsed(2000000)); + assertTrue (now.elapsed() >= 200000); + assertTrue (now.isElapsed(200000)); + assertTrue (!now.isElapsed(2000000)); } diff --git a/Foundation/testsuite/src/ConditionTest.cpp b/Foundation/testsuite/src/ConditionTest.cpp index 80744b486..a4694c3d7 100644 --- a/Foundation/testsuite/src/ConditionTest.cpp +++ b/Foundation/testsuite/src/ConditionTest.cpp @@ -114,21 +114,21 @@ void ConditionTest::testSignal() Thread::sleep(200); t2.start(r2); - assert (!r1.ran()); - assert (!r2.ran()); + assertTrue (!r1.ran()); + assertTrue (!r2.ran()); cond.signal(); t1.join(); - assert (r1.ran()); + assertTrue (r1.ran()); - assert (!t2.tryJoin(200)); + assertTrue (!t2.tryJoin(200)); cond.signal(); t2.join(); - assert (r2.ran()); + assertTrue (r2.ran()); } @@ -150,24 +150,24 @@ void ConditionTest::testBroadcast() Thread::sleep(200); t3.start(r3); - assert (!r1.ran()); - assert (!r2.ran()); - assert (!r3.ran()); + assertTrue (!r1.ran()); + assertTrue (!r2.ran()); + assertTrue (!r3.ran()); cond.signal(); t1.join(); - assert (r1.ran()); - assert (!t2.tryJoin(500)); - assert (!t3.tryJoin(500)); + assertTrue (r1.ran()); + assertTrue (!t2.tryJoin(500)); + assertTrue (!t3.tryJoin(500)); cond.broadcast(); t2.join(); t3.join(); - assert (r2.ran()); - assert (r3.ran()); + assertTrue (r2.ran()); + assertTrue (r3.ran()); } diff --git a/Foundation/testsuite/src/CoreTest.cpp b/Foundation/testsuite/src/CoreTest.cpp index 390189efd..d0df29eb7 100644 --- a/Foundation/testsuite/src/CoreTest.cpp +++ b/Foundation/testsuite/src/CoreTest.cpp @@ -131,18 +131,18 @@ void CoreTest::testPlatform() void CoreTest::testFixedLength() { - assert (sizeof(Poco::Int8) == 1); - assert (sizeof(Poco::UInt8) == 1); - assert (sizeof(Poco::Int16) == 2); - assert (sizeof(Poco::UInt16) == 2); - assert (sizeof(Poco::Int32) == 4); - assert (sizeof(Poco::UInt32) == 4); + assertTrue (sizeof(Poco::Int8) == 1); + assertTrue (sizeof(Poco::UInt8) == 1); + assertTrue (sizeof(Poco::Int16) == 2); + assertTrue (sizeof(Poco::UInt16) == 2); + assertTrue (sizeof(Poco::Int32) == 4); + assertTrue (sizeof(Poco::UInt32) == 4); #if defined(POCO_HAVE_INT64) - assert (sizeof(Poco::Int64) == 8); - assert (sizeof(Poco::UInt64) == 8); + assertTrue (sizeof(Poco::Int64) == 8); + assertTrue (sizeof(Poco::UInt64) == 8); #endif - assert (sizeof(Poco::IntPtr) == sizeof(void*)); - assert (sizeof(Poco::UIntPtr) == sizeof(void*)); + assertTrue (sizeof(Poco::IntPtr) == sizeof(void*)); + assertTrue (sizeof(Poco::UIntPtr) == sizeof(void*)); } @@ -183,8 +183,8 @@ void CoreTest::testEnvironment() { #if !defined(_WIN32_WCE) Environment::set("FOO", "BAR"); - assert (Environment::has("FOO")); - assert (Environment::get("FOO") == "BAR"); + assertTrue (Environment::has("FOO")); + assertTrue (Environment::get("FOO") == "BAR"); #endif try { @@ -209,26 +209,26 @@ void CoreTest::testBuffer() { std::size_t s = 10; Buffer b(s); - assert (b.size() == s); - assert (b.sizeBytes() == s * sizeof(int)); - assert (b.capacity() == s); - assert (b.capacityBytes() == s * sizeof(int)); + assertTrue (b.size() == s); + assertTrue (b.sizeBytes() == s * sizeof(int)); + assertTrue (b.capacity() == s); + assertTrue (b.capacityBytes() == s * sizeof(int)); std::vector v; for (int i = 0; i < s; ++i) v.push_back(i); std::memcpy(b.begin(), &v[0], sizeof(int) * v.size()); - assert (s == b.size()); + assertTrue (s == b.size()); for (int i = 0; i < s; ++i) - assert (b[i] == i); + assertTrue (b[i] == i); b.resize(s/2); for (int i = 0; i < s/2; ++i) - assert (b[i] == i); + assertTrue (b[i] == i); - assert (b.size() == s/2); - assert (b.capacity() == s); + assertTrue (b.size() == s/2); + assertTrue (b.capacity() == s); b.resize(s*2); v.clear(); @@ -238,18 +238,18 @@ void CoreTest::testBuffer() std::memcpy(b.begin(), &v[0], sizeof(int) * v.size()); for (int i = 0; i < s*2; ++i) - assert (b[i] == i); + assertTrue (b[i] == i); - assert (b.size() == s*2); - assert (b.capacity() == s*2); + assertTrue (b.size() == s*2); + assertTrue (b.capacity() == s*2); b.setCapacity(s * 4); - assert (b.size() == s*2); - assert (b.capacity() == s*4); + assertTrue (b.size() == s*2); + assertTrue (b.capacity() == s*4); b.setCapacity(s); - assert (b.size() == s); - assert (b.capacity() == s); + assertTrue (b.size() == s); + assertTrue (b.capacity() == s); #if ENABLE_BUGCHECK_TEST try { int i = b[s]; fail ("must fail"); } @@ -258,28 +258,28 @@ void CoreTest::testBuffer() Buffer c(s); Buffer d(c); - assert (c == d); + assertTrue (c == d); c[1] = -1; - assert (c[1] == -1); + assertTrue (c[1] == -1); c.clear(); - assert (c[1] == 0); + assertTrue (c[1] == 0); Buffer e(0); - assert (e.empty()); + assertTrue (e.empty()); - assert (c != e); + assertTrue (c != e); Buffer f = e; - assert (f == e); + assertTrue (f == e); Buffer g(0); g.append("hello", 5); - assert (g.size() == 5); + assertTrue (g.size() == 5); g.append("hello", 5); - assert (g.size() == 10); - assert ( !std::memcmp(g.begin(), "hellohello", 10) ); + assertTrue (g.size() == 10); + assertTrue ( !std::memcmp(g.begin(), "hellohello", 10) ); char h[10]; Buffer buf(h, 10); @@ -291,28 +291,28 @@ void CoreTest::testBuffer() catch (InvalidAccessException&) { } buf.assign("hello", 5); - assert ( !std::memcmp(&h[0], "hello", 5) ); + assertTrue ( !std::memcmp(&h[0], "hello", 5) ); const char j[10] = "hello"; Buffer k(j, 5); k.append("hello", 5); - assert ( !std::memcmp(&j[0], "hello", 5) ); - assert ( !std::memcmp(k.begin(), "hellohello", 10) ); + assertTrue ( !std::memcmp(&j[0], "hello", 5) ); + assertTrue ( !std::memcmp(k.begin(), "hellohello", 10) ); k.append('w'); - assert (k.size() == 11); - assert ( !std::memcmp(k.begin(), "hellohellow", k.size()) ); + assertTrue (k.size() == 11); + assertTrue ( !std::memcmp(k.begin(), "hellohellow", k.size()) ); k.append('o'); - assert (k.size() == 12); - assert ( !std::memcmp(k.begin(), "hellohellowo", k.size()) ); + assertTrue (k.size() == 12); + assertTrue ( !std::memcmp(k.begin(), "hellohellowo", k.size()) ); k.append('r'); - assert (k.size() == 13); - assert ( !std::memcmp(k.begin(), "hellohellowor", k.size()) ); + assertTrue (k.size() == 13); + assertTrue ( !std::memcmp(k.begin(), "hellohellowor", k.size()) ); k.append('l'); - assert (k.size() == 14); - assert ( !std::memcmp(k.begin(), "hellohelloworl", k.size()) ); + assertTrue (k.size() == 14); + assertTrue ( !std::memcmp(k.begin(), "hellohelloworl", k.size()) ); k.append('d'); - assert (k.size() == 15); - assert ( !std::memcmp(k.begin(), "hellohelloworld", k.size()) ); + assertTrue (k.size() == 15); + assertTrue ( !std::memcmp(k.begin(), "hellohelloworld", k.size()) ); } @@ -322,8 +322,8 @@ void CoreTest::testFIFOBufferEOFAndError() FIFOBuffer f(20, true); - assert (f.isEmpty()); - assert (!f.isFull()); + assertTrue (f.isEmpty()); + assertTrue (!f.isFull()); Buffer b(10); std::vector v; @@ -335,55 +335,55 @@ void CoreTest::testFIFOBufferEOFAndError() v.push_back(c); std::memcpy(b.begin(), &v[0], sizeof(T) * v.size()); - assert(0 == _notToReadable); - assert(0 == _readableToNot); - assert (10 == f.write(b)); - assert(1 == _notToReadable); - assert(0 == _readableToNot); - assert (20 == f.size()); - assert (10 == f.used()); - assert (!f.isEmpty()); + assertTrue (0 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (10 == f.write(b)); + assertTrue (1 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (10 == f.used()); + assertTrue (!f.isEmpty()); f.setEOF(); - assert(0 == _notToWritable); - assert(1 == _writableToNot); - assert (f.hasEOF()); - assert (!f.isEOF()); - assert(1 == _notToReadable); - assert(0 == _readableToNot); - assert (20 == f.size()); - assert (10 == f.used()); - assert (0 == f.write(b)); - assert (!f.isEmpty()); - assert (5 == f.read(b, 5)); - assert(1 == _notToReadable); - assert(0 == _readableToNot); - assert (f.hasEOF()); - assert (!f.isEOF()); - assert (5 == f.read(b, 5)); - assert(1 == _notToReadable); - assert(1 == _readableToNot); - assert (f.hasEOF()); - assert (f.isEOF()); - assert(0 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (0 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (f.hasEOF()); + assertTrue (!f.isEOF()); + assertTrue (1 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (10 == f.used()); + assertTrue (0 == f.write(b)); + assertTrue (!f.isEmpty()); + assertTrue (5 == f.read(b, 5)); + assertTrue (1 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (f.hasEOF()); + assertTrue (!f.isEOF()); + assertTrue (5 == f.read(b, 5)); + assertTrue (1 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (f.hasEOF()); + assertTrue (f.isEOF()); + assertTrue (0 == _notToWritable); + assertTrue (1 == _writableToNot); f.setEOF(false); - assert (!f.hasEOF()); - assert (!f.isEOF()); - assert(1 == _notToWritable); - assert(1 == _writableToNot); - assert(1 == _notToReadable); - assert(1 == _readableToNot); + assertTrue (!f.hasEOF()); + assertTrue (!f.isEOF()); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _readableToNot); - assert (5 == f.write(b)); - assert(1 == _notToWritable); - assert(1 == _writableToNot); - assert(2 == _notToReadable); - assert(1 == _readableToNot); - assert (20 == f.size()); - assert (5 == f.used()); + assertTrue (5 == f.write(b)); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (2 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); f.setError(); - assert (0 == f.write(b)); + assertTrue (0 == f.write(b)); try { @@ -399,26 +399,26 @@ void CoreTest::testFIFOBufferEOFAndError() } catch (InvalidAccessException&) { } - assert(1 == _notToWritable); - assert(2 == _writableToNot); - assert(2 == _notToReadable); - assert(2 == _readableToNot); - assert (20 == f.size()); - assert (0 == f.used()); + assertTrue (1 == _notToWritable); + assertTrue (2 == _writableToNot); + assertTrue (2 == _notToReadable); + assertTrue (2 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (0 == f.used()); f.setError(false); - assert(2 == _notToWritable); - assert(2 == _writableToNot); - assert(2 == _notToReadable); - assert(2 == _readableToNot); - assert (20 == f.size()); - assert (0 == f.used()); - assert (5 == f.write(b)); - assert(2 == _notToWritable); - assert(2 == _writableToNot); - assert(3 == _notToReadable); - assert(2 == _readableToNot); - assert (20 == f.size()); - assert (5 == f.used()); + assertTrue (2 == _notToWritable); + assertTrue (2 == _writableToNot); + assertTrue (2 == _notToReadable); + assertTrue (2 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (0 == f.used()); + assertTrue (5 == f.write(b)); + assertTrue (2 == _notToWritable); + assertTrue (2 == _writableToNot); + assertTrue (3 == _notToReadable); + assertTrue (2 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); } @@ -428,8 +428,8 @@ void CoreTest::testFIFOBufferChar() FIFOBuffer f(20, true); - assert (f.isEmpty()); - assert (!f.isFull()); + assertTrue (f.isEmpty()); + assertTrue (!f.isFull()); Buffer b(10); std::vector v; @@ -441,35 +441,35 @@ void CoreTest::testFIFOBufferChar() v.push_back(c); std::memcpy(b.begin(), &v[0], sizeof(T) * v.size()); - assert(0 == _notToReadable); - assert(0 == _readableToNot); + assertTrue (0 == _notToReadable); + assertTrue (0 == _readableToNot); f.write(b); - assert(1 == _notToReadable); - assert(0 == _readableToNot); - assert (20 == f.size()); - assert (10 == f.used()); - assert (!f.isEmpty()); - assert ('0' == f[0]); - assert ('1' == f[1]); - assert ('2' == f[2]); - assert ('3' == f[3]); - assert ('4' == f[4]); - assert ('5' == f[5]); - assert ('6' == f[6]); - assert ('7' == f[7]); - assert ('8' == f[8]); - assert ('9' == f[9]); + assertTrue (1 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (20 == f.size()); + assertTrue (10 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue ('0' == f[0]); + assertTrue ('1' == f[1]); + assertTrue ('2' == f[2]); + assertTrue ('3' == f[3]); + assertTrue ('4' == f[4]); + assertTrue ('5' == f[5]); + assertTrue ('6' == f[6]); + assertTrue ('7' == f[7]); + assertTrue ('8' == f[8]); + assertTrue ('9' == f[9]); b.resize(5); f.read(b, b.size()); - assert (20 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert ('5' == f[0]); - assert ('6' == f[1]); - assert ('7' == f[2]); - assert ('8' == f[3]); - assert ('9' == f[4]); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue ('5' == f[0]); + assertTrue ('6' == f[1]); + assertTrue ('7' == f[2]); + assertTrue ('8' == f[3]); + assertTrue ('9' == f[4]); try { T POCO_UNUSED i = f[10]; fail ("must fail"); } catch (InvalidAccessException&) { } @@ -480,97 +480,97 @@ void CoreTest::testFIFOBufferChar() b.resize(10); std::memcpy(b.begin(), &v[0], sizeof(T) * v.size()); f.write(b); - assert (20 == f.size()); - assert (15 == f.used()); - assert (!f.isEmpty()); - assert ('5' == f[0]); - assert ('6' == f[1]); - assert ('7' == f[2]); - assert ('8' == f[3]); - assert ('9' == f[4]); - assert ('a' == f[5]); - assert ('b' == f[6]); - assert ('c' == f[7]); - assert ('d' == f[8]); - assert ('e' == f[9]); - assert ('f' == f[10]); - assert ('g' == f[11]); - assert ('h' == f[12]); - assert ('i' == f[13]); - assert ('j' == f[14]); + assertTrue (20 == f.size()); + assertTrue (15 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue ('5' == f[0]); + assertTrue ('6' == f[1]); + assertTrue ('7' == f[2]); + assertTrue ('8' == f[3]); + assertTrue ('9' == f[4]); + assertTrue ('a' == f[5]); + assertTrue ('b' == f[6]); + assertTrue ('c' == f[7]); + assertTrue ('d' == f[8]); + assertTrue ('e' == f[9]); + assertTrue ('f' == f[10]); + assertTrue ('g' == f[11]); + assertTrue ('h' == f[12]); + assertTrue ('i' == f[13]); + assertTrue ('j' == f[14]); try { T POCO_UNUSED i = f[15]; fail ("must fail"); } catch (InvalidAccessException&) { } f.read(b, 10); - assert (20 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert ('f' == f[0]); - assert ('g' == f[1]); - assert ('h' == f[2]); - assert ('i' == f[3]); - assert ('j' == f[4]); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue ('f' == f[0]); + assertTrue ('g' == f[1]); + assertTrue ('h' == f[2]); + assertTrue ('i' == f[3]); + assertTrue ('j' == f[4]); try { T POCO_UNUSED i = f[5]; fail ("must fail"); } catch (InvalidAccessException&) { } - assert(1 == _notToReadable); - assert(0 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); + assertTrue (1 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); f.read(b, 6); - assert(1 == _notToReadable); - assert(1 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); - assert (5 == b.size()); - assert (20 == f.size()); - assert (0 == f.used()); + assertTrue (5 == b.size()); + assertTrue (20 == f.size()); + assertTrue (0 == f.used()); try { T POCO_UNUSED i = f[0]; fail ("must fail"); } catch (InvalidAccessException&) { } - assert (f.isEmpty()); + assertTrue (f.isEmpty()); - assert(1 == _notToReadable); - assert(1 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); - assert (5 == f.write(b)); - assert(2 == _notToReadable); - assert(1 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); + assertTrue (5 == f.write(b)); + assertTrue (2 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); - assert (20 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert ('f' == f[0]); - assert ('g' == f[1]); - assert ('h' == f[2]); - assert ('i' == f[3]); - assert ('j' == f[4]); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue ('f' == f[0]); + assertTrue ('g' == f[1]); + assertTrue ('h' == f[2]); + assertTrue ('i' == f[3]); + assertTrue ('j' == f[4]); f.resize(10); - assert (10 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert ('f' == f[0]); - assert ('g' == f[1]); - assert ('h' == f[2]); - assert ('i' == f[3]); - assert ('j' == f[4]); + assertTrue (10 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue ('f' == f[0]); + assertTrue ('g' == f[1]); + assertTrue ('h' == f[2]); + assertTrue ('i' == f[3]); + assertTrue ('j' == f[4]); - assert(2 == _notToReadable); - assert(1 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); + assertTrue (2 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); f.resize(3, false); - assert(2 == _notToReadable); - assert(2 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); - assert (3 == f.size()); - assert (0 == f.used()); - assert (f.isEmpty()); + assertTrue (2 == _notToReadable); + assertTrue (2 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); + assertTrue (3 == f.size()); + assertTrue (0 == f.used()); + assertTrue (f.isEmpty()); b.resize(3); b[0] = 'x'; @@ -578,115 +578,115 @@ void CoreTest::testFIFOBufferChar() b[2] = 'z'; f.resize(3); - assert(2 == _notToReadable); - assert(2 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); + assertTrue (2 == _notToReadable); + assertTrue (2 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); f.write(b); - assert(3 == _notToReadable); - assert(2 == _readableToNot); - assert(0 == _notToWritable); - assert(1 == _writableToNot); - assert (f.isFull()); + assertTrue (3 == _notToReadable); + assertTrue (2 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (f.isFull()); f.read(b); - assert(3 == _notToReadable); - assert(3 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); - assert (f.isEmpty()); + assertTrue (3 == _notToReadable); + assertTrue (3 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (f.isEmpty()); f.resize(10); - assert (10 == f.size()); - assert (0 == f.used()); - assert (10 == f.available()); - assert (f.isEmpty()); + assertTrue (10 == f.size()); + assertTrue (0 == f.used()); + assertTrue (10 == f.available()); + assertTrue (f.isEmpty()); - assert(3 == _notToReadable); - assert(3 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (3 == _notToReadable); + assertTrue (3 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); f.write(b); - assert(4 == _notToReadable); - assert(3 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (4 == _notToReadable); + assertTrue (3 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); - assert (10 == f.size()); - assert (3 == f.used()); - assert (7 == f.available()); - assert (!f.isEmpty()); + assertTrue (10 == f.size()); + assertTrue (3 == f.used()); + assertTrue (7 == f.available()); + assertTrue (!f.isEmpty()); f.drain(1); - assert(4 == _notToReadable); - assert(3 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (4 == _notToReadable); + assertTrue (3 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); - assert (10 == f.size()); - assert (2 == f.used()); - assert (8 == f.available()); - assert (!f.isEmpty()); + assertTrue (10 == f.size()); + assertTrue (2 == f.used()); + assertTrue (8 == f.available()); + assertTrue (!f.isEmpty()); f.drain(2); - assert(4 == _notToReadable); - assert(4 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (4 == _notToReadable); + assertTrue (4 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); - assert (10 == f.size()); - assert (0 == f.used()); - assert (10 == f.available()); - assert (f.isEmpty()); + assertTrue (10 == f.size()); + assertTrue (0 == f.used()); + assertTrue (10 == f.available()); + assertTrue (f.isEmpty()); f.write(b); - assert(5 == _notToReadable); - assert(4 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (5 == _notToReadable); + assertTrue (4 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); - assert (10 == f.size()); - assert (3 == f.used()); - assert (7 == f.available()); - assert (!f.isEmpty()); + assertTrue (10 == f.size()); + assertTrue (3 == f.used()); + assertTrue (7 == f.available()); + assertTrue (!f.isEmpty()); f.drain(); - assert(5 == _notToReadable); - assert(5 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); - assert (10 == f.size()); - assert (0 == f.used()); - assert (10 == f.available()); - assert (f.isEmpty()); + assertTrue (5 == _notToReadable); + assertTrue (5 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (10 == f.size()); + assertTrue (0 == f.used()); + assertTrue (10 == f.available()); + assertTrue (f.isEmpty()); f.write(b, 2); - assert (10 == f.size()); - assert (2 == f.used()); - assert (8 == f.available()); - assert (!f.isEmpty()); + assertTrue (10 == f.size()); + assertTrue (2 == f.used()); + assertTrue (8 == f.available()); + assertTrue (!f.isEmpty()); - assert(6 == _notToReadable); - assert(5 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (6 == _notToReadable); + assertTrue (5 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); f.drain(); - assert(6 == _notToReadable); - assert(6 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (6 == _notToReadable); + assertTrue (6 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); - assert (3 == f.write(b, 10)); - assert (10 == f.size()); - assert (3 == f.used()); - assert (7 == f.available()); - assert (!f.isEmpty()); + assertTrue (3 == f.write(b, 10)); + assertTrue (10 == f.size()); + assertTrue (3 == f.used()); + assertTrue (7 == f.available()); + assertTrue (!f.isEmpty()); - assert(7 == _notToReadable); - assert(6 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (7 == _notToReadable); + assertTrue (6 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); const char arr[3] = {'4', '5', '6' }; try @@ -696,25 +696,25 @@ void CoreTest::testFIFOBufferChar() } catch (InvalidAccessException&) { } f.copy(&arr[0], 3); - assert(7 == _notToReadable); - assert(6 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (7 == _notToReadable); + assertTrue (6 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); - assert (10 == f.size()); - assert (6 == f.used()); - assert (4 == f.available()); + assertTrue (10 == f.size()); + assertTrue (6 == f.used()); + assertTrue (4 == f.available()); f.copy(&arr[0], 4); - assert(7 == _notToReadable); - assert(6 == _readableToNot); - assert(1 == _notToWritable); - assert(2 == _writableToNot); - assert (f.isFull()); + assertTrue (7 == _notToReadable); + assertTrue (6 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (2 == _writableToNot); + assertTrue (f.isFull()); - assert (10 == f.size()); - assert (10 == f.used()); - assert (0 == f.available()); + assertTrue (10 == f.size()); + assertTrue (10 == f.used()); + assertTrue (0 == f.available()); try { @@ -723,37 +723,37 @@ void CoreTest::testFIFOBufferChar() } catch (InvalidAccessException&) { } f.drain(1); - assert(7 == _notToReadable); - assert(6 == _readableToNot); - assert(2 == _notToWritable); - assert(2 == _writableToNot); + assertTrue (7 == _notToReadable); + assertTrue (6 == _readableToNot); + assertTrue (2 == _notToWritable); + assertTrue (2 == _writableToNot); f.drain(9); - assert (10 == f.size()); - assert (0 == f.used()); - assert (10 == f.available()); + assertTrue (10 == f.size()); + assertTrue (0 == f.used()); + assertTrue (10 == f.available()); const char e[10] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; f.copy(&e[0], 10); - assert (10 == f.size()); - assert (10 == f.used()); - assert (0 == f.available()); + assertTrue (10 == f.size()); + assertTrue (10 == f.used()); + assertTrue (0 == f.available()); f.drain(1); f.write(e, 1); - assert (10 == f.size()); - assert (10 == f.used()); - assert (0 == f.available()); + assertTrue (10 == f.size()); + assertTrue (10 == f.used()); + assertTrue (0 == f.available()); - assert(f[0] == '2'); - assert(f[1] == '3'); - assert(f[2] == '4'); - assert(f[3] == '5'); - assert(f[4] == '6'); - assert(f[5] == '7'); - assert(f[6] == '8'); - assert(f[7] == '9'); - assert(f[8] == '0'); - assert(f[9] == '1'); + assertTrue (f[0] == '2'); + assertTrue (f[1] == '3'); + assertTrue (f[2] == '4'); + assertTrue (f[3] == '5'); + assertTrue (f[4] == '6'); + assertTrue (f[5] == '7'); + assertTrue (f[6] == '8'); + assertTrue (f[7] == '9'); + assertTrue (f[8] == '0'); + assertTrue (f[9] == '1'); f.readable -= delegate(this, &CoreTest::onReadable); f.writable -= delegate(this, &CoreTest::onReadable); @@ -773,30 +773,30 @@ void CoreTest::testFIFOBufferInt() std::memcpy(b.begin(), &v[0], sizeof(T) * v.size()); f.write(b); - assert (20 == f.size()); - assert (10 == f.used()); - assert (!f.isEmpty()); - assert (0 == f[0]); - assert (1 == f[1]); - assert (2 == f[2]); - assert (3 == f[3]); - assert (4 == f[4]); - assert (5 == f[5]); - assert (6 == f[6]); - assert (7 == f[7]); - assert (8 == f[8]); - assert (9 == f[9]); + assertTrue (20 == f.size()); + assertTrue (10 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue (0 == f[0]); + assertTrue (1 == f[1]); + assertTrue (2 == f[2]); + assertTrue (3 == f[3]); + assertTrue (4 == f[4]); + assertTrue (5 == f[5]); + assertTrue (6 == f[6]); + assertTrue (7 == f[7]); + assertTrue (8 == f[8]); + assertTrue (9 == f[9]); b.resize(5); f.read(b, b.size()); - assert (20 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert (5 == f[0]); - assert (6 == f[1]); - assert (7 == f[2]); - assert (8 == f[3]); - assert (9 == f[4]); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue (5 == f[0]); + assertTrue (6 == f[1]); + assertTrue (7 == f[2]); + assertTrue (8 == f[3]); + assertTrue (9 == f[4]); try { T POCO_UNUSED i = f[10]; fail ("must fail"); } catch (InvalidAccessException&) { } @@ -807,99 +807,99 @@ void CoreTest::testFIFOBufferInt() b.resize(10); std::memcpy(b.begin(), &v[0], sizeof(T) * v.size()); f.write(b); - assert (20 == f.size()); - assert (15 == f.used()); - assert (!f.isEmpty()); - assert (5 == f[0]); - assert (6 == f[1]); - assert (7 == f[2]); - assert (8 == f[3]); - assert (9 == f[4]); - assert (10 == f[5]); - assert (11 == f[6]); - assert (12 == f[7]); - assert (13 == f[8]); - assert (14 == f[9]); - assert (15 == f[10]); - assert (16 == f[11]); - assert (17 == f[12]); - assert (18 == f[13]); - assert (19 == f[14]); + assertTrue (20 == f.size()); + assertTrue (15 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue (5 == f[0]); + assertTrue (6 == f[1]); + assertTrue (7 == f[2]); + assertTrue (8 == f[3]); + assertTrue (9 == f[4]); + assertTrue (10 == f[5]); + assertTrue (11 == f[6]); + assertTrue (12 == f[7]); + assertTrue (13 == f[8]); + assertTrue (14 == f[9]); + assertTrue (15 == f[10]); + assertTrue (16 == f[11]); + assertTrue (17 == f[12]); + assertTrue (18 == f[13]); + assertTrue (19 == f[14]); try { T POCO_UNUSED i = f[15]; fail ("must fail"); } catch (InvalidAccessException&) { } f.read(b, 10); - assert (20 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert (15 == f[0]); - assert (16 == f[1]); - assert (17 == f[2]); - assert (18 == f[3]); - assert (19 == f[4]); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue (15 == f[0]); + assertTrue (16 == f[1]); + assertTrue (17 == f[2]); + assertTrue (18 == f[3]); + assertTrue (19 == f[4]); try { T POCO_UNUSED i = f[5]; fail ("must fail"); } catch (InvalidAccessException&) { } f.read(b, 6); - assert (5 == b.size()); - assert (20 == f.size()); - assert (0 == f.used()); + assertTrue (5 == b.size()); + assertTrue (20 == f.size()); + assertTrue (0 == f.used()); try { T POCO_UNUSED i = f[0]; fail ("must fail"); } catch (InvalidAccessException&) { } - assert (f.isEmpty()); + assertTrue (f.isEmpty()); - assert (5 == f.write(b)); - assert (20 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert (15 == f[0]); - assert (16 == f[1]); - assert (17 == f[2]); - assert (18 == f[3]); - assert (19 == f[4]); + assertTrue (5 == f.write(b)); + assertTrue (20 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue (15 == f[0]); + assertTrue (16 == f[1]); + assertTrue (17 == f[2]); + assertTrue (18 == f[3]); + assertTrue (19 == f[4]); f.resize(10); - assert (10 == f.size()); - assert (5 == f.used()); - assert (!f.isEmpty()); - assert (15 == f[0]); - assert (16 == f[1]); - assert (17 == f[2]); - assert (18 == f[3]); - assert(19 == f[4]); + assertTrue (10 == f.size()); + assertTrue (5 == f.used()); + assertTrue (!f.isEmpty()); + assertTrue (15 == f[0]); + assertTrue (16 == f[1]); + assertTrue (17 == f[2]); + assertTrue (18 == f[3]); + assertTrue (19 == f[4]); f.drain(9); - assert(10 == f.size()); - assert(0 == f.used()); - assert(10 == f.available()); + assertTrue (10 == f.size()); + assertTrue (0 == f.used()); + assertTrue (10 == f.available()); const int e[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }; f.copy(&e[0], 10); - assert(10 == f.size()); - assert(10 == f.used()); - assert(0 == f.available()); + assertTrue (10 == f.size()); + assertTrue (10 == f.used()); + assertTrue (0 == f.available()); f.drain(1); f.write(e, 1); - assert(10 == f.size()); - assert(10 == f.used()); - assert(0 == f.available()); + assertTrue (10 == f.size()); + assertTrue (10 == f.used()); + assertTrue (0 == f.available()); - assert(f[0] == 2); - assert(f[1] == 3); - assert(f[2] == 4); - assert(f[3] == 5); - assert(f[4] == 6); - assert(f[5] == 7); - assert(f[6] == 8); - assert(f[7] == 9); - assert(f[8] == 0); - assert(f[9] == 1); + assertTrue (f[0] == 2); + assertTrue (f[1] == 3); + assertTrue (f[2] == 4); + assertTrue (f[3] == 5); + assertTrue (f[4] == 6); + assertTrue (f[5] == 7); + assertTrue (f[6] == 8); + assertTrue (f[7] == 9); + assertTrue (f[8] == 0); + assertTrue (f[9] == 1); f.resize(3, false); - assert (3 == f.size()); - assert (0 == f.used()); - assert (f.isEmpty()); + assertTrue (3 == f.size()); + assertTrue (0 == f.used()); + assertTrue (f.isEmpty()); } @@ -907,20 +907,20 @@ void CoreTest::testAtomicCounter() { AtomicCounter ac; - assert (ac.value() == 0); - assert (ac++ == 0); - assert (ac-- == 1); - assert (++ac == 1); - assert (--ac == 0); + assertTrue (ac.value() == 0); + assertTrue (ac++ == 0); + assertTrue (ac-- == 1); + assertTrue (++ac == 1); + assertTrue (--ac == 0); ac = 2; - assert (ac.value() == 2); + assertTrue (ac.value() == 2); ac = 0; - assert (ac.value() == 0); + assertTrue (ac.value() == 0); AtomicCounter ac2(2); - assert (ac2.value() == 2); + assertTrue (ac2.value() == 2); ACTRunnable act(ac); Thread t1; @@ -941,7 +941,7 @@ void CoreTest::testAtomicCounter() t4.join(); t5.join(); - assert (ac.value() == 0); + assertTrue (ac.value() == 0); } @@ -951,39 +951,39 @@ void CoreTest::testNullable() Nullable f; Nullable s; - assert (i.isNull()); - assert (f.isNull()); - assert (s.isNull()); + assertTrue (i.isNull()); + assertTrue (f.isNull()); + assertTrue (s.isNull()); i = 1; f = 1.5; s = "abc"; - assert (!i.isNull()); - assert (!f.isNull()); - assert (!s.isNull()); + assertTrue (!i.isNull()); + assertTrue (!f.isNull()); + assertTrue (!s.isNull()); - assert (i == 1); - assert (f == 1.5); - assert (s == "abc"); + assertTrue (i == 1); + assertTrue (f == 1.5); + assertTrue (s == "abc"); i.clear(); f.clear(); s.clear(); - assert (i.isNull()); - assert (f.isNull()); - assert (s.isNull()); + assertTrue (i.isNull()); + assertTrue (f.isNull()); + assertTrue (s.isNull()); Nullable n1; - assert (n1.isNull()); + assertTrue (n1.isNull()); - assert (n1.value(42) == 42); - assert (n1.isNull()); - assert (!(0 == n1)); - assert (0 != n1); - assert (!(n1 == 0)); - assert (n1 != 0); + assertTrue (n1.value(42) == 42); + assertTrue (n1.isNull()); + assertTrue (!(0 == n1)); + assertTrue (0 != n1); + assertTrue (!(n1 == 0)); + assertTrue (n1 != 0); try { @@ -995,126 +995,126 @@ void CoreTest::testNullable() } n1 = 1; - assert (!n1.isNull()); - assert (n1.value() == 1); + assertTrue (!n1.isNull()); + assertTrue (n1.value() == 1); Nullable n2(42); - assert (!n2.isNull()); - assert (n2.value() == 42); - assert (n2.value(99) == 42); + assertTrue (!n2.isNull()); + assertTrue (n2.value() == 42); + assertTrue (n2.value(99) == 42); - assert (!(0 == n2)); - assert (0 != n2); - assert (!(n2 == 0)); - assert (n2 != 0); + assertTrue (!(0 == n2)); + assertTrue (0 != n2); + assertTrue (!(n2 == 0)); + assertTrue (n2 != 0); n1 = n2; - assert (!n1.isNull()); - assert (n1.value() == 42); + assertTrue (!n1.isNull()); + assertTrue (n1.value() == 42); std::ostringstream str; str << n1; - assert (str.str() == "42"); + assertTrue (str.str() == "42"); n1.clear(); - assert (n1.isNull()); + assertTrue (n1.isNull()); str.str(""); str << n1; - assert (str.str().empty()); + assertTrue (str.str().empty()); n2.clear(); - assert (n1 == n2); + assertTrue (n1 == n2); n1 = 1; n2 = 1; - assert (n1 == n2); + assertTrue (n1 == n2); n1.clear(); - assert (n1 < n2); - assert (n2 > n1); + assertTrue (n1 < n2); + assertTrue (n2 > n1); n2 = -1; n1 = 0; - assert (n2 < n1); - assert (n2 != n1); - assert (n1 > n2); + assertTrue (n2 < n1); + assertTrue (n2 != n1); + assertTrue (n1 > n2); NullType nd; - assert (n1 != nd); - assert (nd != n1); + assertTrue (n1 != nd); + assertTrue (nd != n1); n1.clear(); - assert (n1 == nd); - assert (nd == n1); + assertTrue (n1 == nd); + assertTrue (nd == n1); } void CoreTest::testAscii() { - assert (Ascii::isAscii('A')); - assert (!Ascii::isAscii(-1)); - assert (!Ascii::isAscii(128)); - assert (!Ascii::isAscii(222)); + assertTrue (Ascii::isAscii('A')); + assertTrue (!Ascii::isAscii(-1)); + assertTrue (!Ascii::isAscii(128)); + assertTrue (!Ascii::isAscii(222)); - assert (Ascii::isSpace(' ')); - assert (Ascii::isSpace('\t')); - assert (Ascii::isSpace('\r')); - assert (Ascii::isSpace('\n')); - assert (!Ascii::isSpace('A')); - assert (!Ascii::isSpace(-1)); - assert (!Ascii::isSpace(222)); + assertTrue (Ascii::isSpace(' ')); + assertTrue (Ascii::isSpace('\t')); + assertTrue (Ascii::isSpace('\r')); + assertTrue (Ascii::isSpace('\n')); + assertTrue (!Ascii::isSpace('A')); + assertTrue (!Ascii::isSpace(-1)); + assertTrue (!Ascii::isSpace(222)); - assert (Ascii::isDigit('0')); - assert (Ascii::isDigit('1')); - assert (Ascii::isDigit('2')); - assert (Ascii::isDigit('3')); - assert (Ascii::isDigit('4')); - assert (Ascii::isDigit('5')); - assert (Ascii::isDigit('6')); - assert (Ascii::isDigit('7')); - assert (Ascii::isDigit('8')); - assert (Ascii::isDigit('9')); - assert (!Ascii::isDigit('a')); + assertTrue (Ascii::isDigit('0')); + assertTrue (Ascii::isDigit('1')); + assertTrue (Ascii::isDigit('2')); + assertTrue (Ascii::isDigit('3')); + assertTrue (Ascii::isDigit('4')); + assertTrue (Ascii::isDigit('5')); + assertTrue (Ascii::isDigit('6')); + assertTrue (Ascii::isDigit('7')); + assertTrue (Ascii::isDigit('8')); + assertTrue (Ascii::isDigit('9')); + assertTrue (!Ascii::isDigit('a')); - assert (Ascii::isHexDigit('0')); - assert (Ascii::isHexDigit('1')); - assert (Ascii::isHexDigit('2')); - assert (Ascii::isHexDigit('3')); - assert (Ascii::isHexDigit('4')); - assert (Ascii::isHexDigit('5')); - assert (Ascii::isHexDigit('6')); - assert (Ascii::isHexDigit('7')); - assert (Ascii::isHexDigit('8')); - assert (Ascii::isHexDigit('9')); - assert (Ascii::isHexDigit('a')); - assert (Ascii::isHexDigit('b')); - assert (Ascii::isHexDigit('c')); - assert (Ascii::isHexDigit('d')); - assert (Ascii::isHexDigit('e')); - assert (Ascii::isHexDigit('f')); - assert (Ascii::isHexDigit('A')); - assert (Ascii::isHexDigit('B')); - assert (Ascii::isHexDigit('C')); - assert (Ascii::isHexDigit('D')); - assert (Ascii::isHexDigit('E')); - assert (Ascii::isHexDigit('F')); - assert (!Ascii::isHexDigit('G')); + assertTrue (Ascii::isHexDigit('0')); + assertTrue (Ascii::isHexDigit('1')); + assertTrue (Ascii::isHexDigit('2')); + assertTrue (Ascii::isHexDigit('3')); + assertTrue (Ascii::isHexDigit('4')); + assertTrue (Ascii::isHexDigit('5')); + assertTrue (Ascii::isHexDigit('6')); + assertTrue (Ascii::isHexDigit('7')); + assertTrue (Ascii::isHexDigit('8')); + assertTrue (Ascii::isHexDigit('9')); + assertTrue (Ascii::isHexDigit('a')); + assertTrue (Ascii::isHexDigit('b')); + assertTrue (Ascii::isHexDigit('c')); + assertTrue (Ascii::isHexDigit('d')); + assertTrue (Ascii::isHexDigit('e')); + assertTrue (Ascii::isHexDigit('f')); + assertTrue (Ascii::isHexDigit('A')); + assertTrue (Ascii::isHexDigit('B')); + assertTrue (Ascii::isHexDigit('C')); + assertTrue (Ascii::isHexDigit('D')); + assertTrue (Ascii::isHexDigit('E')); + assertTrue (Ascii::isHexDigit('F')); + assertTrue (!Ascii::isHexDigit('G')); - assert (Ascii::isPunct('.')); - assert (Ascii::isPunct(',')); - assert (!Ascii::isPunct('A')); + assertTrue (Ascii::isPunct('.')); + assertTrue (Ascii::isPunct(',')); + assertTrue (!Ascii::isPunct('A')); - assert (Ascii::isAlpha('a')); - assert (Ascii::isAlpha('Z')); - assert (!Ascii::isAlpha('0')); + assertTrue (Ascii::isAlpha('a')); + assertTrue (Ascii::isAlpha('Z')); + assertTrue (!Ascii::isAlpha('0')); - assert (Ascii::isLower('a')); - assert (!Ascii::isLower('A')); + assertTrue (Ascii::isLower('a')); + assertTrue (!Ascii::isLower('A')); - assert (Ascii::isUpper('A')); - assert (!Ascii::isUpper('a')); + assertTrue (Ascii::isUpper('A')); + assertTrue (!Ascii::isUpper('a')); - assert (Ascii::toLower('A') == 'a'); - assert (Ascii::toLower('z') == 'z'); - assert (Ascii::toLower('0') == '0'); + assertTrue (Ascii::toLower('A') == 'a'); + assertTrue (Ascii::toLower('z') == 'z'); + assertTrue (Ascii::toLower('0') == '0'); - assert (Ascii::toUpper('a') == 'A'); - assert (Ascii::toUpper('0') == '0'); - assert (Ascii::toUpper('Z') == 'Z'); + assertTrue (Ascii::toUpper('a') == 'A'); + assertTrue (Ascii::toUpper('0') == '0'); + assertTrue (Ascii::toUpper('Z') == 'Z'); } diff --git a/Foundation/testsuite/src/CountingStreamTest.cpp b/Foundation/testsuite/src/CountingStreamTest.cpp index 9c3c3cc48..8cd8784d4 100644 --- a/Foundation/testsuite/src/CountingStreamTest.cpp +++ b/Foundation/testsuite/src/CountingStreamTest.cpp @@ -35,23 +35,23 @@ void CountingStreamTest::testInput() std::istringstream istr1("foo"); CountingInputStream ci1(istr1); while (ci1.good()) ci1.get(c); - assert (ci1.lines() == 1); - assert (ci1.chars() == 3); - assert (ci1.pos() == 3); + assertTrue (ci1.lines() == 1); + assertTrue (ci1.chars() == 3); + assertTrue (ci1.pos() == 3); std::istringstream istr2("foo\nbar"); CountingInputStream ci2(istr2); while (ci2.good()) ci2.get(c); - assert (ci2.lines() == 2); - assert (ci2.chars() == 7); - assert (ci2.pos() == 3); + assertTrue (ci2.lines() == 2); + assertTrue (ci2.chars() == 7); + assertTrue (ci2.pos() == 3); std::istringstream istr3("foo\nbar\n"); CountingInputStream ci3(istr3); while (ci3.good()) ci3.get(c); - assert (ci3.lines() == 2); - assert (ci3.chars() == 8); - assert (ci3.pos() == 0); + assertTrue (ci3.lines() == 2); + assertTrue (ci3.chars() == 8); + assertTrue (ci3.pos() == 0); std::istringstream istr4("foo"); CountingInputStream ci4(istr4); @@ -59,9 +59,9 @@ void CountingStreamTest::testInput() ci4.addChars(10); ci4.addLines(2); ci4.addPos(3); - assert (ci4.lines() == 1 + 2); - assert (ci4.chars() == 3 + 10); - assert (ci4.pos() == 3 + 3); + assertTrue (ci4.lines() == 1 + 2); + assertTrue (ci4.chars() == 3 + 10); + assertTrue (ci4.pos() == 3 + 3); } @@ -70,24 +70,24 @@ void CountingStreamTest::testOutput() std::ostringstream ostr1; CountingOutputStream co1(ostr1); co1 << "foo"; - assert (ostr1.str() == "foo"); - assert (co1.lines() == 1); - assert (co1.chars() == 3); - assert (co1.pos() == 3); + assertTrue (ostr1.str() == "foo"); + assertTrue (co1.lines() == 1); + assertTrue (co1.chars() == 3); + assertTrue (co1.pos() == 3); std::ostringstream ostr2; CountingOutputStream co2(ostr2); co2 << "foo\nbar"; - assert (ostr2.str() == "foo\nbar"); - assert (co2.lines() == 2); - assert (co2.chars() == 7); - assert (co2.pos() == 3); + assertTrue (ostr2.str() == "foo\nbar"); + assertTrue (co2.lines() == 2); + assertTrue (co2.chars() == 7); + assertTrue (co2.pos() == 3); CountingOutputStream co3; co3 << "foo\nbar\n"; - assert (co3.lines() == 2); - assert (co3.chars() == 8); - assert (co3.pos() == 0); + assertTrue (co3.lines() == 2); + assertTrue (co3.chars() == 8); + assertTrue (co3.pos() == 0); std::ostringstream ostr4; CountingOutputStream co4(ostr4); @@ -95,9 +95,9 @@ void CountingStreamTest::testOutput() co4.addChars(10); co4.addLines(2); co4.addPos(3); - assert (co4.lines() == 1 + 2); - assert (co4.chars() == 3 + 10); - assert (co4.pos() == 3 + 3); + assertTrue (co4.lines() == 1 + 2); + assertTrue (co4.chars() == 3 + 10); + assertTrue (co4.pos() == 3 + 3); } diff --git a/Foundation/testsuite/src/DateTimeFormatterTest.cpp b/Foundation/testsuite/src/DateTimeFormatterTest.cpp index 90480bb16..d7ff38b2b 100644 --- a/Foundation/testsuite/src/DateTimeFormatterTest.cpp +++ b/Foundation/testsuite/src/DateTimeFormatterTest.cpp @@ -43,13 +43,13 @@ void DateTimeFormatterTest::testISO8601() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::ISO8601_FORMAT); - assert (str == "2005-01-08T12:30:00Z"); + assertTrue (str == "2005-01-08T12:30:00Z"); str = DateTimeFormatter::format(dt, DateTimeFormat::ISO8601_FORMAT, 3600); - assert (str == "2005-01-08T12:30:00+01:00"); + assertTrue (str == "2005-01-08T12:30:00+01:00"); str = DateTimeFormatter::format(dt, DateTimeFormat::ISO8601_FORMAT, -3600); - assert (str == "2005-01-08T12:30:00-01:00"); + assertTrue (str == "2005-01-08T12:30:00-01:00"); } @@ -58,13 +58,13 @@ void DateTimeFormatterTest::testISO8601Frac() DateTime dt(2005, 1, 8, 12, 30, 00, 12, 34); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::ISO8601_FRAC_FORMAT); - assert(str == "2005-01-08T12:30:00.012034Z"); + assertTrue (str == "2005-01-08T12:30:00.012034Z"); str = DateTimeFormatter::format(dt, DateTimeFormat::ISO8601_FRAC_FORMAT, 3600); - assert(str == "2005-01-08T12:30:00.012034+01:00"); + assertTrue (str == "2005-01-08T12:30:00.012034+01:00"); str = DateTimeFormatter::format(dt, DateTimeFormat::ISO8601_FRAC_FORMAT, -3600); - assert(str == "2005-01-08T12:30:00.012034-01:00"); + assertTrue (str == "2005-01-08T12:30:00.012034-01:00"); } @@ -73,13 +73,13 @@ void DateTimeFormatterTest::testRFC822() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::RFC822_FORMAT); - assert (str == "Sat, 8 Jan 05 12:30:00 GMT"); + assertTrue (str == "Sat, 8 Jan 05 12:30:00 GMT"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC822_FORMAT, 3600); - assert (str == "Sat, 8 Jan 05 12:30:00 +0100"); + assertTrue (str == "Sat, 8 Jan 05 12:30:00 +0100"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC822_FORMAT, -3600); - assert (str == "Sat, 8 Jan 05 12:30:00 -0100"); + assertTrue (str == "Sat, 8 Jan 05 12:30:00 -0100"); } @@ -88,13 +88,13 @@ void DateTimeFormatterTest::testRFC1123() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::RFC1123_FORMAT); - assert (str == "Sat, 8 Jan 2005 12:30:00 GMT"); + assertTrue (str == "Sat, 8 Jan 2005 12:30:00 GMT"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC1123_FORMAT, 3600); - assert (str == "Sat, 8 Jan 2005 12:30:00 +0100"); + assertTrue (str == "Sat, 8 Jan 2005 12:30:00 +0100"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC1123_FORMAT, -3600); - assert (str == "Sat, 8 Jan 2005 12:30:00 -0100"); + assertTrue (str == "Sat, 8 Jan 2005 12:30:00 -0100"); } @@ -103,13 +103,13 @@ void DateTimeFormatterTest::testHTTP() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::HTTP_FORMAT); - assert (str == "Sat, 08 Jan 2005 12:30:00 GMT"); + assertTrue (str == "Sat, 08 Jan 2005 12:30:00 GMT"); str = DateTimeFormatter::format(dt, DateTimeFormat::HTTP_FORMAT, 3600); - assert (str == "Sat, 08 Jan 2005 12:30:00 +0100"); + assertTrue (str == "Sat, 08 Jan 2005 12:30:00 +0100"); str = DateTimeFormatter::format(dt, DateTimeFormat::HTTP_FORMAT, -3600); - assert (str == "Sat, 08 Jan 2005 12:30:00 -0100"); + assertTrue (str == "Sat, 08 Jan 2005 12:30:00 -0100"); } @@ -118,13 +118,13 @@ void DateTimeFormatterTest::testRFC850() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::RFC850_FORMAT); - assert (str == "Saturday, 8-Jan-05 12:30:00 GMT"); + assertTrue (str == "Saturday, 8-Jan-05 12:30:00 GMT"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC850_FORMAT, 3600); - assert (str == "Saturday, 8-Jan-05 12:30:00 +0100"); + assertTrue (str == "Saturday, 8-Jan-05 12:30:00 +0100"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC850_FORMAT, -3600); - assert (str == "Saturday, 8-Jan-05 12:30:00 -0100"); + assertTrue (str == "Saturday, 8-Jan-05 12:30:00 -0100"); } @@ -133,13 +133,13 @@ void DateTimeFormatterTest::testRFC1036() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::RFC1036_FORMAT); - assert (str == "Saturday, 8 Jan 05 12:30:00 GMT"); + assertTrue (str == "Saturday, 8 Jan 05 12:30:00 GMT"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC1036_FORMAT, 3600); - assert (str == "Saturday, 8 Jan 05 12:30:00 +0100"); + assertTrue (str == "Saturday, 8 Jan 05 12:30:00 +0100"); str = DateTimeFormatter::format(dt, DateTimeFormat::RFC1036_FORMAT, -3600); - assert (str == "Saturday, 8 Jan 05 12:30:00 -0100"); + assertTrue (str == "Saturday, 8 Jan 05 12:30:00 -0100"); } @@ -148,7 +148,7 @@ void DateTimeFormatterTest::testASCTIME() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::ASCTIME_FORMAT); - assert (str == "Sat Jan 8 12:30:00 2005"); + assertTrue (str == "Sat Jan 8 12:30:00 2005"); } @@ -157,7 +157,7 @@ void DateTimeFormatterTest::testSORTABLE() DateTime dt(2005, 1, 8, 12, 30, 00); std::string str = DateTimeFormatter::format(dt, DateTimeFormat::SORTABLE_FORMAT); - assert (str == "2005-01-08 12:30:00"); + assertTrue (str == "2005-01-08 12:30:00"); } @@ -166,7 +166,7 @@ void DateTimeFormatterTest::testCustom() DateTime dt(2005, 1, 8, 12, 30, 00, 250); std::string str = DateTimeFormatter::format(dt, "%w/%W/%b/%B/%d/%e/%f/%m/%n/%o/%y/%Y/%H/%h/%a/%A/%M/%S/%i/%c/%z/%Z/%%"); - assert (str == "Sat/Saturday/Jan/January/08/8/ 8/01/1/ 1/05/2005/12/12/pm/PM/30/00/250/2/Z/GMT/%"); + assertTrue (str == "Sat/Saturday/Jan/January/08/8/ 8/01/1/ 1/05/2005/12/12/pm/PM/30/00/250/2/Z/GMT/%"); } @@ -174,27 +174,27 @@ void DateTimeFormatterTest::testTimespan() { Timespan ts(1, 1, 1, 1, 1000); std::string str = DateTimeFormatter::format(ts); - assert (str == "1d 01:01:01.001"); + assertTrue (str == "1d 01:01:01.001"); Timespan ts1(1, 24, 1, 1, 1000); str = DateTimeFormatter::format(ts1); - assert (str == "2d 00:01:01.001"); + assertTrue (str == "2d 00:01:01.001"); Timespan ts2(1, 25, 1, 1, 1000); str = DateTimeFormatter::format(ts2); - assert (str == "2d 01:01:01.001"); + assertTrue (str == "2d 01:01:01.001"); Timespan ts3(5, 4, 3, 2, 1000); str = DateTimeFormatter::format(ts3, "%i.%S:%M:%H d%d %%"); - assert (str == "001.02:03:04 d5 %"); + assertTrue (str == "001.02:03:04 d5 %"); Timespan ts4(0, 24, 60, 60, 1001000); str = DateTimeFormatter::format(ts4); - assert (str == "1d 01:01:01.001"); + assertTrue (str == "1d 01:01:01.001"); Timespan ts5(2, 11, 30, 20, 0); str = DateTimeFormatter::format(ts5, "%h %m %s"); - assert (str == "59 3570 214220"); + assertTrue (str == "59 3570 214220"); } diff --git a/Foundation/testsuite/src/DateTimeParserTest.cpp b/Foundation/testsuite/src/DateTimeParserTest.cpp index a25bc0d2d..c2c44ebc3 100644 --- a/Foundation/testsuite/src/DateTimeParserTest.cpp +++ b/Foundation/testsuite/src/DateTimeParserTest.cpp @@ -39,49 +39,49 @@ void DateTimeParserTest::testISO8601() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, "2005-01-08T12:30:00Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, "2005-01-08T12:30:00+01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, "2005-01-08T12:30:00-01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -3600); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, "2005-01-08T12:30:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FORMAT, "2005-01-08", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); } @@ -89,136 +89,136 @@ void DateTimeParserTest::testISO8601Frac() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00+01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00-01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == -3600); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00.1Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 100); - assert (dt.microsecond() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 100); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00.123+01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00.12345-01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 450); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 450); + assertTrue (tzd == -3600); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2010-09-23T16:17:01.2817002+02:00", tzd); - assert (dt.year() == 2010); - assert (dt.month() == 9); - assert (dt.day() == 23); - assert (dt.hour() == 16); - assert (dt.minute() == 17); - assert (dt.second() == 1); - assert (dt.millisecond() == 281); - assert (dt.microsecond() == 700); - assert (tzd == 7200); + assertTrue (dt.year() == 2010); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 23); + assertTrue (dt.hour() == 16); + assertTrue (dt.minute() == 17); + assertTrue (dt.second() == 1); + assertTrue (dt.millisecond() == 281); + assertTrue (dt.microsecond() == 700); + assertTrue (tzd == 7200); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08T12:30:00.123456", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 456); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 456); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::ISO8601_FRAC_FORMAT, "2005-01-08", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.microsecond() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.microsecond() == 0); + assertTrue (tzd == 0); } @@ -226,58 +226,58 @@ void DateTimeParserTest::testRFC822() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::RFC822_FORMAT, "Sat, 8 Jan 05 12:30:00 GMT", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::RFC822_FORMAT, "Sat, 8 Jan 05 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::RFC822_FORMAT, "Sat, 8 Jan 05 12:30:00 -0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -3600); dt = DateTimeParser::parse(DateTimeFormat::RFC822_FORMAT, "Tue, 18 Jan 05 12:30:00 CET", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 18); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 18); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::RFC822_FORMAT, "Wed, 12 Sep 73 02:01:12 CEST", tzd); - assert (dt.year() == 1973); - assert (dt.month() == 9); - assert (dt.day() == 12); - assert (dt.hour() == 2); - assert (dt.minute() == 1); - assert (dt.second() == 12); - assert (tzd == 7200); + assertTrue (dt.year() == 1973); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 12); + assertTrue (dt.hour() == 2); + assertTrue (dt.minute() == 1); + assertTrue (dt.second() == 12); + assertTrue (tzd == 7200); dt = DateTimeParser::parse(DateTimeFormat::RFC822_FORMAT, "12 Sep 73 02:01:12 CEST", tzd); - assert (dt.year() == 1973); - assert (dt.month() == 9); - assert (dt.day() == 12); - assert (dt.hour() == 2); - assert (dt.minute() == 1); - assert (dt.second() == 12); - assert (tzd == 7200); + assertTrue (dt.year() == 1973); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 12); + assertTrue (dt.hour() == 2); + assertTrue (dt.minute() == 1); + assertTrue (dt.second() == 12); + assertTrue (tzd == 7200); } @@ -285,49 +285,49 @@ void DateTimeParserTest::testRFC1123() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, "Sat, 8 Jan 2005 12:30:00 GMT", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, "Sat, 8 Jan 2005 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, "Sat, 8 Jan 2005 12:30:00 -0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -3600); dt = DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, "Sun, 20 Jul 1969 16:17:30 EDT", tzd); - assert (dt.year() == 1969); - assert (dt.month() == 7); - assert (dt.day() == 20); - assert (dt.hour() == 16); - assert (dt.minute() == 17); - assert (dt.second() == 30); - assert (tzd == -14400); + assertTrue (dt.year() == 1969); + assertTrue (dt.month() == 7); + assertTrue (dt.day() == 20); + assertTrue (dt.hour() == 16); + assertTrue (dt.minute() == 17); + assertTrue (dt.second() == 30); + assertTrue (tzd == -14400); dt = DateTimeParser::parse(DateTimeFormat::RFC1123_FORMAT, "Sun, 20 Jul 1969 16:17:30 GMT+01:00", tzd); - assert (dt.year() == 1969); - assert (dt.month() == 7); - assert (dt.day() == 20); - assert (dt.hour() == 16); - assert (dt.minute() == 17); - assert (dt.second() == 30); - assert (tzd == 3600); + assertTrue (dt.year() == 1969); + assertTrue (dt.month() == 7); + assertTrue (dt.day() == 20); + assertTrue (dt.hour() == 16); + assertTrue (dt.minute() == 17); + assertTrue (dt.second() == 30); + assertTrue (tzd == 3600); } @@ -335,31 +335,31 @@ void DateTimeParserTest::testHTTP() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::HTTP_FORMAT, "Sat, 08 Jan 2005 12:30:00 GMT", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::HTTP_FORMAT, "Sat, 08 Jan 2005 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::HTTP_FORMAT, "Sat, 08 Jan 2005 12:30:00 -0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -3600); } @@ -367,40 +367,40 @@ void DateTimeParserTest::testRFC850() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::RFC850_FORMAT, "Saturday, 8-Jan-05 12:30:00 GMT", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::RFC850_FORMAT, "Saturday, 8-Jan-05 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::RFC850_FORMAT, "Saturday, 8-Jan-05 12:30:00 -0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -3600); dt = DateTimeParser::parse(DateTimeFormat::RFC850_FORMAT, "Wed, 12-Sep-73 02:01:12 CEST", tzd); - assert (dt.year() == 1973); - assert (dt.month() == 9); - assert (dt.day() == 12); - assert (dt.hour() == 2); - assert (dt.minute() == 1); - assert (dt.second() == 12); - assert (tzd == 7200); + assertTrue (dt.year() == 1973); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 12); + assertTrue (dt.hour() == 2); + assertTrue (dt.minute() == 1); + assertTrue (dt.second() == 12); + assertTrue (tzd == 7200); } @@ -408,31 +408,31 @@ void DateTimeParserTest::testRFC1036() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::RFC1036_FORMAT, "Saturday, 8 Jan 05 12:30:00 GMT", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::RFC1036_FORMAT, "Saturday, 8 Jan 05 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse(DateTimeFormat::RFC1036_FORMAT, "Saturday, 8 Jan 05 12:30:00 -0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -3600); } @@ -440,13 +440,13 @@ void DateTimeParserTest::testASCTIME() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::ASCTIME_FORMAT, "Sat Jan 8 12:30:00 2005", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); } @@ -454,22 +454,22 @@ void DateTimeParserTest::testSORTABLE() { int tzd; DateTime dt = DateTimeParser::parse(DateTimeFormat::SORTABLE_FORMAT, "2005-01-08 12:30:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse(DateTimeFormat::SORTABLE_FORMAT, "2005-01-08", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); } @@ -477,36 +477,36 @@ void DateTimeParserTest::testCustom() { int tzd; DateTime dt = DateTimeParser::parse("%d-%b-%Y", "18-Jan-2005", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 18); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 18); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse("%m/%d/%y", "01/18/05", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 18); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 18); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse("%h:%M %a", "12:30 am", tzd); - assert (dt.hour() == 0); - assert (dt.minute() == 30); - assert (dt.second() == 0); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); dt = DateTimeParser::parse("%h:%M %a", "12:30 PM", tzd); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); - assert (!DateTimeParser::tryParse("%h:%M %a", "", dt, tzd)); - assert (!DateTimeParser::tryParse("", "12:30 PM", dt, tzd)); - assert (!DateTimeParser::tryParse("", "", dt, tzd)); + assertTrue (!DateTimeParser::tryParse("%h:%M %a", "", dt, tzd)); + assertTrue (!DateTimeParser::tryParse("", "12:30 PM", dt, tzd)); + assertTrue (!DateTimeParser::tryParse("", "", dt, tzd)); try { @@ -541,132 +541,132 @@ void DateTimeParserTest::testGuess() { int tzd; DateTime dt = DateTimeParser::parse("2005-01-08T12:30:00Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse("20050108T123000Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse("2005-01-08T12:30:00+01:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse("2005-01-08T12:30:00.123456Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 456); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 456); dt = DateTimeParser::parse("2005-01-08T12:30:00,123456Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 456); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 456); dt = DateTimeParser::parse("20050108T123000,123456Z", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 456); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 456); dt = DateTimeParser::parse("20050108T123000.123+0200", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 7200); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 7200); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 0); dt = DateTimeParser::parse("2005-01-08T12:30:00.123456-02:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == -7200); - assert (dt.millisecond() == 123); - assert (dt.microsecond() == 456); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == -7200); + assertTrue (dt.millisecond() == 123); + assertTrue (dt.microsecond() == 456); dt = DateTimeParser::parse("Sat, 8 Jan 05 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse("Sat, 8 Jan 2005 12:30:00 +0100", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 3600); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 3600); dt = DateTimeParser::parse("Sat Jan 8 12:30:00 2005", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse("2005-01-08 12:30:00", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 12); - assert (dt.minute() == 30); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); dt = DateTimeParser::parse("2005-01-08", tzd); - assert (dt.year() == 2005); - assert (dt.month() == 1); - assert (dt.day() == 8); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (tzd == 0); + assertTrue (dt.year() == 2005); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 8); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (tzd == 0); } @@ -675,31 +675,31 @@ void DateTimeParserTest::testParseMonth() std::string str = "January"; std::string::const_iterator it = str.begin(); int month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 1); + assertTrue (month == 1); str = "February"; it = str.begin(); month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 2); + assertTrue (month == 2); str = "December"; it = str.begin(); month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 12); + assertTrue (month == 12); str = "Jan"; it = str.begin(); month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 1); + assertTrue (month == 1); str = "Feb"; it = str.begin(); month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 2); + assertTrue (month == 2); str = "jan"; it = str.begin(); month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 1); + assertTrue (month == 1); str = "feb"; it = str.begin(); month = DateTimeParser::parseMonth(it, str.end()); - assert (month == 2); + assertTrue (month == 2); try { @@ -719,31 +719,31 @@ void DateTimeParserTest::testParseDayOfWeek() std::string str = "Sunday"; std::string::const_iterator it = str.begin(); int dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 0); + assertTrue (dow == 0); str = "Monday"; it = str.begin(); dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 1); + assertTrue (dow == 1); str = "Saturday"; it = str.begin(); dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 6); + assertTrue (dow == 6); str = "Sun"; it = str.begin(); dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 0); + assertTrue (dow == 0); str = "Mon"; it = str.begin(); dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 1); + assertTrue (dow == 1); str = "sun"; it = str.begin(); dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 0); + assertTrue (dow == 0); str = "mon"; it = str.begin(); dow = DateTimeParser::parseDayOfWeek(it, str.end()); - assert (dow == 1); + assertTrue (dow == 1); try { diff --git a/Foundation/testsuite/src/DateTimeTest.cpp b/Foundation/testsuite/src/DateTimeTest.cpp index c2e723482..0d5cfca2e 100644 --- a/Foundation/testsuite/src/DateTimeTest.cpp +++ b/Foundation/testsuite/src/DateTimeTest.cpp @@ -37,28 +37,28 @@ void DateTimeTest::testTimestamp() { Timestamp ts(0); // Unix epoch 1970-01-01 00:00:00 Thursday DateTime dt(ts); - assert (dt.year() == 1970); - assert (dt.month() == 1); - assert (dt.day() == 1); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 4); - assert (dt.julianDay() == 2440587.5); - assert (dt.timestamp() == 0); + assertTrue (dt.year() == 1970); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 1); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 4); + assertTrue (dt.julianDay() == 2440587.5); + assertTrue (dt.timestamp() == 0); ts = Timestamp::fromEpochTime(1000000000); dt = ts; // 2001-09-09 01:46:40 Sunday - assert (dt.year() == 2001); - assert (dt.month() == 9); - assert (dt.day() == 9); - assert (dt.hour() == 1); - assert (dt.minute() == 46); - assert (dt.second() == 40); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 0); - assert (dt.timestamp().epochTime() == 1000000000); + assertTrue (dt.year() == 2001); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 9); + assertTrue (dt.hour() == 1); + assertTrue (dt.minute() == 46); + assertTrue (dt.second() == 40); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 0); + assertTrue (dt.timestamp().epochTime() == 1000000000); assertEqualDelta (dt.julianDay(), 2452161.574074, 0.000001); } @@ -66,77 +66,77 @@ void DateTimeTest::testTimestamp() void DateTimeTest::testJulian() { DateTime dt(2440587.5); // unix epoch as Julian day - assert (dt.year() == 1970); - assert (dt.month() == 1); - assert (dt.day() == 1); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 4); - assert (dt.julianDay() == 2440587.5); - assert (dt.timestamp() == 0); + assertTrue (dt.year() == 1970); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 1); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 4); + assertTrue (dt.julianDay() == 2440587.5); + assertTrue (dt.timestamp() == 0); dt = 2299160.5; // 1582-10-15 00:00:00 (first day of Gregorian reform, UTC base) - assert (dt.year() == 1582); - assert (dt.month() == 10); - assert (dt.day() == 15); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 5); - assert (dt.julianDay() == 2299160.5); + assertTrue (dt.year() == 1582); + assertTrue (dt.month() == 10); + assertTrue (dt.day() == 15); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 5); + assertTrue (dt.julianDay() == 2299160.5); dt = 0.0; // -4713-11-24 12:00:00 (Gregorian date of Julian day reference) - assert (dt.year() == -4713); - assert (dt.month() == 11); - assert (dt.day() == 24); - assert (dt.hour() == 12); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 1); - assert (dt.julianDay() == 0); + assertTrue (dt.year() == -4713); + assertTrue (dt.month() == 11); + assertTrue (dt.day() == 24); + assertTrue (dt.hour() == 12); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 1); + assertTrue (dt.julianDay() == 0); // Test that we can represent down to the microsecond. dt = DateTime(2010, 1, 31, 17, 30, 15, 800, 3); - assert (dt.year() == 2010); - assert (dt.month() == 1); - assert (dt.day() == 31); - assert (dt.hour() == 17); - assert (dt.minute() == 30); - assert (dt.second() == 15); - assert (dt.millisecond() == 800); - assert (dt.microsecond() == 3); + assertTrue (dt.year() == 2010); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 31); + assertTrue (dt.hour() == 17); + assertTrue (dt.minute() == 30); + assertTrue (dt.second() == 15); + assertTrue (dt.millisecond() == 800); + assertTrue (dt.microsecond() == 3); } void DateTimeTest::testGregorian() { DateTime dt(1970, 1, 1); - assert (dt.year() == 1970); - assert (dt.month() == 1); - assert (dt.day() == 1); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 4); - assert (dt.julianDay() == 2440587.5); - assert (dt.timestamp() == 0); + assertTrue (dt.year() == 1970); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 1); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 4); + assertTrue (dt.julianDay() == 2440587.5); + assertTrue (dt.timestamp() == 0); dt.assign(2001, 9, 9, 1, 46, 40); - assert (dt.year() == 2001); - assert (dt.month() == 9); - assert (dt.day() == 9); - assert (dt.hour() == 1); - assert (dt.minute() == 46); - assert (dt.second() == 40); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 0); - assert (dt.timestamp().epochTime() == 1000000000); + assertTrue (dt.year() == 2001); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 9); + assertTrue (dt.hour() == 1); + assertTrue (dt.minute() == 46); + assertTrue (dt.second() == 40); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 0); + assertTrue (dt.timestamp().epochTime() == 1000000000); assertEqualDelta (dt.julianDay(), 2452161.574074, 0.000001); } @@ -153,167 +153,167 @@ void DateTimeTest::testConversions() DateTime dt4(dt2); Timestamp ts4 = dt4.timestamp(); - assert (ts1 == ts2); - assert (ts2 == ts3); - assert (ts3 == ts4); + assertTrue (ts1 == ts2); + assertTrue (ts2 == ts3); + assertTrue (ts3 == ts4); - assert (dt2.year() == 2005); - assert (dt2.month() == 1); - assert (dt2.day() == 28); - assert (dt2.hour() == 14); - assert (dt2.minute() == 24); - assert (dt2.second() == 44); - assert (dt2.millisecond() == 234); - assert (dt2.dayOfWeek() == 5); + assertTrue (dt2.year() == 2005); + assertTrue (dt2.month() == 1); + assertTrue (dt2.day() == 28); + assertTrue (dt2.hour() == 14); + assertTrue (dt2.minute() == 24); + assertTrue (dt2.second() == 44); + assertTrue (dt2.millisecond() == 234); + assertTrue (dt2.dayOfWeek() == 5); } void DateTimeTest::testStatics() { - assert (DateTime::isLeapYear(1984)); - assert (DateTime::isLeapYear(1988)); - assert (DateTime::isLeapYear(1992)); - assert (DateTime::isLeapYear(1996)); - assert (DateTime::isLeapYear(2000)); - assert (DateTime::isLeapYear(2400)); - assert (!DateTime::isLeapYear(1995)); - assert (!DateTime::isLeapYear(1998)); - assert (!DateTime::isLeapYear(2001)); - assert (!DateTime::isLeapYear(1800)); - assert (!DateTime::isLeapYear(1900)); + assertTrue (DateTime::isLeapYear(1984)); + assertTrue (DateTime::isLeapYear(1988)); + assertTrue (DateTime::isLeapYear(1992)); + assertTrue (DateTime::isLeapYear(1996)); + assertTrue (DateTime::isLeapYear(2000)); + assertTrue (DateTime::isLeapYear(2400)); + assertTrue (!DateTime::isLeapYear(1995)); + assertTrue (!DateTime::isLeapYear(1998)); + assertTrue (!DateTime::isLeapYear(2001)); + assertTrue (!DateTime::isLeapYear(1800)); + assertTrue (!DateTime::isLeapYear(1900)); - assert (DateTime::daysOfMonth(2000, 1) == 31); - assert (DateTime::daysOfMonth(2000, 2) == 29); - assert (DateTime::daysOfMonth(1999, 2) == 28); + assertTrue (DateTime::daysOfMonth(2000, 1) == 31); + assertTrue (DateTime::daysOfMonth(2000, 2) == 29); + assertTrue (DateTime::daysOfMonth(1999, 2) == 28); } void DateTimeTest::testCalcs() { DateTime dt1(2005, 1, 1); - assert (dt1.dayOfYear() == 1); - assert (dt1.week(DateTime::MONDAY) == 0); + assertTrue (dt1.dayOfYear() == 1); + assertTrue (dt1.week(DateTime::MONDAY) == 0); dt1.assign(2005, 1, 3); - assert (dt1.dayOfYear() == 3); - assert (dt1.week(DateTime::MONDAY) == 1); + assertTrue (dt1.dayOfYear() == 3); + assertTrue (dt1.week(DateTime::MONDAY) == 1); dt1.assign(2005, 1, 9); - assert (dt1.dayOfYear() == 9); - assert (dt1.week(DateTime::MONDAY) == 1); + assertTrue (dt1.dayOfYear() == 9); + assertTrue (dt1.week(DateTime::MONDAY) == 1); dt1.assign(2005, 1, 10); - assert (dt1.dayOfYear() == 10); - assert (dt1.week(DateTime::MONDAY) == 2); + assertTrue (dt1.dayOfYear() == 10); + assertTrue (dt1.week(DateTime::MONDAY) == 2); dt1.assign(2005, 2, 1); - assert (dt1.dayOfYear() == 32); - assert (dt1.week(DateTime::MONDAY) == 5); + assertTrue (dt1.dayOfYear() == 32); + assertTrue (dt1.week(DateTime::MONDAY) == 5); dt1.assign(2005, 12, 31); - assert (dt1.week(DateTime::MONDAY) == 52); + assertTrue (dt1.week(DateTime::MONDAY) == 52); dt1.assign(2007, 1, 1); - assert (dt1.week(DateTime::MONDAY) == 1); + assertTrue (dt1.week(DateTime::MONDAY) == 1); dt1.assign(2007, 12, 31); - assert (dt1.week(DateTime::MONDAY) == 53); + assertTrue (dt1.week(DateTime::MONDAY) == 53); // Jan 1 is Mon dt1.assign(2001, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2001, 1, 7); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2001, 1, 8); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2001, 1, 21); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2001, 1, 22); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Tue dt1.assign(2002, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2002, 1, 6); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2002, 1, 7); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2002, 1, 20); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2002, 1, 21); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Wed dt1.assign(2003, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2003, 1, 5); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2003, 1, 6); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2003, 1, 19); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2003, 1, 20); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Thu dt1.assign(2004, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2004, 1, 4); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2004, 1, 5); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2004, 1, 18); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2004, 1, 19); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Fri dt1.assign(1999, 1, 1); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(1999, 1, 3); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(1999, 1, 4); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(1999, 1, 17); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(1999, 1, 18); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); // Jan 1 is Sat dt1.assign(2000, 1, 1); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(2000, 1, 2); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(2000, 1, 3); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2000, 1, 16); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2000, 1, 17); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); // Jan 1 is Sun dt1.assign(1995, 1, 1); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(1995, 1, 2); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(1995, 1, 3); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(1995, 1, 15); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(1995, 1, 16); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); } void DateTimeTest::testAMPM() { DateTime dt1(2005, 1, 1, 0, 15, 30); - assert (dt1.isAM()); - assert (!dt1.isPM()); - assert (dt1.hourAMPM() == 12); + assertTrue (dt1.isAM()); + assertTrue (!dt1.isPM()); + assertTrue (dt1.hourAMPM() == 12); dt1.assign(2005, 1, 1, 12, 15, 30); - assert (!dt1.isAM()); - assert (dt1.isPM()); - assert (dt1.hourAMPM() == 12); + assertTrue (!dt1.isAM()); + assertTrue (dt1.isPM()); + assertTrue (dt1.hourAMPM() == 12); dt1.assign(2005, 1, 1, 13, 15, 30); - assert (!dt1.isAM()); - assert (dt1.isPM()); - assert (dt1.hourAMPM() == 1); + assertTrue (!dt1.isAM()); + assertTrue (dt1.isPM()); + assertTrue (dt1.hourAMPM() == 1); } @@ -323,19 +323,19 @@ void DateTimeTest::testRelational() DateTime dt2(2005, 1, 2, 0, 15, 30); DateTime dt3(dt1); - assert (dt1 < dt2); - assert (dt1 <= dt2); - assert (dt2 > dt1); - assert (dt2 >= dt1); - assert (dt1 != dt2); - assert (!(dt1 == dt2)); + assertTrue (dt1 < dt2); + assertTrue (dt1 <= dt2); + assertTrue (dt2 > dt1); + assertTrue (dt2 >= dt1); + assertTrue (dt1 != dt2); + assertTrue (!(dt1 == dt2)); - assert (dt1 == dt3); - assert (!(dt1 != dt3)); - assert (dt1 >= dt3); - assert (dt1 <= dt3); - assert (!(dt1 > dt3)); - assert (!(dt1 < dt3)); + assertTrue (dt1 == dt3); + assertTrue (!(dt1 != dt3)); + assertTrue (dt1 >= dt3); + assertTrue (dt1 <= dt3); + assertTrue (!(dt1 > dt3)); + assertTrue (!(dt1 < dt3)); static const struct { @@ -372,10 +372,10 @@ void DateTimeTest::testRelational() const DateTime& U = u; u.assign(values[j].year, values[j].month, values[j].day); - loop_2_assert(i, j, (j < i) == (U < V)); - loop_2_assert(i, j, (j <= i) == (U <= V)); - loop_2_assert(i, j, (j >= i) == (U >= V)); - loop_2_assert(i, j, (j > i) == (U > V)); + loop_2_assert (i, j, (j < i) == (U < V)); + loop_2_assert (i, j, (j <= i) == (U <= V)); + loop_2_assert (i, j, (j >= i) == (U >= V)); + loop_2_assert (i, j, (j > i) == (U > V)); } } } @@ -387,15 +387,15 @@ void DateTimeTest::testArithmetics() DateTime dt2(2005, 1, 2, 0, 15, 30); Timespan s = dt2 - dt1; - assert (s.days() == 1); + assertTrue (s.days() == 1); DateTime dt3 = dt1 + s; - assert (dt3 == dt2); + assertTrue (dt3 == dt2); dt3 -= s; - assert (dt3 == dt1); + assertTrue (dt3 == dt1); dt1 += s; - assert (dt1 == dt2); + assertTrue (dt1 == dt2); static const struct { @@ -436,32 +436,32 @@ void DateTimeTest::testArithmetics() DateTime x = DateTime(data[di].year1, data[di].month1, data[di].day1); const DateTime& X = x; x += Timespan(num_days, 0, 0, 0, 0); - loop_1_assert(line, data[di].year2 == X.year()); - loop_1_assert(line, data[di].month2 == X.month()); - loop_1_assert(line, data[di].day2 == X.day()); + loop_1_assert (line, data[di].year2 == X.year()); + loop_1_assert (line, data[di].month2 == X.month()); + loop_1_assert (line, data[di].day2 == X.day()); } DateTime edgeTime(2014, 9, 16, 0, 0, 0, 0, 10); edgeTime -= Poco::Timespan(11); - assert (edgeTime.year() == 2014); - assert (edgeTime.month() == 9); - assert (edgeTime.day() == 15); - assert (edgeTime.hour() == 23); - assert (edgeTime.minute() == 59); - assert (edgeTime.second() == 59); - assert (edgeTime.millisecond() == 999); - assert (edgeTime.microsecond() == 999); + assertTrue (edgeTime.year() == 2014); + assertTrue (edgeTime.month() == 9); + assertTrue (edgeTime.day() == 15); + assertTrue (edgeTime.hour() == 23); + assertTrue (edgeTime.minute() == 59); + assertTrue (edgeTime.second() == 59); + assertTrue (edgeTime.millisecond() == 999); + assertTrue (edgeTime.microsecond() == 999); edgeTime.assign(2014, 9, 15, 23, 59, 59, 999, 968); edgeTime += Poco::Timespan(11); - assert (edgeTime.year() == 2014); - assert (edgeTime.month() == 9); - assert (edgeTime.day() == 15); - assert (edgeTime.hour() == 23); - assert (edgeTime.minute() == 59); - assert (edgeTime.second() == 59); - assert (edgeTime.millisecond() == 999); - assert (edgeTime.microsecond() == 979); + assertTrue (edgeTime.year() == 2014); + assertTrue (edgeTime.month() == 9); + assertTrue (edgeTime.day() == 15); + assertTrue (edgeTime.hour() == 23); + assertTrue (edgeTime.minute() == 59); + assertTrue (edgeTime.second() == 59); + assertTrue (edgeTime.millisecond() == 999); + assertTrue (edgeTime.microsecond() == 979); } void DateTimeTest::testIncrementDecrement() @@ -516,13 +516,13 @@ void DateTimeTest::testIncrementDecrement() x = x + Timespan(1,0,0,0,0); DateTime y = x; const DateTime& Y = y; - loop_1_assert(line, data[di].year2 == X.year()); - loop_1_assert(line, data[di].month2 == X.month()); - loop_1_assert(line, data[di].day2 == X.day()); + loop_1_assert (line, data[di].year2 == X.year()); + loop_1_assert (line, data[di].month2 == X.month()); + loop_1_assert (line, data[di].day2 == X.day()); - loop_1_assert(line, data[di].year2 == Y.year()); - loop_1_assert(line, data[di].month2 == Y.month()); - loop_1_assert(line, data[di].day2 == Y.day()); + loop_1_assert (line, data[di].year2 == Y.year()); + loop_1_assert (line, data[di].month2 == Y.month()); + loop_1_assert (line, data[di].day2 == Y.day()); } for (di = 0; di < num_data; ++di) @@ -537,12 +537,12 @@ void DateTimeTest::testIncrementDecrement() const DateTime& X = x; x = x + Timespan(1,0,0,0,0); - loop_1_assert(line, data[di].year2 == X.year()); - loop_1_assert(line, data[di].month2 == X.month()); - loop_1_assert(line, data[di].day2 == X.day()); - loop_1_assert(line, data[di].year1 == Y.year()); - loop_1_assert(line, data[di].month1 == Y.month()); - loop_1_assert(line, data[di].day1 == Y.day()); + loop_1_assert (line, data[di].year2 == X.year()); + loop_1_assert (line, data[di].month2 == X.month()); + loop_1_assert (line, data[di].day2 == X.day()); + loop_1_assert (line, data[di].year1 == Y.year()); + loop_1_assert (line, data[di].month1 == Y.month()); + loop_1_assert (line, data[di].day1 == Y.day()); } for (di = 0; di < num_data; ++di) @@ -553,13 +553,13 @@ void DateTimeTest::testIncrementDecrement() x = x - Timespan(1,0,0,0,0); DateTime y = x; DateTime Y = y; - loop_1_assert(line, data[di].year1 == X.year()); - loop_1_assert(line, data[di].month1 == X.month()); - loop_1_assert(line, data[di].day1 == X.day()); + loop_1_assert (line, data[di].year1 == X.year()); + loop_1_assert (line, data[di].month1 == X.month()); + loop_1_assert (line, data[di].day1 == X.day()); - loop_1_assert(line, data[di].year1 == Y.year()); - loop_1_assert(line, data[di].month1 == Y.month()); - loop_1_assert(line, data[di].day1 == Y.day()); + loop_1_assert (line, data[di].year1 == Y.year()); + loop_1_assert (line, data[di].month1 == Y.month()); + loop_1_assert (line, data[di].day1 == Y.day()); } for (di = 0; di < num_data; ++di) @@ -572,13 +572,13 @@ void DateTimeTest::testIncrementDecrement() // would post-decrement x here. x = x - Timespan(1,0,0,0,0); - loop_1_assert(line, data[di].year1 == X.year()); - loop_1_assert(line, data[di].month1 == X.month()); - loop_1_assert(line, data[di].day1 == X.day()); + loop_1_assert (line, data[di].year1 == X.year()); + loop_1_assert (line, data[di].month1 == X.month()); + loop_1_assert (line, data[di].day1 == X.day()); - loop_1_assert(line, data[di].year2 == Y.year()); - loop_1_assert(line, data[di].month2 == Y.month()); - loop_1_assert(line, data[di].day2 == Y.day()); + loop_1_assert (line, data[di].year2 == Y.year()); + loop_1_assert (line, data[di].month2 == Y.month()); + loop_1_assert (line, data[di].day2 == Y.day()); } } @@ -591,26 +591,26 @@ void DateTimeTest::testSwap() DateTime dt4(2005, 1, 2, 0, 15, 30); dt1.swap(dt2); - assert (dt2 == dt3); - assert (dt1 == dt4); + assertTrue (dt2 == dt3); + assertTrue (dt1 == dt4); } void DateTimeTest::testUsage() { DateTime dt1(1776, 7, 4); - assert (dt1.year() == 1776); - assert (dt1.month() == 7); - assert (dt1.day() == 4); + assertTrue (dt1.year() == 1776); + assertTrue (dt1.month() == 7); + assertTrue (dt1.day() == 4); DateTime dt2(dt1); dt2 += Timespan(6, 0, 0, 0, 0); - assert (dt2.year() == 1776); - assert (dt2.month() == 7); - assert (dt2.day() == 10); + assertTrue (dt2.year() == 1776); + assertTrue (dt2.month() == 7); + assertTrue (dt2.day() == 10); Timespan span = dt2 - dt1; - assert (span.days() == 6); + assertTrue (span.days() == 6); // TODO - When adding months and years we need to be // able to specify the end-end convention. @@ -662,8 +662,8 @@ void DateTimeTest::testSetYearDay() // TODO - need to be able to assert with the loop counter // but cppUnit is not able to do this. - assert (r == x); - assert (day == X.dayOfYear()); + assertTrue (r == x); + assertTrue (day == X.dayOfYear()); #endif } @@ -771,7 +771,7 @@ void DateTimeTest::testIsValid() const bool exp = data[di].d_exp; bool isValid = DateTime::isValid(year, month, day); - loop_1_assert(line, exp == isValid); + loop_1_assert (line, exp == isValid); } } @@ -828,7 +828,7 @@ void DateTimeTest::testDayOfWeek() const int line = data[di].d_lineNum; DateTime x = DateTime(data[di].d_year, data[di].d_month, data[di].d_day); const DateTime& X = x; - loop_1_assert(line, data[di].d_expDay == X.dayOfWeek()); + loop_1_assert (line, data[di].d_expDay == X.dayOfWeek()); } } @@ -837,11 +837,11 @@ void DateTimeTest::testUTC() { DateTime dt(2007, 3, 5, 12, 30, 00); - assert (dt.hour() == 12); + assertTrue (dt.hour() == 12); dt.makeUTC(3600); - assert (dt.hour() == 11); + assertTrue (dt.hour() == 11); dt.makeLocal(3600); - assert (dt.hour() == 12); + assertTrue (dt.hour() == 12); } @@ -850,7 +850,7 @@ void DateTimeTest::testLeapSeconds() DateTime dt1(2015, 6, 30, 23, 59, 60); DateTime dt2(2015, 7, 1, 0, 0, 0); - assert (dt1 == dt2); + assertTrue (dt1 == dt2); } diff --git a/Foundation/testsuite/src/DigestStreamTest.cpp b/Foundation/testsuite/src/DigestStreamTest.cpp index 8339148fd..8a155fe03 100644 --- a/Foundation/testsuite/src/DigestStreamTest.cpp +++ b/Foundation/testsuite/src/DigestStreamTest.cpp @@ -40,8 +40,8 @@ void DigestStreamTest::testInputStream() DigestInputStream ds(md5, istr); std::string s; ds >> s; - assert (DigestEngine::digestToHex(md5.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); - assert (s == "abcdefghijklmnopqrstuvwxyz"); + assertTrue (DigestEngine::digestToHex(md5.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); + assertTrue (s == "abcdefghijklmnopqrstuvwxyz"); } @@ -51,12 +51,12 @@ void DigestStreamTest::testOutputStream1() DigestOutputStream ds(md5); ds << "abcdefghijklmnopqrstuvwxyz"; ds.close(); - assert (DigestEngine::digestToHex(md5.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); + assertTrue (DigestEngine::digestToHex(md5.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); ds << "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ds << "abcdefghijklmnopqrstuvwxyz0123456789"; ds.close(); - assert (DigestEngine::digestToHex(md5.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f"); + assertTrue (DigestEngine::digestToHex(md5.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f"); } @@ -67,8 +67,8 @@ void DigestStreamTest::testOutputStream2() DigestOutputStream ds(md5, ostr); ds << "abcdefghijklmnopqrstuvwxyz"; ds.close(); - assert (DigestEngine::digestToHex(md5.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); - assert (ostr.str() == "abcdefghijklmnopqrstuvwxyz"); + assertTrue (DigestEngine::digestToHex(md5.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); + assertTrue (ostr.str() == "abcdefghijklmnopqrstuvwxyz"); } @@ -77,7 +77,7 @@ void DigestStreamTest::testToFromHex() std::string digest("c3fcd3d76192e4007dfb496cca67e13b"); Poco::DigestEngine::Digest dig = DigestEngine::digestFromHex(digest); std::string digest2 = DigestEngine::digestToHex(dig); - assert (digest == digest2); + assertTrue (digest == digest2); } diff --git a/Foundation/testsuite/src/DirectoryWatcherTest.cpp b/Foundation/testsuite/src/DirectoryWatcherTest.cpp index e1516abc1..3838d9fdb 100644 --- a/Foundation/testsuite/src/DirectoryWatcherTest.cpp +++ b/Foundation/testsuite/src/DirectoryWatcherTest.cpp @@ -56,11 +56,11 @@ void DirectoryWatcherTest::testAdded() Poco::Thread::sleep(2000*dw.scanInterval()); - assert (_events.size() >= 1); - assert (_events[0].callback == "onItemAdded"); - assert (Poco::Path(_events[0].path).getFileName() == "test.txt"); - assert (_events[0].type == DirectoryWatcher::DW_ITEM_ADDED); - assert (!_error); + assertTrue (_events.size() >= 1); + assertTrue (_events[0].callback == "onItemAdded"); + assertTrue (Poco::Path(_events[0].path).getFileName() == "test.txt"); + assertTrue (_events[0].type == DirectoryWatcher::DW_ITEM_ADDED); + assertTrue (!_error); } @@ -87,11 +87,11 @@ void DirectoryWatcherTest::testRemoved() Poco::Thread::sleep(2000*dw.scanInterval()); - assert (_events.size() >= 1); - assert (_events[0].callback == "onItemRemoved"); - assert (Poco::Path(_events[0].path).getFileName() == "test.txt"); - assert (_events[0].type == DirectoryWatcher::DW_ITEM_REMOVED); - assert (!_error); + assertTrue (_events.size() >= 1); + assertTrue (_events[0].callback == "onItemRemoved"); + assertTrue (Poco::Path(_events[0].path).getFileName() == "test.txt"); + assertTrue (_events[0].type == DirectoryWatcher::DW_ITEM_REMOVED); + assertTrue (!_error); } @@ -119,11 +119,11 @@ void DirectoryWatcherTest::testModified() Poco::Thread::sleep(2000*dw.scanInterval()); - assert (_events.size() >= 1); - assert (_events[0].callback == "onItemModified"); - assert (Poco::Path(_events[0].path).getFileName() == "test.txt"); - assert (_events[0].type == DirectoryWatcher::DW_ITEM_MODIFIED); - assert (!_error); + assertTrue (_events.size() >= 1); + assertTrue (_events[0].callback == "onItemModified"); + assertTrue (Poco::Path(_events[0].path).getFileName() == "test.txt"); + assertTrue (_events[0].type == DirectoryWatcher::DW_ITEM_MODIFIED); + assertTrue (!_error); } @@ -154,37 +154,37 @@ void DirectoryWatcherTest::testMoved() if (dw.supportsMoveEvents()) { - assert (_events.size() >= 2); - assert ( + assertTrue (_events.size() >= 2); + assertTrue ( (_events[0].callback == "onItemMovedFrom" && _events[1].callback == "onItemMovedTo") || (_events[1].callback == "onItemMovedFrom" && _events[0].callback == "onItemMovedTo") ); - assert ( + assertTrue ( (Poco::Path(_events[0].path).getFileName() == "test.txt" && Poco::Path(_events[1].path).getFileName() == "test2.txt") || (Poco::Path(_events[1].path).getFileName() == "test.txt" && Poco::Path(_events[0].path).getFileName() == "test2.txt") ); - assert ( + assertTrue ( (_events[0].type == DirectoryWatcher::DW_ITEM_MOVED_FROM && _events[1].type == DirectoryWatcher::DW_ITEM_MOVED_TO) || (_events[1].type == DirectoryWatcher::DW_ITEM_MOVED_FROM && _events[0].type == DirectoryWatcher::DW_ITEM_MOVED_TO) ); } else { - assert (_events.size() >= 2); - assert ( + assertTrue (_events.size() >= 2); + assertTrue ( (_events[0].callback == "onItemAdded" && _events[1].callback == "onItemRemoved") || (_events[1].callback == "onItemAdded" && _events[0].callback == "onItemRemoved") ); - assert ( + assertTrue ( (Poco::Path(_events[0].path).getFileName() == "test.txt" && Poco::Path(_events[1].path).getFileName() == "test2.txt") || (Poco::Path(_events[1].path).getFileName() == "test.txt" && Poco::Path(_events[0].path).getFileName() == "test2.txt") ); - assert ( + assertTrue ( (_events[0].type == DirectoryWatcher::DW_ITEM_ADDED && _events[1].type == DirectoryWatcher::DW_ITEM_REMOVED) || (_events[1].type == DirectoryWatcher::DW_ITEM_ADDED && _events[0].type == DirectoryWatcher::DW_ITEM_REMOVED) ); } - assert (!_error); + assertTrue (!_error); } diff --git a/Foundation/testsuite/src/DynamicFactoryTest.cpp b/Foundation/testsuite/src/DynamicFactoryTest.cpp index 11ffb6da0..5456fc749 100644 --- a/Foundation/testsuite/src/DynamicFactoryTest.cpp +++ b/Foundation/testsuite/src/DynamicFactoryTest.cpp @@ -61,10 +61,10 @@ void DynamicFactoryTest::testDynamicFactory() dynFactory.registerClass("A"); dynFactory.registerClass("B"); - assert (dynFactory.isClass("A")); - assert (dynFactory.isClass("B")); + assertTrue (dynFactory.isClass("A")); + assertTrue (dynFactory.isClass("B")); - assert (!dynFactory.isClass("C")); + assertTrue (!dynFactory.isClass("C")); #ifndef POCO_ENABLE_CPP11 std::auto_ptr a(dynamic_cast(dynFactory.createInstance("A"))); @@ -87,8 +87,8 @@ void DynamicFactoryTest::testDynamicFactory() } dynFactory.unregisterClass("B"); - assert (dynFactory.isClass("A")); - assert (!dynFactory.isClass("B")); + assertTrue (dynFactory.isClass("A")); + assertTrue (!dynFactory.isClass("B")); try { diff --git a/Foundation/testsuite/src/ExpireCacheTest.cpp b/Foundation/testsuite/src/ExpireCacheTest.cpp index d7797ff62..ea3653d2a 100644 --- a/Foundation/testsuite/src/ExpireCacheTest.cpp +++ b/Foundation/testsuite/src/ExpireCacheTest.cpp @@ -42,16 +42,16 @@ void ExpireCacheTest::testClear() aCache.add(1, 2); aCache.add(3, 4); aCache.add(5, 6); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(1) == 2); - assert (*aCache.get(3) == 4); - assert (*aCache.get(5) == 6); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(1) == 2); + assertTrue (*aCache.get(3) == 4); + assertTrue (*aCache.get(5) == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } @@ -74,51 +74,51 @@ void ExpireCacheTest::testExpireN() // 3-1|5 -> 5 gets removed ExpireCache aCache(DURSLEEP); aCache.add(1, 2); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); SharedPtr tmp = aCache.get(1); - assert (!tmp.isNull()); - assert (*tmp == 2); - assert (aCache.size() == 1); + assertTrue (!tmp.isNull()); + assertTrue (*tmp == 2); + assertTrue (aCache.size() == 1); Thread::sleep(DURWAIT); - assert (aCache.size() == 0); - assert (!aCache.has(1)); + assertTrue (aCache.size() == 0); + assertTrue (!aCache.has(1)); // tmp must still be valid, access it - assert (*tmp == 2); + assertTrue (*tmp == 2); tmp = aCache.get(1); - assert (!tmp); + assertTrue (!tmp); aCache.add(1, 2); // 1 Thread::sleep(DURHALFSLEEP); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); tmp = aCache.get(1); SharedPtr tmp2 = aCache.get(3); - assert (*tmp == 2); - assert (*tmp2 == 4); + assertTrue (*tmp == 2); + assertTrue (*tmp2 == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (*tmp == 2); // 1-3 - assert (*tmp2 == 4); // 3-1 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*tmp == 2); // 1-3 + assertTrue (*tmp2 == 4); // 3-1 tmp2 = aCache.get(3); - assert (*tmp2 == 4); + assertTrue (*tmp2 == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(3)); - assert (*tmp2 == 4); + assertTrue (!aCache.has(3)); + assertTrue (*tmp2 == 4); tmp = aCache.get(1); tmp2 = aCache.get(3); - assert (!tmp); - assert (!tmp2); + assertTrue (!tmp); + assertTrue (!tmp2); // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -126,11 +126,11 @@ void ExpireCacheTest::testDuplicateAdd() { ExpireCache aCache(DURSLEEP); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(1, 3); - assert (aCache.has(1)); - assert (*aCache.get(1) == 3); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 3); } @@ -141,37 +141,37 @@ void ExpireCacheTest::testAccessExpireN() // 3-1|5 -> 5 gets removed AccessExpireCache aCache(DURSLEEP); aCache.add(1, 2); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); SharedPtr tmp = aCache.get(1); - assert (!tmp.isNull()); - assert (*tmp == 2); - assert (aCache.size() == 1); + assertTrue (!tmp.isNull()); + assertTrue (*tmp == 2); + assertTrue (aCache.size() == 1); Thread::sleep(DURWAIT); - assert (aCache.size() == 0); - assert (!aCache.has(1)); + assertTrue (aCache.size() == 0); + assertTrue (!aCache.has(1)); // tmp must still be valid, access it - assert (*tmp == 2); + assertTrue (*tmp == 2); tmp = aCache.get(1); - assert (!tmp); + assertTrue (!tmp); aCache.add(1, 2); // 1 Thread::sleep(DURHALFSLEEP); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); Thread::sleep(DURHALFSLEEP+50); //3|1 - assert (!aCache.has(1)); - assert (*aCache.get(3) == 4); + assertTrue (!aCache.has(1)); + assertTrue (*aCache.get(3) == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (*aCache.get(3) == 4); + assertTrue (*aCache.get(3) == 4); // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -181,9 +181,9 @@ void ExpireCacheTest::testExpireWithHas() // 3-1|5 -> 5 gets removed ExpireCache aCache(DURSLEEP); aCache.add(1, 2); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); Thread::sleep(DURWAIT); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); } diff --git a/Foundation/testsuite/src/ExpireLRUCacheTest.cpp b/Foundation/testsuite/src/ExpireLRUCacheTest.cpp index 4b25e49b8..523e9faf6 100644 --- a/Foundation/testsuite/src/ExpireLRUCacheTest.cpp +++ b/Foundation/testsuite/src/ExpireLRUCacheTest.cpp @@ -42,16 +42,16 @@ void ExpireLRUCacheTest::testClear() aCache.add(1, 2); aCache.add(3, 4); aCache.add(5, 6); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(1) == 2); - assert (*aCache.get(3) == 4); - assert (*aCache.get(5) == 6); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(1) == 2); + assertTrue (*aCache.get(3) == 4); + assertTrue (*aCache.get(5) == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } @@ -74,49 +74,49 @@ void ExpireLRUCacheTest::testExpireN() // 3-1|5 -> 5 gets removed ExpireLRUCache aCache(3, DURSLEEP); aCache.add(1, 2); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); SharedPtr tmp = aCache.get(1); - assert (!tmp.isNull()); - assert (*tmp == 2); + assertTrue (!tmp.isNull()); + assertTrue (*tmp == 2); Thread::sleep(DURWAIT); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); // tmp must still be valid, access it - assert (*tmp == 2); + assertTrue (*tmp == 2); tmp = aCache.get(1); - assert (!tmp); + assertTrue (!tmp); aCache.add(1, 2); // 1 Thread::sleep(DURHALFSLEEP); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); tmp = aCache.get(1); SharedPtr tmp2 = aCache.get(3); - assert (*tmp == 2); - assert (*tmp2 == 4); + assertTrue (*tmp == 2); + assertTrue (*tmp2 == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (*tmp == 2); // 1-3 - assert (*tmp2 == 4); // 3-1 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*tmp == 2); // 1-3 + assertTrue (*tmp2 == 4); // 3-1 tmp2 = aCache.get(3); - assert (*tmp2 == 4); + assertTrue (*tmp2 == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(3)); - assert (*tmp2 == 4); + assertTrue (!aCache.has(3)); + assertTrue (*tmp2 == 4); tmp = aCache.get(1); tmp2 = aCache.get(3); - assert (!tmp); - assert (!tmp2); + assertTrue (!tmp); + assertTrue (!tmp2); // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -126,37 +126,37 @@ void ExpireLRUCacheTest::testAccessExpireN() // 3-1|5 -> 5 gets removed AccessExpireLRUCache aCache(3, DURSLEEP); aCache.add(1, 2); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); SharedPtr tmp = aCache.get(1); - assert (!tmp.isNull()); - assert (*tmp == 2); - assert (aCache.size() == 1); + assertTrue (!tmp.isNull()); + assertTrue (*tmp == 2); + assertTrue (aCache.size() == 1); Thread::sleep(DURWAIT); - assert (aCache.size() == 0); - assert (!aCache.has(1)); + assertTrue (aCache.size() == 0); + assertTrue (!aCache.has(1)); // tmp must still be valid, access it - assert (*tmp == 2); + assertTrue (*tmp == 2); tmp = aCache.get(1); - assert (!tmp); + assertTrue (!tmp); aCache.add(1, 2); // 1 Thread::sleep(DURHALFSLEEP); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); Thread::sleep(DURHALFSLEEP+50); //3|1 - assert (!aCache.has(1)); - assert (*aCache.get(3) == 4); + assertTrue (!aCache.has(1)); + assertTrue (*aCache.get(3) == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (*aCache.get(3) == 4); + assertTrue (*aCache.get(3) == 4); // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -178,22 +178,22 @@ void ExpireLRUCacheTest::testCacheSize1() { ExpireLRUCache aCache(1); aCache.add(1, 2); - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(3, 4); // replaces 1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (*aCache.get(3) == 4); + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(3) == 4); aCache.add(5, 6); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); aCache.remove(5); - assert (!aCache.has(5)); + assertTrue (!aCache.has(5)); // removing illegal entries should work too aCache.remove(666); @@ -206,37 +206,37 @@ void ExpireLRUCacheTest::testCacheSize2() // 3-1|5 -> 5 gets removed ExpireLRUCache aCache(2); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (*aCache.get(1) == 2); // 1-3 - assert (*aCache.get(3) == 4); // 3-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(1) == 2); // 1-3 + assertTrue (*aCache.get(3) == 4); // 3-1 aCache.add(5, 6); // 5-3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); // 5-3 - assert (*aCache.get(3) == 4); // 3-5 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); // 5-3 + assertTrue (*aCache.get(3) == 4); // 3-5 // test remove from the end and the beginning of the list aCache.remove(5); // 3 - assert (!aCache.has(5)); - assert (*aCache.get(3) == 4); // 3 + assertTrue (!aCache.has(5)); + assertTrue (*aCache.get(3) == 4); // 3 aCache.add(5, 6); // 5-3 - assert (*aCache.get(3) == 4); // 3-5 + assertTrue (*aCache.get(3) == 4); // 3-5 aCache.remove(3); // 5 - assert (!aCache.has(3)); - assert (*aCache.get(5) == 6); // 5 + assertTrue (!aCache.has(3)); + assertTrue (*aCache.get(5) == 6); // 5 // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); + assertTrue (!aCache.has(5)); } @@ -246,48 +246,48 @@ void ExpireLRUCacheTest::testCacheSizeN() // 3-1|5 -> 5 gets removed ExpireLRUCache aCache(3); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (*aCache.get(1) == 2); // 1-3 - assert (*aCache.get(3) == 4); // 3-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(1) == 2); // 1-3 + assertTrue (*aCache.get(3) == 4); // 3-1 aCache.add(5, 6); // 5-3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); // 5-3-1 - assert (*aCache.get(3) == 4); // 3-5-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); // 5-3-1 + assertTrue (*aCache.get(3) == 4); // 3-5-1 aCache.add(7, 8); // 7-5-3|1 - assert (!aCache.has(1)); - assert (aCache.has(7)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); // 5-7-3 - assert (*aCache.get(3) == 4); // 3-5-7 - assert (*aCache.get(7) == 8); // 7-3-5 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(7)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); // 5-7-3 + assertTrue (*aCache.get(3) == 4); // 3-5-7 + assertTrue (*aCache.get(7) == 8); // 7-3-5 // test remove from the end and the beginning of the list aCache.remove(5); // 7-3 - assert (!aCache.has(5)); - assert (*aCache.get(3) == 4); // 3-7 + assertTrue (!aCache.has(5)); + assertTrue (*aCache.get(3) == 4); // 3-7 aCache.add(5, 6); // 5-3-7 - assert (*aCache.get(7) == 8); // 7-5-3 + assertTrue (*aCache.get(7) == 8); // 7-5-3 aCache.remove(7); // 5-3 - assert (!aCache.has(7)); - assert (aCache.has(3)); - assert (*aCache.get(5) == 6); // 5-3 + assertTrue (!aCache.has(7)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(5) == 6); // 5-3 // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -295,11 +295,11 @@ void ExpireLRUCacheTest::testDuplicateAdd() { ExpireLRUCache aCache(3); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(1, 3); - assert (aCache.has(1)); - assert (*aCache.get(1) == 3); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 3); } diff --git a/Foundation/testsuite/src/FIFOBufferStreamTest.cpp b/Foundation/testsuite/src/FIFOBufferStreamTest.cpp index 391a476e9..4d2f806bc 100644 --- a/Foundation/testsuite/src/FIFOBufferStreamTest.cpp +++ b/Foundation/testsuite/src/FIFOBufferStreamTest.cpp @@ -36,41 +36,41 @@ void FIFOBufferStreamTest::testInput() const char* data = "This is a test"; FIFOBuffer fb1(data, 14); FIFOBufferStream str1(fb1); - assert (str1.rdbuf()->fifoBuffer().isFull()); + assertTrue (str1.rdbuf()->fifoBuffer().isFull()); int c = str1.get(); - assert (c == 'T'); + assertTrue (c == 'T'); c = str1.get(); - assert (c == 'h'); + assertTrue (c == 'h'); std::string str; str1 >> str; - assert (str == "is"); + assertTrue (str == "is"); char buffer[32]; str1.read(buffer, sizeof(buffer)); - assert (str1.gcount() == 10); + assertTrue (str1.gcount() == 10); buffer[str1.gcount()] = 0; - assert (std::string(" is a test") == buffer); + assertTrue (std::string(" is a test") == buffer); const char* data2 = "123"; FIFOBufferStream str2(data2, 3); c = str2.get(); - assert (c == '1'); - assert (str2.good()); + assertTrue (c == '1'); + assertTrue (str2.good()); c = str2.get(); - assert (c == '2'); + assertTrue (c == '2'); str2.unget(); c = str2.get(); - assert (c == '2'); - assert (str2.good()); + assertTrue (c == '2'); + assertTrue (str2.good()); c = str2.get(); - assert (c == '3'); - assert (str2.good()); + assertTrue (c == '3'); + assertTrue (str2.good()); c = str2.get(); - assert (c == -1); - assert (str2.eof()); + assertTrue (c == -1); + assertTrue (str2.eof()); } @@ -79,7 +79,7 @@ void FIFOBufferStreamTest::testOutput() char output[64]; FIFOBufferStream iostr1(output, 64); iostr1 << "This is a test " << 42 << std::ends << std::flush; - assert (std::string("This is a test 42") == output); + assertTrue (std::string("This is a test 42") == output); } @@ -87,75 +87,75 @@ void FIFOBufferStreamTest::testNotify() { FIFOBuffer fb(18); FIFOBufferStream iostr(fb); - assert (iostr.rdbuf()->fifoBuffer().isEmpty()); + assertTrue (iostr.rdbuf()->fifoBuffer().isEmpty()); - assert (0 == _readableToNot); - assert (0 == _notToReadable); - assert (0 == _writableToNot); - assert (0 == _notToWritable); + assertTrue (0 == _readableToNot); + assertTrue (0 == _notToReadable); + assertTrue (0 == _writableToNot); + assertTrue (0 == _notToWritable); iostr.readable += delegate(this, &FIFOBufferStreamTest::onReadable); iostr.writable += delegate(this, &FIFOBufferStreamTest::onWritable); iostr << "This is a test " << 42 << std::ends << std::flush; - assert (iostr.rdbuf()->fifoBuffer().isFull()); + assertTrue (iostr.rdbuf()->fifoBuffer().isFull()); - assert (0 == _readableToNot); - assert (1 == _notToReadable); - assert (1 == _writableToNot); - assert (0 == _notToWritable); + assertTrue (0 == _readableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _writableToNot); + assertTrue (0 == _notToWritable); char input[64]; iostr >> input; - assert (std::string("This") == input); - assert (iostr.rdbuf()->fifoBuffer().isEmpty()); + assertTrue (std::string("This") == input); + assertTrue (iostr.rdbuf()->fifoBuffer().isEmpty()); - assert (1 == _readableToNot); - assert (1 == _notToReadable); - assert (1 == _writableToNot); - assert (1 == _notToWritable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _writableToNot); + assertTrue (1 == _notToWritable); iostr >> input; - assert (std::string("is") == input); + assertTrue (std::string("is") == input); - assert (1 == _readableToNot); - assert (1 == _notToReadable); - assert (1 == _writableToNot); - assert (1 == _notToWritable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _writableToNot); + assertTrue (1 == _notToWritable); iostr >> input; - assert (std::string("a") == input); + assertTrue (std::string("a") == input); - assert (1 == _readableToNot); - assert (1 == _notToReadable); - assert (1 == _writableToNot); - assert (1 == _notToWritable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _writableToNot); + assertTrue (1 == _notToWritable); iostr >> input; - assert (std::string("test") == input); + assertTrue (std::string("test") == input); - assert (1 == _readableToNot); - assert (1 == _notToReadable); - assert (1 == _writableToNot); - assert (1 == _notToWritable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _writableToNot); + assertTrue (1 == _notToWritable); iostr >> input; - assert (std::string("42") == input); + assertTrue (std::string("42") == input); - assert (1 == _readableToNot); - assert (1 == _notToReadable); - assert (1 == _writableToNot); - assert (1 == _notToWritable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToReadable); + assertTrue (1 == _writableToNot); + assertTrue (1 == _notToWritable); iostr.clear(); - assert (iostr.good()); + assertTrue (iostr.good()); iostr << "This is a test " << 42 << std::ends << std::flush; - assert (iostr.rdbuf()->fifoBuffer().isFull()); + assertTrue (iostr.rdbuf()->fifoBuffer().isFull()); - assert (1 == _readableToNot); - assert (2 == _notToReadable); - assert (2 == _writableToNot); - assert (1 == _notToWritable); + assertTrue (1 == _readableToNot); + assertTrue (2 == _notToReadable); + assertTrue (2 == _writableToNot); + assertTrue (1 == _notToWritable); iostr.readable -= delegate(this, &FIFOBufferStreamTest::onReadable); iostr.writable -= delegate(this, &FIFOBufferStreamTest::onWritable); diff --git a/Foundation/testsuite/src/FIFOEventTest.cpp b/Foundation/testsuite/src/FIFOEventTest.cpp index ae1a6e0b3..9497b9c12 100644 --- a/Foundation/testsuite/src/FIFOEventTest.cpp +++ b/Foundation/testsuite/src/FIFOEventTest.cpp @@ -38,50 +38,50 @@ void FIFOEventTest::testNoDelegate() int tmp = 0; EventArgs args; - assert (_count == 0); + assertTrue (_count == 0); Void.notify(this); - assert (_count == 0); + assertTrue (_count == 0); Void += delegate(this, &FIFOEventTest::onVoid); Void -= delegate(this, &FIFOEventTest::onVoid); Void.notify(this); - assert (_count == 0); + assertTrue (_count == 0); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &FIFOEventTest::onSimple); Simple -= delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); ConstSimple += delegate(this, &FIFOEventTest::onConstSimple); ConstSimple -= delegate(this, &FIFOEventTest::onConstSimple); ConstSimple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); //Note: passing &args will not work due to & EventArgs* pArgs = &args; Complex += delegate(this, &FIFOEventTest::onComplex); Complex -= delegate(this, &FIFOEventTest::onComplex); Complex.notify(this, pArgs); - assert (_count == 0); + assertTrue (_count == 0); Complex2 += delegate(this, &FIFOEventTest::onComplex2); Complex2 -= delegate(this, &FIFOEventTest::onComplex2); Complex2.notify(this, args); - assert (_count == 0); + assertTrue (_count == 0); const EventArgs* pCArgs = &args; ConstComplex += delegate(this, &FIFOEventTest::onConstComplex); ConstComplex -= delegate(this, &FIFOEventTest::onConstComplex); ConstComplex.notify(this, pCArgs); - assert (_count == 0); + assertTrue (_count == 0); Const2Complex += delegate(this, &FIFOEventTest::onConst2Complex); Const2Complex -= delegate(this, &FIFOEventTest::onConst2Complex); Const2Complex.notify(this, pArgs); - assert (_count == 0); + assertTrue (_count == 0); } void FIFOEventTest::testSingleDelegate() @@ -89,40 +89,40 @@ void FIFOEventTest::testSingleDelegate() int tmp = 0; EventArgs args; - assert (_count == 0); + assertTrue (_count == 0); Void += delegate(this, &FIFOEventTest::onVoid); Void.notify(this); - assert (_count == 1); + assertTrue (_count == 1); Simple += delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); ConstSimple += delegate(this, &FIFOEventTest::onConstSimple); ConstSimple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); EventArgs* pArgs = &args; Complex += delegate(this, &FIFOEventTest::onComplex); Complex.notify(this, pArgs); - assert (_count == 4); + assertTrue (_count == 4); Complex2 += delegate(this, &FIFOEventTest::onComplex2); Complex2.notify(this, args); - assert (_count == 5); + assertTrue (_count == 5); const EventArgs* pCArgs = &args; ConstComplex += delegate(this, &FIFOEventTest::onConstComplex); ConstComplex.notify(this, pCArgs); - assert (_count == 6); + assertTrue (_count == 6); Const2Complex += delegate(this, &FIFOEventTest::onConst2Complex); Const2Complex.notify(this, pArgs); - assert (_count == 7); + assertTrue (_count == 7); // check if 2nd notify also works Const2Complex.notify(this, pArgs); - assert (_count == 8); + assertTrue (_count == 8); } @@ -130,15 +130,15 @@ void FIFOEventTest::testDuplicateRegister() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &FIFOEventTest::onSimple); Simple += delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); Simple -= delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } void FIFOEventTest::testDuplicateUnregister() @@ -146,23 +146,23 @@ void FIFOEventTest::testDuplicateUnregister() // duplicate unregister shouldn't give an error, int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple -= delegate(this, &FIFOEventTest::onSimple); // should work Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= delegate(this, &FIFOEventTest::onSimple); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } @@ -170,22 +170,22 @@ void FIFOEventTest::testDisabling() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &FIFOEventTest::onSimple); Simple.disable(); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple.enable(); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); // unregister should also work with disabled event Simple.disable(); Simple -= delegate(this, &FIFOEventTest::onSimple); Simple.enable(); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } void FIFOEventTest::testFIFOOrder() @@ -193,13 +193,13 @@ void FIFOEventTest::testFIFOOrder() DummyDelegate o1; DummyDelegate o2; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(&o1, &DummyDelegate::onSimple); Simple += delegate(&o2, &DummyDelegate::onSimple2); int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); Simple -= delegate(&o1, &DummyDelegate::onSimple); Simple -= delegate(&o2, &DummyDelegate::onSimple2); @@ -225,32 +225,32 @@ void FIFOEventTest::testFIFOOrderExpire() DummyDelegate o1; DummyDelegate o2; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(&o1, &DummyDelegate::onSimple, 5000); Simple += delegate(&o2, &DummyDelegate::onSimple2, 5000); int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); // both ways of unregistering should work Simple -= delegate(&o1, &DummyDelegate::onSimple, 6000); Simple -= delegate(&o2, &DummyDelegate::onSimple2); Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); // now start mixing of expire and non expire tmp = 0; Simple += delegate(&o1, &DummyDelegate::onSimple); Simple += delegate(&o2, &DummyDelegate::onSimple2, 5000); Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); Simple -= delegate(&o2, &DummyDelegate::onSimple2); // it is not forbidden to unregister a non expiring event with an expire decorator (it is just stupid ;-)) Simple -= delegate(&o1, &DummyDelegate::onSimple, 6000); Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); // now try with the wrong order Simple += delegate(&o2, &DummyDelegate::onSimple2, 5000); @@ -273,14 +273,14 @@ void FIFOEventTest::testExpire() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &FIFOEventTest::onSimple, 500); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Poco::Thread::sleep(700); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } @@ -288,22 +288,22 @@ void FIFOEventTest::testExpireReRegister() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += delegate(this, &FIFOEventTest::onSimple, 500); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Poco::Thread::sleep(200); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); // renew registration Simple += delegate(this, &FIFOEventTest::onSimple, 600); Poco::Thread::sleep(400); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); Poco::Thread::sleep(300); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } @@ -314,7 +314,7 @@ void FIFOEventTest::testReturnParams() int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 1); + assertTrue (tmp == 1); } void FIFOEventTest::testOverwriteDelegate() @@ -325,22 +325,22 @@ void FIFOEventTest::testOverwriteDelegate() int tmp = 0; // onsimple requires 0 as input Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); } void FIFOEventTest::testAsyncNotify() { Poco::FIFOEvent* pSimple= new Poco::FIFOEvent(); (*pSimple) += delegate(this, &FIFOEventTest::onAsync); - assert (_count == 0); + assertTrue (_count == 0); int tmp = 0; Poco::ActiveResultretArg = pSimple->notifyAsync(this, tmp); delete pSimple; // must work even when the event got deleted! pSimple = NULL; - assert (_count == 0); + assertTrue (_count == 0); retArg.wait(); - assert (retArg.data() == tmp); - assert (_count == LARGEINC); + assertTrue (retArg.data() == tmp); + assertTrue (_count == LARGEINC); } void FIFOEventTest::onVoid(const void* pSender) diff --git a/Foundation/testsuite/src/FPETest.cpp b/Foundation/testsuite/src/FPETest.cpp index 947dfaf3b..27043ebbf 100644 --- a/Foundation/testsuite/src/FPETest.cpp +++ b/Foundation/testsuite/src/FPETest.cpp @@ -35,10 +35,10 @@ void FPETest::testClassify() float nan = a/b; float inf = 1.0f/b; - assert (FPE::isNaN(nan)); - assert (!FPE::isNaN(a)); - assert (FPE::isInfinite(inf)); - assert (!FPE::isInfinite(a)); + assertTrue (FPE::isNaN(nan)); + assertTrue (!FPE::isNaN(a)); + assertTrue (FPE::isInfinite(inf)); + assertTrue (!FPE::isInfinite(a)); } { double a = 0; @@ -46,10 +46,10 @@ void FPETest::testClassify() double nan = a/b; double inf = 1.0/b; - assert (FPE::isNaN(nan)); - assert (!FPE::isNaN(a)); - assert (FPE::isInfinite(inf)); - assert (!FPE::isInfinite(a)); + assertTrue (FPE::isNaN(nan)); + assertTrue (!FPE::isNaN(a)); + assertTrue (FPE::isInfinite(inf)); + assertTrue (!FPE::isInfinite(a)); } } @@ -87,16 +87,16 @@ void FPETest::testFlags() volatile double c = div(a, b); #if !defined(POCO_NO_FPENVIRONMENT) - assert (FPE::isFlag(FPE::FP_DIVIDE_BY_ZERO)); + assertTrue (FPE::isFlag(FPE::FP_DIVIDE_BY_ZERO)); #endif - assert (FPE::isInfinite(c)); + assertTrue (FPE::isInfinite(c)); FPE::clearFlags(); a = 1.23456789e210; b = 9.87654321e210; c = mult(a, b); #if !defined(POCO_NO_FPENVIRONMENT) - assert (FPE::isFlag(FPE::FP_OVERFLOW)); + assertTrue (FPE::isFlag(FPE::FP_OVERFLOW)); #endif assertEqualDelta(c, c, 0); @@ -105,7 +105,7 @@ void FPETest::testFlags() b = 9.87654321e210; c = div(a, b); #if !defined(POCO_NO_FPENVIRONMENT) - assert (FPE::isFlag(FPE::FP_UNDERFLOW)); + assertTrue (FPE::isFlag(FPE::FP_UNDERFLOW)); #endif assertEqualDelta(c, c, 0); } @@ -124,12 +124,12 @@ void FPETest::testRound() { #if !defined(__osf__) && !defined(__VMS) && !defined(POCO_NO_FPENVIRONMENT) FPE::setRoundingMode(FPE::FP_ROUND_TONEAREST); - assert (FPE::getRoundingMode() == FPE::FP_ROUND_TONEAREST); + assertTrue (FPE::getRoundingMode() == FPE::FP_ROUND_TONEAREST); { FPE env(FPE::FP_ROUND_TOWARDZERO); - assert (FPE::getRoundingMode() == FPE::FP_ROUND_TOWARDZERO); + assertTrue (FPE::getRoundingMode() == FPE::FP_ROUND_TOWARDZERO); } - assert (FPE::getRoundingMode() == FPE::FP_ROUND_TONEAREST); + assertTrue (FPE::getRoundingMode() == FPE::FP_ROUND_TONEAREST); #endif } diff --git a/Foundation/testsuite/src/FileChannelTest.cpp b/Foundation/testsuite/src/FileChannelTest.cpp index 6e8a7838a..2e60ca521 100644 --- a/Foundation/testsuite/src/FileChannelTest.cpp +++ b/Foundation/testsuite/src/FileChannelTest.cpp @@ -70,11 +70,11 @@ void FileChannelTest::testRotateBySize() pChannel->log(msg); } File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); f = name + ".1"; - assert (f.exists()); + assertTrue (f.exists()); f = name + ".2"; - assert (!f.exists()); + assertTrue (!f.exists()); } catch (...) { @@ -100,9 +100,9 @@ void FileChannelTest::testRotateByAge() Thread::sleep(300); } File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); f = name + ".1"; - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -131,7 +131,7 @@ void FileChannelTest::testRotateAtTimeDayUTC() } pChannel->log(msg); File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -160,7 +160,7 @@ void FileChannelTest::testRotateAtTimeDayLocal() } pChannel->log(msg); File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -189,7 +189,7 @@ void FileChannelTest::testRotateAtTimeHourUTC() } pChannel->log(msg); File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -218,7 +218,7 @@ void FileChannelTest::testRotateAtTimeHourLocal() } pChannel->log(msg); File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -247,7 +247,7 @@ void FileChannelTest::testRotateAtTimeMinUTC() } pChannel->log(msg); File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -276,7 +276,7 @@ void FileChannelTest::testRotateAtTimeMinLocal() } pChannel->log(msg); File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -302,7 +302,7 @@ void FileChannelTest::testArchive() pChannel->log(msg); } File f(name + ".0"); - assert (f.exists()); + assertTrue (f.exists()); } catch (...) { @@ -330,9 +330,9 @@ void FileChannelTest::testCompress() } Thread::sleep(3000); // allow time for background compression File f0(name + ".0.gz"); - assert (f0.exists()); + assertTrue (f0.exists()); File f1(name + ".1.gz"); - assert (f1.exists()); + assertTrue (f1.exists()); } catch (...) { @@ -359,11 +359,11 @@ void FileChannelTest::purgeAge(const std::string& pa) pChannel->log(msg); } File f0(name + ".0"); - assert(f0.exists()); + assertTrue (f0.exists()); File f1(name + ".1"); - assert(f1.exists()); + assertTrue (f1.exists()); File f2(name + ".2"); - assert(f2.exists()); + assertTrue (f2.exists()); Thread::sleep(5000); for (int i = 0; i < 50; ++i) @@ -371,7 +371,7 @@ void FileChannelTest::purgeAge(const std::string& pa) pChannel->log(msg); } - assert(!f2.exists()); + assertTrue (!f2.exists()); } catch (...) { @@ -399,11 +399,11 @@ void FileChannelTest::noPurgeAge(const std::string& npa) pChannel->log(msg); } File f0(name + ".0"); - assert(f0.exists()); + assertTrue (f0.exists()); File f1(name + ".1"); - assert(f1.exists()); + assertTrue (f1.exists()); File f2(name + ".2"); - assert(f2.exists()); + assertTrue (f2.exists()); Thread::sleep(5000); for (int i = 0; i < 50; ++i) @@ -411,7 +411,7 @@ void FileChannelTest::noPurgeAge(const std::string& npa) pChannel->log(msg); } - assert(f2.exists()); + assertTrue (f2.exists()); } catch (...) { @@ -455,11 +455,11 @@ void FileChannelTest::purgeCount(const std::string& pc) Thread::sleep(50); } File f0(name + ".0"); - assert(f0.exists()); + assertTrue (f0.exists()); File f1(name + ".1"); - assert(f1.exists()); + assertTrue (f1.exists()); File f2(name + ".2"); - assert(!f2.exists()); + assertTrue (!f2.exists()); } catch (...) { remove(name); @@ -486,11 +486,11 @@ void FileChannelTest::noPurgeCount(const std::string& npc) Thread::sleep(50); } File f0(name + ".0"); - assert(f0.exists()); + assertTrue (f0.exists()); File f1(name + ".1"); - assert(f1.exists()); + assertTrue (f1.exists()); File f2(name + ".2"); - assert(f2.exists()); + assertTrue (f2.exists()); } catch (...) { remove(name); @@ -528,7 +528,7 @@ void FileChannelTest::testWrongPurgeOption() fail("must fail"); } catch (InvalidArgumentException) { - assert(pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds"); + assertTrue (pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds"); } try @@ -537,7 +537,7 @@ void FileChannelTest::testWrongPurgeOption() fail("must fail"); } catch (InvalidArgumentException) { - assert(pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds"); + assertTrue (pChannel->getProperty(FileChannel::PROP_PURGEAGE) == "5 seconds"); } remove(name); diff --git a/Foundation/testsuite/src/FileStreamTest.cpp b/Foundation/testsuite/src/FileStreamTest.cpp index c4b9108be..62fab34f9 100644 --- a/Foundation/testsuite/src/FileStreamTest.cpp +++ b/Foundation/testsuite/src/FileStreamTest.cpp @@ -48,10 +48,10 @@ void FileStreamTest::testRead() fos.close(); Poco::FileInputStream fis(file); - assert (fis.good()); + assertTrue (fis.good()); std::string read; fis >> read; - assert (!read.empty()); + assertTrue (!read.empty()); } @@ -72,15 +72,15 @@ void FileStreamTest::testWrite() Poco::TemporaryFile::registerForDeletion(file); Poco::FileOutputStream fos(file); - assert (fos.good()); + assertTrue (fos.good()); fos << "hiho"; fos.close(); Poco::FileInputStream fis(file); - assert (fis.good()); + assertTrue (fis.good()); std::string read; fis >> read; - assert (read == "hiho"); + assertTrue (read == "hiho"); } @@ -99,12 +99,12 @@ void FileStreamTest::testReadWrite() Poco::TemporaryFile::registerForDeletion(file); Poco::FileStream fos(file); - assert (fos.good()); + assertTrue (fos.good()); fos << "hiho"; fos.seekg(0, std::ios::beg); std::string read; fos >> read; - assert (read == "hiho"); + assertTrue (read == "hiho"); } @@ -112,7 +112,7 @@ void FileStreamTest::testOpen() { Poco::FileOutputStream ostr; ostr.open("test.txt", std::ios::out); - assert (ostr.good()); + assertTrue (ostr.good()); ostr.close(); } @@ -134,7 +134,7 @@ void FileStreamTest::testOpenModeIn() f.createFile(); Poco::FileInputStream istr("nonexistent.txt"); - assert (istr.good()); + assertTrue (istr.good()); } @@ -148,20 +148,20 @@ void FileStreamTest::testOpenModeOut() ostr1 << "Hello, world!"; ostr1.close(); - assert (f.exists()); - assert (f.getSize() != 0); + assertTrue (f.exists()); + assertTrue (f.getSize() != 0); Poco::FileStream str1("test.txt"); str1.close(); - assert (f.exists()); - assert (f.getSize() != 0); + assertTrue (f.exists()); + assertTrue (f.getSize() != 0); Poco::FileOutputStream ostr2("test.txt"); ostr2.close(); - assert (f.exists()); - assert (f.getSize() == 0); + assertTrue (f.exists()); + assertTrue (f.getSize() == 0); f.remove(); } @@ -177,14 +177,14 @@ void FileStreamTest::testOpenModeTrunc() ostr1 << "Hello, world!"; ostr1.close(); - assert (f.exists()); - assert (f.getSize() != 0); + assertTrue (f.exists()); + assertTrue (f.getSize() != 0); Poco::FileStream str1("test.txt", std::ios::trunc); str1.close(); - assert (f.exists()); - assert (f.getSize() == 0); + assertTrue (f.exists()); + assertTrue (f.getSize() == 0); f.remove(); } @@ -198,12 +198,12 @@ void FileStreamTest::testOpenModeAte() Poco::FileStream str1("test.txt", std::ios::ate); int c = str1.get(); - assert (str1.eof()); + assertTrue (str1.eof()); str1.clear(); str1.seekg(0); c = str1.get(); - assert (c == '0'); + assertTrue (c == '0'); str1.close(); @@ -212,7 +212,7 @@ void FileStreamTest::testOpenModeAte() str2.seekg(0); std::string s; str2 >> s; - assert (s == "0123456789abcdef"); + assertTrue (s == "0123456789abcdef"); str2.close(); } @@ -236,7 +236,7 @@ void FileStreamTest::testOpenModeApp() Poco::FileInputStream istr("test.txt"); std::string s; istr >> s; - assert (s == "0123456789abcdef"); + assertTrue (s == "0123456789abcdef"); istr.close(); } @@ -248,37 +248,37 @@ void FileStreamTest::testSeek() str.seekg(0); int c = str.get(); - assert (c == '0'); + assertTrue (c == '0'); str.seekg(10); - assert (str.tellg() == std::streampos(10)); + assertTrue (str.tellg() == std::streampos(10)); c = str.get(); - assert (c == 'a'); - assert (str.tellg() == std::streampos(11)); + assertTrue (c == 'a'); + assertTrue (str.tellg() == std::streampos(11)); str.seekg(-1, std::ios::end); - assert (str.tellg() == std::streampos(15)); + assertTrue (str.tellg() == std::streampos(15)); c = str.get(); - assert (c == 'f'); - assert (str.tellg() == std::streampos(16)); + assertTrue (c == 'f'); + assertTrue (str.tellg() == std::streampos(16)); str.seekg(-1, std::ios::cur); - assert (str.tellg() == std::streampos(15)); + assertTrue (str.tellg() == std::streampos(15)); c = str.get(); - assert (c == 'f'); - assert (str.tellg() == std::streampos(16)); + assertTrue (c == 'f'); + assertTrue (str.tellg() == std::streampos(16)); str.seekg(-4, std::ios::cur); - assert (str.tellg() == std::streampos(12)); + assertTrue (str.tellg() == std::streampos(12)); c = str.get(); - assert (c == 'c'); - assert (str.tellg() == std::streampos(13)); + assertTrue (c == 'c'); + assertTrue (str.tellg() == std::streampos(13)); str.seekg(1, std::ios::cur); - assert (str.tellg() == std::streampos(14)); + assertTrue (str.tellg() == std::streampos(14)); c = str.get(); - assert (c == 'e'); - assert (str.tellg() == std::streampos(15)); + assertTrue (c == 'e'); + assertTrue (str.tellg() == std::streampos(15)); } @@ -293,12 +293,12 @@ void FileStreamTest::testMultiOpen() std::string s; str.open("test.txt", std::ios::in); std::getline(str, s); - assert (s == "0123456789"); + assertTrue (s == "0123456789"); str.close(); str.open("test.txt", std::ios::in); std::getline(str, s); - assert (s == "0123456789"); + assertTrue (s == "0123456789"); str.close(); } diff --git a/Foundation/testsuite/src/FileTest.cpp b/Foundation/testsuite/src/FileTest.cpp index 8141b371d..3e1d4a47d 100644 --- a/Foundation/testsuite/src/FileTest.cpp +++ b/Foundation/testsuite/src/FileTest.cpp @@ -41,7 +41,7 @@ FileTest::~FileTest() void FileTest::testFileAttributes1() { File f("testfile.dat"); - assert (!f.exists()); + assertTrue (!f.exists()); try { @@ -185,10 +185,10 @@ void FileTest::testCreateFile() { File f("testfile.dat"); bool created = f.createFile(); - assert (created); - assert (!f.isHidden()); + assertTrue (created); + assertTrue (!f.isHidden()); created = f.createFile(); - assert (!created); + assertTrue (!created); } @@ -197,29 +197,29 @@ void FileTest::testFileAttributes2() TemporaryFile f; bool created = f.createFile(); Timestamp ts; - assert (created); + assertTrue (created); - assert (f.exists()); - assert (f.canRead()); - assert (f.canWrite()); - assert (f.isFile()); - assert (!f.isDirectory()); + assertTrue (f.exists()); + assertTrue (f.canRead()); + assertTrue (f.canWrite()); + assertTrue (f.isFile()); + assertTrue (!f.isDirectory()); Timestamp tsc = f.created(); Timestamp tsm = f.getLastModified(); - assert (tsc - ts >= -2000000 && tsc - ts <= 2000000); - assert (tsm - ts >= -2000000 && tsm - ts <= 2000000); + assertTrue (tsc - ts >= -2000000 && tsc - ts <= 2000000); + assertTrue (tsm - ts >= -2000000 && tsm - ts <= 2000000); f.setWriteable(false); - assert (!f.canWrite()); - assert (f.canRead()); + assertTrue (!f.canWrite()); + assertTrue (f.canRead()); f.setReadOnly(false); - assert (f.canWrite()); - assert (f.canRead()); + assertTrue (f.canWrite()); + assertTrue (f.canRead()); ts = Timestamp::fromEpochTime(1000000); f.setLastModified(ts); - assert (f.getLastModified() == ts); + assertTrue (f.getLastModified() == ts); } @@ -236,9 +236,9 @@ void FileTest::testFileAttributes3() #endif #if !defined(_WIN32_WCE) - assert (f.isDevice()); - assert (!f.isFile()); - assert (!f.isDirectory()); + assertTrue (f.isDevice()); + assertTrue (!f.isFile()); + assertTrue (!f.isDirectory()); #endif } @@ -249,22 +249,22 @@ void FileTest::testCompare() File f2("def.txt"); File f3("abc.txt"); - assert (f1 == f3); - assert (!(f1 == f2)); - assert (f1 != f2); - assert (!(f1 != f3)); - assert (!(f1 == f2)); - assert (f1 < f2); - assert (f1 <= f2); - assert (!(f2 < f1)); - assert (!(f2 <= f1)); - assert (f2 > f1); - assert (f2 >= f1); - assert (!(f1 > f2)); - assert (!(f1 >= f2)); + assertTrue (f1 == f3); + assertTrue (!(f1 == f2)); + assertTrue (f1 != f2); + assertTrue (!(f1 != f3)); + assertTrue (!(f1 == f2)); + assertTrue (f1 < f2); + assertTrue (f1 <= f2); + assertTrue (!(f2 < f1)); + assertTrue (!(f2 <= f1)); + assertTrue (f2 > f1); + assertTrue (f2 >= f1); + assertTrue (!(f1 > f2)); + assertTrue (!(f1 >= f2)); - assert (f1 <= f3); - assert (f1 >= f3); + assertTrue (f1 <= f3); + assertTrue (f1 >= f3); } @@ -274,21 +274,21 @@ void FileTest::testRootDir() #if defined(_WIN32_WCE) File f1("\\"); File f2("/"); - assert (f1.exists()); - assert (f2.exists()); + assertTrue (f1.exists()); + assertTrue (f2.exists()); #else File f1("/"); File f2("c:/"); File f3("c:\\"); File f4("\\"); - assert (f1.exists()); - assert (f2.exists()); - assert (f3.exists()); - assert (f4.exists()); + assertTrue (f1.exists()); + assertTrue (f2.exists()); + assertTrue (f3.exists()); + assertTrue (f4.exists()); #endif #else File f1("/"); - assert (f1.exists()); + assertTrue (f1.exists()); #endif } @@ -298,8 +298,8 @@ void FileTest::testSwap() File f1("abc.txt"); File f2("def.txt"); f1.swap(f2); - assert (f1.path() == "def.txt"); - assert (f2.path() == "abc.txt"); + assertTrue (f1.path() == "def.txt"); + assertTrue (f2.path() == "abc.txt"); } @@ -309,9 +309,9 @@ void FileTest::testSize() ostr << "Hello, world!" << std::endl; ostr.close(); File f("testfile.dat"); - assert (f.getSize() > 0); + assertTrue (f.getSize() > 0); f.setSize(0); - assert (f.getSize() == 0); + assertTrue (f.getSize() == 0); } @@ -328,12 +328,12 @@ void FileTest::testDirectory() TemporaryFile::registerForDeletion("testdir"); bool created = d.createDirectory(); - assert (created); - assert (d.isDirectory()); - assert (!d.isFile()); + assertTrue (created); + assertTrue (d.isDirectory()); + assertTrue (!d.isFile()); std::vector files; d.list(files); - assert (files.empty()); + assertTrue (files.empty()); File f = Path("testdir/file1", Path::PATH_UNIX); f.createFile(); @@ -343,23 +343,23 @@ void FileTest::testDirectory() f.createFile(); d.list(files); - assert (files.size() == 3); + assertTrue (files.size() == 3); std::set fs; fs.insert(files.begin(), files.end()); - assert (fs.find("file1") != fs.end()); - assert (fs.find("file2") != fs.end()); - assert (fs.find("file3") != fs.end()); + assertTrue (fs.find("file1") != fs.end()); + assertTrue (fs.find("file2") != fs.end()); + assertTrue (fs.find("file3") != fs.end()); File dd(Path("testdir/testdir2/testdir3", Path::PATH_UNIX)); dd.createDirectories(); - assert (dd.exists()); - assert (dd.isDirectory()); + assertTrue (dd.exists()); + assertTrue (dd.isDirectory()); File ddd(Path("testdir/testdirB/testdirC/testdirD", Path::PATH_UNIX)); ddd.createDirectories(); - assert (ddd.exists()); - assert (ddd.isDirectory()); + assertTrue (ddd.exists()); + assertTrue (ddd.isDirectory()); d.remove(true); } @@ -374,9 +374,9 @@ void FileTest::testCopy() File f1("testfile.dat"); TemporaryFile f2; f1.setReadOnly().copyTo(f2.path()); - assert (f2.exists()); - assert (!f2.canWrite()); - assert (f1.getSize() == f2.getSize()); + assertTrue (f2.exists()); + assertTrue (!f2.canWrite()); + assertTrue (f1.getSize() == f2.getSize()); f1.setWriteable().remove(); } @@ -391,10 +391,10 @@ void FileTest::testMove() File::FileSize sz = f1.getSize(); TemporaryFile f2; f1.moveTo(f2.path()); - assert (f2.exists()); - assert (f2.getSize() == sz); - assert (f1.exists()); - assert (f1 == f2); + assertTrue (f2.exists()); + assertTrue (f2.getSize() == sz); + assertTrue (f1.exists()); + assertTrue (f1 == f2); } @@ -440,28 +440,28 @@ void FileTest::testCopyDirectory() Path pd1t("testdir2"); File fd1t(pd1t); - assert (fd1t.exists()); - assert (fd1t.isDirectory()); + assertTrue (fd1t.exists()); + assertTrue (fd1t.isDirectory()); Path pd2t(pd1t, "subdir"); File fd2t(pd2t); - assert (fd2t.exists()); - assert (fd2t.isDirectory()); + assertTrue (fd2t.exists()); + assertTrue (fd2t.isDirectory()); Path pf1t(pd1t, "testfile1.dat"); File ff1t(pf1t); - assert (ff1t.exists()); - assert (ff1t.isFile()); + assertTrue (ff1t.exists()); + assertTrue (ff1t.isFile()); Path pf2t(pd1t, "testfile2.dat"); File ff2t(pf2t); - assert (ff2t.exists()); - assert (ff2t.isFile()); + assertTrue (ff2t.exists()); + assertTrue (ff2t.isFile()); Path pf3t(pd2t, "testfile3.dat"); File ff3t(pf3t); - assert (ff3t.exists()); - assert (ff3t.isFile()); + assertTrue (ff3t.exists()); + assertTrue (ff3t.isFile()); fd1.remove(true); fd3.remove(true); @@ -478,9 +478,9 @@ void FileTest::testRename() File f2("testfile2.dat"); f1.renameTo(f2.path()); - assert (f2.exists()); - assert (f1.exists()); - assert (f1 == f2); + assertTrue (f2.exists()); + assertTrue (f1.exists()); + assertTrue (f1 == f2); f2.remove(); } @@ -501,8 +501,8 @@ void FileTest::testLongPath() Poco::File d(longpath); d.createDirectories(); - assert (d.exists()); - assert (d.isDirectory()); + assertTrue (d.exists()); + assertTrue (d.isDirectory()); Poco::File f(p.toString()); f.remove(true); diff --git a/Foundation/testsuite/src/FormatTest.cpp b/Foundation/testsuite/src/FormatTest.cpp index 4f406e1d2..4b121038a 100644 --- a/Foundation/testsuite/src/FormatTest.cpp +++ b/Foundation/testsuite/src/FormatTest.cpp @@ -36,14 +36,14 @@ void FormatTest::testChar() { char c = 'a'; std::string s(format("%c", c)); - assert(s == "a"); + assertTrue (s == "a"); s = format("%2c", c); - assert(s == " a"); + assertTrue (s == " a"); s = format("%-2c", c); - assert(s == "a "); + assertTrue (s == "a "); s = format("%c", std::string("foo")); - assert(s == "[ERRFMT]"); + assertTrue (s == "[ERRFMT]"); } @@ -51,119 +51,119 @@ void FormatTest::testInt() { int i = 42; std::string s(format("%d", i)); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4d", i); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04d", i); - assert (s == "0042"); + assertTrue (s == "0042"); short h = 42; s = format("%hd", h); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4hd", h); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04hd", h); - assert (s == "0042"); + assertTrue (s == "0042"); unsigned short hu = 42; s = format("%hu", hu); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4hu", hu); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04hu", hu); - assert (s == "0042"); + assertTrue (s == "0042"); unsigned x = 0x42; s = format("%x", x); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4x", x); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04x", x); - assert (s == "0042"); + assertTrue (s == "0042"); unsigned o = 042; s = format("%o", o); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4o", o); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04o", o); - assert (s == "0042"); + assertTrue (s == "0042"); unsigned u = 42; s = format("%u", u); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4u", u); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04u", u); - assert (s == "0042"); + assertTrue (s == "0042"); long l = 42; s = format("%ld", l); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4ld", l); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04ld", l); - assert (s == "0042"); + assertTrue (s == "0042"); unsigned long ul = 42; s = format("%lu", ul); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4lu", ul); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04lu", ul); - assert (s == "0042"); + assertTrue (s == "0042"); unsigned long xl = 0x42; s = format("%lx", xl); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4lx", xl); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04lx", xl); - assert (s == "0042"); + assertTrue (s == "0042"); Int64 i64 = 42; s = format("%Ld", i64); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4Ld", i64); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04Ld", i64); - assert (s == "0042"); + assertTrue (s == "0042"); UInt64 ui64 = 42; s = format("%Lu", ui64); - assert (s == "42"); + assertTrue (s == "42"); s = format("%4Lu", ui64); - assert (s == " 42"); + assertTrue (s == " 42"); s = format("%04Lu", ui64); - assert (s == "0042"); + assertTrue (s == "0042"); x = 0xaa; s = format("%x", x); - assert (s == "aa"); + assertTrue (s == "aa"); s = format("%X", x); - assert (s == "AA"); + assertTrue (s == "AA"); i = 42; s = format("%+d", i); - assert (s == "+42"); + assertTrue (s == "+42"); i = -42; s = format("%+d", i); - assert (s == "-42"); + assertTrue (s == "-42"); s = format("%+04d", i); - assert (s == "-042"); + assertTrue (s == "-042"); s = format("%d", i); - assert (s == "-42"); + assertTrue (s == "-42"); s = format("%d", i); - assert (s == "-42"); + assertTrue (s == "-42"); x = 0x42; s = format("%#x", x); - assert (s == "0x42"); + assertTrue (s == "0x42"); s = format("%d", l); - assert (s == "[ERRFMT]"); + assertTrue (s == "[ERRFMT]"); } @@ -171,11 +171,11 @@ void FormatTest::testBool() { bool b = true; std::string s = format("%b", b); - assert (s == "1"); + assertTrue (s == "1"); b = false; s = format("%b", b); - assert (s == "0"); + assertTrue (s == "0"); std::vector bv; bv.push_back(false); @@ -191,7 +191,7 @@ void FormatTest::testBool() s.clear(); format(s, "%b%b%b%b%b%b%b%b%b%b", bv); - assert (s == "0101010101"); + assertTrue (s == "0101010101"); } @@ -199,59 +199,59 @@ void FormatTest::testAnyInt() { char c = 42; std::string s(format("%?i", c)); - assert (s == "42"); + assertTrue (s == "42"); bool b = true; s = format("%?i", b); - assert (s == "1"); + assertTrue (s == "1"); signed char sc = -42; s = format("%?i", sc); - assert (s == "-42"); + assertTrue (s == "-42"); unsigned char uc = 65; s = format("%?i", uc); - assert (s == "65"); + assertTrue (s == "65"); short ss = -134; s = format("%?i", ss); - assert (s == "-134"); + assertTrue (s == "-134"); unsigned short us = 200; s = format("%?i", us); - assert (s == "200"); + assertTrue (s == "200"); int i = -12345; s = format("%?i", i); - assert (s == "-12345"); + assertTrue (s == "-12345"); unsigned ui = 12345; s = format("%?i", ui); - assert (s == "12345"); + assertTrue (s == "12345"); long l = -54321; s = format("%?i", l); - assert (s == "-54321"); + assertTrue (s == "-54321"); unsigned long ul = 54321; s = format("%?i", ul); - assert (s == "54321"); + assertTrue (s == "54321"); Int64 i64 = -12345678; s = format("%?i", i64); - assert (s == "-12345678"); + assertTrue (s == "-12345678"); UInt64 ui64 = 12345678; s = format("%?i", ui64); - assert (s == "12345678"); + assertTrue (s == "12345678"); ss = 0x42; s = format("%?x", ss); - assert (s == "42"); + assertTrue (s == "42"); ss = 042; s = format("%?o", ss); - assert (s == "42"); + assertTrue (s == "42"); } @@ -259,22 +259,22 @@ void FormatTest::testFloatFix() { double d = 1.5; std::string s(format("%f", d)); - assert (s.find("1.50") == 0); + assertTrue (s.find("1.50") == 0); s = format("%10f", d); - assert (s.find(" 1.50") != std::string::npos); + assertTrue (s.find(" 1.50") != std::string::npos); s = format("%6.2f", d); - assert (s == " 1.50"); + assertTrue (s == " 1.50"); s = format("%-6.2f", d); - assert (s == "1.50 "); + assertTrue (s == "1.50 "); float f = 1.5; s = format("%hf", f); - assert (s.find("1.50") == 0); + assertTrue (s.find("1.50") == 0); s = format("%.0f", 1.0); - assert (s == "1"); + assertTrue (s == "1"); } @@ -282,19 +282,19 @@ void FormatTest::testFloatSci() { double d = 1.5; std::string s(format("%e", d)); - assert (s.find("1.50") == 0); - assert (s.find("0e+0") != std::string::npos); + assertTrue (s.find("1.50") == 0); + assertTrue (s.find("0e+0") != std::string::npos); s = format("%20e", d); - assert (s.find(" 1.50") != std::string::npos); - assert (s.find("0e+0") != std::string::npos); + assertTrue (s.find(" 1.50") != std::string::npos); + assertTrue (s.find("0e+0") != std::string::npos); s = format("%10.2e", d); - assert (s == " 1.50e+000" || s == " 1.50e+00"); + assertTrue (s == " 1.50e+000" || s == " 1.50e+00"); s = format("%-10.2e", d); - assert (s == "1.50e+000 " || s == "1.50e+00 "); + assertTrue (s == "1.50e+000 " || s == "1.50e+00 "); s = format("%-10.2E", d); - assert (s == "1.50E+000 " || s == "1.50E+00 "); + assertTrue (s == "1.50E+000 " || s == "1.50E+00 "); } @@ -302,54 +302,54 @@ void FormatTest::testString() { std::string foo("foo"); std::string s(format("%s", foo)); - assert (s == "foo"); + assertTrue (s == "foo"); s = format("%5s", foo); - assert (s == " foo"); + assertTrue (s == " foo"); s = format("%-5s", foo); - assert (s == "foo "); + assertTrue (s == "foo "); s = format("%s%%a", foo); - assert (s == "foo%a"); + assertTrue (s == "foo%a"); s = format("'%s%%''%s%%'", foo, foo); - assert (s == "'foo%''foo%'"); + assertTrue (s == "'foo%''foo%'"); } void FormatTest::testMultiple() { std::string s(format("aaa%dbbb%4dccc", 1, 2)); - assert (s == "aaa1bbb 2ccc"); + assertTrue (s == "aaa1bbb 2ccc"); s = format("%%%d%%%d%%%d", 1, 2, 3); - assert (s == "%1%2%3"); + assertTrue (s == "%1%2%3"); s = format("%d%d%d%d", 1, 2, 3, 4); - assert (s == "1234"); + assertTrue (s == "1234"); s = format("%d%d%d%d%d", 1, 2, 3, 4, 5); - assert (s == "12345"); + assertTrue (s == "12345"); s = format("%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6); - assert (s == "123456"); + assertTrue (s == "123456"); } void FormatTest::testIndex() { std::string s(format("%[1]d%[0]d", 1, 2)); - assert(s == "21"); + assertTrue (s == "21"); s = format("%[5]d%[4]d%[3]d%[2]d%[1]d%[0]d", 1, 2, 3, 4, 5, 6); - assert(s == "654321"); + assertTrue (s == "654321"); s = format("%%%[1]d%%%[2]d%%%d", 1, 2, 3); - assert(s == "%2%3%1"); + assertTrue (s == "%2%3%1"); s = format("%%%d%%%d%%%[0]d", 1, 2); - assert(s == "%1%2%1"); + assertTrue (s == "%1%2%1"); } diff --git a/Foundation/testsuite/src/GlobTest.cpp b/Foundation/testsuite/src/GlobTest.cpp index dd2c84ef6..3e5d40740 100644 --- a/Foundation/testsuite/src/GlobTest.cpp +++ b/Foundation/testsuite/src/GlobTest.cpp @@ -35,343 +35,343 @@ GlobTest::~GlobTest() void GlobTest::testMatchChars() { Glob g1("a"); - assert (g1.match("a")); - assert (!g1.match("b")); - assert (!g1.match("aa")); - assert (!g1.match("")); + assertTrue (g1.match("a")); + assertTrue (!g1.match("b")); + assertTrue (!g1.match("aa")); + assertTrue (!g1.match("")); Glob g2("ab"); - assert (g2.match("ab")); - assert (!g2.match("aab")); - assert (!g2.match("abab")); + assertTrue (g2.match("ab")); + assertTrue (!g2.match("aab")); + assertTrue (!g2.match("abab")); } void GlobTest::testMatchQM() { Glob g1("?"); - assert (g1.match("a")); - assert (g1.match("b")); - assert (!g1.match("aa")); - assert (g1.match(".")); + assertTrue (g1.match("a")); + assertTrue (g1.match("b")); + assertTrue (!g1.match("aa")); + assertTrue (g1.match(".")); Glob g2("\\?"); - assert (g2.match("?")); - assert (!g2.match("a")); - assert (!g2.match("ab")); + assertTrue (g2.match("?")); + assertTrue (!g2.match("a")); + assertTrue (!g2.match("ab")); Glob g3("a?"); - assert (g3.match("aa")); - assert (g3.match("az")); - assert (!g3.match("a")); - assert (!g3.match("aaa")); + assertTrue (g3.match("aa")); + assertTrue (g3.match("az")); + assertTrue (!g3.match("a")); + assertTrue (!g3.match("aaa")); Glob g4("??"); - assert (g4.match("aa")); - assert (g4.match("ab")); - assert (!g4.match("a")); - assert (!g4.match("abc")); + assertTrue (g4.match("aa")); + assertTrue (g4.match("ab")); + assertTrue (!g4.match("a")); + assertTrue (!g4.match("abc")); Glob g5("?a?"); - assert (g5.match("aaa")); - assert (g5.match("bac")); - assert (!g5.match("bbc")); - assert (!g5.match("ba")); - assert (!g5.match("ab")); + assertTrue (g5.match("aaa")); + assertTrue (g5.match("bac")); + assertTrue (!g5.match("bbc")); + assertTrue (!g5.match("ba")); + assertTrue (!g5.match("ab")); Glob g6("a\\?"); - assert (g6.match("a?")); - assert (!g6.match("az")); - assert (!g6.match("a")); + assertTrue (g6.match("a?")); + assertTrue (!g6.match("az")); + assertTrue (!g6.match("a")); Glob g7("?", Glob::GLOB_DOT_SPECIAL); - assert (g7.match("a")); - assert (g7.match("b")); - assert (!g7.match("aa")); - assert (!g7.match(".")); + assertTrue (g7.match("a")); + assertTrue (g7.match("b")); + assertTrue (!g7.match("aa")); + assertTrue (!g7.match(".")); } void GlobTest::testMatchAsterisk() { Glob g1("*"); - assert (g1.match("")); - assert (g1.match("a")); - assert (g1.match("ab")); - assert (g1.match("abc")); - assert (g1.match(".")); + assertTrue (g1.match("")); + assertTrue (g1.match("a")); + assertTrue (g1.match("ab")); + assertTrue (g1.match("abc")); + assertTrue (g1.match(".")); Glob g2("a*"); - assert (g2.match("a")); - assert (g2.match("aa")); - assert (g2.match("abc")); - assert (!g2.match("b")); - assert (!g2.match("ba")); + assertTrue (g2.match("a")); + assertTrue (g2.match("aa")); + assertTrue (g2.match("abc")); + assertTrue (!g2.match("b")); + assertTrue (!g2.match("ba")); Glob g3("ab*"); - assert (g3.match("ab")); - assert (g3.match("abc")); - assert (g3.match("abab")); - assert (!g3.match("ac")); - assert (!g3.match("baab")); + assertTrue (g3.match("ab")); + assertTrue (g3.match("abc")); + assertTrue (g3.match("abab")); + assertTrue (!g3.match("ac")); + assertTrue (!g3.match("baab")); Glob g4("*a"); - assert (g4.match("a")); - assert (g4.match("ba")); - assert (g4.match("aa")); - assert (g4.match("aaaaaa")); - assert (g4.match("bbbbba")); - assert (!g4.match("b")); - assert (!g4.match("ab")); - assert (!g4.match("aaab")); + assertTrue (g4.match("a")); + assertTrue (g4.match("ba")); + assertTrue (g4.match("aa")); + assertTrue (g4.match("aaaaaa")); + assertTrue (g4.match("bbbbba")); + assertTrue (!g4.match("b")); + assertTrue (!g4.match("ab")); + assertTrue (!g4.match("aaab")); Glob g5("a*a"); - assert (g5.match("aa")); - assert (g5.match("aba")); - assert (g5.match("abba")); - assert (!g5.match("aab")); - assert (!g5.match("aaab")); - assert (!g5.match("baaaa")); + assertTrue (g5.match("aa")); + assertTrue (g5.match("aba")); + assertTrue (g5.match("abba")); + assertTrue (!g5.match("aab")); + assertTrue (!g5.match("aaab")); + assertTrue (!g5.match("baaaa")); Glob g6("a*b*c"); - assert (g6.match("abc")); - assert (g6.match("aabbcc")); - assert (g6.match("abcbbc")); - assert (g6.match("aaaabbbbcccc")); - assert (!g6.match("aaaabbbcb")); + assertTrue (g6.match("abc")); + assertTrue (g6.match("aabbcc")); + assertTrue (g6.match("abcbbc")); + assertTrue (g6.match("aaaabbbbcccc")); + assertTrue (!g6.match("aaaabbbcb")); Glob g7("a*b*"); - assert (g7.match("aaabbb")); - assert (g7.match("abababab")); - assert (g7.match("ab")); - assert (g7.match("aaaaab")); - assert (!g7.match("a")); - assert (!g7.match("aa")); - assert (!g7.match("aaa")); + assertTrue (g7.match("aaabbb")); + assertTrue (g7.match("abababab")); + assertTrue (g7.match("ab")); + assertTrue (g7.match("aaaaab")); + assertTrue (!g7.match("a")); + assertTrue (!g7.match("aa")); + assertTrue (!g7.match("aaa")); Glob g8("**"); - assert (g1.match("")); - assert (g1.match("a")); - assert (g1.match("ab")); - assert (g1.match("abc")); + assertTrue (g1.match("")); + assertTrue (g1.match("a")); + assertTrue (g1.match("ab")); + assertTrue (g1.match("abc")); Glob g9("a\\*"); - assert (g9.match("a*")); - assert (!g9.match("aa")); - assert (!g9.match("a")); + assertTrue (g9.match("a*")); + assertTrue (!g9.match("aa")); + assertTrue (!g9.match("a")); Glob g10("a*\\*"); - assert (g10.match("a*")); - assert (g10.match("aaa*")); - assert (!g10.match("a")); - assert (!g10.match("aa")); + assertTrue (g10.match("a*")); + assertTrue (g10.match("aaa*")); + assertTrue (!g10.match("a")); + assertTrue (!g10.match("aa")); Glob g11("*", Glob::GLOB_DOT_SPECIAL); - assert (g11.match("")); - assert (g11.match("a")); - assert (g11.match("ab")); - assert (g11.match("abc")); - assert (!g11.match(".")); + assertTrue (g11.match("")); + assertTrue (g11.match("a")); + assertTrue (g11.match("ab")); + assertTrue (g11.match("abc")); + assertTrue (!g11.match(".")); } void GlobTest::testMatchRange() { Glob g1("[a]"); - assert (g1.match("a")); - assert (!g1.match("b")); - assert (!g1.match("aa")); + assertTrue (g1.match("a")); + assertTrue (!g1.match("b")); + assertTrue (!g1.match("aa")); Glob g2("[ab]"); - assert (g2.match("a")); - assert (g2.match("b")); - assert (!g2.match("c")); - assert (!g2.match("ab")); + assertTrue (g2.match("a")); + assertTrue (g2.match("b")); + assertTrue (!g2.match("c")); + assertTrue (!g2.match("ab")); Glob g3("[abc]"); - assert (g3.match("a")); - assert (g3.match("b")); - assert (g3.match("c")); - assert (!g3.match("ab")); + assertTrue (g3.match("a")); + assertTrue (g3.match("b")); + assertTrue (g3.match("c")); + assertTrue (!g3.match("ab")); Glob g4("[a-z]"); - assert (g4.match("a")); - assert (g4.match("z")); - assert (!g4.match("A")); + assertTrue (g4.match("a")); + assertTrue (g4.match("z")); + assertTrue (!g4.match("A")); Glob g5("[!a]"); - assert (g5.match("b")); - assert (g5.match("c")); - assert (!g5.match("a")); - assert (!g5.match("bb")); + assertTrue (g5.match("b")); + assertTrue (g5.match("c")); + assertTrue (!g5.match("a")); + assertTrue (!g5.match("bb")); Glob g6("[!a-z]"); - assert (g6.match("A")); - assert (!g6.match("a")); - assert (!g6.match("z")); + assertTrue (g6.match("A")); + assertTrue (!g6.match("a")); + assertTrue (!g6.match("z")); Glob g7("[0-9a-zA-Z_]"); - assert (g7.match("0")); - assert (g7.match("1")); - assert (g7.match("8")); - assert (g7.match("9")); - assert (g7.match("a")); - assert (g7.match("b")); - assert (g7.match("z")); - assert (g7.match("A")); - assert (g7.match("Z")); - assert (g7.match("_")); - assert (!g7.match("-")); + assertTrue (g7.match("0")); + assertTrue (g7.match("1")); + assertTrue (g7.match("8")); + assertTrue (g7.match("9")); + assertTrue (g7.match("a")); + assertTrue (g7.match("b")); + assertTrue (g7.match("z")); + assertTrue (g7.match("A")); + assertTrue (g7.match("Z")); + assertTrue (g7.match("_")); + assertTrue (!g7.match("-")); Glob g8("[1-3]"); - assert (g8.match("1")); - assert (g8.match("2")); - assert (g8.match("3")); - assert (!g8.match("0")); - assert (!g8.match("4")); + assertTrue (g8.match("1")); + assertTrue (g8.match("2")); + assertTrue (g8.match("3")); + assertTrue (!g8.match("0")); + assertTrue (!g8.match("4")); Glob g9("[!1-3]"); - assert (g9.match("0")); - assert (g9.match("4")); - assert (!g9.match("1")); - assert (!g9.match("2")); - assert (!g9.match("3")); + assertTrue (g9.match("0")); + assertTrue (g9.match("4")); + assertTrue (!g9.match("1")); + assertTrue (!g9.match("2")); + assertTrue (!g9.match("3")); Glob g10("[\\!a]"); - assert (g10.match("!")); - assert (g10.match("a")); - assert (!g10.match("x")); + assertTrue (g10.match("!")); + assertTrue (g10.match("a")); + assertTrue (!g10.match("x")); Glob g11("[a\\-c]"); - assert (g11.match("a")); - assert (g11.match("c")); - assert (g11.match("-")); - assert (!g11.match("b")); + assertTrue (g11.match("a")); + assertTrue (g11.match("c")); + assertTrue (g11.match("-")); + assertTrue (!g11.match("b")); Glob g12("[\\]]"); - assert (g12.match("]")); - assert (!g12.match("[")); + assertTrue (g12.match("]")); + assertTrue (!g12.match("[")); Glob g13("[[\\]]"); - assert (g13.match("[")); - assert (g13.match("]")); - assert (!g13.match("x")); + assertTrue (g13.match("[")); + assertTrue (g13.match("]")); + assertTrue (!g13.match("x")); Glob g14("\\[]"); - assert (g14.match("[]")); - assert (!g14.match("[[")); + assertTrue (g14.match("[]")); + assertTrue (!g14.match("[[")); Glob g15("a[bc]"); - assert (g15.match("ab")); - assert (g15.match("ac")); - assert (!g15.match("a")); - assert (!g15.match("aa")); + assertTrue (g15.match("ab")); + assertTrue (g15.match("ac")); + assertTrue (!g15.match("a")); + assertTrue (!g15.match("aa")); Glob g16("[ab]c"); - assert (g16.match("ac")); - assert (g16.match("bc")); - assert (!g16.match("a")); - assert (!g16.match("b")); - assert (!g16.match("c")); - assert (!g16.match("aa")); + assertTrue (g16.match("ac")); + assertTrue (g16.match("bc")); + assertTrue (!g16.match("a")); + assertTrue (!g16.match("b")); + assertTrue (!g16.match("c")); + assertTrue (!g16.match("aa")); } void GlobTest::testMisc() { Glob g1("*.cpp"); - assert (g1.match("Glob.cpp")); - assert (!g1.match("Glob.h")); + assertTrue (g1.match("Glob.cpp")); + assertTrue (!g1.match("Glob.h")); Glob g2("*.[hc]"); - assert (g2.match("foo.c")); - assert (g2.match("foo.h")); - assert (!g2.match("foo.i")); + assertTrue (g2.match("foo.c")); + assertTrue (g2.match("foo.h")); + assertTrue (!g2.match("foo.i")); Glob g3("*.*"); - assert (g3.match("foo.cpp")); - assert (g3.match("foo.h")); - assert (g3.match("foo.")); - assert (!g3.match("foo")); + assertTrue (g3.match("foo.cpp")); + assertTrue (g3.match("foo.h")); + assertTrue (g3.match("foo.")); + assertTrue (!g3.match("foo")); Glob g4("File*.?pp"); - assert (g4.match("File.hpp")); - assert (g4.match("File.cpp")); - assert (g4.match("Filesystem.hpp")); - assert (!g4.match("File.h")); + assertTrue (g4.match("File.hpp")); + assertTrue (g4.match("File.cpp")); + assertTrue (g4.match("Filesystem.hpp")); + assertTrue (!g4.match("File.h")); Glob g5("File*.[ch]*"); - assert (g5.match("File.hpp")); - assert (g5.match("File.cpp")); - assert (g5.match("Filesystem.hpp")); - assert (g5.match("File.h")); - assert (g5.match("Filesystem.cp")); + assertTrue (g5.match("File.hpp")); + assertTrue (g5.match("File.cpp")); + assertTrue (g5.match("Filesystem.hpp")); + assertTrue (g5.match("File.h")); + assertTrue (g5.match("Filesystem.cp")); } void GlobTest::testCaseless() { Glob g1("*.cpp", Glob::GLOB_CASELESS); - assert (g1.match("Glob.cpp")); - assert (!g1.match("Glob.h")); - assert (g1.match("Glob.CPP")); - assert (!g1.match("Glob.H")); + assertTrue (g1.match("Glob.cpp")); + assertTrue (!g1.match("Glob.h")); + assertTrue (g1.match("Glob.CPP")); + assertTrue (!g1.match("Glob.H")); Glob g2("*.[hc]", Glob::GLOB_CASELESS); - assert (g2.match("foo.c")); - assert (g2.match("foo.h")); - assert (!g2.match("foo.i")); - assert (g2.match("foo.C")); - assert (g2.match("foo.H")); - assert (!g2.match("foo.I")); + assertTrue (g2.match("foo.c")); + assertTrue (g2.match("foo.h")); + assertTrue (!g2.match("foo.i")); + assertTrue (g2.match("foo.C")); + assertTrue (g2.match("foo.H")); + assertTrue (!g2.match("foo.I")); Glob g4("File*.?pp", Glob::GLOB_CASELESS); - assert (g4.match("file.hpp")); - assert (g4.match("FILE.CPP")); - assert (g4.match("filesystem.hpp")); - assert (g4.match("FILESYSTEM.HPP")); - assert (!g4.match("FILE.H")); - assert (!g4.match("file.h")); + assertTrue (g4.match("file.hpp")); + assertTrue (g4.match("FILE.CPP")); + assertTrue (g4.match("filesystem.hpp")); + assertTrue (g4.match("FILESYSTEM.HPP")); + assertTrue (!g4.match("FILE.H")); + assertTrue (!g4.match("file.h")); Glob g5("File*.[ch]*", Glob::GLOB_CASELESS); - assert (g5.match("file.hpp")); - assert (g5.match("FILE.HPP")); - assert (g5.match("file.cpp")); - assert (g5.match("FILE.CPP")); - assert (g5.match("filesystem.hpp")); - assert (g5.match("FILESYSTEM.HPP")); - assert (g5.match("file.h")); - assert (g5.match("FILE.H")); - assert (g5.match("filesystem.cp")); - assert (g5.match("FILESYSTEM.CP")); + assertTrue (g5.match("file.hpp")); + assertTrue (g5.match("FILE.HPP")); + assertTrue (g5.match("file.cpp")); + assertTrue (g5.match("FILE.CPP")); + assertTrue (g5.match("filesystem.hpp")); + assertTrue (g5.match("FILESYSTEM.HPP")); + assertTrue (g5.match("file.h")); + assertTrue (g5.match("FILE.H")); + assertTrue (g5.match("filesystem.cp")); + assertTrue (g5.match("FILESYSTEM.CP")); Glob g6("[abc]", Glob::GLOB_CASELESS); - assert (g6.match("a")); - assert (g6.match("b")); - assert (g6.match("c")); - assert (g6.match("A")); - assert (g6.match("B")); - assert (g6.match("C")); + assertTrue (g6.match("a")); + assertTrue (g6.match("b")); + assertTrue (g6.match("c")); + assertTrue (g6.match("A")); + assertTrue (g6.match("B")); + assertTrue (g6.match("C")); Glob g7("[a-f]", Glob::GLOB_CASELESS); - assert (g7.match("a")); - assert (g7.match("b")); - assert (g7.match("f")); - assert (!g7.match("g")); - assert (g7.match("A")); - assert (g7.match("B")); - assert (g7.match("F")); - assert (!g7.match("G")); + assertTrue (g7.match("a")); + assertTrue (g7.match("b")); + assertTrue (g7.match("f")); + assertTrue (!g7.match("g")); + assertTrue (g7.match("A")); + assertTrue (g7.match("B")); + assertTrue (g7.match("F")); + assertTrue (!g7.match("G")); Glob g8("[A-F]", Glob::GLOB_CASELESS); - assert (g8.match("a")); - assert (g8.match("b")); - assert (g8.match("f")); - assert (!g8.match("g")); - assert (g8.match("A")); - assert (g8.match("B")); - assert (g8.match("F")); - assert (!g8.match("G")); + assertTrue (g8.match("a")); + assertTrue (g8.match("b")); + assertTrue (g8.match("f")); + assertTrue (!g8.match("g")); + assertTrue (g8.match("A")); + assertTrue (g8.match("B")); + assertTrue (g8.match("F")); + assertTrue (!g8.match("G")); } @@ -391,77 +391,77 @@ void GlobTest::testGlob() std::set files; Glob::glob("globtest/*", files); translatePaths(files); - assert (files.size() == 5); - assert (files.find("globtest/Makefile") != files.end()); - assert (files.find("globtest/.hidden") != files.end()); - assert (files.find("globtest/include/") != files.end()); - assert (files.find("globtest/src/") != files.end()); - assert (files.find("globtest/testsuite/") != files.end()); + assertTrue (files.size() == 5); + assertTrue (files.find("globtest/Makefile") != files.end()); + assertTrue (files.find("globtest/.hidden") != files.end()); + assertTrue (files.find("globtest/include/") != files.end()); + assertTrue (files.find("globtest/src/") != files.end()); + assertTrue (files.find("globtest/testsuite/") != files.end()); files.clear(); Glob::glob("GlobTest/*", files, Glob::GLOB_CASELESS); translatePaths(files); - assert (files.size() == 5); - assert (files.find("globtest/Makefile") != files.end()); - assert (files.find("globtest/.hidden") != files.end()); - assert (files.find("globtest/include/") != files.end()); - assert (files.find("globtest/src/") != files.end()); - assert (files.find("globtest/testsuite/") != files.end()); + assertTrue (files.size() == 5); + assertTrue (files.find("globtest/Makefile") != files.end()); + assertTrue (files.find("globtest/.hidden") != files.end()); + assertTrue (files.find("globtest/include/") != files.end()); + assertTrue (files.find("globtest/src/") != files.end()); + assertTrue (files.find("globtest/testsuite/") != files.end()); files.clear(); Glob::glob("globtest/*/*.[hc]", files); translatePaths(files); - assert (files.size() == 5); - assert (files.find("globtest/include/one.h") != files.end()); - assert (files.find("globtest/include/two.h") != files.end()); - assert (files.find("globtest/src/one.c") != files.end()); - assert (files.find("globtest/src/one.c") != files.end()); - assert (files.find("globtest/src/main.c") != files.end()); + assertTrue (files.size() == 5); + assertTrue (files.find("globtest/include/one.h") != files.end()); + assertTrue (files.find("globtest/include/two.h") != files.end()); + assertTrue (files.find("globtest/src/one.c") != files.end()); + assertTrue (files.find("globtest/src/one.c") != files.end()); + assertTrue (files.find("globtest/src/main.c") != files.end()); files.clear(); Glob::glob("gl?bt?st/*/*/*.c", files); translatePaths(files); - assert (files.size() == 2); - assert (files.find("globtest/testsuite/src/test.c") != files.end()); - assert (files.find("globtest/testsuite/src/main.c") != files.end()); + assertTrue (files.size() == 2); + assertTrue (files.find("globtest/testsuite/src/test.c") != files.end()); + assertTrue (files.find("globtest/testsuite/src/main.c") != files.end()); files.clear(); Glob::glob("Gl?bT?st/*/*/*.C", files, Glob::GLOB_CASELESS); translatePaths(files); - assert (files.size() == 2); - assert (files.find("globtest/testsuite/src/test.c") != files.end()); - assert (files.find("globtest/testsuite/src/main.c") != files.end()); + assertTrue (files.size() == 2); + assertTrue (files.find("globtest/testsuite/src/test.c") != files.end()); + assertTrue (files.find("globtest/testsuite/src/main.c") != files.end()); files.clear(); Glob::glob("globtest/*/src/*", files); translatePaths(files); - assert (files.size() == 3); - assert (files.find("globtest/testsuite/src/test.h") != files.end()); - assert (files.find("globtest/testsuite/src/test.c") != files.end()); - assert (files.find("globtest/testsuite/src/main.c") != files.end()); + assertTrue (files.size() == 3); + assertTrue (files.find("globtest/testsuite/src/test.h") != files.end()); + assertTrue (files.find("globtest/testsuite/src/test.c") != files.end()); + assertTrue (files.find("globtest/testsuite/src/main.c") != files.end()); files.clear(); Glob::glob("globtest/*/", files); translatePaths(files); - assert (files.size() == 3); - assert (files.find("globtest/include/") != files.end()); - assert (files.find("globtest/src/") != files.end()); - assert (files.find("globtest/testsuite/") != files.end()); + assertTrue (files.size() == 3); + assertTrue (files.find("globtest/include/") != files.end()); + assertTrue (files.find("globtest/src/") != files.end()); + assertTrue (files.find("globtest/testsuite/") != files.end()); files.clear(); Glob::glob("globtest/testsuite/src/*", "globtest/testsuite/", files); translatePaths(files); - assert (files.size() == 3); - assert (files.find("globtest/testsuite/src/test.h") != files.end()); - assert (files.find("globtest/testsuite/src/test.c") != files.end()); - assert (files.find("globtest/testsuite/src/main.c") != files.end()); + assertTrue (files.size() == 3); + assertTrue (files.find("globtest/testsuite/src/test.h") != files.end()); + assertTrue (files.find("globtest/testsuite/src/test.c") != files.end()); + assertTrue (files.find("globtest/testsuite/src/main.c") != files.end()); #if !defined(_WIN32_WCE) // won't work if current directory is root dir files.clear(); Glob::glob("globtest/../*/testsuite/*/", files); translatePaths(files); - assert (files.size() == 1); + assertTrue (files.size() == 1); #endif File dir("globtest"); @@ -474,14 +474,14 @@ void GlobTest::testMatchEmptyPattern() // Run the empty pattern against a number of subjects with all different match options const std::string empty; - assert (!Glob(empty, Glob::GLOB_DEFAULT).match("subject")); - assert (Glob(empty, Glob::GLOB_DEFAULT).match(empty)); + assertTrue (!Glob(empty, Glob::GLOB_DEFAULT).match("subject")); + assertTrue (Glob(empty, Glob::GLOB_DEFAULT).match(empty)); - assert (!Glob(empty, Glob::GLOB_DOT_SPECIAL).match("subject")); - assert (Glob(empty, Glob::GLOB_DOT_SPECIAL).match(empty)); + assertTrue (!Glob(empty, Glob::GLOB_DOT_SPECIAL).match("subject")); + assertTrue (Glob(empty, Glob::GLOB_DOT_SPECIAL).match(empty)); - assert (!Glob(empty, Glob::GLOB_CASELESS).match("subject")); - assert (Glob(empty, Glob::GLOB_CASELESS).match(empty)); + assertTrue (!Glob(empty, Glob::GLOB_CASELESS).match("subject")); + assertTrue (Glob(empty, Glob::GLOB_CASELESS).match(empty)); } diff --git a/Foundation/testsuite/src/HMACEngineTest.cpp b/Foundation/testsuite/src/HMACEngineTest.cpp index a9321dc4d..2df96fe2c 100644 --- a/Foundation/testsuite/src/HMACEngineTest.cpp +++ b/Foundation/testsuite/src/HMACEngineTest.cpp @@ -39,21 +39,21 @@ void HMACEngineTest::testHMAC() HMACEngine hmac1(key); hmac1.update(data); std::string digest = DigestEngine::digestToHex(hmac1.digest()); - assert (digest == "9294727a3638bb1c13f48ef8158bfc9d"); + assertTrue (digest == "9294727a3638bb1c13f48ef8158bfc9d"); key = "Jefe"; data = "what do ya want for nothing?"; HMACEngine hmac2(key); hmac2.update(data); digest = DigestEngine::digestToHex(hmac2.digest()); - assert (digest == "750c783e6ab0b503eaa86e310a5db738"); + assertTrue (digest == "750c783e6ab0b503eaa86e310a5db738"); key = std::string(16, 0xaa); data = std::string(50, 0xdd); HMACEngine hmac3(key); hmac3.update(data); digest = DigestEngine::digestToHex(hmac3.digest()); - assert (digest == "56be34521d144c88dbb8c733f0e8b3f6"); + assertTrue (digest == "56be34521d144c88dbb8c733f0e8b3f6"); } diff --git a/Foundation/testsuite/src/HashMapTest.cpp b/Foundation/testsuite/src/HashMapTest.cpp index 33382432a..e3a0f5e36 100644 --- a/Foundation/testsuite/src/HashMapTest.cpp +++ b/Foundation/testsuite/src/HashMapTest.cpp @@ -36,38 +36,38 @@ void HashMapTest::testInsert() typedef HashMap IntMap; IntMap hm; - assert (hm.empty()); + assertTrue (hm.empty()); for (int i = 0; i < N; ++i) { std::pair res = hm.insert(IntMap::ValueType(i, i*2)); - assert (res.first->first == i); - assert (res.first->second == i*2); - assert (res.second); + assertTrue (res.first->first == i); + assertTrue (res.first->second == i*2); + assertTrue (res.second); IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); - assert (it->second == i*2); - assert (hm.count(i) == 1); - assert (hm.size() == i + 1); + assertTrue (it != hm.end()); + assertTrue (it->first == i); + assertTrue (it->second == i*2); + assertTrue (hm.count(i) == 1); + assertTrue (hm.size() == i + 1); } - assert (!hm.empty()); + assertTrue (!hm.empty()); for (int i = 0; i < N; ++i) { IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); - assert (it->second == i*2); + assertTrue (it != hm.end()); + assertTrue (it->first == i); + assertTrue (it->second == i*2); } for (int i = 0; i < N; ++i) { std::pair res = hm.insert(IntMap::ValueType(i, 0)); - assert (res.first->first == i); - assert (res.first->second == i*2); - assert (!res.second); + assertTrue (res.first->first == i); + assertTrue (res.first->second == i*2); + assertTrue (!res.second); } } @@ -83,27 +83,27 @@ void HashMapTest::testErase() { hm.insert(IntMap::ValueType(i, i*2)); } - assert (hm.size() == N); + assertTrue (hm.size() == N); for (int i = 0; i < N; i += 2) { hm.erase(i); IntMap::Iterator it = hm.find(i); - assert (it == hm.end()); + assertTrue (it == hm.end()); } - assert (hm.size() == N/2); + assertTrue (hm.size() == N/2); for (int i = 0; i < N; i += 2) { IntMap::Iterator it = hm.find(i); - assert (it == hm.end()); + assertTrue (it == hm.end()); } for (int i = 1; i < N; i += 2) { IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (*it == i); + assertTrue (it != hm.end()); + assertTrue (*it == i); } for (int i = 0; i < N; i += 2) @@ -114,9 +114,9 @@ void HashMapTest::testErase() for (int i = 0; i < N; ++i) { IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); - assert (it->second == i*2); + assertTrue (it != hm.end()); + assertTrue (it->first == i); + assertTrue (it->second == i*2); } } @@ -138,12 +138,12 @@ void HashMapTest::testIterator() it = hm.begin(); while (it != hm.end()) { - assert (values.find(it->first) == values.end()); + assertTrue (values.find(it->first) == values.end()); values[it->first] = it->second; ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } @@ -163,12 +163,12 @@ void HashMapTest::testConstIterator() IntMap::ConstIterator it = hm.begin(); while (it != hm.end()) { - assert (values.find(it->first) == values.end()); + assertTrue (values.find(it->first) == values.end()); values[it->first] = it->second; ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } @@ -181,10 +181,10 @@ void HashMapTest::testIndex() hm[2] = 4; hm[3] = 6; - assert (hm.size() == 3); - assert (hm[1] == 2); - assert (hm[2] == 4); - assert (hm[3] == 6); + assertTrue (hm.size() == 3); + assertTrue (hm[1] == 2); + assertTrue (hm[2] == 4); + assertTrue (hm[3] == 6); try { diff --git a/Foundation/testsuite/src/HashSetTest.cpp b/Foundation/testsuite/src/HashSetTest.cpp index db3302c34..89dcc2e4e 100644 --- a/Foundation/testsuite/src/HashSetTest.cpp +++ b/Foundation/testsuite/src/HashSetTest.cpp @@ -35,33 +35,33 @@ void HashSetTest::testInsert() HashSet > hs; - assert (hs.empty()); + assertTrue (hs.empty()); for (int i = 0; i < N; ++i) { std::pair >::Iterator, bool> res = hs.insert(i); - assert (*res.first == i); - assert (res.second); + assertTrue (*res.first == i); + assertTrue (res.second); HashSet >::Iterator it = hs.find(i); - assert (it != hs.end()); - assert (*it == i); - assert (hs.size() == i + 1); + assertTrue (it != hs.end()); + assertTrue (*it == i); + assertTrue (hs.size() == i + 1); } - assert (!hs.empty()); + assertTrue (!hs.empty()); for (int i = 0; i < N; ++i) { HashSet >::Iterator it = hs.find(i); - assert (it != hs.end()); - assert (*it == i); + assertTrue (it != hs.end()); + assertTrue (*it == i); } for (int i = 0; i < N; ++i) { std::pair >::Iterator, bool> res = hs.insert(i); - assert (*res.first == i); - assert (!res.second); + assertTrue (*res.first == i); + assertTrue (!res.second); } } @@ -76,27 +76,27 @@ void HashSetTest::testErase() { hs.insert(i); } - assert (hs.size() == N); + assertTrue (hs.size() == N); for (int i = 0; i < N; i += 2) { hs.erase(i); HashSet >::Iterator it = hs.find(i); - assert (it == hs.end()); + assertTrue (it == hs.end()); } - assert (hs.size() == N/2); + assertTrue (hs.size() == N/2); for (int i = 0; i < N; i += 2) { HashSet >::Iterator it = hs.find(i); - assert (it == hs.end()); + assertTrue (it == hs.end()); } for (int i = 1; i < N; i += 2) { HashSet >::Iterator it = hs.find(i); - assert (it != hs.end()); - assert (*it == i); + assertTrue (it != hs.end()); + assertTrue (*it == i); } for (int i = 0; i < N; i += 2) @@ -107,8 +107,8 @@ void HashSetTest::testErase() for (int i = 0; i < N; ++i) { HashSet >::Iterator it = hs.find(i); - assert (it != hs.end()); - assert (*it == i); + assertTrue (it != hs.end()); + assertTrue (*it == i); } } @@ -128,12 +128,12 @@ void HashSetTest::testIterator() HashSet >::Iterator it = hs.begin(); while (it != hs.end()) { - assert (values.find(*it) == values.end()); + assertTrue (values.find(*it) == values.end()); values.insert(*it); ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } @@ -152,12 +152,12 @@ void HashSetTest::testConstIterator() HashSet >::ConstIterator it = hs.begin(); while (it != hs.end()) { - assert (values.find(*it) == values.end()); + assertTrue (values.find(*it) == values.end()); values.insert(*it); ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } diff --git a/Foundation/testsuite/src/HashTableTest.cpp b/Foundation/testsuite/src/HashTableTest.cpp index be4835d4c..c80ee6a2b 100644 --- a/Foundation/testsuite/src/HashTableTest.cpp +++ b/Foundation/testsuite/src/HashTableTest.cpp @@ -33,14 +33,14 @@ void HashTableTest::testInsert() std::string s1("str1"); std::string s2("str2"); HashTable hashTable; - assert (!hashTable.exists(s1)); + assertTrue (!hashTable.exists(s1)); hashTable.insert(s1, 13); - assert (hashTable.exists(s1)); - assert (hashTable.get(s1) == 13); + assertTrue (hashTable.exists(s1)); + assertTrue (hashTable.get(s1) == 13); int retVal = 0; - assert (hashTable.get(s1, retVal)); - assert (retVal == 13); + assertTrue (hashTable.get(s1, retVal)); + assertTrue (retVal == 13); try { hashTable.insert(s1, 22); @@ -54,9 +54,9 @@ void HashTableTest::testInsert() } catch (Exception&){} - assert (!hashTable.exists(s2)); + assertTrue (!hashTable.exists(s2)); hashTable.insert(s2, 13); - assert (hashTable.exists(s2)); + assertTrue (hashTable.exists(s2)); } @@ -68,16 +68,16 @@ void HashTableTest::testUpdate() HashTable hashTable; hashTable.insert(s1, 13); hashTable.update(s1, 14); - assert (hashTable.exists(s1)); - assert (hashTable.get(s1) == 14); + assertTrue (hashTable.exists(s1)); + assertTrue (hashTable.get(s1) == 14); int retVal = 0; - assert (hashTable.get(s1, retVal)); - assert (retVal == 14); + assertTrue (hashTable.get(s1, retVal)); + assertTrue (retVal == 14); // updating a non existing item must work too hashTable.update(s2, 15); - assert (hashTable.get(s2) == 15); + assertTrue (hashTable.get(s2) == 15); } @@ -92,8 +92,8 @@ void HashTableTest::testOverflow() for (int i = 0; i < 1024; ++i) { std::string tmp = Poco::NumberFormatter::format(i); - assert (hashTable.exists(tmp)); - assert (hashTable.get(tmp) == i*i); + assertTrue (hashTable.exists(tmp)); + assertTrue (hashTable.get(tmp) == i*i); } } @@ -101,29 +101,29 @@ void HashTableTest::testOverflow() void HashTableTest::testSize() { HashTable hashTable(13); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); Poco::UInt32 POCO_UNUSED h1 = hashTable.insert("1", 1); - assert (hashTable.size() == 1); + assertTrue (hashTable.size() == 1); Poco::UInt32 POCO_UNUSED h2 = hashTable.update("2", 2); - assert (hashTable.size() == 2); + assertTrue (hashTable.size() == 2); hashTable.remove("1"); - assert (hashTable.size() == 1); + assertTrue (hashTable.size() == 1); hashTable.remove("3"); - assert (hashTable.size() == 1); + assertTrue (hashTable.size() == 1); hashTable.removeRaw("2", h2); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); hashTable.insert("1", 1); hashTable.insert("2", 2); - assert (hashTable.size() == 2); + assertTrue (hashTable.size() == 2); hashTable.clear(); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); } void HashTableTest::testResize() { HashTable hashTable(13); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); hashTable.resize(19); for (int i = 0; i < 1024; ++i) { @@ -134,8 +134,8 @@ void HashTableTest::testResize() for (int i = 0; i < 1024; ++i) { std::string tmp = Poco::NumberFormatter::format(i); - assert (hashTable.exists(tmp)); - assert (hashTable.get(tmp) == i*i); + assertTrue (hashTable.exists(tmp)); + assertTrue (hashTable.get(tmp) == i*i); } } @@ -144,18 +144,18 @@ void HashTableTest::testStatistic() { double relax = 0.001; HashTable hashTable(13); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); HashStatistic stat1(hashTable.currentState()); - assert (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax); - assert (stat1.maxPositionsOfTable() == 13); - assert (stat1.maxEntriesPerHash() == 0); + assertTrue (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax); + assertTrue (stat1.maxPositionsOfTable() == 13); + assertTrue (stat1.maxEntriesPerHash() == 0); hashTable.resize(19); stat1 = hashTable.currentState(true); - assert (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax); - assert (stat1.maxPositionsOfTable() == 19); - assert (stat1.maxEntriesPerHash() == 0); - assert (stat1.detailedEntriesPerHash().size() == 19); + assertTrue (stat1.avgEntriesPerHash() < relax && stat1.avgEntriesPerHash() > -relax); + assertTrue (stat1.maxPositionsOfTable() == 19); + assertTrue (stat1.maxEntriesPerHash() == 0); + assertTrue (stat1.detailedEntriesPerHash().size() == 19); for (int i = 0; i < 1024; ++i) { @@ -163,17 +163,17 @@ void HashTableTest::testStatistic() } stat1 = hashTable.currentState(true); double expAvg = 1024.0/ 19; - assert (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax)); - assert (stat1.maxPositionsOfTable() == 19); - assert (stat1.maxEntriesPerHash() > expAvg); + assertTrue (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax)); + assertTrue (stat1.maxPositionsOfTable() == 19); + assertTrue (stat1.maxEntriesPerHash() > expAvg); hashTable.resize(1009); stat1 = hashTable.currentState(true); expAvg = 1024.0/ 1009; - assert (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax)); - assert (stat1.maxPositionsOfTable() == 1009); - assert (stat1.maxEntriesPerHash() > expAvg); + assertTrue (stat1.avgEntriesPerHash() < (expAvg + relax) && stat1.avgEntriesPerHash() > (expAvg - relax)); + assertTrue (stat1.maxPositionsOfTable() == 1009); + assertTrue (stat1.maxEntriesPerHash() > expAvg); } diff --git a/Foundation/testsuite/src/HexBinaryTest.cpp b/Foundation/testsuite/src/HexBinaryTest.cpp index 72b1c5ba0..a2a504e61 100644 --- a/Foundation/testsuite/src/HexBinaryTest.cpp +++ b/Foundation/testsuite/src/HexBinaryTest.cpp @@ -39,14 +39,14 @@ void HexBinaryTest::testEncoder() HexBinaryEncoder encoder(str); encoder << std::string("\00\01\02\03\04\05", 6); encoder.close(); - assert (str.str() == "000102030405"); + assertTrue (str.str() == "000102030405"); } { std::ostringstream str; HexBinaryEncoder encoder(str); encoder << std::string("\00\01\02\03", 4); encoder.close(); - assert (str.str() == "00010203"); + assertTrue (str.str() == "00010203"); } { std::ostringstream str; @@ -54,7 +54,7 @@ void HexBinaryTest::testEncoder() encoder << "ABCDEF"; encoder << char(0xaa) << char(0xbb); encoder.close(); - assert (str.str() == "414243444546aabb"); + assertTrue (str.str() == "414243444546aabb"); } { std::ostringstream str; @@ -63,7 +63,7 @@ void HexBinaryTest::testEncoder() encoder << "ABCDEF"; encoder << char(0xaa) << char(0xbb); encoder.close(); - assert (str.str() == "414243444546AABB"); + assertTrue (str.str() == "414243444546AABB"); } } @@ -73,68 +73,68 @@ void HexBinaryTest::testDecoder() { std::istringstream istr("000102030405"); HexBinaryDecoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == 5); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == 5); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("0001020304"); HexBinaryDecoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == 4); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == 4); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("0a0bcdef"); HexBinaryDecoder decoder(istr); - assert (decoder.good() && decoder.get() == 0x0a); - assert (decoder.good() && decoder.get() == 0x0b); - assert (decoder.good() && decoder.get() == 0xcd); - assert (decoder.good() && decoder.get() == 0xef); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0x0a); + assertTrue (decoder.good() && decoder.get() == 0x0b); + assertTrue (decoder.good() && decoder.get() == 0xcd); + assertTrue (decoder.good() && decoder.get() == 0xef); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("0A0BCDEF"); HexBinaryDecoder decoder(istr); - assert (decoder.good() && decoder.get() == 0x0a); - assert (decoder.good() && decoder.get() == 0x0b); - assert (decoder.good() && decoder.get() == 0xcd); - assert (decoder.good() && decoder.get() == 0xef); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0x0a); + assertTrue (decoder.good() && decoder.get() == 0x0b); + assertTrue (decoder.good() && decoder.get() == 0xcd); + assertTrue (decoder.good() && decoder.get() == 0xef); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("00 01 02 03"); HexBinaryDecoder decoder(istr); - assert (decoder.good() && decoder.get() == 0); - assert (decoder.good() && decoder.get() == 1); - assert (decoder.good() && decoder.get() == 2); - assert (decoder.good() && decoder.get() == 3); - assert (decoder.good() && decoder.get() == -1); + assertTrue (decoder.good() && decoder.get() == 0); + assertTrue (decoder.good() && decoder.get() == 1); + assertTrue (decoder.good() && decoder.get() == 2); + assertTrue (decoder.good() && decoder.get() == 3); + assertTrue (decoder.good() && decoder.get() == -1); } { std::istringstream istr("414243444546"); HexBinaryDecoder decoder(istr); std::string s; decoder >> s; - assert (s == "ABCDEF"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "ABCDEF"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } { std::istringstream istr("4041\r\n4243\r\n4445"); HexBinaryDecoder decoder(istr); std::string s; decoder >> s; - assert (s == "@ABCDE"); - assert (decoder.eof()); - assert (!decoder.fail()); + assertTrue (s == "@ABCDE"); + assertTrue (decoder.eof()); + assertTrue (!decoder.fail()); } { std::istringstream istr("AABB#CCDD"); @@ -143,12 +143,12 @@ void HexBinaryTest::testDecoder() try { decoder >> s; - assert (decoder.bad()); + assertTrue (decoder.bad()); } catch (DataFormatException&) { } - assert (!decoder.eof()); + assertTrue (!decoder.eof()); } } @@ -165,7 +165,7 @@ void HexBinaryTest::testEncodeDecode() std::string s; int c = decoder.get(); while (c != -1) { s += char(c); c = decoder.get(); } - assert (s == "The quick brown fox jumped over the lazy dog."); + assertTrue (s == "The quick brown fox jumped over the lazy dog."); } { std::string src; @@ -178,7 +178,7 @@ void HexBinaryTest::testEncodeDecode() std::string s; int c = decoder.get(); while (c != -1) { s += char(c); c = decoder.get(); } - assert (s == src); + assertTrue (s == src); } } diff --git a/Foundation/testsuite/src/LRUCacheTest.cpp b/Foundation/testsuite/src/LRUCacheTest.cpp index be0ee3bda..cb4a83a9d 100644 --- a/Foundation/testsuite/src/LRUCacheTest.cpp +++ b/Foundation/testsuite/src/LRUCacheTest.cpp @@ -33,23 +33,23 @@ LRUCacheTest::~LRUCacheTest() void LRUCacheTest::testClear() { LRUCache aCache(3); - assert (aCache.size() == 0); - assert (aCache.getAllKeys().size() == 0); + assertTrue (aCache.size() == 0); + assertTrue (aCache.getAllKeys().size() == 0); aCache.add(1, 2); aCache.add(3, 4); aCache.add(5, 6); - assert (aCache.size() == 3); - assert (aCache.getAllKeys().size() == 3); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(1) == 2); - assert (*aCache.get(3) == 4); - assert (*aCache.get(5) == 6); + assertTrue (aCache.size() == 3); + assertTrue (aCache.getAllKeys().size() == 3); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(1) == 2); + assertTrue (*aCache.get(3) == 4); + assertTrue (*aCache.get(5) == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } @@ -71,22 +71,22 @@ void LRUCacheTest::testCacheSize1() { LRUCache aCache(1); aCache.add(1, 2); - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(3, 4); // replaces 1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (*aCache.get(3) == 4); + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(3) == 4); aCache.add(5, 6); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); aCache.remove(5); - assert (!aCache.has(5)); + assertTrue (!aCache.has(5)); // removing illegal entries should work too aCache.remove(666); @@ -99,37 +99,37 @@ void LRUCacheTest::testCacheSize2() // 3-1|5 -> 5 gets removed LRUCache aCache(2); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (*aCache.get(1) == 2); // 1-3 - assert (*aCache.get(3) == 4); // 3-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(1) == 2); // 1-3 + assertTrue (*aCache.get(3) == 4); // 3-1 aCache.add(5, 6); // 5-3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); // 5-3 - assert (*aCache.get(3) == 4); // 3-5 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); // 5-3 + assertTrue (*aCache.get(3) == 4); // 3-5 // test remove from the end and the beginning of the list aCache.remove(5); // 3 - assert (!aCache.has(5)); - assert (*aCache.get(3) == 4); // 3 + assertTrue (!aCache.has(5)); + assertTrue (*aCache.get(3) == 4); // 3 aCache.add(5, 6); // 5-3 - assert (*aCache.get(3) == 4); // 3-5 + assertTrue (*aCache.get(3) == 4); // 3-5 aCache.remove(3); // 5 - assert (!aCache.has(3)); - assert (*aCache.get(5) == 6); // 5 + assertTrue (!aCache.has(3)); + assertTrue (*aCache.get(5) == 6); // 5 // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); + assertTrue (!aCache.has(5)); } @@ -139,48 +139,48 @@ void LRUCacheTest::testCacheSizeN() // 3-1|5 -> 5 gets removed LRUCache aCache(3); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(3, 4); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (*aCache.get(1) == 2); // 1-3 - assert (*aCache.get(3) == 4); // 3-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(1) == 2); // 1-3 + assertTrue (*aCache.get(3) == 4); // 3-1 aCache.add(5, 6); // 5-3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); // 5-3-1 - assert (*aCache.get(3) == 4); // 3-5-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); // 5-3-1 + assertTrue (*aCache.get(3) == 4); // 3-5-1 aCache.add(7, 8); // 7-5-3|1 - assert (!aCache.has(1)); - assert (aCache.has(7)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (*aCache.get(5) == 6); // 5-7-3 - assert (*aCache.get(3) == 4); // 3-5-7 - assert (*aCache.get(7) == 8); // 7-3-5 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(7)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (*aCache.get(5) == 6); // 5-7-3 + assertTrue (*aCache.get(3) == 4); // 3-5-7 + assertTrue (*aCache.get(7) == 8); // 7-3-5 // test remove from the end and the beginning of the list aCache.remove(5); // 7-3 - assert (!aCache.has(5)); - assert (*aCache.get(3) == 4); // 3-7 + assertTrue (!aCache.has(5)); + assertTrue (*aCache.get(3) == 4); // 3-7 aCache.add(5, 6); // 5-3-7 - assert (*aCache.get(7) == 8); // 7-5-3 + assertTrue (*aCache.get(7) == 8); // 7-5-3 aCache.remove(7); // 5-3 - assert (!aCache.has(7)); - assert (aCache.has(3)); - assert (*aCache.get(5) == 6); // 5-3 + assertTrue (!aCache.has(7)); + assertTrue (aCache.has(3)); + assertTrue (*aCache.get(5) == 6); // 5-3 // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -188,11 +188,11 @@ void LRUCacheTest::testDuplicateAdd() { LRUCache aCache(3); aCache.add(1, 2); // 1 - assert (aCache.has(1)); - assert (*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.add(1, 3); - assert (aCache.has(1)); - assert (*aCache.get(1) == 3); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 3); } @@ -206,18 +206,18 @@ void LRUCacheTest::testUpdate() aCache.Remove += delegate(this, &LRUCacheTest::onRemove); aCache.Update += delegate(this, &LRUCacheTest::onUpdate); aCache.add(1, 2); // 1 ,one add event - assert(addCnt == 1); - assert(updateCnt == 0); - assert(removeCnt == 0); + assertTrue (addCnt == 1); + assertTrue (updateCnt == 0); + assertTrue (removeCnt == 0); - assert(aCache.has(1)); - assert(*aCache.get(1) == 2); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 2); aCache.update(1, 3); // one update event only! - assert(addCnt == 1); - assert(updateCnt == 1); - assert(removeCnt == 0); - assert(aCache.has(1)); - assert(*aCache.get(1) == 3); + assertTrue (addCnt == 1); + assertTrue (updateCnt == 1); + assertTrue (removeCnt == 0); + assertTrue (aCache.has(1)); + assertTrue (*aCache.get(1) == 3); } diff --git a/Foundation/testsuite/src/LineEndingConverterTest.cpp b/Foundation/testsuite/src/LineEndingConverterTest.cpp index 04ed2e684..cc9065b6c 100644 --- a/Foundation/testsuite/src/LineEndingConverterTest.cpp +++ b/Foundation/testsuite/src/LineEndingConverterTest.cpp @@ -39,7 +39,7 @@ void LineEndingConverterTest::testInputDosToUnix() InputLineEndingConverter conv(input, LineEnding::NEWLINE_LF); StreamCopier::copyStream(conv, output); std::string result = output.str(); - assert (result == "line1\nline2\nline3\n"); + assertTrue (result == "line1\nline2\nline3\n"); } @@ -50,7 +50,7 @@ void LineEndingConverterTest::testInputUnixToDos() InputLineEndingConverter conv(input, LineEnding::NEWLINE_CRLF); StreamCopier::copyStream(conv, output); std::string result = output.str(); - assert (result == "line1\r\nline2\r\nline3\r\n"); + assertTrue (result == "line1\r\nline2\r\nline3\r\n"); } @@ -61,7 +61,7 @@ void LineEndingConverterTest::testInputMacToUnix() InputLineEndingConverter conv(input, LineEnding::NEWLINE_LF); StreamCopier::copyStream(conv, output); std::string result = output.str(); - assert (result == "line1\nline2\nline3\n"); + assertTrue (result == "line1\nline2\nline3\n"); } @@ -72,7 +72,7 @@ void LineEndingConverterTest::testInputRemove() InputLineEndingConverter conv(input, ""); StreamCopier::copyStream(conv, output); std::string result = output.str(); - assert (result == "line1line2line3"); + assertTrue (result == "line1line2line3"); } @@ -82,7 +82,7 @@ void LineEndingConverterTest::testOutputDosToUnix() OutputLineEndingConverter conv(output, LineEnding::NEWLINE_LF); conv << "line1\r\nline2\r\nline3\r\n" << std::flush; std::string result = output.str(); - assert (result == "line1\nline2\nline3\n"); + assertTrue (result == "line1\nline2\nline3\n"); } @@ -92,7 +92,7 @@ void LineEndingConverterTest::testOutputUnixToDos() OutputLineEndingConverter conv(output, LineEnding::NEWLINE_CRLF); conv << "line1\nline2\nline3\n" << std::flush; std::string result = output.str(); - assert (result == "line1\r\nline2\r\nline3\r\n"); + assertTrue (result == "line1\r\nline2\r\nline3\r\n"); } @@ -102,7 +102,7 @@ void LineEndingConverterTest::testOutputMacToUnix() OutputLineEndingConverter conv(output, LineEnding::NEWLINE_LF); conv << "line1\rline2\rline3\r" << std::flush; std::string result = output.str(); - assert (result == "line1\nline2\nline3\n"); + assertTrue (result == "line1\nline2\nline3\n"); } @@ -112,7 +112,7 @@ void LineEndingConverterTest::testOutputRemove() OutputLineEndingConverter conv(output, ""); conv << "line1\r\nline2\rline3\n" << std::flush; std::string result = output.str(); - assert (result == "line1line2line3"); + assertTrue (result == "line1line2line3"); } diff --git a/Foundation/testsuite/src/LinearHashTableTest.cpp b/Foundation/testsuite/src/LinearHashTableTest.cpp index b0e6c83cd..276d831d6 100644 --- a/Foundation/testsuite/src/LinearHashTableTest.cpp +++ b/Foundation/testsuite/src/LinearHashTableTest.cpp @@ -42,36 +42,36 @@ void LinearHashTableTest::testInsert() LinearHashTable > ht; - assert (ht.empty()); + assertTrue (ht.empty()); for (int i = 0; i < N; ++i) { std::pair >::Iterator, bool> res = ht.insert(i); - assert (*res.first == i); - assert (res.second); + assertTrue (*res.first == i); + assertTrue (res.second); LinearHashTable >::Iterator it = ht.find(i); - assert (it != ht.end()); - assert (*it == i); - assert (ht.size() == i + 1); + assertTrue (it != ht.end()); + assertTrue (*it == i); + assertTrue (ht.size() == i + 1); } - assert (ht.buckets() == N + 1); + assertTrue (ht.buckets() == N + 1); - assert (!ht.empty()); + assertTrue (!ht.empty()); for (int i = 0; i < N; ++i) { LinearHashTable >::Iterator it = ht.find(i); - assert (it != ht.end()); - assert (*it == i); + assertTrue (it != ht.end()); + assertTrue (*it == i); } for (int i = 0; i < N; ++i) { std::pair >::Iterator, bool> res = ht.insert(i); - assert (*res.first == i); - assert (!res.second); - assert (ht.size() == N); - assert (ht.buckets() == N + 1); + assertTrue (*res.first == i); + assertTrue (!res.second); + assertTrue (ht.size() == N); + assertTrue (ht.buckets() == N + 1); } } @@ -86,27 +86,27 @@ void LinearHashTableTest::testErase() { ht.insert(i); } - assert (ht.size() == N); + assertTrue (ht.size() == N); for (int i = 0; i < N; i += 2) { ht.erase(i); LinearHashTable >::Iterator it = ht.find(i); - assert (it == ht.end()); + assertTrue (it == ht.end()); } - assert (ht.size() == N/2); + assertTrue (ht.size() == N/2); for (int i = 0; i < N; i += 2) { LinearHashTable >::Iterator it = ht.find(i); - assert (it == ht.end()); + assertTrue (it == ht.end()); } for (int i = 1; i < N; i += 2) { LinearHashTable >::Iterator it = ht.find(i); - assert (it != ht.end()); - assert (*it == i); + assertTrue (it != ht.end()); + assertTrue (*it == i); } for (int i = 0; i < N; i += 2) @@ -117,8 +117,8 @@ void LinearHashTableTest::testErase() for (int i = 0; i < N; ++i) { LinearHashTable >::Iterator it = ht.find(i); - assert (it != ht.end()); - assert (*it == i); + assertTrue (it != ht.end()); + assertTrue (*it == i); } } @@ -138,12 +138,12 @@ void LinearHashTableTest::testIterator() LinearHashTable >::Iterator it = ht.begin(); while (it != ht.end()) { - assert (values.find(*it) == values.end()); + assertTrue (values.find(*it) == values.end()); values.insert(*it); ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } @@ -162,12 +162,12 @@ void LinearHashTableTest::testConstIterator() LinearHashTable >::ConstIterator it = ht.begin(); while (it != ht.end()) { - assert (values.find(*it) == values.end()); + assertTrue (values.find(*it) == values.end()); values.insert(*it); ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); values.clear(); const LinearHashTable > cht(ht); @@ -175,12 +175,12 @@ void LinearHashTableTest::testConstIterator() LinearHashTable >::ConstIterator cit = cht.begin(); while (cit != cht.end()) { - assert (values.find(*cit) == values.end()); + assertTrue (values.find(*cit) == values.end()); values.insert(*cit); ++cit; } - assert (values.size() == N); + assertTrue (values.size() == N); } diff --git a/Foundation/testsuite/src/ListMapTest.cpp b/Foundation/testsuite/src/ListMapTest.cpp index 6d9bbf380..567ece63e 100644 --- a/Foundation/testsuite/src/ListMapTest.cpp +++ b/Foundation/testsuite/src/ListMapTest.cpp @@ -36,36 +36,36 @@ void ListMapTest::testInsert() typedef ListMap IntMap; IntMap hm; - assert (hm.empty()); + assertTrue (hm.empty()); for (int i = 0; i < N; ++i) { IntMap::Iterator res = hm.insert(IntMap::ValueType(i, i*2)); - assert (res->first == i); - assert (res->second == i*2); + assertTrue (res->first == i); + assertTrue (res->second == i*2); IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); - assert (it->second == i*2); - assert (hm.size() == i + 1); + assertTrue (it != hm.end()); + assertTrue (it->first == i); + assertTrue (it->second == i*2); + assertTrue (hm.size() == i + 1); } - assert (!hm.empty()); + assertTrue (!hm.empty()); for (int i = 0; i < N; ++i) { IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); - assert (it->second == i*2); + assertTrue (it != hm.end()); + assertTrue (it->first == i); + assertTrue (it->second == i*2); } hm.clear(); for (int i = 0; i < N; ++i) { IntMap::Iterator res = hm.insert(IntMap::ValueType(i, 0)); - assert (res->first == i); - assert (res->second == 0); + assertTrue (res->first == i); + assertTrue (res->second == 0); } } @@ -81,27 +81,27 @@ void ListMapTest::testInsertOrder() lm.insert(StrToIntMap::ValueType("bar", 43)); StrToIntMap::Iterator it = lm.begin(); - assert (it != lm.end() && it->first == "foo" && it->second == 42); + assertTrue (it != lm.end() && it->first == "foo" && it->second == 42); ++it; - assert (it != lm.end() && it->first == "bar" && it->second == 43); + assertTrue (it != lm.end() && it->first == "bar" && it->second == 43); ++it; - assert (it == lm.end()); + assertTrue (it == lm.end()); lm.insert(StrToIntMap::ValueType("foo", 44)); it = lm.begin(); - assert (it != lm.end() && it->first == "foo" && it->second == 42); + assertTrue (it != lm.end() && it->first == "foo" && it->second == 42); ++it; - assert (it != lm.end() && it->first == "foo" && it->second == 44); + assertTrue (it != lm.end() && it->first == "foo" && it->second == 44); ++it; - assert (it != lm.end() && it->first == "bar" && it->second == 43); + assertTrue (it != lm.end() && it->first == "bar" && it->second == 43); ++it; - assert (it == lm.end()); + assertTrue (it == lm.end()); } @@ -116,27 +116,27 @@ void ListMapTest::testErase() { hm.insert(IntMap::ValueType(i, i*2)); } - assert (hm.size() == N); + assertTrue (hm.size() == N); for (int i = 0; i < N; i += 2) { hm.erase(i); IntMap::Iterator it = hm.find(i); - assert (it == hm.end()); + assertTrue (it == hm.end()); } - assert (hm.size() == N/2); + assertTrue (hm.size() == N/2); for (int i = 0; i < N; i += 2) { IntMap::Iterator it = hm.find(i); - assert (it == hm.end()); + assertTrue (it == hm.end()); } for (int i = 1; i < N; i += 2) { IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); + assertTrue (it != hm.end()); + assertTrue (it->first == i); } for (int i = 0; i < N; i += 2) @@ -147,9 +147,9 @@ void ListMapTest::testErase() for (int i = 0; i < N; ++i) { IntMap::Iterator it = hm.find(i); - assert (it != hm.end()); - assert (it->first == i); - assert (it->second == i*2); + assertTrue (it != hm.end()); + assertTrue (it->first == i); + assertTrue (it->second == i*2); } } @@ -171,12 +171,12 @@ void ListMapTest::testIterator() it = hm.begin(); while (it != hm.end()) { - assert (values.find(it->first) == values.end()); + assertTrue (values.find(it->first) == values.end()); values[it->first] = it->second; ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } @@ -196,12 +196,12 @@ void ListMapTest::testConstIterator() IntMap::ConstIterator it = hm.begin(); while (it != hm.end()) { - assert (values.find(it->first) == values.end()); + assertTrue (values.find(it->first) == values.end()); values[it->first] = it->second; ++it; } - assert (values.size() == N); + assertTrue (values.size() == N); } @@ -214,10 +214,10 @@ void ListMapTest::testIntIndex() hm[2] = 4; hm[3] = 6; - assert (hm.size() == 3); - assert (hm[1] == 2); - assert (hm[2] == 4); - assert (hm[3] == 6); + assertTrue (hm.size() == 3); + assertTrue (hm[1] == 2); + assertTrue (hm[2] == 4); + assertTrue (hm[3] == 6); try { @@ -240,10 +240,10 @@ void ListMapTest::testStringIndex() hm["index2"] = "value4"; hm["index3"] = "value6"; - assert (hm.size() == 3); - assert (hm["index1"] == "value2"); - assert (hm["Index2"] == "value4"); - assert (hm["inDeX3"] == "value6"); + assertTrue (hm.size() == 3); + assertTrue (hm["index1"] == "value2"); + assertTrue (hm["Index2"] == "value4"); + assertTrue (hm["inDeX3"] == "value6"); try { diff --git a/Foundation/testsuite/src/LocalDateTimeTest.cpp b/Foundation/testsuite/src/LocalDateTimeTest.cpp index 2a2728b5a..5cf89c294 100644 --- a/Foundation/testsuite/src/LocalDateTimeTest.cpp +++ b/Foundation/testsuite/src/LocalDateTimeTest.cpp @@ -47,29 +47,29 @@ LocalDateTimeTest::~LocalDateTimeTest() void LocalDateTimeTest::testGregorian1() { LocalDateTime dt(1970, 1, 1); - assert (dt.year() == 1970); - assert (dt.month() == 1); - assert (dt.day() == 1); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 4); + assertTrue (dt.year() == 1970); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 1); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 4); // REMOVED: this fails when the current DST offset differs from // the one on 1970-1-1 - //assert (dt.tzd() == Timezone::tzd()); - assert (dt.julianDay() == 2440587.5); + //assertTrue (dt.tzd() == Timezone::tzd()); + assertTrue (dt.julianDay() == 2440587.5); dt.assign(2001, 9, 9, 1, 46, 40); - assert (dt.year() == 2001); - assert (dt.month() == 9); - assert (dt.day() == 9); - assert (dt.hour() == 1); - assert (dt.minute() == 46); - assert (dt.second() == 40); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 0); - //assert (dt.tzd() == Timezone::tzd()); + assertTrue (dt.year() == 2001); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 9); + assertTrue (dt.hour() == 1); + assertTrue (dt.minute() == 46); + assertTrue (dt.second() == 40); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 0); + //assertTrue (dt.tzd() == Timezone::tzd()); assertEqualDelta (dt.julianDay(), 2452161.574074, 0.000001); } @@ -77,26 +77,26 @@ void LocalDateTimeTest::testGregorian1() void LocalDateTimeTest::testGregorian2() { LocalDateTime dt(2*3600, 1970, 1, 1, 0, 0, 0, 0, 0); - assert (dt.year() == 1970); - assert (dt.month() == 1); - assert (dt.day() == 1); - assert (dt.hour() == 0); - assert (dt.minute() == 0); - assert (dt.second() == 0); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 4); - assert (dt.tzd() == 2*3600); + assertTrue (dt.year() == 1970); + assertTrue (dt.month() == 1); + assertTrue (dt.day() == 1); + assertTrue (dt.hour() == 0); + assertTrue (dt.minute() == 0); + assertTrue (dt.second() == 0); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 4); + assertTrue (dt.tzd() == 2*3600); dt.assign(-7*3600, 2001, 9, 9, 1, 46, 40, 0, 0); - assert (dt.year() == 2001); - assert (dt.month() == 9); - assert (dt.day() == 9); - assert (dt.hour() == 1); - assert (dt.minute() == 46); - assert (dt.second() == 40); - assert (dt.millisecond() == 0); - assert (dt.dayOfWeek() == 0); - assert (dt.tzd() == -7*3600); + assertTrue (dt.year() == 2001); + assertTrue (dt.month() == 9); + assertTrue (dt.day() == 9); + assertTrue (dt.hour() == 1); + assertTrue (dt.minute() == 46); + assertTrue (dt.second() == 40); + assertTrue (dt.millisecond() == 0); + assertTrue (dt.dayOfWeek() == 0); + assertTrue (dt.tzd() == -7*3600); } @@ -109,163 +109,163 @@ void LocalDateTimeTest::testConversions() LocalDateTime dt4(dt2); LocalDateTime dt5(-4*3600, dt1.utc()); - assert (dt2.year() == 2005); - assert (dt2.month() == 1); - assert (dt2.day() == 28); - assert (dt2.hour() == 14); - assert (dt2.minute() == 24); - assert (dt2.second() == 44); - assert (dt2.millisecond() == 234); - assert (dt2.dayOfWeek() == 5); - assert (dt2.tzd() == 2*3600); + assertTrue (dt2.year() == 2005); + assertTrue (dt2.month() == 1); + assertTrue (dt2.day() == 28); + assertTrue (dt2.hour() == 14); + assertTrue (dt2.minute() == 24); + assertTrue (dt2.second() == 44); + assertTrue (dt2.millisecond() == 234); + assertTrue (dt2.dayOfWeek() == 5); + assertTrue (dt2.tzd() == 2*3600); - assert (dt5.year() == 2005); - assert (dt5.month() == 1); - assert (dt5.day() == 28); - assert (dt5.hour() == 8); - assert (dt5.minute() == 24); - assert (dt5.second() == 44); - assert (dt5.millisecond() == 234); - assert (dt5.dayOfWeek() == 5); - assert (dt5.tzd() == -4*3600); + assertTrue (dt5.year() == 2005); + assertTrue (dt5.month() == 1); + assertTrue (dt5.day() == 28); + assertTrue (dt5.hour() == 8); + assertTrue (dt5.minute() == 24); + assertTrue (dt5.second() == 44); + assertTrue (dt5.millisecond() == 234); + assertTrue (dt5.dayOfWeek() == 5); + assertTrue (dt5.tzd() == -4*3600); DateTime dt6(2005, 1, 28, 14, 24, 44, 234, 0); LocalDateTime dt7(3600, dt6); LocalDateTime dt8(3600, dt6, false); LocalDateTime dt9(3600, dt6, true); - assert (dt7.hour() == 15); - assert (dt8.hour() == 14); - assert (dt9.hour() == 15); + assertTrue (dt7.hour() == 15); + assertTrue (dt8.hour() == 14); + assertTrue (dt9.hour() == 15); } void LocalDateTimeTest::testCalcs() { LocalDateTime dt1(2005, 1, 1); - assert (dt1.dayOfYear() == 1); - assert (dt1.week(DateTime::MONDAY) == 0); + assertTrue (dt1.dayOfYear() == 1); + assertTrue (dt1.week(DateTime::MONDAY) == 0); dt1.assign(2005, 1, 3); - assert (dt1.dayOfYear() == 3); - assert (dt1.week(DateTime::MONDAY) == 1); + assertTrue (dt1.dayOfYear() == 3); + assertTrue (dt1.week(DateTime::MONDAY) == 1); dt1.assign(2005, 1, 9); - assert (dt1.dayOfYear() == 9); - assert (dt1.week(DateTime::MONDAY) == 1); + assertTrue (dt1.dayOfYear() == 9); + assertTrue (dt1.week(DateTime::MONDAY) == 1); dt1.assign(2005, 1, 10); - assert (dt1.dayOfYear() == 10); - assert (dt1.week(DateTime::MONDAY) == 2); + assertTrue (dt1.dayOfYear() == 10); + assertTrue (dt1.week(DateTime::MONDAY) == 2); dt1.assign(2005, 2, 1); - assert (dt1.dayOfYear() == 32); - assert (dt1.week(DateTime::MONDAY) == 5); + assertTrue (dt1.dayOfYear() == 32); + assertTrue (dt1.week(DateTime::MONDAY) == 5); dt1.assign(2005, 12, 31); - assert (dt1.week(DateTime::MONDAY) == 52); + assertTrue (dt1.week(DateTime::MONDAY) == 52); dt1.assign(2007, 1, 1); - assert (dt1.week(DateTime::MONDAY) == 1); + assertTrue (dt1.week(DateTime::MONDAY) == 1); dt1.assign(2007, 12, 31); - assert (dt1.week(DateTime::MONDAY) == 53); + assertTrue (dt1.week(DateTime::MONDAY) == 53); // Jan 1 is Mon dt1.assign(2001, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2001, 1, 7); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2001, 1, 8); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2001, 1, 21); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2001, 1, 22); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Tue dt1.assign(2002, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2002, 1, 6); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2002, 1, 7); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2002, 1, 20); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2002, 1, 21); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Wed dt1.assign(2003, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2003, 1, 5); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2003, 1, 6); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2003, 1, 19); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2003, 1, 20); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Thu dt1.assign(2004, 1, 1); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2004, 1, 4); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2004, 1, 5); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2004, 1, 18); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); dt1.assign(2004, 1, 19); - assert (dt1.week() == 4); + assertTrue (dt1.week() == 4); // Jan 1 is Fri dt1.assign(1999, 1, 1); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(1999, 1, 3); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(1999, 1, 4); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(1999, 1, 17); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(1999, 1, 18); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); // Jan 1 is Sat dt1.assign(2000, 1, 1); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(2000, 1, 2); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(2000, 1, 3); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(2000, 1, 16); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(2000, 1, 17); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); // Jan 1 is Sun dt1.assign(1995, 1, 1); - assert (dt1.week() == 0); + assertTrue (dt1.week() == 0); dt1.assign(1995, 1, 2); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(1995, 1, 3); - assert (dt1.week() == 1); + assertTrue (dt1.week() == 1); dt1.assign(1995, 1, 15); - assert (dt1.week() == 2); + assertTrue (dt1.week() == 2); dt1.assign(1995, 1, 16); - assert (dt1.week() == 3); + assertTrue (dt1.week() == 3); } void LocalDateTimeTest::testAMPM() { LocalDateTime dt1(2005, 1, 1, 0, 15, 30); - assert (dt1.isAM()); - assert (!dt1.isPM()); - assert (dt1.hourAMPM() == 12); + assertTrue (dt1.isAM()); + assertTrue (!dt1.isPM()); + assertTrue (dt1.hourAMPM() == 12); dt1.assign(2005, 1, 1, 12, 15, 30); - assert (!dt1.isAM()); - assert (dt1.isPM()); - assert (dt1.hourAMPM() == 12); + assertTrue (!dt1.isAM()); + assertTrue (dt1.isPM()); + assertTrue (dt1.hourAMPM() == 12); dt1.assign(2005, 1, 1, 13, 15, 30); - assert (!dt1.isAM()); - assert (dt1.isPM()); - assert (dt1.hourAMPM() == 1); + assertTrue (!dt1.isAM()); + assertTrue (dt1.isPM()); + assertTrue (dt1.hourAMPM() == 1); } @@ -275,19 +275,19 @@ void LocalDateTimeTest::testRelational1() LocalDateTime dt2(2005, 1, 2, 0, 15, 30); LocalDateTime dt3(dt1); - assert (dt1 < dt2); - assert (dt1 <= dt2); - assert (dt2 > dt1); - assert (dt2 >= dt1); - assert (dt1 != dt2); - assert (!(dt1 == dt2)); + assertTrue (dt1 < dt2); + assertTrue (dt1 <= dt2); + assertTrue (dt2 > dt1); + assertTrue (dt2 >= dt1); + assertTrue (dt1 != dt2); + assertTrue (!(dt1 == dt2)); - assert (dt1 == dt3); - assert (!(dt1 != dt3)); - assert (dt1 >= dt3); - assert (dt1 <= dt3); - assert (!(dt1 > dt3)); - assert (!(dt1 < dt3)); + assertTrue (dt1 == dt3); + assertTrue (!(dt1 != dt3)); + assertTrue (dt1 >= dt3); + assertTrue (dt1 <= dt3); + assertTrue (!(dt1 > dt3)); + assertTrue (!(dt1 < dt3)); } @@ -297,19 +297,19 @@ void LocalDateTimeTest::testRelational2() LocalDateTime dt2(2*3600, 2005, 1, 1, 17, 30, 0, 0, 0); LocalDateTime dt3(5*3600, 2005, 1, 1, 18, 30, 0, 0, 0); - assert (dt1 < dt2); - assert (dt1 <= dt2); - assert (dt2 > dt1); - assert (dt2 >= dt1); - assert (dt1 != dt2); - assert (!(dt1 == dt2)); + assertTrue (dt1 < dt2); + assertTrue (dt1 <= dt2); + assertTrue (dt2 > dt1); + assertTrue (dt2 >= dt1); + assertTrue (dt1 != dt2); + assertTrue (!(dt1 == dt2)); - assert (dt1 == dt3); - assert (!(dt1 != dt3)); - assert (dt1 >= dt3); - assert (dt1 <= dt3); - assert (!(dt1 > dt3)); - assert (!(dt1 < dt3)); + assertTrue (dt1 == dt3); + assertTrue (!(dt1 != dt3)); + assertTrue (dt1 >= dt3); + assertTrue (dt1 <= dt3); + assertTrue (!(dt1 > dt3)); + assertTrue (!(dt1 < dt3)); } @@ -319,15 +319,15 @@ void LocalDateTimeTest::testArithmetics1() LocalDateTime dt2(2005, 1, 2, 0, 15, 30); Timespan s = dt2 - dt1; - assert (s.days() == 1); + assertTrue (s.days() == 1); LocalDateTime dt3 = dt1 + s; - assert (dt3 == dt2); + assertTrue (dt3 == dt2); dt3 -= s; - assert (dt3 == dt1); + assertTrue (dt3 == dt1); dt1 += s; - assert (dt1 == dt2); + assertTrue (dt1 == dt2); } @@ -337,15 +337,15 @@ void LocalDateTimeTest::testArithmetics2() LocalDateTime dt2(5*3600, 2005, 1, 2, 18, 30, 0, 0, 0); Timespan s = dt2 - dt1; - assert (s.days() == 1); + assertTrue (s.days() == 1); LocalDateTime dt3 = dt1 + s; - assert (dt3 == dt2); + assertTrue (dt3 == dt2); dt3 -= s; - assert (dt3 == dt1); + assertTrue (dt3 == dt1); dt1 += s; - assert (dt1 == dt2); + assertTrue (dt1 == dt2); } @@ -354,9 +354,9 @@ void LocalDateTimeTest::testSwap() LocalDateTime dt1(2005, 1, 1, 0, 15, 30); LocalDateTime dt2(2005, 1, 2, 0, 15, 30); - assert (dt1 < dt2); + assertTrue (dt1 < dt2); dt1.swap(dt2); - assert (dt2 < dt1); + assertTrue (dt2 < dt1); } @@ -432,7 +432,7 @@ void LocalDateTimeTest::testTimezone() then.tm_sec, dt2.millisecond(), dt2.microsecond())); - assert (dt2 == calcd); + assertTrue (dt2 == calcd); } } } diff --git a/Foundation/testsuite/src/LogStreamTest.cpp b/Foundation/testsuite/src/LogStreamTest.cpp index bdfa8e08f..7fec5d0cb 100644 --- a/Foundation/testsuite/src/LogStreamTest.cpp +++ b/Foundation/testsuite/src/LogStreamTest.cpp @@ -43,13 +43,13 @@ void LogStreamTest::testLogStream() LogStream ls(root); ls << "information" << ' ' << 1 << std::endl; - assert (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION); - assert (pChannel->list().begin()->getText() == "information 1"); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION); + assertTrue (pChannel->list().begin()->getText() == "information 1"); pChannel->list().clear(); ls.error() << "error" << std::endl; - assert (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR); - assert (pChannel->list().begin()->getText() == "error"); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR); + assertTrue (pChannel->list().begin()->getText() == "error"); pChannel->list().clear(); } diff --git a/Foundation/testsuite/src/LoggerTest.cpp b/Foundation/testsuite/src/LoggerTest.cpp index b90e7b814..dd47d01b9 100644 --- a/Foundation/testsuite/src/LoggerTest.cpp +++ b/Foundation/testsuite/src/LoggerTest.cpp @@ -37,23 +37,23 @@ void LoggerTest::testLogger() AutoPtr pChannel = new TestChannel; Logger& root = Logger::root(); root.setChannel(pChannel.get()); - assert (root.getLevel() == Message::PRIO_INFORMATION); - assert (root.is(Message::PRIO_INFORMATION)); - assert (root.fatal()); - assert (root.critical()); - assert (root.error()); - assert (root.warning()); - assert (root.notice()); - assert (root.information()); - assert (!root.debug()); - assert (!root.trace()); + assertTrue (root.getLevel() == Message::PRIO_INFORMATION); + assertTrue (root.is(Message::PRIO_INFORMATION)); + assertTrue (root.fatal()); + assertTrue (root.critical()); + assertTrue (root.error()); + assertTrue (root.warning()); + assertTrue (root.notice()); + assertTrue (root.information()); + assertTrue (!root.debug()); + assertTrue (!root.trace()); root.information("Informational message"); - assert (pChannel->list().size() == 1); + assertTrue (pChannel->list().size() == 1); root.warning("Warning message"); - assert (pChannel->list().size() == 2); + assertTrue (pChannel->list().size() == 2); root.debug("Debug message"); - assert (pChannel->list().size() == 2); + assertTrue (pChannel->list().size() == 2); Logger& logger1 = Logger::get("Logger1"); Logger& logger2 = Logger::get("Logger2"); @@ -64,91 +64,91 @@ void LoggerTest::testLogger() std::vector loggers; Logger::names(loggers); - assert (loggers.size() == 7); - assert (loggers[0] == ""); - assert (loggers[1] == "Logger1"); - assert (loggers[2] == "Logger1.Logger1"); - assert (loggers[3] == "Logger1.Logger2"); - assert (loggers[4] == "Logger2"); - assert (loggers[5] == "Logger2.Logger1"); - assert (loggers[6] == "Logger2.Logger2"); + assertTrue (loggers.size() == 7); + assertTrue (loggers[0] == ""); + assertTrue (loggers[1] == "Logger1"); + assertTrue (loggers[2] == "Logger1.Logger1"); + assertTrue (loggers[3] == "Logger1.Logger2"); + assertTrue (loggers[4] == "Logger2"); + assertTrue (loggers[5] == "Logger2.Logger1"); + assertTrue (loggers[6] == "Logger2.Logger2"); Logger::setLevel("Logger1", Message::PRIO_DEBUG); - assert (logger1.is(Message::PRIO_DEBUG)); - assert (logger11.is(Message::PRIO_DEBUG)); - assert (logger12.is(Message::PRIO_DEBUG)); - assert (!logger2.is(Message::PRIO_DEBUG)); - assert (!logger21.is(Message::PRIO_DEBUG)); - assert (!logger22.is(Message::PRIO_DEBUG)); - assert (logger11.is(Message::PRIO_INFORMATION)); - assert (logger12.is(Message::PRIO_INFORMATION)); - assert (logger21.is(Message::PRIO_INFORMATION)); - assert (logger22.is(Message::PRIO_INFORMATION)); + assertTrue (logger1.is(Message::PRIO_DEBUG)); + assertTrue (logger11.is(Message::PRIO_DEBUG)); + assertTrue (logger12.is(Message::PRIO_DEBUG)); + assertTrue (!logger2.is(Message::PRIO_DEBUG)); + assertTrue (!logger21.is(Message::PRIO_DEBUG)); + assertTrue (!logger22.is(Message::PRIO_DEBUG)); + assertTrue (logger11.is(Message::PRIO_INFORMATION)); + assertTrue (logger12.is(Message::PRIO_INFORMATION)); + assertTrue (logger21.is(Message::PRIO_INFORMATION)); + assertTrue (logger22.is(Message::PRIO_INFORMATION)); Logger::setLevel("Logger2.Logger1", Message::PRIO_ERROR); - assert (logger1.is(Message::PRIO_DEBUG)); - assert (logger11.is(Message::PRIO_DEBUG)); - assert (logger12.is(Message::PRIO_DEBUG)); - assert (!logger21.is(Message::PRIO_DEBUG)); - assert (!logger22.is(Message::PRIO_DEBUG)); - assert (logger11.is(Message::PRIO_INFORMATION)); - assert (logger12.is(Message::PRIO_INFORMATION)); - assert (logger21.is(Message::PRIO_ERROR)); - assert (logger22.is(Message::PRIO_INFORMATION)); + assertTrue (logger1.is(Message::PRIO_DEBUG)); + assertTrue (logger11.is(Message::PRIO_DEBUG)); + assertTrue (logger12.is(Message::PRIO_DEBUG)); + assertTrue (!logger21.is(Message::PRIO_DEBUG)); + assertTrue (!logger22.is(Message::PRIO_DEBUG)); + assertTrue (logger11.is(Message::PRIO_INFORMATION)); + assertTrue (logger12.is(Message::PRIO_INFORMATION)); + assertTrue (logger21.is(Message::PRIO_ERROR)); + assertTrue (logger22.is(Message::PRIO_INFORMATION)); Logger::setLevel("", Message::PRIO_WARNING); - assert (root.getLevel() == Message::PRIO_WARNING); - assert (logger1.getLevel() == Message::PRIO_WARNING); - assert (logger11.getLevel() == Message::PRIO_WARNING); - assert (logger12.getLevel() == Message::PRIO_WARNING); - assert (logger1.getLevel() == Message::PRIO_WARNING); - assert (logger21.getLevel() == Message::PRIO_WARNING); - assert (logger22.getLevel() == Message::PRIO_WARNING); + assertTrue (root.getLevel() == Message::PRIO_WARNING); + assertTrue (logger1.getLevel() == Message::PRIO_WARNING); + assertTrue (logger11.getLevel() == Message::PRIO_WARNING); + assertTrue (logger12.getLevel() == Message::PRIO_WARNING); + assertTrue (logger1.getLevel() == Message::PRIO_WARNING); + assertTrue (logger21.getLevel() == Message::PRIO_WARNING); + assertTrue (logger22.getLevel() == Message::PRIO_WARNING); AutoPtr pChannel2 = new TestChannel; Logger::setChannel("Logger2", pChannel2.get()); - assert (pChannel == root.getChannel()); - assert (pChannel == logger1.getChannel()); - assert (pChannel == logger11.getChannel()); - assert (pChannel == logger12.getChannel()); - assert (pChannel2 == logger2.getChannel()); - assert (pChannel2 == logger21.getChannel()); - assert (pChannel2 == logger22.getChannel()); + assertTrue (pChannel == root.getChannel()); + assertTrue (pChannel == logger1.getChannel()); + assertTrue (pChannel == logger11.getChannel()); + assertTrue (pChannel == logger12.getChannel()); + assertTrue (pChannel2 == logger2.getChannel()); + assertTrue (pChannel2 == logger21.getChannel()); + assertTrue (pChannel2 == logger22.getChannel()); root.setLevel(Message::PRIO_TRACE); pChannel->list().clear(); root.trace("trace"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_TRACE); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_TRACE); pChannel->list().clear(); root.debug("debug"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_DEBUG); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_DEBUG); pChannel->list().clear(); root.information("information"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION); pChannel->list().clear(); root.notice("notice"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_NOTICE); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_NOTICE); pChannel->list().clear(); root.warning("warning"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_WARNING); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_WARNING); pChannel->list().clear(); root.error("error"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR); pChannel->list().clear(); root.critical("critical"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_CRITICAL); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_CRITICAL); pChannel->list().clear(); root.fatal("fatal"); - assert (pChannel->list().begin()->getPriority() == Message::PRIO_FATAL); + assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_FATAL); root.setLevel("1"); - assert (root.getLevel() == Message::PRIO_FATAL); + assertTrue (root.getLevel() == Message::PRIO_FATAL); root.setLevel("8"); - assert (root.getLevel() == Message::PRIO_TRACE); + assertTrue (root.getLevel() == Message::PRIO_TRACE); try { root.setLevel("0"); - assert(0); + assertTrue (0); } catch(Poco::InvalidArgumentException&) { @@ -156,7 +156,7 @@ void LoggerTest::testLogger() try { root.setLevel("9"); - assert(0); + assertTrue (0); } catch(Poco::InvalidArgumentException&) { @@ -168,23 +168,23 @@ void LoggerTest::testLogger() void LoggerTest::testFormat() { std::string str = Logger::format("$0$1", "foo", "bar"); - assert (str == "foobar"); + assertTrue (str == "foobar"); str = Logger::format("foo$0", "bar"); - assert (str == "foobar"); + assertTrue (str == "foobar"); str = Logger::format("the amount is $$ $0", "100"); - assert (str == "the amount is $ 100"); + assertTrue (str == "the amount is $ 100"); str = Logger::format("$0$1$2", "foo", "bar"); - assert (str == "foobar"); + assertTrue (str == "foobar"); str = Logger::format("$foo$0", "bar"); - assert (str == "$foobar"); + assertTrue (str == "$foobar"); str = Logger::format("$0", "1"); - assert (str == "1"); + assertTrue (str == "1"); str = Logger::format("$0$1", "1", "2"); - assert (str == "12"); + assertTrue (str == "12"); str = Logger::format("$0$1$2", "1", "2", "3"); - assert (str == "123"); + assertTrue (str == "123"); str = Logger::format("$0$1$2$3", "1", "2", "3", "4"); - assert (str == "1234"); + assertTrue (str == "1234"); } void LoggerTest::testFormatAny() @@ -194,43 +194,43 @@ void LoggerTest::testFormatAny() root.setChannel(pChannel.get()); root.error("%s%s", std::string("foo"), std::string("bar")); - assert (pChannel->getLastMessage().getText() == "foobar"); + assertTrue (pChannel->getLastMessage().getText() == "foobar"); root.error("foo%s", std::string("bar")); - assert (pChannel->getLastMessage().getText() == "foobar"); + assertTrue (pChannel->getLastMessage().getText() == "foobar"); root.error("the amount is %% %d", 100); - assert (pChannel->getLastMessage().getText() == "the amount is % 100"); + assertTrue (pChannel->getLastMessage().getText() == "the amount is % 100"); root.error("%d", 1); - assert (pChannel->getLastMessage().getText() == "1"); + assertTrue (pChannel->getLastMessage().getText() == "1"); root.error("%d%d", 1, 2); - assert (pChannel->getLastMessage().getText() == "12"); + assertTrue (pChannel->getLastMessage().getText() == "12"); root.error("%d%d%d", 1, 2, 3); - assert (pChannel->getLastMessage().getText() == "123"); + assertTrue (pChannel->getLastMessage().getText() == "123"); root.error("%d%d%d%d", 1, 2, 3, 4); - assert (pChannel->getLastMessage().getText() == "1234"); + assertTrue (pChannel->getLastMessage().getText() == "1234"); root.error("%d%d%d%d%d", 1, 2, 3, 4, 5); - assert (pChannel->getLastMessage().getText() == "12345"); + assertTrue (pChannel->getLastMessage().getText() == "12345"); root.error("%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6); - assert (pChannel->getLastMessage().getText() == "123456"); + assertTrue (pChannel->getLastMessage().getText() == "123456"); root.error("%d%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6, 7); - assert(pChannel->getLastMessage().getText() == "1234567"); + assertTrue (pChannel->getLastMessage().getText() == "1234567"); root.error("%d%d%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6, 7, 8); - assert(pChannel->getLastMessage().getText() == "12345678"); + assertTrue (pChannel->getLastMessage().getText() == "12345678"); root.error("%d%d%d%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6, 7, 8, 9); - assert(pChannel->getLastMessage().getText() == "123456789"); + assertTrue (pChannel->getLastMessage().getText() == "123456789"); root.error("%d%d%d%d%d%d%d%d%d%d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - assert(pChannel->getLastMessage().getText() == "12345678910"); + assertTrue (pChannel->getLastMessage().getText() == "12345678910"); } @@ -243,13 +243,13 @@ void LoggerTest::testDump() char buffer1[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}; root.dump("test", buffer1, sizeof(buffer1)); - assert (pChannel->list().empty()); + assertTrue (pChannel->list().empty()); root.setLevel(Message::PRIO_DEBUG); root.dump("test", buffer1, sizeof(buffer1)); std::string msg = pChannel->list().begin()->getText(); - assert (msg == "test\n0000 00 01 02 03 04 05 ......"); + assertTrue (msg == "test\n0000 00 01 02 03 04 05 ......"); pChannel->clear(); char buffer2[] = { @@ -258,7 +258,7 @@ void LoggerTest::testDump() }; root.dump("", buffer2, sizeof(buffer2)); msg = pChannel->list().begin()->getText(); - assert (msg == "0000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................"); + assertTrue (msg == "0000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................"); pChannel->clear(); char buffer3[] = { @@ -268,7 +268,7 @@ void LoggerTest::testDump() }; root.dump("", buffer3, sizeof(buffer3)); msg = pChannel->list().begin()->getText(); - assert (msg == "0000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................\n" + assertTrue (msg == "0000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................\n" "0010 20 41 42 1F 7F 7E AB..~"); pChannel->clear(); } diff --git a/Foundation/testsuite/src/LoggingFactoryTest.cpp b/Foundation/testsuite/src/LoggingFactoryTest.cpp index e43ae9c4f..1e7c2dd5b 100644 --- a/Foundation/testsuite/src/LoggingFactoryTest.cpp +++ b/Foundation/testsuite/src/LoggingFactoryTest.cpp @@ -75,16 +75,16 @@ void LoggingFactoryTest::testBuiltins() AutoPtr pConsoleChannel = fact.createChannel("ConsoleChannel"); #if defined(_WIN32) && !defined(_WIN32_WCE) - assert (dynamic_cast(pConsoleChannel.get()) != 0); + assertTrue (dynamic_cast(pConsoleChannel.get()) != 0); #else - assert (dynamic_cast(pConsoleChannel.get()) != 0); + assertTrue (dynamic_cast(pConsoleChannel.get()) != 0); #endif AutoPtr pFileChannel = fact.createChannel("FileChannel"); - assert (dynamic_cast(pFileChannel.get()) != 0); + assertTrue (dynamic_cast(pFileChannel.get()) != 0); AutoPtr pSplitterChannel = fact.createChannel("SplitterChannel"); - assert (dynamic_cast(pSplitterChannel.get()) != 0); + assertTrue (dynamic_cast(pSplitterChannel.get()) != 0); try { @@ -96,7 +96,7 @@ void LoggingFactoryTest::testBuiltins() } AutoPtr pPatternFormatter = fact.createFormatter("PatternFormatter"); - assert (dynamic_cast(pPatternFormatter.get()) != 0); + assertTrue (dynamic_cast(pPatternFormatter.get()) != 0); try { @@ -121,10 +121,10 @@ void LoggingFactoryTest::testCustom() fact->registerFormatterClass("CustomFormatter", new Instantiator); AutoPtr pCustomChannel = fact->createChannel("CustomChannel"); - assert (dynamic_cast(pCustomChannel.get()) != 0); + assertTrue (dynamic_cast(pCustomChannel.get()) != 0); AutoPtr pCustomFormatter = fact->createFormatter("CustomFormatter"); - assert (dynamic_cast(pCustomFormatter.get()) != 0); + assertTrue (dynamic_cast(pCustomFormatter.get()) != 0); } diff --git a/Foundation/testsuite/src/LoggingRegistryTest.cpp b/Foundation/testsuite/src/LoggingRegistryTest.cpp index 7cc9a17bd..e32bdf1e9 100644 --- a/Foundation/testsuite/src/LoggingRegistryTest.cpp +++ b/Foundation/testsuite/src/LoggingRegistryTest.cpp @@ -52,14 +52,14 @@ void LoggingRegistryTest::testRegister() reg.registerFormatter("f2", pF2); Channel* pC = reg.channelForName("c1"); - assert (pC1 == pC); + assertTrue (pC1 == pC); pC = reg.channelForName("c2"); - assert (pC2 == pC); + assertTrue (pC2 == pC); Formatter* pF = reg.formatterForName("f1"); - assert (pF1 == pF); + assertTrue (pF1 == pF); pF = reg.formatterForName("f2"); - assert (pF2 == pF); + assertTrue (pF2 == pF); try { @@ -92,15 +92,15 @@ void LoggingRegistryTest::testReregister() reg.registerChannel("c1", pC1b); Channel* pC = reg.channelForName("c1"); - assert (pC1b == pC); + assertTrue (pC1b == pC); pC = reg.channelForName("c2"); - assert (pC2 == pC); + assertTrue (pC2 == pC); reg.registerFormatter("f1", pF1b); Formatter* pF = reg.formatterForName("f1"); - assert (pF1b == pF); + assertTrue (pF1b == pF); pF = reg.formatterForName("f2"); - assert (pF2 == pF); + assertTrue (pF2 == pF); } diff --git a/Foundation/testsuite/src/MD4EngineTest.cpp b/Foundation/testsuite/src/MD4EngineTest.cpp index 424211a08..0e69fa613 100644 --- a/Foundation/testsuite/src/MD4EngineTest.cpp +++ b/Foundation/testsuite/src/MD4EngineTest.cpp @@ -35,26 +35,26 @@ void MD4EngineTest::testMD4() // test vectors from RFC 1320 engine.update(""); - assert (DigestEngine::digestToHex(engine.digest()) == "31d6cfe0d16ae931b73c59d7e0c089c0"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "31d6cfe0d16ae931b73c59d7e0c089c0"); engine.update("a"); - assert (DigestEngine::digestToHex(engine.digest()) == "bde52cb31de33e46245e05fbdbd6fb24"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "bde52cb31de33e46245e05fbdbd6fb24"); engine.update("abc"); - assert (DigestEngine::digestToHex(engine.digest()) == "a448017aaf21d8525fc10ae87aa6729d"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "a448017aaf21d8525fc10ae87aa6729d"); engine.update("message digest"); - assert (DigestEngine::digestToHex(engine.digest()) == "d9130a8164549fe818874806e1c7014b"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "d9130a8164549fe818874806e1c7014b"); engine.update("abcdefghijklmnopqrstuvwxyz"); - assert (DigestEngine::digestToHex(engine.digest()) == "d79e1c308aa5bbcdeea8ed63df412da9"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "d79e1c308aa5bbcdeea8ed63df412da9"); engine.update("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); engine.update("abcdefghijklmnopqrstuvwxyz0123456789"); - assert (DigestEngine::digestToHex(engine.digest()) == "043f8582f241db351ce627e153e7f0e4"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "043f8582f241db351ce627e153e7f0e4"); engine.update("12345678901234567890123456789012345678901234567890123456789012345678901234567890"); - assert (DigestEngine::digestToHex(engine.digest()) == "e33b4ddc9c38f2199c3e7b164fcc0536"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "e33b4ddc9c38f2199c3e7b164fcc0536"); } diff --git a/Foundation/testsuite/src/MD5EngineTest.cpp b/Foundation/testsuite/src/MD5EngineTest.cpp index 6401ccded..d3692ec09 100644 --- a/Foundation/testsuite/src/MD5EngineTest.cpp +++ b/Foundation/testsuite/src/MD5EngineTest.cpp @@ -35,26 +35,26 @@ void MD5EngineTest::testMD5() // test vectors from RFC 1321 engine.update(""); - assert (DigestEngine::digestToHex(engine.digest()) == "d41d8cd98f00b204e9800998ecf8427e"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "d41d8cd98f00b204e9800998ecf8427e"); engine.update("a"); - assert (DigestEngine::digestToHex(engine.digest()) == "0cc175b9c0f1b6a831c399e269772661"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "0cc175b9c0f1b6a831c399e269772661"); engine.update("abc"); - assert (DigestEngine::digestToHex(engine.digest()) == "900150983cd24fb0d6963f7d28e17f72"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "900150983cd24fb0d6963f7d28e17f72"); engine.update("message digest"); - assert (DigestEngine::digestToHex(engine.digest()) == "f96b697d7cb7938d525a2f31aaf161d0"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "f96b697d7cb7938d525a2f31aaf161d0"); engine.update("abcdefghijklmnopqrstuvwxyz"); - assert (DigestEngine::digestToHex(engine.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "c3fcd3d76192e4007dfb496cca67e13b"); engine.update("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); engine.update("abcdefghijklmnopqrstuvwxyz0123456789"); - assert (DigestEngine::digestToHex(engine.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "d174ab98d277d9f5a5611c2c9f419d9f"); engine.update("12345678901234567890123456789012345678901234567890123456789012345678901234567890"); - assert (DigestEngine::digestToHex(engine.digest()) == "57edf4a22be3c955ac49da2e2107b67a"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "57edf4a22be3c955ac49da2e2107b67a"); } @@ -64,8 +64,8 @@ void MD5EngineTest::testConstantTimeEquals() DigestEngine::Digest d2 = DigestEngine::digestFromHex("d41d8cd98f00b204e9800998ecf8427e"); DigestEngine::Digest d3 = DigestEngine::digestFromHex("0cc175b9c0f1b6a831c399e269772661"); - assert (DigestEngine::constantTimeEquals(d1, d2)); - assert (!DigestEngine::constantTimeEquals(d1, d3)); + assertTrue (DigestEngine::constantTimeEquals(d1, d2)); + assertTrue (!DigestEngine::constantTimeEquals(d1, d3)); } diff --git a/Foundation/testsuite/src/ManifestTest.cpp b/Foundation/testsuite/src/ManifestTest.cpp index 9d258ac88..524519cd3 100644 --- a/Foundation/testsuite/src/ManifestTest.cpp +++ b/Foundation/testsuite/src/ManifestTest.cpp @@ -43,54 +43,54 @@ ManifestTest::~ManifestTest() void ManifestTest::testManifest() { Manifest manifest; - assert (manifest.empty()); - assert (manifest.size() == 0); - assert (manifest.insert(new MetaObject("MfTestObject1"))); - assert (!manifest.empty()); - assert (manifest.size() == 1); - assert (manifest.insert(new MetaObject("MfTestObject2"))); + assertTrue (manifest.empty()); + assertTrue (manifest.size() == 0); + assertTrue (manifest.insert(new MetaObject("MfTestObject1"))); + assertTrue (!manifest.empty()); + assertTrue (manifest.size() == 1); + assertTrue (manifest.insert(new MetaObject("MfTestObject2"))); MetaObject* pMeta = new MetaObject("MfTestObject2"); - assert (!manifest.insert(pMeta)); + assertTrue (!manifest.insert(pMeta)); delete pMeta; - assert (!manifest.empty()); - assert (manifest.size() == 2); - assert (manifest.insert(new MetaObject("MfTestObject3"))); - assert (manifest.size() == 3); + assertTrue (!manifest.empty()); + assertTrue (manifest.size() == 2); + assertTrue (manifest.insert(new MetaObject("MfTestObject3"))); + assertTrue (manifest.size() == 3); - assert (manifest.find("MfTestObject1") != manifest.end()); - assert (manifest.find("MfTestObject2") != manifest.end()); - assert (manifest.find("MfTestObject3") != manifest.end()); - assert (manifest.find("MfTestObject4") == manifest.end()); + assertTrue (manifest.find("MfTestObject1") != manifest.end()); + assertTrue (manifest.find("MfTestObject2") != manifest.end()); + assertTrue (manifest.find("MfTestObject3") != manifest.end()); + assertTrue (manifest.find("MfTestObject4") == manifest.end()); std::set classes; Manifest::Iterator it = manifest.begin(); - assert (it != manifest.end()); + assertTrue (it != manifest.end()); classes.insert(it->name()); ++it; - assert (it != manifest.end()); + assertTrue (it != manifest.end()); classes.insert(it->name()); ++it; - assert (it != manifest.end()); + assertTrue (it != manifest.end()); classes.insert(it->name()); it++; - assert (it == manifest.end()); + assertTrue (it == manifest.end()); - assert (classes.find("MfTestObject1") != classes.end()); - assert (classes.find("MfTestObject2") != classes.end()); - assert (classes.find("MfTestObject3") != classes.end()); + assertTrue (classes.find("MfTestObject1") != classes.end()); + assertTrue (classes.find("MfTestObject2") != classes.end()); + assertTrue (classes.find("MfTestObject3") != classes.end()); manifest.clear(); - assert (manifest.empty()); - assert (manifest.size() == 0); - assert (manifest.insert(new MetaObject("MfTestObject4"))); - assert (!manifest.empty()); - assert (manifest.size() == 1); + assertTrue (manifest.empty()); + assertTrue (manifest.size() == 0); + assertTrue (manifest.insert(new MetaObject("MfTestObject4"))); + assertTrue (!manifest.empty()); + assertTrue (manifest.size() == 1); it = manifest.begin(); - assert (it != manifest.end()); - assert (std::string(it->name()) == "MfTestObject4"); + assertTrue (it != manifest.end()); + assertTrue (std::string(it->name()) == "MfTestObject4"); ++it; - assert (it == manifest.end()); + assertTrue (it == manifest.end()); } diff --git a/Foundation/testsuite/src/MemoryPoolTest.cpp b/Foundation/testsuite/src/MemoryPoolTest.cpp index 2db928eb9..9f86e9172 100644 --- a/Foundation/testsuite/src/MemoryPoolTest.cpp +++ b/Foundation/testsuite/src/MemoryPoolTest.cpp @@ -32,16 +32,16 @@ void MemoryPoolTest::testMemoryPool() { MemoryPool pool1(100, 0, 10); - assert (pool1.blockSize() == 100); - assert (pool1.allocated() == 0); - assert (pool1.available() == 0); + assertTrue (pool1.blockSize() == 100); + assertTrue (pool1.allocated() == 0); + assertTrue (pool1.available() == 0); std::vector ptrs; for (int i = 0; i < 10; ++i) { ptrs.push_back(pool1.get()); - assert (pool1.allocated() == i + 1); - assert (pool1.available() == 0); + assertTrue (pool1.allocated() == i + 1); + assertTrue (pool1.available() == 0); } try @@ -58,13 +58,13 @@ void MemoryPoolTest::testMemoryPool() { pool1.release(*it); ++av; - assert (pool1.available() == av); + assertTrue (pool1.available() == av); } MemoryPool pool2(32, 5, 10); - assert (pool2.available() == 5); - assert (pool2.blockSize() == 32); - assert (pool2.allocated() == 5); + assertTrue (pool2.available() == 5); + assertTrue (pool2.blockSize() == 32); + assertTrue (pool2.allocated() == 5); } diff --git a/Foundation/testsuite/src/MemoryStreamTest.cpp b/Foundation/testsuite/src/MemoryStreamTest.cpp index 029084c2e..9c705a589 100644 --- a/Foundation/testsuite/src/MemoryStreamTest.cpp +++ b/Foundation/testsuite/src/MemoryStreamTest.cpp @@ -36,37 +36,37 @@ void MemoryStreamTest::testInput() MemoryInputStream istr1(data, 14); int c = istr1.get(); - assert (c == 'T'); + assertTrue (c == 'T'); c = istr1.get(); - assert (c == 'h'); + assertTrue (c == 'h'); std::string str; istr1 >> str; - assert (str == "is"); + assertTrue (str == "is"); char buffer[32]; istr1.read(buffer, sizeof(buffer)); - assert (istr1.gcount() == 10); + assertTrue (istr1.gcount() == 10); buffer[istr1.gcount()] = 0; - assert (std::string(" is a test") == buffer); + assertTrue (std::string(" is a test") == buffer); const char* data2 = "123"; MemoryInputStream istr2(data2, 3); c = istr2.get(); - assert (c == '1'); - assert (istr2.good()); + assertTrue (c == '1'); + assertTrue (istr2.good()); c = istr2.get(); - assert (c == '2'); + assertTrue (c == '2'); istr2.unget(); c = istr2.get(); - assert (c == '2'); - assert (istr2.good()); + assertTrue (c == '2'); + assertTrue (istr2.good()); c = istr2.get(); - assert (c == '3'); - assert (istr2.good()); + assertTrue (c == '3'); + assertTrue (istr2.good()); c = istr2.get(); - assert (c == -1); - assert (istr2.eof()); + assertTrue (c == -1); + assertTrue (istr2.eof()); } @@ -75,15 +75,15 @@ void MemoryStreamTest::testOutput() char output[64]; MemoryOutputStream ostr1(output, 64); ostr1 << "This is a test " << 42 << std::ends; - assert (ostr1.charsWritten() == 18); - assert (std::string("This is a test 42") == output); + assertTrue (ostr1.charsWritten() == 18); + assertTrue (std::string("This is a test 42") == output); char output2[4]; MemoryOutputStream ostr2(output2, 4); ostr2 << "test"; - assert (ostr2.good()); + assertTrue (ostr2.good()); ostr2 << 'x'; - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } void MemoryStreamTest::testTell() @@ -92,22 +92,22 @@ void MemoryStreamTest::testTell() Poco::MemoryOutputStream ostr(buffer.begin(), buffer.size()); ostr << 'H' << 'e' << 'l' << 'l' << 'o' << '\0'; std::streamoff np = ostr.tellp(); - assert (np == 6); + assertTrue (np == 6); Poco::MemoryInputStream istr(buffer.begin(), buffer.size()); char c; istr >> c; - assert (c == 'H'); + assertTrue (c == 'H'); istr >> c; - assert (c == 'e'); + assertTrue (c == 'e'); istr >> c; - assert (c == 'l'); + assertTrue (c == 'l'); std::streamoff ng = istr.tellg(); - assert (ng == 3); + assertTrue (ng == 3); } @@ -121,27 +121,27 @@ void MemoryStreamTest::testInputSeek() char c; istr >> c; - assert (c == '1'); + assertTrue (c == '1'); istr.seekg(3, std::ios_base::beg); // 3 from beginning istr >> c; // now that makes 4 - assert (4 == istr.tellg()); - assert (c == '4'); + assertTrue (4 == istr.tellg()); + assertTrue (c == '4'); istr.seekg(2, std::ios_base::cur); // now that makes 6 istr >> c; // now that makes 7 - assert (7 == istr.tellg()); - assert (c == '7'); + assertTrue (7 == istr.tellg()); + assertTrue (c == '7'); istr.seekg(-7, std::ios_base::end); // so that puts us at 9-7=2 istr >> c; // now 3 - assert (3 == istr.tellg()); - assert (c == '3'); + assertTrue (3 == istr.tellg()); + assertTrue (c == '3'); istr.seekg(9, std::ios_base::beg); - assert (istr.good()); - assert (9 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (9 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -149,16 +149,16 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(0)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(0)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } istr.seekg(-9, std::ios_base::end); - assert (istr.good()); - assert (0 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (0 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -166,16 +166,16 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(0)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(0)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } istr.seekg(0, std::ios_base::beg); - assert (istr.good()); - assert (0 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (0 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -183,16 +183,16 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(0)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(0)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } istr.seekg(0, std::ios_base::end); - assert (istr.good()); - assert (9 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (9 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -200,19 +200,19 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(0)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(0)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } istr.seekg(3, std::ios_base::beg); - assert (istr.good()); - assert (3 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (3 == istr.tellg()); istr.seekg(6, std::ios_base::cur); - assert (istr.good()); - assert (9 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (9 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -221,19 +221,19 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(4)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(4)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } istr.seekg(-4, std::ios_base::end); - assert (istr.good()); - assert (5 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (5 == istr.tellg()); istr.seekg(4, std::ios_base::cur); - assert (istr.good()); - assert (9 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (9 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -242,19 +242,19 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(5)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(5)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } istr.seekg(4, std::ios_base::beg); - assert (istr.good()); - assert (4 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (4 == istr.tellg()); istr.seekg(-4, std::ios_base::cur); - assert (istr.good()); - assert (0 == istr.tellg()); + assertTrue (istr.good()); + assertTrue (0 == istr.tellg()); { Poco::MemoryInputStream istr2(buffer.begin(), buffer.size()); @@ -263,9 +263,9 @@ void MemoryStreamTest::testInputSeek() #ifdef __APPLE__ // workaround for clang libstdc++, which does not // set failbit if seek returns -1 - assert (istr2.fail() || istr2.tellg() == std::streampos(4)); + assertTrue (istr2.fail() || istr2.tellg() == std::streampos(4)); #else - assert (istr2.fail()); + assertTrue (istr2.fail()); #endif } } @@ -286,28 +286,28 @@ void MemoryStreamTest::testInputSeekVsStringStream() sss >> x; mis >> y; - assert (x == y); + assertTrue (x == y); sss.seekg(3, std::ios_base::beg); mis.seekg(3, std::ios_base::beg); sss >> x; mis >> y; - assert (x == y); - assert (sss.tellg() == mis.tellg()); + assertTrue (x == y); + assertTrue (sss.tellg() == mis.tellg()); sss.seekg(2, std::ios_base::cur); mis.seekg(2, std::ios_base::cur); sss >> x; mis >> y; - assert (x == y); - assert (sss.tellg() == mis.tellg()); + assertTrue (x == y); + assertTrue (sss.tellg() == mis.tellg()); sss.seekg(-7, std::ios_base::end); mis.seekg(-7, std::ios_base::end); sss >> x; mis >> y; - assert (x == y); - assert (sss.tellg() == mis.tellg()); + assertTrue (x == y); + assertTrue (sss.tellg() == mis.tellg()); } @@ -319,106 +319,106 @@ void MemoryStreamTest::testOutputSeek() ostr.seekp(4, std::ios_base::beg); // 4 from beginning ostr << 'a'; // and that makes 5 (zero index 4) - assert (5 == ostr.tellp()); - assert (buffer[4] == 'a'); + assertTrue (5 == ostr.tellp()); + assertTrue (buffer[4] == 'a'); ostr.seekp(2, std::ios_base::cur); // and this makes 7 ostr << 'b'; // and this makes 8 (zero index 7) - assert (8 == ostr.tellp()); - assert (buffer[7] == 'b'); + assertTrue (8 == ostr.tellp()); + assertTrue (buffer[7] == 'b'); ostr.seekp(-3, std::ios_base::end); // 9-3=6 from the beginning ostr << 'c'; // and this makes 7 (zero index 6) - assert (7 == ostr.tellp()); - assert (buffer[6] == 'c'); + assertTrue (7 == ostr.tellp()); + assertTrue (buffer[6] == 'c'); ostr.seekp(9, std::ios_base::beg); - assert (ostr.good()); - assert (9 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (9 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(10, std::ios_base::beg); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } ostr.seekp(-9, std::ios_base::end); - assert (ostr.good()); - assert (0 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (0 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(-10, std::ios_base::end); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } ostr.seekp(0, std::ios_base::beg); - assert (ostr.good()); - assert (0 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (0 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(-1, std::ios_base::beg); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } ostr.seekp(0, std::ios_base::end); - assert (ostr.good()); - assert (9 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (9 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(1, std::ios_base::end); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } ostr.seekp(3, std::ios_base::beg); - assert (ostr.good()); - assert (3 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (3 == ostr.tellp()); ostr.seekp(6, std::ios_base::cur); - assert (ostr.good()); - assert (9 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (9 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(4, std::ios_base::beg); ostr2.seekp(6, std::ios_base::cur); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } ostr.seekp(-4, std::ios_base::end); - assert (ostr.good()); - assert (5 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (5 == ostr.tellp()); ostr.seekp(4, std::ios_base::cur); - assert (ostr.good()); - assert (9 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (9 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(-4, std::ios_base::end); ostr2.seekp(5, std::ios_base::cur); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } ostr.seekp(4, std::ios_base::beg); - assert (ostr.good()); - assert (4 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (4 == ostr.tellp()); ostr.seekp(-4, std::ios_base::cur); - assert (ostr.good()); - assert (0 == ostr.tellp()); + assertTrue (ostr.good()); + assertTrue (0 == ostr.tellp()); { Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size()); ostr2.seekp(4, std::ios_base::beg); ostr2.seekp(-5, std::ios_base::cur); - assert (ostr2.fail()); + assertTrue (ostr2.fail()); } } @@ -436,33 +436,33 @@ void MemoryStreamTest::testOutputSeekVsStringStream() oss.seekp(4, std::ios_base::beg); mos << 'a'; oss << 'a'; - assert (oss.str()[4] == 'a'); - assert (buffer[4] == oss.str()[4]); - assert (oss.tellp() == mos.tellp()); + assertTrue (oss.str()[4] == 'a'); + assertTrue (buffer[4] == oss.str()[4]); + assertTrue (oss.tellp() == mos.tellp()); mos.seekp(2, std::ios_base::cur); oss.seekp(2, std::ios_base::cur); mos << 'b'; oss << 'b'; - assert (oss.str()[7] == 'b'); - assert (buffer[7] == oss.str()[7]); - assert (oss.tellp() == mos.tellp()); + assertTrue (oss.str()[7] == 'b'); + assertTrue (buffer[7] == oss.str()[7]); + assertTrue (oss.tellp() == mos.tellp()); mos.seekp(-3, std::ios_base::end); oss.seekp(-3, std::ios_base::end); mos << 'c'; oss << 'c'; - assert (oss.str()[6] == 'c'); - assert (buffer[6] == oss.str()[6]); - assert (oss.tellp() == mos.tellp()); + assertTrue (oss.str()[6] == 'c'); + assertTrue (buffer[6] == oss.str()[6]); + assertTrue (oss.tellp() == mos.tellp()); mos.seekp(-2, std::ios_base::cur); oss.seekp(-2, std::ios_base::cur); mos << 'd'; oss << 'd'; - assert (oss.str()[5] == 'd'); - assert (buffer[5] == oss.str()[5]); - assert (oss.tellp() == mos.tellp()); + assertTrue (oss.str()[5] == 'd'); + assertTrue (buffer[5] == oss.str()[5]); + assertTrue (oss.tellp() == mos.tellp()); } diff --git a/Foundation/testsuite/src/NDCTest.cpp b/Foundation/testsuite/src/NDCTest.cpp index ed80e5950..5891707d8 100644 --- a/Foundation/testsuite/src/NDCTest.cpp +++ b/Foundation/testsuite/src/NDCTest.cpp @@ -31,36 +31,36 @@ NDCTest::~NDCTest() void NDCTest::testNDC() { NDC ndc; - assert (ndc.depth() == 0); + assertTrue (ndc.depth() == 0); ndc.push("item1"); - assert (ndc.toString() == "item1"); - assert (ndc.depth() == 1); + assertTrue (ndc.toString() == "item1"); + assertTrue (ndc.depth() == 1); ndc.push("item2"); - assert (ndc.toString() == "item1:item2"); - assert (ndc.depth() == 2); + assertTrue (ndc.toString() == "item1:item2"); + assertTrue (ndc.depth() == 2); ndc.pop(); - assert (ndc.depth() == 1); - assert (ndc.toString() == "item1"); + assertTrue (ndc.depth() == 1); + assertTrue (ndc.toString() == "item1"); ndc.pop(); - assert (ndc.depth() == 0); + assertTrue (ndc.depth() == 0); } void NDCTest::testNDCScope() { poco_ndc("item1"); - assert (NDC::current().depth() == 1); + assertTrue (NDC::current().depth() == 1); { poco_ndc("item2"); - assert (NDC::current().depth() == 2); + assertTrue (NDC::current().depth() == 2); { poco_ndc("item3"); - assert (NDC::current().depth() == 3); + assertTrue (NDC::current().depth() == 3); NDC::current().dump(std::cout); } - assert (NDC::current().depth() == 2); + assertTrue (NDC::current().depth() == 2); } - assert (NDC::current().depth() == 1); + assertTrue (NDC::current().depth() == 1); } diff --git a/Foundation/testsuite/src/NamedEventTest.cpp b/Foundation/testsuite/src/NamedEventTest.cpp index 0748c05ac..b812bfa68 100644 --- a/Foundation/testsuite/src/NamedEventTest.cpp +++ b/Foundation/testsuite/src/NamedEventTest.cpp @@ -78,7 +78,7 @@ void NamedEventTest::testNamedEvent() } thr1.join(); #if POCO_OS != POCO_OS_ANDROID - assert (te.timestamp() > now); + assertTrue (te.timestamp() > now); #endif Thread thr2; thr2.start(te); @@ -96,7 +96,7 @@ void NamedEventTest::testNamedEvent() } thr2.join(); #if POCO_OS != POCO_OS_ANDROID - assert (te.timestamp() > now); + assertTrue (te.timestamp() > now); #endif } diff --git a/Foundation/testsuite/src/NamedMutexTest.cpp b/Foundation/testsuite/src/NamedMutexTest.cpp index 6c91f646b..772c87b4b 100644 --- a/Foundation/testsuite/src/NamedMutexTest.cpp +++ b/Foundation/testsuite/src/NamedMutexTest.cpp @@ -97,7 +97,7 @@ void NamedMutexTest::testLock() Thread::sleep(2000); testMutex.unlock(); thr.join(); - assert (tl.timestamp() > now); + assertTrue (tl.timestamp() > now); } catch(Poco::NotImplementedException e) { @@ -115,7 +115,7 @@ void NamedMutexTest::testTryLock() thr1.start(ttl1); thr1.join(); #if POCO_OS != POCO_OS_ANDROID - assert (ttl1.locked()); + assertTrue (ttl1.locked()); #endif try { @@ -125,7 +125,7 @@ void NamedMutexTest::testTryLock() thr2.start(ttl2); thr2.join(); testMutex.unlock(); - assert (!ttl2.locked()); + assertTrue (!ttl2.locked()); } catch(Poco::NotImplementedException e) { diff --git a/Foundation/testsuite/src/NamedTuplesTest.cpp b/Foundation/testsuite/src/NamedTuplesTest.cpp index 5c02ed17c..911484156 100644 --- a/Foundation/testsuite/src/NamedTuplesTest.cpp +++ b/Foundation/testsuite/src/NamedTuplesTest.cpp @@ -48,29 +48,29 @@ void NamedTuplesTest::testNamedTuple1() TupleType aTuple; - assert (aTuple["A"] == ""); + assertTrue (aTuple["A"] == ""); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 1); + assertTrue (aTuple.length == 1); TupleType aTuple2("string1", "1"); - assert (aTuple2["string1"] == "1"); + assertTrue (aTuple2["string1"] == "1"); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.set<0>("2"); - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3.length == 1); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3.length == 1); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -83,33 +83,33 @@ void NamedTuplesTest::testNamedTuple2() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 2); + assertTrue (aTuple.length == 2); TupleType aTuple2("string1", "1", "int1", 1); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3.length == 2); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3.length == 2); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -124,37 +124,37 @@ void NamedTuplesTest::testNamedTuple3() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 3); + assertTrue (aTuple.length == 3); TupleType aTuple2("string1", "1", "int1", 1, "bool1", true); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3.length == 3); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3.length == 3); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -170,39 +170,39 @@ void NamedTuplesTest::testNamedTuple4() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 4); + assertTrue (aTuple.length == 4); TupleType aTuple2("string1", "1", "int1", 1, "bool1", true, "float1", 1.5f); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3.length == 4); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3.length == 4); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -219,43 +219,43 @@ void NamedTuplesTest::testNamedTuple5() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 5); + assertTrue (aTuple.length == 5); TupleType aTuple2("string1", "1", "int1", 1, "bool1", true, "float1", 1.5f, "char1", 'c'); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3.length == 5); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3.length == 5); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -273,15 +273,15 @@ void NamedTuplesTest::testNamedTuple6() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 6); + assertTrue (aTuple.length == 6); TupleType aTuple2("string1", "1", "int1", 1, @@ -289,31 +289,31 @@ void NamedTuplesTest::testNamedTuple6() "float1", 1.5f, "char1", 'c', "long1", 999); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3.length == 6); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3.length == 6); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -332,15 +332,15 @@ void NamedTuplesTest::testNamedTuple7() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 7); + assertTrue (aTuple.length == 7); TupleType aTuple2("string1", "1", "int1", 1, @@ -349,32 +349,32 @@ void NamedTuplesTest::testNamedTuple7() "char1", 'c', "long1", 999, "double1", 1.5); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3.length == 7); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3.length == 7); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -394,16 +394,16 @@ void NamedTuplesTest::testNamedTuple8() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 8); + assertTrue (aTuple.length == 8); TupleType aTuple2("string1", "1", "int1", 1, @@ -413,34 +413,34 @@ void NamedTuplesTest::testNamedTuple8() "long1", 999, "double1", 1.5, "short1", 32700); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3.length == 8); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3.length == 8); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -462,17 +462,17 @@ void NamedTuplesTest::testNamedTuple9() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 9); + assertTrue (aTuple.length == 9); TupleType aTuple2("string1", "1", "int1", 1, @@ -483,36 +483,36 @@ void NamedTuplesTest::testNamedTuple9() "double1", 1.5, "short1", 32700, "string2", "2"); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3.length == 9); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3.length == 9); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -534,18 +534,18 @@ void NamedTuplesTest::testNamedTuple10() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 10); + assertTrue (aTuple.length == 10); TupleType aTuple2("string1", "1", "int1", 1, @@ -557,38 +557,38 @@ void NamedTuplesTest::testNamedTuple10() "short1", 32700, "string2", "2", "int2", 2 ); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3.length == 10); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3.length == 10); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -611,19 +611,19 @@ void NamedTuplesTest::testNamedTuple11() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 11); + assertTrue (aTuple.length == 11); TupleType aTuple2("string1", "1", "int1", 1, @@ -636,40 +636,40 @@ void NamedTuplesTest::testNamedTuple11() "string2", "2", "int2", 2, "string3", "3"); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3.length == 11); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3.length == 11); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -693,20 +693,20 @@ void NamedTuplesTest::testNamedTuple12() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 12); + assertTrue (aTuple.length == 12); TupleType aTuple2("string1", "1", "int1", 1, @@ -720,41 +720,41 @@ void NamedTuplesTest::testNamedTuple12() "int2", 2, "string3", "3", "int3", 3); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3.length == 12); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3.length == 12); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -779,21 +779,21 @@ void NamedTuplesTest::testNamedTuple13() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 13); + assertTrue (aTuple.length == 13); TupleType aTuple2("string1", "1", "int1", 1, @@ -808,42 +808,42 @@ void NamedTuplesTest::testNamedTuple13() "string3", "3", "int3", 3, "bool2", true); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3.length == 13); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3.length == 13); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -869,21 +869,21 @@ void NamedTuplesTest::testNamedTuple14() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 14); + assertTrue (aTuple.length == 14); TupleType aTuple2("string1", "1", "int1", 1, @@ -899,44 +899,44 @@ void NamedTuplesTest::testNamedTuple14() "int3", 3, "bool2", true, "float2", 2.5); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3.length == 14); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3.length == 14); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -963,21 +963,21 @@ void NamedTuplesTest::testNamedTuple15() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 15); + assertTrue (aTuple.length == 15); TupleType aTuple2("string1", "1", "int1", 1, @@ -994,46 +994,46 @@ void NamedTuplesTest::testNamedTuple15() "bool2", true, "float2", 2.5, "char2", 'c'); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["char2"] == 'c'); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["char2"] == 'c'); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3["bool2"] == false); - assert (aTuple3.length == 15); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3["bool2"] == false); + assertTrue (aTuple3.length == 15); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -1061,22 +1061,22 @@ void NamedTuplesTest::testNamedTuple16() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); - assert (aTuple["O"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); + assertTrue (aTuple["O"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 16); + assertTrue (aTuple.length == 16); TupleType aTuple2("string1", "1", "int1", 1, @@ -1094,49 +1094,49 @@ void NamedTuplesTest::testNamedTuple16() "float2", 2.5, "char2", 'c', "long2", 999); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["char2"] == 'c'); - assert (aTuple2["long2"] == 999); - assert (aTuple2.length == 16); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["char2"] == 'c'); + assertTrue (aTuple2["long2"] == 999); + assertTrue (aTuple2.length == 16); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3["bool2"] == false); - assert (aTuple3["char2"] == 0); - assert (aTuple3.length == 16); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3["bool2"] == false); + assertTrue (aTuple3["char2"] == 0); + assertTrue (aTuple3.length == 16); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -1165,23 +1165,23 @@ void NamedTuplesTest::testNamedTuple17() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); - assert (aTuple["O"] == 0); - assert (aTuple["P"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); + assertTrue (aTuple["O"] == 0); + assertTrue (aTuple["P"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 17); + assertTrue (aTuple.length == 17); TupleType aTuple2("string1", "1", "int1", 1, @@ -1200,51 +1200,51 @@ void NamedTuplesTest::testNamedTuple17() "char2", 'c', "long2", 999, "double2", 2.5); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["char2"] == 'c'); - assert (aTuple2["long2"] == 999); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2.length == 17); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["char2"] == 'c'); + assertTrue (aTuple2["long2"] == 999); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2.length == 17); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3["bool2"] == false); - assert (aTuple3["char2"] == 0); - assert (aTuple3["long2"] == 0); - assert (aTuple3.length == 17); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3["bool2"] == false); + assertTrue (aTuple3["char2"] == 0); + assertTrue (aTuple3["long2"] == 0); + assertTrue (aTuple3.length == 17); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -1274,24 +1274,24 @@ void NamedTuplesTest::testNamedTuple18() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); - assert (aTuple["O"] == 0); - assert (aTuple["P"] == 0); - assert (aTuple["R"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); + assertTrue (aTuple["O"] == 0); + assertTrue (aTuple["P"] == 0); + assertTrue (aTuple["R"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 18); + assertTrue (aTuple.length == 18); TupleType aTuple2("string1", "1", "int1", 1, @@ -1311,53 +1311,53 @@ void NamedTuplesTest::testNamedTuple18() "long2", 999, "double2", 2.5, "short2", 32700); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["char2"] == 'c'); - assert (aTuple2["long2"] == 999); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["short2"] == 32700); - assert (aTuple2.length == 18); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["char2"] == 'c'); + assertTrue (aTuple2["long2"] == 999); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["short2"] == 32700); + assertTrue (aTuple2.length == 18); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3["bool2"] == false); - assert (aTuple3["char2"] == 0); - assert (aTuple3["long2"] == 0); - assert (aTuple3["short2"] == 0); - assert (aTuple3.length == 18); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3["bool2"] == false); + assertTrue (aTuple3["char2"] == 0); + assertTrue (aTuple3["long2"] == 0); + assertTrue (aTuple3["short2"] == 0); + assertTrue (aTuple3.length == 18); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -1388,25 +1388,25 @@ void NamedTuplesTest::testNamedTuple19() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); - assert (aTuple["O"] == 0); - assert (aTuple["P"] == 0); - assert (aTuple["R"] == 0); - assert (aTuple["S"] == ""); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); + assertTrue (aTuple["O"] == 0); + assertTrue (aTuple["P"] == 0); + assertTrue (aTuple["R"] == 0); + assertTrue (aTuple["S"] == ""); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 19); + assertTrue (aTuple.length == 19); TupleType aTuple2("string1", "1", "int1", 1, @@ -1427,55 +1427,55 @@ void NamedTuplesTest::testNamedTuple19() "double2", 2.5, "short2", 32700, "string4", "4"); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["char2"] == 'c'); - assert (aTuple2["long2"] == 999); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["short2"] == 32700); - assert (aTuple2["string4"] == "4"); - assert (aTuple2.length == 19); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["char2"] == 'c'); + assertTrue (aTuple2["long2"] == 999); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["short2"] == 32700); + assertTrue (aTuple2["string4"] == "4"); + assertTrue (aTuple2.length == 19); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3["bool2"] == false); - assert (aTuple3["char2"] == 0); - assert (aTuple3["long2"] == 0); - assert (aTuple3["short2"] == 0); - assert (aTuple3["string4"] == ""); - assert (aTuple3.length == 19); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3["bool2"] == false); + assertTrue (aTuple3["char2"] == 0); + assertTrue (aTuple3["long2"] == 0); + assertTrue (aTuple3["short2"] == 0); + assertTrue (aTuple3["string4"] == ""); + assertTrue (aTuple3.length == 19); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } @@ -1507,25 +1507,25 @@ void NamedTuplesTest::testNamedTuple20() TupleType aTuple; - assert (aTuple["A"] == ""); - assert (aTuple["B"] == 0); - assert (aTuple["C"] == false); - assert (aTuple["E"] == 0); - assert (aTuple["F"] == 0); - assert (aTuple["H"] == 0); - assert (aTuple["I"] == ""); - assert (aTuple["J"] == 0); - assert (aTuple["K"] == ""); - assert (aTuple["L"] == 0); - assert (aTuple["M"] == false); - assert (aTuple["O"] == 0); - assert (aTuple["P"] == 0); - assert (aTuple["R"] == 0); - assert (aTuple["S"] == ""); - assert (aTuple["T"] == 0); + assertTrue (aTuple["A"] == ""); + assertTrue (aTuple["B"] == 0); + assertTrue (aTuple["C"] == false); + assertTrue (aTuple["E"] == 0); + assertTrue (aTuple["F"] == 0); + assertTrue (aTuple["H"] == 0); + assertTrue (aTuple["I"] == ""); + assertTrue (aTuple["J"] == 0); + assertTrue (aTuple["K"] == ""); + assertTrue (aTuple["L"] == 0); + assertTrue (aTuple["M"] == false); + assertTrue (aTuple["O"] == 0); + assertTrue (aTuple["P"] == 0); + assertTrue (aTuple["R"] == 0); + assertTrue (aTuple["S"] == ""); + assertTrue (aTuple["T"] == 0); try { int POCO_UNUSED xyz; xyz = aTuple["XYZ"]; fail ("must fail"); } catch (NotFoundException&) { } - assert (aTuple.length == 20); + assertTrue (aTuple.length == 20); TupleType aTuple2("string1", "1", "int1", 1, @@ -1547,57 +1547,57 @@ void NamedTuplesTest::testNamedTuple20() "short2", 32700, "string4", "4", "int4", 4); - assert (aTuple2["string1"] == "1"); - assert (aTuple2["int1"] == 1); - assert (aTuple2["bool1"] == true); - assert (aTuple2["float1"] == 1.5); - assert (aTuple2["char1"] == 'c'); - assert (aTuple2["long1"] == 999); - assert (aTuple2["double1"] == 1.5); - assert (aTuple2["short1"] == 32700); - assert (aTuple2["string2"] == "2"); - assert (aTuple2["int2"] == 2); - assert (aTuple2["string3"] == "3"); - assert (aTuple2["int3"] == 3); - assert (aTuple2["bool2"] == true); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["char2"] == 'c'); - assert (aTuple2["long2"] == 999); - assert (aTuple2["float2"] == 2.5); - assert (aTuple2["short2"] == 32700); - assert (aTuple2["string4"] == "4"); - assert (aTuple2["int4"] == 4); - assert (aTuple2.length == 20); + assertTrue (aTuple2["string1"] == "1"); + assertTrue (aTuple2["int1"] == 1); + assertTrue (aTuple2["bool1"] == true); + assertTrue (aTuple2["float1"] == 1.5); + assertTrue (aTuple2["char1"] == 'c'); + assertTrue (aTuple2["long1"] == 999); + assertTrue (aTuple2["double1"] == 1.5); + assertTrue (aTuple2["short1"] == 32700); + assertTrue (aTuple2["string2"] == "2"); + assertTrue (aTuple2["int2"] == 2); + assertTrue (aTuple2["string3"] == "3"); + assertTrue (aTuple2["int3"] == 3); + assertTrue (aTuple2["bool2"] == true); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["char2"] == 'c'); + assertTrue (aTuple2["long2"] == 999); + assertTrue (aTuple2["float2"] == 2.5); + assertTrue (aTuple2["short2"] == 32700); + assertTrue (aTuple2["string4"] == "4"); + assertTrue (aTuple2["int4"] == 4); + assertTrue (aTuple2.length == 20); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3(aTuple2.names()); - assert (aTuple3.names() == aTuple2.names()); - assert (aTuple3["string1"] == ""); - assert (aTuple3["int1"] == 0); - assert (aTuple3["bool1"] == false); - assert (aTuple3["char1"] == 0); - assert (aTuple3["long1"] == 0); - assert (aTuple3["short1"] == 0); - assert (aTuple3["string2"] == ""); - assert (aTuple3["int2"] == 0); - assert (aTuple3["string3"] == ""); - assert (aTuple3["int3"] == 0); - assert (aTuple3["bool2"] == false); - assert (aTuple3["char2"] == 0); - assert (aTuple3["long2"] == 0); - assert (aTuple3["short2"] == 0); - assert (aTuple3["string4"] == ""); - assert (aTuple3["int4"] == 0); - assert (aTuple3.length == 20); + assertTrue (aTuple3.names() == aTuple2.names()); + assertTrue (aTuple3["string1"] == ""); + assertTrue (aTuple3["int1"] == 0); + assertTrue (aTuple3["bool1"] == false); + assertTrue (aTuple3["char1"] == 0); + assertTrue (aTuple3["long1"] == 0); + assertTrue (aTuple3["short1"] == 0); + assertTrue (aTuple3["string2"] == ""); + assertTrue (aTuple3["int2"] == 0); + assertTrue (aTuple3["string3"] == ""); + assertTrue (aTuple3["int3"] == 0); + assertTrue (aTuple3["bool2"] == false); + assertTrue (aTuple3["char2"] == 0); + assertTrue (aTuple3["long2"] == 0); + assertTrue (aTuple3["short2"] == 0); + assertTrue (aTuple3["string4"] == ""); + assertTrue (aTuple3["int4"] == 0); + assertTrue (aTuple3.length == 20); - assert (aTuple.getName(0) == "string1"); + assertTrue (aTuple.getName(0) == "string1"); aTuple.setName(0, "New Name"); - assert (aTuple.getName(0) == "New Name"); + assertTrue (aTuple.getName(0) == "New Name"); try { aTuple.setName(20, ""); fail("must fail"); } catch (InvalidArgumentException&) { } diff --git a/Foundation/testsuite/src/NotificationCenterTest.cpp b/Foundation/testsuite/src/NotificationCenterTest.cpp index 778c3c832..9e22b1943 100644 --- a/Foundation/testsuite/src/NotificationCenterTest.cpp +++ b/Foundation/testsuite/src/NotificationCenterTest.cpp @@ -51,16 +51,16 @@ void NotificationCenterTest::test2() NotificationCenter nc; Observer o(*this, &NotificationCenterTest::handle1); nc.addObserver(o); - assert (nc.hasObserver(o)); - assert (nc.hasObservers()); - assert (nc.countObservers() == 1); + assertTrue (nc.hasObserver(o)); + assertTrue (nc.hasObservers()); + assertTrue (nc.countObservers() == 1); nc.postNotification(new Notification); - assert (_set.size() == 1); - assert (_set.find("handle1") != _set.end()); + assertTrue (_set.size() == 1); + assertTrue (_set.find("handle1") != _set.end()); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle1)); - assert (!nc.hasObserver(o)); - assert (!nc.hasObservers()); - assert (nc.countObservers() == 0); + assertTrue (!nc.hasObserver(o)); + assertTrue (!nc.hasObservers()); + assertTrue (nc.countObservers() == 0); } @@ -70,21 +70,21 @@ void NotificationCenterTest::test3() Observer o1(*this, &NotificationCenterTest::handle1); Observer o2(*this, &NotificationCenterTest::handle2); nc.addObserver(o1); - assert (nc.hasObserver(o1)); + assertTrue (nc.hasObserver(o1)); nc.addObserver(o2); - assert (nc.hasObserver(o2)); - assert (nc.hasObservers()); - assert (nc.countObservers() == 2); + assertTrue (nc.hasObserver(o2)); + assertTrue (nc.hasObservers()); + assertTrue (nc.countObservers() == 2); nc.postNotification(new Notification); - assert (_set.size() == 2); - assert (_set.find("handle1") != _set.end()); - assert (_set.find("handle2") != _set.end()); + assertTrue (_set.size() == 2); + assertTrue (_set.find("handle1") != _set.end()); + assertTrue (_set.find("handle2") != _set.end()); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle1)); - assert (!nc.hasObserver(o1)); + assertTrue (!nc.hasObserver(o1)); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle2)); - assert (!nc.hasObserver(o2)); - assert (!nc.hasObservers()); - assert (nc.countObservers() == 0); + assertTrue (!nc.hasObserver(o2)); + assertTrue (!nc.hasObservers()); + assertTrue (nc.countObservers() == 0); } @@ -94,28 +94,28 @@ void NotificationCenterTest::test4() Observer o1(*this, &NotificationCenterTest::handle1); Observer o2(*this, &NotificationCenterTest::handle2); nc.addObserver(o1); - assert (nc.hasObserver(o1)); + assertTrue (nc.hasObserver(o1)); nc.addObserver(o2); - assert (nc.hasObserver(o2)); + assertTrue (nc.hasObserver(o2)); nc.postNotification(new Notification); - assert (_set.size() == 2); - assert (_set.find("handle1") != _set.end()); - assert (_set.find("handle2") != _set.end()); + assertTrue (_set.size() == 2); + assertTrue (_set.find("handle1") != _set.end()); + assertTrue (_set.find("handle2") != _set.end()); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle1)); - assert (!nc.hasObserver(o1)); + assertTrue (!nc.hasObserver(o1)); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle2)); - assert (!nc.hasObserver(o2)); + assertTrue (!nc.hasObserver(o2)); _set.clear(); nc.postNotification(new Notification); - assert (_set.empty()); + assertTrue (_set.empty()); Observer o3(*this, &NotificationCenterTest::handle3); nc.addObserver(o3); - assert (nc.hasObserver(o3)); + assertTrue (nc.hasObserver(o3)); nc.postNotification(new Notification); - assert (_set.size() == 1); - assert (_set.find("handle3") != _set.end()); + assertTrue (_set.size() == 1); + assertTrue (_set.find("handle3") != _set.end()); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle3)); - assert (!nc.hasObserver(o3)); + assertTrue (!nc.hasObserver(o3)); } @@ -125,13 +125,13 @@ void NotificationCenterTest::test5() nc.addObserver(Observer(*this, &NotificationCenterTest::handle1)); nc.addObserver(Observer(*this, &NotificationCenterTest::handleTest)); nc.postNotification(new Notification); - assert (_set.size() == 1); - assert (_set.find("handle1") != _set.end()); + assertTrue (_set.size() == 1); + assertTrue (_set.find("handle1") != _set.end()); _set.clear(); nc.postNotification(new TestNotification); - assert (_set.size() == 2); - assert (_set.find("handle1") != _set.end()); - assert (_set.find("handleTest") != _set.end()); + assertTrue (_set.size() == 2); + assertTrue (_set.find("handle1") != _set.end()); + assertTrue (_set.find("handleTest") != _set.end()); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle1)); nc.removeObserver(Observer(*this, &NotificationCenterTest::handleTest)); } @@ -142,8 +142,8 @@ void NotificationCenterTest::testAuto() NotificationCenter nc; nc.addObserver(NObserver(*this, &NotificationCenterTest::handleAuto)); nc.postNotification(new Notification); - assert (_set.size() == 1); - assert (_set.find("handleAuto") != _set.end()); + assertTrue (_set.size() == 1); + assertTrue (_set.find("handleAuto") != _set.end()); nc.removeObserver(NObserver(*this, &NotificationCenterTest::handleAuto)); } @@ -153,8 +153,8 @@ void NotificationCenterTest::testDefaultCenter() NotificationCenter& nc = NotificationCenter::defaultCenter(); nc.addObserver(Observer(*this, &NotificationCenterTest::handle1)); nc.postNotification(new Notification); - assert (_set.size() == 1); - assert (_set.find("handle1") != _set.end()); + assertTrue (_set.size() == 1); + assertTrue (_set.find("handle1") != _set.end()); nc.removeObserver(Observer(*this, &NotificationCenterTest::handle1)); } diff --git a/Foundation/testsuite/src/NotificationQueueTest.cpp b/Foundation/testsuite/src/NotificationQueueTest.cpp index 51c7671f8..db7a99ba6 100644 --- a/Foundation/testsuite/src/NotificationQueueTest.cpp +++ b/Foundation/testsuite/src/NotificationQueueTest.cpp @@ -60,35 +60,35 @@ NotificationQueueTest::~NotificationQueueTest() void NotificationQueueTest::testQueueDequeue() { NotificationQueue queue; - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); Notification* pNf = queue.dequeueNotification(); assertNullPtr(pNf); queue.enqueueNotification(new Notification); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pNf = queue.dequeueNotification(); assertNotNullPtr(pNf); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); pNf->release(); queue.enqueueNotification(new QTestNotification("first")); queue.enqueueNotification(new QTestNotification("second")); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); QTestNotification* pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "first"); + assertTrue (pTNf->data() == "first"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "second"); + assertTrue (pTNf->data() == "second"); pTNf->release(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); pNf = queue.dequeueNotification(); assertNullPtr(pNf); @@ -101,25 +101,25 @@ void NotificationQueueTest::testQueueDequeueUrgent() queue.enqueueNotification(new QTestNotification("first")); queue.enqueueNotification(new QTestNotification("second")); queue.enqueueUrgentNotification(new QTestNotification("third")); - assert (!queue.empty()); - assert (queue.size() == 3); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 3); QTestNotification* pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); pTNf = dynamic_cast(queue.dequeueNotification()); - assert (pTNf->data() == "first"); + assertTrue (pTNf->data() == "first"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "second"); + assertTrue (pTNf->data() == "second"); pTNf->release(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); Notification* pNf = queue.dequeueNotification(); assertNullPtr(pNf); @@ -131,20 +131,20 @@ void NotificationQueueTest::testWaitDequeue() NotificationQueue queue; queue.enqueueNotification(new QTestNotification("third")); queue.enqueueNotification(new QTestNotification("fourth")); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); QTestNotification* pTNf = dynamic_cast(queue.waitDequeueNotification(10)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.waitDequeueNotification(10)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "fourth"); + assertTrue (pTNf->data() == "fourth"); pTNf->release(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); Notification* pNf = queue.waitDequeueNotification(10); assertNullPtr(pNf); @@ -173,18 +173,18 @@ void NotificationQueueTest::testThreads() t1.join(); t2.join(); t3.join(); - assert (_handled.size() == NOTIFICATION_COUNT); - assert (_handled.count("thread1") > 0); - assert (_handled.count("thread2") > 0); - assert (_handled.count("thread3") > 0); + assertTrue (_handled.size() == NOTIFICATION_COUNT); + assertTrue (_handled.count("thread1") > 0); + assertTrue (_handled.count("thread2") > 0); + assertTrue (_handled.count("thread3") > 0); } void NotificationQueueTest::testDefaultQueue() { NotificationQueue& queue = NotificationQueue::defaultQueue(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); } diff --git a/Foundation/testsuite/src/NullStreamTest.cpp b/Foundation/testsuite/src/NullStreamTest.cpp index c86835704..f8471cefc 100644 --- a/Foundation/testsuite/src/NullStreamTest.cpp +++ b/Foundation/testsuite/src/NullStreamTest.cpp @@ -31,20 +31,20 @@ NullStreamTest::~NullStreamTest() void NullStreamTest::testInput() { NullInputStream istr; - assert (istr.good()); - assert (!istr.eof()); + assertTrue (istr.good()); + assertTrue (!istr.eof()); int c = istr.get(); - assert (c == -1); - assert (istr.eof()); + assertTrue (c == -1); + assertTrue (istr.eof()); } void NullStreamTest::testOutput() { NullOutputStream ostr; - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!"; - assert (ostr.good()); + assertTrue (ostr.good()); } diff --git a/Foundation/testsuite/src/NumberFormatterTest.cpp b/Foundation/testsuite/src/NumberFormatterTest.cpp index 50972c8dd..127c2373c 100644 --- a/Foundation/testsuite/src/NumberFormatterTest.cpp +++ b/Foundation/testsuite/src/NumberFormatterTest.cpp @@ -32,69 +32,69 @@ NumberFormatterTest::~NumberFormatterTest() void NumberFormatterTest::testFormat() { - assert (NumberFormatter::format(123) == "123"); - assert (NumberFormatter::format(-123) == "-123"); - assert (NumberFormatter::format(-123, 5) == " -123"); + assertTrue (NumberFormatter::format(123) == "123"); + assertTrue (NumberFormatter::format(-123) == "-123"); + assertTrue (NumberFormatter::format(-123, 5) == " -123"); - assert (NumberFormatter::format((unsigned) 123) == "123"); - assert (NumberFormatter::format((unsigned) 123, 5) == " 123"); - assert (NumberFormatter::format0((unsigned) 123, 5) == "00123"); + assertTrue (NumberFormatter::format((unsigned) 123) == "123"); + assertTrue (NumberFormatter::format((unsigned) 123, 5) == " 123"); + assertTrue (NumberFormatter::format0((unsigned) 123, 5) == "00123"); - assert (NumberFormatter::format((long) 123) == "123"); - assert (NumberFormatter::format((long) -123) == "-123"); - assert (NumberFormatter::format((long) -123, 5) == " -123"); + assertTrue (NumberFormatter::format((long) 123) == "123"); + assertTrue (NumberFormatter::format((long) -123) == "-123"); + assertTrue (NumberFormatter::format((long) -123, 5) == " -123"); - assert (NumberFormatter::format((unsigned long) 123) == "123"); - assert (NumberFormatter::format((unsigned long) 123, 5) == " 123"); + assertTrue (NumberFormatter::format((unsigned long) 123) == "123"); + assertTrue (NumberFormatter::format((unsigned long) 123, 5) == " 123"); - assert (NumberFormatter::format(123) == "123"); - assert (NumberFormatter::format(-123) == "-123"); - assert (NumberFormatter::format(-123, 5) == " -123"); + assertTrue (NumberFormatter::format(123) == "123"); + assertTrue (NumberFormatter::format(-123) == "-123"); + assertTrue (NumberFormatter::format(-123, 5) == " -123"); #if defined(POCO_HAVE_INT64) - assert (NumberFormatter::format((Int64) 123) == "123"); - assert (NumberFormatter::format((Int64) -123) == "-123"); - assert (NumberFormatter::format((Int64) -123, 5) == " -123"); + assertTrue (NumberFormatter::format((Int64) 123) == "123"); + assertTrue (NumberFormatter::format((Int64) -123) == "-123"); + assertTrue (NumberFormatter::format((Int64) -123, 5) == " -123"); - assert (NumberFormatter::format((UInt64) 123) == "123"); - assert (NumberFormatter::format((UInt64) 123, 5) == " 123"); + assertTrue (NumberFormatter::format((UInt64) 123) == "123"); + assertTrue (NumberFormatter::format((UInt64) 123, 5) == " 123"); #if defined(POCO_LONG_IS_64_BIT) - assert (NumberFormatter::format((long long) 123) == "123"); - assert (NumberFormatter::format((long long) -123) == "-123"); - assert (NumberFormatter::format((long long) -123, 5) == " -123"); + assertTrue (NumberFormatter::format((long long) 123) == "123"); + assertTrue (NumberFormatter::format((long long) -123) == "-123"); + assertTrue (NumberFormatter::format((long long) -123, 5) == " -123"); - assert (NumberFormatter::format((unsigned long long) 123) == "123"); - assert (NumberFormatter::format((unsigned long long) 123, 5) == " 123"); + assertTrue (NumberFormatter::format((unsigned long long) 123) == "123"); + assertTrue (NumberFormatter::format((unsigned long long) 123, 5) == " 123"); #endif #endif if (sizeof(void*) == 4) { - assert (NumberFormatter::format((void*) 0x12345678) == "12345678"); + assertTrue (NumberFormatter::format((void*) 0x12345678) == "12345678"); } else { - assert (NumberFormatter::format((void*) 0x12345678) == "0000000012345678"); + assertTrue (NumberFormatter::format((void*) 0x12345678) == "0000000012345678"); } } void NumberFormatterTest::testFormat0() { - assert (NumberFormatter::format0(123, 5) == "00123"); - assert (NumberFormatter::format0(-123, 5) == "-0123"); - assert (NumberFormatter::format0((long) 123, 5) == "00123"); - assert (NumberFormatter::format0((long) -123, 5) == "-0123"); - assert (NumberFormatter::format0((unsigned long) 123, 5) == "00123"); + assertTrue (NumberFormatter::format0(123, 5) == "00123"); + assertTrue (NumberFormatter::format0(-123, 5) == "-0123"); + assertTrue (NumberFormatter::format0((long) 123, 5) == "00123"); + assertTrue (NumberFormatter::format0((long) -123, 5) == "-0123"); + assertTrue (NumberFormatter::format0((unsigned long) 123, 5) == "00123"); #if defined(POCO_HAVE_INT64) - assert (NumberFormatter::format0((Int64) 123, 5) == "00123"); - assert (NumberFormatter::format0((Int64) -123, 5) == "-0123"); - assert (NumberFormatter::format0((UInt64) 123, 5) == "00123"); + assertTrue (NumberFormatter::format0((Int64) 123, 5) == "00123"); + assertTrue (NumberFormatter::format0((Int64) -123, 5) == "-0123"); + assertTrue (NumberFormatter::format0((UInt64) 123, 5) == "00123"); #if defined(POCO_LONG_IS_64_BIT) - assert (NumberFormatter::format0((long long) 123, 5) == "00123"); - assert (NumberFormatter::format0((long long) -123, 5) == "-0123"); - assert (NumberFormatter::format0((unsigned long long) 123, 5) == "00123"); + assertTrue (NumberFormatter::format0((long long) 123, 5) == "00123"); + assertTrue (NumberFormatter::format0((long long) -123, 5) == "-0123"); + assertTrue (NumberFormatter::format0((unsigned long long) 123, 5) == "00123"); #endif #endif } @@ -102,116 +102,116 @@ void NumberFormatterTest::testFormat0() void NumberFormatterTest::testFormatBool() { - assert(NumberFormatter::format(true, NumberFormatter::FMT_TRUE_FALSE) == "true"); - assert(NumberFormatter::format(false, NumberFormatter::FMT_TRUE_FALSE) == "false"); - assert(NumberFormatter::format(true, NumberFormatter::FMT_YES_NO) == "yes"); - assert(NumberFormatter::format(false, NumberFormatter::FMT_YES_NO) == "no"); - assert(NumberFormatter::format(true, NumberFormatter::FMT_ON_OFF) == "on"); - assert(NumberFormatter::format(false, NumberFormatter::FMT_ON_OFF) == "off"); + assertTrue (NumberFormatter::format(true, NumberFormatter::FMT_TRUE_FALSE) == "true"); + assertTrue (NumberFormatter::format(false, NumberFormatter::FMT_TRUE_FALSE) == "false"); + assertTrue (NumberFormatter::format(true, NumberFormatter::FMT_YES_NO) == "yes"); + assertTrue (NumberFormatter::format(false, NumberFormatter::FMT_YES_NO) == "no"); + assertTrue (NumberFormatter::format(true, NumberFormatter::FMT_ON_OFF) == "on"); + assertTrue (NumberFormatter::format(false, NumberFormatter::FMT_ON_OFF) == "off"); } void NumberFormatterTest::testFormatHex() { - assert (NumberFormatter::formatHex(0x12) == "12"); - assert (NumberFormatter::formatHex(0xab) == "AB"); - assert (NumberFormatter::formatHex(0x12, 4) == "0012"); - assert (NumberFormatter::formatHex(0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex(0x12) == "12"); + assertTrue (NumberFormatter::formatHex(0xab) == "AB"); + assertTrue (NumberFormatter::formatHex(0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex(0xab, 4) == "00AB"); - assert (NumberFormatter::formatHex((unsigned) 0x12) == "12"); - assert (NumberFormatter::formatHex((unsigned) 0xab) == "AB"); - assert (NumberFormatter::formatHex((unsigned) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((unsigned) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((unsigned) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((unsigned) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((unsigned) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((unsigned) 0xab, 4) == "00AB"); - assert (NumberFormatter::formatHex((long) 0x12) == "12"); - assert (NumberFormatter::formatHex((long) 0xab) == "AB"); - assert (NumberFormatter::formatHex((long) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((long) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((long) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((long) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((long) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((long) 0xab, 4) == "00AB"); - assert (NumberFormatter::formatHex((unsigned long) 0x12) == "12"); - assert (NumberFormatter::formatHex((unsigned long) 0xab) == "AB"); - assert (NumberFormatter::formatHex((unsigned long) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((unsigned long) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0xab, 4) == "00AB"); #if defined(POCO_HAVE_INT64) - assert (NumberFormatter::formatHex((Int64) 0x12) == "12"); - assert (NumberFormatter::formatHex((Int64) 0xab) == "AB"); - assert (NumberFormatter::formatHex((Int64) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((Int64) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((Int64) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((Int64) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((Int64) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((Int64) 0xab, 4) == "00AB"); - assert (NumberFormatter::formatHex((UInt64) 0x12) == "12"); - assert (NumberFormatter::formatHex((UInt64) 0xab) == "AB"); - assert (NumberFormatter::formatHex((UInt64) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((UInt64) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((UInt64) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((UInt64) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((UInt64) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((UInt64) 0xab, 4) == "00AB"); #if defined(POCO_LONG_IS_64_BIT) - assert (NumberFormatter::formatHex((long long) 0x12) == "12"); - assert (NumberFormatter::formatHex((long long) 0xab) == "AB"); - assert (NumberFormatter::formatHex((long long) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((long long) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((long long) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((long long) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((long long) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((long long) 0xab, 4) == "00AB"); - assert (NumberFormatter::formatHex((unsigned long long) 0x12) == "12"); - assert (NumberFormatter::formatHex((unsigned long long) 0xab) == "AB"); - assert (NumberFormatter::formatHex((unsigned long long) 0x12, 4) == "0012"); - assert (NumberFormatter::formatHex((unsigned long long) 0xab, 4) == "00AB"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0x12) == "12"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0xab) == "AB"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0x12, 4) == "0012"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0xab, 4) == "00AB"); #endif #endif - assert (NumberFormatter::formatHex(0x12, true) == "0x12"); - assert (NumberFormatter::formatHex(0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex(0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex(0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex(0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex(0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex(0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex(0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex(0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex(0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex(0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex(0xab, 6, true) == "0x00AB"); - assert (NumberFormatter::formatHex((unsigned) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((unsigned) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((unsigned) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((unsigned) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((unsigned) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((unsigned) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((unsigned) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((unsigned) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((unsigned) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((unsigned) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((unsigned) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((unsigned) 0xab, 6, true) == "0x00AB"); - assert (NumberFormatter::formatHex((long) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((long) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((long) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((long) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((long) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((long) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((long) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((long) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((long) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((long) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((long) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((long) 0xab, 6, true) == "0x00AB"); - assert (NumberFormatter::formatHex((unsigned long) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((unsigned long) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((unsigned long) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((unsigned long) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((unsigned long) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((unsigned long) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((unsigned long) 0xab, 6, true) == "0x00AB"); #if defined(POCO_HAVE_INT64) - assert (NumberFormatter::formatHex((Int64) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((Int64) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((Int64) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((Int64) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((Int64) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((Int64) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((Int64) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((Int64) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((Int64) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((Int64) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((Int64) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((Int64) 0xab, 6, true) == "0x00AB"); - assert (NumberFormatter::formatHex((UInt64) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((UInt64) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((UInt64) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((UInt64) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((UInt64) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((UInt64) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((UInt64) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((UInt64) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((UInt64) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((UInt64) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((UInt64) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((UInt64) 0xab, 6, true) == "0x00AB"); #if defined(POCO_LONG_IS_64_BIT) - assert (NumberFormatter::formatHex((long long) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((long long) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((long long) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((long long) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((long long) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((long long) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((long long) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((long long) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((long long) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((long long) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((long long) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((long long) 0xab, 6, true) == "0x00AB"); - assert (NumberFormatter::formatHex((unsigned long long) 0x12, true) == "0x12"); - assert (NumberFormatter::formatHex((unsigned long long) 0xab, true) == "0xAB"); - assert (NumberFormatter::formatHex((unsigned long long) 0x12, 4, true) == "0x12"); - assert (NumberFormatter::formatHex((unsigned long long) 0xab, 4, true) == "0xAB"); - assert (NumberFormatter::formatHex((unsigned long long) 0x12, 6, true) == "0x0012"); - assert (NumberFormatter::formatHex((unsigned long long) 0xab, 6, true) == "0x00AB"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0x12, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0xab, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0x12, 4, true) == "0x12"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0xab, 4, true) == "0xAB"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0x12, 6, true) == "0x0012"); + assertTrue (NumberFormatter::formatHex((unsigned long long) 0xab, 6, true) == "0x00AB"); #endif #endif } @@ -219,50 +219,50 @@ void NumberFormatterTest::testFormatHex() void NumberFormatterTest::testFormatFloat() { - assert (NumberFormatter::format(1.0f) == "1"); - assert (NumberFormatter::format(1.23f) == "1.23"); - assert (NumberFormatter::format(-1.23f) == "-1.23"); - assert (NumberFormatter::format(0.1f) == "0.1"); - assert (NumberFormatter::format(-0.1f) == "-0.1"); - assert (NumberFormatter::format(1.23) == "1.23"); - assert (NumberFormatter::format(-1.23) == "-1.23"); - assert (NumberFormatter::format(1.0) == "1"); - assert (NumberFormatter::format(-1.0) == "-1"); - assert (NumberFormatter::format(0.1) == "0.1"); - assert (NumberFormatter::format(-0.1) == "-0.1"); + assertTrue (NumberFormatter::format(1.0f) == "1"); + assertTrue (NumberFormatter::format(1.23f) == "1.23"); + assertTrue (NumberFormatter::format(-1.23f) == "-1.23"); + assertTrue (NumberFormatter::format(0.1f) == "0.1"); + assertTrue (NumberFormatter::format(-0.1f) == "-0.1"); + assertTrue (NumberFormatter::format(1.23) == "1.23"); + assertTrue (NumberFormatter::format(-1.23) == "-1.23"); + assertTrue (NumberFormatter::format(1.0) == "1"); + assertTrue (NumberFormatter::format(-1.0) == "-1"); + assertTrue (NumberFormatter::format(0.1) == "0.1"); + assertTrue (NumberFormatter::format(-0.1) == "-0.1"); int decDigits = std::numeric_limits::digits10; std::ostringstream ostr; ostr << "0." << std::string(decDigits - 1, '0') << '1'; - assert(NumberFormatter::format(1 / std::pow(10., decDigits)) == ostr.str()); + assertTrue (NumberFormatter::format(1 / std::pow(10., decDigits)) == ostr.str()); ostr.str(""); ostr << "1e-" << decDigits + 1; std::string str (ostr.str()); std::string str1 (NumberFormatter::format(1 / std::pow(10., decDigits + 1))); - assert(NumberFormatter::format(1 / std::pow(10., decDigits + 1)) == ostr.str()); + assertTrue (NumberFormatter::format(1 / std::pow(10., decDigits + 1)) == ostr.str()); - assert(NumberFormatter::format(12.25) == "12.25"); - assert(NumberFormatter::format(12.25, 4) == "12.2500"); - assert(NumberFormatter::format(12.25, 8, 4) == " 12.2500"); + assertTrue (NumberFormatter::format(12.25) == "12.25"); + assertTrue (NumberFormatter::format(12.25, 4) == "12.2500"); + assertTrue (NumberFormatter::format(12.25, 8, 4) == " 12.2500"); - assert (NumberFormatter::format(12.45f, 2) == "12.45"); + assertTrue (NumberFormatter::format(12.45f, 2) == "12.45"); - assert(NumberFormatter::format(-12.25) == "-12.25"); - assert(NumberFormatter::format(-12.25, 4) == "-12.2500"); - assert(NumberFormatter::format(-12.25, 10, 4) == " -12.2500"); - assert(NumberFormatter::format(-12.25, 10, 2) == " -12.25"); - assert(NumberFormatter::format(-12.25, 10, 1) == " -12.3"); + assertTrue (NumberFormatter::format(-12.25) == "-12.25"); + assertTrue (NumberFormatter::format(-12.25, 4) == "-12.2500"); + assertTrue (NumberFormatter::format(-12.25, 10, 4) == " -12.2500"); + assertTrue (NumberFormatter::format(-12.25, 10, 2) == " -12.25"); + assertTrue (NumberFormatter::format(-12.25, 10, 1) == " -12.3"); - assert (NumberFormatter::format(50.0, 3) == "50.000"); - assert (NumberFormatter::format(50.0f, 3) == "50.000"); - assert (NumberFormatter::format(50.123, 3) == "50.123"); - assert (NumberFormatter::format(50.123f, 3) == "50.123"); - assert (NumberFormatter::format(50.123, 0) == "50"); - assert (NumberFormatter::format(50.123f, 0) == "50"); - assert (NumberFormatter::format(50.546, 0) == "51"); - assert (NumberFormatter::format(50.546f, 0) == "51"); - assert (NumberFormatter::format(50.546f, 2) == "50.55"); + assertTrue (NumberFormatter::format(50.0, 3) == "50.000"); + assertTrue (NumberFormatter::format(50.0f, 3) == "50.000"); + assertTrue (NumberFormatter::format(50.123, 3) == "50.123"); + assertTrue (NumberFormatter::format(50.123f, 3) == "50.123"); + assertTrue (NumberFormatter::format(50.123, 0) == "50"); + assertTrue (NumberFormatter::format(50.123f, 0) == "50"); + assertTrue (NumberFormatter::format(50.546, 0) == "51"); + assertTrue (NumberFormatter::format(50.546f, 0) == "51"); + assertTrue (NumberFormatter::format(50.546f, 2) == "50.55"); } @@ -270,48 +270,48 @@ void NumberFormatterTest::testAppend() { std::string s; NumberFormatter::append(s, 123); - assert (s == "123"); + assertTrue (s == "123"); s.erase(); NumberFormatter::append(s, 123, 4); - assert (s == " 123"); + assertTrue (s == " 123"); s.erase(); NumberFormatter::append0(s, 123, 5); - assert (s == "00123"); + assertTrue (s == "00123"); s.erase(); NumberFormatter::appendHex(s, 0xDEAD); - assert (s == "DEAD"); + assertTrue (s == "DEAD"); s.erase(); NumberFormatter::appendHex(s, 0xDEAD, 6); - assert (s == "00DEAD"); + assertTrue (s == "00DEAD"); s.erase(); NumberFormatter::append(s, 123u); - assert (s == "123"); + assertTrue (s == "123"); s.erase(); NumberFormatter::append(s, 123u, 4); - assert (s == " 123"); + assertTrue (s == " 123"); s.erase(); NumberFormatter::append0(s, 123u, 5); - assert (s == "00123"); + assertTrue (s == "00123"); s.erase(); NumberFormatter::append(s, 123.4); - assert (s == "123.4"); + assertTrue (s == "123.4"); s.erase(); NumberFormatter::append(s, 123.4567, 2); - assert (s == "123.46"); + assertTrue (s == "123.46"); s.erase(); NumberFormatter::append(s, 123.4567, 10, 5); - assert (s == " 123.45670"); + assertTrue (s == " 123.45670"); s.erase(); NumberFormatter::append(s, 123., 2); - assert (s == "123.00"); + assertTrue (s == "123.00"); s.erase(); NumberFormatter::append(s, static_cast(1234567), 2); - assert (s == "1234567.00"); + assertTrue (s == "1234567.00"); s.erase(); NumberFormatter::append(s, 1234567.0, 10, 1); - assert (s == " 1234567.0"); + assertTrue (s == " 1234567.0"); } diff --git a/Foundation/testsuite/src/NumberParserTest.cpp b/Foundation/testsuite/src/NumberParserTest.cpp index a9519c3e2..7e7fba65d 100644 --- a/Foundation/testsuite/src/NumberParserTest.cpp +++ b/Foundation/testsuite/src/NumberParserTest.cpp @@ -58,44 +58,44 @@ void NumberParserTest::testParse() { char ts = sep[i]; - assert(NumberParser::parse("123") == 123); - assert(NumberParser::parse(format("123%c456", ts), ts) == 123456); - assert(NumberParser::parse(format("1%c234%c567", ts, ts), ts) == 1234567); + assertTrue (NumberParser::parse("123") == 123); + assertTrue (NumberParser::parse(format("123%c456", ts), ts) == 123456); + assertTrue (NumberParser::parse(format("1%c234%c567", ts, ts), ts) == 1234567); } - assert(NumberParser::parse("+123") == 123); - assert(NumberParser::parse("-123") == -123); - assert(NumberParser::parse("0") == 0); - assert(NumberParser::parse("000") == 0); - assert(NumberParser::parse("0123") == 123); - assert(NumberParser::parse("+0123") == 123); - assert(NumberParser::parse("-0123") == -123); - assert(NumberParser::parseUnsigned("123") == 123); - assert(NumberParser::parseHex("12AB") == 0x12ab); - assert(NumberParser::parseHex("0x12AB") == 0x12ab); - assert(NumberParser::parseHex("0X12AB") == 0x12ab); - assert(NumberParser::parseHex("00") == 0); - assert(NumberParser::parseOct("123") == 0123); - assert(NumberParser::parseOct("0123") == 0123); - assert(NumberParser::parseOct("0") == 0); - assert(NumberParser::parseOct("000") == 0); + assertTrue (NumberParser::parse("+123") == 123); + assertTrue (NumberParser::parse("-123") == -123); + assertTrue (NumberParser::parse("0") == 0); + assertTrue (NumberParser::parse("000") == 0); + assertTrue (NumberParser::parse("0123") == 123); + assertTrue (NumberParser::parse("+0123") == 123); + assertTrue (NumberParser::parse("-0123") == -123); + assertTrue (NumberParser::parseUnsigned("123") == 123); + assertTrue (NumberParser::parseHex("12AB") == 0x12ab); + assertTrue (NumberParser::parseHex("0x12AB") == 0x12ab); + assertTrue (NumberParser::parseHex("0X12AB") == 0x12ab); + assertTrue (NumberParser::parseHex("00") == 0); + assertTrue (NumberParser::parseOct("123") == 0123); + assertTrue (NumberParser::parseOct("0123") == 0123); + assertTrue (NumberParser::parseOct("0") == 0); + assertTrue (NumberParser::parseOct("000") == 0); - assert(NumberParser::parseBool("0") == false); - assert(NumberParser::parseBool("FALSE") == false); - assert(NumberParser::parseBool("no") == false); - assert(NumberParser::parseBool("1") == true); - assert(NumberParser::parseBool("True") == true); - assert(NumberParser::parseBool("YeS") == true); + assertTrue (NumberParser::parseBool("0") == false); + assertTrue (NumberParser::parseBool("FALSE") == false); + assertTrue (NumberParser::parseBool("no") == false); + assertTrue (NumberParser::parseBool("1") == true); + assertTrue (NumberParser::parseBool("True") == true); + assertTrue (NumberParser::parseBool("YeS") == true); #if defined(POCO_HAVE_INT64) - assert(NumberParser::parse64("123") == 123); - assert(NumberParser::parse64("-123") == -123); - assert(NumberParser::parse64("0123") == 123); - assert(NumberParser::parse64("-0123") == -123); - assert(NumberParser::parseUnsigned64("123") == 123); - assert(NumberParser::parseHex64("12AB") == 0x12ab); - assert(NumberParser::parseOct64("123") == 0123); - assert(NumberParser::parseOct64("0123") == 0123); + assertTrue (NumberParser::parse64("123") == 123); + assertTrue (NumberParser::parse64("-123") == -123); + assertTrue (NumberParser::parse64("0123") == 123); + assertTrue (NumberParser::parse64("-0123") == -123); + assertTrue (NumberParser::parseUnsigned64("123") == 123); + assertTrue (NumberParser::parseHex64("12AB") == 0x12ab); + assertTrue (NumberParser::parseOct64("123") == 0123); + assertTrue (NumberParser::parseOct64("0123") == 0123); #endif #ifndef POCO_NO_FPENVIRONMENT @@ -173,20 +173,20 @@ void NumberParserTest::testParse() void NumberParserTest::testLimits() { - assert(testUpperLimit()); - assert(testLowerLimit()); - assert(testUpperLimit()); - assert(testUpperLimit()); - assert(testLowerLimit()); - assert(testUpperLimit()); - assert(testUpperLimit()); - assert(testLowerLimit()); - assert(testUpperLimit()); + assertTrue (testUpperLimit()); + assertTrue (testLowerLimit()); + assertTrue (testUpperLimit()); + assertTrue (testUpperLimit()); + assertTrue (testLowerLimit()); + assertTrue (testUpperLimit()); + assertTrue (testUpperLimit()); + assertTrue (testLowerLimit()); + assertTrue (testUpperLimit()); #if defined(POCO_HAVE_INT64) - assert(testUpperLimit64()); - assert(testLowerLimit64()); - assert(testUpperLimit64()); + assertTrue (testUpperLimit64()); + assertTrue (testLowerLimit64()); + assertTrue (testUpperLimit64()); #endif } @@ -197,7 +197,7 @@ void NumberParserTest::testParseError() if (dp == 0) dp = '.'; char ts = thousandSeparator(); if (ts == 0) ts = ','; - assert (dp != ts); + assertTrue (dp != ts); try { diff --git a/Foundation/testsuite/src/ObjectPoolTest.cpp b/Foundation/testsuite/src/ObjectPoolTest.cpp index 01ea13a03..f4d9fd791 100644 --- a/Foundation/testsuite/src/ObjectPoolTest.cpp +++ b/Foundation/testsuite/src/ObjectPoolTest.cpp @@ -32,59 +32,59 @@ void ObjectPoolTest::testObjectPool() { ObjectPool > pool(3, 4); - assert (pool.capacity() == 3); - assert (pool.peakCapacity() == 4); - assert (pool.size() == 0); - assert (pool.available() == 4); + assertTrue (pool.capacity() == 3); + assertTrue (pool.peakCapacity() == 4); + assertTrue (pool.size() == 0); + assertTrue (pool.available() == 4); Poco::SharedPtr pStr1 = pool.borrowObject(); pStr1->assign("first"); - assert (pool.size() == 1); - assert (pool.available() == 3); + assertTrue (pool.size() == 1); + assertTrue (pool.available() == 3); Poco::SharedPtr pStr2 = pool.borrowObject(); pStr2->assign("second"); - assert (pool.size() == 2); - assert (pool.available() == 2); + assertTrue (pool.size() == 2); + assertTrue (pool.available() == 2); Poco::SharedPtr pStr3 = pool.borrowObject(); pStr3->assign("third"); - assert (pool.size() == 3); - assert (pool.available() == 1); + assertTrue (pool.size() == 3); + assertTrue (pool.available() == 1); Poco::SharedPtr pStr4 = pool.borrowObject(); pStr4->assign("fourth"); - assert (pool.size() == 4); - assert (pool.available() == 0); + assertTrue (pool.size() == 4); + assertTrue (pool.available() == 0); Poco::SharedPtr pStr5 = pool.borrowObject(); - assert (pStr5.isNull()); + assertTrue (pStr5.isNull()); pool.returnObject(pStr4); - assert (pool.size() == 4); - assert (pool.available() == 1); + assertTrue (pool.size() == 4); + assertTrue (pool.available() == 1); pool.returnObject(pStr3); - assert (pool.size() == 4); - assert (pool.available() == 2); + assertTrue (pool.size() == 4); + assertTrue (pool.available() == 2); pStr3 = pool.borrowObject(); - assert (*pStr3 == "third"); - assert (pool.available() == 1); + assertTrue (*pStr3 == "third"); + assertTrue (pool.available() == 1); pool.returnObject(pStr3); pool.returnObject(pStr2); pool.returnObject(pStr1); - assert (pool.size() == 3); - assert (pool.available() == 4); + assertTrue (pool.size() == 3); + assertTrue (pool.available() == 4); pStr1 = pool.borrowObject(); - assert (*pStr1 == "second"); - assert (pool.available() == 3); + assertTrue (*pStr1 == "second"); + assertTrue (pool.available() == 3); pool.returnObject(pStr1); - assert (pool.available() == 4); + assertTrue (pool.available() == 4); } diff --git a/Foundation/testsuite/src/PBKDF2EngineTest.cpp b/Foundation/testsuite/src/PBKDF2EngineTest.cpp index 503e15787..f05529b62 100644 --- a/Foundation/testsuite/src/PBKDF2EngineTest.cpp +++ b/Foundation/testsuite/src/PBKDF2EngineTest.cpp @@ -41,7 +41,7 @@ void PBKDF2EngineTest::testPBKDF2a() PBKDF2Engine > pbkdf2(s, 1, 20); pbkdf2.update(p); std::string dk = DigestEngine::digestToHex(pbkdf2.digest()); - assert (dk == "0c60c80f961f0e71f3a9b524af6012062fe037a6"); + assertTrue (dk == "0c60c80f961f0e71f3a9b524af6012062fe037a6"); } @@ -54,7 +54,7 @@ void PBKDF2EngineTest::testPBKDF2b() PBKDF2Engine > pbkdf2(s, 2, 20); pbkdf2.update(p); std::string dk = DigestEngine::digestToHex(pbkdf2.digest()); - assert (dk == "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"); + assertTrue (dk == "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"); } @@ -67,7 +67,7 @@ void PBKDF2EngineTest::testPBKDF2c() PBKDF2Engine > pbkdf2(s, 4096, 20); pbkdf2.update(p); std::string dk = DigestEngine::digestToHex(pbkdf2.digest()); - assert (dk == "4b007901b765489abead49d926f721d065a429c1"); + assertTrue (dk == "4b007901b765489abead49d926f721d065a429c1"); } @@ -80,7 +80,7 @@ void PBKDF2EngineTest::testPBKDF2d() PBKDF2Engine > pbkdf2(s, 16777216, 20); pbkdf2.update(p); std::string dk = DigestEngine::digestToHex(pbkdf2.digest()); - assert (dk == "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"); + assertTrue (dk == "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"); #endif // defined(ENABLE_LONG_RUNNING_TESTS) } @@ -94,7 +94,7 @@ void PBKDF2EngineTest::testPBKDF2e() PBKDF2Engine > pbkdf2(s, 4096, 25); pbkdf2.update(p); std::string dk = DigestEngine::digestToHex(pbkdf2.digest()); - assert (dk == "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"); + assertTrue (dk == "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"); } @@ -107,7 +107,7 @@ void PBKDF2EngineTest::testPBKDF2f() PBKDF2Engine > pbkdf2(s, 4096, 16); pbkdf2.update(p); std::string dk = DigestEngine::digestToHex(pbkdf2.digest()); - assert (dk == "56fa6aa75548099dcc37d7f03425e0c3"); + assertTrue (dk == "56fa6aa75548099dcc37d7f03425e0c3"); } diff --git a/Foundation/testsuite/src/PathTest.cpp b/Foundation/testsuite/src/PathTest.cpp index 6497cfcef..c9cc6ede3 100644 --- a/Foundation/testsuite/src/PathTest.cpp +++ b/Foundation/testsuite/src/PathTest.cpp @@ -46,65 +46,65 @@ void PathTest::testParseUnix1() { Path p; p.parse("", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == ""); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == ""); p.parse("/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/"); p.parse("/usr", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr"); p.parse("/usr/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/"); p.parse("usr/", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr/"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr/"); p.parse("usr", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (p[0] == "usr"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p[0] == "usr"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr"); p.parse("/usr/local", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local"); } @@ -112,56 +112,56 @@ void PathTest::testParseUnix2() { Path p; p.parse("/usr/local/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/"); p.parse("usr/local/", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr/local/"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr/local/"); p.parse("usr/local", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr/local"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr/local"); p.parse("/usr/local/bin", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin"); p.parse("/usr/local/bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); } @@ -169,92 +169,92 @@ void PathTest::testParseUnix3() { Path p; p.parse("//usr/local/bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("/usr//local/bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("/usr/local//bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("/usr/local/bin//", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("/usr/local/./bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("./usr/local/bin/", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr/local/bin/"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr/local/bin/"); p.parse("./usr/local/bin/./", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr/local/bin/"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr/local/bin/"); p.parse("./usr/local/bin/.", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "usr/local/bin/."); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "usr/local/bin/."); } @@ -262,97 +262,97 @@ void PathTest::testParseUnix4() { Path p; p.parse("/usr/local/lib/../bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("/usr/local/lib/../bin/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin/"); p.parse("/usr/local/lib/../../", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/"); p.parse("/usr/local/lib/..", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "lib"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/lib/.."); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "lib"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/lib/.."); p.parse("../usr/local/lib/", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 4); - assert (p[0] == ".."); - assert (p[1] == "usr"); - assert (p[2] == "local"); - assert (p[3] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "../usr/local/lib/"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 4); + assertTrue (p[0] == ".."); + assertTrue (p[1] == "usr"); + assertTrue (p[2] == "local"); + assertTrue (p[3] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "../usr/local/lib/"); p.parse("/usr/../lib/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/lib/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/lib/"); p.parse("/usr/../../lib/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/lib/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/lib/"); p.parse("local/../../lib/", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == ".."); - assert (p[1] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "../lib/"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == ".."); + assertTrue (p[1] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "../lib/"); p.parse("a/b/c/d", Path::PATH_UNIX); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "a"); - assert (p[1] == "b"); - assert (p[2] == "c"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "a/b/c/d"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "a"); + assertTrue (p[1] == "b"); + assertTrue (p[2] == "c"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "a/b/c/d"); } @@ -360,15 +360,15 @@ void PathTest::testParseUnix5() { Path p; p.parse("/c:/windows/system32/", Path::PATH_UNIX); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.getDevice() == "c"); - assert (p.depth() == 2); - assert (p[0] == "windows"); - assert (p[1] == "system32"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/c:/windows/system32/"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.getDevice() == "c"); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "windows"); + assertTrue (p[1] == "system32"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/c:/windows/system32/"); } @@ -376,62 +376,62 @@ void PathTest::testParseWindows1() { Path p; p.parse("", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == ""); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == ""); p.parse("/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\"); p.parse("\\", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\"); p.parse("/usr", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr"); p.parse("\\usr", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr"); p.parse("/usr/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\"); p.parse("\\usr\\", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\"); } @@ -439,136 +439,136 @@ void PathTest::testParseWindows2() { Path p; p.parse("usr/", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\"); p.parse("usr", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (p[0] == "usr"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p[0] == "usr"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr"); p.parse("usr\\", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\"); p.parse("/usr/local", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local"); p.parse("\\usr\\local", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local"); p.parse("/usr/local/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\"); p.parse("usr/local/", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\local\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\local\\"); p.parse("usr/local", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\local"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\local"); p.parse("/usr/local/bin", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin"); p.parse("/usr/local/bin/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("/usr//local/bin/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("/usr/local//bin/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("/usr/local/bin//", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); } @@ -576,141 +576,141 @@ void PathTest::testParseWindows3() { Path p; p.parse("/usr/local/./bin/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("./usr/local/bin/", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\local\\bin\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\local\\bin\\"); p.parse("./usr/local/bin/./", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\local\\bin\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\local\\bin\\"); p.parse("./usr/local/bin/.", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "usr\\local\\bin\\."); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "usr\\local\\bin\\."); p.parse("/usr/local/lib/../bin/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("/usr/local/lib/../bin/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("\\usr\\local\\lib\\..\\bin\\", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\bin\\"); p.parse("/usr/local/lib/../../", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "usr"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "usr"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\"); p.parse("/usr/local/lib/..", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "lib"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\lib\\.."); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "lib"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\usr\\local\\lib\\.."); p.parse("../usr/local/lib/", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 4); - assert (p[0] == ".."); - assert (p[1] == "usr"); - assert (p[2] == "local"); - assert (p[3] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "..\\usr\\local\\lib\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 4); + assertTrue (p[0] == ".."); + assertTrue (p[1] == "usr"); + assertTrue (p[2] == "local"); + assertTrue (p[3] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "..\\usr\\local\\lib\\"); p.parse("/usr/../lib/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\lib\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\lib\\"); p.parse("/usr/../../lib/", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\lib\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\lib\\"); p.parse("local/../../lib/", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == ".."); - assert (p[1] == "lib"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "..\\lib\\"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == ".."); + assertTrue (p[1] == "lib"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "..\\lib\\"); } @@ -718,93 +718,93 @@ void PathTest::testParseWindows4() { Path p; p.parse("\\\\server\\files", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "files"); - assert (p.getNode() == "server"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "files"); + assertTrue (p.getNode() == "server"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\"); p.parse("\\\\server\\files\\", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "files"); - assert (p.getNode() == "server"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "files"); + assertTrue (p.getNode() == "server"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\"); p.parse("\\\\server\\files\\file", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "files"); - assert (p.getNode() == "server"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\file"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "files"); + assertTrue (p.getNode() == "server"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\file"); p.parse("\\\\server\\files\\dir\\file", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "files"); - assert (p[1] == "dir"); - assert (p.getNode() == "server"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\dir\\file"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "files"); + assertTrue (p[1] == "dir"); + assertTrue (p.getNode() == "server"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\dir\\file"); p.parse("\\\\server\\files\\dir\\file", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "files"); - assert (p[1] == "dir"); - assert (p.getNode() == "server"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\dir\\file"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "files"); + assertTrue (p[1] == "dir"); + assertTrue (p.getNode() == "server"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\dir\\file"); p.parse("\\\\server", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getNode() == "server"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getNode() == "server"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\"); p.parse("c:\\", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "c"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "c"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\"); p.parse("c:\\WinNT", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "c"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "c"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT"); p.parse("c:\\WinNT\\", Path::PATH_WINDOWS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "WinNT"); - assert (p.getDevice() == "c"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "WinNT"); + assertTrue (p.getDevice() == "c"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT\\"); try { @@ -825,15 +825,15 @@ void PathTest::testParseWindows4() } p.parse("a\\b\\c\\d", Path::PATH_WINDOWS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "a"); - assert (p[1] == "b"); - assert (p[2] == "c"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "a\\b\\c\\d"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "a"); + assertTrue (p[1] == "b"); + assertTrue (p[2] == "c"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "a\\b\\c\\d"); } @@ -841,80 +841,80 @@ void PathTest::testParseVMS1() { Path p; p.parse("", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == ""); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == ""); p.parse("[]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == ""); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == ""); p.parse("[foo]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[.foo]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[.foo]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[.foo]"); p.parse("[foo.bar]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo.bar]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar]"); p.parse("[.foo.bar]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[.foo.bar]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[.foo.bar]"); p.parse("[foo.bar.foobar]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p[2] == "foobar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo.bar.foobar]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p[2] == "foobar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar.foobar]"); p.parse("[.foo.bar.foobar]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p[2] == "foobar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[.foo.bar.foobar]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p[2] == "foobar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[.foo.bar.foobar]"); } @@ -922,35 +922,35 @@ void PathTest::testParseVMS2() { Path p; p.parse("[foo][bar]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo.bar]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar]"); p.parse("[foo.][bar]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo.bar]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar]"); p.parse("[foo.bar][foo]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p[2] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo.bar.foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p[2] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar.foo]"); try { @@ -971,98 +971,98 @@ void PathTest::testParseVMS2() } p.parse("[-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[-]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[-]"); p.parse("[--]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[--]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[--]"); p.parse("[---]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p[2] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[---]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p[2] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[---]"); p.parse("[-.-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[--]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[--]"); p.parse("[.-.-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[--]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[--]"); p.parse("[-.-.-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p[2] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[---]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p[2] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[---]"); p.parse("[.-.-.-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p[2] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[---]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p[2] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[---]"); p.parse("[.--.-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p[2] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[---]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p[2] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[---]"); p.parse("[--.-]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == ".."); - assert (p[1] == ".."); - assert (p[2] == ".."); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[---]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == ".."); + assertTrue (p[1] == ".."); + assertTrue (p[2] == ".."); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[---]"); } @@ -1070,77 +1070,77 @@ void PathTest::testParseVMS3() { Path p; p.parse("[foo][-]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[foo][--]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[foo][-.-]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[foo][bar.-]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[foo][bar.foo.-]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo.bar]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo.bar]"); p.parse("[foo][bar.foo.--]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[foo][bar.foo.---]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); p.parse("[foo][bar.foo.-.-.-]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]"); } @@ -1148,141 +1148,141 @@ void PathTest::testParseVMS4() { Path p; p.parse("device:[foo]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.getDevice() == "device"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "device:[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.getDevice() == "device"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "device:[foo]"); p.parse("device:[.foo]", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.getDevice() == "device"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "device:[.foo]"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.getDevice() == "device"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "device:[.foo]"); p.parse("node::device:[foo]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (p.getNode() == "node"); - assert (p.getDevice() == "device"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "node::device:[foo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (p.getNode() == "node"); + assertTrue (p.getDevice() == "device"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "node::device:[foo]"); p.parse("node::device:[foo.bar]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p.getNode() == "node"); - assert (p.getDevice() == "device"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "node::device:[foo.bar]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p.getNode() == "node"); + assertTrue (p.getDevice() == "device"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "node::device:[foo.bar]"); p.parse("node::device:[foo.bar.][goo]", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 3); - assert (p[0] == "foo"); - assert (p[1] == "bar"); - assert (p[2] == "goo"); - assert (p.getNode() == "node"); - assert (p.getDevice() == "device"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "node::device:[foo.bar.goo]"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 3); + assertTrue (p[0] == "foo"); + assertTrue (p[1] == "bar"); + assertTrue (p[2] == "goo"); + assertTrue (p.getNode() == "node"); + assertTrue (p.getDevice() == "device"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "node::device:[foo.bar.goo]"); p.parse("[]foo.txt", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "foo.txt"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "foo.txt"); p.parse("[foo]bar.txt", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]bar.txt"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]bar.txt"); p.parse("[foo]bar.txt;", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]bar.txt"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]bar.txt"); p.parse("[foo]bar.txt;5", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]bar.txt;5"); - assert (p.version() == "5"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]bar.txt;5"); + assertTrue (p.version() == "5"); p.parse("foo:bar.txt", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "foo:bar.txt"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "foo:bar.txt"); p.parse("foo:bar.txt;5", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "foo:bar.txt;5"); - assert (p.version() == "5"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "foo:bar.txt;5"); + assertTrue (p.version() == "5"); p.parse("foo:", Path::PATH_VMS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "foo"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_VMS) == "foo:"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "foo"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "foo:"); p.parse("bar.txt", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "bar.txt"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "bar.txt"); p.parse("bar.txt;5", Path::PATH_VMS); - assert (p.isRelative()); - assert (!p.isAbsolute()); - assert (p.depth() == 0); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "bar.txt;5"); - assert (p.version() == "5"); + assertTrue (p.isRelative()); + assertTrue (!p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "bar.txt;5"); + assertTrue (p.version() == "5"); } @@ -1291,63 +1291,63 @@ void PathTest::testParseGuess() Path p; p.parse("foo:bar.txt;5", Path::PATH_GUESS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "foo:bar.txt;5"); - assert (p.version() == "5"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "foo:bar.txt;5"); + assertTrue (p.version() == "5"); p.parse("/usr/local/bin", Path::PATH_GUESS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 2); - assert (p[0] == "usr"); - assert (p[1] == "local"); - assert (p[2] == "bin"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/bin"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 2); + assertTrue (p[0] == "usr"); + assertTrue (p[1] == "local"); + assertTrue (p[2] == "bin"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/bin"); p.parse("\\\\server\\files", Path::PATH_GUESS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "files"); - assert (p.getNode() == "server"); - assert (p.isDirectory()); - assert (!p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "files"); + assertTrue (p.getNode() == "server"); + assertTrue (p.isDirectory()); + assertTrue (!p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "\\\\server\\files\\"); p.parse("c:\\WinNT", Path::PATH_GUESS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "c"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "c"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\WinNT"); p.parse("foo:bar.txt;5", Path::PATH_GUESS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 0); - assert (p.getDevice() == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "foo:bar.txt;5"); - assert (p.version() == "5"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 0); + assertTrue (p.getDevice() == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "foo:bar.txt;5"); + assertTrue (p.version() == "5"); p.parse("[foo]bar.txt", Path::PATH_GUESS); - assert (!p.isRelative()); - assert (p.isAbsolute()); - assert (p.depth() == 1); - assert (p[0] == "foo"); - assert (!p.isDirectory()); - assert (p.isFile()); - assert (p.toString(Path::PATH_VMS) == "[foo]bar.txt"); + assertTrue (!p.isRelative()); + assertTrue (p.isAbsolute()); + assertTrue (p.depth() == 1); + assertTrue (p[0] == "foo"); + assertTrue (!p.isDirectory()); + assertTrue (p.isFile()); + assertTrue (p.toString(Path::PATH_VMS) == "[foo]bar.txt"); } @@ -1355,41 +1355,41 @@ void PathTest::testTryParse() { Path p; #if defined(POCO_OS_FAMILY_UNIX) - assert (p.tryParse("/etc/passwd")); - assert (p.toString() == "/etc/passwd"); + assertTrue (p.tryParse("/etc/passwd")); + assertTrue (p.toString() == "/etc/passwd"); #elif defined(POCO_OS_FAMILY_WINDOWS) - assert (p.tryParse("c:\\windows\\system32")); - assert (p.toString() == "c:\\windows\\system32"); - assert (!p.tryParse("c:foo.bar")); - assert (p.toString() == "c:\\windows\\system32"); + assertTrue (p.tryParse("c:\\windows\\system32")); + assertTrue (p.toString() == "c:\\windows\\system32"); + assertTrue (!p.tryParse("c:foo.bar")); + assertTrue (p.toString() == "c:\\windows\\system32"); #endif - assert (p.tryParse("c:\\windows\\system", Path::PATH_WINDOWS)); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\windows\\system"); - assert (!p.tryParse("c:foo.bar", Path::PATH_WINDOWS)); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\windows\\system"); + assertTrue (p.tryParse("c:\\windows\\system", Path::PATH_WINDOWS)); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\windows\\system"); + assertTrue (!p.tryParse("c:foo.bar", Path::PATH_WINDOWS)); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\windows\\system"); } void PathTest::testStatics() { std::string s = Path::current(); - assert (!s.empty()); + assertTrue (!s.empty()); Path p(s); - assert (p.isDirectory() && p.isAbsolute()); + assertTrue (p.isDirectory() && p.isAbsolute()); s = Path::home(); - assert (!s.empty()); + assertTrue (!s.empty()); p = s; - assert (p.isDirectory() && p.isAbsolute()); + assertTrue (p.isDirectory() && p.isAbsolute()); s = Path::temp(); - assert (!s.empty()); + assertTrue (!s.empty()); p = s; - assert (p.isDirectory() && p.isAbsolute()); + assertTrue (p.isDirectory() && p.isAbsolute()); s = Path::null(); - assert (!s.empty()); + assertTrue (!s.empty()); p = s; } @@ -1397,29 +1397,29 @@ void PathTest::testStatics() void PathTest::testBaseNameExt() { Path p("foo.bar"); - assert (p.getFileName() == "foo.bar"); - assert (p.getBaseName() == "foo"); - assert (p.getExtension() == "bar"); + assertTrue (p.getFileName() == "foo.bar"); + assertTrue (p.getBaseName() == "foo"); + assertTrue (p.getExtension() == "bar"); p.setBaseName("readme"); - assert (p.getFileName() == "readme.bar"); - assert (p.getBaseName() == "readme"); - assert (p.getExtension() == "bar"); + assertTrue (p.getFileName() == "readme.bar"); + assertTrue (p.getBaseName() == "readme"); + assertTrue (p.getExtension() == "bar"); p.setExtension("txt"); - assert (p.getFileName() == "readme.txt"); - assert (p.getBaseName() == "readme"); - assert (p.getExtension() == "txt"); + assertTrue (p.getFileName() == "readme.txt"); + assertTrue (p.getBaseName() == "readme"); + assertTrue (p.getExtension() == "txt"); p.setExtension("html"); - assert (p.getFileName() == "readme.html"); - assert (p.getBaseName() == "readme"); - assert (p.getExtension() == "html"); + assertTrue (p.getFileName() == "readme.html"); + assertTrue (p.getBaseName() == "readme"); + assertTrue (p.getExtension() == "html"); p.setBaseName("index"); - assert (p.getFileName() == "index.html"); - assert (p.getBaseName() == "index"); - assert (p.getExtension() == "html"); + assertTrue (p.getFileName() == "index.html"); + assertTrue (p.getBaseName() == "index"); + assertTrue (p.getExtension() == "html"); } @@ -1428,17 +1428,17 @@ void PathTest::testAbsolute() Path base("C:\\Program Files\\", Path::PATH_WINDOWS); Path rel("Poco"); Path abs = rel.absolute(base); - assert (abs.toString(Path::PATH_WINDOWS) == "C:\\Program Files\\Poco"); + assertTrue (abs.toString(Path::PATH_WINDOWS) == "C:\\Program Files\\Poco"); base.parse("/usr/local", Path::PATH_UNIX); rel.parse("Poco/include", Path::PATH_UNIX); abs = rel.absolute(base); - assert (abs.toString(Path::PATH_UNIX) == "/usr/local/Poco/include"); + assertTrue (abs.toString(Path::PATH_UNIX) == "/usr/local/Poco/include"); base.parse("/usr/local/bin", Path::PATH_UNIX); rel.parse("../Poco/include", Path::PATH_UNIX); abs = rel.absolute(base); - assert (abs.toString(Path::PATH_UNIX) == "/usr/local/Poco/include"); + assertTrue (abs.toString(Path::PATH_UNIX) == "/usr/local/Poco/include"); } @@ -1486,23 +1486,23 @@ void PathTest::testParent() { Path p("/usr/local/include", Path::PATH_UNIX); p.makeParent(); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/"); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/"); p.makeParent(); - assert (p.toString(Path::PATH_UNIX) == "/usr/"); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/"); p.makeParent(); - assert (p.toString(Path::PATH_UNIX) == "/"); + assertTrue (p.toString(Path::PATH_UNIX) == "/"); p.makeParent(); - assert (p.toString(Path::PATH_UNIX) == "/"); + assertTrue (p.toString(Path::PATH_UNIX) == "/"); } void PathTest::testForDirectory() { Path p = Path::forDirectory("/usr/local/include", Path::PATH_UNIX); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/include/"); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/include/"); p = Path::forDirectory("/usr/local/include/", Path::PATH_UNIX); - assert (p.toString(Path::PATH_UNIX) == "/usr/local/include/"); + assertTrue (p.toString(Path::PATH_UNIX) == "/usr/local/include/"); } @@ -1510,21 +1510,21 @@ void PathTest::testExpand() { #if defined(POCO_OS_FAMILY_UNIX) std::string s = Path::expand("~/.bashrc"); - assert (s == Path::expand("$HOME/.bashrc")); - assert (s == Environment::get("HOME") + "/.bashrc" || + assertTrue (s == Path::expand("$HOME/.bashrc")); + assertTrue (s == Environment::get("HOME") + "/.bashrc" || s == Environment::get("HOME") + "//.bashrc"); Path p(s); s = Path::expand("$HOME/.bashrc"); - assert (s == Path::expand("~/.bashrc")); + assertTrue (s == Path::expand("~/.bashrc")); s = Path::expand("${HOME}/.bashrc"); - assert (s == Path::expand("~/.bashrc")); + assertTrue (s == Path::expand("~/.bashrc")); #elif defined(POCO_OS_FAMILY_WINDOWS) std::string s = Path::expand("%TMP%\\foo"); - assert (s == Environment::get("TMP") + "\\foo"); + assertTrue (s == Environment::get("TMP") + "\\foo"); Path p(s); #else std::string s = Path::expand("SYS$LOGIN:[projects]"); - assert (s.find(":[projects]") != std::string::npos); + assertTrue (s.find(":[projects]") != std::string::npos); Path p(s); #endif } @@ -1534,7 +1534,7 @@ void PathTest::testListRoots() { std::vector devs; Path::listRoots(devs); - assert (devs.size() > 0); + assertTrue (devs.size() > 0); for (std::vector::iterator it = devs.begin(); it != devs.end(); ++it) { std::cout << *it << std::endl; @@ -1558,11 +1558,11 @@ void PathTest::testFind() bool found = true; bool notfound = false; #endif - assert (found); - assert (!notfound); + assertTrue (found); + assertTrue (!notfound); std::string fn = p.toString(); - assert (fn.size() > 0); + assertTrue (fn.size() > 0); } @@ -1571,8 +1571,8 @@ void PathTest::testSwap() Path p1("c:\\temp\\foo.bar"); Path p2("\\\\server\\files\\foo.bar"); p1.swap(p2); - assert (p1.toString() == "\\\\server\\files\\foo.bar"); - assert (p2.toString() == "c:\\temp\\foo.bar"); + assertTrue (p1.toString() == "\\\\server\\files\\foo.bar"); + assertTrue (p2.toString() == "c:\\temp\\foo.bar"); } @@ -1580,19 +1580,19 @@ void PathTest::testResolve() { Path p("c:\\foo\\", Path::PATH_WINDOWS); p.resolve("test.dat"); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\test.dat"); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\test.dat"); p.assign("c:\\foo\\", Path::PATH_WINDOWS); p.resolve(Path("d:\\bar.txt", Path::PATH_WINDOWS)); - assert (p.toString(Path::PATH_WINDOWS) == "d:\\bar.txt"); + assertTrue (p.toString(Path::PATH_WINDOWS) == "d:\\bar.txt"); p.assign("c:\\foo\\bar.txt", Path::PATH_WINDOWS); p.resolve("foo.txt"); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\foo.txt"); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\foo.txt"); p.assign("c:\\foo\\bar\\", Path::PATH_WINDOWS); p.resolve(Path("..\\baz\\test.dat", Path::PATH_WINDOWS)); - assert (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\baz\\test.dat"); + assertTrue (p.toString(Path::PATH_WINDOWS) == "c:\\foo\\baz\\test.dat"); } @@ -1602,13 +1602,13 @@ void PathTest::testPushPop() p.pushDirectory("a"); p.pushDirectory("b"); p.pushDirectory("c"); - assert (p.toString(Path::PATH_UNIX) == "a/b/c/"); + assertTrue (p.toString(Path::PATH_UNIX) == "a/b/c/"); p.popDirectory(); - assert (p.toString(Path::PATH_UNIX) == "a/b/"); + assertTrue (p.toString(Path::PATH_UNIX) == "a/b/"); p.popFrontDirectory(); - assert (p.toString(Path::PATH_UNIX) == "b/"); + assertTrue (p.toString(Path::PATH_UNIX) == "b/"); } diff --git a/Foundation/testsuite/src/PatternFormatterTest.cpp b/Foundation/testsuite/src/PatternFormatterTest.cpp index a63f4c697..29f8e0871 100644 --- a/Foundation/testsuite/src/PatternFormatterTest.cpp +++ b/Foundation/testsuite/src/PatternFormatterTest.cpp @@ -47,50 +47,50 @@ void PatternFormatterTest::testPatternFormatter() std::string result; fmt.setProperty("pattern", "%Y-%m-%dT%H:%M:%S [%s] %p: %t"); fmt.format(msg, result); - assert (result == "2005-01-01T14:30:15 [TestSource] Error: Test message text"); + assertTrue (result == "2005-01-01T14:30:15 [TestSource] Error: Test message text"); result.clear(); fmt.setProperty("pattern", "%w, %e %b %y %H:%M:%S.%i [%s:%I:%T] %q: %t"); fmt.format(msg, result); - assert (result == "Sat, 1 Jan 05 14:30:15.500 [TestSource:1:TestThread] E: Test message text"); + assertTrue (result == "Sat, 1 Jan 05 14:30:15.500 [TestSource:1:TestThread] E: Test message text"); result.clear(); fmt.setProperty("pattern", "%Y-%m-%d %H:%M:%S [%N:%P:%s]%l-%t"); fmt.format(msg, result); - assert (result.find("2005-01-01 14:30:15 [") == 0); - assert (result.find(":TestSource]3-Test message text") != std::string::npos); + assertTrue (result.find("2005-01-01 14:30:15 [") == 0); + assertTrue (result.find(":TestSource]3-Test message text") != std::string::npos); result.clear(); - assert (fmt.getProperty("times") == "UTC"); + assertTrue (fmt.getProperty("times") == "UTC"); fmt.setProperty("times", "local"); fmt.format(msg, result); - assert (result.find("2005-01-01 ") == 0); - assert (result.find(":TestSource]3-Test message text") != std::string::npos); + assertTrue (result.find("2005-01-01 ") == 0); + assertTrue (result.find(":TestSource]3-Test message text") != std::string::npos); result.clear(); fmt.setProperty("pattern", "%[testParam]"); fmt.format(msg, result); - assert (result == "Test Parameter"); + assertTrue (result == "Test Parameter"); result.clear(); fmt.setProperty("pattern", "%[testParam] %p"); fmt.format(msg, result); - assert (result == "Test Parameter Error"); + assertTrue (result == "Test Parameter Error"); result.clear(); fmt.setProperty("pattern", "start %v[10] end"); fmt.format(msg, result); - assert (result == "start TestSource end"); + assertTrue (result == "start TestSource end"); result.clear(); fmt.setProperty("pattern", "start %v[12] end"); fmt.format(msg, result); - assert (result == "start TestSource end"); + assertTrue (result == "start TestSource end"); result.clear(); fmt.setProperty("pattern", "start %v[8] end"); fmt.format(msg, result); - assert (result == "start stSource end"); + assertTrue (result == "start stSource end"); } diff --git a/Foundation/testsuite/src/PriorityEventTest.cpp b/Foundation/testsuite/src/PriorityEventTest.cpp index 0027effd2..af0bf8a67 100644 --- a/Foundation/testsuite/src/PriorityEventTest.cpp +++ b/Foundation/testsuite/src/PriorityEventTest.cpp @@ -38,55 +38,55 @@ void PriorityEventTest::testNoDelegate() int tmp = 0; EventArgs args; - assert (_count == 0); + assertTrue (_count == 0); Void.notify(this); - assert (_count == 0); + assertTrue (_count == 0); Void += priorityDelegate(this, &PriorityEventTest::onVoid, 0); Void -= priorityDelegate(this, &PriorityEventTest::onVoid, 0); Void.notify(this); - assert (_count == 0); + assertTrue (_count == 0); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimpleNoSender, 0); Simple -= priorityDelegate(this, &PriorityEventTest::onSimpleNoSender, 0); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); ConstSimple += priorityDelegate(this, &PriorityEventTest::onConstSimple, 0); ConstSimple -= priorityDelegate(this, &PriorityEventTest::onConstSimple, 0); ConstSimple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); //Note: passing &args will not work due to & EventArgs* pArgs = &args; Complex += priorityDelegate(this, &PriorityEventTest::onComplex, 0); Complex -= priorityDelegate(this, &PriorityEventTest::onComplex, 0); Complex.notify(this, pArgs); - assert (_count == 0); + assertTrue (_count == 0); Complex2 += priorityDelegate(this, &PriorityEventTest::onComplex2, 0); Complex2 -= priorityDelegate(this, &PriorityEventTest::onComplex2, 0); Complex2.notify(this, args); - assert (_count == 0); + assertTrue (_count == 0); const EventArgs* pCArgs = &args; ConstComplex += priorityDelegate(this, &PriorityEventTest::onConstComplex, 0); ConstComplex -= priorityDelegate(this, &PriorityEventTest::onConstComplex, 0); ConstComplex.notify(this, pCArgs); - assert (_count == 0); + assertTrue (_count == 0); Const2Complex += priorityDelegate(this, &PriorityEventTest::onConst2Complex, 0); Const2Complex -= priorityDelegate(this, &PriorityEventTest::onConst2Complex, 0); Const2Complex.notify(this, pArgs); - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(&PriorityEventTest::onStaticSimple, 0); Simple += priorityDelegate(&PriorityEventTest::onStaticSimple, 0); @@ -95,7 +95,7 @@ void PriorityEventTest::testNoDelegate() Simple += priorityDelegate(&PriorityEventTest::onStaticSimple3, 3); Simple.notify(this, tmp); - assert (_count == 4); + assertTrue (_count == 4); Simple -= priorityDelegate(PriorityEventTest::onStaticSimple, 0); @@ -104,7 +104,7 @@ void PriorityEventTest::testNoDelegate() Void += priorityDelegate(&PriorityEventTest::onStaticVoid, 1); Void.notify(this); - assert (_count == 7); + assertTrue (_count == 7); Void -= priorityDelegate(PriorityEventTest::onStaticVoid, 0); } @@ -113,49 +113,49 @@ void PriorityEventTest::testSingleDelegate() int tmp = 0; EventArgs args; - assert (_count == 0); + assertTrue (_count == 0); Void += priorityDelegate(this, &PriorityEventTest::onVoid, 0); // unregistering with a different priority --> different observer, is ignored Void -= priorityDelegate(this, &PriorityEventTest::onVoid, 3); Void.notify(this); - assert (_count == 1); + assertTrue (_count == 1); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 0); // unregistering with a different priority --> different observer, is ignored Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 3); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); ConstSimple += priorityDelegate(this, &PriorityEventTest::onConstSimple, 0); ConstSimple -= priorityDelegate(this, &PriorityEventTest::onConstSimple, 3); ConstSimple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); EventArgs* pArgs = &args; Complex += priorityDelegate(this, &PriorityEventTest::onComplex, 0); Complex -= priorityDelegate(this, &PriorityEventTest::onComplex, 3); Complex.notify(this, pArgs); - assert (_count == 4); + assertTrue (_count == 4); Complex2 += priorityDelegate(this, &PriorityEventTest::onComplex2, 0); Complex2 -= priorityDelegate(this, &PriorityEventTest::onComplex2, 3); Complex2.notify(this, args); - assert (_count == 5); + assertTrue (_count == 5); const EventArgs* pCArgs = &args; ConstComplex += priorityDelegate(this, &PriorityEventTest::onConstComplex, 0); ConstComplex -= priorityDelegate(this, &PriorityEventTest::onConstComplex, 3); ConstComplex.notify(this, pCArgs); - assert (_count == 6); + assertTrue (_count == 6); Const2Complex += priorityDelegate(this, &PriorityEventTest::onConst2Complex, 0); Const2Complex -= priorityDelegate(this, &PriorityEventTest::onConst2Complex, 3); Const2Complex.notify(this, pArgs); - assert (_count == 7); + assertTrue (_count == 7); // check if 2nd notify also works Const2Complex.notify(this, pArgs); - assert (_count == 8); + assertTrue (_count == 8); } @@ -163,22 +163,22 @@ void PriorityEventTest::testDuplicateRegister() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); Simple += priorityDelegate(this, &PriorityEventTest::onSimpleOther, 1); Simple.notify(this, tmp); - assert (_count == 4 + LARGEINC); + assertTrue (_count == 4 + LARGEINC); Simple -= priorityDelegate(this, &PriorityEventTest::onSimpleOther, 1); Simple.notify(this, tmp); - assert (_count == 5 + LARGEINC); + assertTrue (_count == 5 + LARGEINC); } void PriorityEventTest::testDuplicateUnregister() @@ -186,23 +186,23 @@ void PriorityEventTest::testDuplicateUnregister() // duplicate unregister shouldn't give an error, int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 0); // should work Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } @@ -210,22 +210,22 @@ void PriorityEventTest::testDisabling() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.disable(); Simple.notify(this, tmp); - assert (_count == 0); + assertTrue (_count == 0); Simple.enable(); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); // unregister should also work with disabled event Simple.disable(); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 0); Simple.enable(); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); } void PriorityEventTest::testPriorityOrder() @@ -233,14 +233,14 @@ void PriorityEventTest::testPriorityOrder() DummyDelegate o1; DummyDelegate o2; - assert (_count == 0); + assertTrue (_count == 0); Simple += PriorityDelegate(&o2, &DummyDelegate::onSimple2, 1); Simple += PriorityDelegate(&o1, &DummyDelegate::onSimple, 0); int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); Simple -= PriorityDelegate(&o1, &DummyDelegate::onSimple, 0); Simple -= PriorityDelegate(&o2, &DummyDelegate::onSimple2, 1); @@ -269,19 +269,19 @@ void PriorityEventTest::testPriorityOrderExpire() DummyDelegate o1; DummyDelegate o2; - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(&o2, &DummyDelegate::onSimple2, 1, 500000); Simple += priorityDelegate(&o1, &DummyDelegate::onSimple, 0, 500000); int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); // both ways of unregistering should work Simple -= priorityDelegate(&o1, &DummyDelegate::onSimple, 0, 500000); Simple -= priorityDelegate(&o2, &DummyDelegate::onSimple2, 1); Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); // now start mixing of expire and non expire tmp = 0; @@ -289,13 +289,13 @@ void PriorityEventTest::testPriorityOrderExpire() Simple += priorityDelegate(&o1, &DummyDelegate::onSimple, 0); Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); Simple -= priorityDelegate(&o2, &DummyDelegate::onSimple2, 1); // it is not forbidden to unregister a non expiring event with an expire decorator (it is just stupid ;-)) Simple -= priorityDelegate(&o1, &DummyDelegate::onSimple, 0, 500000); Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); // now try with the wrong order Simple += priorityDelegate(&o2, &DummyDelegate::onSimple2, 0, 500000); @@ -320,24 +320,24 @@ void PriorityEventTest::testExpire() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 1, 500); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Poco::Thread::sleep(700); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Simple -= priorityDelegate(this, &PriorityEventTest::onSimple, 1, 500); Simple += priorityDelegate(&PriorityEventTest::onStaticSimple, 1, 500); Simple += priorityDelegate(&PriorityEventTest::onStaticSimple2, 1, 500); Simple += priorityDelegate(&PriorityEventTest::onStaticSimple3, 1, 500); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); Poco::Thread::sleep(700); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } @@ -345,22 +345,22 @@ void PriorityEventTest::testExpireReRegister() { int tmp = 0; - assert (_count == 0); + assertTrue (_count == 0); Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 1, 500); Simple.notify(this, tmp); - assert (_count == 1); + assertTrue (_count == 1); Poco::Thread::sleep(200); Simple.notify(this, tmp); - assert (_count == 2); + assertTrue (_count == 2); // renew registration Simple += priorityDelegate(this, &PriorityEventTest::onSimple, 1, 600); Poco::Thread::sleep(400); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); Poco::Thread::sleep(300); Simple.notify(this, tmp); - assert (_count == 3); + assertTrue (_count == 3); } @@ -371,7 +371,7 @@ void PriorityEventTest::testReturnParams() int tmp = 0; Simple.notify(this, tmp); - assert (tmp == 1); + assertTrue (tmp == 1); } void PriorityEventTest::testOverwriteDelegate() @@ -382,22 +382,22 @@ void PriorityEventTest::testOverwriteDelegate() int tmp = 0; // onsimple requires 0 as input Simple.notify(this, tmp); - assert (tmp == 2); + assertTrue (tmp == 2); } void PriorityEventTest::testAsyncNotify() { Poco::PriorityEvent* pSimple= new Poco::PriorityEvent(); (*pSimple) += priorityDelegate(this, &PriorityEventTest::onAsync, 0); - assert (_count == 0); + assertTrue (_count == 0); int tmp = 0; Poco::ActiveResultretArg = pSimple->notifyAsync(this, tmp); delete pSimple; // must work even when the event got deleted! pSimple = NULL; - assert (_count == 0); + assertTrue (_count == 0); retArg.wait(); - assert (retArg.data() == tmp); - assert (_count == LARGEINC); + assertTrue (retArg.data() == tmp); + assertTrue (_count == LARGEINC); } diff --git a/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp b/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp index 507e8cfa8..0c8c62582 100644 --- a/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp +++ b/Foundation/testsuite/src/PriorityNotificationQueueTest.cpp @@ -60,49 +60,49 @@ PriorityNotificationQueueTest::~PriorityNotificationQueueTest() void PriorityNotificationQueueTest::testQueueDequeue() { PriorityNotificationQueue queue; - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); Notification* pNf = queue.dequeueNotification(); assertNullPtr(pNf); queue.enqueueNotification(new Notification, 1); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pNf = queue.dequeueNotification(); assertNotNullPtr(pNf); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); pNf->release(); queue.enqueueNotification(new QTestNotification("first"), 1); queue.enqueueNotification(new QTestNotification("fourth"), 4); queue.enqueueNotification(new QTestNotification("third"), 3); queue.enqueueNotification(new QTestNotification("second"), 2); - assert (!queue.empty()); - assert (queue.size() == 4); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 4); QTestNotification* pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "first"); + assertTrue (pTNf->data() == "first"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 3); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 3); pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "second"); + assertTrue (pTNf->data() == "second"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.dequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "fourth"); + assertTrue (pTNf->data() == "fourth"); pTNf->release(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); pNf = queue.dequeueNotification(); assertNullPtr(pNf); @@ -114,20 +114,20 @@ void PriorityNotificationQueueTest::testWaitDequeue() PriorityNotificationQueue queue; queue.enqueueNotification(new QTestNotification("third"), 3); queue.enqueueNotification(new QTestNotification("fourth"), 4); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); QTestNotification* pTNf = dynamic_cast(queue.waitDequeueNotification(10)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.waitDequeueNotification(10)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "fourth"); + assertTrue (pTNf->data() == "fourth"); pTNf->release(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); Notification* pNf = queue.waitDequeueNotification(10); assertNullPtr(pNf); @@ -156,18 +156,18 @@ void PriorityNotificationQueueTest::testThreads() t1.join(); t2.join(); t3.join(); - assert (_handled.size() == NOTIFICATION_COUNT); - assert (_handled.count("thread1") > 0); - assert (_handled.count("thread2") > 0); - assert (_handled.count("thread3") > 0); + assertTrue (_handled.size() == NOTIFICATION_COUNT); + assertTrue (_handled.count("thread1") > 0); + assertTrue (_handled.count("thread2") > 0); + assertTrue (_handled.count("thread3") > 0); } void PriorityNotificationQueueTest::testDefaultQueue() { PriorityNotificationQueue& queue = PriorityNotificationQueue::defaultQueue(); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); } diff --git a/Foundation/testsuite/src/ProcessTest.cpp b/Foundation/testsuite/src/ProcessTest.cpp index bcf8e8812..9f571a3cd 100644 --- a/Foundation/testsuite/src/ProcessTest.cpp +++ b/Foundation/testsuite/src/ProcessTest.cpp @@ -58,7 +58,7 @@ void ProcessTest::testLaunch() args.push_back("arg3"); ProcessHandle ph = Process::launch(cmd, args); int rc = ph.wait(); - assert (rc == 3); + assertTrue (rc == 3); } @@ -86,7 +86,7 @@ void ProcessTest::testLaunchRedirectIn() ostr << std::string(100, 'x'); ostr.close(); int rc = ph.wait(); - assert (rc == 100); + assertTrue (rc == 100); #endif // !defined(_WIN32_WCE) } @@ -115,9 +115,9 @@ void ProcessTest::testLaunchRedirectOut() std::string s; int c = istr.get(); while (c != -1) { s += (char) c; c = istr.get(); } - assert (s == "Hello, world!"); + assertTrue (s == "Hello, world!"); int rc = ph.wait(); - assert (rc == 1); + assertTrue (rc == 1); #endif // !defined(_WIN32_WCE) } @@ -148,9 +148,9 @@ void ProcessTest::testLaunchEnv() std::string s; int c = istr.get(); while (c != -1) { s += (char) c; c = istr.get(); } - assert (s == "test"); + assertTrue (s == "test"); int rc = ph.wait(); - assert (rc == 0); + assertTrue (rc == 0); #endif // !defined(_WIN32_WCE) } @@ -186,12 +186,12 @@ void ProcessTest::testLaunchArgs() { if ('\n' == c) { - assert(argNumber < args.size()); + assertTrue (argNumber < args.size()); std::string expectedArg = args[argNumber]; if (expectedArg.npos != expectedArg.find("already quoted")) { expectedArg = "already quoted \" \\"; } - assert(receivedArg == expectedArg); + assertTrue (receivedArg == expectedArg); ++argNumber; receivedArg = ""; } @@ -201,9 +201,9 @@ void ProcessTest::testLaunchArgs() } c = istr.get(); } - assert(argNumber == args.size()); + assertTrue (argNumber == args.size()); int rc = ph.wait(); - assert(rc == args.size()); + assertTrue (rc == args.size()); #endif // !defined(_WIN32_WCE) } @@ -229,14 +229,14 @@ void ProcessTest::testIsRunning() Pipe inPipe; ProcessHandle ph = Process::launch(cmd, args, &inPipe, 0, 0); Process::PID id = ph.id(); - assert (Process::isRunning(ph)); - assert (Process::isRunning(id)); + assertTrue (Process::isRunning(ph)); + assertTrue (Process::isRunning(id)); PipeOutputStream ostr(inPipe); ostr << std::string(100, 'x'); ostr.close(); int POCO_UNUSED rc = ph.wait(); - assert (!Process::isRunning(ph)); - assert (!Process::isRunning(id)); + assertTrue (!Process::isRunning(ph)); + assertTrue (!Process::isRunning(id)); #endif // !defined(_WIN32_WCE) } diff --git a/Foundation/testsuite/src/RWLockTest.cpp b/Foundation/testsuite/src/RWLockTest.cpp index de099f642..9efe26317 100644 --- a/Foundation/testsuite/src/RWLockTest.cpp +++ b/Foundation/testsuite/src/RWLockTest.cpp @@ -154,12 +154,12 @@ void RWLockTest::testLock() t3.join(); t4.join(); t5.join(); - assert (counter == 50000); - assert (r1.ok()); - assert (r2.ok()); - assert (r3.ok()); - assert (r4.ok()); - assert (r5.ok()); + assertTrue (counter == 50000); + assertTrue (r1.ok()); + assertTrue (r2.ok()); + assertTrue (r3.ok()); + assertTrue (r4.ok()); + assertTrue (r5.ok()); #endif // defined(ENABLE_LONG_RUNNING_TESTS) } @@ -189,12 +189,12 @@ void RWLockTest::testTryLock() t3.join(); t4.join(); t5.join(); - assert (counter == 50000); - assert (r1.ok()); - assert (r2.ok()); - assert (r3.ok()); - assert (r4.ok()); - assert (r5.ok()); + assertTrue (counter == 50000); + assertTrue (r1.ok()); + assertTrue (r2.ok()); + assertTrue (r3.ok()); + assertTrue (r4.ok()); + assertTrue (r5.ok()); #endif // defined(ENABLE_LONG_RUNNING_TESTS) } diff --git a/Foundation/testsuite/src/RandomStreamTest.cpp b/Foundation/testsuite/src/RandomStreamTest.cpp index c2ba8b47e..73ba555e4 100644 --- a/Foundation/testsuite/src/RandomStreamTest.cpp +++ b/Foundation/testsuite/src/RandomStreamTest.cpp @@ -50,8 +50,8 @@ void RandomStreamTest::testStream() var /= n; int sd = int(std::sqrt((double) var)); - assert (110 < avg && avg < 140); - assert (sd < 20); + assertTrue (110 < avg && avg < 140); + assertTrue (sd < 20); } diff --git a/Foundation/testsuite/src/RandomTest.cpp b/Foundation/testsuite/src/RandomTest.cpp index 33b1fc9b6..0d9ba5aed 100644 --- a/Foundation/testsuite/src/RandomTest.cpp +++ b/Foundation/testsuite/src/RandomTest.cpp @@ -37,7 +37,7 @@ void RandomTest::testSequence1() rnd2.seed(12345); for (int i = 0; i < 100; ++i) { - assert (rnd1.next() == rnd2.next()); + assertTrue (rnd1.next() == rnd2.next()); } } @@ -58,7 +58,7 @@ void RandomTest::testSequence2() break; } } - assert (!equals); + assertTrue (!equals); } @@ -75,7 +75,7 @@ void RandomTest::testDistribution1() int sum = 0; for (int k = 0; k < n; ++k) sum += d[k]; - assert (sum == n); + assertTrue (sum == n); } @@ -97,8 +97,8 @@ void RandomTest::testDistribution2() var /= n; int sd = int(std::sqrt((double) var)); - assert (95 < avg && avg < 105); - assert (sd < 15); + assertTrue (95 < avg && avg < 105); + assertTrue (sd < 15); } @@ -120,8 +120,8 @@ void RandomTest::testDistribution3() var /= n; int sd = int(std::sqrt((double) var)); - assert (95 < avg && avg < 105); - assert (sd < 15); + assertTrue (95 < avg && avg < 105); + assertTrue (sd < 15); } diff --git a/Foundation/testsuite/src/RegularExpressionTest.cpp b/Foundation/testsuite/src/RegularExpressionTest.cpp index 345c67dfc..921b9a226 100644 --- a/Foundation/testsuite/src/RegularExpressionTest.cpp +++ b/Foundation/testsuite/src/RegularExpressionTest.cpp @@ -33,18 +33,18 @@ void RegularExpressionTest::testIndex() { RegularExpression re("[0-9]+"); RegularExpression::Match match; - assert (re.match("", 0, match) == 0); - assert (re.match("123", 3, match) == 0); + assertTrue (re.match("", 0, match) == 0); + assertTrue (re.match("123", 3, match) == 0); } void RegularExpressionTest::testMatch1() { RegularExpression re("[0-9]+"); - assert (re.match("123")); - assert (!re.match("123cd")); - assert (!re.match("abcde")); - assert (re.match("ab123", 2)); + assertTrue (re.match("123")); + assertTrue (!re.match("123cd")); + assertTrue (!re.match("abcde")); + assertTrue (re.match("ab123", 2)); } @@ -52,21 +52,21 @@ void RegularExpressionTest::testMatch2() { RegularExpression re("[0-9]+"); RegularExpression::Match match; - assert (re.match("123", 0, match) == 1); - assert (match.offset == 0); - assert (match.length == 3); + assertTrue (re.match("123", 0, match) == 1); + assertTrue (match.offset == 0); + assertTrue (match.length == 3); - assert (re.match("abc123def", 0, match) == 1); - assert (match.offset == 3); - assert (match.length == 3); + assertTrue (re.match("abc123def", 0, match) == 1); + assertTrue (match.offset == 3); + assertTrue (match.length == 3); - assert (re.match("abcdef", 0, match) == 0); - assert (match.offset == std::string::npos); - assert (match.length == 0); + assertTrue (re.match("abcdef", 0, match) == 0); + assertTrue (match.offset == std::string::npos); + assertTrue (match.length == 0); - assert (re.match("abc123def", 3, match) == 1); - assert (match.offset == 3); - assert (match.length == 3); + assertTrue (re.match("abc123def", 3, match) == 1); + assertTrue (match.offset == 3); + assertTrue (match.length == 3); } @@ -74,23 +74,23 @@ void RegularExpressionTest::testMatch3() { RegularExpression re("[0-9]+"); RegularExpression::MatchVec match; - assert (re.match("123", 0, match) == 1); - assert (match.size() == 1); - assert (match[0].offset == 0); - assert (match[0].length == 3); + assertTrue (re.match("123", 0, match) == 1); + assertTrue (match.size() == 1); + assertTrue (match[0].offset == 0); + assertTrue (match[0].length == 3); - assert (re.match("abc123def", 0, match) == 1); - assert (match.size() == 1); - assert (match[0].offset == 3); - assert (match[0].length == 3); + assertTrue (re.match("abc123def", 0, match) == 1); + assertTrue (match.size() == 1); + assertTrue (match[0].offset == 3); + assertTrue (match[0].length == 3); - assert (re.match("abcdef", 0, match) == 0); - assert (match.size() == 0); + assertTrue (re.match("abcdef", 0, match) == 0); + assertTrue (match.size() == 0); - assert (re.match("abc123def", 3, match) == 1); - assert (match.size() == 1); - assert (match[0].offset == 3); - assert (match[0].length == 3); + assertTrue (re.match("abc123def", 3, match) == 1); + assertTrue (match.size() == 1); + assertTrue (match[0].offset == 3); + assertTrue (match[0].length == 3); } @@ -98,41 +98,41 @@ void RegularExpressionTest::testMatch4() { RegularExpression re("([0-9]+) ([0-9]+)"); RegularExpression::MatchVec matches; - assert (re.match("123 456", 0, matches) == 3); - assert (matches.size() == 3); - assert (matches[0].offset == 0); - assert (matches[0].length == 7); - assert (matches[1].offset == 0); - assert (matches[1].length == 3); - assert (matches[2].offset == 4); - assert (matches[2].length == 3); + assertTrue (re.match("123 456", 0, matches) == 3); + assertTrue (matches.size() == 3); + assertTrue (matches[0].offset == 0); + assertTrue (matches[0].length == 7); + assertTrue (matches[1].offset == 0); + assertTrue (matches[1].length == 3); + assertTrue (matches[2].offset == 4); + assertTrue (matches[2].length == 3); - assert (re.match("abc123 456def", 0, matches) == 3); - assert (matches.size() == 3); - assert (matches[0].offset == 3); - assert (matches[0].length == 7); - assert (matches[1].offset == 3); - assert (matches[1].length == 3); - assert (matches[2].offset == 7); - assert (matches[2].length == 3); + assertTrue (re.match("abc123 456def", 0, matches) == 3); + assertTrue (matches.size() == 3); + assertTrue (matches[0].offset == 3); + assertTrue (matches[0].length == 7); + assertTrue (matches[1].offset == 3); + assertTrue (matches[1].length == 3); + assertTrue (matches[2].offset == 7); + assertTrue (matches[2].length == 3); } void RegularExpressionTest::testMatch5() { std::string digits = "0123"; - assert (RegularExpression::match(digits, "[0-9]+")); + assertTrue (RegularExpression::match(digits, "[0-9]+")); std::string alphas = "abcd"; - assert (!RegularExpression::match(alphas, "[0-9]+")); + assertTrue (!RegularExpression::match(alphas, "[0-9]+")); } void RegularExpressionTest::testMatch6() { RegularExpression expr("^([a-z]*)?$"); - assert (expr.match("", 0, 0)); - assert (expr.match("abcde", 0, 0)); - assert (!expr.match("123", 0, 0)); + assertTrue (expr.match("", 0, 0)); + assertTrue (expr.match("abcde", 0, 0)); + assertTrue (!expr.match("123", 0, 0)); } @@ -140,17 +140,17 @@ void RegularExpressionTest::testExtract() { RegularExpression re("[0-9]+"); std::string str; - assert (re.extract("123", str) == 1); - assert (str == "123"); + assertTrue (re.extract("123", str) == 1); + assertTrue (str == "123"); - assert (re.extract("abc123def", 0, str) == 1); - assert (str == "123"); + assertTrue (re.extract("abc123def", 0, str) == 1); + assertTrue (str == "123"); - assert (re.extract("abcdef", 0, str) == 0); - assert (str == ""); + assertTrue (re.extract("abcdef", 0, str) == 0); + assertTrue (str == ""); - assert (re.extract("abc123def", 3, str) == 1); - assert (str == "123"); + assertTrue (re.extract("abc123def", 3, str) == 1); + assertTrue (str == "123"); } @@ -158,20 +158,20 @@ void RegularExpressionTest::testSplit1() { RegularExpression re("[0-9]+"); std::vector strings; - assert (re.split("123", 0, strings) == 1); - assert (strings.size() == 1); - assert (strings[0] == "123"); + assertTrue (re.split("123", 0, strings) == 1); + assertTrue (strings.size() == 1); + assertTrue (strings[0] == "123"); - assert (re.split("abc123def", 0, strings) == 1); - assert (strings.size() == 1); - assert (strings[0] == "123"); + assertTrue (re.split("abc123def", 0, strings) == 1); + assertTrue (strings.size() == 1); + assertTrue (strings[0] == "123"); - assert (re.split("abcdef", 0, strings) == 0); - assert (strings.empty()); + assertTrue (re.split("abcdef", 0, strings) == 0); + assertTrue (strings.empty()); - assert (re.split("abc123def", 3, strings) == 1); - assert (strings.size() == 1); - assert (strings[0] == "123"); + assertTrue (re.split("abc123def", 3, strings) == 1); + assertTrue (strings.size() == 1); + assertTrue (strings[0] == "123"); } @@ -179,17 +179,17 @@ void RegularExpressionTest::testSplit2() { RegularExpression re("([0-9]+) ([0-9]+)"); std::vector strings; - assert (re.split("123 456", 0, strings) == 3); - assert (strings.size() == 3); - assert (strings[0] == "123 456"); - assert (strings[1] == "123"); - assert (strings[2] == "456"); + assertTrue (re.split("123 456", 0, strings) == 3); + assertTrue (strings.size() == 3); + assertTrue (strings[0] == "123 456"); + assertTrue (strings[1] == "123"); + assertTrue (strings[2] == "456"); - assert (re.split("abc123 456def", 0, strings) == 3); - assert (strings.size() == 3); - assert (strings[0] == "123 456"); - assert (strings[1] == "123"); - assert (strings[2] == "456"); + assertTrue (re.split("abc123 456def", 0, strings) == 3); + assertTrue (strings.size() == 3); + assertTrue (strings[0] == "123 456"); + assertTrue (strings[1] == "123"); + assertTrue (strings[2] == "456"); } @@ -197,29 +197,29 @@ void RegularExpressionTest::testSubst1() { RegularExpression re("[0-9]+"); std::string s = "123"; - assert (re.subst(s, "ABC") == 1); - assert (s == "ABC"); - assert (re.subst(s, "123") == 0); + assertTrue (re.subst(s, "ABC") == 1); + assertTrue (s == "ABC"); + assertTrue (re.subst(s, "123") == 0); s = "123"; - assert (re.subst(s, "AB$0CD") == 1); - assert (s == "AB123CD"); + assertTrue (re.subst(s, "AB$0CD") == 1); + assertTrue (s == "AB123CD"); s = "123"; - assert (re.subst(s, "AB$1CD") == 1); - assert (s == "ABCD"); + assertTrue (re.subst(s, "AB$1CD") == 1); + assertTrue (s == "ABCD"); s = "123"; - assert (re.subst(s, "AB$2CD") == 1); - assert (s == "ABCD"); + assertTrue (re.subst(s, "AB$2CD") == 1); + assertTrue (s == "ABCD"); s = "123"; - assert (re.subst(s, "AB$$CD") == 1); - assert (s == "AB$$CD"); + assertTrue (re.subst(s, "AB$$CD") == 1); + assertTrue (s == "AB$$CD"); s = "123"; - assert (re.subst(s, "AB$0CD", RegularExpression::RE_NO_VARS) == 1); - assert (s == "AB$0CD"); + assertTrue (re.subst(s, "AB$0CD", RegularExpression::RE_NO_VARS) == 1); + assertTrue (s == "AB$0CD"); } @@ -227,8 +227,8 @@ void RegularExpressionTest::testSubst2() { RegularExpression re("([0-9]+) ([0-9]+)"); std::string s = "123 456"; - assert (re.subst(s, "$2-$1") == 1); - assert (s == "456-123"); + assertTrue (re.subst(s, "$2-$1") == 1); + assertTrue (s == "456-123"); } @@ -236,8 +236,8 @@ void RegularExpressionTest::testSubst3() { RegularExpression re("[0-9]+"); std::string s = "123 456 789"; - assert (re.subst(s, "n", RegularExpression::RE_GLOBAL) == 3); - assert (s == "n n n"); + assertTrue (re.subst(s, "n", RegularExpression::RE_GLOBAL) == 3); + assertTrue (s == "n n n"); } @@ -245,8 +245,8 @@ void RegularExpressionTest::testSubst4() { RegularExpression re("[0-9]+"); std::string s = "ABC 123 456 789 DEF"; - assert (re.subst(s, "n", RegularExpression::RE_GLOBAL) == 3); - assert (s == "ABC n n n DEF"); + assertTrue (re.subst(s, "n", RegularExpression::RE_GLOBAL) == 3); + assertTrue (s == "ABC n n n DEF"); } diff --git a/Foundation/testsuite/src/SHA1EngineTest.cpp b/Foundation/testsuite/src/SHA1EngineTest.cpp index 1a8c64b13..2a0fba933 100644 --- a/Foundation/testsuite/src/SHA1EngineTest.cpp +++ b/Foundation/testsuite/src/SHA1EngineTest.cpp @@ -35,14 +35,14 @@ void SHA1EngineTest::testSHA1() // test vectors from FIPS 180-1 engine.update("abc"); - assert (DigestEngine::digestToHex(engine.digest()) == "a9993e364706816aba3e25717850c26c9cd0d89d"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "a9993e364706816aba3e25717850c26c9cd0d89d"); engine.update("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"); - assert (DigestEngine::digestToHex(engine.digest()) == "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); for (int i = 0; i < 1000000; ++i) engine.update('a'); - assert (DigestEngine::digestToHex(engine.digest()) == "34aa973cd4c4daa4f61eeb2bdbad27316534016f"); + assertTrue (DigestEngine::digestToHex(engine.digest()) == "34aa973cd4c4daa4f61eeb2bdbad27316534016f"); } diff --git a/Foundation/testsuite/src/SemaphoreTest.cpp b/Foundation/testsuite/src/SemaphoreTest.cpp index 202d4ab06..e6f958fa7 100644 --- a/Foundation/testsuite/src/SemaphoreTest.cpp +++ b/Foundation/testsuite/src/SemaphoreTest.cpp @@ -80,7 +80,7 @@ SemaphoreTest::~SemaphoreTest() void SemaphoreTest::testInitZero() { SemaRunnable r(0, 3); - assert (!r.tryWait(10)); + assertTrue (!r.tryWait(10)); r.set(); r.wait(); try @@ -97,18 +97,18 @@ void SemaphoreTest::testInitZero() } r.set(); r.set(); - assert (r.tryWait(0)); + assertTrue (r.tryWait(0)); r.wait(); - assert (!r.tryWait(10)); + assertTrue (!r.tryWait(10)); Thread t; t.start(r); Thread::sleep(100); - assert (!r.ran()); + assertTrue (!r.ran()); r.set(); t.join(); - assert (r.ran()); - assert (!r.tryWait(10)); + assertTrue (r.ran()); + assertTrue (!r.tryWait(10)); } @@ -116,11 +116,11 @@ void SemaphoreTest::testInitNonZero() { SemaRunnable r(2, 2); r.wait(); - assert (r.tryWait(10)); - assert (!r.tryWait(10)); + assertTrue (r.tryWait(10)); + assertTrue (!r.tryWait(10)); r.set(); - assert (r.tryWait(10)); - assert (!r.tryWait(10)); + assertTrue (r.tryWait(10)); + assertTrue (!r.tryWait(10)); } diff --git a/Foundation/testsuite/src/SharedLibraryTest.cpp b/Foundation/testsuite/src/SharedLibraryTest.cpp index 41cf4696b..8227d3444 100644 --- a/Foundation/testsuite/src/SharedLibraryTest.cpp +++ b/Foundation/testsuite/src/SharedLibraryTest.cpp @@ -39,15 +39,15 @@ void SharedLibraryTest::testSharedLibrary1() std::string path = "TestLibrary"; path.append(SharedLibrary::suffix()); SharedLibrary sl; - assert (!sl.isLoaded()); + assertTrue (!sl.isLoaded()); sl.load(path); - assert (sl.getPath() == path); - assert (sl.isLoaded()); - assert (sl.hasSymbol("pocoBuildManifest")); - assert (sl.hasSymbol("pocoInitializeLibrary")); - assert (sl.hasSymbol("pocoUninitializeLibrary")); - assert (sl.hasSymbol("gimmeFive")); - assert (!sl.hasSymbol("fooBar123")); + assertTrue (sl.getPath() == path); + assertTrue (sl.isLoaded()); + assertTrue (sl.hasSymbol("pocoBuildManifest")); + assertTrue (sl.hasSymbol("pocoInitializeLibrary")); + assertTrue (sl.hasSymbol("pocoUninitializeLibrary")); + assertTrue (sl.hasSymbol("gimmeFive")); + assertTrue (!sl.hasSymbol("fooBar123")); void* p1 = sl.getSymbol("pocoBuildManifest"); assertNotNullPtr(p1); @@ -64,7 +64,7 @@ void SharedLibraryTest::testSharedLibrary1() failmsg("wrong exception"); } sl.unload(); - assert (!sl.isLoaded()); + assertTrue (!sl.isLoaded()); } @@ -73,14 +73,14 @@ void SharedLibraryTest::testSharedLibrary2() std::string path = "TestLibrary"; path.append(SharedLibrary::suffix()); SharedLibrary sl(path); - assert (sl.getPath() == path); - assert (sl.isLoaded()); + assertTrue (sl.getPath() == path); + assertTrue (sl.isLoaded()); GimmeFiveFunc gimmeFive = (GimmeFiveFunc) sl.getSymbol("gimmeFive"); - assert (gimmeFive() == 5); + assertTrue (gimmeFive() == 5); sl.unload(); - assert (!sl.isLoaded()); + assertTrue (!sl.isLoaded()); } @@ -101,12 +101,12 @@ void SharedLibraryTest::testSharedLibrary3() { failmsg("wrong exception"); } - assert (!sl.isLoaded()); + assertTrue (!sl.isLoaded()); path = "TestLibrary"; path.append(SharedLibrary::suffix()); sl.load(path); - assert (sl.isLoaded()); + assertTrue (sl.isLoaded()); try { @@ -120,10 +120,10 @@ void SharedLibraryTest::testSharedLibrary3() { failmsg("wrong exception"); } - assert (sl.isLoaded()); + assertTrue (sl.isLoaded()); sl.unload(); - assert (!sl.isLoaded()); + assertTrue (!sl.isLoaded()); } diff --git a/Foundation/testsuite/src/SharedMemoryTest.cpp b/Foundation/testsuite/src/SharedMemoryTest.cpp index fb8e4b6b3..c1a9b86fa 100644 --- a/Foundation/testsuite/src/SharedMemoryTest.cpp +++ b/Foundation/testsuite/src/SharedMemoryTest.cpp @@ -32,7 +32,7 @@ SharedMemoryTest::~SharedMemoryTest() void SharedMemoryTest::testCreate() { SharedMemory mem("hi", 4096, SharedMemory::AM_WRITE); - assert (mem.end()- mem.begin() == 4096); + assertTrue (mem.end()- mem.begin() == 4096); mem.begin()[0] = 'A'; mem.end()[-1] = 'Z'; } @@ -42,12 +42,12 @@ void SharedMemoryTest::testCreateFromFile() { Poco::Path p = findDataFile("testdata.txt"); Poco::File f(p); - assert (f.exists() && f.isFile()); + assertTrue (f.exists() && f.isFile()); SharedMemory mem(f, SharedMemory::AM_READ); - assert (mem.end() > mem.begin()); // valid? - assert (mem.end() - mem.begin() == f.getSize()); - assert (mem.begin()[0] == 'A'); - assert (mem.end()[-5] == 'Z'); + assertTrue (mem.end() > mem.begin()); // valid? + assertTrue (mem.end() - mem.begin() == f.getSize()); + assertTrue (mem.begin()[0] == 'A'); + assertTrue (mem.end()[-5] == 'Z'); } diff --git a/Foundation/testsuite/src/SharedPtrTest.cpp b/Foundation/testsuite/src/SharedPtrTest.cpp index 229342014..d42c8bcd4 100644 --- a/Foundation/testsuite/src/SharedPtrTest.cpp +++ b/Foundation/testsuite/src/SharedPtrTest.cpp @@ -91,70 +91,70 @@ void SharedPtrTest::testSharedPtr() pTO1 = pTO2; pTO2 = pTmp; } - assert (pTO1 < pTO2); + assertTrue (pTO1 < pTO2); ptr1 = pTO1; - assert (ptr1.referenceCount() == 1); + assertTrue (ptr1.referenceCount() == 1); SharedPtr ptr2 = pTO2; SharedPtr ptr3 = ptr1; - assert (ptr1.referenceCount() == 2); + assertTrue (ptr1.referenceCount() == 2); SharedPtr ptr4; - assert (ptr1.get() == pTO1); - assert (ptr1 == pTO1); - assert (ptr2.get() == pTO2); - assert (ptr2 == pTO2); - assert (ptr3.get() == pTO1); - assert (ptr3 == pTO1); + assertTrue (ptr1.get() == pTO1); + assertTrue (ptr1 == pTO1); + assertTrue (ptr2.get() == pTO2); + assertTrue (ptr2 == pTO2); + assertTrue (ptr3.get() == pTO1); + assertTrue (ptr3 == pTO1); - assert (ptr1 == pTO1); - assert (ptr1 != pTO2); - assert (ptr1 < pTO2); - assert (ptr1 <= pTO2); - assert (ptr2 > pTO1); - assert (ptr2 >= pTO1); + assertTrue (ptr1 == pTO1); + assertTrue (ptr1 != pTO2); + assertTrue (ptr1 < pTO2); + assertTrue (ptr1 <= pTO2); + assertTrue (ptr2 > pTO1); + assertTrue (ptr2 >= pTO1); - assert (ptr1 == ptr3); - assert (ptr1 != ptr2); - assert (ptr1 < ptr2); - assert (ptr1 <= ptr2); - assert (ptr2 > ptr1); - assert (ptr2 >= ptr1); + assertTrue (ptr1 == ptr3); + assertTrue (ptr1 != ptr2); + assertTrue (ptr1 < ptr2); + assertTrue (ptr1 <= ptr2); + assertTrue (ptr2 > ptr1); + assertTrue (ptr2 >= ptr1); ptr1.swap(ptr2); - assert (ptr2 < ptr1); + assertTrue (ptr2 < ptr1); ptr2.swap(ptr1); - assert ((ptr1->data() == "one" && ptr2->data() == "two") || (ptr1->data() == "two" && ptr2->data() == "one")); + assertTrue ((ptr1->data() == "one" && ptr2->data() == "two") || (ptr1->data() == "two" && ptr2->data() == "one")); try { - assert (ptr4->data() == "four"); + assertTrue (ptr4->data() == "four"); fail ("must throw NullPointerException"); } catch (NullPointerException&) { } - assert (!(ptr4 == ptr1)); - assert (!(ptr4 == ptr2)); - assert (ptr4 != ptr1); - assert (ptr4 != ptr2); + assertTrue (!(ptr4 == ptr1)); + assertTrue (!(ptr4 == ptr2)); + assertTrue (ptr4 != ptr1); + assertTrue (ptr4 != ptr2); ptr4 = ptr2; - assert (ptr4 == ptr2); - assert (!(ptr4 != ptr2)); + assertTrue (ptr4 == ptr2); + assertTrue (!(ptr4 != ptr2)); - assert (TestObject::count() == 2); + assertTrue (TestObject::count() == 2); ptr1 = 0; ptr2 = 0; ptr3 = 0; ptr4 = 0; - assert (TestObject::count() == 0); + assertTrue (TestObject::count() == 0); { SharedPtr ptr = new TestObject(""); - assert (TestObject::count() == 1); + assertTrue (TestObject::count() == 1); } - assert (TestObject::count() == 0); + assertTrue (TestObject::count() == 0); } @@ -168,15 +168,15 @@ void SharedPtrTest::testImplicitCast() } { SharedPtr ptr2(new DerivedObject("test", 666)); - assert (TestObject::count() == 1); + assertTrue (TestObject::count() == 1); SharedPtr ptr1 = ptr2; - assert (TestObject::count() == 1); + assertTrue (TestObject::count() == 1); } - assert (TestObject::count() == 0); + assertTrue (TestObject::count() == 0); SharedPtr ptr1 = new DerivedObject("test", 666); - assert (TestObject::count() == 1); + assertTrue (TestObject::count() == 1); ptr1 = 0; - assert (TestObject::count() == 0); + assertTrue (TestObject::count() == 0); } @@ -184,14 +184,14 @@ void SharedPtrTest::testExplicitCast() { SharedPtr ptr1 = new DerivedObject("test", 666); SharedPtr ptr2 = ptr1.cast(); - assert (ptr2.get() != 0); + assertTrue (ptr2.get() != 0); // cast the other way round must fail ptr1 = new TestObject("test"); - assert (TestObject::count() == 2); + assertTrue (TestObject::count() == 2); ptr2 = ptr1.cast(); - assert (TestObject::count() == 1); - assert (ptr2.get() == 0); + assertTrue (TestObject::count() == 1); + assertTrue (ptr2.get() == 0); } diff --git a/Foundation/testsuite/src/SimpleFileChannelTest.cpp b/Foundation/testsuite/src/SimpleFileChannelTest.cpp index c0b6c67c4..cb83a4854 100644 --- a/Foundation/testsuite/src/SimpleFileChannelTest.cpp +++ b/Foundation/testsuite/src/SimpleFileChannelTest.cpp @@ -55,10 +55,10 @@ void SimpleFileChannelTest::testRotate() pChannel->log(msg); } File f(name); - assert (f.exists()); + assertTrue (f.exists()); f = name + ".0"; - assert (f.exists()); - assert (f.getSize() >= 2048); + assertTrue (f.exists()); + assertTrue (f.getSize() >= 2048); } catch (...) { diff --git a/Foundation/testsuite/src/SimpleHashTableTest.cpp b/Foundation/testsuite/src/SimpleHashTableTest.cpp index c76584ee0..0197ebfdd 100644 --- a/Foundation/testsuite/src/SimpleHashTableTest.cpp +++ b/Foundation/testsuite/src/SimpleHashTableTest.cpp @@ -33,14 +33,14 @@ void SimpleHashTableTest::testInsert() std::string s1("str1"); std::string s2("str2"); SimpleHashTable hashTable; - assert (!hashTable.exists(s1)); + assertTrue (!hashTable.exists(s1)); hashTable.insert(s1, 13); - assert (hashTable.exists(s1)); - assert (hashTable.get(s1) == 13); + assertTrue (hashTable.exists(s1)); + assertTrue (hashTable.get(s1) == 13); int retVal = 0; - assert (hashTable.get(s1, retVal)); - assert (retVal == 13); + assertTrue (hashTable.get(s1, retVal)); + assertTrue (retVal == 13); try { hashTable.insert(s1, 22); @@ -54,9 +54,9 @@ void SimpleHashTableTest::testInsert() } catch (Exception&){} - assert (!hashTable.exists(s2)); + assertTrue (!hashTable.exists(s2)); hashTable.insert(s2, 13); - assert (hashTable.exists(s2)); + assertTrue (hashTable.exists(s2)); } @@ -68,16 +68,16 @@ void SimpleHashTableTest::testUpdate() SimpleHashTable hashTable; hashTable.insert(s1, 13); hashTable.update(s1, 14); - assert (hashTable.exists(s1)); - assert (hashTable.get(s1) == 14); + assertTrue (hashTable.exists(s1)); + assertTrue (hashTable.get(s1) == 14); int retVal = 0; - assert (hashTable.get(s1, retVal)); - assert (retVal == 14); + assertTrue (hashTable.get(s1, retVal)); + assertTrue (retVal == 14); // updating a non existing item must work too hashTable.update(s2, 15); - assert (hashTable.get(s2) == 15); + assertTrue (hashTable.get(s2) == 15); } @@ -92,8 +92,8 @@ void SimpleHashTableTest::testOverflow() for (int i = 0; i < 31; ++i) { std::string tmp = Poco::NumberFormatter::format(i); - assert (hashTable.exists(tmp)); - assert (hashTable.get(tmp) == i*i); + assertTrue (hashTable.exists(tmp)); + assertTrue (hashTable.get(tmp) == i*i); } } @@ -101,20 +101,20 @@ void SimpleHashTableTest::testOverflow() void SimpleHashTableTest::testSize() { SimpleHashTable hashTable(13); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); Poco::UInt32 POCO_UNUSED h1 = hashTable.insert("1", 1); - assert (hashTable.size() == 1); + assertTrue (hashTable.size() == 1); Poco::UInt32 POCO_UNUSED h2 = hashTable.update("2", 2); - assert (hashTable.size() == 2); + assertTrue (hashTable.size() == 2); hashTable.clear(); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); } void SimpleHashTableTest::testResize() { SimpleHashTable hashTable(13); - assert (hashTable.size() == 0); + assertTrue (hashTable.size() == 0); hashTable.resize(2467); for (int i = 0; i < 1024; ++i) { @@ -125,8 +125,8 @@ void SimpleHashTableTest::testResize() for (int i = 0; i < 1024; ++i) { std::string tmp = Poco::NumberFormatter::format(i); - assert (hashTable.exists(tmp)); - assert (hashTable.get(tmp) == i*i); + assertTrue (hashTable.exists(tmp)); + assertTrue (hashTable.get(tmp) == i*i); } } diff --git a/Foundation/testsuite/src/StopwatchTest.cpp b/Foundation/testsuite/src/StopwatchTest.cpp index 76b212764..9aa05c537 100644 --- a/Foundation/testsuite/src/StopwatchTest.cpp +++ b/Foundation/testsuite/src/StopwatchTest.cpp @@ -38,21 +38,21 @@ void StopwatchTest::testStopwatch() Thread::sleep(200); sw.stop(); Timestamp::TimeDiff d = sw.elapsed(); - assert (d >= 180000 && d <= 300000); + assertTrue (d >= 180000 && d <= 300000); sw.start(); Thread::sleep(100); d = sw.elapsed(); - assert (d >= 280000 && d <= 400000); + assertTrue (d >= 280000 && d <= 400000); Thread::sleep(100); sw.stop(); d = sw.elapsed(); - assert (d >= 380000 && d <= 500000); + assertTrue (d >= 380000 && d <= 500000); sw.reset(); sw.start(); Thread::sleep(200); sw.stop(); d = sw.elapsed(); - assert (d >= 180000 && d <= 300000); + assertTrue (d >= 180000 && d <= 300000); } diff --git a/Foundation/testsuite/src/StreamConverterTest.cpp b/Foundation/testsuite/src/StreamConverterTest.cpp index 7e84632cf..0775751dc 100644 --- a/Foundation/testsuite/src/StreamConverterTest.cpp +++ b/Foundation/testsuite/src/StreamConverterTest.cpp @@ -45,22 +45,22 @@ void StreamConverterTest::testIdentityASCIIIn() std::ostringstream ostr1; InputStreamConverter converter1(istr1, encoding, encoding); StreamCopier::copyStream(converter1, ostr1); - assert (ostr1.str() == ""); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == ""); + assertTrue (converter1.errors() == 0); std::istringstream istr2("foo bar"); std::ostringstream ostr2; InputStreamConverter converter2(istr2, encoding, encoding); StreamCopier::copyStream(converter2, ostr2); - assert (ostr2.str() == "foo bar"); - assert (converter2.errors() == 0); + assertTrue (ostr2.str() == "foo bar"); + assertTrue (converter2.errors() == 0); std::istringstream istr3("x"); std::ostringstream ostr3; InputStreamConverter converter3(istr3, encoding, encoding); StreamCopier::copyStream(converter3, ostr3); - assert (ostr3.str() == "x"); - assert (converter3.errors() == 0); + assertTrue (ostr3.str() == "x"); + assertTrue (converter3.errors() == 0); } @@ -71,20 +71,20 @@ void StreamConverterTest::testIdentityASCIIOut() std::ostringstream ostr1; OutputStreamConverter converter1(ostr1, encoding, encoding); converter1 << ""; - assert (ostr1.str() == ""); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == ""); + assertTrue (converter1.errors() == 0); std::ostringstream ostr2; OutputStreamConverter converter2(ostr2, encoding, encoding); converter2 << "foo bar"; - assert (ostr2.str() == "foo bar"); - assert (converter2.errors() == 0); + assertTrue (ostr2.str() == "foo bar"); + assertTrue (converter2.errors() == 0); std::ostringstream ostr3; OutputStreamConverter converter3(ostr3, encoding, encoding); converter3 << "x"; - assert (ostr3.str() == "x"); - assert (converter3.errors() == 0); + assertTrue (ostr3.str() == "x"); + assertTrue (converter3.errors() == 0); } @@ -96,22 +96,22 @@ void StreamConverterTest::testIdentityUTF8In() std::ostringstream ostr1; InputStreamConverter converter1(istr1, encoding, encoding); StreamCopier::copyStream(converter1, ostr1); - assert (ostr1.str() == ""); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == ""); + assertTrue (converter1.errors() == 0); std::istringstream istr2("foo bar"); std::ostringstream ostr2; InputStreamConverter converter2(istr2, encoding, encoding); StreamCopier::copyStream(converter2, ostr2); - assert (ostr2.str() == "foo bar"); - assert (converter2.errors() == 0); + assertTrue (ostr2.str() == "foo bar"); + assertTrue (converter2.errors() == 0); std::istringstream istr3("x"); std::ostringstream ostr3; InputStreamConverter converter3(istr3, encoding, encoding); StreamCopier::copyStream(converter3, ostr3); - assert (ostr3.str() == "x"); - assert (converter3.errors() == 0); + assertTrue (ostr3.str() == "x"); + assertTrue (converter3.errors() == 0); const unsigned char greek[] = {0x20, 0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0x20, 0x00}; std::string text((const char*) greek); @@ -120,8 +120,8 @@ void StreamConverterTest::testIdentityUTF8In() std::ostringstream ostr4; InputStreamConverter converter4(istr4, encoding, encoding); StreamCopier::copyStream(converter4, ostr4); - assert (ostr4.str() == text); - assert (converter4.errors() == 0); + assertTrue (ostr4.str() == text); + assertTrue (converter4.errors() == 0); const unsigned char supp[] = {0x41, 0x42, 0xf0, 0x90, 0x82, 0xa4, 0xf0, 0xaf, 0xa6, 0xa0, 0xf0, 0xaf, 0xa8, 0x9d, 0x00}; std::string text2((const char*) supp); @@ -130,8 +130,8 @@ void StreamConverterTest::testIdentityUTF8In() std::ostringstream ostr5; InputStreamConverter converter5(istr5, encoding, encoding); StreamCopier::copyStream(converter5, ostr5); - assert (ostr5.str() == text2); - assert (converter5.errors() == 0); + assertTrue (ostr5.str() == text2); + assertTrue (converter5.errors() == 0); } @@ -144,20 +144,20 @@ void StreamConverterTest::testIdentityUTF8Out() std::ostringstream ostr1; OutputStreamConverter converter1(ostr1, encoding, encoding); converter1 << ""; - assert (ostr1.str() == ""); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == ""); + assertTrue (converter1.errors() == 0); std::ostringstream ostr2; OutputStreamConverter converter2(ostr2, encoding, encoding); converter2 << "foo bar"; - assert (ostr2.str() == "foo bar"); - assert (converter2.errors() == 0); + assertTrue (ostr2.str() == "foo bar"); + assertTrue (converter2.errors() == 0); std::ostringstream ostr3; OutputStreamConverter converter3(ostr3, encoding, encoding); converter3 << "x"; - assert (ostr3.str() == "x"); - assert (converter3.errors() == 0); + assertTrue (ostr3.str() == "x"); + assertTrue (converter3.errors() == 0); const unsigned char greek[] = {0x20, 0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0x20, 0x00}; std::string text((const char*) greek); @@ -165,8 +165,8 @@ void StreamConverterTest::testIdentityUTF8Out() std::ostringstream ostr4; OutputStreamConverter converter4(ostr4, encoding, encoding); converter4 << text; - assert (ostr4.str() == text); - assert (converter4.errors() == 0); + assertTrue (ostr4.str() == text); + assertTrue (converter4.errors() == 0); } @@ -182,15 +182,15 @@ void StreamConverterTest::testUTF8toASCIIIn() std::ostringstream ostr1; InputStreamConverter converter1(istr1, utf8Encoding, asciiEncoding); StreamCopier::copyStream(converter1, ostr1); - assert (ostr1.str() == " ????? AB"); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == " ????? AB"); + assertTrue (converter1.errors() == 0); std::istringstream istr2("abcde"); std::ostringstream ostr2; InputStreamConverter converter2(istr2, utf8Encoding, asciiEncoding); StreamCopier::copyStream(converter2, ostr2); - assert (ostr2.str() == "abcde"); - assert (converter2.errors() == 0); + assertTrue (ostr2.str() == "abcde"); + assertTrue (converter2.errors() == 0); } @@ -205,14 +205,14 @@ void StreamConverterTest::testUTF8toASCIIOut() std::ostringstream ostr1; OutputStreamConverter converter1(ostr1, utf8Encoding, asciiEncoding); converter1 << text; - assert (ostr1.str() == " ????? AB"); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == " ????? AB"); + assertTrue (converter1.errors() == 0); std::ostringstream ostr2; OutputStreamConverter converter2(ostr2, utf8Encoding, asciiEncoding); converter2 << "abcde"; - assert (ostr2.str() == "abcde"); - assert (converter2.errors() == 0); + assertTrue (ostr2.str() == "abcde"); + assertTrue (converter2.errors() == 0); } @@ -230,8 +230,8 @@ void StreamConverterTest::testLatin1toUTF8In() std::ostringstream ostr1; InputStreamConverter converter1(istr1, latin1Encoding, utf8Encoding); StreamCopier::copyStream(converter1, ostr1); - assert (ostr1.str() == utf8Text); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == utf8Text); + assertTrue (converter1.errors() == 0); } @@ -248,8 +248,8 @@ void StreamConverterTest::testLatin1toUTF8Out() std::ostringstream ostr1; OutputStreamConverter converter1(ostr1, latin1Encoding, utf8Encoding); converter1 << latin1Text; - assert (ostr1.str() == utf8Text); - assert (converter1.errors() == 0); + assertTrue (ostr1.str() == utf8Text); + assertTrue (converter1.errors() == 0); } @@ -265,7 +265,7 @@ void StreamConverterTest::testErrorsIn() std::ostringstream ostr1; InputStreamConverter converter1(istr1, utf8Encoding, latin1Encoding); StreamCopier::copyStream(converter1, ostr1); - assert (converter1.errors() == 2); + assertTrue (converter1.errors() == 2); } @@ -280,7 +280,7 @@ void StreamConverterTest::testErrorsOut() std::ostringstream ostr1; OutputStreamConverter converter1(ostr1, utf8Encoding, latin1Encoding); converter1 << badText; - assert (converter1.errors() == 1); + assertTrue (converter1.errors() == 1); } diff --git a/Foundation/testsuite/src/StreamCopierTest.cpp b/Foundation/testsuite/src/StreamCopierTest.cpp index 4c261fbd9..790e60014 100644 --- a/Foundation/testsuite/src/StreamCopierTest.cpp +++ b/Foundation/testsuite/src/StreamCopierTest.cpp @@ -36,8 +36,8 @@ void StreamCopierTest::testBufferedCopy() std::istringstream istr(src); std::ostringstream ostr; std::streamsize n = StreamCopier::copyStream(istr, ostr); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } { std::string src; @@ -45,8 +45,8 @@ void StreamCopierTest::testBufferedCopy() std::istringstream istr(src); std::ostringstream ostr; std::streamsize n = StreamCopier::copyStream(istr, ostr, 100); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } { std::string src; @@ -54,8 +54,8 @@ void StreamCopierTest::testBufferedCopy() std::istringstream istr(src); std::ostringstream ostr; std::streamsize n = StreamCopier::copyStream(istr, ostr, 128); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } { std::string src; @@ -63,8 +63,8 @@ void StreamCopierTest::testBufferedCopy() std::istringstream istr(src); std::ostringstream ostr; std::streamsize n = StreamCopier::copyStream(istr, ostr, 512); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } } @@ -76,8 +76,8 @@ void StreamCopierTest::testUnbufferedCopy() std::istringstream istr(src); std::ostringstream ostr; std::streamsize n = StreamCopier::copyStreamUnbuffered(istr, ostr); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } @@ -88,8 +88,8 @@ void StreamCopierTest::testCopyToString() std::istringstream istr(src); std::string dest; std::streamsize n = StreamCopier::copyToString(istr, dest, 100); - assert (src == dest); - assert (n == src.size()); + assertTrue (src == dest); + assertTrue (n == src.size()); } @@ -102,8 +102,8 @@ void StreamCopierTest::testBufferedCopy64() std::istringstream istr(src); std::ostringstream ostr; Poco::UInt64 n = StreamCopier::copyStream64(istr, ostr); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } { std::string src; @@ -111,8 +111,8 @@ void StreamCopierTest::testBufferedCopy64() std::istringstream istr(src); std::ostringstream ostr; Poco::UInt64 n = StreamCopier::copyStream64(istr, ostr, 100); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } { std::string src; @@ -120,8 +120,8 @@ void StreamCopierTest::testBufferedCopy64() std::istringstream istr(src); std::ostringstream ostr; Poco::UInt64 n = StreamCopier::copyStream64(istr, ostr, 128); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } { std::string src; @@ -129,8 +129,8 @@ void StreamCopierTest::testBufferedCopy64() std::istringstream istr(src); std::ostringstream ostr; Poco::UInt64 n = StreamCopier::copyStream64(istr, ostr, 512); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } } @@ -142,8 +142,8 @@ void StreamCopierTest::testUnbufferedCopy64() std::istringstream istr(src); std::ostringstream ostr; Poco::UInt64 n = StreamCopier::copyStreamUnbuffered64(istr, ostr); - assert (ostr.str() == src); - assert (n == src.size()); + assertTrue (ostr.str() == src); + assertTrue (n == src.size()); } @@ -154,8 +154,8 @@ void StreamCopierTest::testCopyToString64() std::istringstream istr(src); std::string dest; Poco::UInt64 n = StreamCopier::copyToString64(istr, dest, 100); - assert (src == dest); - assert (n == src.size()); + assertTrue (src == dest); + assertTrue (n == src.size()); } #endif diff --git a/Foundation/testsuite/src/StreamTokenizerTest.cpp b/Foundation/testsuite/src/StreamTokenizerTest.cpp index 3e6d8140f..a13d3312d 100644 --- a/Foundation/testsuite/src/StreamTokenizerTest.cpp +++ b/Foundation/testsuite/src/StreamTokenizerTest.cpp @@ -123,7 +123,7 @@ void StreamTokenizerTest::testTokenizer1() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } @@ -137,11 +137,11 @@ void StreamTokenizerTest::testTokenizer2() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "foo"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "foo"); next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } @@ -155,15 +155,15 @@ void StreamTokenizerTest::testTokenizer3() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "foo"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "foo"); next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "bar"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "bar"); next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } @@ -177,15 +177,15 @@ void StreamTokenizerTest::testTokenizer4() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "foo"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "foo"); next = tokenizer.next(); - assert (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); - assert (next->asInteger() == 123); + assertTrue (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); + assertTrue (next->asInteger() == 123); next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } @@ -199,19 +199,19 @@ void StreamTokenizerTest::testTokenizer5() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "foo"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "foo"); next = tokenizer.next(); - assert (next->tokenClass() == Token::INVALID_TOKEN); - assert (next->tokenString() == "#"); + assertTrue (next->tokenClass() == Token::INVALID_TOKEN); + assertTrue (next->tokenString() == "#"); next = tokenizer.next(); - assert (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); - assert (next->asInteger() == 123); + assertTrue (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); + assertTrue (next->asInteger() == 123); next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } @@ -225,19 +225,19 @@ void StreamTokenizerTest::testTokenizer6() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "foo"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "foo"); next = tokenizer.next(); - assert (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); - assert (next->asInteger() == 123); + assertTrue (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); + assertTrue (next->asInteger() == 123); next = tokenizer.next(); - assert (next->tokenClass() == Token::INVALID_TOKEN); - assert (next->tokenString() == "#"); + assertTrue (next->tokenClass() == Token::INVALID_TOKEN); + assertTrue (next->tokenString() == "#"); next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } @@ -251,15 +251,15 @@ void StreamTokenizerTest::testTokenizer7() tokenizer.addToken(new IntLiteralToken()); const Token* next = tokenizer.next(); - assert (next->tokenClass() == Token::IDENTIFIER_TOKEN); - assert (next->tokenString() == "foo"); + assertTrue (next->tokenClass() == Token::IDENTIFIER_TOKEN); + assertTrue (next->tokenString() == "foo"); next = tokenizer.next(); - assert (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); - assert (next->asInteger() == 123); + assertTrue (next->tokenClass() == Token::INTEGER_LITERAL_TOKEN); + assertTrue (next->asInteger() == 123); next = tokenizer.next(); - assert (next->tokenClass() == Token::EOF_TOKEN); + assertTrue (next->tokenClass() == Token::EOF_TOKEN); } diff --git a/Foundation/testsuite/src/StringTest.cpp b/Foundation/testsuite/src/StringTest.cpp index b5522fec3..eca8eccc3 100644 --- a/Foundation/testsuite/src/StringTest.cpp +++ b/Foundation/testsuite/src/StringTest.cpp @@ -76,13 +76,13 @@ void StringTest::testTrimLeft() { { std::string s = "abc"; - assert (trimLeft(s) == "abc"); + assertTrue (trimLeft(s) == "abc"); } std::string s = " abc "; - assert (trimLeft(s) == "abc "); + assertTrue (trimLeft(s) == "abc "); { std::string s = " ab c "; - assert (trimLeft(s) == "ab c "); + assertTrue (trimLeft(s) == "ab c "); } } @@ -91,15 +91,15 @@ void StringTest::testTrimLeftInPlace() { { std::string s = "abc"; - assert (trimLeftInPlace(s) == "abc"); + assertTrue (trimLeftInPlace(s) == "abc"); } { std::string s = " abc "; - assert (trimLeftInPlace(s) == "abc "); + assertTrue (trimLeftInPlace(s) == "abc "); } { std::string s = " ab c "; - assert (trimLeftInPlace(s) == "ab c "); + assertTrue (trimLeftInPlace(s) == "ab c "); } } @@ -108,15 +108,15 @@ void StringTest::testTrimRight() { { std::string s = "abc"; - assert (trimRight(s) == "abc"); + assertTrue (trimRight(s) == "abc"); } { std::string s = " abc "; - assert (trimRight(s) == " abc"); + assertTrue (trimRight(s) == " abc"); } { std::string s = " ab c "; - assert (trimRight(s) == " ab c"); + assertTrue (trimRight(s) == " ab c"); } } @@ -125,15 +125,15 @@ void StringTest::testTrimRightInPlace() { { std::string s = "abc"; - assert (trimRightInPlace(s) == "abc"); + assertTrue (trimRightInPlace(s) == "abc"); } { std::string s = " abc "; - assert (trimRightInPlace(s) == " abc"); + assertTrue (trimRightInPlace(s) == " abc"); } { std::string s = " ab c "; - assert (trimRightInPlace(s) == " ab c"); + assertTrue (trimRightInPlace(s) == " ab c"); } } @@ -142,15 +142,15 @@ void StringTest::testTrim() { { std::string s = "abc"; - assert (trim(s) == "abc"); + assertTrue (trim(s) == "abc"); } { std::string s = "abc "; - assert (trim(s) == "abc"); + assertTrue (trim(s) == "abc"); } { std::string s = " ab c "; - assert (trim(s) == "ab c"); + assertTrue (trim(s) == "ab c"); } } @@ -159,15 +159,15 @@ void StringTest::testTrimInPlace() { { std::string s = "abc"; - assert (trimInPlace(s) == "abc"); + assertTrue (trimInPlace(s) == "abc"); } { std::string s = " abc "; - assert (trimInPlace(s) == "abc"); + assertTrue (trimInPlace(s) == "abc"); } { std::string s = " ab c "; - assert (trimInPlace(s) == "ab c"); + assertTrue (trimInPlace(s) == "ab c"); } } @@ -176,19 +176,19 @@ void StringTest::testToUpper() { { std::string s = "abc"; - assert (toUpper(s) == "ABC"); + assertTrue (toUpper(s) == "ABC"); } { std::string s = "Abc"; - assert (toUpper(s) == "ABC"); + assertTrue (toUpper(s) == "ABC"); } { std::string s = "abc"; - assert (toUpperInPlace(s) == "ABC"); + assertTrue (toUpperInPlace(s) == "ABC"); } { std::string s = "Abc"; - assert (toUpperInPlace(s) == "ABC"); + assertTrue (toUpperInPlace(s) == "ABC"); } } @@ -197,19 +197,19 @@ void StringTest::testToLower() { { std::string s = "ABC"; - assert (toLower(s) == "abc"); + assertTrue (toLower(s) == "abc"); } { std::string s = "aBC"; - assert (toLower(s) == "abc"); + assertTrue (toLower(s) == "abc"); } { std::string s = "ABC"; - assert (toLowerInPlace(s) == "abc"); + assertTrue (toLowerInPlace(s) == "abc"); } { std::string s = "aBC"; - assert (toLowerInPlace(s) == "abc"); + assertTrue (toLowerInPlace(s) == "abc"); } } @@ -218,29 +218,29 @@ void StringTest::testIstring() { istring is1 = "AbC"; istring is2 = "aBc"; - assert (is1 == is2); + assertTrue (is1 == is2); const char c1[] = { 'G', 0, (char) 0xFC, 'n', 't', 'e', 'r', '\0' }; const char c2[] = { 'g', 0, (char) 0xDC, 'N', 'T', 'E', 'R', '\0' }; is1 = c1; is2 = c2; - assert (is1 == is2); + assertTrue (is1 == is2); is1[0] = 'f'; - assert (is1 < is2); + assertTrue (is1 < is2); is1[0] = 'F'; - assert (is1 < is2); + assertTrue (is1 < is2); is1[0] = 'H'; - assert (is1 > is2); + assertTrue (is1 > is2); is1[0] = 'h'; - assert (is1 > is2); + assertTrue (is1 > is2); is1 = "aAaBbBcCc"; is2 = "bbb"; - assert (isubstr(is1, is2) == 3); + assertTrue (isubstr(is1, is2) == 3); is2 = "bC"; - assert (isubstr(is1, is2) == 5); + assertTrue (isubstr(is1, is2) == 5); is2 = "xxx"; - assert (isubstr(is1, is2) == istring::npos); + assertTrue (isubstr(is1, is2) == istring::npos); } @@ -251,41 +251,41 @@ void StringTest::testIcompare() std::string s3 = "bbb"; std::string s4 = "cCcCc"; std::string s5; - assert (icompare(s1, s2) == 0); - assert (icompare(s1, s3) < 0); - assert (icompare(s1, s4) < 0); - assert (icompare(s3, s1) > 0); - assert (icompare(s4, s2) > 0); - assert (icompare(s2, s4) < 0); - assert (icompare(s1, s5) > 0); - assert (icompare(s5, s4) < 0); + assertTrue (icompare(s1, s2) == 0); + assertTrue (icompare(s1, s3) < 0); + assertTrue (icompare(s1, s4) < 0); + assertTrue (icompare(s3, s1) > 0); + assertTrue (icompare(s4, s2) > 0); + assertTrue (icompare(s2, s4) < 0); + assertTrue (icompare(s1, s5) > 0); + assertTrue (icompare(s5, s4) < 0); std::string ss1 = "xxAAAzz"; std::string ss2 = "YaaaX"; std::string ss3 = "YbbbX"; - assert (icompare(ss1, 2, 3, ss2, 1, 3) == 0); - assert (icompare(ss1, 2, 3, ss3, 1, 3) < 0); - assert (icompare(ss1, 2, 3, ss2, 1) == 0); - assert (icompare(ss1, 2, 3, ss3, 1) < 0); - assert (icompare(ss1, 2, 2, ss2, 1, 3) < 0); - assert (icompare(ss1, 2, 2, ss2, 1, 2) == 0); - assert (icompare(ss3, 1, 3, ss1, 2, 3) > 0); + assertTrue (icompare(ss1, 2, 3, ss2, 1, 3) == 0); + assertTrue (icompare(ss1, 2, 3, ss3, 1, 3) < 0); + assertTrue (icompare(ss1, 2, 3, ss2, 1) == 0); + assertTrue (icompare(ss1, 2, 3, ss3, 1) < 0); + assertTrue (icompare(ss1, 2, 2, ss2, 1, 3) < 0); + assertTrue (icompare(ss1, 2, 2, ss2, 1, 2) == 0); + assertTrue (icompare(ss3, 1, 3, ss1, 2, 3) > 0); - assert (icompare(s1, s2.c_str()) == 0); - assert (icompare(s1, s3.c_str()) < 0); - assert (icompare(s1, s4.c_str()) < 0); - assert (icompare(s3, s1.c_str()) > 0); - assert (icompare(s4, s2.c_str()) > 0); - assert (icompare(s2, s4.c_str()) < 0); - assert (icompare(s1, s5.c_str()) > 0); - assert (icompare(s5, s4.c_str()) < 0); + assertTrue (icompare(s1, s2.c_str()) == 0); + assertTrue (icompare(s1, s3.c_str()) < 0); + assertTrue (icompare(s1, s4.c_str()) < 0); + assertTrue (icompare(s3, s1.c_str()) > 0); + assertTrue (icompare(s4, s2.c_str()) > 0); + assertTrue (icompare(s2, s4.c_str()) < 0); + assertTrue (icompare(s1, s5.c_str()) > 0); + assertTrue (icompare(s5, s4.c_str()) < 0); - assert (icompare(ss1, 2, 3, "aaa") == 0); - assert (icompare(ss1, 2, 2, "aaa") < 0); - assert (icompare(ss1, 2, 3, "AAA") == 0); - assert (icompare(ss1, 2, 2, "bb") < 0); + assertTrue (icompare(ss1, 2, 3, "aaa") == 0); + assertTrue (icompare(ss1, 2, 2, "aaa") < 0); + assertTrue (icompare(ss1, 2, 3, "AAA") == 0); + assertTrue (icompare(ss1, 2, 2, "bb") < 0); - assert (icompare(ss1, 2, "aaa") > 0); + assertTrue (icompare(ss1, 2, "aaa") > 0); } @@ -299,12 +299,12 @@ void StringTest::testCILessThan() ciMap["A"] = 3; ciMap["Z"] = 4; - assert (ciMap.size() == 3); + assertTrue (ciMap.size() == 3); CIMapType::iterator it = ciMap.begin(); - assert (it->first == "A"); ++it; - assert (it->first == "b"); ++it; - assert (it->first == "z"); - assert (it->second == 4); + assertTrue (it->first == "A"); ++it; + assertTrue (it->first == "b"); ++it; + assertTrue (it->first == "z"); + assertTrue (it->second == 4); typedef std::set CISetType; @@ -314,22 +314,22 @@ void StringTest::testCILessThan() ciSet.insert("A"); ciSet.insert("Z"); - assert (ciSet.size() == 3); + assertTrue (ciSet.size() == 3); CISetType::iterator sIt = ciSet.begin(); - assert (*sIt == "A"); ++sIt; - assert (*sIt == "b"); ++sIt; - assert (*sIt == "z"); + assertTrue (*sIt == "A"); ++sIt; + assertTrue (*sIt == "b"); ++sIt; + assertTrue (*sIt == "z"); } void StringTest::testTranslate() { std::string s = "aabbccdd"; - assert (translate(s, "abc", "ABC") == "AABBCCdd"); - assert (translate(s, "abc", "AB") == "AABBdd"); - assert (translate(s, "abc", "") == "dd"); - assert (translate(s, "cba", "CB") == "BBCCdd"); - assert (translate(s, "", "CB") == "aabbccdd"); + assertTrue (translate(s, "abc", "ABC") == "AABBCCdd"); + assertTrue (translate(s, "abc", "AB") == "AABBdd"); + assertTrue (translate(s, "abc", "") == "dd"); + assertTrue (translate(s, "cba", "CB") == "BBCCdd"); + assertTrue (translate(s, "", "CB") == "aabbccdd"); } @@ -337,7 +337,7 @@ void StringTest::testTranslateInPlace() { std::string s = "aabbccdd"; translateInPlace(s, "abc", "ABC"); - assert (s == "AABBCCdd"); + assertTrue (s == "AABBCCdd"); } @@ -345,45 +345,45 @@ void StringTest::testReplace() { std::string s("aabbccdd"); - assert (replace(s, std::string("aa"), std::string("xx")) == "xxbbccdd"); - assert (replace(s, std::string("bb"), std::string("xx")) == "aaxxccdd"); - assert (replace(s, std::string("dd"), std::string("xx")) == "aabbccxx"); - assert (replace(s, std::string("bbcc"), std::string("xx")) == "aaxxdd"); - assert (replace(s, std::string("b"), std::string("xx")) == "aaxxxxccdd"); - assert (replace(s, std::string("bb"), std::string("")) == "aaccdd"); - assert (replace(s, std::string("b"), std::string("")) == "aaccdd"); - assert (replace(s, std::string("ee"), std::string("xx")) == "aabbccdd"); - assert (replace(s, std::string("dd"), std::string("")) == "aabbcc"); + assertTrue (replace(s, std::string("aa"), std::string("xx")) == "xxbbccdd"); + assertTrue (replace(s, std::string("bb"), std::string("xx")) == "aaxxccdd"); + assertTrue (replace(s, std::string("dd"), std::string("xx")) == "aabbccxx"); + assertTrue (replace(s, std::string("bbcc"), std::string("xx")) == "aaxxdd"); + assertTrue (replace(s, std::string("b"), std::string("xx")) == "aaxxxxccdd"); + assertTrue (replace(s, std::string("bb"), std::string("")) == "aaccdd"); + assertTrue (replace(s, std::string("b"), std::string("")) == "aaccdd"); + assertTrue (replace(s, std::string("ee"), std::string("xx")) == "aabbccdd"); + assertTrue (replace(s, std::string("dd"), std::string("")) == "aabbcc"); - assert (replace(s, "aa", "xx") == "xxbbccdd"); - assert (replace(s, "bb", "xx") == "aaxxccdd"); - assert (replace(s, "dd", "xx") == "aabbccxx"); - assert (replace(s, "bbcc", "xx") == "aaxxdd"); - assert (replace(s, "bb", "") == "aaccdd"); - assert (replace(s, "b", "") == "aaccdd"); - assert (replace(s, "ee", "xx") == "aabbccdd"); - assert (replace(s, "dd", "") == "aabbcc"); + assertTrue (replace(s, "aa", "xx") == "xxbbccdd"); + assertTrue (replace(s, "bb", "xx") == "aaxxccdd"); + assertTrue (replace(s, "dd", "xx") == "aabbccxx"); + assertTrue (replace(s, "bbcc", "xx") == "aaxxdd"); + assertTrue (replace(s, "bb", "") == "aaccdd"); + assertTrue (replace(s, "b", "") == "aaccdd"); + assertTrue (replace(s, "ee", "xx") == "aabbccdd"); + assertTrue (replace(s, "dd", "") == "aabbcc"); s = "aabbaabb"; - assert (replace(s, std::string("aa"), std::string("")) == "bbbb"); - assert (replace(s, std::string("a"), std::string("")) == "bbbb"); - assert (replace(s, std::string("a"), std::string("x")) == "xxbbxxbb"); - assert (replace(s, std::string("a"), std::string("xx")) == "xxxxbbxxxxbb"); - assert (replace(s, std::string("aa"), std::string("xxx")) == "xxxbbxxxbb"); + assertTrue (replace(s, std::string("aa"), std::string("")) == "bbbb"); + assertTrue (replace(s, std::string("a"), std::string("")) == "bbbb"); + assertTrue (replace(s, std::string("a"), std::string("x")) == "xxbbxxbb"); + assertTrue (replace(s, std::string("a"), std::string("xx")) == "xxxxbbxxxxbb"); + assertTrue (replace(s, std::string("aa"), std::string("xxx")) == "xxxbbxxxbb"); - assert (replace(s, std::string("aa"), std::string("xx"), 2) == "aabbxxbb"); + assertTrue (replace(s, std::string("aa"), std::string("xx"), 2) == "aabbxxbb"); - assert (replace(s, "aa", "") == "bbbb"); - assert (replace(s, "a", "") == "bbbb"); - assert (replace(s, "a", "x") == "xxbbxxbb"); - assert (replace(s, "a", "xx") == "xxxxbbxxxxbb"); - assert (replace(s, "aa", "xxx") == "xxxbbxxxbb"); + assertTrue (replace(s, "aa", "") == "bbbb"); + assertTrue (replace(s, "a", "") == "bbbb"); + assertTrue (replace(s, "a", "x") == "xxbbxxbb"); + assertTrue (replace(s, "a", "xx") == "xxxxbbxxxxbb"); + assertTrue (replace(s, "aa", "xxx") == "xxxbbxxxbb"); - assert (replace(s, "aa", "xx", 2) == "aabbxxbb"); - assert (replace(s, 'a', 'x', 2) == "aabbxxbb"); - assert (remove(s, 'a', 2) == "aabbbb"); - assert (remove(s, 'a') == "bbbb"); - assert (remove(s, 'b', 2) == "aaaa"); + assertTrue (replace(s, "aa", "xx", 2) == "aabbxxbb"); + assertTrue (replace(s, 'a', 'x', 2) == "aabbxxbb"); + assertTrue (remove(s, 'a', 2) == "aabbbb"); + assertTrue (remove(s, 'a') == "bbbb"); + assertTrue (remove(s, 'b', 2) == "aaaa"); } @@ -392,17 +392,17 @@ void StringTest::testReplaceInPlace() std::string s("aabbccdd"); replaceInPlace(s, std::string("aa"), std::string("xx")); - assert (s == "xxbbccdd"); + assertTrue (s == "xxbbccdd"); s = "aabbccdd"; replaceInPlace(s, 'a', 'x'); - assert (s == "xxbbccdd"); + assertTrue (s == "xxbbccdd"); replaceInPlace(s, 'x'); - assert (s == "bbccdd"); + assertTrue (s == "bbccdd"); removeInPlace(s, 'b', 1); - assert (s == "bccdd"); + assertTrue (s == "bccdd"); removeInPlace(s, 'd'); - assert (s == "bcc"); + assertTrue (s == "bcc"); } @@ -415,21 +415,21 @@ void StringTest::testCat() std::string s5("five"); std::string s6("six"); - assert (cat(s1, s2) == "onetwo"); - assert (cat(s1, s2, s3) == "onetwothree"); - assert (cat(s1, s2, s3, s4) == "onetwothreefour"); - assert (cat(s1, s2, s3, s4, s5) == "onetwothreefourfive"); - assert (cat(s1, s2, s3, s4, s5, s6) == "onetwothreefourfivesix"); + assertTrue (cat(s1, s2) == "onetwo"); + assertTrue (cat(s1, s2, s3) == "onetwothree"); + assertTrue (cat(s1, s2, s3, s4) == "onetwothreefour"); + assertTrue (cat(s1, s2, s3, s4, s5) == "onetwothreefourfive"); + assertTrue (cat(s1, s2, s3, s4, s5, s6) == "onetwothreefourfivesix"); std::vector vec; - assert (cat(std::string(), vec.begin(), vec.end()) == ""); - assert (cat(std::string(","), vec.begin(), vec.end()) == ""); + assertTrue (cat(std::string(), vec.begin(), vec.end()) == ""); + assertTrue (cat(std::string(","), vec.begin(), vec.end()) == ""); vec.push_back(s1); - assert (cat(std::string(","), vec.begin(), vec.end()) == "one"); + assertTrue (cat(std::string(","), vec.begin(), vec.end()) == "one"); vec.push_back(s2); - assert (cat(std::string(","), vec.begin(), vec.end()) == "one,two"); + assertTrue (cat(std::string(","), vec.begin(), vec.end()) == "one,two"); vec.push_back(s3); - assert (cat(std::string(","), vec.begin(), vec.end()) == "one,two,three"); + assertTrue (cat(std::string(","), vec.begin(), vec.end()) == "one,two,three"); } @@ -464,79 +464,79 @@ void StringTest::testStringToFloat() char ts = sep[j]; if (ts == ds) continue; - assert(strToFloat("1", result, ds, ts)); + assertTrue (strToFloat("1", result, ds, ts)); assertEqualDelta(1.0, result, 0.01); - assert(strToFloat(format("%c1", ds), result, ds, ts)); + assertTrue (strToFloat(format("%c1", ds), result, ds, ts)); assertEqualDelta(.1, result, 0.01); - assert(strToFloat(format("1%c", ds), result, ds, ts)); + assertTrue (strToFloat(format("1%c", ds), result, ds, ts)); assertEqualDelta(1., result, 0.01); - assert(strToFloat("0", result, ds, ts)); + assertTrue (strToFloat("0", result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToFloat(format("0%c", ds), result, ds, ts)); + assertTrue (strToFloat(format("0%c", ds), result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToFloat(format("%c0", ds), result, ds, ts)); + assertTrue (strToFloat(format("%c0", ds), result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToFloat(format("0%c0", ds), result, ds, ts)); + assertTrue (strToFloat(format("0%c0", ds), result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToFloat(format("0%c0", ds), result, ds, ts)); + assertTrue (strToFloat(format("0%c0", ds), result, ds, ts)); assertEqualDelta(0., result, 0.01); - assert(strToFloat(format("0%c0", ds), result, ds, ts)); + assertTrue (strToFloat(format("0%c0", ds), result, ds, ts)); assertEqualDelta(.0, result, 0.01); - assert(strToFloat(format("12%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToFloat(format("12%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToFloat(format("-12%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("-12%c34", ds), result, ds, ts)); assertEqualDelta(-12.34, result, 0.01); - assert(strToFloat(format("%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("%c34", ds), result, ds, ts)); assertEqualDelta(.34, result, 0.01); - assert(strToFloat(format("-%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("-%c34", ds), result, ds, ts)); assertEqualDelta(-.34, result, 0.01); - assert(strToFloat(format("12%c", ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c", ds), result, ds, ts)); assertEqualDelta(12., result, 0.01); - assert(strToFloat(format("-12%c", ds), result, ds, ts)); + assertTrue (strToFloat(format("-12%c", ds), result, ds, ts)); assertEqualDelta(-12., result, 0.01); - assert(strToFloat("12", result, ds, ts)); + assertTrue (strToFloat("12", result, ds, ts)); assertEqualDelta(12, result, 0.01); - assert(strToFloat("-12", result, ds, ts)); + assertTrue (strToFloat("-12", result, ds, ts)); assertEqualDelta(-12, result, 0.01); - assert(strToFloat(format("12%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToFloat(format("1%c234%c34", ts, ds), result, ds, ts)); + assertTrue (strToFloat(format("1%c234%c34", ts, ds), result, ds, ts)); assertEqualDelta(1234.34, result, 0.01); - assert(strToFloat(format("12%c345%c34", ts, ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c345%c34", ts, ds), result, ds, ts)); assertEqualDelta(12345.34, result, 0.01); - assert(strToFloat(format("123%c456%c34", ts, ds), result, ds, ts)); + assertTrue (strToFloat(format("123%c456%c34", ts, ds), result, ds, ts)); assertEqualDelta(123456.34, result, 0.01); - assert(strToFloat(format("1%c234%c567%c34", ts, ts, ds), result, ds, ts)); + assertTrue (strToFloat(format("1%c234%c567%c34", ts, ts, ds), result, ds, ts)); if ((std::numeric_limits::max() / 10) < 1.23456e10) fail ("test value larger than max value for this platform"); else { float d = 12e34f; - assert(strToFloat(format("12e34", ds), result, ds, ts)); + assertTrue (strToFloat(format("12e34", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01e34); d = 1.234e30f; - assert(strToFloat(format("1%c234e30", ds), result, ds, ts)); + assertTrue (strToFloat(format("1%c234e30", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToFloat(format("1%c234E+30", ds), result, ds, ts)); + assertTrue (strToFloat(format("1%c234E+30", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); } float d = 12.34e-10f; - assert(strToFloat(format("12%c34e-10", ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c34e-10", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToFloat(format("-12%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format("-12%c34", ds), result, ds, ts)); assertEqualDelta(-12.34, result, 0.01); - assert(strToFloat(format(" 12%c34", ds), result, ds, ts)); + assertTrue (strToFloat(format(" 12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToFloat(format("12%c34 ", ds), result, ds, ts)); + assertTrue (strToFloat(format("12%c34 ", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToFloat(format(" 12%c34 ", ds), result, ds, ts)); + assertTrue (strToFloat(format(" 12%c34 ", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); } } @@ -556,60 +556,60 @@ void StringTest::testStringToDouble() char ts = sep[j]; if (ts == ds) continue; - assert(strToDouble("1", result, ds, ts)); + assertTrue (strToDouble("1", result, ds, ts)); assertEqualDelta(1.0, result, 0.01); - assert(strToDouble(format("%c1", ds), result, ds, ts)); + assertTrue (strToDouble(format("%c1", ds), result, ds, ts)); assertEqualDelta(.1, result, 0.01); - assert(strToDouble(format("1%c", ds), result, ds, ts)); + assertTrue (strToDouble(format("1%c", ds), result, ds, ts)); assertEqualDelta(1., result, 0.01); - assert(strToDouble("0", result, ds, ts)); + assertTrue (strToDouble("0", result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToDouble(format("0%c", ds), result, ds, ts)); + assertTrue (strToDouble(format("0%c", ds), result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToDouble(format("%c0", ds), result, ds, ts)); + assertTrue (strToDouble(format("%c0", ds), result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToDouble(format("0%c0", ds), result, ds, ts)); + assertTrue (strToDouble(format("0%c0", ds), result, ds, ts)); assertEqualDelta(0.0, result, 0.01); - assert(strToDouble(format("0%c0", ds), result, ds, ts)); + assertTrue (strToDouble(format("0%c0", ds), result, ds, ts)); assertEqualDelta(0., result, 0.01); - assert(strToDouble(format("0%c0", ds), result, ds, ts)); + assertTrue (strToDouble(format("0%c0", ds), result, ds, ts)); assertEqualDelta(.0, result, 0.01); - assert(strToDouble(format("12%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToDouble(format("12%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToDouble(format("-12%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format("-12%c34", ds), result, ds, ts)); assertEqualDelta(-12.34, result, 0.01); - assert(strToDouble(format("%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format("%c34", ds), result, ds, ts)); assertEqualDelta(.34, result, 0.01); - assert(strToDouble(format("-%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format("-%c34", ds), result, ds, ts)); assertEqualDelta(-.34, result, 0.01); - assert(strToDouble(format("12%c", ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c", ds), result, ds, ts)); assertEqualDelta(12., result, 0.01); - assert(strToDouble(format("-12%c", ds), result, ds, ts)); + assertTrue (strToDouble(format("-12%c", ds), result, ds, ts)); assertEqualDelta(-12., result, 0.01); - assert(strToDouble("12", result, ds, ts)); + assertTrue (strToDouble("12", result, ds, ts)); assertEqualDelta(12, result, 0.01); - assert(strToDouble("-12", result, ds, ts)); + assertTrue (strToDouble("-12", result, ds, ts)); assertEqualDelta(-12, result, 0.01); - assert(strToDouble(format("12%c3456789012345678901234567890", ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c3456789012345678901234567890", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToDouble("1234345", result, ds, ts)); + assertTrue (strToDouble("1234345", result, ds, ts)); assertEqualDelta(1234345, result, 0.00000001); - assert(strToDouble(format("1%c234%c345", ts, ts), result, ds, ts)); + assertTrue (strToDouble(format("1%c234%c345", ts, ts), result, ds, ts)); assertEqualDelta(1234345, result, 0.00000001); - assert(strToDouble(format("1%c234%c3456789012345678901234567890", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format("1%c234%c3456789012345678901234567890", ts, ds), result, ds, ts)); assertEqualDelta(1234.3456789, result, 0.00000001); - assert(strToDouble(format("12%c345%c3456789012345678901234567890", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c345%c3456789012345678901234567890", ts, ds), result, ds, ts)); assertEqualDelta(12345.3456789, result, 0.00000001); - assert(strToDouble(format("123%c456%c3456789012345678901234567890", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format("123%c456%c3456789012345678901234567890", ts, ds), result, ds, ts)); assertEqualDelta(123456.3456789, result, 0.00000001); - assert(strToDouble(format("1%c234%c567%c3456789012345678901234567890", ts, ts, ds), result, ds, ts)); + assertTrue (strToDouble(format("1%c234%c567%c3456789012345678901234567890", ts, ts, ds), result, ds, ts)); assertEqualDelta(1234567.3456789, result, 0.00000001); - assert(strToDouble(format("12%c345%c678%c3456789012345678901234567890", ts, ts, ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c345%c678%c3456789012345678901234567890", ts, ts, ds), result, ds, ts)); assertEqualDelta(12345678.3456789, result, 0.00000001); - assert(strToDouble(format("123%c456%c789%c3456789012345678901234567890", ts, ts, ds), result, ds, ts)); + assertTrue (strToDouble(format("123%c456%c789%c3456789012345678901234567890", ts, ts, ds), result, ds, ts)); assertEqualDelta(123456789.3456789, result, 0.00000001); if ((std::numeric_limits::max() / 10) < 1.23456e10) @@ -617,67 +617,67 @@ void StringTest::testStringToDouble() else { double d = 12e34; - assert(strToDouble(format("12e34", ds), result, ds, ts)); + assertTrue (strToDouble(format("12e34", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01e34); d = 1.234e100; - assert(strToDouble(format("1%c234e100", ds), result, ds, ts)); + assertTrue (strToDouble(format("1%c234e100", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToDouble(format("1%c234E+100", ds), result, ds, ts)); + assertTrue (strToDouble(format("1%c234E+100", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = 1.234e-100; - assert(strToDouble(format("1%c234E-100", ds), result, ds, ts)); + assertTrue (strToDouble(format("1%c234E-100", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = -1.234e100; - assert(strToDouble(format("-1%c234e+100", ds), result, ds, ts)); + assertTrue (strToDouble(format("-1%c234e+100", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToDouble(format("-1%c234E100", ds), result, ds, ts)); + assertTrue (strToDouble(format("-1%c234E100", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = 1.234e-100; - assert(strToDouble(format(" 1%c234e-100 ", ds), result, ds, ts)); + assertTrue (strToDouble(format(" 1%c234e-100 ", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToDouble(format(" 1%c234e-100 ", ds), result, ds, ts)); + assertTrue (strToDouble(format(" 1%c234e-100 ", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToDouble(format(" 1%c234e-100 ", ds), result, ds, ts)); + assertTrue (strToDouble(format(" 1%c234e-100 ", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = 1234.234e-100; - assert(strToDouble(format(" 1%c234%c234e-100 ", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format(" 1%c234%c234e-100 ", ts, ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = 12345.234e-100; - assert(strToDouble(format(" 12%c345%c234e-100 ", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format(" 12%c345%c234e-100 ", ts, ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = 123456.234e-100; - assert(strToDouble(format(" 123%c456%c234e-100 ", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format(" 123%c456%c234e-100 ", ts, ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = -1234.234e-100; - assert(strToDouble(format(" -1%c234%c234e-100 ", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format(" -1%c234%c234e-100 ", ts, ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = -12345.234e-100; - assert(strToDouble(format(" -12%c345%c234e-100 ", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format(" -12%c345%c234e-100 ", ts, ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); d = -123456.234e-100; char ou = 0; - assert(strToDouble(format(" -123%c456%c234e-100 ", ts, ds), result, ds, ts)); + assertTrue (strToDouble(format(" -123%c456%c234e-100 ", ts, ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert (ou == 0); + assertTrue (ou == 0); } double d = 12.34e-10; - assert(strToDouble(format("12%c34e-10", ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c34e-10", ds), result, ds, ts)); assertEqualDelta(d, result, 0.01); - assert(strToDouble(format("-12%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format("-12%c34", ds), result, ds, ts)); assertEqualDelta(-12.34, result, 0.01); - assert(strToDouble(format(" 12%c34", ds), result, ds, ts)); + assertTrue (strToDouble(format(" 12%c34", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToDouble(format("12%c34 ", ds), result, ds, ts)); + assertTrue (strToDouble(format("12%c34 ", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); - assert(strToDouble(format(" 12%c34 ", ds), result, ds, ts)); + assertTrue (strToDouble(format(" 12%c34 ", ds), result, ds, ts)); assertEqualDelta(12.34, result, 0.01); } } @@ -690,18 +690,18 @@ void StringTest::testStringToFloatError() if (ds == 0) ds = '.'; char ts = thousandSeparator(); if (ts == 0) ts = ','; - assert (ds != ts); + assertTrue (ds != ts); double result = 0.0; - assert (!strToDouble(format("a12%c3", ds), result)); - assert (!strToDouble(format("1b2%c3", ds), result)); - assert (!strToDouble(format("12c%c3", ds), result)); - assert (!strToDouble(format("12%cx3", ds), result)); + assertTrue (!strToDouble(format("a12%c3", ds), result)); + assertTrue (!strToDouble(format("1b2%c3", ds), result)); + assertTrue (!strToDouble(format("12c%c3", ds), result)); + assertTrue (!strToDouble(format("12%cx3", ds), result)); - assert(!strToDouble(format("123%c456%c234e1000000", ts, ds), result)); - assert(!strToDouble(format("123%c456%c234e+1000000", ts, ds), result)); - //assert(!strToDouble(0, result, ou)); // strToDouble is resilient to null pointers - assert(!strToDouble("", result)); + assertTrue (!strToDouble(format("123%c456%c234e1000000", ts, ds), result)); + assertTrue (!strToDouble(format("123%c456%c234e+1000000", ts, ds), result)); + //assertTrue (!strToDouble(0, result, ou)); // strToDouble is resilient to null pointers + assertTrue (!strToDouble("", result)); } @@ -719,29 +719,29 @@ void StringTest::testNumericLocale() std::cout << "Decimal point: '" << decimalSeparator() << '\'' << std::endl; std::cout << "Thousand separator: '" << ts << '\'' << std::endl; doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, 1.23); - assert (std::strncmp(buffer, "1.23", 4) == 0); + assertTrue (std::strncmp(buffer, "1.23", 4) == 0); std::cout << "1.23 == '" << buffer << '\'' << std::endl; std::locale::global(std::locale("German")); std::locale locGerman; - assert (',' == decimalSeparator()); - assert ('.' == thousandSeparator()); + assertTrue (',' == decimalSeparator()); + assertTrue ('.' == thousandSeparator()); std::cout << "New locale: '" << locGerman.name() << '\'' << std::endl; std::cout << "Decimal point: '" << decimalSeparator() << '\'' << std::endl; std::cout << "Thousand separator: '" << thousandSeparator() << '\'' << std::endl; doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, 1.23); - assert (std::strncmp(buffer, "1.23", 4) == 0); + assertTrue (std::strncmp(buffer, "1.23", 4) == 0); std::cout << "1.23 == '" << buffer << '\'' << std::endl; std::locale::global(std::locale("US")); std::locale locUS; - assert ('.' == decimalSeparator()); - assert (',' == thousandSeparator()); + assertTrue ('.' == decimalSeparator()); + assertTrue (',' == thousandSeparator()); std::cout << "New locale: '" << locUS.name() << '\'' << std::endl; std::cout << "Decimal point: '" << decimalSeparator() << '\'' << std::endl; std::cout << "Thousand separator: '" << thousandSeparator() << '\'' << std::endl; doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, 1.23); - assert (std::strncmp(buffer, "1.23", 4) == 0); + assertTrue (std::strncmp(buffer, "1.23", 4) == 0); std::cout << "1.23 == '" << buffer << '\'' << std::endl; std::locale::global(loc); @@ -751,11 +751,11 @@ void StringTest::testNumericLocale() std::cout << "Decimal point: '" << decimalSeparator() << '\'' << std::endl; std::cout << "Thousand separator: '" << thousandSeparator() << '\'' << std::endl; doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, 1.23); - assert (std::strncmp(buffer, "1.23", 4) == 0); + assertTrue (std::strncmp(buffer, "1.23", 4) == 0); std::cout << "1.23 == '" << buffer << '\'' << std::endl; - assert (dp == decimalSeparator()); - assert (ts == thousandSeparator()); + assertTrue (dp == decimalSeparator()); + assertTrue (ts == thousandSeparator()); } catch (std::runtime_error& ex) { std::cout << ex.what() << std::endl; @@ -886,87 +886,87 @@ void StringTest::testIntToString() // decimal std::string result; - assert (intToStr(0, 10, result)); - assert (result == "0"); - assert (intToStr(0, 10, result, false, 10, '0')); - assert (result == "0000000000"); - assert (intToStr(1234567890, 10, result)); - assert (result == "1234567890"); - assert (intToStr(-1234567890, 10, result)); - assert (result == "-1234567890"); - assert (intToStr(-1234567890, 10, result, false, 15, '0')); - assert (result == "-00001234567890"); - assert (intToStr(-1234567890, 10, result, false, 15)); - assert (result == " -1234567890"); - assert (intToStr(-1234567890, 10, result, false, 0, 0, ',')); - assert (result == "-1,234,567,890"); + assertTrue (intToStr(0, 10, result)); + assertTrue (result == "0"); + assertTrue (intToStr(0, 10, result, false, 10, '0')); + assertTrue (result == "0000000000"); + assertTrue (intToStr(1234567890, 10, result)); + assertTrue (result == "1234567890"); + assertTrue (intToStr(-1234567890, 10, result)); + assertTrue (result == "-1234567890"); + assertTrue (intToStr(-1234567890, 10, result, false, 15, '0')); + assertTrue (result == "-00001234567890"); + assertTrue (intToStr(-1234567890, 10, result, false, 15)); + assertTrue (result == " -1234567890"); + assertTrue (intToStr(-1234567890, 10, result, false, 0, 0, ',')); + assertTrue (result == "-1,234,567,890"); // binary - assert (intToStr(1234567890, 2, result)); - assert (result == "1001001100101100000001011010010"); - assert (intToStr(1234567890, 2, result, true)); - assert (result == "1001001100101100000001011010010"); - assert (intToStr(1234567890, 2, result, true, 35, '0')); - assert (result == "00001001001100101100000001011010010"); - assert (uIntToStr(0xFF, 2, result)); - assert (result == "11111111"); - assert (uIntToStr(0x0F, 2, result, false, 8, '0')); - assert (result == "00001111"); - assert (uIntToStr(0x0F, 2, result)); - assert (result == "1111"); - assert (uIntToStr(0xF0, 2, result)); - assert (result == "11110000"); - assert (uIntToStr(0xFFFF, 2, result)); - assert (result == "1111111111111111"); - assert (uIntToStr(0xFF00, 2, result)); - assert (result == "1111111100000000"); - assert (uIntToStr(0xFFFFFFFF, 2, result)); - assert (result == "11111111111111111111111111111111"); - assert (uIntToStr(0xFF00FF00, 2, result)); - assert (result == "11111111000000001111111100000000"); - assert (uIntToStr(0xF0F0F0F0, 2, result)); - assert (result == "11110000111100001111000011110000"); + assertTrue (intToStr(1234567890, 2, result)); + assertTrue (result == "1001001100101100000001011010010"); + assertTrue (intToStr(1234567890, 2, result, true)); + assertTrue (result == "1001001100101100000001011010010"); + assertTrue (intToStr(1234567890, 2, result, true, 35, '0')); + assertTrue (result == "00001001001100101100000001011010010"); + assertTrue (uIntToStr(0xFF, 2, result)); + assertTrue (result == "11111111"); + assertTrue (uIntToStr(0x0F, 2, result, false, 8, '0')); + assertTrue (result == "00001111"); + assertTrue (uIntToStr(0x0F, 2, result)); + assertTrue (result == "1111"); + assertTrue (uIntToStr(0xF0, 2, result)); + assertTrue (result == "11110000"); + assertTrue (uIntToStr(0xFFFF, 2, result)); + assertTrue (result == "1111111111111111"); + assertTrue (uIntToStr(0xFF00, 2, result)); + assertTrue (result == "1111111100000000"); + assertTrue (uIntToStr(0xFFFFFFFF, 2, result)); + assertTrue (result == "11111111111111111111111111111111"); + assertTrue (uIntToStr(0xFF00FF00, 2, result)); + assertTrue (result == "11111111000000001111111100000000"); + assertTrue (uIntToStr(0xF0F0F0F0, 2, result)); + assertTrue (result == "11110000111100001111000011110000"); #if defined(POCO_HAVE_INT64) - assert (uIntToStr(0xFFFFFFFFFFFFFFFF, 2, result)); - assert (result == "1111111111111111111111111111111111111111111111111111111111111111"); - assert (uIntToStr(0xFF00000FF00000FF, 2, result)); - assert (result == "1111111100000000000000000000111111110000000000000000000011111111"); + assertTrue (uIntToStr(0xFFFFFFFFFFFFFFFF, 2, result)); + assertTrue (result == "1111111111111111111111111111111111111111111111111111111111111111"); + assertTrue (uIntToStr(0xFF00000FF00000FF, 2, result)); + assertTrue (result == "1111111100000000000000000000111111110000000000000000000011111111"); #endif // octal - assert (uIntToStr(1234567890, 010, result)); - assert (result == "11145401322"); - assert (uIntToStr(1234567890, 010, result, true)); - assert (result == "011145401322"); - assert (uIntToStr(1234567890, 010, result, true, 15, '0')); - assert (result == "000011145401322"); - assert (uIntToStr(012345670, 010, result, true)); - assert (result == "012345670"); - assert (uIntToStr(012345670, 010, result)); - assert (result == "12345670"); + assertTrue (uIntToStr(1234567890, 010, result)); + assertTrue (result == "11145401322"); + assertTrue (uIntToStr(1234567890, 010, result, true)); + assertTrue (result == "011145401322"); + assertTrue (uIntToStr(1234567890, 010, result, true, 15, '0')); + assertTrue (result == "000011145401322"); + assertTrue (uIntToStr(012345670, 010, result, true)); + assertTrue (result == "012345670"); + assertTrue (uIntToStr(012345670, 010, result)); + assertTrue (result == "12345670"); // hexadecimal - assert (uIntToStr(0, 0x10, result, true)); - assert (result == "0x0"); - assert (uIntToStr(0, 0x10, result, true, 4, '0')); - assert (result == "0x00"); - assert (uIntToStr(0, 0x10, result, false, 4, '0')); - assert (result == "0000"); - assert (uIntToStr(1234567890, 0x10, result)); - assert (result == "499602D2"); - assert (uIntToStr(1234567890, 0x10, result, true)); - assert (result == "0x499602D2"); - assert (uIntToStr(1234567890, 0x10, result, true, 15, '0')); - assert (result == "0x00000499602D2"); - assert (uIntToStr(0x1234567890ABCDEF, 0x10, result, true)); - assert (result == "0x1234567890ABCDEF"); - assert (uIntToStr(0xDEADBEEF, 0x10, result)); - assert (result == "DEADBEEF"); + assertTrue (uIntToStr(0, 0x10, result, true)); + assertTrue (result == "0x0"); + assertTrue (uIntToStr(0, 0x10, result, true, 4, '0')); + assertTrue (result == "0x00"); + assertTrue (uIntToStr(0, 0x10, result, false, 4, '0')); + assertTrue (result == "0000"); + assertTrue (uIntToStr(1234567890, 0x10, result)); + assertTrue (result == "499602D2"); + assertTrue (uIntToStr(1234567890, 0x10, result, true)); + assertTrue (result == "0x499602D2"); + assertTrue (uIntToStr(1234567890, 0x10, result, true, 15, '0')); + assertTrue (result == "0x00000499602D2"); + assertTrue (uIntToStr(0x1234567890ABCDEF, 0x10, result, true)); + assertTrue (result == "0x1234567890ABCDEF"); + assertTrue (uIntToStr(0xDEADBEEF, 0x10, result)); + assertTrue (result == "DEADBEEF"); #if defined(POCO_HAVE_INT64) - assert (uIntToStr(0xFFFFFFFFFFFFFFFF, 0x10, result)); - assert (result == "FFFFFFFFFFFFFFFF"); - assert (uIntToStr(0xFFFFFFFFFFFFFFFF, 0x10, result, true)); - assert (result == "0xFFFFFFFFFFFFFFFF"); + assertTrue (uIntToStr(0xFFFFFFFFFFFFFFFF, 0x10, result)); + assertTrue (result == "FFFFFFFFFFFFFFFF"); + assertTrue (uIntToStr(0xFFFFFFFFFFFFFFFF, 0x10, result, true)); + assertTrue (result == "0xFFFFFFFFFFFFFFFF"); #endif try @@ -984,23 +984,23 @@ void StringTest::testFloatToString() double val = 1.03721575516329e-112; std::string str; - assert (doubleToStr(str, val, 14, 21) == "1.03721575516329e-112"); - assert (doubleToStr(str, val, 14, 22) == " 1.03721575516329e-112"); + assertTrue (doubleToStr(str, val, 14, 21) == "1.03721575516329e-112"); + assertTrue (doubleToStr(str, val, 14, 22) == " 1.03721575516329e-112"); val = -val; - assert (doubleToStr(str, val, 14, 22) == "-1.03721575516329e-112"); - assert (doubleToStr(str, val, 14, 23) == " -1.03721575516329e-112"); + assertTrue (doubleToStr(str, val, 14, 22) == "-1.03721575516329e-112"); + assertTrue (doubleToStr(str, val, 14, 23) == " -1.03721575516329e-112"); val = -10372157551632.9; - assert (doubleToStr(str, val, 1, 21, ',') == "-10,372,157,551,632.9"); - assert (doubleToStr(str, val, 1, 22, ',') == " -10,372,157,551,632.9"); - assert (doubleToStr(str, val, 2, 22, ',') == "-10,372,157,551,632.90"); - assert (doubleToStr(str, val, 2, 22, '.', ',') == "-10.372.157.551.632,90"); - assert (doubleToStr(str, val, 2, 22, ' ', ',') == "-10 372 157 551 632,90"); + assertTrue (doubleToStr(str, val, 1, 21, ',') == "-10,372,157,551,632.9"); + assertTrue (doubleToStr(str, val, 1, 22, ',') == " -10,372,157,551,632.9"); + assertTrue (doubleToStr(str, val, 2, 22, ',') == "-10,372,157,551,632.90"); + assertTrue (doubleToStr(str, val, 2, 22, '.', ',') == "-10.372.157.551.632,90"); + assertTrue (doubleToStr(str, val, 2, 22, ' ', ',') == "-10 372 157 551 632,90"); int ival = 1234567890; - assert(doubleToStr(str, ival, 1, 15, ',') == "1,234,567,890.0"); + assertTrue (doubleToStr(str, ival, 1, 15, ',') == "1,234,567,890.0"); ival = -123456789; - assert(doubleToStr(str, ival, 1, 14, ',') == "-123,456,789.0"); + assertTrue (doubleToStr(str, ival, 1, 14, ',') == "-123,456,789.0"); } @@ -1083,67 +1083,67 @@ void StringTest::benchmarkFloatToStr() void StringTest::testJSONString() { - assert (toJSON("\\", false) == "\\\\"); - assert (toJSON("\"", false) == "\\\""); - assert (toJSON("/", false) == "\\/"); - assert (toJSON("\a", false) == "\\u0007"); - assert (toJSON("\b", false) == "\\b"); - assert (toJSON("\f", false) == "\\f"); - assert (toJSON("\n", false) == "\\n"); - assert (toJSON("\r", false) == "\\r"); - assert (toJSON("\t", false) == "\\t"); - assert (toJSON("\v", false) == "\\u000B"); - assert (toJSON("a", false) == "a"); - assert (toJSON("\xD0\x82", 0) == "\xD0\x82"); - assert (toJSON("\xD0\x82", Poco::JSON_ESCAPE_UNICODE) == "\\u0402"); + assertTrue (toJSON("\\", false) == "\\\\"); + assertTrue (toJSON("\"", false) == "\\\""); + assertTrue (toJSON("/", false) == "\\/"); + assertTrue (toJSON("\a", false) == "\\u0007"); + assertTrue (toJSON("\b", false) == "\\b"); + assertTrue (toJSON("\f", false) == "\\f"); + assertTrue (toJSON("\n", false) == "\\n"); + assertTrue (toJSON("\r", false) == "\\r"); + assertTrue (toJSON("\t", false) == "\\t"); + assertTrue (toJSON("\v", false) == "\\u000B"); + assertTrue (toJSON("a", false) == "a"); + assertTrue (toJSON("\xD0\x82", 0) == "\xD0\x82"); + assertTrue (toJSON("\xD0\x82", Poco::JSON_ESCAPE_UNICODE) == "\\u0402"); // ??? on MSVC, the assert macro expansion // fails to compile when this string is inline ??? std::string str = "\"foo\\\\\""; - assert (toJSON("foo\\") == str); + assertTrue (toJSON("foo\\") == str); - assert (toJSON("bar/") == "\"bar\\/\""); - assert (toJSON("baz") == "\"baz\""); - assert (toJSON("q\"uote\"d") == "\"q\\\"uote\\\"d\""); - assert (toJSON("bs\b") == "\"bs\\b\""); - assert (toJSON("nl\n") == "\"nl\\n\""); - assert (toJSON("tb\t") == "\"tb\\t\""); - assert (toJSON("\xD0\x82") == "\"\xD0\x82\""); - assert (toJSON("\xD0\x82", Poco::JSON_WRAP_STRINGS) == "\"\xD0\x82\""); - assert (toJSON("\xD0\x82", + assertTrue (toJSON("bar/") == "\"bar\\/\""); + assertTrue (toJSON("baz") == "\"baz\""); + assertTrue (toJSON("q\"uote\"d") == "\"q\\\"uote\\\"d\""); + assertTrue (toJSON("bs\b") == "\"bs\\b\""); + assertTrue (toJSON("nl\n") == "\"nl\\n\""); + assertTrue (toJSON("tb\t") == "\"tb\\t\""); + assertTrue (toJSON("\xD0\x82") == "\"\xD0\x82\""); + assertTrue (toJSON("\xD0\x82", Poco::JSON_WRAP_STRINGS) == "\"\xD0\x82\""); + assertTrue (toJSON("\xD0\x82", Poco::JSON_WRAP_STRINGS | Poco::JSON_ESCAPE_UNICODE) == "\"\\u0402\""); std::ostringstream ostr; toJSON("foo\\", ostr); - assert(ostr.str() == str); + assertTrue (ostr.str() == str); ostr.str(""); toJSON("foo\\", ostr); - assert(toJSON("bar/") == "\"bar\\/\""); + assertTrue (toJSON("bar/") == "\"bar\\/\""); ostr.str(""); toJSON("baz", ostr); - assert(ostr.str() == "\"baz\""); + assertTrue (ostr.str() == "\"baz\""); ostr.str(""); toJSON("q\"uote\"d", ostr); - assert(ostr.str() == "\"q\\\"uote\\\"d\""); + assertTrue (ostr.str() == "\"q\\\"uote\\\"d\""); ostr.str(""); toJSON("bs\b", ostr); - assert(ostr.str() == "\"bs\\b\""); + assertTrue (ostr.str() == "\"bs\\b\""); ostr.str(""); toJSON("nl\n", ostr); - assert(ostr.str() == "\"nl\\n\""); + assertTrue (ostr.str() == "\"nl\\n\""); ostr.str(""); toJSON("tb\t", ostr); - assert(ostr.str() == "\"tb\\t\""); + assertTrue (ostr.str() == "\"tb\\t\""); ostr.str(""); toJSON("\xD0\x82", ostr); - assert(ostr.str() == "\"\xD0\x82\""); + assertTrue (ostr.str() == "\"\xD0\x82\""); ostr.str(""); toJSON("\xD0\x82", ostr, Poco::JSON_WRAP_STRINGS); - assert(ostr.str() == "\"\xD0\x82\""); + assertTrue (ostr.str() == "\"\xD0\x82\""); ostr.str(""); toJSON("\xD0\x82", ostr, Poco::JSON_WRAP_STRINGS | Poco::JSON_ESCAPE_UNICODE); - assert(ostr.str() == "\"\\u0402\""); + assertTrue (ostr.str() == "\"\\u0402\""); ostr.str(""); } diff --git a/Foundation/testsuite/src/StringTest.h b/Foundation/testsuite/src/StringTest.h index 6c47fe24f..9c4e04107 100644 --- a/Foundation/testsuite/src/StringTest.h +++ b/Foundation/testsuite/src/StringTest.h @@ -69,26 +69,26 @@ private: { T result = 0; if (123 <= std::numeric_limits::max()) - assert(Poco::strToInt("123", result, 10)); assert(result == 123); + assertTrue (Poco::strToInt("123", result, 10)); assertTrue (result == 123); - assert(Poco::strToInt("0", result, 10)); assert(result == 0); - assert(Poco::strToInt("000", result, 10)); assert(result == 0); + assertTrue (Poco::strToInt("0", result, 10)); assertTrue (result == 0); + assertTrue (Poco::strToInt("000", result, 10)); assertTrue (result == 0); if (std::numeric_limits::is_signed && (-123 > std::numeric_limits::min())) - { assert(Poco::strToInt("-123", result, 10)); assert(result == -123); } + { assertTrue (Poco::strToInt("-123", result, 10)); assertTrue (result == -123); } if (0x123 < std::numeric_limits::max()) - { assert(Poco::strToInt("123", result, 0x10)); assert(result == 0x123); } + { assertTrue (Poco::strToInt("123", result, 0x10)); assertTrue (result == 0x123); } if (0x12ab < std::numeric_limits::max()) - { assert(Poco::strToInt("12AB", result, 0x10)); assert(result == 0x12ab); } + { assertTrue (Poco::strToInt("12AB", result, 0x10)); assertTrue (result == 0x12ab); } if (123 < std::numeric_limits::max()) - { assert(Poco::strToInt("00", result, 0x10)); assert(result == 0); } + { assertTrue (Poco::strToInt("00", result, 0x10)); assertTrue (result == 0); } if (0123 < std::numeric_limits::max()) - { assert(Poco::strToInt("123", result, 010)); assert(result == 0123); } + { assertTrue (Poco::strToInt("123", result, 010)); assertTrue (result == 0123); } if (0123 < std::numeric_limits::max()) - { assert(Poco::strToInt("0123", result, 010)); assert(result == 0123); } + { assertTrue (Poco::strToInt("0123", result, 010)); assertTrue (result == 0123); } - assert(Poco::strToInt("0", result, 010)); assert(result == 0); - assert(Poco::strToInt("000", result, 010)); assert(result == 0); + assertTrue (Poco::strToInt("0", result, 010)); assertTrue (result == 0); + assertTrue (Poco::strToInt("000", result, 010)); assertTrue (result == 0); } template diff --git a/Foundation/testsuite/src/StringTokenizerTest.cpp b/Foundation/testsuite/src/StringTokenizerTest.cpp index 927bdea9a..711992250 100644 --- a/Foundation/testsuite/src/StringTokenizerTest.cpp +++ b/Foundation/testsuite/src/StringTokenizerTest.cpp @@ -34,302 +34,302 @@ void StringTokenizerTest::testStringTokenizer() { { StringTokenizer st("", ""); - assert (st.begin() == st.end()); + assertTrue (st.begin() == st.end()); } { StringTokenizer st("", "", StringTokenizer::TOK_IGNORE_EMPTY); - assert (st.begin() == st.end()); + assertTrue (st.begin() == st.end()); } { StringTokenizer st("", "", StringTokenizer::TOK_TRIM); - assert (st.begin() == st.end()); + assertTrue (st.begin() == st.end()); } { StringTokenizer st("", "", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); - assert (st.begin() == st.end()); + assertTrue (st.begin() == st.end()); } { StringTokenizer st("abc", ""); StringTokenizer::Iterator it = st.begin(); - assert (st.find("abc") == 0); - assert (it != st.end()); - assert (*it++ == "abc"); - assert (it == st.end()); + assertTrue (st.find("abc") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "abc"); + assertTrue (it == st.end()); } { StringTokenizer st("abc ", "", StringTokenizer::TOK_TRIM); StringTokenizer::Iterator it = st.begin(); - assert (st.find("abc") == 0); - assert (it != st.end()); - assert (*it++ == "abc"); - assert (it == st.end()); + assertTrue (st.find("abc") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "abc"); + assertTrue (it == st.end()); } { StringTokenizer st(" abc ", "", StringTokenizer::TOK_TRIM); StringTokenizer::Iterator it = st.begin(); - assert (st.find("abc") == 0); - assert (it != st.end()); - assert (*it++ == "abc"); - assert (it == st.end()); + assertTrue (st.find("abc") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "abc"); + assertTrue (it == st.end()); } { StringTokenizer st(" abc", "", StringTokenizer::TOK_TRIM); StringTokenizer::Iterator it = st.begin(); - assert (st.find("abc") == 0); - assert (it != st.end()); - assert (*it++ == "abc"); - assert (it == st.end()); + assertTrue (st.find("abc") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "abc"); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "b"); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (st.find("c") == 1); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it != st.end()); - assert (*it++ == "c"); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (st.find("c") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it != st.end()); + assertTrue (*it++ == "c"); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "b", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (st.find("c") == 1); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it != st.end()); - assert (*it++ == "c"); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (st.find("c") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it != st.end()); + assertTrue (*it++ == "c"); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "bc"); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (st.find("") == 1); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it != st.end()); - assert (*it++ == ""); - assert (it != st.end()); - assert (*it++ == ""); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (st.find("") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "bc", StringTokenizer::TOK_TRIM); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (st.find("") == 1); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it != st.end()); - assert (*it++ == ""); - assert (it != st.end()); - assert (*it++ == ""); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (st.find("") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "bc", StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "bc", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it == st.end()); } { StringTokenizer st("abc", "bc", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it == st.end()); } { StringTokenizer st("a a,c c", ","); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a a") == 0); - assert (st.find("c c") == 1); - assert (it != st.end()); - assert (*it++ == "a a"); - assert (it != st.end()); - assert (*it++ == "c c"); - assert (it == st.end()); + assertTrue (st.find("a a") == 0); + assertTrue (st.find("c c") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a a"); + assertTrue (it != st.end()); + assertTrue (*it++ == "c c"); + assertTrue (it == st.end()); } { StringTokenizer st("a a,c c", ",", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a a") == 0); - assert (st.find("c c") == 1); - assert (it != st.end()); - assert (*it++ == "a a"); - assert (it != st.end()); - assert (*it++ == "c c"); - assert (it == st.end()); + assertTrue (st.find("a a") == 0); + assertTrue (st.find("c c") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a a"); + assertTrue (it != st.end()); + assertTrue (*it++ == "c c"); + assertTrue (it == st.end()); } { StringTokenizer st(" a a , , c c ", ","); StringTokenizer::Iterator it = st.begin(); - assert (st.find(" a a ") == 0); - assert (st.find(" ") == 1); - assert (st.find(" c c ") == 2); - assert (it != st.end()); - assert (*it++ == " a a "); - assert (it != st.end()); - assert (*it++ == " "); - assert (it != st.end()); - assert (*it++ == " c c "); - assert (it == st.end()); + assertTrue (st.find(" a a ") == 0); + assertTrue (st.find(" ") == 1); + assertTrue (st.find(" c c ") == 2); + assertTrue (it != st.end()); + assertTrue (*it++ == " a a "); + assertTrue (it != st.end()); + assertTrue (*it++ == " "); + assertTrue (it != st.end()); + assertTrue (*it++ == " c c "); + assertTrue (it == st.end()); } { StringTokenizer st(" a a , , c c ", ",", StringTokenizer::TOK_TRIM); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a a") == 0); - assert (st.find("") == 1); - assert (st.find("c c") == 2); - assert (it != st.end()); - assert (*it++ == "a a"); - assert (it != st.end()); - assert (*it++ == ""); - assert (it != st.end()); - assert (*it++ == "c c"); - assert (it == st.end()); + assertTrue (st.find("a a") == 0); + assertTrue (st.find("") == 1); + assertTrue (st.find("c c") == 2); + assertTrue (it != st.end()); + assertTrue (*it++ == "a a"); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it != st.end()); + assertTrue (*it++ == "c c"); + assertTrue (it == st.end()); } { StringTokenizer st(" a a , , c c ", ",", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a a") == 0); - assert (st.find("c c") == 1); - assert (it != st.end()); - assert (*it++ == "a a"); - assert (it != st.end()); - assert (*it++ == "c c"); - assert (it == st.end()); + assertTrue (st.find("a a") == 0); + assertTrue (st.find("c c") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "a a"); + assertTrue (it != st.end()); + assertTrue (*it++ == "c c"); + assertTrue (it == st.end()); } { StringTokenizer st("abc,def,,ghi , jk, l ", ",", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("abc") == 0); - assert (st.find("def") == 1); - assert (st.find("ghi") == 2); - assert (st.find("jk") == 3); - assert (st.find("l") == 4); - assert (it != st.end()); - assert (*it++ == "abc"); - assert (it != st.end()); - assert (*it++ == "def"); - assert (it != st.end()); - assert (*it++ == "ghi"); - assert (it != st.end()); - assert (*it++ == "jk"); - assert (it != st.end()); - assert (*it++ == "l"); - assert (it == st.end()); + assertTrue (st.find("abc") == 0); + assertTrue (st.find("def") == 1); + assertTrue (st.find("ghi") == 2); + assertTrue (st.find("jk") == 3); + assertTrue (st.find("l") == 4); + assertTrue (it != st.end()); + assertTrue (*it++ == "abc"); + assertTrue (it != st.end()); + assertTrue (*it++ == "def"); + assertTrue (it != st.end()); + assertTrue (*it++ == "ghi"); + assertTrue (it != st.end()); + assertTrue (*it++ == "jk"); + assertTrue (it != st.end()); + assertTrue (*it++ == "l"); + assertTrue (it == st.end()); } { StringTokenizer st("abc,def,,ghi // jk, l ", ",/", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("abc") == 0); - assert (st.find("def") == 1); - assert (st.find("ghi") == 2); - assert (st.find("jk") == 3); - assert (st.find("l") == 4); - assert (it != st.end()); - assert (*it++ == "abc"); - assert (it != st.end()); - assert (*it++ == "def"); - assert (it != st.end()); - assert (*it++ == "ghi"); - assert (it != st.end()); - assert (*it++ == "jk"); - assert (it != st.end()); - assert (*it++ == "l"); - assert (it == st.end()); + assertTrue (st.find("abc") == 0); + assertTrue (st.find("def") == 1); + assertTrue (st.find("ghi") == 2); + assertTrue (st.find("jk") == 3); + assertTrue (st.find("l") == 4); + assertTrue (it != st.end()); + assertTrue (*it++ == "abc"); + assertTrue (it != st.end()); + assertTrue (*it++ == "def"); + assertTrue (it != st.end()); + assertTrue (*it++ == "ghi"); + assertTrue (it != st.end()); + assertTrue (*it++ == "jk"); + assertTrue (it != st.end()); + assertTrue (*it++ == "l"); + assertTrue (it == st.end()); } { StringTokenizer st("a/bc,def,,ghi // jk, l ", ",/", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("a") == 0); - assert (st.find("bc") == 1); - assert (st.find("def") == 2); - assert (st.find("ghi") == 3); - assert (st.find("jk") == 4); - assert (st.find("l") == 5); - assert (it != st.end()); - assert (*it++ == "a"); - assert (it != st.end()); - assert (*it++ == "bc"); - assert (it != st.end()); - assert (*it++ == "def"); - assert (it != st.end()); - assert (*it++ == "ghi"); - assert (it != st.end()); - assert (*it++ == "jk"); - assert (it != st.end()); - assert (*it++ == "l"); - assert (it == st.end()); + assertTrue (st.find("a") == 0); + assertTrue (st.find("bc") == 1); + assertTrue (st.find("def") == 2); + assertTrue (st.find("ghi") == 3); + assertTrue (st.find("jk") == 4); + assertTrue (st.find("l") == 5); + assertTrue (it != st.end()); + assertTrue (*it++ == "a"); + assertTrue (it != st.end()); + assertTrue (*it++ == "bc"); + assertTrue (it != st.end()); + assertTrue (*it++ == "def"); + assertTrue (it != st.end()); + assertTrue (*it++ == "ghi"); + assertTrue (it != st.end()); + assertTrue (*it++ == "jk"); + assertTrue (it != st.end()); + assertTrue (*it++ == "l"); + assertTrue (it == st.end()); } { StringTokenizer st(",ab,cd,", ","); StringTokenizer::Iterator it = st.begin(); - assert (st.find("") == 0); - assert (st.find("ab") == 1); - assert (st.find("cd") == 2); - assert (it != st.end()); - assert (*it++ == ""); - assert (it != st.end()); - assert (*it++ == "ab"); - assert (it != st.end()); - assert (*it++ == "cd"); - assert (it != st.end()); - assert (*it++ == ""); - assert (it == st.end()); + assertTrue (st.find("") == 0); + assertTrue (st.find("ab") == 1); + assertTrue (st.find("cd") == 2); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it != st.end()); + assertTrue (*it++ == "ab"); + assertTrue (it != st.end()); + assertTrue (*it++ == "cd"); + assertTrue (it != st.end()); + assertTrue (*it++ == ""); + assertTrue (it == st.end()); } { StringTokenizer st(",ab,cd,", ",", StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("ab") == 0); - assert (st.find("cd") == 1); - assert (it != st.end()); - assert (*it++ == "ab"); - assert (it != st.end()); - assert (*it++ == "cd"); - assert (it == st.end()); + assertTrue (st.find("ab") == 0); + assertTrue (st.find("cd") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "ab"); + assertTrue (it != st.end()); + assertTrue (*it++ == "cd"); + assertTrue (it == st.end()); } { StringTokenizer st(" , ab , cd , ", ",", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); StringTokenizer::Iterator it = st.begin(); - assert (st.find("ab") == 0); - assert (st.find("cd") == 1); - assert (it != st.end()); - assert (*it++ == "ab"); - assert (it != st.end()); - assert (*it++ == "cd"); - assert (it == st.end()); + assertTrue (st.find("ab") == 0); + assertTrue (st.find("cd") == 1); + assertTrue (it != st.end()); + assertTrue (*it++ == "ab"); + assertTrue (it != st.end()); + assertTrue (*it++ == "cd"); + assertTrue (it == st.end()); } { StringTokenizer st("1 : 2 , : 3 ", ":,", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); - assert (st.count() == 3); - assert (st[0] == "1"); - assert (st[1] == "2"); - assert (st[2] == "3"); - assert (st.find("1") == 0); - assert (st.find("2") == 1); - assert (st.find("3") == 2); + assertTrue (st.count() == 3); + assertTrue (st[0] == "1"); + assertTrue (st[1] == "2"); + assertTrue (st[2] == "3"); + assertTrue (st.find("1") == 0); + assertTrue (st.find("2") == 1); + assertTrue (st.find("3") == 2); } { Poco::StringTokenizer st(" 2- ","-", Poco::StringTokenizer::TOK_TRIM); - assert (st.count() == 2); - assert (st[0] == "2"); - assert (st[1] == ""); + assertTrue (st.count() == 2); + assertTrue (st[0] == "2"); + assertTrue (st[1] == ""); } } @@ -338,43 +338,43 @@ void StringTokenizerTest::testFind() { StringTokenizer st("0,1,2,3,3,2,1,0", ",", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY); - assert (st.count() == 8); - assert (2 == st.count("0")); - assert (2 == st.count("1")); - assert (2 == st.count("2")); - assert (2 == st.count("3")); - assert (0 == st.count("4")); - assert (0 == st.count("5")); - assert (0 == st.count("6")); - assert (0 == st.count("7")); + assertTrue (st.count() == 8); + assertTrue (2 == st.count("0")); + assertTrue (2 == st.count("1")); + assertTrue (2 == st.count("2")); + assertTrue (2 == st.count("3")); + assertTrue (0 == st.count("4")); + assertTrue (0 == st.count("5")); + assertTrue (0 == st.count("6")); + assertTrue (0 == st.count("7")); - assert (st[0] == "0"); - assert (st[1] == "1"); - assert (st[2] == "2"); - assert (st[3] == "3"); - assert (st[4] == "3"); - assert (st[5] == "2"); - assert (st[6] == "1"); - assert (st[7] == "0"); + assertTrue (st[0] == "0"); + assertTrue (st[1] == "1"); + assertTrue (st[2] == "2"); + assertTrue (st[3] == "3"); + assertTrue (st[4] == "3"); + assertTrue (st[5] == "2"); + assertTrue (st[6] == "1"); + assertTrue (st[7] == "0"); - assert (st.has("0")); - assert (st.has("1")); - assert (st.has("2")); - assert (st.has("3")); - assert (!st.has("4")); - assert (!st.has("5")); - assert (!st.has("6")); - assert (!st.has("7")); + assertTrue (st.has("0")); + assertTrue (st.has("1")); + assertTrue (st.has("2")); + assertTrue (st.has("3")); + assertTrue (!st.has("4")); + assertTrue (!st.has("5")); + assertTrue (!st.has("6")); + assertTrue (!st.has("7")); - assert (st.find("0") == 0); - assert (st.find("1") == 1); - assert (st.find("2") == 2); - assert (st.find("3") == 3); + assertTrue (st.find("0") == 0); + assertTrue (st.find("1") == 1); + assertTrue (st.find("2") == 2); + assertTrue (st.find("3") == 3); - assert (st.find("0", 1) == 7); - assert (st.find("1", 2) == 6); - assert (st.find("2", 3) == 5); - assert (st.find("3", 4) == 4); + assertTrue (st.find("0", 1) == 7); + assertTrue (st.find("1", 2) == 6); + assertTrue (st.find("2", 3) == 5); + assertTrue (st.find("3", 4) == 4); try { @@ -392,18 +392,18 @@ void StringTokenizerTest::testFind() st[0] = "1"; st[7] = "1"; - assert (st[0] == "1"); - assert (st[7] == "1"); - assert (0 == st.count("0")); - assert (4 == st.count("1")); + assertTrue (st[0] == "1"); + assertTrue (st[7] == "1"); + assertTrue (0 == st.count("0")); + assertTrue (4 == st.count("1")); st.replace("2", "5"); - assert (0 == st.count("2")); - assert (2 == st.count("5")); + assertTrue (0 == st.count("2")); + assertTrue (2 == st.count("5")); st.replace("3", "6", 4); - assert (1 == st.count("3")); - assert (1 == st.count("6")); + assertTrue (1 == st.count("3")); + assertTrue (1 == st.count("6")); } diff --git a/Foundation/testsuite/src/TaskManagerTest.cpp b/Foundation/testsuite/src/TaskManagerTest.cpp index e7a9f7903..f8476b481 100644 --- a/Foundation/testsuite/src/TaskManagerTest.cpp +++ b/Foundation/testsuite/src/TaskManagerTest.cpp @@ -253,27 +253,27 @@ void TaskManagerTest::testFinish() tm.addObserver(Observer(to, &TaskObserver::taskProgress)); AutoPtr pTT = new TestTask; tm.start(pTT.duplicate()); - assert (pTT->progress() == 0); + assertTrue (pTT->progress() == 0); Thread::sleep(200); pTT->cont(); while (pTT->progress() != 0.5) Thread::sleep(50); - assert (to.progress() == 0.5); - assert (to.started()); - assert (pTT->state() == Task::TASK_RUNNING); + assertTrue (to.progress() == 0.5); + assertTrue (to.started()); + assertTrue (pTT->state() == Task::TASK_RUNNING); TaskManager::TaskList list = tm.taskList(); - assert (list.size() == 1); - assert (tm.count() == 1); + assertTrue (list.size() == 1); + assertTrue (tm.count() == 1); pTT->cont(); while (pTT->progress() != 1.0) Thread::sleep(50); pTT->cont(); while (pTT->state() != Task::TASK_FINISHED) Thread::sleep(50); - assert (pTT->state() == Task::TASK_FINISHED); + assertTrue (pTT->state() == Task::TASK_FINISHED); while (!to.finished()) Thread::sleep(50); - assert (to.finished()); + assertTrue (to.finished()); while (tm.count() == 1) Thread::sleep(50); list = tm.taskList(); - assert (list.empty()); - assert (!to.error()); + assertTrue (list.empty()); + assertTrue (!to.error()); } @@ -288,26 +288,26 @@ void TaskManagerTest::testCancel() tm.addObserver(Observer(to, &TaskObserver::taskProgress)); AutoPtr pTT = new TestTask; tm.start(pTT.duplicate()); - assert (pTT->progress() == 0); + assertTrue (pTT->progress() == 0); Thread::sleep(200); pTT->cont(); while (pTT->progress() != 0.5) Thread::sleep(50); - assert (to.progress() == 0.5); - assert (to.started()); - assert (pTT->state() == Task::TASK_RUNNING); + assertTrue (to.progress() == 0.5); + assertTrue (to.started()); + assertTrue (pTT->state() == Task::TASK_RUNNING); TaskManager::TaskList list = tm.taskList(); - assert (list.size() == 1); - assert (tm.count() == 1); + assertTrue (list.size() == 1); + assertTrue (tm.count() == 1); tm.cancelAll(); - assert (to.cancelled()); + assertTrue (to.cancelled()); pTT->cont(); while (pTT->state() != Task::TASK_FINISHED) Thread::sleep(50); - assert (pTT->state() == Task::TASK_FINISHED); - assert (to.finished()); + assertTrue (pTT->state() == Task::TASK_FINISHED); + assertTrue (to.finished()); while (tm.count() == 1) Thread::sleep(50); list = tm.taskList(); - assert (list.empty()); - assert (!to.error()); + assertTrue (list.empty()); + assertTrue (!to.error()); } @@ -322,25 +322,25 @@ void TaskManagerTest::testError() tm.addObserver(Observer(to, &TaskObserver::taskProgress)); AutoPtr pTT = new TestTask; tm.start(pTT.duplicate()); - assert (pTT->progress() == 0); + assertTrue (pTT->progress() == 0); Thread::sleep(200); pTT->cont(); while (pTT->progress() != 0.5) Thread::sleep(50); - assert (to.progress() == 0.5); - assert (to.started()); - assert (pTT->state() == Task::TASK_RUNNING); + assertTrue (to.progress() == 0.5); + assertTrue (to.started()); + assertTrue (pTT->state() == Task::TASK_RUNNING); TaskManager::TaskList list = tm.taskList(); - assert (list.size() == 1); - assert (tm.count() == 1); + assertTrue (list.size() == 1); + assertTrue (tm.count() == 1); pTT->fail(); pTT->cont(); while (pTT->state() != Task::TASK_FINISHED) Thread::sleep(50); - assert (pTT->state() == Task::TASK_FINISHED); - assert (to.finished()); - assert (to.error() != 0); + assertTrue (pTT->state() == Task::TASK_FINISHED); + assertTrue (to.finished()); + assertTrue (to.error() != 0); while (tm.count() == 1) Thread::sleep(50); list = tm.taskList(); - assert (list.empty()); + assertTrue (list.empty()); } @@ -355,12 +355,12 @@ void TaskManagerTest::testCustom() AutoPtr > pCNT1 = new CustomNotificationTask(0); tm.start(pCNT1.duplicate()); - assert (ti.custom() == 0); + assertTrue (ti.custom() == 0); for (int i = 1; i < 10; ++i) { pCNT1->setCustom(i); - assert (ti.custom() == i); + assertTrue (ti.custom() == i); } CustomTaskObserver ts(""); @@ -370,11 +370,11 @@ void TaskManagerTest::testCustom() AutoPtr > pCNT2 = new CustomNotificationTask(""); tm.start(pCNT2.duplicate()); - assert (tm.taskList().size() == 2); - assert (ts.custom() == ""); + assertTrue (tm.taskList().size() == 2); + assertTrue (ts.custom() == ""); std::string str("notify me"); pCNT2->setCustom(str); - assert (ts.custom() == str); + assertTrue (ts.custom() == str); S s; s.i = 0; @@ -388,14 +388,14 @@ void TaskManagerTest::testCustom() AutoPtr > pCNT3 = new CustomNotificationTask(&s); tm.start(pCNT3.duplicate()); - assert (tm.taskList().size() == 3); - assert (ptst.custom()->i == 0); - assert (ptst.custom()->str == ""); + assertTrue (tm.taskList().size() == 3); + assertTrue (ptst.custom()->i == 0); + assertTrue (ptst.custom()->str == ""); s.i = 123; s.str = "123"; pCNT3->setCustom(&s); - assert (ptst.custom()->i == 123); - assert (ptst.custom()->str == "123"); + assertTrue (ptst.custom()->i == 123); + assertTrue (ptst.custom()->str == "123"); s.i = 0; s.str = ""; @@ -408,22 +408,22 @@ void TaskManagerTest::testCustom() AutoPtr > pCNT4 = new CustomNotificationTask(s); tm.start(pCNT4.duplicate()); - assert (tm.taskList().size() == 4); - assert (tst.custom().i == 0); - assert (tst.custom().str == ""); + assertTrue (tm.taskList().size() == 4); + assertTrue (tst.custom().i == 0); + assertTrue (tst.custom().str == ""); s.i = 123; s.str = "123"; pCNT4->setCustom(s); - assert (tst.custom().i == 123); - assert (tst.custom().str == "123"); + assertTrue (tst.custom().i == 123); + assertTrue (tst.custom().str == "123"); AutoPtr pST = new SimpleTask; tm.start(pST.duplicate()); - assert (tm.taskList().size() == 5); + assertTrue (tm.taskList().size() == 5); tm.cancelAll(); while (tm.count() > 0) Thread::sleep(50); - assert (tm.count() == 0); + assertTrue (tm.count() == 0); } @@ -435,11 +435,11 @@ void TaskManagerTest::testMultiTasks() tm.start(new SimpleTask); TaskManager::TaskList list = tm.taskList(); - assert (list.size() == 3); + assertTrue (list.size() == 3); tm.cancelAll(); while (tm.count() > 0) Thread::sleep(100); - assert (tm.count() == 0); + assertTrue (tm.count() == 0); } @@ -453,8 +453,8 @@ void TaskManagerTest::testCustomThreadPool() { tm.start(new SimpleTask); } - assert (tp.allocated() == tp.capacity()); - assert (tm.count() == tp.allocated()); + assertTrue (tp.allocated() == tp.capacity()); + assertTrue (tm.count() == tp.allocated()); // the next one should fail try @@ -470,7 +470,7 @@ void TaskManagerTest::testCustomThreadPool() failmsg("wrong exception thrown"); } - assert (tm.count() == tp.allocated()); + assertTrue (tm.count() == tp.allocated()); tp.joinAll(); } diff --git a/Foundation/testsuite/src/TaskTest.cpp b/Foundation/testsuite/src/TaskTest.cpp index 674f1c82c..591ac06e3 100644 --- a/Foundation/testsuite/src/TaskTest.cpp +++ b/Foundation/testsuite/src/TaskTest.cpp @@ -69,51 +69,51 @@ TaskTest::~TaskTest() void TaskTest::testFinish() { AutoPtr pTT = new TestTask; - assert (pTT->state() == Task::TASK_IDLE); + assertTrue (pTT->state() == Task::TASK_IDLE); Thread thr; thr.start(*pTT); - assert (pTT->progress() == 0); + assertTrue (pTT->progress() == 0); pTT->cont(); while (pTT->progress() != 0.5) Thread::sleep(50); - assert (pTT->state() == Task::TASK_RUNNING); + assertTrue (pTT->state() == Task::TASK_RUNNING); pTT->cont(); while (pTT->progress() != 1.0) Thread::sleep(50); pTT->cont(); thr.join(); - assert (pTT->state() == Task::TASK_FINISHED); + assertTrue (pTT->state() == Task::TASK_FINISHED); } void TaskTest::testCancel1() { AutoPtr pTT = new TestTask; - assert (pTT->state() == Task::TASK_IDLE); + assertTrue (pTT->state() == Task::TASK_IDLE); Thread thr; thr.start(*pTT); - assert (pTT->progress() == 0); + assertTrue (pTT->progress() == 0); pTT->cont(); while (pTT->progress() != 0.5) Thread::sleep(50); - assert (pTT->state() == Task::TASK_RUNNING); + assertTrue (pTT->state() == Task::TASK_RUNNING); pTT->cancel(); - assert (pTT->state() == Task::TASK_CANCELLING); + assertTrue (pTT->state() == Task::TASK_CANCELLING); pTT->cont(); thr.join(); - assert (pTT->state() == Task::TASK_FINISHED); + assertTrue (pTT->state() == Task::TASK_FINISHED); } void TaskTest::testCancel2() { AutoPtr pTT = new TestTask; - assert (pTT->state() == Task::TASK_IDLE); + assertTrue (pTT->state() == Task::TASK_IDLE); Thread thr; thr.start(*pTT); - assert (pTT->progress() == 0); + assertTrue (pTT->progress() == 0); pTT->cancel(); - assert (pTT->state() == Task::TASK_CANCELLING); + assertTrue (pTT->state() == Task::TASK_CANCELLING); pTT->cont(); thr.join(); - assert (pTT->state() == Task::TASK_FINISHED); + assertTrue (pTT->state() == Task::TASK_FINISHED); } diff --git a/Foundation/testsuite/src/TeeStreamTest.cpp b/Foundation/testsuite/src/TeeStreamTest.cpp index 7de9f8e98..6a4be8986 100644 --- a/Foundation/testsuite/src/TeeStreamTest.cpp +++ b/Foundation/testsuite/src/TeeStreamTest.cpp @@ -37,7 +37,7 @@ void TeeStreamTest::testTeeInputStream() tis.addStream(ostr); std::string s; tis >> s; - assert (ostr.str() == "foo"); + assertTrue (ostr.str() == "foo"); } @@ -48,8 +48,8 @@ void TeeStreamTest::testTeeOutputStream() TeeOutputStream tos(ostr1); tos.addStream(ostr2); tos << "bar" << std::flush; - assert (ostr1.str() == "bar"); - assert (ostr2.str() == "bar"); + assertTrue (ostr1.str() == "bar"); + assertTrue (ostr2.str() == "bar"); } diff --git a/Foundation/testsuite/src/TextBufferIteratorTest.cpp b/Foundation/testsuite/src/TextBufferIteratorTest.cpp index 407663b07..e7291bba5 100644 --- a/Foundation/testsuite/src/TextBufferIteratorTest.cpp +++ b/Foundation/testsuite/src/TextBufferIteratorTest.cpp @@ -40,7 +40,7 @@ void TextBufferIteratorTest::testEmptyLatin1() TextBufferIterator it(text, encoding); TextBufferIterator end(it.end()); - assert (it == end); + assertTrue (it == end); } @@ -51,10 +51,10 @@ void TextBufferIteratorTest::testOneLatin1() TextBufferIterator it(text, encoding); TextBufferIterator end(it.end()); - assert (it != end); - assert (*it == 'x'); + assertTrue (it != end); + assertTrue (*it == 'x'); ++it; - assert (it == end); + assertTrue (it == end); } @@ -65,24 +65,24 @@ void TextBufferIteratorTest::testLatin1() TextBufferIterator it(text, encoding); TextBufferIterator end(it.end()); - assert (it != end); - assert (*it++ == 'L'); - assert (it != end); - assert (*it++ == 'a'); - assert (it != end); - assert (*it++ == 't'); - assert (it != end); - assert (*it++ == 'i'); - assert (it != end); - assert (*it++ == 'n'); - assert (it != end); - assert (*it++ == '1'); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 'L'); + assertTrue (it != end); + assertTrue (*it++ == 'a'); + assertTrue (it != end); + assertTrue (*it++ == 't'); + assertTrue (it != end); + assertTrue (*it++ == 'i'); + assertTrue (it != end); + assertTrue (*it++ == 'n'); + assertTrue (it != end); + assertTrue (*it++ == '1'); + assertTrue (it == end); const char* empty = ""; it = TextBufferIterator(empty, encoding); end = it.end(); - assert (it == end); + assertTrue (it == end); } @@ -93,7 +93,7 @@ void TextBufferIteratorTest::testEmptyUTF8() TextBufferIterator it(text, encoding); TextBufferIterator end(text); - assert (it == end); + assertTrue (it == end); } @@ -106,50 +106,50 @@ void TextBufferIteratorTest::testOneUTF8() TextBufferIterator it(text, encoding); TextBufferIterator end(it.end()); - assert (it != end); - assert (*it == 'x'); + assertTrue (it != end); + assertTrue (*it == 'x'); ++it; - assert (it == end); + assertTrue (it == end); unsigned char data[Poco::TextEncoding::MAX_SEQUENCE_LENGTH]; // 2 byte sequence int n = encoding.convert(0xab, data, sizeof(data)); - assert (n == 2); + assertTrue (n == 2); it = TextBufferIterator(reinterpret_cast(data), n, encoding); end = it.end(); - assert (it != end); - assert (*it++ == 0xab); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0xab); + assertTrue (it == end); // 3 byte sequence n = encoding.convert(0xabcd, data, sizeof(data)); - assert (n == 3); + assertTrue (n == 3); it = TextBufferIterator(reinterpret_cast(data), n, encoding); end = it.end(); - assert (it != end); - assert (*it++ == 0xabcd); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0xabcd); + assertTrue (it == end); // 4 byte sequence n = encoding.convert(0xabcde, data, sizeof(data)); - assert (n == 4); + assertTrue (n == 4); it = TextBufferIterator(reinterpret_cast(data), n, encoding); end = it.end(); - assert (it != end); - assert (*it++ == 0xabcde); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0xabcde); + assertTrue (it == end); // 5 byte sequence - not supported n = encoding.convert(0xabcdef, data, sizeof(data)); - assert (n == 0); + assertTrue (n == 0); // 6 byte sequence - not supported n = encoding.convert(0xfabcdef, data, sizeof(data)); - assert (n == 0); + assertTrue (n == 0); } @@ -160,21 +160,21 @@ void TextBufferIteratorTest::testUTF8() TextBufferIterator it(reinterpret_cast(text), encoding); TextBufferIterator end(it.end()); - assert (it != end); - assert (*it++ == 0x0020); - assert (it != end); - assert (*it++ == 0x03ba); - assert (it != end); - assert (*it++ == 0x1f79); - assert (it != end); - assert (*it++ == 0x03c3); - assert (it != end); - assert (*it++ == 0x03bc); - assert (it != end); - assert (*it++ == 0x03b5); - assert (it != end); - assert (*it++ == 0x0020); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0x0020); + assertTrue (it != end); + assertTrue (*it++ == 0x03ba); + assertTrue (it != end); + assertTrue (*it++ == 0x1f79); + assertTrue (it != end); + assertTrue (*it++ == 0x03c3); + assertTrue (it != end); + assertTrue (*it++ == 0x03bc); + assertTrue (it != end); + assertTrue (*it++ == 0x03b5); + assertTrue (it != end); + assertTrue (*it++ == 0x0020); + assertTrue (it == end); } @@ -185,17 +185,17 @@ void TextBufferIteratorTest::testUTF8Supplementary() TextBufferIterator it(reinterpret_cast(text), encoding); TextBufferIterator end(it.end()); - assert (it != end); - assert (*it++ == 0x0041); - assert (it != end); - assert (*it++ == 0x0042); - assert (it != end); - assert (*it++ == 0x100a4); - assert (it != end); - assert (*it++ == 0x2f9a0); - assert (it != end); - assert (*it++ == 0x2fa1d); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0x0041); + assertTrue (it != end); + assertTrue (*it++ == 0x0042); + assertTrue (it != end); + assertTrue (*it++ == 0x100a4); + assertTrue (it != end); + assertTrue (*it++ == 0x2f9a0); + assertTrue (it != end); + assertTrue (*it++ == 0x2fa1d); + assertTrue (it == end); } @@ -206,17 +206,17 @@ void TextBufferIteratorTest::testUTF16Supplementary() TextBufferIterator it(reinterpret_cast(text), sizeof(text), encoding); TextBufferIterator end(it.end()); - assert (it != end); - assert (*it++ == 0x0041); - assert (it != end); - assert (*it++ == 0x0042); - assert (it != end); - assert (*it++ == 0x100a4); - assert (it != end); - assert (*it++ == 0x2f9a0); - assert (it != end); - assert (*it++ == 0x2fa1d); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0x0041); + assertTrue (it != end); + assertTrue (*it++ == 0x0042); + assertTrue (it != end); + assertTrue (*it++ == 0x100a4); + assertTrue (it != end); + assertTrue (*it++ == 0x2f9a0); + assertTrue (it != end); + assertTrue (*it++ == 0x2fa1d); + assertTrue (it == end); } @@ -228,11 +228,11 @@ void TextBufferIteratorTest::testSwap() TextBufferIterator it2(text, encoding); TextBufferIterator end(it1.end()); - assert (it1 == it2); + assertTrue (it1 == it2); it2.swap(end); - assert (it1 != it2); + assertTrue (it1 != it2); it2.swap(end); - assert (it1 == it2); + assertTrue (it1 == it2); } diff --git a/Foundation/testsuite/src/TextConverterTest.cpp b/Foundation/testsuite/src/TextConverterTest.cpp index 733297c10..0de7ca1ff 100644 --- a/Foundation/testsuite/src/TextConverterTest.cpp +++ b/Foundation/testsuite/src/TextConverterTest.cpp @@ -43,35 +43,35 @@ void TextConverterTest::testIdentityASCII() std::string empty; std::string result0; int errors = converter.convert(empty, result0); - assert (result0 == empty); - assert (errors == 0); + assertTrue (result0 == empty); + assertTrue (errors == 0); std::string fooBar = "foo bar"; std::string result1; errors = converter.convert(fooBar, result1); - assert (result1 == fooBar); - assert (errors == 0); + assertTrue (result1 == fooBar); + assertTrue (errors == 0); std::string result2; errors = converter.convert(fooBar.data(), (int) fooBar.length(), result2); - assert (result2 == fooBar); - assert (errors == 0); + assertTrue (result2 == fooBar); + assertTrue (errors == 0); std::string result3; errors = converter.convert("", 0, result3); - assert (result3.empty()); - assert (errors == 0); + assertTrue (result3.empty()); + assertTrue (errors == 0); std::string x = "x"; std::string result4; errors = converter.convert(x, result4); - assert (result4 == x); - assert (errors == 0); + assertTrue (result4 == x); + assertTrue (errors == 0); std::string result5; errors = converter.convert("x", 1, result5); - assert (result5 == x); - assert (errors == 0); + assertTrue (result5 == x); + assertTrue (errors == 0); } @@ -83,59 +83,59 @@ void TextConverterTest::testIdentityUTF8() std::string empty; std::string result0; int errors = converter.convert(empty, result0); - assert (result0 == empty); - assert (errors == 0); + assertTrue (result0 == empty); + assertTrue (errors == 0); std::string fooBar = "foo bar"; std::string result1; errors = converter.convert(fooBar, result1); - assert (result1 == fooBar); - assert (errors == 0); + assertTrue (result1 == fooBar); + assertTrue (errors == 0); std::string result2; errors = converter.convert(fooBar.data(), (int) fooBar.length(), result2); - assert (result2 == fooBar); - assert (errors == 0); + assertTrue (result2 == fooBar); + assertTrue (errors == 0); std::string result3; errors = converter.convert("", 0, result3); - assert (result3.empty()); - assert (errors == 0); + assertTrue (result3.empty()); + assertTrue (errors == 0); const unsigned char greek[] = {0x20, 0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0x20, 0x00}; std::string text((const char*) greek); std::string result4; errors = converter.convert(text, result4); - assert (result4 == text); - assert (errors == 0); + assertTrue (result4 == text); + assertTrue (errors == 0); std::string result5; errors = converter.convert((char*) greek, 13, result5); - assert (result5 == text); - assert (errors == 0); + assertTrue (result5 == text); + assertTrue (errors == 0); std::string x = "x"; std::string result6; errors = converter.convert(x, result6); - assert (result6 == x); - assert (errors == 0); + assertTrue (result6 == x); + assertTrue (errors == 0); std::string result7; errors = converter.convert("x", 1, result7); - assert (result7 == x); - assert (errors == 0); + assertTrue (result7 == x); + assertTrue (errors == 0); std::string utfChar((char*) greek + 1, 2); std::string result8; errors = converter.convert(utfChar, result8); - assert (result8 == utfChar); - assert (errors == 0); + assertTrue (result8 == utfChar); + assertTrue (errors == 0); std::string result9; errors = converter.convert((char*) greek + 1, 2, result9); - assert (result9 == utfChar); - assert (errors == 0); + assertTrue (result9 == utfChar); + assertTrue (errors == 0); } @@ -149,12 +149,12 @@ void TextConverterTest::testUTF8toASCII() std::string text((const char*) greek); std::string result0; int errors = converter.convert(text, result0); - assert (result0 == " ????? AB"); - assert (errors == 0); + assertTrue (result0 == " ????? AB"); + assertTrue (errors == 0); std::string result1; errors = converter.convert("abcde", 5, result1); - assert (result1 == "abcde"); + assertTrue (result1 == "abcde"); } @@ -171,14 +171,14 @@ void TextConverterTest::testLatin1toUTF8() std::string result0; int errors = converter.convert(latin1Text, result0); - assert (result0 == utf8Text); - assert (errors == 0); + assertTrue (result0 == utf8Text); + assertTrue (errors == 0); assertEqual((long) result0.size(), 7); std::string result1; errors = converter.convert(latin1Chars, 6, result1); - assert (result1 == utf8Text); - assert (errors == 0); + assertTrue (result1 == utf8Text); + assertTrue (errors == 0); } @@ -322,7 +322,7 @@ void TextConverterTest::testErrors() std::string result; int errors = converter.convert(badText, result); - assert (errors == 2); + assertTrue (errors == 2); } diff --git a/Foundation/testsuite/src/TextEncodingTest.cpp b/Foundation/testsuite/src/TextEncodingTest.cpp index 2ca851b7c..7f5f9d6f2 100644 --- a/Foundation/testsuite/src/TextEncodingTest.cpp +++ b/Foundation/testsuite/src/TextEncodingTest.cpp @@ -37,57 +37,57 @@ TextEncodingTest::~TextEncodingTest() void TextEncodingTest::testTextEncoding() { TextEncoding& utf8 = TextEncoding::byName("utf8"); - assert (std::string("UTF-8") == utf8.canonicalName()); + assertTrue (std::string("UTF-8") == utf8.canonicalName()); TextEncoding& latin1 = TextEncoding::byName("latin1"); - assert (std::string("ISO-8859-1") == latin1.canonicalName()); + assertTrue (std::string("ISO-8859-1") == latin1.canonicalName()); TextEncoding& latin2 = TextEncoding::byName("latin2"); - assert (std::string("ISO-8859-2") == latin2.canonicalName()); + assertTrue (std::string("ISO-8859-2") == latin2.canonicalName()); TextEncoding& latin9 = TextEncoding::byName("latin9"); - assert (std::string("ISO-8859-15") == latin9.canonicalName()); + assertTrue (std::string("ISO-8859-15") == latin9.canonicalName()); TextEncoding& cp1250 = TextEncoding::byName("CP1250"); - assert (std::string("windows-1250") == cp1250.canonicalName()); + assertTrue (std::string("windows-1250") == cp1250.canonicalName()); TextEncoding& cp1251 = TextEncoding::byName("CP1251"); - assert (std::string("windows-1251") == cp1251.canonicalName()); + assertTrue (std::string("windows-1251") == cp1251.canonicalName()); TextEncoding& cp1252 = TextEncoding::byName("CP1252"); - assert (std::string("windows-1252") == cp1252.canonicalName()); + assertTrue (std::string("windows-1252") == cp1252.canonicalName()); TextEncoding& glob = TextEncoding::global(); - assert (std::string("UTF-8") == glob.canonicalName()); + assertTrue (std::string("UTF-8") == glob.canonicalName()); TextEncoding::global(new Latin1Encoding); TextEncoding& glob2 = TextEncoding::global(); - assert (std::string("ISO-8859-1") == glob2.canonicalName()); + assertTrue (std::string("ISO-8859-1") == glob2.canonicalName()); TextEncoding::global(new Latin2Encoding); TextEncoding& glob3 = TextEncoding::global(); - assert (std::string("ISO-8859-2") == glob3.canonicalName()); + assertTrue (std::string("ISO-8859-2") == glob3.canonicalName()); TextEncoding::global(new Latin9Encoding); TextEncoding& glob4 = TextEncoding::global(); - assert (std::string("ISO-8859-15") == glob4.canonicalName()); + assertTrue (std::string("ISO-8859-15") == glob4.canonicalName()); TextEncoding::global(new Windows1250Encoding); TextEncoding& glob5 = TextEncoding::global(); - assert (std::string("windows-1250") == glob5.canonicalName()); + assertTrue (std::string("windows-1250") == glob5.canonicalName()); TextEncoding::global(new Windows1251Encoding); TextEncoding& glob6 = TextEncoding::global(); - assert (std::string("windows-1251") == glob6.canonicalName()); + assertTrue (std::string("windows-1251") == glob6.canonicalName()); TextEncoding::global(new Windows1252Encoding); TextEncoding& glob7 = TextEncoding::global(); - assert (std::string("windows-1252") == glob7.canonicalName()); + assertTrue (std::string("windows-1252") == glob7.canonicalName()); TextEncoding::global(new UTF8Encoding); TextEncoding& glob8 = TextEncoding::global(); - assert (std::string("UTF-8") == glob8.canonicalName()); + assertTrue (std::string("UTF-8") == glob8.canonicalName()); } diff --git a/Foundation/testsuite/src/TextIteratorTest.cpp b/Foundation/testsuite/src/TextIteratorTest.cpp index 7383df64a..3c0ec34ec 100644 --- a/Foundation/testsuite/src/TextIteratorTest.cpp +++ b/Foundation/testsuite/src/TextIteratorTest.cpp @@ -40,7 +40,7 @@ void TextIteratorTest::testEmptyLatin1() TextIterator it(text, encoding); TextIterator end(text); - assert (it == end); + assertTrue (it == end); } @@ -51,10 +51,10 @@ void TextIteratorTest::testOneLatin1() TextIterator it(text, encoding); TextIterator end(text); - assert (it != end); - assert (*it == 'x'); + assertTrue (it != end); + assertTrue (*it == 'x'); ++it; - assert (it == end); + assertTrue (it == end); } @@ -65,24 +65,24 @@ void TextIteratorTest::testLatin1() TextIterator it(text, encoding); TextIterator end(text); - assert (it != end); - assert (*it++ == 'L'); - assert (it != end); - assert (*it++ == 'a'); - assert (it != end); - assert (*it++ == 't'); - assert (it != end); - assert (*it++ == 'i'); - assert (it != end); - assert (*it++ == 'n'); - assert (it != end); - assert (*it++ == '1'); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 'L'); + assertTrue (it != end); + assertTrue (*it++ == 'a'); + assertTrue (it != end); + assertTrue (*it++ == 't'); + assertTrue (it != end); + assertTrue (*it++ == 'i'); + assertTrue (it != end); + assertTrue (*it++ == 'n'); + assertTrue (it != end); + assertTrue (*it++ == '1'); + assertTrue (it == end); std::string empty; it = TextIterator(empty, encoding); end = TextIterator(empty); - assert (it == end); + assertTrue (it == end); } @@ -93,7 +93,7 @@ void TextIteratorTest::testEmptyUTF8() TextIterator it(text, encoding); TextIterator end(text); - assert (it == end); + assertTrue (it == end); } @@ -106,53 +106,53 @@ void TextIteratorTest::testOneUTF8() TextIterator it(text, encoding); TextIterator end(text); - assert (it != end); - assert (*it == 'x'); + assertTrue (it != end); + assertTrue (*it == 'x'); ++it; - assert (it == end); + assertTrue (it == end); unsigned char data[Poco::TextEncoding::MAX_SEQUENCE_LENGTH]; // 2 byte sequence int n = encoding.convert(0xab, data, sizeof(data)); - assert (n == 2); + assertTrue (n == 2); text.assign((char*) data, n); it = TextIterator(text, encoding); end = TextIterator(text); - assert (it != end); - assert (*it++ == 0xab); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0xab); + assertTrue (it == end); // 3 byte sequence n = encoding.convert(0xabcd, data, sizeof(data)); - assert (n == 3); + assertTrue (n == 3); text.assign((char*) data, n); it = TextIterator(text, encoding); end = TextIterator(text); - assert (it != end); - assert (*it++ == 0xabcd); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0xabcd); + assertTrue (it == end); // 4 byte sequence n = encoding.convert(0xabcde, data, sizeof(data)); - assert (n == 4); + assertTrue (n == 4); text.assign((char*) data, n); it = TextIterator(text, encoding); end = TextIterator(text); - assert (it != end); - assert (*it++ == 0xabcde); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0xabcde); + assertTrue (it == end); // 5 byte sequence - not supported n = encoding.convert(0xabcdef, data, sizeof(data)); - assert (n == 0); + assertTrue (n == 0); // 6 byte sequence - not supported n = encoding.convert(0xfabcdef, data, sizeof(data)); - assert (n == 0); + assertTrue (n == 0); } @@ -164,21 +164,21 @@ void TextIteratorTest::testUTF8() TextIterator it(text, encoding); TextIterator end(text); - assert (it != end); - assert (*it++ == 0x0020); - assert (it != end); - assert (*it++ == 0x03ba); - assert (it != end); - assert (*it++ == 0x1f79); - assert (it != end); - assert (*it++ == 0x03c3); - assert (it != end); - assert (*it++ == 0x03bc); - assert (it != end); - assert (*it++ == 0x03b5); - assert (it != end); - assert (*it++ == 0x0020); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0x0020); + assertTrue (it != end); + assertTrue (*it++ == 0x03ba); + assertTrue (it != end); + assertTrue (*it++ == 0x1f79); + assertTrue (it != end); + assertTrue (*it++ == 0x03c3); + assertTrue (it != end); + assertTrue (*it++ == 0x03bc); + assertTrue (it != end); + assertTrue (*it++ == 0x03b5); + assertTrue (it != end); + assertTrue (*it++ == 0x0020); + assertTrue (it == end); } @@ -190,17 +190,17 @@ void TextIteratorTest::testUTF8Supplementary() TextIterator it(text, encoding); TextIterator end(text); - assert (it != end); - assert (*it++ == 0x0041); - assert (it != end); - assert (*it++ == 0x0042); - assert (it != end); - assert (*it++ == 0x100a4); - assert (it != end); - assert (*it++ == 0x2f9a0); - assert (it != end); - assert (*it++ == 0x2fa1d); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0x0041); + assertTrue (it != end); + assertTrue (*it++ == 0x0042); + assertTrue (it != end); + assertTrue (*it++ == 0x100a4); + assertTrue (it != end); + assertTrue (*it++ == 0x2f9a0); + assertTrue (it != end); + assertTrue (*it++ == 0x2fa1d); + assertTrue (it == end); } @@ -212,17 +212,17 @@ void TextIteratorTest::testUTF16Supplementary() TextIterator it(text, encoding); TextIterator end(text); - assert (it != end); - assert (*it++ == 0x0041); - assert (it != end); - assert (*it++ == 0x0042); - assert (it != end); - assert (*it++ == 0x100a4); - assert (it != end); - assert (*it++ == 0x2f9a0); - assert (it != end); - assert (*it++ == 0x2fa1d); - assert (it == end); + assertTrue (it != end); + assertTrue (*it++ == 0x0041); + assertTrue (it != end); + assertTrue (*it++ == 0x0042); + assertTrue (it != end); + assertTrue (*it++ == 0x100a4); + assertTrue (it != end); + assertTrue (*it++ == 0x2f9a0); + assertTrue (it != end); + assertTrue (*it++ == 0x2fa1d); + assertTrue (it == end); } @@ -234,11 +234,11 @@ void TextIteratorTest::testSwap() TextIterator it2(text, encoding); TextIterator end(text); - assert (it1 == it2); + assertTrue (it1 == it2); it2.swap(end); - assert (it1 != it2); + assertTrue (it1 != it2); it2.swap(end); - assert (it1 == it2); + assertTrue (it1 == it2); } diff --git a/Foundation/testsuite/src/ThreadLocalTest.cpp b/Foundation/testsuite/src/ThreadLocalTest.cpp index 22af10211..654f7dce2 100644 --- a/Foundation/testsuite/src/ThreadLocalTest.cpp +++ b/Foundation/testsuite/src/ThreadLocalTest.cpp @@ -83,9 +83,9 @@ void ThreadLocalTest::testLocality() t2.join(); t3.join(); - assert (r1.result() == 5000); - assert (r2.result() == 7500); - assert (r3.result() == 6000); + assertTrue (r1.result() == 5000); + assertTrue (r2.result() == 7500); + assertTrue (r3.result() == 6000); } @@ -94,10 +94,10 @@ void ThreadLocalTest::testAccessors() ThreadLocal ts; ts->i = 100; ts->s = "foo"; - assert ((*ts).i == 100); - assert ((*ts).s == "foo"); - assert (ts.get().i == 100); - assert (ts.get().s == "foo"); + assertTrue ((*ts).i == 100); + assertTrue ((*ts).s == "foo"); + assertTrue (ts.get().i == 100); + assertTrue (ts.get().s == "foo"); } diff --git a/Foundation/testsuite/src/ThreadPoolTest.cpp b/Foundation/testsuite/src/ThreadPoolTest.cpp index 71032391f..c04967257 100644 --- a/Foundation/testsuite/src/ThreadPoolTest.cpp +++ b/Foundation/testsuite/src/ThreadPoolTest.cpp @@ -37,40 +37,40 @@ void ThreadPoolTest::testThreadPool() ThreadPool pool(2, 3, 3); pool.setStackSize(1); - assert (pool.allocated() == 2); - assert (pool.used() == 0); - assert (pool.capacity() == 3); - assert (pool.available() == 3); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 0); + assertTrue (pool.capacity() == 3); + assertTrue (pool.available() == 3); pool.addCapacity(1); - assert (pool.allocated() == 2); - assert (pool.used() == 0); - assert (pool.capacity() == 4); - assert (pool.available() == 4); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 0); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 4); RunnableAdapter ra(*this, &ThreadPoolTest::count); pool.start(ra); - assert (pool.allocated() == 2); - assert (pool.used() == 1); - assert (pool.capacity() == 4); - assert (pool.available() == 3); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 1); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 3); pool.start(ra); - assert (pool.allocated() == 2); - assert (pool.used() == 2); - assert (pool.capacity() == 4); - assert (pool.available() == 2); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 2); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 2); pool.start(ra); - assert (pool.allocated() == 3); - assert (pool.used() == 3); - assert (pool.capacity() == 4); - assert (pool.available() == 1); + assertTrue (pool.allocated() == 3); + assertTrue (pool.used() == 3); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 1); pool.start(ra); - assert (pool.allocated() == 4); - assert (pool.used() == 4); - assert (pool.capacity() == 4); - assert (pool.available() == 0); + assertTrue (pool.allocated() == 4); + assertTrue (pool.used() == 4); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 0); try { @@ -88,43 +88,43 @@ void ThreadPoolTest::testThreadPool() _event.set(); // go!!! pool.joinAll(); - assert (_count == 40000); + assertTrue (_count == 40000); - assert (pool.allocated() == 4); - assert (pool.used() == 0); - assert (pool.capacity() == 4); - assert (pool.available() == 4); + assertTrue (pool.allocated() == 4); + assertTrue (pool.used() == 0); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 4); Thread::sleep(4000); pool.collect(); - assert (pool.allocated() == 2); - assert (pool.used() == 0); - assert (pool.capacity() == 4); - assert (pool.available() == 4); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 0); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 4); _count = 0; _event.reset(); pool.start(ra); - assert (pool.allocated() == 2); - assert (pool.used() == 1); - assert (pool.capacity() == 4); - assert (pool.available() == 3); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 1); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 3); pool.start(ra); - assert (pool.allocated() == 2); - assert (pool.used() == 2); - assert (pool.capacity() == 4); - assert (pool.available() == 2); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 2); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 2); _event.set(); // go!!! pool.joinAll(); - assert (_count == 20000); + assertTrue (_count == 20000); - assert (pool.allocated() == 2); - assert (pool.used() == 0); - assert (pool.capacity() == 4); - assert (pool.available() == 4); + assertTrue (pool.allocated() == 2); + assertTrue (pool.used() == 0); + assertTrue (pool.capacity() == 4); + assertTrue (pool.available() == 4); } diff --git a/Foundation/testsuite/src/ThreadTest.cpp b/Foundation/testsuite/src/ThreadTest.cpp index 615aa81a8..475e8067b 100644 --- a/Foundation/testsuite/src/ThreadTest.cpp +++ b/Foundation/testsuite/src/ThreadTest.cpp @@ -159,15 +159,15 @@ void ThreadTest::testThread() { Thread thread; MyRunnable r; - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); thread.start(r); Thread::sleep(200); - assert (thread.isRunning()); + assertTrue (thread.isRunning()); r.notify(); thread.join(); - assert (!thread.isRunning()); - assert (r.ran()); - assert (!r.threadName().empty()); + assertTrue (!thread.isRunning()); + assertTrue (r.ran()); + assertTrue (!r.threadName().empty()); } @@ -178,8 +178,8 @@ void ThreadTest::testNamedThread() thread.start(r); r.notify(); thread.join(); - assert (r.ran()); - assert (r.threadName() == "MyThread"); + assertTrue (r.ran()); + assertTrue (r.threadName() == "MyThread"); } @@ -200,47 +200,47 @@ void ThreadTest::testThreads() MyRunnable r2; MyRunnable r3; MyRunnable r4; - assert (!thread1.isRunning()); - assert (!thread2.isRunning()); - assert (!thread3.isRunning()); - assert (!thread4.isRunning()); + assertTrue (!thread1.isRunning()); + assertTrue (!thread2.isRunning()); + assertTrue (!thread3.isRunning()); + assertTrue (!thread4.isRunning()); thread1.start(r1); Thread::sleep(200); - assert (thread1.isRunning()); - assert (!thread2.isRunning()); - assert (!thread3.isRunning()); - assert (!thread4.isRunning()); + assertTrue (thread1.isRunning()); + assertTrue (!thread2.isRunning()); + assertTrue (!thread3.isRunning()); + assertTrue (!thread4.isRunning()); thread2.start(r2); thread3.start(r3); thread4.start(r4); Thread::sleep(200); - assert (thread1.isRunning()); - assert (thread2.isRunning()); - assert (thread3.isRunning()); - assert (thread4.isRunning()); + assertTrue (thread1.isRunning()); + assertTrue (thread2.isRunning()); + assertTrue (thread3.isRunning()); + assertTrue (thread4.isRunning()); r4.notify(); thread4.join(); - assert (!thread4.isRunning()); - assert (thread1.isRunning()); - assert (thread2.isRunning()); - assert (thread3.isRunning()); + assertTrue (!thread4.isRunning()); + assertTrue (thread1.isRunning()); + assertTrue (thread2.isRunning()); + assertTrue (thread3.isRunning()); r3.notify(); thread3.join(); - assert (!thread3.isRunning()); + assertTrue (!thread3.isRunning()); r2.notify(); thread2.join(); - assert (!thread2.isRunning()); + assertTrue (!thread2.isRunning()); r1.notify(); thread1.join(); - assert (!thread1.isRunning()); - assert (r1.ran()); - assert (r1.threadName() == "Thread1"); - assert (r2.ran()); - assert (r2.threadName() == "Thread2"); - assert (r3.ran()); - assert (r3.threadName() == "Thread3"); - assert (r4.ran()); - assert (r4.threadName() == "Thread4"); + assertTrue (!thread1.isRunning()); + assertTrue (r1.ran()); + assertTrue (r1.threadName() == "Thread1"); + assertTrue (r2.ran()); + assertTrue (r2.threadName() == "Thread2"); + assertTrue (r3.ran()); + assertTrue (r3.threadName() == "Thread3"); + assertTrue (r4.ran()); + assertTrue (r4.threadName() == "Thread4"); } @@ -248,14 +248,14 @@ void ThreadTest::testJoin() { Thread thread; MyRunnable r; - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); thread.start(r); Thread::sleep(200); - assert (thread.isRunning()); - assert (!thread.tryJoin(100)); + assertTrue (thread.isRunning()); + assertTrue (!thread.tryJoin(100)); r.notify(); - assert (thread.tryJoin(500)); - assert (!thread.isRunning()); + assertTrue (thread.tryJoin(500)); + assertTrue (!thread.isRunning()); } @@ -271,7 +271,7 @@ void ThreadTest::testNotJoin() } Thread::sleep(100); - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); } @@ -279,30 +279,30 @@ void ThreadTest::testTrySleep() { Thread thread; TrySleepRunnable r; - assert(r.isSleepy()); - assert(!thread.isRunning()); - assert(r.counter() == 0); + assertTrue (r.isSleepy()); + assertTrue (!thread.isRunning()); + assertTrue (r.counter() == 0); thread.start(r); - assert(thread.isRunning()); - assert(r.counter() == 0); - assert(r.isSleepy()); + assertTrue (thread.isRunning()); + assertTrue (r.counter() == 0); + assertTrue (r.isSleepy()); Thread::sleep(100); - assert(r.counter() == 0); - assert(r.isSleepy()); + assertTrue (r.counter() == 0); + assertTrue (r.isSleepy()); thread.wakeUp(); Thread::sleep(10); - assert(r.counter() == 1); - assert(r.isSleepy()); + assertTrue (r.counter() == 1); + assertTrue (r.isSleepy()); Thread::sleep(100); - assert(r.counter() == 1); + assertTrue (r.counter() == 1); thread.wakeUp(); Thread::sleep(10); - assert(r.counter() == 2); - assert(r.isSleepy()); + assertTrue (r.counter() == 2); + assertTrue (r.isSleepy()); Thread::sleep(200); - assert(r.counter() == 3); - assert(!r.isSleepy()); - assert(!thread.isRunning()); + assertTrue (r.counter() == 3); + assertTrue (!r.isSleepy()); + assertTrue (!thread.isRunning()); thread.wakeUp(); - assert(!thread.isRunning()); + assertTrue (!thread.isRunning()); } @@ -324,20 +324,20 @@ void ThreadTest::testThreadTarget() ThreadTarget te(&MyRunnable::staticFunc); Thread thread; - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); int tmp = MyRunnable::_staticVar; thread.start(te); thread.join(); - assert (tmp + 1 == MyRunnable::_staticVar); + assertTrue (tmp + 1 == MyRunnable::_staticVar); ThreadTarget te1(freeFunc); - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); tmp = MyRunnable::_staticVar; thread.start(te1); thread.join(); - assert (tmp + 1 == MyRunnable::_staticVar); + assertTrue (tmp + 1 == MyRunnable::_staticVar); } @@ -345,19 +345,19 @@ void ThreadTest::testThreadFunction() { Thread thread; - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); int tmp = MyRunnable::_staticVar; thread.start(freeFunc, &tmp); thread.join(); - assert (tmp * 2 == MyRunnable::_staticVar); + assertTrue (tmp * 2 == MyRunnable::_staticVar); - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); tmp = MyRunnable::_staticVar = 0; thread.start(freeFunc, &tmp); thread.join(); - assert (0 == MyRunnable::_staticVar); + assertTrue (0 == MyRunnable::_staticVar); } @@ -374,27 +374,27 @@ void ThreadTest::testThreadFunctor() { Thread thread; - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); MyRunnable::_staticVar = 0; thread.startFunc(Functor()); thread.join(); - assert (1 == MyRunnable::_staticVar); + assertTrue (1 == MyRunnable::_staticVar); - assert (!thread.isRunning()); + assertTrue (!thread.isRunning()); #if __cplusplus >= 201103L Thread thread2; - assert (!thread2.isRunning()); + assertTrue (!thread2.isRunning()); MyRunnable::_staticVar = 0; thread.startFunc([] () {MyRunnable::_staticVar++;}); thread.join(); - assert (1 == MyRunnable::_staticVar); + assertTrue (1 == MyRunnable::_staticVar); - assert (!thread2.isRunning()); + assertTrue (!thread2.isRunning()); #endif } @@ -406,36 +406,36 @@ void ThreadTest::testThreadStackSize() Thread thread; - assert (0 == thread.getStackSize()); + assertTrue (0 == thread.getStackSize()); thread.setStackSize(stackSize); - assert (stackSize <= thread.getStackSize()); + assertTrue (stackSize <= thread.getStackSize()); int tmp = MyRunnable::_staticVar; thread.start(freeFunc, &tmp); thread.join(); - assert (tmp * 2 == MyRunnable::_staticVar); + assertTrue (tmp * 2 == MyRunnable::_staticVar); stackSize = 1; thread.setStackSize(stackSize); #if !defined(POCO_OS_FAMILY_BSD) // on BSD family, stack size is rounded #ifdef PTHREAD_STACK_MIN - assert (PTHREAD_STACK_MIN == thread.getStackSize()); + assertTrue (PTHREAD_STACK_MIN == thread.getStackSize()); #else - assert (stackSize >= thread.getStackSize()); + assertTrue (stackSize >= thread.getStackSize()); #endif #endif tmp = MyRunnable::_staticVar; thread.start(freeFunc, &tmp); thread.join(); - assert (tmp * 2 == MyRunnable::_staticVar); + assertTrue (tmp * 2 == MyRunnable::_staticVar); thread.setStackSize(0); - assert (0 == thread.getStackSize()); + assertTrue (0 == thread.getStackSize()); tmp = MyRunnable::_staticVar; thread.start(freeFunc, &tmp); thread.join(); - assert (tmp * 2 == MyRunnable::_staticVar); + assertTrue (tmp * 2 == MyRunnable::_staticVar); } @@ -444,7 +444,7 @@ void ThreadTest::testSleep() Poco::Timestamp start; Thread::sleep(200); Poco::Timespan elapsed = start.elapsed(); - assert (elapsed.totalMilliseconds() >= 190 && elapsed.totalMilliseconds() < 250); + assertTrue (elapsed.totalMilliseconds() >= 190 && elapsed.totalMilliseconds() < 250); } diff --git a/Foundation/testsuite/src/TimedNotificationQueueTest.cpp b/Foundation/testsuite/src/TimedNotificationQueueTest.cpp index d6d0e02f1..c7fc57dc0 100644 --- a/Foundation/testsuite/src/TimedNotificationQueueTest.cpp +++ b/Foundation/testsuite/src/TimedNotificationQueueTest.cpp @@ -58,17 +58,17 @@ TimedNotificationQueueTest::~TimedNotificationQueueTest() void TimedNotificationQueueTest::testDequeue() { TimedNotificationQueue queue; - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); Notification* pNf = queue.dequeueNotification(); assertNullPtr(pNf); queue.enqueueNotification(new Notification, Timestamp()); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pNf = queue.dequeueNotification(); assertNotNullPtr(pNf); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); pNf->release(); Poco::Clock ts1; @@ -84,19 +84,19 @@ void TimedNotificationQueueTest::testDequeue() queue.enqueueNotification(new QTestNotification("fourth"), ts4); queue.enqueueNotification(new QTestNotification("third"), ts3); queue.enqueueNotification(new QTestNotification("second"), ts2); - assert (!queue.empty()); - assert (queue.size() == 4); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 4); QTestNotification* pTNf = 0; while (!pTNf) { pTNf = dynamic_cast(queue.dequeueNotification()); } assertNotNullPtr(pTNf); - assert (pTNf->data() == "first"); + assertTrue (pTNf->data() == "first"); pTNf->release(); - assert (ts1.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 3); + assertTrue (ts1.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 3); pTNf = 0; while (!pTNf) @@ -104,11 +104,11 @@ void TimedNotificationQueueTest::testDequeue() pTNf = dynamic_cast(queue.dequeueNotification()); } assertNotNullPtr(pTNf); - assert (pTNf->data() == "second"); + assertTrue (pTNf->data() == "second"); pTNf->release(); - assert (ts2.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (ts2.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); pTNf = 0; while (!pTNf) @@ -116,11 +116,11 @@ void TimedNotificationQueueTest::testDequeue() pTNf = dynamic_cast(queue.dequeueNotification()); } assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (ts3.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (ts3.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = 0; while (!pTNf) @@ -128,11 +128,11 @@ void TimedNotificationQueueTest::testDequeue() pTNf = dynamic_cast(queue.dequeueNotification()); } assertNotNullPtr(pTNf); - assert (pTNf->data() == "fourth"); + assertTrue (pTNf->data() == "fourth"); pTNf->release(); - assert (ts4.elapsed() >= 0); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (ts4.elapsed() >= 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); pNf = queue.dequeueNotification(); assertNullPtr(pNf); @@ -156,39 +156,39 @@ void TimedNotificationQueueTest::testWaitDequeue() queue.enqueueNotification(new QTestNotification("fourth"), ts4); queue.enqueueNotification(new QTestNotification("third"), ts3); queue.enqueueNotification(new QTestNotification("second"), ts2); - assert (!queue.empty()); - assert (queue.size() == 4); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 4); QTestNotification* pTNf = dynamic_cast(queue.waitDequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "first"); + assertTrue (pTNf->data() == "first"); pTNf->release(); - assert (ts1.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 3); + assertTrue (ts1.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 3); pTNf = dynamic_cast(queue.waitDequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "second"); + assertTrue (pTNf->data() == "second"); pTNf->release(); - assert (ts2.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (ts2.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); pTNf = dynamic_cast(queue.waitDequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (ts3.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (ts3.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.waitDequeueNotification()); assertNotNullPtr(pTNf); - assert (pTNf->data() == "fourth"); + assertTrue (pTNf->data() == "fourth"); pTNf->release(); - assert (ts4.elapsed() >= 0); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (ts4.elapsed() >= 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); } @@ -209,43 +209,43 @@ void TimedNotificationQueueTest::testWaitDequeueTimeout() queue.enqueueNotification(new QTestNotification("fourth"), ts4); queue.enqueueNotification(new QTestNotification("third"), ts3); queue.enqueueNotification(new QTestNotification("second"), ts2); - assert (!queue.empty()); - assert (queue.size() == 4); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 4); QTestNotification* pTNf = dynamic_cast(queue.waitDequeueNotification(10)); assertNullPtr(pTNf); pTNf = dynamic_cast(queue.waitDequeueNotification(20)); assertNullPtr(pTNf); pTNf = dynamic_cast(queue.waitDequeueNotification(200)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "first"); + assertTrue (pTNf->data() == "first"); pTNf->release(); - assert (ts1.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 3); + assertTrue (ts1.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 3); pTNf = dynamic_cast(queue.waitDequeueNotification(220)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "second"); + assertTrue (pTNf->data() == "second"); pTNf->release(); - assert (ts2.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 2); + assertTrue (ts2.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 2); pTNf = dynamic_cast(queue.waitDequeueNotification(220)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "third"); + assertTrue (pTNf->data() == "third"); pTNf->release(); - assert (ts3.elapsed() >= 0); - assert (!queue.empty()); - assert (queue.size() == 1); + assertTrue (ts3.elapsed() >= 0); + assertTrue (!queue.empty()); + assertTrue (queue.size() == 1); pTNf = dynamic_cast(queue.waitDequeueNotification(220)); assertNotNullPtr(pTNf); - assert (pTNf->data() == "fourth"); + assertTrue (pTNf->data() == "fourth"); pTNf->release(); - assert (ts1.elapsed() >= 0); - assert (queue.empty()); - assert (queue.size() == 0); + assertTrue (ts1.elapsed() >= 0); + assertTrue (queue.empty()); + assertTrue (queue.size() == 0); } diff --git a/Foundation/testsuite/src/TimerTest.cpp b/Foundation/testsuite/src/TimerTest.cpp index b910bf9b1..07c5eb5a6 100644 --- a/Foundation/testsuite/src/TimerTest.cpp +++ b/Foundation/testsuite/src/TimerTest.cpp @@ -34,8 +34,8 @@ TimerTest::~TimerTest() void TimerTest::testTimer() { Timer t(100, 200); - assert (t.getStartInterval() == 100); - assert (t.getPeriodicInterval() == 200); + assertTrue (t.getStartInterval() == 100); + assertTrue (t.getPeriodicInterval() == 200); Stopwatch sw; TimerCallback tc(*this, &TimerTest::onTimer); @@ -43,15 +43,15 @@ void TimerTest::testTimer() t.start(tc); _event.wait(); sw.stop(); - assert (sw.elapsed() >= 80000 && sw.elapsed() < 120000); + assertTrue (sw.elapsed() >= 80000 && sw.elapsed() < 120000); sw.restart(); _event.wait(); sw.stop(); - assert (sw.elapsed() >= 180000 && sw.elapsed() < 250000); + assertTrue (sw.elapsed() >= 180000 && sw.elapsed() < 250000); sw.restart(); _event.wait(); sw.stop(); - assert (sw.elapsed() >= 180000 && sw.elapsed() < 250000); + assertTrue (sw.elapsed() >= 180000 && sw.elapsed() < 250000); t.stop(); } diff --git a/Foundation/testsuite/src/TimespanTest.cpp b/Foundation/testsuite/src/TimespanTest.cpp index d7a630346..fe7eb7076 100644 --- a/Foundation/testsuite/src/TimespanTest.cpp +++ b/Foundation/testsuite/src/TimespanTest.cpp @@ -30,46 +30,46 @@ TimespanTest::~TimespanTest() void TimespanTest::testConversions() { Timespan ts; - assert (ts.totalMicroseconds() == 0); + assertTrue (ts.totalMicroseconds() == 0); ts = Timespan::DAYS; - assert (ts.totalMicroseconds() == Timespan::DAYS); - assert (ts.totalMilliseconds() == 86400000); - assert (ts.totalSeconds() == 86400); - assert (ts.totalMinutes() == 60*24); - assert (ts.totalHours() == 24); - assert (ts.days() == 1); + assertTrue (ts.totalMicroseconds() == Timespan::DAYS); + assertTrue (ts.totalMilliseconds() == 86400000); + assertTrue (ts.totalSeconds() == 86400); + assertTrue (ts.totalMinutes() == 60*24); + assertTrue (ts.totalHours() == 24); + assertTrue (ts.days() == 1); - assert (ts.microseconds() == 0); - assert (ts.milliseconds() == 0); - assert (ts.seconds() == 0); - assert (ts.minutes() == 0); - assert (ts.hours() == 0); + assertTrue (ts.microseconds() == 0); + assertTrue (ts.milliseconds() == 0); + assertTrue (ts.seconds() == 0); + assertTrue (ts.minutes() == 0); + assertTrue (ts.hours() == 0); ts.assign(2, 12, 30, 10, 123456); - assert (ts.microseconds() == 456); - assert (ts.milliseconds() == 123); - assert (ts.seconds() == 10); - assert (ts.minutes() == 30); - assert (ts.hours() == 12); - assert (ts.days() == 2); + assertTrue (ts.microseconds() == 456); + assertTrue (ts.milliseconds() == 123); + assertTrue (ts.seconds() == 10); + assertTrue (ts.minutes() == 30); + assertTrue (ts.hours() == 12); + assertTrue (ts.days() == 2); ts.assign(0, 36, 30, 10, 123456); - assert (ts.microseconds() == 456); - assert (ts.milliseconds() == 123); - assert (ts.useconds() == 123456); - assert (ts.seconds() == 10); - assert (ts.minutes() == 30); - assert (ts.hours() == 12); - assert (ts.days() == 1); + assertTrue (ts.microseconds() == 456); + assertTrue (ts.milliseconds() == 123); + assertTrue (ts.useconds() == 123456); + assertTrue (ts.seconds() == 10); + assertTrue (ts.minutes() == 30); + assertTrue (ts.hours() == 12); + assertTrue (ts.days() == 1); ts.assign(0, 0, 2190, 10, 123456); - assert (ts.microseconds() == 456); - assert (ts.milliseconds() == 123); - assert (ts.useconds() == 123456); - assert (ts.seconds() == 10); - assert (ts.minutes() == 30); - assert (ts.hours() == 12); - assert (ts.days() == 1); + assertTrue (ts.microseconds() == 456); + assertTrue (ts.milliseconds() == 123); + assertTrue (ts.useconds() == 123456); + assertTrue (ts.seconds() == 10); + assertTrue (ts.minutes() == 30); + assertTrue (ts.hours() == 12); + assertTrue (ts.days() == 1); } @@ -79,28 +79,28 @@ void TimespanTest::testComparisons() Timespan ts2(20000000); Timespan ts3(20000000); - assert (ts1 != ts2); - assert (!(ts1 == ts2)); - assert (ts1 <= ts2); - assert (ts1 < ts2); - assert (ts2 > ts1); - assert (ts2 >= ts1); + assertTrue (ts1 != ts2); + assertTrue (!(ts1 == ts2)); + assertTrue (ts1 <= ts2); + assertTrue (ts1 < ts2); + assertTrue (ts2 > ts1); + assertTrue (ts2 >= ts1); - assert (ts2 == ts3); - assert (!(ts2 != ts3)); - assert (ts2 >= ts3); - assert (ts2 <= ts3); - assert (!(ts2 > ts3)); - assert (!(ts2 < ts3)); + assertTrue (ts2 == ts3); + assertTrue (!(ts2 != ts3)); + assertTrue (ts2 >= ts3); + assertTrue (ts2 <= ts3); + assertTrue (!(ts2 > ts3)); + assertTrue (!(ts2 < ts3)); - assert (ts1 == 10000000); - assert (ts1 != 20000000); - assert (ts1 <= 10000000); - assert (ts1 <= 20000000); - assert (ts1 >= 10000000); - assert (ts1 >= 5000000); - assert (ts1 < 20000000); - assert (ts1 > 5000000); + assertTrue (ts1 == 10000000); + assertTrue (ts1 != 20000000); + assertTrue (ts1 <= 10000000); + assertTrue (ts1 <= 20000000); + assertTrue (ts1 >= 10000000); + assertTrue (ts1 >= 5000000); + assertTrue (ts1 < 20000000); + assertTrue (ts1 > 5000000); } @@ -110,17 +110,17 @@ void TimespanTest::testArithmetics() Timespan ts2(50000000); Timespan ts3; ts3 = ts1 + ts2; - assert (ts3 == 150000000); + assertTrue (ts3 == 150000000); ts3 = ts1 + 30000000; - assert (ts3 == 130000000); + assertTrue (ts3 == 130000000); ts3 = ts1 - ts2; - assert (ts3 == 50000000); + assertTrue (ts3 == 50000000); ts3 = ts1 - 20000000; - assert (ts3 == 80000000); + assertTrue (ts3 == 80000000); ts3 += 20000000; - assert (ts3 == ts1); + assertTrue (ts3 == ts1); ts3 -= ts2; - assert (ts3 == ts2); + assertTrue (ts3 == ts2); } @@ -129,9 +129,9 @@ void TimespanTest::testSwap() Timespan ts1(10000000); Timespan ts2(50000000); - assert (ts1 < ts2); + assertTrue (ts1 < ts2); ts1.swap(ts2); - assert (ts2 < ts1); + assertTrue (ts2 < ts1); } diff --git a/Foundation/testsuite/src/TimestampTest.cpp b/Foundation/testsuite/src/TimestampTest.cpp index e431ee587..a6bcf8b14 100644 --- a/Foundation/testsuite/src/TimestampTest.cpp +++ b/Foundation/testsuite/src/TimestampTest.cpp @@ -35,37 +35,37 @@ void TimestampTest::testTimestamp() Thread::sleep(200); Timestamp t2; Timestamp t3 = t2; - assert (t1 != t2); - assert (!(t1 == t2)); - assert (t2 > t1); - assert (t2 >= t1); - assert (!(t1 > t2)); - assert (!(t1 >= t2)); - assert (t2 == t3); - assert (!(t2 != t3)); - assert (t2 >= t3); - assert (t2 <= t3); + assertTrue (t1 != t2); + assertTrue (!(t1 == t2)); + assertTrue (t2 > t1); + assertTrue (t2 >= t1); + assertTrue (!(t1 > t2)); + assertTrue (!(t1 >= t2)); + assertTrue (t2 == t3); + assertTrue (!(t2 != t3)); + assertTrue (t2 >= t3); + assertTrue (t2 <= t3); Timestamp::TimeDiff d = (t2 - t1); - assert (d >= 180000 && d <= 300000); + assertTrue (d >= 180000 && d <= 300000); t1.swap(t2); - assert (t1 > t2); + assertTrue (t1 > t2); t2.swap(t1); Timestamp::UtcTimeVal tv = t1.utcTime(); Timestamp t4 = Timestamp::fromUtcTime(tv); - assert (t1 == t4); + assertTrue (t1 == t4); Timestamp epoch(0); tv = epoch.utcTime(); - assert (tv >> 32 == 0x01B21DD2); - assert ((tv & 0xFFFFFFFF) == 0x13814000); + assertTrue (tv >> 32 == 0x01B21DD2); + assertTrue ((tv & 0xFFFFFFFF) == 0x13814000); Timestamp now; Thread::sleep(201); - assert (now.elapsed() >= 200000); - assert (now.isElapsed(200000)); - assert (!now.isElapsed(2000000)); + assertTrue (now.elapsed() >= 200000); + assertTrue (now.isElapsed(200000)); + assertTrue (!now.isElapsed(2000000)); #if defined(_WIN32) { @@ -74,7 +74,7 @@ void TimestampTest::testTimestamp() Poco::UInt32 high; now.toFileTimeNP(low, high); Timestamp ts = Timestamp::fromFileTimeNP(low, high); - assert (now == ts); + assertTrue (now == ts); } #endif } diff --git a/Foundation/testsuite/src/TuplesTest.cpp b/Foundation/testsuite/src/TuplesTest.cpp index b505d7c8b..a5beec740 100644 --- a/Foundation/testsuite/src/TuplesTest.cpp +++ b/Foundation/testsuite/src/TuplesTest.cpp @@ -57,151 +57,151 @@ TuplesTest::~TuplesTest() void TuplesTest::testTuple1() { Tuple t; - assert (t.length == 1); + assertTrue (t.length == 1); t.set<0>(-1); - assert (t.get<0>() == -1); + assertTrue (t.get<0>() == -1); Tuple t2(-1); - assert (t2.get<0>() == -1); + assertTrue (t2.get<0>() == -1); Tuple tCpy (t2); - assert (t2.get<0>() == tCpy.get<0>()); - assert (t2 == tCpy); + assertTrue (t2.get<0>() == tCpy.get<0>()); + assertTrue (t2 == tCpy); Tuple tCpy2 = t2; - assert (t2.get<0>() == tCpy2.get<0>()); - assert (t2 == tCpy2); + assertTrue (t2.get<0>() == tCpy2.get<0>()); + assertTrue (t2 == tCpy2); tCpy2.set<0>(888); - assert (t2 != tCpy2); - assert (t < tCpy2); + assertTrue (t2 != tCpy2); + assertTrue (t < tCpy2); Tuple t3(0); - assert (t3.get<1>().empty()); + assertTrue (t3.get<1>().empty()); Tuple > t4(0); - assert (t4.get<1>().empty()); - assert (t4.get<2>().empty()); + assertTrue (t4.get<1>().empty()); + assertTrue (t4.get<2>().empty()); } void TuplesTest::testTuple2() { Tuple dummy1; - assert (dummy1.length == 2); + assertTrue (dummy1.length == 2); dummy1.set<0>(-1); - assert (dummy1.get<0>() == -1); + assertTrue (dummy1.get<0>() == -1); //test partial init Tuple dummy11(0); Tuple dummy2; dummy2.set<1>(-1); - assert (dummy2.get<1>() == -1); + assertTrue (dummy2.get<1>() == -1); Tuple dummy3; dummy3.set<1>(-1); - assert (dummy3.get<1>() == -1); + assertTrue (dummy3.get<1>() == -1); Tuple aTuple; aTuple.set<0>("str"); aTuple.set<1>(1); - assert (aTuple.get<0>() == "str"); - assert (aTuple.get<1>() == 1); + assertTrue (aTuple.get<0>() == "str"); + assertTrue (aTuple.get<1>() == 1); Tuple aTuple2(aTuple); - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.set<1>(99); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple2.set<1>(100000); - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple3() { Tuple dummy1; - assert (dummy1.length == 3); + assertTrue (dummy1.length == 3); dummy1.set<0>(-1); - assert (dummy1.get<0>() == -1); + assertTrue (dummy1.get<0>() == -1); //test partial init Tuple dummy11(0); Tuple dummy2; dummy2.set<1>(-1); - assert (dummy2.get<1>() == -1); + assertTrue (dummy2.get<1>() == -1); Tuple dummy3; dummy3.set<2>(-1); - assert (dummy3.get<2>() == -1); + assertTrue (dummy3.get<2>() == -1); Tuple aTuple; aTuple.set<0>("str"); aTuple.set<1>(1); aTuple.set<2>(true); - assert (aTuple.get<0>() == "str"); - assert (aTuple.get<1>() == 1); - assert (aTuple.get<2>()); + assertTrue (aTuple.get<0>() == "str"); + assertTrue (aTuple.get<1>() == 1); + assertTrue (aTuple.get<2>()); Tuple aTuple2(aTuple); - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.set<2>(false); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple2.set<1>(100000); - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple4() { Tuple dummy1; - assert (dummy1.length == 4); + assertTrue (dummy1.length == 4); dummy1.set<0>(-1); - assert (dummy1.get<0>() == -1); + assertTrue (dummy1.get<0>() == -1); //test partial init Tuple dummy11(0); Tuple dummy2; dummy2.set<1>(-1); - assert (dummy2.get<1>() == -1); + assertTrue (dummy2.get<1>() == -1); Tuple dummy3; dummy3.set<3>(-1); - assert (dummy3.get<3>() == -1); + assertTrue (dummy3.get<3>() == -1); Tuple aTuple; aTuple.set<0>("str"); aTuple.set<1>(1); aTuple.set<2>(true); aTuple.set<3>(3.14f); - assert (aTuple.get<0>() == "str"); - assert (aTuple.get<1>() == 1); - assert (aTuple.get<2>()); - assert (aTuple.get<3>() >= 3.13f && aTuple.get<3>() <= 3.15f); + assertTrue (aTuple.get<0>() == "str"); + assertTrue (aTuple.get<1>() == 1); + assertTrue (aTuple.get<2>()); + assertTrue (aTuple.get<3>() >= 3.13f && aTuple.get<3>() <= 3.15f); Tuple aTuple2(aTuple); - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.set<2>(false); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple2.set<1>(100000); - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple5() { Tuple dummy1; - assert (dummy1.length == 5); + assertTrue (dummy1.length == 5); dummy1.set<0>(-1); - assert (dummy1.get<0>() == -1); + assertTrue (dummy1.get<0>() == -1); //test partial init Tuple dummy11(0); Tuple dummy2; dummy2.set<1>(-1); - assert (dummy2.get<1>() == -1); + assertTrue (dummy2.get<1>() == -1); Tuple dummy3; dummy3.set<4>(-1); - assert (dummy3.get<4>() == -1); + assertTrue (dummy3.get<4>() == -1); Tuple aTuple; aTuple.set<0>("str"); @@ -209,73 +209,73 @@ void TuplesTest::testTuple5() aTuple.set<2>(true); aTuple.set<3>(3.14f); aTuple.set<4>(' '); - assert (aTuple.get<0>() == "str"); - assert (aTuple.get<1>() == 1); - assert (aTuple.get<2>()); - assert (aTuple.get<3>() >= 3.13f && aTuple.get<3>() <= 3.15f); - assert (aTuple.get<4>() == ' '); + assertTrue (aTuple.get<0>() == "str"); + assertTrue (aTuple.get<1>() == 1); + assertTrue (aTuple.get<2>()); + assertTrue (aTuple.get<3>() >= 3.13f && aTuple.get<3>() <= 3.15f); + assertTrue (aTuple.get<4>() == ' '); Tuple aTuple2(aTuple); - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.set<2>(false); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple2.set<1>(100000); - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple6() { Tuple aTuple; - assert (aTuple.length == 6); + assertTrue (aTuple.length == 6); Tuple aTuple2("1", 1, true, 3.14f, 'c', 999); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple7() { Tuple aTuple; - assert (aTuple.length == 7); + assertTrue (aTuple.length == 7); Tuple aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple8() { Tuple aTuple; - assert (aTuple.length == 8); + assertTrue (aTuple.length == 8); Tuple aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } void TuplesTest::testTuple9() { Tuple aTuple; - assert (aTuple.length == 9); + assertTrue (aTuple.length == 9); Tuple aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2"); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -284,13 +284,13 @@ void TuplesTest::testTuple10() typedef Tuple TupleType; TupleType aTuple; - assert (aTuple.length == 10); + assertTrue (aTuple.length == 10); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -300,13 +300,13 @@ void TuplesTest::testTuple11() std::string> TupleType; TupleType aTuple; - assert (aTuple.length == 11); + assertTrue (aTuple.length == 11); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1"); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -316,13 +316,13 @@ void TuplesTest::testTuple12() std::string, int> TupleType; TupleType aTuple; - assert (aTuple.length == 12); + assertTrue (aTuple.length == 12); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -332,13 +332,13 @@ void TuplesTest::testTuple13() std::string, int, bool> TupleType; TupleType aTuple; - assert (aTuple.length == 13); + assertTrue (aTuple.length == 13); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -348,13 +348,13 @@ void TuplesTest::testTuple14() std::string, int, bool, float> TupleType; TupleType aTuple; - assert (aTuple.length == 14); + assertTrue (aTuple.length == 14); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -364,13 +364,13 @@ void TuplesTest::testTuple15() std::string, int, bool, float, char> TupleType; TupleType aTuple; - assert (aTuple.length == 15); + assertTrue (aTuple.length == 15); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c'); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -380,13 +380,13 @@ void TuplesTest::testTuple16() std::string, int, bool, float, char, long> TupleType; TupleType aTuple; - assert (aTuple.length == 16); + assertTrue (aTuple.length == 16); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c', 999); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -396,13 +396,13 @@ void TuplesTest::testTuple17() std::string, int, bool, float, char, long, double> TupleType; TupleType aTuple; - assert (aTuple.length == 17); + assertTrue (aTuple.length == 17); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c', 999, 33.14); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -412,13 +412,13 @@ void TuplesTest::testTuple18() std::string, int, bool, float, char, long, double, short> TupleType; TupleType aTuple; - assert (aTuple.length == 18); + assertTrue (aTuple.length == 18); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c', 999, 33.14, 32700); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -428,13 +428,13 @@ void TuplesTest::testTuple19() std::string, int, bool, float, char, long, double, short, std::string> TupleType; TupleType aTuple; - assert (aTuple.length == 19); + assertTrue (aTuple.length == 19); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2"); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -444,14 +444,14 @@ void TuplesTest::testTuple20() std::string, int, bool, float, char, long, double, short, std::string, int> TupleType; TupleType aTuple; - assert (aTuple.length == 20); + assertTrue (aTuple.length == 20); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); } @@ -461,19 +461,19 @@ void TuplesTest::testTupleOrder() std::string, int, bool, float, char, long, double, short, std::string, int> TupleType; TupleType aTuple; - assert (aTuple.length == 20); + assertTrue (aTuple.length == 20); TupleType aTuple2("1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2, "1", 1, true, 3.14f, 'c', 999, 33.14, 32700, "2", 2); - assert (aTuple != aTuple2); + assertTrue (aTuple != aTuple2); aTuple = aTuple2; - assert (aTuple == aTuple2); + assertTrue (aTuple == aTuple2); aTuple2.get<1>()++; - assert (aTuple < aTuple2); + assertTrue (aTuple < aTuple2); TupleType aTuple3; aTuple3 = aTuple2; aTuple3.get<1>()++; - assert (aTuple2 < aTuple3); + assertTrue (aTuple2 < aTuple3); testTupleStrictWeak(aTuple, aTuple2, aTuple3); @@ -482,26 +482,26 @@ void TuplesTest::testTupleOrder() tv.push_back(aTuple); tv.push_back(aTuple2); - assert (tv[0] == aTuple3); - assert (tv[1] == aTuple); - assert (tv[2] == aTuple2); + assertTrue (tv[0] == aTuple3); + assertTrue (tv[1] == aTuple); + assertTrue (tv[2] == aTuple2); std::sort(tv.begin(), tv.end()); - assert (tv[0] == aTuple); - assert (tv[1] == aTuple2); - assert (tv[2] == aTuple3); + assertTrue (tv[0] == aTuple); + assertTrue (tv[1] == aTuple2); + assertTrue (tv[2] == aTuple3); std::map tm; std::pair::iterator, bool> mIt = tm.insert(std::map::value_type(aTuple2, 2)); - assert (mIt.second); + assertTrue (mIt.second); mIt = tm.insert(std::map::value_type(aTuple, 1)); - assert (mIt.second); + assertTrue (mIt.second); mIt = tm.insert(std::map::value_type(aTuple3, 3)); - assert (mIt.second); + assertTrue (mIt.second); std::map::iterator fIt = tm.find(aTuple2); - assert (2 == fIt->second); + assertTrue (2 == fIt->second); typedef Tuple StrTup; typedef std::map StrTupMap; @@ -519,17 +519,17 @@ void TuplesTest::testTupleOrder() strMap.insert(StrTupMap::value_type(st3, 3)); strMap.insert(StrTupMap::value_type(st4, 4)); - assert (1 == strMap[st1]); - assert (2 == strMap[st2]); - assert (3 == strMap[st3]); - assert (4 == strMap[st4]); + assertTrue (1 == strMap[st1]); + assertTrue (2 == strMap[st2]); + assertTrue (3 == strMap[st3]); + assertTrue (4 == strMap[st4]); StrTupMap::iterator it = strMap.begin(); - assert (st4 == it->first); ++it; - assert (st2 == it->first); ++it; - assert (st1 == it->first); ++it; - assert (st3 == it->first); ++it; - assert (it == strMap.end()); + assertTrue (st4 == it->first); ++it; + assertTrue (st2 == it->first); ++it; + assertTrue (st1 == it->first); ++it; + assertTrue (st3 == it->first); ++it; + assertTrue (it == strMap.end()); } @@ -537,10 +537,10 @@ void TuplesTest::testMemOverhead() { Tuple smallOne(0); int sz = sizeof(smallOne); - assert (sz == 4 || sz == 8); //depending on architecture and alignment + assertTrue (sz == 4 || sz == 8); //depending on architecture and alignment Tuple notSoSmall(0); sz = sizeof(notSoSmall); - assert (sz == 8 || sz == 16); //depending on architecture and alignment + assertTrue (sz == 8 || sz == 16); //depending on architecture and alignment } diff --git a/Foundation/testsuite/src/TuplesTest.h b/Foundation/testsuite/src/TuplesTest.h index c3ee60764..cee79b549 100644 --- a/Foundation/testsuite/src/TuplesTest.h +++ b/Foundation/testsuite/src/TuplesTest.h @@ -56,9 +56,9 @@ private: template void testTupleStrictWeak(const T& t1, const T& t2, const T& t3) { - assert (t1 < t2 && !(t2 < t1)); // antisymmetric - assert (t1 < t2 && t2 < t3 && t1 < t3); // transitive - assert (!(t1 < t1)); // irreflexive + assertTrue (t1 < t2 && !(t2 < t1)); // antisymmetric + assertTrue (t1 < t2 && t2 < t3 && t1 < t3); // transitive + assertTrue (!(t1 < t1)); // irreflexive } }; diff --git a/Foundation/testsuite/src/TypeListTest.cpp b/Foundation/testsuite/src/TypeListTest.cpp index 8b8e0fbb0..e7560b7a6 100644 --- a/Foundation/testsuite/src/TypeListTest.cpp +++ b/Foundation/testsuite/src/TypeListTest.cpp @@ -99,188 +99,188 @@ void TypeListTest::testTypeList() static POCO_UNUSED TypeLocator pos8; static POCO_UNUSED TypeLocator posUnknown; - assert (pos0.value == 0); - assert (pos1.value == 1); - assert (pos2.value == 2); - assert (pos3.value == 3); - assert (pos4.value == 4); - assert (pos5.value == 5); - assert (pos6.value == 6); - assert (pos7.value == 7); - assert (pos8.value == 0); - assert (posUnknown.value == -1); + assertTrue (pos0.value == 0); + assertTrue (pos1.value == 1); + assertTrue (pos2.value == 2); + assertTrue (pos3.value == 3); + assertTrue (pos4.value == 4); + assertTrue (pos5.value == 5); + assertTrue (pos6.value == 6); + assertTrue (pos7.value == 7); + assertTrue (pos8.value == 0); + assertTrue (posUnknown.value == -1); tuple.set::value >(-123); - assert (-123 == tuple.get<4>()); + assertTrue (-123 == tuple.get<4>()); - assert (typeid(TypeGetter<0, Type15>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<0, Type15>::ConstHeadType) == typeid(const Int8)); - assert (typeid(TypeGetter<1, Type15>::HeadType) == typeid(UInt8)); - assert (typeid(TypeGetter<1, Type15>::ConstHeadType) == typeid(const UInt8)); - assert (typeid(TypeGetter<2, Type15>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<2, Type15>::ConstHeadType) == typeid(const Int16)); - assert (typeid(TypeGetter<3, Type15>::HeadType) == typeid(UInt16)); - assert (typeid(TypeGetter<3, Type15>::ConstHeadType) == typeid(const UInt16)); - assert (typeid(TypeGetter<4, Type15>::HeadType) == typeid(Int32)); - assert (typeid(TypeGetter<4, Type15>::ConstHeadType) == typeid(const Int32)); - assert (typeid(TypeGetter<5, Type15>::HeadType) == typeid(UInt32)); - assert (typeid(TypeGetter<5, Type15>::ConstHeadType) == typeid(const UInt32)); - assert (typeid(TypeGetter<6, Type15>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<6, Type15>::ConstHeadType) == typeid(const float)); - assert (typeid(TypeGetter<7, Type15>::HeadType) == typeid(double)); - assert (typeid(TypeGetter<7, Type15>::ConstHeadType) == typeid(const double)); - assert (typeid(TypeGetter<8, Type15>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<8, Type15>::ConstHeadType) == typeid(const Int8)); - assert (typeid(TypeGetter<9, Type15>::HeadType) == typeid(UInt8)); - assert (typeid(TypeGetter<9, Type15>::ConstHeadType) == typeid(const UInt8)); - assert (typeid(TypeGetter<10, Type15>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<10, Type15>::ConstHeadType) == typeid(const Int16)); - assert (typeid(TypeGetter<11, Type15>::HeadType) == typeid(UInt16)); - assert (typeid(TypeGetter<11, Type15>::ConstHeadType) == typeid(const UInt16)); - assert (typeid(TypeGetter<12, Type15>::HeadType) == typeid(Int32)); - assert (typeid(TypeGetter<12, Type15>::ConstHeadType) == typeid(const Int32)); - assert (typeid(TypeGetter<13, Type15>::HeadType) == typeid(UInt32)); - assert (typeid(TypeGetter<13, Type15>::ConstHeadType) == typeid(const UInt32)); - assert (typeid(TypeGetter<14, Type15>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<14, Type15>::ConstHeadType) == typeid(const float)); + assertTrue (typeid(TypeGetter<0, Type15>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<0, Type15>::ConstHeadType) == typeid(const Int8)); + assertTrue (typeid(TypeGetter<1, Type15>::HeadType) == typeid(UInt8)); + assertTrue (typeid(TypeGetter<1, Type15>::ConstHeadType) == typeid(const UInt8)); + assertTrue (typeid(TypeGetter<2, Type15>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<2, Type15>::ConstHeadType) == typeid(const Int16)); + assertTrue (typeid(TypeGetter<3, Type15>::HeadType) == typeid(UInt16)); + assertTrue (typeid(TypeGetter<3, Type15>::ConstHeadType) == typeid(const UInt16)); + assertTrue (typeid(TypeGetter<4, Type15>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<4, Type15>::ConstHeadType) == typeid(const Int32)); + assertTrue (typeid(TypeGetter<5, Type15>::HeadType) == typeid(UInt32)); + assertTrue (typeid(TypeGetter<5, Type15>::ConstHeadType) == typeid(const UInt32)); + assertTrue (typeid(TypeGetter<6, Type15>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<6, Type15>::ConstHeadType) == typeid(const float)); + assertTrue (typeid(TypeGetter<7, Type15>::HeadType) == typeid(double)); + assertTrue (typeid(TypeGetter<7, Type15>::ConstHeadType) == typeid(const double)); + assertTrue (typeid(TypeGetter<8, Type15>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<8, Type15>::ConstHeadType) == typeid(const Int8)); + assertTrue (typeid(TypeGetter<9, Type15>::HeadType) == typeid(UInt8)); + assertTrue (typeid(TypeGetter<9, Type15>::ConstHeadType) == typeid(const UInt8)); + assertTrue (typeid(TypeGetter<10, Type15>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<10, Type15>::ConstHeadType) == typeid(const Int16)); + assertTrue (typeid(TypeGetter<11, Type15>::HeadType) == typeid(UInt16)); + assertTrue (typeid(TypeGetter<11, Type15>::ConstHeadType) == typeid(const UInt16)); + assertTrue (typeid(TypeGetter<12, Type15>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<12, Type15>::ConstHeadType) == typeid(const Int32)); + assertTrue (typeid(TypeGetter<13, Type15>::HeadType) == typeid(UInt32)); + assertTrue (typeid(TypeGetter<13, Type15>::ConstHeadType) == typeid(const UInt32)); + assertTrue (typeid(TypeGetter<14, Type15>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<14, Type15>::ConstHeadType) == typeid(const float)); typedef TypeListType::HeadType Type1; - assert (1 == Type1::length); + assertTrue (1 == Type1::length); typedef TypeListType::HeadType Type2; - assert (2 == Type2::length); + assertTrue (2 == Type2::length); typedef TypeAppender::HeadType Type3; - assert (3 == Type3::length); + assertTrue (3 == Type3::length); - assert (typeid(TypeGetter<0, Type3>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, Type3>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<2, Type3>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<0, Type3>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, Type3>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<2, Type3>::HeadType) == typeid(Int32)); static POCO_UNUSED TypeLocator posNo1; static POCO_UNUSED TypeLocator posNo2; static POCO_UNUSED TypeLocator posNo3; - assert (posNo1.value == 0); - assert (posNo2.value == 1); - assert (posNo3.value == 2); + assertTrue (posNo1.value == 0); + assertTrue (posNo2.value == 1); + assertTrue (posNo3.value == 2); typedef TypeOneEraser::HeadType TypeEraser1; - assert (2 == TypeEraser1::length); - assert (typeid(TypeGetter<0, TypeEraser1>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<1, TypeEraser1>::HeadType) == typeid(Int32)); + assertTrue (2 == TypeEraser1::length); + assertTrue (typeid(TypeGetter<0, TypeEraser1>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<1, TypeEraser1>::HeadType) == typeid(Int32)); typedef TypeOneEraser::HeadType TypeEraser2; - assert (2 == TypeEraser2::length); - assert (typeid(TypeGetter<0, TypeEraser2>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeEraser2>::HeadType) == typeid(Int32)); + assertTrue (2 == TypeEraser2::length); + assertTrue (typeid(TypeGetter<0, TypeEraser2>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeEraser2>::HeadType) == typeid(Int32)); typedef TypeOneEraser::HeadType TypeEraser3; - assert (2 == TypeEraser3::length); - assert (typeid(TypeGetter<0, TypeEraser3>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeEraser3>::HeadType) == typeid(Int16)); + assertTrue (2 == TypeEraser3::length); + assertTrue (typeid(TypeGetter<0, TypeEraser3>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeEraser3>::HeadType) == typeid(Int16)); typedef TypeListType::HeadType Type5; typedef TypeAllEraser::HeadType TypeAllEraser3; - assert (2 == TypeAllEraser3::length); - assert (typeid(TypeGetter<0, TypeAllEraser3>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<1, TypeAllEraser3>::HeadType) == typeid(Int16)); + assertTrue (2 == TypeAllEraser3::length); + assertTrue (typeid(TypeGetter<0, TypeAllEraser3>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<1, TypeAllEraser3>::HeadType) == typeid(Int16)); typedef TypeDuplicateEraser::HeadType TypeDuplicateEraser1; - assert (2 == TypeDuplicateEraser1::length); - assert (typeid(TypeGetter<0, TypeDuplicateEraser1>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeDuplicateEraser1>::HeadType) == typeid(Int16)); + assertTrue (2 == TypeDuplicateEraser1::length); + assertTrue (typeid(TypeGetter<0, TypeDuplicateEraser1>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeDuplicateEraser1>::HeadType) == typeid(Int16)); typedef TypeOneReplacer::HeadType TypeOneReplacer1; - assert (5 == TypeOneReplacer1::length); - assert (typeid(TypeGetter<0, TypeOneReplacer1>::HeadType) == typeid(Int32)); - assert (typeid(TypeGetter<1, TypeOneReplacer1>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<2, TypeOneReplacer1>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<3, TypeOneReplacer1>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<4, TypeOneReplacer1>::HeadType) == typeid(Int8)); + assertTrue (5 == TypeOneReplacer1::length); + assertTrue (typeid(TypeGetter<0, TypeOneReplacer1>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<1, TypeOneReplacer1>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<2, TypeOneReplacer1>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<3, TypeOneReplacer1>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<4, TypeOneReplacer1>::HeadType) == typeid(Int8)); typedef TypeAllReplacer::HeadType TypeAllReplacer1; - assert (5 == TypeAllReplacer1::length); - assert (typeid(TypeGetter<0, TypeAllReplacer1>::HeadType) == typeid(Int32)); - assert (typeid(TypeGetter<1, TypeAllReplacer1>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<2, TypeAllReplacer1>::HeadType) == typeid(Int32)); - assert (typeid(TypeGetter<3, TypeAllReplacer1>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<4, TypeAllReplacer1>::HeadType) == typeid(Int32)); + assertTrue (5 == TypeAllReplacer1::length); + assertTrue (typeid(TypeGetter<0, TypeAllReplacer1>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<1, TypeAllReplacer1>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<2, TypeAllReplacer1>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<3, TypeAllReplacer1>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<4, TypeAllReplacer1>::HeadType) == typeid(Int32)); typedef TypeListType::HeadType TypeVoid; - assert (typeid(TypeGetter<0, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<1, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<2, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<3, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<4, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<5, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<6, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<7, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<8, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<9, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<10, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<11, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<12, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<13, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<14, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<15, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<16, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<17, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<18, TypeVoid>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<19, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<0, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<1, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<2, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<3, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<4, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<5, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<6, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<7, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<8, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<9, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<10, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<11, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<12, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<13, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<14, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<15, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<16, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<17, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<18, TypeVoid>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<19, TypeVoid>::HeadType) == typeid(Void)); typedef TypeOneReplacer::HeadType TypeFirstReplacer; - assert (typeid(TypeGetter<0, TypeFirstReplacer>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<2, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<3, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<4, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<5, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<6, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<7, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<8, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<9, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<10, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<11, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<12, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<13, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<14, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<15, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<16, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<17, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<18, TypeFirstReplacer>::HeadType) == typeid(Void)); - assert (typeid(TypeGetter<19, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<0, TypeFirstReplacer>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<2, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<3, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<4, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<5, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<6, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<7, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<8, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<9, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<10, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<11, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<12, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<13, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<14, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<15, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<16, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<17, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<18, TypeFirstReplacer>::HeadType) == typeid(Void)); + assertTrue (typeid(TypeGetter<19, TypeFirstReplacer>::HeadType) == typeid(Void)); typedef TypeOneReplacer::HeadType TypeSecondReplacer; - assert (typeid(TypeGetter<0, TypeSecondReplacer>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeSecondReplacer>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<0, TypeSecondReplacer>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeSecondReplacer>::HeadType) == typeid(Int16)); typedef TypeOneReplacer::HeadType TypeThirdReplacer; - assert (typeid(TypeGetter<0, TypeThirdReplacer>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeThirdReplacer>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<2, TypeThirdReplacer>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<0, TypeThirdReplacer>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeThirdReplacer>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<2, TypeThirdReplacer>::HeadType) == typeid(Int32)); typedef TypeAllReplacer::HeadType TypeFourthReplacer; - assert (typeid(TypeGetter<0, TypeFourthReplacer>::HeadType) == typeid(Int8)); - assert (typeid(TypeGetter<1, TypeFourthReplacer>::HeadType) == typeid(Int16)); - assert (typeid(TypeGetter<2, TypeFourthReplacer>::HeadType) == typeid(Int32)); - assert (typeid(TypeGetter<3, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<4, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<5, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<6, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<7, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<8, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<9, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<10, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<11, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<12, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<13, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<14, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<15, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<16, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<17, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<18, TypeFourthReplacer>::HeadType) == typeid(float)); - assert (typeid(TypeGetter<19, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<0, TypeFourthReplacer>::HeadType) == typeid(Int8)); + assertTrue (typeid(TypeGetter<1, TypeFourthReplacer>::HeadType) == typeid(Int16)); + assertTrue (typeid(TypeGetter<2, TypeFourthReplacer>::HeadType) == typeid(Int32)); + assertTrue (typeid(TypeGetter<3, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<4, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<5, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<6, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<7, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<8, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<9, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<10, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<11, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<12, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<13, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<14, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<15, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<16, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<17, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<18, TypeFourthReplacer>::HeadType) == typeid(float)); + assertTrue (typeid(TypeGetter<19, TypeFourthReplacer>::HeadType) == typeid(float)); } diff --git a/Foundation/testsuite/src/URIStreamOpenerTest.cpp b/Foundation/testsuite/src/URIStreamOpenerTest.cpp index a647983ad..9d23a2bb8 100644 --- a/Foundation/testsuite/src/URIStreamOpenerTest.cpp +++ b/Foundation/testsuite/src/URIStreamOpenerTest.cpp @@ -59,7 +59,7 @@ void URIStreamOpenerTest::testStreamOpenerFile() TemporaryFile tempFile; std::string path = tempFile.path(); std::ofstream ostr(path.c_str()); - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!" << std::endl; ostr.close(); @@ -70,8 +70,8 @@ void URIStreamOpenerTest::testStreamOpenerFile() URIStreamOpener opener; std::istream* istr = opener.open(uri); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; } @@ -81,7 +81,7 @@ void URIStreamOpenerTest::testStreamOpenerRelative() TemporaryFile tempFile; std::string path = tempFile.path(); std::ofstream ostr(path.c_str()); - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!" << std::endl; ostr.close(); @@ -90,8 +90,8 @@ void URIStreamOpenerTest::testStreamOpenerRelative() URIStreamOpener opener; std::istream* istr = opener.open(uri); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; } @@ -101,7 +101,7 @@ void URIStreamOpenerTest::testStreamOpenerURI() TemporaryFile tempFile; std::string path = tempFile.path(); std::ofstream ostr(path.c_str()); - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!" << std::endl; ostr.close(); @@ -112,8 +112,8 @@ void URIStreamOpenerTest::testStreamOpenerURI() URIStreamOpener opener; std::istream* istr = opener.open(uriString); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; } @@ -123,7 +123,7 @@ void URIStreamOpenerTest::testStreamOpenerURIResolve() TemporaryFile tempFile; std::string path = tempFile.path(); std::ofstream ostr(path.c_str()); - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!" << std::endl; ostr.close(); @@ -138,8 +138,8 @@ void URIStreamOpenerTest::testStreamOpenerURIResolve() URIStreamOpener opener; std::istream* istr = opener.open(uriString, p.getFileName()); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; } @@ -149,14 +149,14 @@ void URIStreamOpenerTest::testStreamOpenerPath() TemporaryFile tempFile; std::string path = tempFile.path(); std::ofstream ostr(path.c_str()); - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!" << std::endl; ostr.close(); URIStreamOpener opener; std::istream* istr = opener.open(path); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; } @@ -166,7 +166,7 @@ void URIStreamOpenerTest::testStreamOpenerPathResolve() TemporaryFile tempFile; std::string path = tempFile.path(); std::ofstream ostr(path.c_str()); - assert (ostr.good()); + assertTrue (ostr.good()); ostr << "Hello, world!" << std::endl; ostr.close(); @@ -176,8 +176,8 @@ void URIStreamOpenerTest::testStreamOpenerPathResolve() URIStreamOpener opener; std::istream* istr = opener.open(base, p.getFileName()); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; } @@ -185,16 +185,16 @@ void URIStreamOpenerTest::testStreamOpenerPathResolve() void URIStreamOpenerTest::testRegisterUnregister() { URIStreamOpener opener; - assert (!opener.supportsScheme("string")); + assertTrue (!opener.supportsScheme("string")); opener.registerStreamFactory("string", new StringStreamFactory); - assert (opener.supportsScheme("string")); + assertTrue (opener.supportsScheme("string")); URI uri("string:foobar"); std::istream* istr = opener.open(uri); - assert (istr != 0); - assert (istr->good()); + assertTrue (istr != 0); + assertTrue (istr->good()); delete istr; opener.unregisterStreamFactory("string"); - assert (!opener.supportsScheme("string")); + assertTrue (!opener.supportsScheme("string")); } diff --git a/Foundation/testsuite/src/URITest.cpp b/Foundation/testsuite/src/URITest.cpp index 201638463..9358e9ccd 100644 --- a/Foundation/testsuite/src/URITest.cpp +++ b/Foundation/testsuite/src/URITest.cpp @@ -32,507 +32,507 @@ URITest::~URITest() void URITest::testConstruction() { URI uri; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath().empty()); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); uri.setScheme("ftp"); - assert (uri.getScheme() == "ftp"); - assert (uri.getPort() == 21); + assertTrue (uri.getScheme() == "ftp"); + assertTrue (uri.getPort() == 21); uri.setScheme("HTTP"); - assert (uri.getScheme() == "http"); + assertTrue (uri.getScheme() == "http"); uri.setAuthority("www.appinf.com"); - assert (uri.getAuthority() == "www.appinf.com"); - assert (uri.getPort() == 80); + assertTrue (uri.getAuthority() == "www.appinf.com"); + assertTrue (uri.getPort() == 80); uri.setAuthority("user@services.appinf.com:8000"); - assert (uri.getUserInfo() == "user"); - assert (uri.getHost() == "services.appinf.com"); - assert (uri.getPort() == 8000); + assertTrue (uri.getUserInfo() == "user"); + assertTrue (uri.getHost() == "services.appinf.com"); + assertTrue (uri.getPort() == 8000); uri.setPath("/index.html"); - assert (uri.getPath() == "/index.html"); + assertTrue (uri.getPath() == "/index.html"); uri.setPath("/file%20with%20spaces.html"); - assert (uri.getPath() == "/file with spaces.html"); + assertTrue (uri.getPath() == "/file with spaces.html"); uri.setPathEtc("/query.cgi?query=foo"); - assert (uri.getPath() == "/query.cgi"); - assert (uri.getQuery() == "query=foo"); - assert (uri.getFragment().empty()); - assert (uri.getPathEtc() == "/query.cgi?query=foo"); - assert (uri.getPathAndQuery() == "/query.cgi?query=foo"); + assertTrue (uri.getPath() == "/query.cgi"); + assertTrue (uri.getQuery() == "query=foo"); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.getPathEtc() == "/query.cgi?query=foo"); + assertTrue (uri.getPathAndQuery() == "/query.cgi?query=foo"); uri.setPathEtc("/query.cgi?query=bar#frag"); - assert (uri.getPath() == "/query.cgi"); - assert (uri.getQuery() == "query=bar"); - assert (uri.getFragment() == "frag"); - assert (uri.getPathEtc() == "/query.cgi?query=bar#frag"); - assert (uri.getPathAndQuery() == "/query.cgi?query=bar"); + assertTrue (uri.getPath() == "/query.cgi"); + assertTrue (uri.getQuery() == "query=bar"); + assertTrue (uri.getFragment() == "frag"); + assertTrue (uri.getPathEtc() == "/query.cgi?query=bar#frag"); + assertTrue (uri.getPathAndQuery() == "/query.cgi?query=bar"); uri.setQuery("query=test"); - assert (uri.getQuery() == "query=test"); + assertTrue (uri.getQuery() == "query=test"); uri.setFragment("result"); - assert (uri.getFragment() == "result"); + assertTrue (uri.getFragment() == "result"); URI uri2("file", "/home/guenter/foo.bar"); - assert (uri2.getScheme() == "file"); - assert (uri2.getPath() == "/home/guenter/foo.bar"); + assertTrue (uri2.getScheme() == "file"); + assertTrue (uri2.getPath() == "/home/guenter/foo.bar"); URI uri3("http", "www.appinf.com", "/index.html"); - assert (uri3.getScheme() == "http"); - assert (uri3.getAuthority() == "www.appinf.com"); - assert (uri3.getPath() == "/index.html"); + assertTrue (uri3.getScheme() == "http"); + assertTrue (uri3.getAuthority() == "www.appinf.com"); + assertTrue (uri3.getPath() == "/index.html"); URI uri4("http", "www.appinf.com:8000", "/index.html"); - assert (uri4.getScheme() == "http"); - assert (uri4.getAuthority() == "www.appinf.com:8000"); - assert (uri4.getPath() == "/index.html"); + assertTrue (uri4.getScheme() == "http"); + assertTrue (uri4.getAuthority() == "www.appinf.com:8000"); + assertTrue (uri4.getPath() == "/index.html"); URI uri5("http", "user@www.appinf.com:8000", "/index.html"); - assert (uri5.getScheme() == "http"); - assert (uri5.getUserInfo() == "user"); - assert (uri5.getHost() == "www.appinf.com"); - assert (uri5.getPort() == 8000); - assert (uri5.getAuthority() == "user@www.appinf.com:8000"); - assert (uri5.getPath() == "/index.html"); + assertTrue (uri5.getScheme() == "http"); + assertTrue (uri5.getUserInfo() == "user"); + assertTrue (uri5.getHost() == "www.appinf.com"); + assertTrue (uri5.getPort() == 8000); + assertTrue (uri5.getAuthority() == "user@www.appinf.com:8000"); + assertTrue (uri5.getPath() == "/index.html"); URI uri6("http", "user@www.appinf.com:80", "/index.html"); - assert (uri6.getScheme() == "http"); - assert (uri6.getUserInfo() == "user"); - assert (uri6.getHost() == "www.appinf.com"); - assert (uri6.getPort() == 80); - assert (uri6.getAuthority() == "user@www.appinf.com"); - assert (uri6.getPath() == "/index.html"); + assertTrue (uri6.getScheme() == "http"); + assertTrue (uri6.getUserInfo() == "user"); + assertTrue (uri6.getHost() == "www.appinf.com"); + assertTrue (uri6.getPort() == 80); + assertTrue (uri6.getAuthority() == "user@www.appinf.com"); + assertTrue (uri6.getPath() == "/index.html"); URI uri7("http", "user@www.appinf.com:", "/index.html"); - assert (uri7.getScheme() == "http"); - assert (uri7.getUserInfo() == "user"); - assert (uri7.getHost() == "www.appinf.com"); - assert (uri7.getPort() == 80); - assert (uri7.getAuthority() == "user@www.appinf.com"); - assert (uri7.getPath() == "/index.html"); + assertTrue (uri7.getScheme() == "http"); + assertTrue (uri7.getUserInfo() == "user"); + assertTrue (uri7.getHost() == "www.appinf.com"); + assertTrue (uri7.getPort() == 80); + assertTrue (uri7.getAuthority() == "user@www.appinf.com"); + assertTrue (uri7.getPath() == "/index.html"); URI uri8("http", "www.appinf.com", "/index.html", "query=test"); - assert (uri8.getScheme() == "http"); - assert (uri8.getAuthority() == "www.appinf.com"); - assert (uri8.getPath() == "/index.html"); - assert (uri8.getQuery() == "query=test"); + assertTrue (uri8.getScheme() == "http"); + assertTrue (uri8.getAuthority() == "www.appinf.com"); + assertTrue (uri8.getPath() == "/index.html"); + assertTrue (uri8.getQuery() == "query=test"); URI uri9("http", "www.appinf.com", "/index.html", "query=test", "fragment"); - assert (uri9.getScheme() == "http"); - assert (uri9.getAuthority() == "www.appinf.com"); - assert (uri9.getPath() == "/index.html"); - assert (uri9.getPathEtc() == "/index.html?query=test#fragment"); - assert (uri9.getQuery() == "query=test"); - assert (uri9.getFragment() == "fragment"); + assertTrue (uri9.getScheme() == "http"); + assertTrue (uri9.getAuthority() == "www.appinf.com"); + assertTrue (uri9.getPath() == "/index.html"); + assertTrue (uri9.getPathEtc() == "/index.html?query=test#fragment"); + assertTrue (uri9.getQuery() == "query=test"); + assertTrue (uri9.getFragment() == "fragment"); uri9.clear(); - assert (uri9.getScheme().empty()); - assert (uri9.getAuthority().empty()); - assert (uri9.getUserInfo().empty()); - assert (uri9.getHost().empty()); - assert (uri9.getPort() == 0); - assert (uri9.getPath().empty()); - assert (uri9.getQuery().empty()); - assert (uri9.getFragment().empty()); + assertTrue (uri9.getScheme().empty()); + assertTrue (uri9.getAuthority().empty()); + assertTrue (uri9.getUserInfo().empty()); + assertTrue (uri9.getHost().empty()); + assertTrue (uri9.getPort() == 0); + assertTrue (uri9.getPath().empty()); + assertTrue (uri9.getQuery().empty()); + assertTrue (uri9.getFragment().empty()); URI uri10("ldap", "[2001:db8::7]", "/c=GB?objectClass?one"); - assert (uri10.getScheme() == "ldap"); - assert (uri10.getUserInfo().empty()); - assert (uri10.getHost() == "2001:db8::7"); - assert (uri10.getPort() == 389); - assert (uri10.getAuthority() == "[2001:db8::7]"); - assert (uri10.getPathEtc() == "/c=GB?objectClass?one"); + assertTrue (uri10.getScheme() == "ldap"); + assertTrue (uri10.getUserInfo().empty()); + assertTrue (uri10.getHost() == "2001:db8::7"); + assertTrue (uri10.getPort() == 389); + assertTrue (uri10.getAuthority() == "[2001:db8::7]"); + assertTrue (uri10.getPathEtc() == "/c=GB?objectClass?one"); URI uri11("http", "www.appinf.com", "/index.html?query=test#fragment"); - assert (uri11.getScheme() == "http"); - assert (uri11.getAuthority() == "www.appinf.com"); - assert (uri11.getPath() == "/index.html"); - assert (uri11.getPathEtc() == "/index.html?query=test#fragment"); - assert (uri11.getQuery() == "query=test"); - assert (uri11.getFragment() == "fragment"); + assertTrue (uri11.getScheme() == "http"); + assertTrue (uri11.getAuthority() == "www.appinf.com"); + assertTrue (uri11.getPath() == "/index.html"); + assertTrue (uri11.getPathEtc() == "/index.html?query=test#fragment"); + assertTrue (uri11.getQuery() == "query=test"); + assertTrue (uri11.getFragment() == "fragment"); } void URITest::testParse() { URI uri("http://www.appinf.com"); - assert (uri.getScheme() == "http"); - assert (uri.getAuthority() == "www.appinf.com"); - assert (uri.getPath().empty()); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "http"); + assertTrue (uri.getAuthority() == "www.appinf.com"); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); uri = "http://www.appinf.com/"; - assert (uri.getScheme() == "http"); - assert (uri.getAuthority() == "www.appinf.com"); - assert (uri.getPath() == "/"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "http"); + assertTrue (uri.getAuthority() == "www.appinf.com"); + assertTrue (uri.getPath() == "/"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); uri = "ftp://anonymous@ftp.appinf.com/pub/"; - assert (uri.getScheme() == "ftp"); - assert (uri.getUserInfo() == "anonymous"); - assert (uri.getHost() == "ftp.appinf.com"); - assert (uri.getPort() == 21); - assert (uri.getAuthority() == "anonymous@ftp.appinf.com"); - assert (uri.getPath() == "/pub/"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "ftp"); + assertTrue (uri.getUserInfo() == "anonymous"); + assertTrue (uri.getHost() == "ftp.appinf.com"); + assertTrue (uri.getPort() == 21); + assertTrue (uri.getAuthority() == "anonymous@ftp.appinf.com"); + assertTrue (uri.getPath() == "/pub/"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); + assertTrue (!uri.isRelative()); uri = "https://www.appinf.com/index.html#top"; - assert (uri.getScheme() == "https"); - assert (uri.getHost() == "www.appinf.com"); - assert (uri.getPort() == 443); - assert (uri.getPath() == "/index.html"); - assert (uri.getQuery().empty()); - assert (uri.getFragment() == "top"); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "https"); + assertTrue (uri.getHost() == "www.appinf.com"); + assertTrue (uri.getPort() == 443); + assertTrue (uri.getPath() == "/index.html"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment() == "top"); + assertTrue (!uri.isRelative()); uri = "http://www.appinf.com/search.cgi?keyword=test&scope=all"; - assert (uri.getScheme() == "http"); - assert (uri.getHost() == "www.appinf.com"); - assert (uri.getPort() == 80); - assert (uri.getPath() == "/search.cgi"); - assert (uri.getQuery() == "keyword=test&scope=all"); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "http"); + assertTrue (uri.getHost() == "www.appinf.com"); + assertTrue (uri.getPort() == 80); + assertTrue (uri.getPath() == "/search.cgi"); + assertTrue (uri.getQuery() == "keyword=test&scope=all"); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); uri = "http://www.appinf.com/search.cgi?keyword=test&scope=all#result"; - assert (uri.getScheme() == "http"); - assert (uri.getHost() == "www.appinf.com"); - assert (uri.getPort() == 80); - assert (uri.getPath() == "/search.cgi"); - assert (uri.getQuery() == "keyword=test&scope=all"); - assert (uri.getFragment() == "result"); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "http"); + assertTrue (uri.getHost() == "www.appinf.com"); + assertTrue (uri.getPort() == 80); + assertTrue (uri.getPath() == "/search.cgi"); + assertTrue (uri.getQuery() == "keyword=test&scope=all"); + assertTrue (uri.getFragment() == "result"); + assertTrue (!uri.isRelative()); uri = "http://www.appinf.com/search.cgi?keyword=test%20encoded&scope=all#result"; - assert (uri.getScheme() == "http"); - assert (uri.getHost() == "www.appinf.com"); - assert (uri.getPort() == 80); - assert (uri.getPath() == "/search.cgi"); - assert (uri.getQuery() == "keyword=test encoded&scope=all"); - assert (uri.getFragment() == "result"); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "http"); + assertTrue (uri.getHost() == "www.appinf.com"); + assertTrue (uri.getPort() == 80); + assertTrue (uri.getPath() == "/search.cgi"); + assertTrue (uri.getQuery() == "keyword=test encoded&scope=all"); + assertTrue (uri.getFragment() == "result"); + assertTrue (!uri.isRelative()); uri = "ldap://[2001:db8::7]/c=GB?objectClass?one"; - assert (uri.getScheme() == "ldap"); - assert (uri.getUserInfo().empty()); - assert (uri.getHost() == "2001:db8::7"); - assert (uri.getPort() == 389); - assert (uri.getAuthority() == "[2001:db8::7]"); - assert (uri.getPath() == "/c=GB"); - assert (uri.getQuery() == "objectClass?one"); - assert (uri.getFragment().empty()); + assertTrue (uri.getScheme() == "ldap"); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost() == "2001:db8::7"); + assertTrue (uri.getPort() == 389); + assertTrue (uri.getAuthority() == "[2001:db8::7]"); + assertTrue (uri.getPath() == "/c=GB"); + assertTrue (uri.getQuery() == "objectClass?one"); + assertTrue (uri.getFragment().empty()); uri = "mailto:John.Doe@example.com"; - assert (uri.getScheme() == "mailto"); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getAuthority().empty()); - assert (uri.getPath() == "John.Doe@example.com"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); + assertTrue (uri.getScheme() == "mailto"); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getPath() == "John.Doe@example.com"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); uri = "tel:+1-816-555-1212"; - assert (uri.getScheme() == "tel"); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getAuthority().empty()); - assert (uri.getPath() == "+1-816-555-1212"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); + assertTrue (uri.getScheme() == "tel"); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getPath() == "+1-816-555-1212"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); uri = "telnet://192.0.2.16:80"; - assert (uri.getScheme() == "telnet"); - assert (uri.getUserInfo().empty()); - assert (uri.getHost() == "192.0.2.16"); - assert (uri.getPort() == 80); - assert (uri.getAuthority() == "192.0.2.16:80"); - assert (uri.getPath().empty()); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); + assertTrue (uri.getScheme() == "telnet"); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost() == "192.0.2.16"); + assertTrue (uri.getPort() == 80); + assertTrue (uri.getAuthority() == "192.0.2.16:80"); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); uri = "urn:oasis:names:specification:docbook:dtd:xml:4.1.2"; - assert (uri.getScheme() == "urn"); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getAuthority().empty()); - assert (uri.getPath() == "oasis:names:specification:docbook:dtd:xml:4.1.2"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); + assertTrue (uri.getScheme() == "urn"); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getPath() == "oasis:names:specification:docbook:dtd:xml:4.1.2"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); uri = ""; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath().empty()); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.empty()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.empty()); // relative references uri = "/foo/bar"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "/foo/bar"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "/foo/bar"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "./foo/bar"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "./foo/bar"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "./foo/bar"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "../foo/bar"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "../foo/bar"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "../foo/bar"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "index.html"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "index.html"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "index.html"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "index.html#frag"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "index.html"); - assert (uri.getQuery().empty()); - assert (uri.getFragment() == "frag"); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "index.html"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment() == "frag"); + assertTrue (uri.isRelative()); uri = "?query=test"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath().empty()); - assert (uri.getQuery() == "query=test"); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery() == "query=test"); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "?query=test#frag"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath().empty()); - assert (uri.getQuery() == "query=test"); - assert (uri.getFragment() == "frag"); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery() == "query=test"); + assertTrue (uri.getFragment() == "frag"); + assertTrue (uri.isRelative()); uri = "#frag"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath().empty()); - assert (uri.getQuery().empty()); - assert (uri.getFragment() == "frag"); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment() == "frag"); + assertTrue (uri.isRelative()); uri = "#"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath().empty()); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath().empty()); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "file:///a/b/c"; - assert (uri.getScheme() == "file"); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "/a/b/c"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "file"); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "/a/b/c"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); uri = "file://localhost/a/b/c"; - assert (uri.getScheme() == "file"); - assert (uri.getAuthority() == "localhost"); - assert (uri.getUserInfo().empty()); - assert (uri.getHost() == "localhost"); - assert (uri.getPort() == 0); - assert (uri.getPath() == "/a/b/c"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "file"); + assertTrue (uri.getAuthority() == "localhost"); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost() == "localhost"); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "/a/b/c"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); uri = "file:///c:/Windows/system32/"; - assert (uri.getScheme() == "file"); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "/c:/Windows/system32/"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (!uri.isRelative()); + assertTrue (uri.getScheme() == "file"); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "/c:/Windows/system32/"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (!uri.isRelative()); uri = "./c:/Windows/system32/"; - assert (uri.getScheme().empty()); - assert (uri.getAuthority().empty()); - assert (uri.getUserInfo().empty()); - assert (uri.getHost().empty()); - assert (uri.getPort() == 0); - assert (uri.getPath() == "./c:/Windows/system32/"); - assert (uri.getQuery().empty()); - assert (uri.getFragment().empty()); - assert (uri.isRelative()); + assertTrue (uri.getScheme().empty()); + assertTrue (uri.getAuthority().empty()); + assertTrue (uri.getUserInfo().empty()); + assertTrue (uri.getHost().empty()); + assertTrue (uri.getPort() == 0); + assertTrue (uri.getPath() == "./c:/Windows/system32/"); + assertTrue (uri.getQuery().empty()); + assertTrue (uri.getFragment().empty()); + assertTrue (uri.isRelative()); uri = "ws://www.appinf.com/ws"; - assert (uri.getScheme() == "ws"); - assert (uri.getPort() == 80); + assertTrue (uri.getScheme() == "ws"); + assertTrue (uri.getPort() == 80); uri = "wss://www.appinf.com/ws"; - assert (uri.getScheme() == "wss"); - assert (uri.getPort() == 443); + assertTrue (uri.getScheme() == "wss"); + assertTrue (uri.getPort() == 443); } void URITest::testToString() { URI uri("http://www.appinf.com"); - assert (uri.toString() == "http://www.appinf.com"); + assertTrue (uri.toString() == "http://www.appinf.com"); uri = "http://www.appinf.com/"; - assert (uri.toString() == "http://www.appinf.com/"); + assertTrue (uri.toString() == "http://www.appinf.com/"); uri = "ftp://anonymous@ftp.appinf.com/pub/"; - assert (uri.toString() == "ftp://anonymous@ftp.appinf.com/pub/"); + assertTrue (uri.toString() == "ftp://anonymous@ftp.appinf.com/pub/"); uri = "https://www.appinf.com/index.html#top"; - assert (uri.toString() == "https://www.appinf.com/index.html#top"); + assertTrue (uri.toString() == "https://www.appinf.com/index.html#top"); uri = "http://www.appinf.com/search.cgi?keyword=test&scope=all"; - assert (uri.toString() == "http://www.appinf.com/search.cgi?keyword=test&scope=all"); + assertTrue (uri.toString() == "http://www.appinf.com/search.cgi?keyword=test&scope=all"); uri = "http://www.appinf.com/search.cgi?keyword=test&scope=all#result"; - assert (uri.toString() == "http://www.appinf.com/search.cgi?keyword=test&scope=all#result"); + assertTrue (uri.toString() == "http://www.appinf.com/search.cgi?keyword=test&scope=all#result"); uri = "http://www.appinf.com/search.cgi?keyword=test%20encoded&scope=all#result"; - assert (uri.toString() == "http://www.appinf.com/search.cgi?keyword=test%20encoded&scope=all#result"); + assertTrue (uri.toString() == "http://www.appinf.com/search.cgi?keyword=test%20encoded&scope=all#result"); uri = "ldap://[2001:db8::7]/c=GB?objectClass?one"; - assert (uri.toString() == "ldap://[2001:db8::7]/c=GB?objectClass?one"); + assertTrue (uri.toString() == "ldap://[2001:db8::7]/c=GB?objectClass?one"); uri = "mailto:John.Doe@example.com"; - assert (uri.toString() == "mailto:John.Doe@example.com"); + assertTrue (uri.toString() == "mailto:John.Doe@example.com"); uri = "tel:+1-816-555-1212"; - assert (uri.toString() == "tel:+1-816-555-1212"); + assertTrue (uri.toString() == "tel:+1-816-555-1212"); uri = "telnet://192.0.2.16:80"; - assert (uri.toString() == "telnet://192.0.2.16:80"); + assertTrue (uri.toString() == "telnet://192.0.2.16:80"); uri = "urn:oasis:names:specification:docbook:dtd:xml:4.1.2"; - assert (uri.toString() == "urn:oasis:names:specification:docbook:dtd:xml:4.1.2"); + assertTrue (uri.toString() == "urn:oasis:names:specification:docbook:dtd:xml:4.1.2"); uri = ""; - assert (uri.toString() == ""); + assertTrue (uri.toString() == ""); // relative references uri = "/foo/bar"; - assert (uri.toString() == "/foo/bar"); + assertTrue (uri.toString() == "/foo/bar"); uri = "./foo/bar"; - assert (uri.toString() == "./foo/bar"); + assertTrue (uri.toString() == "./foo/bar"); uri = "../foo/bar"; - assert (uri.toString() == "../foo/bar"); + assertTrue (uri.toString() == "../foo/bar"); uri = "//foo/bar"; - assert (uri.toString() == "//foo/bar"); + assertTrue (uri.toString() == "//foo/bar"); uri = "index.html"; - assert (uri.toString() == "index.html"); + assertTrue (uri.toString() == "index.html"); uri = "index.html#frag"; - assert (uri.toString() == "index.html#frag"); + assertTrue (uri.toString() == "index.html#frag"); uri = "?query=test"; - assert (uri.toString() == "?query=test"); + assertTrue (uri.toString() == "?query=test"); uri = "?query=test#frag"; - assert (uri.toString() == "?query=test#frag"); + assertTrue (uri.toString() == "?query=test#frag"); uri = "#frag"; - assert (uri.toString() == "#frag"); + assertTrue (uri.toString() == "#frag"); uri = "#"; - assert (uri.toString() == ""); + assertTrue (uri.toString() == ""); uri = "file:///a/b/c"; - assert (uri.toString() == "file:///a/b/c"); + assertTrue (uri.toString() == "file:///a/b/c"); uri = "file://localhost/a/b/c"; - assert (uri.toString() == "file://localhost/a/b/c"); + assertTrue (uri.toString() == "file://localhost/a/b/c"); uri = "file:///c:/Windows/system32/"; - assert (uri.toString() == "file:///c:/Windows/system32/"); + assertTrue (uri.toString() == "file:///c:/Windows/system32/"); uri = "./c:/Windows/system32/"; - assert (uri.toString() == "./c:/Windows/system32/"); + assertTrue (uri.toString() == "./c:/Windows/system32/"); uri = "http://www.appinf.com"; uri.setRawQuery("query=test"); - assert (uri.toString() == "http://www.appinf.com/?query=test"); + assertTrue (uri.toString() == "http://www.appinf.com/?query=test"); } @@ -540,25 +540,25 @@ void URITest::testCompare() { URI uri1("http://www.appinf.com"); URI uri2("HTTP://www.appinf.com:80"); - assert (uri1 == uri2); - assert (uri1 == "http://www.appinf.com:"); - assert (uri1 != "http://www.google.com"); + assertTrue (uri1 == uri2); + assertTrue (uri1 == "http://www.appinf.com:"); + assertTrue (uri1 != "http://www.google.com"); uri1 = "/foo/bar"; - assert (uri1 == "/foo/bar"); - assert (uri1 != "/foo/baz"); + assertTrue (uri1 == "/foo/bar"); + assertTrue (uri1 != "/foo/baz"); uri1 = "?query"; - assert (uri1 == "?query"); - assert (uri1 != "?query2"); + assertTrue (uri1 == "?query"); + assertTrue (uri1 != "?query2"); uri1 = "#frag"; - assert (uri1 == "#frag"); - assert (uri1 != "#frag2"); + assertTrue (uri1 == "#frag"); + assertTrue (uri1 != "#frag2"); uri1 = "/index.html#frag"; - assert (uri1 == "/index.html#frag"); - assert (uri1 != "/index.html"); + assertTrue (uri1 == "/index.html#frag"); + assertTrue (uri1 != "/index.html"); } @@ -566,64 +566,64 @@ void URITest::testNormalize() { URI uri("http://www.appinf.com"); uri.normalize(); - assert (uri.toString() == "http://www.appinf.com"); + assertTrue (uri.toString() == "http://www.appinf.com"); uri = "http://www.appinf.com/"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/"); + assertTrue (uri.toString() == "http://www.appinf.com/"); uri = "http://www.appinf.com/foo/bar/./index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/bar/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/bar/index.html"); uri = "http://www.appinf.com/foo/bar/../index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/index.html"); uri = "http://www.appinf.com/foo/./bar/../index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/index.html"); uri = "http://www.appinf.com/foo/./bar/../index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/index.html"); uri = "http://www.appinf.com/foo/bar/../../index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/index.html"); uri = "http://www.appinf.com/foo/bar/../../../index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/index.html"); uri = "http://www.appinf.com/foo/bar/.././../index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/index.html"); uri = "http://www.appinf.com/./foo/bar/index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/bar/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/bar/index.html"); uri = "http://www.appinf.com/../foo/bar/index.html"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/bar/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/bar/index.html"); uri = "http://www.appinf.com/../foo/bar/"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/foo/bar/"); + assertTrue (uri.toString() == "http://www.appinf.com/foo/bar/"); uri = "http://www.appinf.com/../foo/../"; uri.normalize(); - assert (uri.toString() == "http://www.appinf.com/"); + assertTrue (uri.toString() == "http://www.appinf.com/"); uri = "file:///c:/Windows/system32/"; uri.normalize(); - assert (uri.toString() == "file:///c:/Windows/system32/"); + assertTrue (uri.toString() == "file:///c:/Windows/system32/"); uri.clear(); uri.setPath("c:/windows/system32/"); uri.normalize(); - assert (uri.toString() == "./c:/windows/system32/"); + assertTrue (uri.toString() == "./c:/windows/system32/"); } @@ -632,86 +632,86 @@ void URITest::testResolve() URI uri("http://www.appinf.com"); uri.resolve("/index.html"); - assert (uri.toString() == "http://www.appinf.com/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/index.html"); uri.resolve("#frag"); - assert (uri.toString() == "http://www.appinf.com/index.html#frag"); + assertTrue (uri.toString() == "http://www.appinf.com/index.html#frag"); uri = "http://www.appinf.com/html"; uri.resolve("../images/foo.gif"); - assert (uri.toString() == "http://www.appinf.com/images/foo.gif"); + assertTrue (uri.toString() == "http://www.appinf.com/images/foo.gif"); uri = "http://www.appinf.com/html/"; uri.resolve("."); - assert (uri.toString() == "http://www.appinf.com/html/"); + assertTrue (uri.toString() == "http://www.appinf.com/html/"); uri = "http://www.appinf.com/html/"; uri.resolve("."); - assert (uri.toString() == "http://www.appinf.com/html/"); + assertTrue (uri.toString() == "http://www.appinf.com/html/"); uri = "http://www.appinf.com/html/"; uri.resolve(".."); - assert (uri.toString() == "http://www.appinf.com/"); + assertTrue (uri.toString() == "http://www.appinf.com/"); uri = "http://www.appinf.com/html/"; uri.resolve("index.html"); - assert (uri.toString() == "http://www.appinf.com/html/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/html/index.html"); uri = "http://www.appinf.com/html/"; uri.resolve("/index.html"); - assert (uri.toString() == "http://www.appinf.com/index.html"); + assertTrue (uri.toString() == "http://www.appinf.com/index.html"); uri = "/a/b/c/d/e"; uri.resolve("./../../f/./g"); - assert (uri.toString() == "/a/b/f/g"); + assertTrue (uri.toString() == "/a/b/f/g"); uri = "/a/b/../c/"; uri.resolve("../d"); - assert (uri.toString() == "/a/d"); + assertTrue (uri.toString() == "/a/d"); uri = "/a/b/../c/"; uri.resolve("../d/"); - assert (uri.toString() == "/a/d/"); + assertTrue (uri.toString() == "/a/d/"); uri = "/a/b/c/"; uri.resolve("../../../../d/"); - assert (uri.toString() == "/d/"); + assertTrue (uri.toString() == "/d/"); uri = "/a/b/c/"; uri.resolve("%2e%2e/%2e%2e/%2e%2e/../d/"); - assert (uri.toString() == "/d/"); + assertTrue (uri.toString() == "/d/"); uri = "/a/b/c/"; uri.resolve(""); - assert (uri.toString() == "/a/b/c/"); + assertTrue (uri.toString() == "/a/b/c/"); uri = "/a/b/c/"; uri.resolve("/d/"); - assert (uri.toString() == "/d/"); + assertTrue (uri.toString() == "/d/"); uri = "/a/b/c"; uri.resolve(""); - assert (uri.toString() == "/a/b/c"); + assertTrue (uri.toString() == "/a/b/c"); uri = "/a/b/c"; uri.resolve("?query=test"); - assert (uri.toString() == "/a/b/c?query=test"); + assertTrue (uri.toString() == "/a/b/c?query=test"); uri = "/a/b/c"; uri.resolve("#frag"); - assert (uri.toString() == "/a/b/c#frag"); + assertTrue (uri.toString() == "/a/b/c#frag"); uri = "http://www.appinf.com/html/"; uri.resolve("http://www.google.com/"); - assert (uri.toString() == "http://www.google.com/"); + assertTrue (uri.toString() == "http://www.google.com/"); uri = "http://www.appinf.com/"; URI uri2(uri, "index.html"); - assert (uri2.toString() == "http://www.appinf.com/index.html"); + assertTrue (uri2.toString() == "http://www.appinf.com/index.html"); uri = "index.html"; URI uri3(uri, "search.html"); - assert (uri3.toString() == "search.html"); + assertTrue (uri3.toString() == "search.html"); } @@ -721,8 +721,8 @@ void URITest::testSwap() URI uri2("mailto:John.Doe@example.com"); uri1.swap(uri2); - assert (uri1.toString() == "mailto:John.Doe@example.com"); - assert (uri2.toString() == "http://www.appinf.com/search.cgi?keyword=test%20encoded&scope=all#result"); + assertTrue (uri1.toString() == "mailto:John.Doe@example.com"); + assertTrue (uri2.toString() == "http://www.appinf.com/search.cgi?keyword=test%20encoded&scope=all#result"); } @@ -733,53 +733,53 @@ void URITest::testOther() // a convenient reproduction case, and a URL that actually works. Poco::URI uri("http://google.com/search?q=hello%25world#frag%20ment"); - assert(uri.getHost() == "google.com"); - assert(uri.getPath() == "/search"); - assert(uri.getQuery() == "q=hello%world"); - assert(uri.getRawQuery() == "q=hello%25world"); - assert(uri.getFragment() == "frag ment"); - assert(uri.toString() == "http://google.com/search?q=hello%25world#frag%20ment"); - assert(uri.getPathEtc() == "/search?q=hello%25world#frag%20ment"); + assertTrue (uri.getHost() == "google.com"); + assertTrue (uri.getPath() == "/search"); + assertTrue (uri.getQuery() == "q=hello%world"); + assertTrue (uri.getRawQuery() == "q=hello%25world"); + assertTrue (uri.getFragment() == "frag ment"); + assertTrue (uri.toString() == "http://google.com/search?q=hello%25world#frag%20ment"); + assertTrue (uri.getPathEtc() == "/search?q=hello%25world#frag%20ment"); uri.setQuery("q=foo&bar"); - assert(uri.getQuery() == "q=foo&bar"); - assert(uri.getRawQuery() == "q=foo&bar"); - assert(uri.toString() == "http://google.com/search?q=foo&bar#frag%20ment"); - assert(uri.getPathEtc() == "/search?q=foo&bar#frag%20ment"); + assertTrue (uri.getQuery() == "q=foo&bar"); + assertTrue (uri.getRawQuery() == "q=foo&bar"); + assertTrue (uri.toString() == "http://google.com/search?q=foo&bar#frag%20ment"); + assertTrue (uri.getPathEtc() == "/search?q=foo&bar#frag%20ment"); uri.setQuery("q=foo/bar"); - assert(uri.getQuery() == "q=foo/bar"); - assert(uri.getRawQuery() == "q=foo%2Fbar"); - assert(uri.toString() == "http://google.com/search?q=foo%2Fbar#frag%20ment"); - assert(uri.getPathEtc() == "/search?q=foo%2Fbar#frag%20ment"); + assertTrue (uri.getQuery() == "q=foo/bar"); + assertTrue (uri.getRawQuery() == "q=foo%2Fbar"); + assertTrue (uri.toString() == "http://google.com/search?q=foo%2Fbar#frag%20ment"); + assertTrue (uri.getPathEtc() == "/search?q=foo%2Fbar#frag%20ment"); uri.setQuery("q=goodbye cruel world"); - assert(uri.getQuery() == "q=goodbye cruel world"); - assert(uri.getRawQuery() == "q=goodbye%20cruel%20world"); - assert(uri.toString() == "http://google.com/search?q=goodbye%20cruel%20world#frag%20ment"); - assert(uri.getPathEtc() == "/search?q=goodbye%20cruel%20world#frag%20ment"); + assertTrue (uri.getQuery() == "q=goodbye cruel world"); + assertTrue (uri.getRawQuery() == "q=goodbye%20cruel%20world"); + assertTrue (uri.toString() == "http://google.com/search?q=goodbye%20cruel%20world#frag%20ment"); + assertTrue (uri.getPathEtc() == "/search?q=goodbye%20cruel%20world#frag%20ment"); uri.setRawQuery("q=pony%7eride"); - assert(uri.getQuery() == "q=pony~ride"); - assert(uri.getRawQuery() == "q=pony%7eride"); - assert(uri.toString() == "http://google.com/search?q=pony%7eride#frag%20ment"); - assert(uri.getPathEtc() == "/search?q=pony%7eride#frag%20ment"); + assertTrue (uri.getQuery() == "q=pony~ride"); + assertTrue (uri.getRawQuery() == "q=pony%7eride"); + assertTrue (uri.toString() == "http://google.com/search?q=pony%7eride#frag%20ment"); + assertTrue (uri.getPathEtc() == "/search?q=pony%7eride#frag%20ment"); uri.addQueryParameter("pa=ra&m1"); - assert(uri.getRawQuery() == "q=pony%7eride&pa%3Dra%26m1="); - assert(uri.getQuery() == "q=pony~ride&pa=ra&m1="); + assertTrue (uri.getRawQuery() == "q=pony%7eride&pa%3Dra%26m1="); + assertTrue (uri.getQuery() == "q=pony~ride&pa=ra&m1="); uri.addQueryParameter("pa=ra&m2", "val&ue"); - assert(uri.getRawQuery() == "q=pony%7eride&pa%3Dra%26m1=&pa%3Dra%26m2=val%26ue"); - assert(uri.getQuery() == "q=pony~ride&pa=ra&m1=&pa=ra&m2=val&ue"); + assertTrue (uri.getRawQuery() == "q=pony%7eride&pa%3Dra%26m1=&pa%3Dra%26m2=val%26ue"); + assertTrue (uri.getQuery() == "q=pony~ride&pa=ra&m1=&pa=ra&m2=val&ue"); uri = "http://google.com/search?q=hello+world#frag%20ment"; - assert(uri.getHost() == "google.com"); - assert(uri.getPath() == "/search"); - assert(uri.getQuery() == "q=hello+world"); - assert(uri.getRawQuery() == "q=hello+world"); - assert(uri.getFragment() == "frag ment"); - assert(uri.toString() == "http://google.com/search?q=hello+world#frag%20ment"); - assert(uri.getPathEtc() == "/search?q=hello+world#frag%20ment"); + assertTrue (uri.getHost() == "google.com"); + assertTrue (uri.getPath() == "/search"); + assertTrue (uri.getQuery() == "q=hello+world"); + assertTrue (uri.getRawQuery() == "q=hello+world"); + assertTrue (uri.getFragment() == "frag ment"); + assertTrue (uri.toString() == "http://google.com/search?q=hello+world#frag%20ment"); + assertTrue (uri.getPathEtc() == "/search?q=hello+world#frag%20ment"); } @@ -787,19 +787,19 @@ void URITest::testEncodeDecode() { std::string str; URI::encode("http://google.com/search?q=hello+world#frag ment", "+#?", str); - assert (str == "http://google.com/search%3Fq=hello%2Bworld%23frag%20ment"); + assertTrue (str == "http://google.com/search%3Fq=hello%2Bworld%23frag%20ment"); str = ""; URI::encode("http://google.com/search?q=hello+world#frag ment", "", str); - assert (str == "http://google.com/search?q=hello+world#frag%20ment"); + assertTrue (str == "http://google.com/search?q=hello+world#frag%20ment"); str = ""; URI::decode("http://google.com/search?q=hello+world#frag%20ment", str, true); - assert (str == "http://google.com/search?q=hello world#frag ment"); + assertTrue (str == "http://google.com/search?q=hello world#frag ment"); str = ""; URI::decode("http://google.com/search?q=hello%2Bworld#frag%20ment", str); - assert (str == "http://google.com/search?q=hello+world#frag ment"); + assertTrue (str == "http://google.com/search?q=hello+world#frag ment"); } @@ -807,15 +807,15 @@ void URITest::testFromPath() { Path path1("/var/www/site/index.html", Path::PATH_UNIX); URI uri1(path1); - assert (uri1.toString() == "file:///var/www/site/index.html"); + assertTrue (uri1.toString() == "file:///var/www/site/index.html"); Path path2("/var/www/site/with space.html", Path::PATH_UNIX); URI uri2(path2); - assert (uri2.toString() == "file:///var/www/site/with%20space.html"); + assertTrue (uri2.toString() == "file:///var/www/site/with%20space.html"); Path path3("c:\\www\\index.html", Path::PATH_WINDOWS); URI uri3(path3); - assert (uri3.toString() == "file:///c:/www/index.html"); + assertTrue (uri3.toString() == "file:///c:/www/index.html"); } @@ -823,33 +823,33 @@ void URITest::testQueryParameters() { Poco::URI uri("http://google.com/search?q=hello+world&client=safari"); URI::QueryParameters params = uri.getQueryParameters(); - assert (params.size() == 2); - assert (params[0].first == "q"); - assert (params[0].second == "hello world"); - assert (params[1].first == "client"); - assert (params[1].second == "safari"); + assertTrue (params.size() == 2); + assertTrue (params[0].first == "q"); + assertTrue (params[0].second == "hello world"); + assertTrue (params[1].first == "client"); + assertTrue (params[1].second == "safari"); uri.setQueryParameters(params); - assert (uri.toString() == "http://google.com/search?q=hello%20world&client=safari"); + assertTrue (uri.toString() == "http://google.com/search?q=hello%20world&client=safari"); uri = "http://google.com/search?q=&client&"; params = uri.getQueryParameters(); - assert (params.size() == 2); - assert (params[0].first == "q"); - assert (params[0].second == ""); - assert (params[1].first == "client"); - assert (params[1].second == ""); + assertTrue (params.size() == 2); + assertTrue (params[0].first == "q"); + assertTrue (params[0].second == ""); + assertTrue (params[1].first == "client"); + assertTrue (params[1].second == ""); uri.setQueryParameters(params); - assert (uri.toString() == "http://google.com/search?q=&client="); + assertTrue (uri.toString() == "http://google.com/search?q=&client="); params[0].second = "foo/bar?"; uri.setQueryParameters(params); - assert (uri.toString() == "http://google.com/search?q=foo%2Fbar%3F&client="); + assertTrue (uri.toString() == "http://google.com/search?q=foo%2Fbar%3F&client="); params[0].second = "foo&bar"; uri.setQueryParameters(params); - assert (uri.toString() == "http://google.com/search?q=foo%26bar&client="); + assertTrue (uri.toString() == "http://google.com/search?q=foo%26bar&client="); } diff --git a/Foundation/testsuite/src/UTF8StringTest.cpp b/Foundation/testsuite/src/UTF8StringTest.cpp index 79c39f798..42a48fbcf 100644 --- a/Foundation/testsuite/src/UTF8StringTest.cpp +++ b/Foundation/testsuite/src/UTF8StringTest.cpp @@ -32,32 +32,32 @@ void UTF8StringTest::testCompare() std::string a1("aaaaa"); std::string b1("bbbbb"); - assert (UTF8::icompare(a1, b1) < 0); + assertTrue (UTF8::icompare(a1, b1) < 0); std::string a2("aaaaa"); std::string b2("BBBBB"); - assert (UTF8::icompare(a2, b2) < 0); + assertTrue (UTF8::icompare(a2, b2) < 0); std::string a3("AAAAA"); std::string b3("bbbbb"); - assert (UTF8::icompare(a3, b3) < 0); + assertTrue (UTF8::icompare(a3, b3) < 0); std::string a4("aaaaa"); std::string b4("AAAAA"); - assert (UTF8::icompare(a4, b4) == 0); + assertTrue (UTF8::icompare(a4, b4) == 0); std::string a5("AAAAA"); std::string b5("bbbbb"); - assert (UTF8::icompare(a5, b5) < 0); + assertTrue (UTF8::icompare(a5, b5) < 0); std::string a6("\303\274\303\266\303\244"); // "u"o"a std::string b6("\303\234\303\226\303\204"); // "U"O"A - assert (UTF8::icompare(a6, b6) == 0); + assertTrue (UTF8::icompare(a6, b6) == 0); } @@ -65,21 +65,21 @@ void UTF8StringTest::testTransform() { std::string s1("abcde"); UTF8::toUpperInPlace(s1); - assert (s1 == "ABCDE"); + assertTrue (s1 == "ABCDE"); std::string s2("aBcDe123"); UTF8::toUpperInPlace(s2); - assert (s2 == "ABCDE123"); + assertTrue (s2 == "ABCDE123"); std::string s3("\303\274\303\266\303\244"); // "u"o"a UTF8::toUpperInPlace(s3); - assert (s3 == "\303\234\303\226\303\204"); // "U"O"A + assertTrue (s3 == "\303\234\303\226\303\204"); // "U"O"A UTF8::toLowerInPlace(s3); - assert (s3 == "\303\274\303\266\303\244"); // "u"o"a + assertTrue (s3 == "\303\274\303\266\303\244"); // "u"o"a // a mix of invalid sequences std::string str = "\xC2\xE5\xF0\xF8\xE8\xED\xFB+-++"; - assert ("???+-++" == UTF8::toLower(str)); + assertTrue ("???+-++" == UTF8::toLower(str)); } @@ -87,8 +87,8 @@ void UTF8StringTest::testEscape() { std::string s1("A \t, a \v, and an \a walk into a |, and the barman says \xD0\x82"); - assert (UTF8::escape(s1) == "A \\t, a \\v, and an \\a walk into a |, and the barman says \\u0402"); - assert (UTF8::escape(s1, true) == "A \\t, a \\u000B, and an \\u0007 walk into a |, and the barman says \\u0402"); + assertTrue (UTF8::escape(s1) == "A \\t, a \\v, and an \\a walk into a |, and the barman says \\u0402"); + assertTrue (UTF8::escape(s1, true) == "A \\t, a \\u000B, and an \\u0007 walk into a |, and the barman says \\u0402"); } @@ -97,8 +97,8 @@ void UTF8StringTest::testUnescape() std::string s1("A \\t, a \\u000B, and an \\u0007 walk into a |, and the barman says \\u0402"); std::string s2("A \\t, a \\v, and an \\a walk into a |, and the barman says \\u0402"); - assert (UTF8::unescape(s1) == "A \t, a \v, and an \a walk into a |, and the barman says \xD0\x82"); - assert (UTF8::unescape(s2) == "A \t, a \v, and an \a walk into a |, and the barman says \xD0\x82"); + assertTrue (UTF8::unescape(s1) == "A \t, a \v, and an \a walk into a |, and the barman says \xD0\x82"); + assertTrue (UTF8::unescape(s2) == "A \t, a \v, and an \a walk into a |, and the barman says \xD0\x82"); } diff --git a/Foundation/testsuite/src/UUIDGeneratorTest.cpp b/Foundation/testsuite/src/UUIDGeneratorTest.cpp index 80a220808..1ea742e52 100644 --- a/Foundation/testsuite/src/UUIDGeneratorTest.cpp +++ b/Foundation/testsuite/src/UUIDGeneratorTest.cpp @@ -39,8 +39,8 @@ void UUIDGeneratorTest::testTimeBased() for (int i = 0; i < 1000; ++i) { UUID uuid = gen.create(); - assert (uuid.version() == UUID::UUID_TIME_BASED); - assert (uuids.find(uuid) == uuids.end()); + assertTrue (uuid.version() == UUID::UUID_TIME_BASED); + assertTrue (uuids.find(uuid) == uuids.end()); uuids.insert(uuid); } } @@ -54,8 +54,8 @@ void UUIDGeneratorTest::testRandom() for (int i = 0; i < 1000; ++i) { UUID uuid = gen.createRandom(); - assert (uuid.version() == UUID::UUID_RANDOM); - assert (uuids.find(uuid) == uuids.end()); + assertTrue (uuid.version() == UUID::UUID_RANDOM); + assertTrue (uuids.find(uuid) == uuids.end()); uuids.insert(uuid); } } @@ -66,29 +66,29 @@ void UUIDGeneratorTest::testNameBased() UUIDGenerator& gen = UUIDGenerator::defaultGenerator(); UUID uuid1 = gen.createFromName(UUID::uri(), "http://www.appinf.com/uuid"); - assert (uuid1.version() == UUID::UUID_NAME_BASED); - assert (uuid1.variant() == 2); + assertTrue (uuid1.version() == UUID::UUID_NAME_BASED); + assertTrue (uuid1.variant() == 2); UUID uuid2 = gen.createFromName(UUID::uri(), "http://www.appinf.com/uuid2"); - assert (uuid2 != uuid1); + assertTrue (uuid2 != uuid1); UUID uuid3 = gen.createFromName(UUID::dns(), "www.appinf.com"); - assert (uuid3 != uuid1); + assertTrue (uuid3 != uuid1); UUID uuid4 = gen.createFromName(UUID::oid(), "1.3.6.1.4.1"); - assert (uuid4 != uuid1); + assertTrue (uuid4 != uuid1); UUID uuid5 = gen.createFromName(UUID::x500(), "cn=Guenter Obiltschnig, ou=People, o=Applied Informatics, c=at"); - assert (uuid5 != uuid1); + assertTrue (uuid5 != uuid1); UUID uuid6 = gen.createFromName(UUID::uri(), "http://www.appinf.com/uuid"); - assert (uuid6 == uuid1); + assertTrue (uuid6 == uuid1); Poco::SHA1Engine sha1; UUID uuid7 = gen.createFromName(UUID::uri(), "http://www.appinf.com/uuid", sha1); - assert (uuid7.version() == UUID::UUID_NAME_BASED_SHA1); - assert (uuid7.variant() == 2); - assert (uuid7 != uuid1); + assertTrue (uuid7.version() == UUID::UUID_NAME_BASED_SHA1); + assertTrue (uuid7.variant() == 2); + assertTrue (uuid7 != uuid1); } diff --git a/Foundation/testsuite/src/UUIDTest.cpp b/Foundation/testsuite/src/UUIDTest.cpp index cc5ceee6f..baef56807 100644 --- a/Foundation/testsuite/src/UUIDTest.cpp +++ b/Foundation/testsuite/src/UUIDTest.cpp @@ -31,13 +31,13 @@ UUIDTest::~UUIDTest() void UUIDTest::testParse() { UUID uuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8"); - assert (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); + assertTrue (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); uuid.parse("6BA7B810-9DAD-11D1-80B4-00C04FD430C8"); - assert (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); + assertTrue (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); uuid.parse("6BA7B8109DAD11D180B400C04FD430C8"); - assert (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); + assertTrue (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); try { @@ -102,51 +102,51 @@ void UUIDTest::testBuffer() uuid.copyTo(buffer); UUID uuid2; uuid2.copyFrom(buffer); - assert (uuid2.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); + assertTrue (uuid2.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); } void UUIDTest::testCompare() { UUID null; - assert (null.isNull()); - assert (UUID::null().isNull()); + assertTrue (null.isNull()); + assertTrue (UUID::null().isNull()); UUID uuid1 = null; UUID uuid2; - assert (uuid1.isNull()); - assert (uuid1 == null); - assert (!(uuid1 != null)); - assert (uuid1 >= null); - assert (uuid1 <= null); - assert (!(uuid1 > null)); - assert (!(uuid1 < null)); - assert (uuid1.toString() == "00000000-0000-0000-0000-000000000000"); + assertTrue (uuid1.isNull()); + assertTrue (uuid1 == null); + assertTrue (!(uuid1 != null)); + assertTrue (uuid1 >= null); + assertTrue (uuid1 <= null); + assertTrue (!(uuid1 > null)); + assertTrue (!(uuid1 < null)); + assertTrue (uuid1.toString() == "00000000-0000-0000-0000-000000000000"); uuid1 = UUID::dns(); - assert (!uuid1.isNull()); - assert (uuid1 != null); - assert (!(uuid1 == null)); - assert (uuid1 >= null); - assert (!(uuid1 <= null)); - assert (uuid1 > null); - assert (!(uuid1 < null)); - assert (uuid1.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); + assertTrue (!uuid1.isNull()); + assertTrue (uuid1 != null); + assertTrue (!(uuid1 == null)); + assertTrue (uuid1 >= null); + assertTrue (!(uuid1 <= null)); + assertTrue (uuid1 > null); + assertTrue (!(uuid1 < null)); + assertTrue (uuid1.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); - assert (null != uuid1); - assert (!(null == uuid1)); - assert (!(null >= uuid1)); - assert (null <= uuid1); - assert (!(null > uuid1)); - assert (null < uuid1); + assertTrue (null != uuid1); + assertTrue (!(null == uuid1)); + assertTrue (!(null >= uuid1)); + assertTrue (null <= uuid1); + assertTrue (!(null > uuid1)); + assertTrue (null < uuid1); uuid2 = uuid1; - assert (uuid2 == uuid1); - assert (!(uuid2 != uuid1)); - assert (uuid2 >= uuid1); - assert (uuid2 <= uuid1); - assert (!(uuid2 > uuid1)); - assert (!(uuid2 < uuid1)); + assertTrue (uuid2 == uuid1); + assertTrue (!(uuid2 != uuid1)); + assertTrue (uuid2 >= uuid1); + assertTrue (uuid2 <= uuid1); + assertTrue (!(uuid2 > uuid1)); + assertTrue (!(uuid2 < uuid1)); } @@ -154,19 +154,19 @@ void UUIDTest::testVersion() { UUID uuid("db4fa7e9-9e62-4597-99e0-b1ec0b59800e"); UUID::Version v = uuid.version(); - assert (v == UUID::UUID_RANDOM); + assertTrue (v == UUID::UUID_RANDOM); uuid.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"); v = uuid.version(); - assert (v == UUID::UUID_TIME_BASED); + assertTrue (v == UUID::UUID_TIME_BASED); uuid.parse("d2ee4220-3625-11d9-9669-0800200c9a66"); v = uuid.version(); - assert (v == UUID::UUID_TIME_BASED); + assertTrue (v == UUID::UUID_TIME_BASED); uuid.parse("360d3652-4411-4786-bbe6-b9675b548559"); v = uuid.version(); - assert (v == UUID::UUID_RANDOM); + assertTrue (v == UUID::UUID_RANDOM); } @@ -174,19 +174,19 @@ void UUIDTest::testVariant() { UUID uuid("db4fa7e9-9e62-4597-99e0-b1ec0b59800e"); int v = uuid.variant(); - assert (v == 2); + assertTrue (v == 2); uuid.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"); v = uuid.variant(); - assert (v == 2); + assertTrue (v == 2); uuid.parse("d2ee4220-3625-11d9-9669-0800200c9a66"); v = uuid.variant(); - assert (v == 2); + assertTrue (v == 2); uuid.parse("360d3652-4411-4786-bbe6-b9675b548559"); v = uuid.variant(); - assert (v == 2); + assertTrue (v == 2); } @@ -195,19 +195,19 @@ void UUIDTest::testSwap() UUID uuid1("db4fa7e9-9e62-4597-99e0-b1ec0b59800e"); UUID uuid2("d2ee4220-3625-11d9-9669-0800200c9a66"); uuid1.swap(uuid2); - assert (uuid1.toString() == "d2ee4220-3625-11d9-9669-0800200c9a66"); - assert (uuid2.toString() == "db4fa7e9-9e62-4597-99e0-b1ec0b59800e"); + assertTrue (uuid1.toString() == "d2ee4220-3625-11d9-9669-0800200c9a66"); + assertTrue (uuid2.toString() == "db4fa7e9-9e62-4597-99e0-b1ec0b59800e"); } void UUIDTest::testTryParse() { UUID uuid; - assert (uuid.tryParse("6BA7B810-9DAD-11D1-80B4-00C04FD430C8")); - assert (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); + assertTrue (uuid.tryParse("6BA7B810-9DAD-11D1-80B4-00C04FD430C8")); + assertTrue (uuid.toString() == "6ba7b810-9dad-11d1-80b4-00c04fd430c8"); UUID notUuid; - assert (!notUuid.tryParse("not a uuid")); - assert (notUuid.isNull()); + assertTrue (!notUuid.tryParse("not a uuid")); + assertTrue (notUuid.isNull()); } void UUIDTest::setUp() diff --git a/Foundation/testsuite/src/UnicodeConverterTest.h b/Foundation/testsuite/src/UnicodeConverterTest.h index a08b5532f..ab99d286b 100644 --- a/Foundation/testsuite/src/UnicodeConverterTest.h +++ b/Foundation/testsuite/src/UnicodeConverterTest.h @@ -46,27 +46,27 @@ private: T wtext, wtext2, wtext3; Poco::UnicodeConverter::convert(text, wtext); if (sizeof(typename T::value_type) == 2) - assert(Poco::UnicodeConverter::UTFStrlen(wtext.data()) == 8); + assertTrue (Poco::UnicodeConverter::UTFStrlen(wtext.data()) == 8); else if (sizeof(typename T::value_type) == 4) - assert(Poco::UnicodeConverter::UTFStrlen(wtext.data()) == 5); + assertTrue (Poco::UnicodeConverter::UTFStrlen(wtext.data()) == 5); Poco::UnicodeConverter::convert((const char*) supp, strlen((const char*) supp), wtext2); Poco::UnicodeConverter::convert((const char*)supp, wtext3); - assert(wtext == wtext2); - assert(wtext == wtext3); + assertTrue (wtext == wtext2); + assertTrue (wtext == wtext3); std::string text2, text3, text4; - assert (text != text2); - assert (text != text3); - assert (text != text4); + assertTrue (text != text2); + assertTrue (text != text3); + assertTrue (text != text4); // Convert from wide to UTF-8 Poco::UnicodeConverter::convert(wtext, text2); Poco::UnicodeConverter::convert(wtext2, text3); Poco::UnicodeConverter::convert(wtext3, text4); - assert (text == text2); - assert (text == text3); - assert (text == text4); + assertTrue (text == text2); + assertTrue (text == text3); + assertTrue (text == text4); } }; diff --git a/Foundation/testsuite/src/UniqueExpireCacheTest.cpp b/Foundation/testsuite/src/UniqueExpireCacheTest.cpp index 1176982d5..1bf895566 100644 --- a/Foundation/testsuite/src/UniqueExpireCacheTest.cpp +++ b/Foundation/testsuite/src/UniqueExpireCacheTest.cpp @@ -61,16 +61,16 @@ void UniqueExpireCacheTest::testClear() aCache.add(1, IntVal(2, DURSLEEP)); aCache.add(3, IntVal(4, DURSLEEP)); aCache.add(5, IntVal(6, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(1)->value == 2); - assert (aCache.get(3)->value == 4); - assert (aCache.get(5)->value == 6); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(1)->value == 2); + assertTrue (aCache.get(3)->value == 4); + assertTrue (aCache.get(5)->value == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } @@ -80,16 +80,16 @@ void UniqueExpireCacheTest::testAccessClear() aCache.add(1, DIntVal(2, DURSLEEP)); aCache.add(3, DIntVal(4, DURSLEEP)); aCache.add(5, DIntVal(6, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(1)->value() == 2); - assert (aCache.get(3)->value() == 4); - assert (aCache.get(5)->value() == 6); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(1)->value() == 2); + assertTrue (aCache.get(3)->value() == 4); + assertTrue (aCache.get(5)->value() == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } @@ -99,23 +99,23 @@ void UniqueExpireCacheTest::testAccessUpdate() aCache.add(1, DIntVal(2, DURSLEEP)); aCache.add(3, DIntVal(4, DURSLEEP)); aCache.add(5, DIntVal(6, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(1)->value() == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(1)->value() == 2); Thread::sleep(DURSLEEP/2); - assert (aCache.get(1)->value() == 2); + assertTrue (aCache.get(1)->value() == 2); Thread::sleep(DURSLEEP/2); - assert (aCache.get(1)->value() == 2); + assertTrue (aCache.get(1)->value() == 2); Thread::sleep(DURSLEEP/2); - assert (aCache.get(1)->value() == 2); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (aCache.get(1)->value() == 2); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); Thread::sleep(DURSLEEP*2); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); aCache.remove(666); //must work too } @@ -124,7 +124,7 @@ void UniqueExpireCacheTest::testExpire0() { UniqueExpireCache aCache; aCache.add(1, IntVal(2, 0)); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); } @@ -133,7 +133,7 @@ void UniqueExpireCacheTest::testAccessExpire0() { UniqueAccessExpireCache aCache; aCache.add(1, DIntVal(2, Timespan(0, 0))); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); } @@ -143,49 +143,49 @@ void UniqueExpireCacheTest::testExpireN() // 3-1|5 -> 5 gets removed UniqueExpireCache aCache; aCache.add(1, IntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); SharedPtr tmp = aCache.get(1); - assert (!tmp.isNull()); - assert (tmp->value == 2); + assertTrue (!tmp.isNull()); + assertTrue (tmp->value == 2); Thread::sleep(DURWAIT); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); // tmp must still be valid, access it - assert (tmp->value == 2); + assertTrue (tmp->value == 2); tmp = aCache.get(1); - assert (tmp.isNull()); + assertTrue (tmp.isNull()); aCache.add(1, IntVal(2, DURSLEEP)); // 1 Thread::sleep(DURHALFSLEEP); aCache.add(3, IntVal(4, DURSLEEP)); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); tmp = aCache.get(1); SharedPtr tmp2 = aCache.get(3); - assert (tmp->value == 2); - assert (tmp2->value == 4); + assertTrue (tmp->value == 2); + assertTrue (tmp2->value == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (tmp->value == 2); // 1-3 - assert (tmp2->value == 4); // 3-1 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (tmp->value == 2); // 1-3 + assertTrue (tmp2->value == 4); // 3-1 tmp2 = aCache.get(3); - assert (tmp2->value == 4); + assertTrue (tmp2->value == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(3)); - assert (tmp2->value == 4); + assertTrue (!aCache.has(3)); + assertTrue (tmp2->value == 4); tmp = aCache.get(1); tmp2 = aCache.get(3); - assert (!tmp); - assert (!tmp2); + assertTrue (!tmp); + assertTrue (!tmp2); // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -193,11 +193,11 @@ void UniqueExpireCacheTest::testDuplicateAdd() { UniqueExpireCache aCache; aCache.add(1, IntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); - assert (aCache.get(1)->value == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 2); aCache.add(1, IntVal(3, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.get(1)->value == 3); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 3); } @@ -205,11 +205,11 @@ void UniqueExpireCacheTest::testAccessDuplicateAdd() { UniqueAccessExpireCache aCache; aCache.add(1, DIntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); - assert (aCache.get(1)->value() == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value() == 2); aCache.add(1, DIntVal(3, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.get(1)->value() == 3); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value() == 3); } @@ -218,11 +218,11 @@ void UniqueExpireCacheTest::testExpirationDecorator() typedef ExpirationDecorator ExpireInt; UniqueExpireCache aCache; aCache.add(1, ExpireInt(2, DURSLEEP)); // 1 - assert (aCache.has(1)); - assert (aCache.get(1)->value() == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value() == 2); aCache.add(1, ExpireInt(3, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.get(1)->value() == 3); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value() == 3); } diff --git a/Foundation/testsuite/src/UniqueExpireLRUCacheTest.cpp b/Foundation/testsuite/src/UniqueExpireLRUCacheTest.cpp index 0be25c5ab..702162504 100644 --- a/Foundation/testsuite/src/UniqueExpireLRUCacheTest.cpp +++ b/Foundation/testsuite/src/UniqueExpireLRUCacheTest.cpp @@ -62,16 +62,16 @@ void UniqueExpireLRUCacheTest::testClear() aCache.add(1, IntVal(2, DURSLEEP)); aCache.add(3, IntVal(4, DURSLEEP)); aCache.add(5, IntVal(6, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(1)->value == 2); - assert (aCache.get(3)->value == 4); - assert (aCache.get(5)->value == 6); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(1)->value == 2); + assertTrue (aCache.get(3)->value == 4); + assertTrue (aCache.get(5)->value == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } @@ -82,23 +82,23 @@ void UniqueExpireLRUCacheTest::testAccessClear() aCache.add(1, DIntVal(2, DURSLEEP)); aCache.add(3, DIntVal(4, DURSLEEP)); aCache.add(5, DIntVal(6, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(1)->value() == 2); - assert (aCache.get(3)->value() == 4); - assert (aCache.get(5)->value() == 6); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(1)->value() == 2); + assertTrue (aCache.get(3)->value() == 4); + assertTrue (aCache.get(5)->value() == 6); aCache.clear(); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (!aCache.has(5)); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (!aCache.has(5)); } void UniqueExpireLRUCacheTest::testExpire0() { UniqueExpireLRUCache aCache; aCache.add(1, IntVal(2, 0)); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); } @@ -108,49 +108,49 @@ void UniqueExpireLRUCacheTest::testExpireN() // 3-1|5 -> 5 gets removed UniqueExpireLRUCache aCache(3); aCache.add(1, IntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); + assertTrue (aCache.has(1)); SharedPtr tmp = aCache.get(1); - assert (!tmp.isNull()); - assert (tmp->value == 2); + assertTrue (!tmp.isNull()); + assertTrue (tmp->value == 2); Thread::sleep(DURWAIT); - assert (!aCache.has(1)); + assertTrue (!aCache.has(1)); // tmp must still be valid, access it - assert (tmp->value == 2); + assertTrue (tmp->value == 2); tmp = aCache.get(1); - assert (!tmp); + assertTrue (!tmp); aCache.add(1, IntVal(2, DURSLEEP)); // 1 Thread::sleep(DURHALFSLEEP); aCache.add(3, IntVal(4, DURSLEEP)); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); tmp = aCache.get(1); SharedPtr tmp2 = aCache.get(3); - assert (tmp->value == 2); - assert (tmp2->value == 4); + assertTrue (tmp->value == 2); + assertTrue (tmp2->value == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (tmp->value == 2); // 1-3 - assert (tmp2->value == 4); // 3-1 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (tmp->value == 2); // 1-3 + assertTrue (tmp2->value == 4); // 3-1 tmp2 = aCache.get(3); - assert (tmp2->value == 4); + assertTrue (tmp2->value == 4); Thread::sleep(DURHALFSLEEP+25); //3|1 - assert (!aCache.has(3)); - assert (tmp2->value == 4); + assertTrue (!aCache.has(3)); + assertTrue (tmp2->value == 4); tmp = aCache.get(1); tmp2 = aCache.get(3); - assert (!tmp); - assert (!tmp2); + assertTrue (!tmp); + assertTrue (!tmp2); // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -172,22 +172,22 @@ void UniqueExpireLRUCacheTest::testCacheSize1() { UniqueExpireLRUCache aCache(1); aCache.add(1, IntVal(2, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.get(1)->value == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 2); aCache.add(3, IntVal(4, DURSLEEP)); // replaces 1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.get(3)->value == 4); + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.get(3)->value == 4); aCache.add(5, IntVal(6, DURSLEEP)); - assert (!aCache.has(1)); - assert (!aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(5)->value == 6); + assertTrue (!aCache.has(1)); + assertTrue (!aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(5)->value == 6); aCache.remove(5); - assert (!aCache.has(5)); + assertTrue (!aCache.has(5)); // removing illegal entries should work too aCache.remove(666); @@ -200,37 +200,37 @@ void UniqueExpireLRUCacheTest::testCacheSize2() // 3-1|5 -> 5 gets removed UniqueExpireLRUCache aCache(2); aCache.add(1, IntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); - assert (aCache.get(1)->value == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 2); aCache.add(3, IntVal(4, DURSLEEP)); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.get(1)->value == 2); // 1-3 - assert (aCache.get(3)->value == 4); // 3-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.get(1)->value == 2); // 1-3 + assertTrue (aCache.get(3)->value == 4); // 3-1 aCache.add(5, IntVal(6, DURSLEEP)); // 5-3|1 - assert (!aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(5)->value == 6); // 5-3 - assert (aCache.get(3)->value == 4); // 3-5 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(5)->value == 6); // 5-3 + assertTrue (aCache.get(3)->value == 4); // 3-5 // test remove from the end and the beginning of the list aCache.remove(5); // 3 - assert (!aCache.has(5)); - assert (aCache.get(3)->value == 4); // 3 + assertTrue (!aCache.has(5)); + assertTrue (aCache.get(3)->value == 4); // 3 aCache.add(5, IntVal(6, DURSLEEP)); // 5-3 - assert (aCache.get(3)->value == 4); // 3-5 + assertTrue (aCache.get(3)->value == 4); // 3-5 aCache.remove(3); // 5 - assert (!aCache.has(3)); - assert (aCache.get(5)->value == 6); // 5 + assertTrue (!aCache.has(3)); + assertTrue (aCache.get(5)->value == 6); // 5 // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); + assertTrue (!aCache.has(5)); } @@ -240,48 +240,48 @@ void UniqueExpireLRUCacheTest::testCacheSizeN() // 3-1|5 -> 5 gets removed UniqueExpireLRUCache aCache(3); aCache.add(1, IntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); - assert (aCache.get(1)->value == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 2); aCache.add(3, IntVal(4, DURSLEEP)); // 3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.get(1)->value == 2); // 1-3 - assert (aCache.get(3)->value == 4); // 3-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.get(1)->value == 2); // 1-3 + assertTrue (aCache.get(3)->value == 4); // 3-1 aCache.add(5, IntVal(6, DURSLEEP)); // 5-3-1 - assert (aCache.has(1)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(5)->value == 6); // 5-3-1 - assert (aCache.get(3)->value == 4); // 3-5-1 + assertTrue (aCache.has(1)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(5)->value == 6); // 5-3-1 + assertTrue (aCache.get(3)->value == 4); // 3-5-1 aCache.add(7, IntVal(8, DURSLEEP)); // 7-5-3|1 - assert (!aCache.has(1)); - assert (aCache.has(7)); - assert (aCache.has(3)); - assert (aCache.has(5)); - assert (aCache.get(5)->value == 6); // 5-7-3 - assert (aCache.get(3)->value == 4); // 3-5-7 - assert (aCache.get(7)->value == 8); // 7-3-5 + assertTrue (!aCache.has(1)); + assertTrue (aCache.has(7)); + assertTrue (aCache.has(3)); + assertTrue (aCache.has(5)); + assertTrue (aCache.get(5)->value == 6); // 5-7-3 + assertTrue (aCache.get(3)->value == 4); // 3-5-7 + assertTrue (aCache.get(7)->value == 8); // 7-3-5 // test remove from the end and the beginning of the list aCache.remove(5); // 7-3 - assert (!aCache.has(5)); - assert (aCache.get(3)->value == 4); // 3-7 + assertTrue (!aCache.has(5)); + assertTrue (aCache.get(3)->value == 4); // 3-7 aCache.add(5, IntVal(6, DURSLEEP)); // 5-3-7 - assert (aCache.get(7)->value == 8); // 7-5-3 + assertTrue (aCache.get(7)->value == 8); // 7-5-3 aCache.remove(7); // 5-3 - assert (!aCache.has(7)); - assert (aCache.has(3)); - assert (aCache.get(5)->value == 6); // 5-3 + assertTrue (!aCache.has(7)); + assertTrue (aCache.has(3)); + assertTrue (aCache.get(5)->value == 6); // 5-3 // removing illegal entries should work too aCache.remove(666); aCache.clear(); - assert (!aCache.has(5)); - assert (!aCache.has(3)); + assertTrue (!aCache.has(5)); + assertTrue (!aCache.has(3)); } @@ -289,11 +289,11 @@ void UniqueExpireLRUCacheTest::testDuplicateAdd() { UniqueExpireLRUCache aCache(3); aCache.add(1, IntVal(2, DURSLEEP)); // 1 - assert (aCache.has(1)); - assert (aCache.get(1)->value == 2); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 2); aCache.add(1, IntVal(3, DURSLEEP)); - assert (aCache.has(1)); - assert (aCache.get(1)->value == 3); + assertTrue (aCache.has(1)); + assertTrue (aCache.get(1)->value == 3); } diff --git a/Foundation/testsuite/src/VarTest.cpp b/Foundation/testsuite/src/VarTest.cpp index 4d9b033f4..747467e9f 100644 --- a/Foundation/testsuite/src/VarTest.cpp +++ b/Foundation/testsuite/src/VarTest.cpp @@ -71,7 +71,7 @@ void VarTest::testInt8() Poco::Int8 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::Int8)); + assertTrue (a1.type() == typeid(Poco::Int8)); std::string s1; Poco::Int8 s2; @@ -107,30 +107,30 @@ void VarTest::testInt8() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); Int8 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -142,21 +142,21 @@ void VarTest::testInt8() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -165,7 +165,7 @@ void VarTest::testInt16() Poco::Int16 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::Int16)); + assertTrue (a1.type() == typeid(Poco::Int16)); std::string s1; Poco::Int8 s2; @@ -201,30 +201,30 @@ void VarTest::testInt16() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); Int16 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -236,21 +236,21 @@ void VarTest::testInt16() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -259,7 +259,7 @@ void VarTest::testInt32() Poco::Int32 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::Int32)); + assertTrue (a1.type() == typeid(Poco::Int32)); std::string s1; Poco::Int8 s2; @@ -295,30 +295,30 @@ void VarTest::testInt32() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); Int32 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -330,21 +330,21 @@ void VarTest::testInt32() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -353,7 +353,7 @@ void VarTest::testInt64() Poco::Int64 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::Int64)); + assertTrue (a1.type() == typeid(Poco::Int64)); std::string s1; Poco::Int8 s2; @@ -389,30 +389,30 @@ void VarTest::testInt64() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); Int64 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -424,21 +424,21 @@ void VarTest::testInt64() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -447,7 +447,7 @@ void VarTest::testUInt8() Poco::UInt8 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::UInt8)); + assertTrue (a1.type() == typeid(Poco::UInt8)); std::string s1; Poco::Int8 s2; @@ -483,30 +483,30 @@ void VarTest::testUInt8() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); UInt8 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -518,21 +518,21 @@ void VarTest::testUInt8() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -541,7 +541,7 @@ void VarTest::testUInt16() Poco::UInt16 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::UInt16)); + assertTrue (a1.type() == typeid(Poco::UInt16)); std::string s1; Poco::Int8 s2; @@ -577,30 +577,30 @@ void VarTest::testUInt16() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); UInt16 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -612,21 +612,21 @@ void VarTest::testUInt16() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -635,7 +635,7 @@ void VarTest::testUInt32() Poco::UInt32 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::UInt32)); + assertTrue (a1.type() == typeid(Poco::UInt32)); std::string s1; Poco::Int8 s2; @@ -671,30 +671,30 @@ void VarTest::testUInt32() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); UInt32 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -706,21 +706,21 @@ void VarTest::testUInt32() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -729,7 +729,7 @@ void VarTest::testUInt64() Poco::UInt64 src = 32; Var a1 = src; - assert (a1.type() == typeid(Poco::UInt64)); + assertTrue (a1.type() == typeid(Poco::UInt64)); std::string s1; Poco::Int8 s2; @@ -765,30 +765,30 @@ void VarTest::testUInt64() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); UInt64 value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -800,21 +800,21 @@ void VarTest::testUInt64() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -823,7 +823,7 @@ void VarTest::testBool() bool src = true; Var a1 = src; - assert (a1.type() == typeid(bool)); + assertTrue (a1.type() == typeid(bool)); std::string s1; Poco::Int8 s2; @@ -859,30 +859,30 @@ void VarTest::testBool() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 1); - assert (s15 == 1); - assert (s16 == 1); - assert (s17 == 1); - assert (s1 == "true"); - assert (s2 == 1); - assert (s3 == 1); - assert (s4 == 1); - assert (s5 == 1); - assert (s6 == 1); - assert (s7 == 1); - assert (s8 == 1); - assert (s9 == 1); - assert (s10 == 1.0f); - assert (s11 == 1.0); - assert (s12); - assert (s13 == '\x1'); + assertTrue (s14 == 1); + assertTrue (s15 == 1); + assertTrue (s16 == 1); + assertTrue (s17 == 1); + assertTrue (s1 == "true"); + assertTrue (s2 == 1); + assertTrue (s3 == 1); + assertTrue (s4 == 1); + assertTrue (s5 == 1); + assertTrue (s6 == 1); + assertTrue (s7 == 1); + assertTrue (s8 == 1); + assertTrue (s9 == 1); + assertTrue (s10 == 1.0f); + assertTrue (s11 == 1.0); + assertTrue (s12); + assertTrue (s13 == '\x1'); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); bool value = a1.extract(); - assert (value); + assertTrue (value); try { @@ -900,7 +900,7 @@ void VarTest::testChar() char src = ' '; Var a1 = src; - assert (a1.type() == typeid(char)); + assertTrue (a1.type() == typeid(char)); std::string s1; Poco::Int8 s2; @@ -936,30 +936,30 @@ void VarTest::testChar() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == " "); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == " "); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); char value = a1.extract(); - assert (value == ' '); + assertTrue (value == ' '); try { @@ -980,7 +980,7 @@ void VarTest::testFloat() float src = 32.0f; Var a1 = src; - assert (a1.type() == typeid(float)); + assertTrue (a1.type() == typeid(float)); std::string s1; Poco::Int8 s2; @@ -1016,30 +1016,30 @@ void VarTest::testFloat() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); float value = a1.extract(); - assert (value == 32.0f); + assertTrue (value == 32.0f); try { @@ -1051,21 +1051,21 @@ void VarTest::testFloat() } Var a3 = a1 + 1.0f; - assert (a3 == 33.0f); + assertTrue (a3 == 33.0f); a3 = a1 - 1.0f; - assert (a3 == 31.0f); + assertTrue (a3 == 31.0f); a3 += 1.0f; - assert (a3 == 32.0f); + assertTrue (a3 == 32.0f); a3 -= 1.0f; - assert (a3 == 31.0f); + assertTrue (a3 == 31.0f); a3 = a1 / 2.0f; - assert (a3 == 16.0f); + assertTrue (a3 == 16.0f); a3 = a1 * 2.0f; - assert (a3 == 64.0f); + assertTrue (a3 == 64.0f); a3 /= 2.0f; - assert (a3 == 32.0f); + assertTrue (a3 == 32.0f); a3 *= 2.0f; - assert (a3 == 64.0f); + assertTrue (a3 == 64.0f); } @@ -1078,7 +1078,7 @@ void VarTest::testDouble() double src = 32.0; Var a1 = src; - assert (a1.type() == typeid(double)); + assertTrue (a1.type() == typeid(double)); std::string s1; Poco::Int8 s2; @@ -1114,30 +1114,30 @@ void VarTest::testDouble() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); double value = a1.extract(); - assert (value == 32.0); + assertTrue (value == 32.0); try { @@ -1150,21 +1150,21 @@ void VarTest::testDouble() Var a3 = a1 + 1.0; - assert (a3 == 33.0); + assertTrue (a3 == 33.0); a3 = a1 - 1.0; - assert (a3 == 31.0); + assertTrue (a3 == 31.0); a3 += 1.0; - assert (a3 == 32.0); + assertTrue (a3 == 32.0); a3 -= 1.0; - assert (a3 == 31.0); + assertTrue (a3 == 31.0); a3 = a1 / 2.0; - assert (a3 == 16.0); + assertTrue (a3 == 16.0); a3 = a1 * 2.0; - assert (a3 == 64.0); + assertTrue (a3 == 64.0); a3 /= 2.0; - assert (a3 == 32.0); + assertTrue (a3 == 32.0); a3 *= 2.0; - assert (a3 == 64.0); + assertTrue (a3 == 64.0); } @@ -1172,7 +1172,7 @@ void VarTest::testString() { Var a1("32"); - assert (a1.type() == typeid(std::string)); + assertTrue (a1.type() == typeid(std::string)); std::string s1; Poco::Int8 s2; @@ -1208,26 +1208,26 @@ void VarTest::testString() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == '3'); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == '3'); const std::string& value = a1.extract(); - assert (value == "32"); + assertTrue (value == "32"); try { @@ -1241,20 +1241,20 @@ void VarTest::testString() Var a4(123); std::string s("456"); Var a5 = a4 + s; - assert (a5 == "123456"); + assertTrue (a5 == "123456"); a4 += s; - assert (a4 == "123456"); + assertTrue (a4 == "123456"); Var a6 = a4 + "789"; - assert (a6 == "123456789"); + assertTrue (a6 == "123456789"); a4 += "789"; - assert (a4 == "123456789"); + assertTrue (a4 == "123456789"); a4 = ""; - assert(!a4); + assertTrue (!a4); a4 = "0"; - assert(!a4); + assertTrue (!a4); a4 = "FaLsE"; - assert(!a4); + assertTrue (!a4); } @@ -1263,7 +1263,7 @@ void VarTest::testLong() long src = 32; Var a1 = src; - assert (a1.type() == typeid(long)); + assertTrue (a1.type() == typeid(long)); std::string s1; Poco::Int8 s2; @@ -1299,30 +1299,30 @@ void VarTest::testLong() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); long value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -1334,21 +1334,21 @@ void VarTest::testLong() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -1357,7 +1357,7 @@ void VarTest::testULong() unsigned long src = 32; Var a1 = src; - assert (a1.type() == typeid(unsigned long)); + assertTrue (a1.type() == typeid(unsigned long)); std::string s1; Poco::Int8 s2; @@ -1393,30 +1393,30 @@ void VarTest::testULong() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); unsigned long value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -1428,21 +1428,21 @@ void VarTest::testULong() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } void VarTest::testLongLong() @@ -1450,7 +1450,7 @@ void VarTest::testLongLong() long long src = 32; Var a1 = src; - assert (a1.type() == typeid(long long)); + assertTrue (a1.type() == typeid(long long)); std::string s1; Poco::Int8 s2; @@ -1486,30 +1486,30 @@ void VarTest::testLongLong() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); long long value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -1521,21 +1521,21 @@ void VarTest::testLongLong() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } @@ -1544,7 +1544,7 @@ void VarTest::testULongLong() unsigned long long src = 32; Var a1 = src; - assert (a1.type() == typeid(unsigned long long)); + assertTrue (a1.type() == typeid(unsigned long long)); std::string s1; Poco::Int8 s2; @@ -1580,30 +1580,30 @@ void VarTest::testULongLong() a1.convert(s15); a1.convert(s16); a1.convert(s17); - assert (s14 == 32); - assert (s15 == 32); - assert (s16 == 32); - assert (s17 == 32); - assert (s1 == "32"); - assert (s2 == 32); - assert (s3 == 32); - assert (s4 == 32); - assert (s5 == 32); - assert (s6 == 32); - assert (s7 == 32); - assert (s8 == 32); - assert (s9 == 32); - assert (s10 == 32.0f); - assert (s11 == 32.0); - assert (s12); - assert (s13 == ' '); + assertTrue (s14 == 32); + assertTrue (s15 == 32); + assertTrue (s16 == 32); + assertTrue (s17 == 32); + assertTrue (s1 == "32"); + assertTrue (s2 == 32); + assertTrue (s3 == 32); + assertTrue (s4 == 32); + assertTrue (s5 == 32); + assertTrue (s6 == 32); + assertTrue (s7 == 32); + assertTrue (s8 == 32); + assertTrue (s9 == 32); + assertTrue (s10 == 32.0f); + assertTrue (s11 == 32.0); + assertTrue (s12); + assertTrue (s13 == ' '); Var a2(a1); std::string t2; a2.convert(t2); - assert (s1 == t2); + assertTrue (s1 == t2); unsigned long long value = a1.extract(); - assert (value == 32); + assertTrue (value == 32); try { @@ -1615,36 +1615,36 @@ void VarTest::testULongLong() } Var a3 = a1 + 1; - assert (a3 == 33); + assertTrue (a3 == 33); a3 = a1 - 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 += 1; - assert (a3 == 32); + assertTrue (a3 == 32); a3 -= 1; - assert (a3 == 31); + assertTrue (a3 == 31); a3 = a1 / 2; - assert (a3 == 16); + assertTrue (a3 == 16); a3 = a1 * 2; - assert (a3 == 64); + assertTrue (a3 == 64); a3 /= 2; - assert (a3 == 32); + assertTrue (a3 == 32); a3 *= 2; - assert (a3 == 64); + assertTrue (a3 == 64); } void VarTest::testUDT() { Dummy d0; - assert (d0 == 0); + assertTrue (d0 == 0); Dummy d(1); Var da = d; - assert (da.extract() == 1); + assertTrue (da.extract() == 1); Dummy d1 = d; Var da1 = d1; - assert (da1.extract() == 1); + assertTrue (da1.extract() == 1); try { @@ -1659,35 +1659,35 @@ void VarTest::testConversionOperator() { Var any("42"); int i = any; - assert (i == 42); - assert (any == i); + assertTrue (i == 42); + assertTrue (any == i); any = 123; std::string s1 = any.convert(); - assert (s1 == "123"); - assert (s1 == any); - assert (any == s1); - assert ("123" == any); + assertTrue (s1 == "123"); + assertTrue (s1 == any); + assertTrue (any == s1); + assertTrue ("123" == any); any = 321; s1 = any.convert(); - assert (s1 == "321"); + assertTrue (s1 == "321"); any = "456"; - assert (any == "456"); - assert ("456" == any); + assertTrue (any == "456"); + assertTrue ("456" == any); any = 789; std::string s2 = any.convert(); - assert (s2 == "789"); - assert (s2 == any); - assert (any == s2); - assert ("789" == any); + assertTrue (s2 == "789"); + assertTrue (s2 == any); + assertTrue (any == s2); + assertTrue ("789" == any); Var any2 = "1.5"; double d = any2; - assert (d == 1.5); - assert (any2 == d); + assertTrue (d == 1.5); + assertTrue (any2 == d); } @@ -1695,113 +1695,113 @@ void VarTest::testComparisonOperators() { Var any1 = 1; Var any2 = "1"; - assert (any1 == any2); - assert (any1 == 1); - assert (1 == any1); - assert (any1 == "1"); - assert ("1" == any1); - assert (any1 <= 1); - assert (1 >= any1); - assert (any1 <= 2); - assert (2 >= any1); - assert (any1 < 2); - assert (2 > any1); - assert (any1 > 0); - assert (0 < any1); - assert (any1 >= 1); - assert (1 <= any1); - assert (any1 >= 0); - assert (0 <= any1); + assertTrue (any1 == any2); + assertTrue (any1 == 1); + assertTrue (1 == any1); + assertTrue (any1 == "1"); + assertTrue ("1" == any1); + assertTrue (any1 <= 1); + assertTrue (1 >= any1); + assertTrue (any1 <= 2); + assertTrue (2 >= any1); + assertTrue (any1 < 2); + assertTrue (2 > any1); + assertTrue (any1 > 0); + assertTrue (0 < any1); + assertTrue (any1 >= 1); + assertTrue (1 <= any1); + assertTrue (any1 >= 0); + assertTrue (0 <= any1); any1 = 1L; - assert (any1 == any2); - assert (any1 == 1L); - assert (1L == any1); - assert (any1 == "1"); - assert ("1" == any1); - assert (any1 != 2L); - assert (2L != any1); - assert (any1 != "2"); - assert ("2" != any1); - assert (any1 <= 1L); - assert (1L >= any1); - assert (any1 <= 2L); - assert (2L >= any1); - assert (any1 < 2L); - assert (2L > any1); - assert (any1 > 0); - assert (0 < any1); - assert (any1 >= 1L); - assert (1L <= any1); - assert (any1 >= 0); - assert (0 <= any1); + assertTrue (any1 == any2); + assertTrue (any1 == 1L); + assertTrue (1L == any1); + assertTrue (any1 == "1"); + assertTrue ("1" == any1); + assertTrue (any1 != 2L); + assertTrue (2L != any1); + assertTrue (any1 != "2"); + assertTrue ("2" != any1); + assertTrue (any1 <= 1L); + assertTrue (1L >= any1); + assertTrue (any1 <= 2L); + assertTrue (2L >= any1); + assertTrue (any1 < 2L); + assertTrue (2L > any1); + assertTrue (any1 > 0); + assertTrue (0 < any1); + assertTrue (any1 >= 1L); + assertTrue (1L <= any1); + assertTrue (any1 >= 0); + assertTrue (0 <= any1); any1 = 0x31; - assert (any1 == '1'); - assert ('1' == any1); - assert (any1 <= '1'); - assert ('1' >= any1); - assert (any1 <= '2'); - assert ('2' >= any1); - assert (any1 < '2'); - assert ('2' > any1); - assert (any1 > 0); - assert (0 < any1); - assert (any1 >= '1'); - assert ('1' <= any1); - assert (any1 >= 0); - assert (0 <= any1); + assertTrue (any1 == '1'); + assertTrue ('1' == any1); + assertTrue (any1 <= '1'); + assertTrue ('1' >= any1); + assertTrue (any1 <= '2'); + assertTrue ('2' >= any1); + assertTrue (any1 < '2'); + assertTrue ('2' > any1); + assertTrue (any1 > 0); + assertTrue (0 < any1); + assertTrue (any1 >= '1'); + assertTrue ('1' <= any1); + assertTrue (any1 >= 0); + assertTrue (0 <= any1); any1 = "2"; - assert (any1 != any2); - assert (any1 != 1); - assert (1 != any1); - assert (any1 != "1"); - assert ("1" != any1); + assertTrue (any1 != any2); + assertTrue (any1 != 1); + assertTrue (1 != any1); + assertTrue (any1 != "1"); + assertTrue ("1" != any1); any1 = 1.5; - assert (any1 == 1.5); - assert (1.5 == any1); - assert (any1 == "1.5"); - assert ("1.5" == any1); - assert (any1 != 2.5); - assert (2.5 != any1); - assert (any1 != "2.5"); - assert ("2.5" != any1); - assert (any1 <= 1.5); - assert (1.5 >= any1); - assert (any1 <= 2.5); - assert (2.5 >= any1); - assert (any1 < 2.5); - assert (2.5 > any1); - assert (any1 > 0); - assert (0 < any1); - assert (any1 >= 1.5); - assert (1.5 <= any1); - assert (any1 >= 0); - assert (0 <= any1); + assertTrue (any1 == 1.5); + assertTrue (1.5 == any1); + assertTrue (any1 == "1.5"); + assertTrue ("1.5" == any1); + assertTrue (any1 != 2.5); + assertTrue (2.5 != any1); + assertTrue (any1 != "2.5"); + assertTrue ("2.5" != any1); + assertTrue (any1 <= 1.5); + assertTrue (1.5 >= any1); + assertTrue (any1 <= 2.5); + assertTrue (2.5 >= any1); + assertTrue (any1 < 2.5); + assertTrue (2.5 > any1); + assertTrue (any1 > 0); + assertTrue (0 < any1); + assertTrue (any1 >= 1.5); + assertTrue (1.5 <= any1); + assertTrue (any1 >= 0); + assertTrue (0 <= any1); any1 = 1.5f; - assert (any1 == 1.5f); - assert (1.5f == any1); - assert (any1 == "1.5"); - assert ("1.5" == any1); - assert (any1 != 2.5f); - assert (2.5f != any1); - assert (any1 != "2.5"); - assert ("2.5" != any1); - assert (any1 <= 1.5f); - assert (1.5f >= any1); - assert (any1 <= 2.5f); - assert (2.5f >= any1); - assert (any1 < 2.5f); - assert (2.5f > any1); - assert (any1 > 0); - assert (0 < any1); - assert (any1 >= 1.5f); - assert (1.5f <= any1); - assert (any1 >= 0); - assert (0 <= any1); + assertTrue (any1 == 1.5f); + assertTrue (1.5f == any1); + assertTrue (any1 == "1.5"); + assertTrue ("1.5" == any1); + assertTrue (any1 != 2.5f); + assertTrue (2.5f != any1); + assertTrue (any1 != "2.5"); + assertTrue ("2.5" != any1); + assertTrue (any1 <= 1.5f); + assertTrue (1.5f >= any1); + assertTrue (any1 <= 2.5f); + assertTrue (2.5f >= any1); + assertTrue (any1 < 2.5f); + assertTrue (2.5f > any1); + assertTrue (any1 > 0); + assertTrue (0 < any1); + assertTrue (any1 >= 1.5f); + assertTrue (1.5f <= any1); + assertTrue (any1 >= 0); + assertTrue (0 <= any1); } @@ -1810,77 +1810,77 @@ void VarTest::testArithmeticOperators() Var any1 = 1; Var any2 = 2; Var any3 = any1 + any2; - assert (any3 == 3); + assertTrue (any3 == 3); int i = 1; i += any1; - assert (2 == i); + assertTrue (2 == i); any1 = 3; - assert ((5 - any1) == 2); + assertTrue ((5 - any1) == 2); any2 = 5; any3 = any2 - any1; - assert (any3 == 2); + assertTrue (any3 == 2); any3 -= 1; - assert (any3 == 1); + assertTrue (any3 == 1); i = 5; i -= any1; - assert (2 == i); + assertTrue (2 == i); any1 = 3; - assert ((5 * any1) == 15); + assertTrue ((5 * any1) == 15); any2 = 5; any3 = any1 * any2; - assert (any3 == 15); + assertTrue (any3 == 15); any3 *= 3; - assert (any3 == 45); + assertTrue (any3 == 45); i = 5; i *= any1; - assert (15 == i); + assertTrue (15 == i); any1 = 3; - assert ((9 / any1) == 3); + assertTrue ((9 / any1) == 3); any2 = 9; any3 = any2 / any1; - assert (any3 == 3); + assertTrue (any3 == 3); any3 /= 3; - assert (any3 == 1); + assertTrue (any3 == 1); i = 9; i /= any1; - assert (3 == i); + assertTrue (3 == i); any1 = 1.0f; any2 = .5f; any3 = .0f; any3 = any1 + any2; - assert (any3 == 1.5f); + assertTrue (any3 == 1.5f); any3 += .5f; - assert (any3 == 2.0f); + assertTrue (any3 == 2.0f); any1 = 1.0; any2 = .5; any3 = 0.0; any3 = any1 + any2; - assert (any3 == 1.5); + assertTrue (any3 == 1.5); any3 += .5; - assert (any3 == 2.0); + assertTrue (any3 == 2.0); any1 = 1; any2 = "2"; any3 = any1 + any2; - assert (any3 == 3); + assertTrue (any3 == 3); any2 = "4"; any3 += any2; - assert (any3 == 7); - assert (1 + any3 == 8); + assertTrue (any3 == 7); + assertTrue (1 + any3 == 8); any1 = "123"; any2 = "456"; any3 = any1 + any2; - assert (any3 == "123456"); + assertTrue (any3 == "123456"); any2 = "789"; any3 += any2; - assert (any3 == "123456789"); - assert (("xyz" + any3) == "xyz123456789"); + assertTrue (any3 == "123456789"); + assertTrue (("xyz" + any3) == "xyz123456789"); try { any3 = any1 - any2; fail ("must fail"); } catch (InvalidArgumentException&){} @@ -1902,13 +1902,13 @@ void VarTest::testArithmeticOperators() any1 = 10; - assert (any1++ == 10); - assert (any1 == 11); - assert (++any1 == 12); + assertTrue (any1++ == 10); + assertTrue (any1 == 11); + assertTrue (++any1 == 12); - assert (any1-- == 12); - assert (any1 == 11); - assert (--any1 == 10); + assertTrue (any1-- == 12); + assertTrue (any1 == 11); + assertTrue (--any1 == 10); any1 = 1.23; @@ -2011,8 +2011,8 @@ void VarTest::testCtor() a3 = a1; - assert (a2 == 42); - assert (a3 == 42); + assertTrue (a2 == 42); + assertTrue (a3 == 42); } @@ -2060,26 +2060,26 @@ void VarTest::testIsStruct() Var d19(s19); Var d20(s20); - assert (!d1.isStruct()); - assert (!d2.isStruct()); - assert (!d3.isStruct()); - assert (!d4.isStruct()); - assert (!d5.isStruct()); - assert (!d6.isStruct()); - assert (!d7.isStruct()); - assert (!d8.isStruct()); - assert (!d9.isStruct()); - assert (!d10.isStruct()); - assert (!d11.isStruct()); - assert (!d12.isStruct()); - assert (!d13.isStruct()); - assert (!d14.isStruct()); - assert (!d15.isStruct()); - assert (!d16.isStruct()); - assert (!d17.isStruct()); - assert (!d18.isStruct()); - assert (d19.isStruct()); - assert (d20.isStruct()); + assertTrue (!d1.isStruct()); + assertTrue (!d2.isStruct()); + assertTrue (!d3.isStruct()); + assertTrue (!d4.isStruct()); + assertTrue (!d5.isStruct()); + assertTrue (!d6.isStruct()); + assertTrue (!d7.isStruct()); + assertTrue (!d8.isStruct()); + assertTrue (!d9.isStruct()); + assertTrue (!d10.isStruct()); + assertTrue (!d11.isStruct()); + assertTrue (!d12.isStruct()); + assertTrue (!d13.isStruct()); + assertTrue (!d14.isStruct()); + assertTrue (!d15.isStruct()); + assertTrue (!d16.isStruct()); + assertTrue (!d17.isStruct()); + assertTrue (!d18.isStruct()); + assertTrue (d19.isStruct()); + assertTrue (d20.isStruct()); } @@ -2126,26 +2126,26 @@ void VarTest::testIsArray() Var d18(s18); Var d19(s19); - assert (!d0.isArray()); - assert (!d1.isArray()); - assert (!d2.isArray()); - assert (!d3.isArray()); - assert (!d4.isArray()); - assert (!d5.isArray()); - assert (!d6.isArray()); - assert (!d7.isArray()); - assert (!d8.isArray()); - assert (!d9.isArray()); - assert (!d10.isArray()); - assert (!d11.isArray()); - assert (!d12.isArray()); - assert (!d13.isArray()); - assert (!d14.isArray()); - assert (!d15.isArray()); - assert (!d16.isArray()); - assert (!d17.isArray()); - assert (d18.isArray()); - assert (!d19.isArray()); + assertTrue (!d0.isArray()); + assertTrue (!d1.isArray()); + assertTrue (!d2.isArray()); + assertTrue (!d3.isArray()); + assertTrue (!d4.isArray()); + assertTrue (!d5.isArray()); + assertTrue (!d6.isArray()); + assertTrue (!d7.isArray()); + assertTrue (!d8.isArray()); + assertTrue (!d9.isArray()); + assertTrue (!d10.isArray()); + assertTrue (!d11.isArray()); + assertTrue (!d12.isArray()); + assertTrue (!d13.isArray()); + assertTrue (!d14.isArray()); + assertTrue (!d15.isArray()); + assertTrue (!d16.isArray()); + assertTrue (!d17.isArray()); + assertTrue (d18.isArray()); + assertTrue (!d19.isArray()); } @@ -2237,22 +2237,22 @@ void VarTest::testArrayIdxOperator() void VarTest::testDynamicStructBasics() { DynamicStruct aStruct; - assert (aStruct.empty()); - assert (aStruct.size() == 0); - assert (aStruct.members().empty()); + assertTrue (aStruct.empty()); + assertTrue (aStruct.size() == 0); + assertTrue (aStruct.members().empty()); aStruct.insert("First Name", "Little"); - assert (!aStruct.empty()); - assert (aStruct.size() == 1); - assert (*(aStruct.members().begin()) == "First Name"); - assert (aStruct["First Name"] == "Little"); + assertTrue (!aStruct.empty()); + assertTrue (aStruct.size() == 1); + assertTrue (*(aStruct.members().begin()) == "First Name"); + assertTrue (aStruct["First Name"] == "Little"); aStruct.insert("Last Name", "POCO"); - assert (aStruct.members().size() == 2); + assertTrue (aStruct.members().size() == 2); aStruct.erase("First Name"); - assert (aStruct.size() == 1); - assert (*(aStruct.members().begin()) == "Last Name"); + assertTrue (aStruct.size() == 1); + assertTrue (*(aStruct.members().begin()) == "Last Name"); aStruct.clear(); - assert (aStruct.size() == 0); + assertTrue (aStruct.size() == 0); } @@ -2262,10 +2262,10 @@ void VarTest::testDynamicStructString() aStruct["First Name"] = "Junior"; aStruct["Last Name"] = "POCO"; Var a1(aStruct); - assert (a1["First Name"] == "Junior"); - assert (a1["Last Name"] == "POCO"); + assertTrue (a1["First Name"] == "Junior"); + assertTrue (a1["Last Name"] == "POCO"); a1["First Name"] = "Senior"; - assert (a1["First Name"] == "Senior"); + assertTrue (a1["First Name"] == "Senior"); testGetIdxMustThrow(a1, 0); Struct s1; @@ -2274,9 +2274,9 @@ void VarTest::testDynamicStructString() s1["3"] = 3; Struct s2(s1); - assert (s2["1"] == 1); - assert (s2["2"] == 2); - assert (s2["3"] == 3); + assertTrue (s2["1"] == 1); + assertTrue (s2["2"] == 2); + assertTrue (s2["3"] == 3); std::map m1; m1["1"] = 1; @@ -2284,9 +2284,9 @@ void VarTest::testDynamicStructString() m1["3"] = 3; Struct m2(m1); - assert (m2["1"] == 1); - assert (m2["2"] == 2); - assert (m2["3"] == 3); + assertTrue (m2["1"] == 1); + assertTrue (m2["2"] == 2); + assertTrue (m2["3"] == 3); } @@ -2297,11 +2297,11 @@ void VarTest::testDynamicStructInt() aStruct[1] = "POCO"; aStruct[2] = 10; Var a1(aStruct); - assert (a1[0]== "Junior"); - assert (a1[1]== "POCO"); - assert (a1[2]== 10); + assertTrue (a1[0]== "Junior"); + assertTrue (a1[1]== "POCO"); + assertTrue (a1[2]== 10); a1[0] = "Senior"; - assert (a1[0] == "Senior"); + assertTrue (a1[0] == "Senior"); Struct s1; s1[1] = "1"; @@ -2309,9 +2309,9 @@ void VarTest::testDynamicStructInt() s1[3] = "3"; Struct s2(s1); - assert (s2[1] == "1"); - assert (s2[2] == "2"); - assert (s2[3] == "3"); + assertTrue (s2[1] == "1"); + assertTrue (s2[2] == "2"); + assertTrue (s2[3] == "3"); std::map m1; m1[1] = "1"; @@ -2319,16 +2319,16 @@ void VarTest::testDynamicStructInt() m1[3] = "3"; Struct m2(m1); - assert (m2[1] == "1"); - assert (m2[2] == "2"); - assert (m2[3] == "3"); + assertTrue (m2[1] == "1"); + assertTrue (m2[2] == "2"); + assertTrue (m2[3] == "3"); } void VarTest::testDynamicPair() { Pair aPair; - assert (0 == aPair.first()); + assertTrue (0 == aPair.first()); try { std::string s = aPair.second().convert(); @@ -2337,38 +2337,38 @@ void VarTest::testDynamicPair() catch (InvalidAccessException&) { } Var va(aPair); - assert ("{ \"0\" : null }" == va.convert()); - assert (aPair.toString() == va.convert()); + assertTrue ("{ \"0\" : null }" == va.convert()); + assertTrue (aPair.toString() == va.convert()); aPair = Pair(4, "123"); - assert ("123" == aPair.second()); + assertTrue ("123" == aPair.second()); va = aPair; - assert ("{ \"4\" : \"123\" }" == va.convert()); - assert (aPair.toString() == va.convert()); + assertTrue ("{ \"4\" : \"123\" }" == va.convert()); + assertTrue (aPair.toString() == va.convert()); int i = 1; std::string s = "2"; Pair iPair(i, s); - assert (1 == iPair.first()); - assert ("2" == iPair.second()); + assertTrue (1 == iPair.first()); + assertTrue ("2" == iPair.second()); Pair sPair(s, i); - assert ("2" == sPair.first()); - assert (1 == sPair.second()); + assertTrue ("2" == sPair.first()); + assertTrue (1 == sPair.second()); std::pair p = std::make_pair(i, s); Pair pPair(p); - assert (1 == pPair.first()); - assert ("2" == pPair.second()); + assertTrue (1 == pPair.first()); + assertTrue ("2" == pPair.second()); Var vp(pPair); - assert ("{ \"1\" : \"2\" }" == vp.convert()); - assert (pPair.toString() == vp.convert()); + assertTrue ("{ \"1\" : \"2\" }" == vp.convert()); + assertTrue (pPair.toString() == vp.convert()); Var vs(sPair); - assert ("{ \"2\" : 1 }" == vs.convert()); - assert (sPair.toString() == vs.convert()); + assertTrue ("{ \"2\" : 1 }" == vs.convert()); + assertTrue (sPair.toString() == vs.convert()); } @@ -2382,7 +2382,7 @@ void VarTest::testArrayToString() Var a1(s16); std::string res = a1.convert(); std::string expected("[ \"string\", 23 ]"); - assert (res == expected); + assertTrue (res == expected); } @@ -2396,7 +2396,7 @@ void VarTest::testArrayToStringEscape() Var a1(s16); std::string res = a1.convert(); std::string expected("[ \"\\\"quoted string\\\"\", 23 ]"); - assert (res == expected); + assertTrue (res == expected); } @@ -2409,8 +2409,8 @@ void VarTest::testStructToString() Var a1(aStruct); std::string res = a1.convert(); std::string expected = "{ \"Age\" : 1, \"First Name\" : \"Junior\", \"Last Name\" : \"POCO\" }"; - assert (res == expected); - assert (aStruct.toString() == res); + assertTrue (res == expected); + assertTrue (aStruct.toString() == res); } @@ -2421,8 +2421,8 @@ void VarTest::testStructToStringEscape() Var a1(aStruct); std::string res = a1.convert(); std::string expected = "{ \"Value\" : \"Value with \\\" and \\n\" }"; - assert (res == expected); - assert (aStruct.toString() == res); + assertTrue (res == expected); + assertTrue (aStruct.toString() == res); } @@ -2455,8 +2455,8 @@ void VarTest::testArrayOfStructsToString() "{ \"Age\" : 100, \"First Name\" : \"Senior\", \"Last Name\" : \"POCO\" } " "] ] ]"; - assert (res == expected); - assert (a1.toString() == res); + assertTrue (res == expected); + assertTrue (a1.toString() == res); } @@ -2482,8 +2482,8 @@ void VarTest::testStructWithArraysToString() std::string expected = "{ \"Address\" : { \"Country\" : \"Carinthia\", \"Number\" : 4, \"Street\" : \"Unknown\" }, " "\"Age\" : 1, \"First Name\" : \"Junior\", \"Last Name\" : [ \"string\", 23 ] }"; - assert (res == expected); - assert (aStruct.toString() == res); + assertTrue (res == expected); + assertTrue (aStruct.toString() == res); } @@ -2492,21 +2492,21 @@ void VarTest::testJSONDeserializeString() Var a("test"); std::string tst = Var::toString(a); Var b = Var::parse(tst); - assert (b.convert() == "test"); + assertTrue (b.convert() == "test"); Var c('c'); tst = Var::toString(c); Var b2 = Var::parse(tst); char cc = b2.convert(); - assert (cc == 'c'); + assertTrue (cc == 'c'); tst = "{ \"a\" : \"1\", \"b\" : \"2\" \n}"; a = Var::parse(tst); - assert(a.toString() == "{ \"a\" : \"1\", \"b\" : \"2\" }"); + assertTrue (a.toString() == "{ \"a\" : \"1\", \"b\" : \"2\" }"); tst = "{ \"a\" : \"1\", \"b\" : \"2\"\n}"; a = Var::parse(tst); - assert(a.toString() == "{ \"a\" : \"1\", \"b\" : \"2\" }"); + assertTrue (a.toString() == "{ \"a\" : \"1\", \"b\" : \"2\" }"); } @@ -2535,13 +2535,13 @@ void VarTest::testJSONDeserializePrimitives() Var ab = Var::parse(sb); Var af = Var::parse(sf); Var ad = Var::parse(sd); - assert (a8 == i8); - assert (a16 == u16); - assert (a32 == i32); - assert (a64 == u64); - assert (ab == b); - assert (af == f); - assert (ad == d); + assertTrue (a8 == i8); + assertTrue (a16 == u16); + assertTrue (a32 == i32); + assertTrue (a64 == u64); + assertTrue (ab == b); + assertTrue (af == f); + assertTrue (ad == d); } @@ -2570,15 +2570,15 @@ void VarTest::testJSONDeserializeArray() std::string sVec = Var::toString(aVec); Var a = Var::parse(sVec); - assert (a[0] == i8); - assert (a[1] == u16); - assert (a[2] == i32); - assert (a[3] == u64); - assert (a[4] == b); - assert (a[5] == f); - assert (a[6] == d); - assert (a[7] == s); - assert (a[8] == c); + assertTrue (a[0] == i8); + assertTrue (a[1] == u16); + assertTrue (a[2] == i32); + assertTrue (a[3] == u64); + assertTrue (a[4] == b); + assertTrue (a[5] == f); + assertTrue (a[6] == d); + assertTrue (a[7] == s); + assertTrue (a[8] == c); } @@ -2619,29 +2619,29 @@ void VarTest::testJSONDeserializeComplex() std::string sStr = Var::toString(aStr); Var a = Var::parse(sStr); - assert (a.isStruct()); - assert (aStr["i8"] == i8); - assert (aStr["u16"] == u16); - assert (aStr["i32"] == i32); - assert (aStr["u64"] == u64); - assert (aStr["b"] == b); - assert (aStr["f"] == f); - assert (aStr["d"] == d); - assert (aStr["s"] == s); - assert (aStr["c"] == c); + assertTrue (a.isStruct()); + assertTrue (aStr["i8"] == i8); + assertTrue (aStr["u16"] == u16); + assertTrue (aStr["i32"] == i32); + assertTrue (aStr["u64"] == u64); + assertTrue (aStr["b"] == b); + assertTrue (aStr["f"] == f); + assertTrue (aStr["d"] == d); + assertTrue (aStr["s"] == s); + assertTrue (aStr["c"] == c); Var vecRet = a["vec"]; - assert (vecRet.isArray()); - assert (vecRet[0] == i8); - assert (vecRet[1] == u16); - assert (vecRet[2] == i32); - assert (vecRet[3] == u64); - assert (vecRet[4] == b); - assert (vecRet[5] == f); - assert (vecRet[6] == d); - assert (vecRet[7] == s); - assert (vecRet[8] == c); + assertTrue (vecRet.isArray()); + assertTrue (vecRet[0] == i8); + assertTrue (vecRet[1] == u16); + assertTrue (vecRet[2] == i32); + assertTrue (vecRet[3] == u64); + assertTrue (vecRet[4] == b); + assertTrue (vecRet[5] == f); + assertTrue (vecRet[6] == d); + assertTrue (vecRet[7] == s); + assertTrue (vecRet[8] == c); Var strRet = vecRet[9]; - assert (strRet.isStruct()); + assertTrue (strRet.isStruct()); } @@ -2670,15 +2670,15 @@ void VarTest::testJSONDeserializeStruct() std::string sStr = Var::toString(aStr); Var a = Var::parse(sStr); - assert (a["i8"] == i8); - assert (a["u16"] == u16); - assert (a["i32"] == i32); - assert (a["u64"] == u64); - assert (a["b"] == b); - assert (a["f"] == f); - assert (a["d"] == d); - assert (a["s"] == s); - assert (a["c"] == c); + assertTrue (a["i8"] == i8); + assertTrue (a["u16"] == u16); + assertTrue (a["i32"] == i32); + assertTrue (a["u64"] == u64); + assertTrue (a["b"] == b); + assertTrue (a["f"] == f); + assertTrue (a["d"] == d); + assertTrue (a["s"] == s); + assertTrue (a["c"] == c); } @@ -2699,14 +2699,14 @@ void VarTest::testJSONRoundtripStruct() std::string sStr = Var::toString(aStr); Var a = Var::parse(sStr); - assert (a["i64"].isInteger()); - assert (!a["u64"].isSigned()); - assert (a["b"].isBoolean()); - assert (a["d"].isNumeric()); - assert (a["s"].isString()); + assertTrue (a["i64"].isInteger()); + assertTrue (!a["u64"].isSigned()); + assertTrue (a["b"].isBoolean()); + assertTrue (a["d"].isNumeric()); + assertTrue (a["s"].isString()); std::string serialized = Var::toString(a); - assert (sStr == serialized); + assertTrue (sStr == serialized); } @@ -2717,26 +2717,26 @@ void VarTest::testDate() Poco::Timestamp tsNow = dtNow.timestamp(); Poco::LocalDateTime ldtNow(dtNow.timestamp()); Var dt(dtNow); - assert(dt.isDate()); - assert(dt.isTime()); - assert(dt.isDateTime()); + assertTrue (dt.isDate()); + assertTrue (dt.isTime()); + assertTrue (dt.isDateTime()); Var ts(tsNow); - assert(ts.isDate()); - assert(ts.isTime()); - assert(ts.isDateTime()); + assertTrue (ts.isDate()); + assertTrue (ts.isTime()); + assertTrue (ts.isDateTime()); Var ldt(ldtNow); - assert(ldt.isDate()); - assert(ldt.isTime()); - assert(ldt.isDateTime()); + assertTrue (ldt.isDate()); + assertTrue (ldt.isTime()); + assertTrue (ldt.isDateTime()); Var dtStr(dt.convert()); Var tsStr(ts.convert()); Var ldtStr(ldt.convert()); DateTime dtRes = dtStr.convert(); LocalDateTime ldtRes = ldtStr.convert(); Timestamp tsRes = tsStr.convert(); - assert (dtNow == dtRes); - assert (ldtNow == ldtRes); - assert (tsNow == tsRes); + assertTrue (dtNow == dtRes); + assertTrue (ldtNow == ldtRes); + assertTrue (tsNow == tsRes); } @@ -2766,7 +2766,7 @@ void VarTest::testGetIdxMustThrow(Var& a1, std::vector::size_type n) const Var& c1 = a1; const Var& cval1 = c1[n]; fail("bad const cast - must throw"); - assert (cval1 == c1); // silence the compiler + assertTrue (cval1 == c1); // silence the compiler } catch (Poco::InvalidAccessException&) { @@ -2780,42 +2780,42 @@ void VarTest::testGetIdxMustThrow(Var& a1, std::vector::size_type n) void VarTest::testEmpty() { Var da; - assert (da.isEmpty()); - assert (da.type() == typeid(void)); - assert (!da.isArray()); - assert (!da.isInteger()); - assert (!da.isNumeric()); - assert (!da.isSigned()); - assert (!da.isString()); - assert (da == da); - assert (!(da != da)); + assertTrue (da.isEmpty()); + assertTrue (da.type() == typeid(void)); + assertTrue (!da.isArray()); + assertTrue (!da.isInteger()); + assertTrue (!da.isNumeric()); + assertTrue (!da.isSigned()); + assertTrue (!da.isString()); + assertTrue (da == da); + assertTrue (!(da != da)); - assert (da != Var(1)); - assert (!(da == Var(1))); - assert (Var(1) != da); - assert (!(Var(1) == da)); + assertTrue (da != Var(1)); + assertTrue (!(da == Var(1))); + assertTrue (Var(1) != da); + assertTrue (!(Var(1) == da)); da = "123"; int i = da.convert(); - assert (123 == i); + assertTrue (123 == i); std::string s = da.extract(); - assert ("123" == s); - assert (!da.isEmpty()); + assertTrue ("123" == s); + assertTrue (!da.isEmpty()); da.empty(); - assert (da.isEmpty()); - assert (da.type() == typeid(void)); - assert (!da.isArray()); - assert (!da.isInteger()); - assert (!da.isNumeric()); - assert (!da.isSigned()); - assert (!da.isString()); - assert (da == da); - assert (!(da != da)); + assertTrue (da.isEmpty()); + assertTrue (da.type() == typeid(void)); + assertTrue (!da.isArray()); + assertTrue (!da.isInteger()); + assertTrue (!da.isNumeric()); + assertTrue (!da.isSigned()); + assertTrue (!da.isString()); + assertTrue (da == da); + assertTrue (!(da != da)); - assert (da != ""); - assert ("" != da); - assert (!(da == "")); - assert (!("" == da)); + assertTrue (da != ""); + assertTrue ("" != da); + assertTrue (!(da == "")); + assertTrue (!("" == da)); testEmptyComparisons(); testEmptyComparisons(); @@ -2854,61 +2854,61 @@ void VarTest::testEmpty() void VarTest::testIterator() { Var da; - assert (da.isEmpty()); - assert (da.begin() == da.end()); + assertTrue (da.isEmpty()); + assertTrue (da.begin() == da.end()); da = 1; - assert (!da.isEmpty()); - assert (da == 1); - assert (da[0] == 1); + assertTrue (!da.isEmpty()); + assertTrue (da == 1); + assertTrue (da[0] == 1); try { da[1] = 2; } catch (RangeException&) {} - assert (da.begin() != da.end()); + assertTrue (da.begin() != da.end()); Var::Iterator it = da.begin(); Var::Iterator end = da.end(); - assert (it != end); - assert (++it == end); - assert (--it == da.begin()); + assertTrue (it != end); + assertTrue (++it == end); + assertTrue (--it == da.begin()); it++; - assert (it == end); + assertTrue (it == end); try { ++it; fail ("must fail"); } catch (RangeException&) {} - assert (it == end); + assertTrue (it == end); da = "abc"; - assert (da.size() == 3); - assert (!da.isArray()); - assert (da.isString()); - //assert (da[0] == 'a'); - assert (da.at(0) == 'a'); - //assert (da[1] = 'b'); - assert (da.at(1) == 'b'); - //assert (da[2] = 'c'); - assert (da.at(2) == 'c'); + assertTrue (da.size() == 3); + assertTrue (!da.isArray()); + assertTrue (da.isString()); + //assertTrue (da[0] == 'a'); + assertTrue (da.at(0) == 'a'); + //assertTrue (da[1] = 'b'); + assertTrue (da.at(1) == 'b'); + //assertTrue (da[2] = 'c'); + assertTrue (da.at(2) == 'c'); da.at(0) = 'b'; - assert (da.at(0) == 'b'); + assertTrue (da.at(0) == 'b'); // TODO: allow treatment of strings like arrays //da[1] = 'c'; da.at(1) = 'c'; - assert (da.at(1) == 'c'); + assertTrue (da.at(1) == 'c'); //da[2] = 'a'; da.at(2) = 'a'; - assert (da.at(2) == 'a'); + assertTrue (da.at(2) == 'a'); it = da.begin(); end = da.end(); - assert (it != end); - assert (++it != end); - assert (--it == da.begin()); + assertTrue (it != end); + assertTrue (++it != end); + assertTrue (--it == da.begin()); testContainerIterator >(); testContainerIterator >(); diff --git a/Foundation/testsuite/src/VarTest.h b/Foundation/testsuite/src/VarTest.h index c2704455d..3351f0929 100644 --- a/Foundation/testsuite/src/VarTest.h +++ b/Foundation/testsuite/src/VarTest.h @@ -85,12 +85,12 @@ private: void testGetIdx(const Poco::Dynamic::Var& a1, std::vector::size_type n, const T& expectedResult) { Poco::Dynamic::Var val1 = a1[n]; - assert (val1 == expectedResult); + assertTrue (val1 == expectedResult); const Poco::Dynamic::Var c1 = a1; - assert (a1 == c1); // silence the compiler + assertTrue (a1 == c1); // silence the compiler const Poco::Dynamic::Var cval1 = a1[n]; - assert (cval1 == expectedResult); + assertTrue (cval1 == expectedResult); } @@ -130,8 +130,8 @@ private: template void testLimitsSignedUnsigned() { - assert (std::numeric_limits::is_signed); - assert (!std::numeric_limits::is_signed); + assertTrue (std::numeric_limits::is_signed); + assertTrue (!std::numeric_limits::is_signed); TS iMin = std::numeric_limits::min(); Poco::Dynamic::Var dMin = iMin; @@ -162,18 +162,18 @@ private: Poco::Dynamic::Var da; T val = 0; - assert (da != val); - assert (val != da); - assert (!(val == da)); - assert (!(da == val)); - assert (!(da < val)); - assert (!(val < da)); - assert (!(da > val)); - assert (!(val > da)); - assert (!(da <= val)); - assert (!(val <= da)); - assert (!(da >= val)); - assert (!(val >= da)); + assertTrue (da != val); + assertTrue (val != da); + assertTrue (!(val == da)); + assertTrue (!(da == val)); + assertTrue (!(da < val)); + assertTrue (!(val < da)); + assertTrue (!(da > val)); + assertTrue (!(val > da)); + assertTrue (!(da <= val)); + assertTrue (!(val <= da)); + assertTrue (!(da >= val)); + assertTrue (!(val >= da)); } template @@ -184,7 +184,7 @@ private: cont.push_back("2"); cont.push_back(3.5); Poco::Dynamic::Var arr(cont); - assert (arr.size() == 3); + assertTrue (arr.size() == 3); Poco::Dynamic::Var::Iterator it = arr.begin(); Poco::Dynamic::Var::Iterator end = arr.end(); int counter = 0; @@ -193,13 +193,13 @@ private: switch (++counter) { case 1: - assert (*it == 1); + assertTrue (*it == 1); break; case 2: - assert (*it == 2); + assertTrue (*it == 2); break; case 3: - assert (*it == 3.5); + assertTrue (*it == 3.5); break; default: fail ("must fail - wrong size"); diff --git a/Foundation/testsuite/src/ZLibTest.cpp b/Foundation/testsuite/src/ZLibTest.cpp index 586c6df03..966d2d9d4 100644 --- a/Foundation/testsuite/src/ZLibTest.cpp +++ b/Foundation/testsuite/src/ZLibTest.cpp @@ -48,9 +48,9 @@ void ZLibTest::testDeflate1() InflatingInputStream inflater(buffer); std::string data; inflater >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); inflater >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); } @@ -67,9 +67,9 @@ void ZLibTest::testDeflate2() inflater.close(); std::string data; buffer2 >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); buffer2 >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); } @@ -87,9 +87,9 @@ void ZLibTest::testDeflate3() inflater.close(); std::string data; buffer3 >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); buffer3 >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); } @@ -105,7 +105,7 @@ void ZLibTest::testDeflate4() InflatingInputStream inflater(istr, -10); std::string data2; inflater >> data2; - assert (data2 == data); + assertTrue (data2 == data); } @@ -119,9 +119,9 @@ void ZLibTest::testGzip1() InflatingInputStream inflater(buffer, InflatingStreamBuf::STREAM_GZIP); std::string data; inflater >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); inflater >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); } @@ -140,9 +140,9 @@ void ZLibTest::testGzip2() InflatingInputStream inflater(istr, InflatingStreamBuf::STREAM_GZIP); std::string data; inflater >> data; - assert (data == "Hello,"); + assertTrue (data == "Hello,"); inflater >> data; - assert (data == "world!"); + assertTrue (data == "world!"); } @@ -160,18 +160,18 @@ void ZLibTest::testGzip3() InflatingInputStream inflater(buffer, InflatingStreamBuf::STREAM_GZIP); std::string data; inflater >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); inflater >> data; - assert (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); + assertTrue (data == "abcdefabcdefabcdefabcdefabcdefabcdef"); data.clear(); inflater >> data; - assert (data.empty()); - assert (inflater.eof()); + assertTrue (data.empty()); + assertTrue (inflater.eof()); inflater.reset(); inflater >> data; - assert (data == "bcdefabcdefabcdefabcdefabcdefabcdefa"); + assertTrue (data == "bcdefabcdefabcdefabcdefabcdefabcdefa"); inflater >> data; - assert (data == "bcdefabcdefabcdefabcdefabcdefabcdefa"); + assertTrue (data == "bcdefabcdefabcdefabcdefabcdefabcdefa"); } diff --git a/JSON/testsuite/src/JSONTest.cpp b/JSON/testsuite/src/JSONTest.cpp index 00f4a810a..2533cab49 100644 --- a/JSON/testsuite/src/JSONTest.cpp +++ b/JSON/testsuite/src/JSONTest.cpp @@ -68,23 +68,23 @@ void JSONTest::testNullProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); - assert(object->isNull("test")); + assertTrue (object->isNull("test")); Var test = object->get("test"); - assert(test.isEmpty()); + assertTrue (test.isEmpty()); Poco::Nullable test2 = object->getNullableValue("test"); - assert(test2.isNull()); + assertTrue (test2.isNull()); DynamicStruct ds = *object; - assert (ds["test"].isEmpty()); + assertTrue (ds["test"].isEmpty()); const DynamicStruct& rds = *object; - assert (rds["test"].isEmpty()); + assertTrue (rds["test"].isEmpty()); } @@ -101,24 +101,24 @@ void JSONTest::testTrueProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.type() == typeid(bool)); + assertTrue (test.type() == typeid(bool)); bool value = test; - assert(value); + assertTrue (value); DynamicStruct ds = *object; - assert (!ds["test"].isEmpty()); - assert (ds["test"]); + assertTrue (!ds["test"].isEmpty()); + assertTrue (ds["test"]); const DynamicStruct& rds = *object; - assert (!rds["test"].isEmpty()); - assert (rds["test"]); + assertTrue (!rds["test"].isEmpty()); + assertTrue (rds["test"]); } @@ -135,24 +135,24 @@ void JSONTest::testFalseProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.type() == typeid(bool)); + assertTrue (test.type() == typeid(bool)); bool value = test; - assert(!value); + assertTrue (!value); DynamicStruct ds = *object; - assert (!ds["test"].isEmpty()); - assert (!ds["test"]); + assertTrue (!ds["test"].isEmpty()); + assertTrue (!ds["test"]); const DynamicStruct& rds = *object; - assert (!rds["test"].isEmpty()); - assert (!rds["test"]); + assertTrue (!rds["test"].isEmpty()); + assertTrue (!rds["test"]); } @@ -179,33 +179,33 @@ void JSONTest::testUnsignedNumberProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.isNumeric()); - assert(test.isInteger()); + assertTrue (test.isNumeric()); + assertTrue (test.isInteger()); Poco::UInt32 value = test; - assert(value == -1); + assertTrue (value == -1); DynamicStruct ds = *object; - assert (!ds["test"].isEmpty()); - assert (ds["test"].isNumeric()); - assert (ds["test"].isInteger()); - assert (ds["test"] == 4294967295u); + assertTrue (!ds["test"].isEmpty()); + assertTrue (ds["test"].isNumeric()); + assertTrue (ds["test"].isInteger()); + assertTrue (ds["test"] == 4294967295u); value = ds["test"]; - assert(value == -1); + assertTrue (value == -1); const DynamicStruct& rds = *object; - assert (!rds["test"].isEmpty()); - assert (rds["test"].isNumeric()); - assert (rds["test"].isInteger()); - assert (rds["test"] == 4294967295u); + assertTrue (!rds["test"].isEmpty()); + assertTrue (rds["test"].isNumeric()); + assertTrue (rds["test"].isInteger()); + assertTrue (rds["test"] == 4294967295u); value = rds["test"]; - assert(value == -1); + assertTrue (value == -1); } #if defined(POCO_HAVE_INT64) @@ -224,32 +224,32 @@ void JSONTest::testNumber64Property() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object object = *result.extract(); Var test = object.get("test"); - assert(test.isInteger()); + assertTrue (test.isInteger()); Poco::Int64 value = test; - assert(value == -5000000000000000); + assertTrue (value == -5000000000000000); DynamicStruct ds = object; - assert (!ds["test"].isEmpty()); - assert (ds["test"].isNumeric()); - assert (ds["test"].isInteger()); - assert (ds["test"] == -5000000000000000); + assertTrue (!ds["test"].isEmpty()); + assertTrue (ds["test"].isNumeric()); + assertTrue (ds["test"].isInteger()); + assertTrue (ds["test"] == -5000000000000000); value = ds["test"]; - assert(value == -5000000000000000); + assertTrue (value == -5000000000000000); const DynamicStruct& rds = object; - assert (!rds["test"].isEmpty()); - assert (rds["test"].isNumeric()); - assert (rds["test"].isInteger()); - assert (rds["test"] == -5000000000000000); + assertTrue (!rds["test"].isEmpty()); + assertTrue (rds["test"].isNumeric()); + assertTrue (rds["test"].isInteger()); + assertTrue (rds["test"] == -5000000000000000); value = rds["test"]; - assert(value == -5000000000000000); + assertTrue (value == -5000000000000000); } @@ -267,32 +267,32 @@ void JSONTest::testUnsignedNumber64Property() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.isInteger()); + assertTrue (test.isInteger()); Poco::UInt64 value = test; - assert(value == -1); + assertTrue (value == -1); /* TODO: clang has trouble here DynamicStruct ds = *object; - assert (!ds["test"].isEmpty()); - assert (ds["test"].isNumeric()); - assert (ds["test"].isInteger()); - assert (ds["test"] == 18446744073709551615); + assertTrue (!ds["test"].isEmpty()); + assertTrue (ds["test"].isNumeric()); + assertTrue (ds["test"].isInteger()); + assertTrue (ds["test"] == 18446744073709551615); value = ds["test"]; - assert(value == -1); + assertTrue (value == -1); const DynamicStruct& rds = *object; - assert (!rds["test"].isEmpty()); - assert (rds["test"].isNumeric()); - assert (rds["test"].isInteger()); - assert (rds["test"] == 18446744073709551615); + assertTrue (!rds["test"].isEmpty()); + assertTrue (rds["test"].isNumeric()); + assertTrue (rds["test"].isInteger()); + assertTrue (rds["test"] == 18446744073709551615); value = rds["test"]; - assert(value == -1); + assertTrue (value == -1); */ } @@ -312,37 +312,37 @@ void JSONTest::testStringProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object object = *result.extract(); Var test = object.get("test"); - assert(test.isString()); + assertTrue (test.isString()); std::string value = test.convert(); - assert(value.compare("value") == 0); + assertTrue (value.compare("value") == 0); object.set("test2", 'a'); std::ostringstream ostr; object.stringify(ostr); - assert(ostr.str() == "{\"test\":\"value\",\"test2\":\"a\"}"); + assertTrue (ostr.str() == "{\"test\":\"value\",\"test2\":\"a\"}"); DynamicStruct ds = object; - assert (!ds["test"].isEmpty()); - assert (ds["test"].isString()); - assert (!ds["test"].isInteger()); - assert (ds["test"] == "value"); + assertTrue (!ds["test"].isEmpty()); + assertTrue (ds["test"].isString()); + assertTrue (!ds["test"].isInteger()); + assertTrue (ds["test"] == "value"); value = ds["test"].toString(); - assert(value == "value"); + assertTrue (value == "value"); const DynamicStruct& rds = object; - assert (!rds["test"].isEmpty()); - assert (rds["test"].isString()); - assert (!rds["test"].isInteger()); - assert (rds["test"] == "value"); + assertTrue (!rds["test"].isEmpty()); + assertTrue (rds["test"].isString()); + assertTrue (!rds["test"].isInteger()); + assertTrue (rds["test"] == "value"); value = rds["test"].toString(); - assert(value == "value"); + assertTrue (value == "value"); } @@ -359,19 +359,19 @@ void JSONTest::testEmptyObject() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); - assert(object->size() == 0); + assertTrue (object->size() == 0); DynamicStruct ds = *object; - assert (ds.size() == 0); + assertTrue (ds.size() == 0); const DynamicStruct& rds = *object; - assert (rds.size() == 0); + assertTrue (rds.size() == 0); } @@ -388,21 +388,21 @@ void JSONTest::testEmptyPropertyName() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); - assert(object->size() == 1); + assertTrue (object->size() == 1); DynamicStruct ds = *object; - assert (ds.size() == 1); + assertTrue (ds.size() == 1); const DynamicStruct& rds = *object; - assert (rds.size() == 1); + assertTrue (rds.size() == 1); - assert (ds[""] == 42); + assertTrue (ds[""] == 42); } @@ -473,39 +473,39 @@ void JSONTest::testComplexObject() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); - assert(object->size() > 0); + assertTrue (object->size() > 0); Object::NameList names = object->getNames(); - assert (names.size() == 4); - assert (names[0] == "id"); - assert (names[1] == "jsonrpc"); - assert (names[2] == "result"); - assert (names[3] == "total"); + assertTrue (names.size() == 4); + assertTrue (names[0] == "id"); + assertTrue (names[1] == "jsonrpc"); + assertTrue (names[2] == "result"); + assertTrue (names[3] == "total"); DynamicStruct ds = *object; - assert (ds.size() > 0); - assert (ds["id"] == 1); - assert (ds["jsonrpc"] == 2.0); + assertTrue (ds.size() > 0); + assertTrue (ds["id"] == 1); + assertTrue (ds["jsonrpc"] == 2.0); - assert (ds["result"].isArray()); - assert (ds["result"].size() == 1); - assert (ds["result"][0].isStruct()); - assert (ds["result"][0]["id"] == 1); - assert (ds["result"][0]["guid"] == "67acfb26-17eb-4a75-bdbd-f0669b7d8f73"); - assert (ds["result"][0]["age"] == 40); - assert (ds["result"][0]["name"] == "Angelina Crossman"); - assert (ds["result"][0]["gender"] == "female"); - assert (ds["result"][0]["company"] == "Raylog"); - assert (ds["result"][0]["phone"] == "892-470-2803"); - assert (ds["result"][0]["email"] == "angelina@raylog.com"); - assert (ds["result"][0]["address"] == "20726, CostaMesa, Horatio Streets"); - assert (ds["result"][0]["about"] == "Consectetuer suscipit volutpat eros dolor euismod, " + assertTrue (ds["result"].isArray()); + assertTrue (ds["result"].size() == 1); + assertTrue (ds["result"][0].isStruct()); + assertTrue (ds["result"][0]["id"] == 1); + assertTrue (ds["result"][0]["guid"] == "67acfb26-17eb-4a75-bdbd-f0669b7d8f73"); + assertTrue (ds["result"][0]["age"] == 40); + assertTrue (ds["result"][0]["name"] == "Angelina Crossman"); + assertTrue (ds["result"][0]["gender"] == "female"); + assertTrue (ds["result"][0]["company"] == "Raylog"); + assertTrue (ds["result"][0]["phone"] == "892-470-2803"); + assertTrue (ds["result"][0]["email"] == "angelina@raylog.com"); + assertTrue (ds["result"][0]["address"] == "20726, CostaMesa, Horatio Streets"); + assertTrue (ds["result"][0]["about"] == "Consectetuer suscipit volutpat eros dolor euismod, " "et dignissim in feugiat sed, ea tation exerci quis. Consectetuer, " "dolor dolore ad vero ullamcorper, tincidunt facilisis at in facilisi, " "iusto illum illum. Autem nibh, sed elit consequat volutpat tation, " @@ -515,28 +515,28 @@ void JSONTest::testComplexObject() "suscipit, vulputate elit ut lobortis exerci, nulla dolore eros at " "aliquam, ullamcorper vero ad iusto. Adipiscing, nisl eros exerci " "nisl vel, erat in luptatum in duis, iusto."); - assert (ds["result"][0]["registered"] == "2008-04-09T11:13:17 +05:00"); + assertTrue (ds["result"][0]["registered"] == "2008-04-09T11:13:17 +05:00"); - assert (ds["result"][0]["tags"].isArray()); - assert (ds["result"][0]["tags"].size() == 7); - assert (ds["result"][0]["tags"][0] == "ut"); - assert (ds["result"][0]["tags"][1] == "accumsan"); - assert (ds["result"][0]["tags"][2] == "feugait"); - assert (ds["result"][0]["tags"][3] == "ex"); - assert (ds["result"][0]["tags"][4] == "odio"); - assert (ds["result"][0]["tags"][5] == "consequat"); - assert (ds["result"][0]["tags"][6] == "delenit"); + assertTrue (ds["result"][0]["tags"].isArray()); + assertTrue (ds["result"][0]["tags"].size() == 7); + assertTrue (ds["result"][0]["tags"][0] == "ut"); + assertTrue (ds["result"][0]["tags"][1] == "accumsan"); + assertTrue (ds["result"][0]["tags"][2] == "feugait"); + assertTrue (ds["result"][0]["tags"][3] == "ex"); + assertTrue (ds["result"][0]["tags"][4] == "odio"); + assertTrue (ds["result"][0]["tags"][5] == "consequat"); + assertTrue (ds["result"][0]["tags"][6] == "delenit"); - assert (ds["result"][0]["friends"][0].isStruct()); - assert (ds["result"][0]["friends"][0]["id"] == 1); - assert (ds["result"][0]["friends"][0]["name"] == "Hailey Hardman"); - assert (ds["result"][0]["friends"][1]["id"] == 2); - assert (ds["result"][0]["friends"][1]["name"] == "Bailey Oldridge"); - assert (ds["result"][0]["friends"][2]["id"] == 3); - assert (ds["result"][0]["friends"][2]["name"] == "Makayla Campbell"); + assertTrue (ds["result"][0]["friends"][0].isStruct()); + assertTrue (ds["result"][0]["friends"][0]["id"] == 1); + assertTrue (ds["result"][0]["friends"][0]["name"] == "Hailey Hardman"); + assertTrue (ds["result"][0]["friends"][1]["id"] == 2); + assertTrue (ds["result"][0]["friends"][1]["name"] == "Bailey Oldridge"); + assertTrue (ds["result"][0]["friends"][2]["id"] == 3); + assertTrue (ds["result"][0]["friends"][2]["name"] == "Makayla Campbell"); const DynamicStruct& rds = *object; - assert (rds.size() > 0); + assertTrue (rds.size() > 0); } @@ -553,19 +553,19 @@ void JSONTest::testDoubleProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.isNumeric()); + assertTrue (test.isNumeric()); double value = test; - assert(value == 1234.5); + assertTrue (value == 1234.5); DynamicStruct ds = *object; - assert (ds["test"] == 1234.5); + assertTrue (ds["test"] == 1234.5); } @@ -582,16 +582,16 @@ void JSONTest::testDouble2Property() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.isNumeric()); + assertTrue (test.isNumeric()); double value = test; - assert(value >= 1.99e34 && value <= 12.01e34); + assertTrue (value >= 1.99e34 && value <= 12.01e34); } @@ -608,16 +608,16 @@ void JSONTest::testDouble3Property() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); - assert(test.isNumeric()); + assertTrue (test.isNumeric()); double value = test; - assert(value == 12e-34); + assertTrue (value == 12e-34); } @@ -634,30 +634,30 @@ void JSONTest::testObjectProperty() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert (false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); - assert (object->isObject("test")); - assert (!object->isArray("test")); + assertTrue (object->isObject("test")); + assertTrue (!object->isArray("test")); - assert (!object->isArray("nonExistentKey")); - assert (!object->isObject("nonExistentKey")); + assertTrue (!object->isArray("nonExistentKey")); + assertTrue (!object->isObject("nonExistentKey")); Var test = object->get("test"); - assert (test.type() == typeid(Object::Ptr)); + assertTrue (test.type() == typeid(Object::Ptr)); Object::Ptr subObject = test.extract(); test = subObject->get("property"); - assert (test.isString()); + assertTrue (test.isString()); std::string value = test.convert(); - assert (value.compare("value") == 0); + assertTrue (value.compare("value") == 0); DynamicStruct ds = *object; - assert (ds["test"].isStruct()); - assert (ds["test"]["property"] == "value"); + assertTrue (ds["test"].isStruct()); + assertTrue (ds["test"]["property"] == "value"); // make sure that Object is recognized as such { @@ -667,7 +667,7 @@ void JSONTest::testObjectProperty() inner.set("some_string", "xyz"); std::string key = "new_object"; obj.set(key, inner); - assert(obj.isObject(key)); + assertTrue (obj.isObject(key)); } // make sure that Object pointer is recognized as Object @@ -678,7 +678,7 @@ void JSONTest::testObjectProperty() inner->set("some_string", "xyz"); std::string key = "new_object"; obj.set(key, inner); - assert(obj.isObject(key)); + assertTrue (obj.isObject(key)); } } @@ -696,43 +696,43 @@ void JSONTest::testObjectArray() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); - assert(object->isObject("test")); + assertTrue (object->isObject("test")); Object::Ptr subObject = object->getObject("test"); - assert(!subObject->isObject("test1")); - assert(subObject->isArray("test1")); - assert(!subObject->isObject("test2")); - assert(!subObject->isArray("test2")); + assertTrue (!subObject->isObject("test1")); + assertTrue (subObject->isArray("test1")); + assertTrue (!subObject->isObject("test2")); + assertTrue (!subObject->isArray("test2")); DynamicStruct ds = *object; - assert (ds.size() > 0); - assert (ds.size() == 1); + assertTrue (ds.size() > 0); + assertTrue (ds.size() == 1); - assert (ds["test"].isStruct()); - assert (ds["test"]["test1"].isArray()); - assert (ds["test"]["test1"].size() == 3); - assert (ds["test"]["test1"][0] == 1); - assert (ds["test"]["test1"][1] == 2); - assert (ds["test"]["test1"][2] == 3); - assert (ds["test"]["test2"] == 4); + assertTrue (ds["test"].isStruct()); + assertTrue (ds["test"]["test1"].isArray()); + assertTrue (ds["test"]["test1"].size() == 3); + assertTrue (ds["test"]["test1"][0] == 1); + assertTrue (ds["test"]["test1"][1] == 2); + assertTrue (ds["test"]["test1"][2] == 3); + assertTrue (ds["test"]["test2"] == 4); #ifdef POCO_ENABLE_CPP11 object->set("test3", "another top level value"); ds = std::move(*object); - assert (ds.size() == 2); - assert (ds["test"].isStruct()); - assert (ds["test"]["test1"].isArray()); - assert (ds["test"]["test1"].size() == 3); - assert (ds["test"]["test1"][0] == 1); - assert (ds["test"]["test1"][1] == 2); - assert (ds["test"]["test1"][2] == 3); - assert (ds["test"]["test2"] == 4); - assert (ds["test3"] == "another top level value"); + assertTrue (ds.size() == 2); + assertTrue (ds["test"].isStruct()); + assertTrue (ds["test"]["test1"].isArray()); + assertTrue (ds["test"]["test1"].size() == 3); + assertTrue (ds["test"]["test1"][0] == 1); + assertTrue (ds["test"]["test1"][1] == 2); + assertTrue (ds["test"]["test1"][2] == 3); + assertTrue (ds["test"]["test2"] == 4); + assertTrue (ds["test3"] == "another top level value"); #endif // POCO_ENABLE_CPP11 } @@ -751,29 +751,29 @@ void JSONTest::testArrayOfObjects() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.isArray()); - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.isArray()); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr arr = result.extract(); Object::Ptr object = arr->getObject(0); - assert (object->getValue("test") == 0); + assertTrue (object->getValue("test") == 0); Object::Ptr subObject = arr->getObject(1); Poco::JSON::Array::Ptr subArr = subObject->getArray("test1"); result = subArr->get(0); - assert (result == 1); + assertTrue (result == 1); Poco::Dynamic::Array da = *arr; - assert (da.size() == 2); - assert (da[0].isStruct()); - assert (da[0]["test"] == 0); - assert (da[1].isStruct()); - assert (da[1]["test1"].isArray()); - assert (da[1]["test1"][0] == 1); - assert (da[1]["test1"][1] == 2); - assert (da[1]["test1"][2] == 3); - assert (da[1]["test2"] == 4); + assertTrue (da.size() == 2); + assertTrue (da[0].isStruct()); + assertTrue (da[0]["test"] == 0); + assertTrue (da[1].isStruct()); + assertTrue (da[1]["test1"].isArray()); + assertTrue (da[1]["test1"][0] == 1); + assertTrue (da[1]["test1"][1] == 2); + assertTrue (da[1]["test1"][2] == 3); + assertTrue (da[1]["test2"] == 4); } @@ -790,16 +790,16 @@ void JSONTest::testEmptyArray() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); - assert(array->size() == 0); + assertTrue (array->size() == 0); Poco::Dynamic::Array da = *array; - assert (da.size() == 0); + assertTrue (da.size() == 0); } @@ -816,19 +816,19 @@ void JSONTest::testNestedArray() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); - assert(array->size() == 1); + assertTrue (array->size() == 1); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0].size() == 1); - assert (da[0][0].size() == 1); - assert (da[0][0][0].size() == 0); + assertTrue (da.size() == 1); + assertTrue (da[0].size() == 1); + assertTrue (da[0][0].size() == 1); + assertTrue (da[0][0][0].size() == 0); } @@ -845,19 +845,19 @@ void JSONTest::testNullElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); - assert(array->isNull(0)); + assertTrue (array->isNull(0)); Var test = array->get(0); - assert(test.isEmpty()); + assertTrue (test.isEmpty()); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0].isEmpty()); + assertTrue (da.size() == 1); + assertTrue (da[0].isEmpty()); } @@ -874,20 +874,20 @@ void JSONTest::testTrueElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); Var test = array->get(0); - assert(test.type() == typeid(bool)); + assertTrue (test.type() == typeid(bool)); bool value = test; - assert(value); + assertTrue (value); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0]); + assertTrue (da.size() == 1); + assertTrue (da[0]); } @@ -904,20 +904,20 @@ void JSONTest::testFalseElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); Var test = array->get(0); - assert(test.type() == typeid(bool)); + assertTrue (test.type() == typeid(bool)); bool value = test; - assert(!value); + assertTrue (!value); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (!da[0]); + assertTrue (da.size() == 1); + assertTrue (!da[0]); } @@ -934,20 +934,20 @@ void JSONTest::testNumberElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); Var test = array->get(0); - assert(test.isInteger()); + assertTrue (test.isInteger()); int value = test; - assert(value == 1969); + assertTrue (value == 1969); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0] == 1969); + assertTrue (da.size() == 1); + assertTrue (da[0] == 1969); } @@ -964,27 +964,27 @@ void JSONTest::testStringElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); Var test = array->get(0); - assert(test.isString()); + assertTrue (test.isString()); std::string value = test.convert(); - assert(value.compare("value") == 0); + assertTrue (value.compare("value") == 0); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0] == "value"); + assertTrue (da.size() == 1); + assertTrue (da[0] == "value"); std::stringstream s; json = "[ \"\\u0017\" ]"; Var v = Parser().parse(json); Stringifier::condense(v, s); std::string ss = s.str(); - assert(s.str() == "[\"\\u0017\"]"); + assertTrue (s.str() == "[\"\\u0017\"]"); } @@ -1001,19 +1001,19 @@ void JSONTest::testEmptyObjectElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); Object::Ptr object = array->getObject(0); - assert(object->size() == 0); + assertTrue (object->size() == 0); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0].isStruct()); - assert (da[0].size() == 0); + assertTrue (da.size() == 1); + assertTrue (da[0].isStruct()); + assertTrue (da[0].size() == 0); } @@ -1030,20 +1030,20 @@ void JSONTest::testDoubleElement() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); Poco::JSON::Array::Ptr array = result.extract(); Var test = array->get(0); - assert(test.isNumeric()); + assertTrue (test.isNumeric()); double value = test; - assert(value == 1234.5); + assertTrue (value == 1234.5); Poco::Dynamic::Array da = *array; - assert (da.size() == 1); - assert (da[0] == 1234.5); + assertTrue (da.size() == 1); + assertTrue (da[0] == 1234.5); } @@ -1055,49 +1055,49 @@ void JSONTest::testSetArrayElement() Poco::JSON::Array::Ptr array = result.extract(); Poco::Dynamic::Array dynArray = *array; - assert(dynArray.size() == 0); + assertTrue (dynArray.size() == 0); // array[0] = 7 array->set(0, 7); - assert(array->size() == 1); - assert(array->getElement(0) == 7); + assertTrue (array->size() == 1); + assertTrue (array->getElement(0) == 7); dynArray = *array; - assert(dynArray.size() == 1); - assert(dynArray[0] == 7); + assertTrue (dynArray.size() == 1); + assertTrue (dynArray[0] == 7); // array[2] = "foo" array->set(2, std::string("foo")); - assert(array->size() == 3); - assert(array->getElement(0) == 7); - assert(array->isNull(1)); - assert(array->getElement(2) == "foo"); + assertTrue (array->size() == 3); + assertTrue (array->getElement(0) == 7); + assertTrue (array->isNull(1)); + assertTrue (array->getElement(2) == "foo"); dynArray = *array; - assert(dynArray.size() == 3); - assert(dynArray[0] == 7); - assert(dynArray[1].isEmpty()); - assert(dynArray[2] == "foo"); + assertTrue (dynArray.size() == 3); + assertTrue (dynArray[0] == 7); + assertTrue (dynArray[1].isEmpty()); + assertTrue (dynArray[2] == "foo"); // array[1] = 13 array->set(1, 13); - assert(array->size() == 3); - assert(array->getElement(0) == 7); - assert(array->getElement(1) == 13); - assert(array->getElement(2) == "foo"); + assertTrue (array->size() == 3); + assertTrue (array->getElement(0) == 7); + assertTrue (array->getElement(1) == 13); + assertTrue (array->getElement(2) == "foo"); #ifdef POCO_ENABLE_CPP11 dynArray = std::move(*array); - assert(dynArray.size() == 3); - assert(dynArray[0] == 7); - assert(dynArray[1] == 13); - assert(dynArray[2] == "foo"); + assertTrue (dynArray.size() == 3); + assertTrue (dynArray[0] == 7); + assertTrue (dynArray[1] == 13); + assertTrue (dynArray[2] == "foo"); #endif // POCO_ENABLE_CPP11 dynArray.clear(); - assert(dynArray.size() == 0); + assertTrue (dynArray.size() == 0); } @@ -1114,14 +1114,14 @@ void JSONTest::testOptValue() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); int n = object->optValue("test", 123); - assert(n == 123); + assertTrue (n == 123); } @@ -1138,61 +1138,61 @@ void JSONTest::testQuery() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Query query(result); std::string firstChild = query.findValue("children[0]", ""); - assert(firstChild.compare("Jonas") == 0); + assertTrue (firstChild.compare("Jonas") == 0); Poco::DynamicStruct ds = *result.extract(); - assert (ds["name"] == "Franky"); - assert (ds["children"].size() == 2); - assert (ds["children"][0] == "Jonas"); - assert (ds["children"][1] == "Ellen"); + assertTrue (ds["name"] == "Franky"); + assertTrue (ds["children"].size() == 2); + assertTrue (ds["children"][0] == "Jonas"); + assertTrue (ds["children"][1] == "Ellen"); Object::Ptr pAddress = query.findObject("address"); - assert (pAddress->getValue("street") == "A Street"); + assertTrue (pAddress->getValue("street") == "A Street"); pAddress = query.findObject("bad address"); - assert (pAddress.isNull()); + assertTrue (pAddress.isNull()); Object address; address.set("dummy", 123); query.findObject("bad address", address); - assert (!address.has("dummy")); + assertTrue (!address.has("dummy")); Object& rAddress = query.findObject("address", address); - assert (rAddress.getValue("number") == 123); + assertTrue (rAddress.getValue("number") == 123); Var badAddr = query.find("address.street.anotherObject"); - assert(badAddr.isEmpty()); + assertTrue (badAddr.isEmpty()); using Poco::JSON::Array; Array::Ptr pChildren = query.findArray("children"); - assert (pChildren->getElement(0) == "Jonas"); + assertTrue (pChildren->getElement(0) == "Jonas"); pChildren = query.findArray("no children"); - assert (pChildren.isNull()); + assertTrue (pChildren.isNull()); Array children; children.add("dummy"); query.findArray("no children", children); - assert (children.size() == 0); + assertTrue (children.size() == 0); Array& rChildren = query.findArray("children", children); - assert (rChildren.getElement(1) == "Ellen"); + assertTrue (rChildren.getElement(1) == "Ellen"); Object::Ptr pObj = new Poco::JSON::Object; pObj->set("Id", 22); Query queryPointer(pObj); Var idQueryPointer = queryPointer.find("Id"); - assert(22 == idQueryPointer); + assertTrue (22 == idQueryPointer); Query queryObj(*pObj); Var idQueryObj = queryObj.find("Id"); - assert (22 == idQueryObj); + assertTrue (22 == idQueryObj); Var bad = 1; try @@ -1231,15 +1231,15 @@ void JSONTest::testComment() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Query query(result); std::string firstChild = query.findValue("children[0]", ""); - assert(firstChild.compare("Jonas") == 0); + assertTrue (firstChild.compare("Jonas") == 0); } @@ -1251,13 +1251,13 @@ void JSONTest::testPrintHandler() PrintHandler::Ptr pHandler = new PrintHandler(ostr); parser.setHandler(pHandler); parser.parse(json); - assert (ostr.str() == "{\"name\":\"Homer\",\"age\":38,\"wife\":\"Marge\",\"age\":36,\"children\":[\"Bart\",\"Lisa\",\"Maggie\"]}"); + assertTrue (ostr.str() == "{\"name\":\"Homer\",\"age\":38,\"wife\":\"Marge\",\"age\":36,\"children\":[\"Bart\",\"Lisa\",\"Maggie\"]}"); pHandler->setIndent(1); ostr.str(""); parser.reset(); parser.parse(json); - assert (ostr.str() == "{\n" + assertTrue (ostr.str() == "{\n" " \"name\" : \"Homer\",\n" " \"age\" : 38,\n" " \"wife\" : \"Marge\",\n" @@ -1274,7 +1274,7 @@ void JSONTest::testPrintHandler() ostr.str(""); parser.reset(); parser.parse(json); - assert (ostr.str() == "{\n" + assertTrue (ostr.str() == "{\n" " \"name\" : \"Homer\",\n" " \"age\" : 38,\n" " \"wife\" : \"Marge\",\n" @@ -1291,7 +1291,7 @@ void JSONTest::testPrintHandler() ostr.str(""); parser.reset(); parser.parse(json); - assert (ostr.str() == "{\n" + assertTrue (ostr.str() == "{\n" " \"name\" : \"Homer\",\n" " \"age\" : 38,\n" " \"wife\" : \"Marge\",\n" @@ -1341,21 +1341,21 @@ void JSONTest::testPrintHandler() pHandler->setIndent(0); parser.reset(); parser.parse(json); - assert (json == ostr.str()); + assertTrue (json == ostr.str()); json="[[\"a\"],[\"b\"],[[\"c\"],[\"d\"]]]"; ostr.str(""); pHandler->setIndent(0); parser.reset(); parser.parse(json); - assert (json == ostr.str()); + assertTrue (json == ostr.str()); json="[{\"1\":\"one\",\"0\":[\"zero\",\"nil\"]}]"; ostr.str(""); pHandler->setIndent(0); parser.reset(); parser.parse(json); - assert (json == ostr.str()); + assertTrue (json == ostr.str()); } @@ -1365,23 +1365,23 @@ void JSONTest::testStringify() std::ostringstream os; Var i = 123; Stringifier::stringify(i, os); - assert(os.str() == "123"); + assertTrue (os.str() == "123"); os.str(""); Var f = 123.456; Stringifier::stringify(f, os); - assert(os.str() == "123.456"); + assertTrue (os.str() == "123.456"); os.str(""); Var s = "abcdef"; Stringifier::stringify(s, os); - assert(os.str() == "\"abcdef\""); + assertTrue (os.str() == "\"abcdef\""); os.str(""); DateTime dt; Var d = dt; Stringifier::stringify(d, os); - assert(os.str() == std::string("\"" + DateTimeFormatter::format(dt, Poco::DateTimeFormat::ISO8601_FORMAT) + "\"")); + assertTrue (os.str() == std::string("\"" + DateTimeFormatter::format(dt, Poco::DateTimeFormat::ISO8601_FORMAT) + "\"")); std::string str1 = "\r"; std::string str2 = "\n"; @@ -1391,9 +1391,9 @@ void JSONTest::testStringify() std::ostringstream oss1, oss2; Poco::JSON::Stringifier::stringify(obj1, oss1); Poco::JSON::Stringifier::stringify(obj2, oss2); - assert(oss1.str() == "{\"payload\":\"\\r\"}"); + assertTrue (oss1.str() == "{\"payload\":\"\\r\"}"); std::cout << "\"" << oss1.str() << "\"" << std::endl; - assert(oss2.str() == "{\"payload\":\"\\n\"}"); + assertTrue (oss2.str() == "{\"payload\":\"\\n\"}"); Object jObj(false); jObj.set("foo\\", 0); @@ -1407,7 +1407,7 @@ void JSONTest::testStringify() std::stringstream ss; jObj.stringify(ss); - assert(ss.str() == "{\"backspace\":\"bs\\b\",\"bar\\/\":0,\"baz\":0,\"foo\\\\\":0," + assertTrue (ss.str() == "{\"backspace\":\"bs\\b\",\"bar\\/\":0,\"baz\":0,\"foo\\\\\":0," "\"newline\":\"nl\\n\",\"q\\\"uote\\\"d\":0,\"tab\":\"tb\\t\"}"); std::string json = "{ \"Simpsons\" : { \"husband\" : { \"name\" : \"Homer\" , \"age\" : 38 }, \"wife\" : { \"name\" : \"Marge\", \"age\" : 36 }, " @@ -1423,10 +1423,10 @@ void JSONTest::testStringify() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); std::ostringstream ostr; Stringifier::condense(result, ostr); @@ -1449,11 +1449,11 @@ void JSONTest::testStringify() "\"age\":36,\"name\":\"Marge\"" "}}}"; - assert (ostr.str() == str); + assertTrue (ostr.str() == str); ostr.str(""); Stringifier::stringify(result, ostr); - assert (ostr.str() == str); + assertTrue (ostr.str() == str); ostr.str(""); Stringifier::stringify(result, ostr, 1); @@ -1479,7 +1479,7 @@ void JSONTest::testStringify() " }\n" " }\n" "}"; - assert (ostr.str() == str); + assertTrue (ostr.str() == str); ostr.str(""); Stringifier::stringify(result, ostr, 2); @@ -1505,7 +1505,7 @@ void JSONTest::testStringify() " }\n" " }\n" "}"; - assert (ostr.str() == str); + assertTrue (ostr.str() == str); ostr.str(""); Stringifier::stringify(result, ostr, 4); @@ -1531,7 +1531,7 @@ void JSONTest::testStringify() " }\n" " }\n" "}"; - assert (ostr.str() == str); + assertTrue (ostr.str() == str); } @@ -1543,16 +1543,16 @@ void JSONTest::testStringifyPreserveOrder() presObj.set("baz", 0); std::stringstream ss; presObj.stringify(ss); - assert(ss.str() == "{\"foo\":0,\"bar\":0,\"baz\":0}"); + assertTrue (ss.str() == "{\"foo\":0,\"bar\":0,\"baz\":0}"); Object::NameList nl = presObj.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); ss.str(""); Stringifier::stringify(presObj, ss); - assert(ss.str() == "{\"foo\":0,\"bar\":0,\"baz\":0}"); + assertTrue (ss.str() == "{\"foo\":0,\"bar\":0,\"baz\":0}"); Object noPresObj; noPresObj.set("foo", 0); @@ -1560,10 +1560,10 @@ void JSONTest::testStringifyPreserveOrder() noPresObj.set("baz", 0); ss.str(""); noPresObj.stringify(ss); - assert(ss.str() == "{\"bar\":0,\"baz\":0,\"foo\":0}"); + assertTrue (ss.str() == "{\"bar\":0,\"baz\":0,\"foo\":0}"); ss.str(""); Stringifier::stringify(noPresObj, ss); - assert(ss.str() == "{\"bar\":0,\"baz\":0,\"foo\":0}"); + assertTrue (ss.str() == "{\"bar\":0,\"baz\":0,\"foo\":0}"); std::string json = "{ \"Simpsons\" : { \"husband\" : { \"name\" : \"Homer\" , \"age\" : 38 }, \"wife\" : { \"name\" : \"Marge\", \"age\" : 36 }, " "\"children\" : [ \"Bart\", \"Lisa\", \"Maggie\" ], " @@ -1580,27 +1580,27 @@ void JSONTest::testStringifyPreserveOrder() catch(JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); std::ostringstream ostr; Stringifier::condense(result, ostr); std::cout << ostr.str() << std::endl; - assert (ostr.str() == "{\"Simpsons\":{\"husband\":{\"name\":\"Homer\",\"age\":38},\"wife\":{\"name\":\"Marge\",\"age\":36}," + assertTrue (ostr.str() == "{\"Simpsons\":{\"husband\":{\"name\":\"Homer\",\"age\":38},\"wife\":{\"name\":\"Marge\",\"age\":36}," "\"children\":[\"Bart\",\"Lisa\",\"Maggie\"]," "\"address\":{\"number\":742,\"street\":\"Evergreen Terrace\",\"town\":\"Springfield\"}}}"); ostr.str(""); Stringifier::stringify(result, ostr); - assert (ostr.str() == "{\"Simpsons\":{\"husband\":{\"name\":\"Homer\",\"age\":38},\"wife\":{\"name\":\"Marge\",\"age\":36}," + assertTrue (ostr.str() == "{\"Simpsons\":{\"husband\":{\"name\":\"Homer\",\"age\":38},\"wife\":{\"name\":\"Marge\",\"age\":36}," "\"children\":[\"Bart\",\"Lisa\",\"Maggie\"]," "\"address\":{\"number\":742,\"street\":\"Evergreen Terrace\",\"town\":\"Springfield\"}}}"); ostr.str(""); Stringifier::stringify(result, ostr, 1); - assert (ostr.str() == "{\n" + assertTrue (ostr.str() == "{\n" " \"Simpsons\" : {\n" " \"husband\" : {\n" " \"name\" : \"Homer\",\n" @@ -1625,7 +1625,7 @@ void JSONTest::testStringifyPreserveOrder() ostr.str(""); Stringifier::stringify(result, ostr, 2); - assert (ostr.str() == "{\n" + assertTrue (ostr.str() == "{\n" " \"Simpsons\" : {\n" " \"husband\" : {\n" " \"name\" : \"Homer\",\n" @@ -1650,7 +1650,7 @@ void JSONTest::testStringifyPreserveOrder() ostr.str(""); Stringifier::stringify(result, ostr, 4); - assert (ostr.str() == "{\n" + assertTrue (ostr.str() == "{\n" " \"Simpsons\" : {\n" " \"husband\" : {\n" " \"name\" : \"Homer\",\n" @@ -1674,24 +1674,24 @@ void JSONTest::testStringifyPreserveOrder() "}"); Poco::DynamicStruct ds = *result.extract(); - assert (ds["Simpsons"].isStruct()); - assert (ds["Simpsons"]["husband"].isStruct()); - assert (ds["Simpsons"]["husband"]["name"] == "Homer"); - assert (ds["Simpsons"]["husband"]["age"] == 38); + assertTrue (ds["Simpsons"].isStruct()); + assertTrue (ds["Simpsons"]["husband"].isStruct()); + assertTrue (ds["Simpsons"]["husband"]["name"] == "Homer"); + assertTrue (ds["Simpsons"]["husband"]["age"] == 38); - assert (ds["Simpsons"]["wife"].isStruct()); - assert (ds["Simpsons"]["wife"]["name"] == "Marge"); - assert (ds["Simpsons"]["wife"]["age"] == 36); + assertTrue (ds["Simpsons"]["wife"].isStruct()); + assertTrue (ds["Simpsons"]["wife"]["name"] == "Marge"); + assertTrue (ds["Simpsons"]["wife"]["age"] == 36); - assert (ds["Simpsons"]["children"].isArray()); - assert (ds["Simpsons"]["children"][0] == "Bart"); - assert (ds["Simpsons"]["children"][1] == "Lisa"); - assert (ds["Simpsons"]["children"][2] == "Maggie"); + assertTrue (ds["Simpsons"]["children"].isArray()); + assertTrue (ds["Simpsons"]["children"][0] == "Bart"); + assertTrue (ds["Simpsons"]["children"][1] == "Lisa"); + assertTrue (ds["Simpsons"]["children"][2] == "Maggie"); - assert (ds["Simpsons"]["address"].isStruct()); - assert (ds["Simpsons"]["address"]["number"] == 742); - assert (ds["Simpsons"]["address"]["street"] == "Evergreen Terrace"); - assert (ds["Simpsons"]["address"]["town"] == "Springfield"); + assertTrue (ds["Simpsons"]["address"].isStruct()); + assertTrue (ds["Simpsons"]["address"]["number"] == 742); + assertTrue (ds["Simpsons"]["address"]["street"] == "Evergreen Terrace"); + assertTrue (ds["Simpsons"]["address"]["town"] == "Springfield"); } @@ -1836,7 +1836,7 @@ void JSONTest::testTemplate() std::ostringstream ostr; tpl.render(data, ostr); std::cout << ostr.str(); - assert (ostr.str() == "Hello world! From Franky.\nYou're too old."); + assertTrue (ostr.str() == "Hello world! From Franky.\nYou're too old."); } @@ -1852,7 +1852,7 @@ void JSONTest::testUnicode() parser.parse(json); result = parser.asVar(); - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); Var test = object->get("test"); @@ -1863,7 +1863,7 @@ void JSONTest::testUnicode() std::string original; converter.convert(text, original); - assert(test.convert() == original); + assertTrue (test.convert() == original); parser.reset(); std::ostringstream os; @@ -1879,7 +1879,7 @@ void JSONTest::testUnicode() os.str(""); os << "[\"" << (char)0xC2 << (char)0x92 << "\"]"; result = parser.parse(os.str()); - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); parser.reset(); os.str(""); @@ -1895,7 +1895,7 @@ void JSONTest::testUnicode() os.str(""); os << "[\"" << (char)0xE2 << (char)0x82 << (char)0xAC << "\"]"; result = parser.parse(os.str()); - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); parser.reset(); os.str(""); @@ -1911,7 +1911,7 @@ void JSONTest::testUnicode() os.str(""); os << "[\"" << (char)0xF0 << (char)0xA4 << (char)0xAD << (char)0xAD << "\"]"; result = parser.parse(os.str()); - assert(result.type() == typeid(Poco::JSON::Array::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Array::Ptr)); } @@ -1932,7 +1932,7 @@ void JSONTest::testEscape0() std::stringstream ss; json->stringify(ss); - assert(ss.str().compare("{\"name\":\"B\\u0000b\"}") == 0); + assertTrue (ss.str().compare("{\"name\":\"B\\u0000b\"}") == 0); } @@ -1942,13 +1942,13 @@ void JSONTest::testNonEscapeUnicode() Poco::JSON::Parser parser(new Poco::JSON::ParseHandler()); Var result = parser.parse(chinese); - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); std::stringstream ss; object->stringify(ss); - assert(ss.str().compare("{\"name\":\"\xE4\xB8\xAD\"}") == 0); + assertTrue (ss.str().compare("{\"name\":\"\xE4\xB8\xAD\"}") == 0); const unsigned char utf8Chars[] = {'{', '"', 'n', 'a', 'm', 'e', '"', ':', '"', 'g', 0xC3, 0xBC, 'n', 't', 'e', 'r', '"', '}', 0}; @@ -1957,7 +1957,7 @@ void JSONTest::testNonEscapeUnicode() result = parser.parse(utf8Text); object = result.extract(); ss.str(""); object->stringify(ss); - assert (ss.str() == "{\"name\":\"g\xC3\xBCnter\"}"); + assertTrue (ss.str() == "{\"name\":\"g\xC3\xBCnter\"}"); Poco::JSON::Object obj1; std::string shortEscapeStr("String with \t"); @@ -1972,13 +1972,13 @@ void JSONTest::testNonEscapeUnicode() parser.parse(ss.str()); result = parser.asVar(); - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); object = result.extract(); Var shortEscape = object->get("shortEscape"); Var longEscape = object->get("longEscape"); - assert(shortEscape.convert() == shortEscapeStr); - assert(longEscape.convert() == longEscapeStr); + assertTrue (shortEscape.convert() == shortEscapeStr); + assertTrue (longEscape.convert() == longEscapeStr); } @@ -1989,14 +1989,14 @@ void JSONTest::testEscapeUnicode() Poco::JSON::Parser parser(new Poco::JSON::ParseHandler()); Var result = parser.parse(chinese); - assert(result.type() == typeid(Object::Ptr)); + assertTrue (result.type() == typeid(Object::Ptr)); Object::Ptr object = result.extract(); object->setEscapeUnicode(true); std::stringstream ss; object->stringify(ss, 0, -1); - assert(ss.str().compare("{\"name\":\"\\u4E2D\"}") == 0); + assertTrue (ss.str().compare("{\"name\":\"\\u4E2D\"}") == 0); const unsigned char utf8Chars[] = {'{', '"', 'n', 'a', 'm', 'e', '"', ':', '"', 'g', 0xC3, 0xBC, 'n', 't', 'e', 'r', '"', '}', 0}; @@ -2006,7 +2006,7 @@ void JSONTest::testEscapeUnicode() object = result.extract(); object->setEscapeUnicode(true); ss.str(""); object->stringify(ss, 0, -1); - assert (ss.str() == "{\"name\":\"g\\u00FCnter\"}"); + assertTrue (ss.str() == "{\"name\":\"g\\u00FCnter\"}"); } @@ -2047,50 +2047,50 @@ void JSONTest::testCopy() obj1.set("baz", 0); Object::NameList nl = obj1.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); Object obj2; obj2 = obj1; nl = obj2.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); Object obj3; obj3.set("foo", 0); obj3.set("bar", 0); obj3.set("baz", 0); nl = obj3.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "bar"); - assert (nl[1] == "baz"); - assert (nl[2] == "foo"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "bar"); + assertTrue (nl[1] == "baz"); + assertTrue (nl[2] == "foo"); Object obj4; obj4 = obj3; nl = obj4.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "bar"); - assert (nl[1] == "baz"); - assert (nl[2] == "foo"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "bar"); + assertTrue (nl[1] == "baz"); + assertTrue (nl[2] == "foo"); obj4 = obj1; nl = obj4.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); Object obj5(obj1); nl = obj5.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); } @@ -2103,59 +2103,59 @@ void JSONTest::testMove() obj1.set("baz", 0); Object::NameList nl = obj1.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); Object obj2; obj2 = std::move(obj1); - assert (obj1.getNames().size() == 0); + assertTrue (obj1.getNames().size() == 0); nl = obj2.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); Object obj3; obj3.set("foo", 0); obj3.set("bar", 0); obj3.set("baz", 0); nl = obj3.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "bar"); - assert (nl[1] == "baz"); - assert (nl[2] == "foo"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "bar"); + assertTrue (nl[1] == "baz"); + assertTrue (nl[2] == "foo"); Object obj4; obj4 = std::move(obj3); - assert (obj3.getNames().size() == 0); + assertTrue (obj3.getNames().size() == 0); nl = obj4.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "bar"); - assert (nl[1] == "baz"); - assert (nl[2] == "foo"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "bar"); + assertTrue (nl[1] == "baz"); + assertTrue (nl[2] == "foo"); Object obj5(Poco::JSON_PRESERVE_KEY_ORDER); obj5.set("foo", 0); obj5.set("bar", 0); obj5.set("baz", 0); nl = obj5.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); obj4 = std::move(obj5); - assert (obj5.getNames().size() == 0); + assertTrue (obj5.getNames().size() == 0); nl = obj4.getNames(); - assert (nl.size() == 3); - assert (nl[0] == "foo"); - assert (nl[1] == "bar"); - assert (nl[2] == "baz"); + assertTrue (nl.size() == 3); + assertTrue (nl[0] == "foo"); + assertTrue (nl[1] == "bar"); + assertTrue (nl[2] == "baz"); #endif // POCO_ENABLE_CPP11 } diff --git a/JSON/testsuite/src/JSONTest.h b/JSON/testsuite/src/JSONTest.h index 988bd1384..78b82d7e9 100644 --- a/JSON/testsuite/src/JSONTest.h +++ b/JSON/testsuite/src/JSONTest.h @@ -106,26 +106,26 @@ private: catch (Poco::JSON::JSONException& jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } - assert(result.type() == typeid(Poco::JSON::Object::Ptr)); + assertTrue (result.type() == typeid(Poco::JSON::Object::Ptr)); Poco::JSON::Object::Ptr object = result.extract(); Poco::Dynamic::Var test = object->get("test"); - assert(test.isNumeric()); + assertTrue (test.isNumeric()); T value = test; - assert(value == number); + assertTrue (value == number); Poco::DynamicStruct ds = *object; - assert(!ds["test"].isEmpty()); - assert(ds["test"].isNumeric()); - assert(ds["test"] == number); + assertTrue (!ds["test"].isEmpty()); + assertTrue (ds["test"].isNumeric()); + assertTrue (ds["test"] == number); const Poco::DynamicStruct& rds = *object; - assert(!rds["test"].isEmpty()); - assert(rds["test"].isNumeric()); - assert(rds["test"] == number); + assertTrue (!rds["test"].isEmpty()); + assertTrue (rds["test"].isNumeric()); + assertTrue (rds["test"] == number); } }; diff --git a/MongoDB/testsuite/src/MongoDBTest.cpp b/MongoDB/testsuite/src/MongoDBTest.cpp index ddb48041c..9105ea9dd 100644 --- a/MongoDB/testsuite/src/MongoDBTest.cpp +++ b/MongoDB/testsuite/src/MongoDBTest.cpp @@ -95,16 +95,16 @@ void MongoDBTest::testQueryRequest() try { std::string lastname = doc->get("lastname"); - assert(lastname.compare("Braem") == 0); + assertTrue (lastname.compare("Braem") == 0); std::string firstname = doc->get("firstname"); - assert(firstname.compare("Franky") == 0); + assertTrue (firstname.compare("Franky") == 0); Poco::Timestamp birthDateTimestamp = doc->get("birthdate"); Poco::DateTime birthDate(birthDateTimestamp); - assert(birthDate.year() == 1969 && birthDate.month() == 3 && birthDate.day() == 9); + assertTrue (birthDate.year() == 1969 && birthDate.month() == 3 && birthDate.day() == 9); Poco::Timestamp lastupdatedTimestamp = doc->get("lastupdated"); - assert(doc->isType("unknown")); + assertTrue (doc->isType("unknown")); bool active = doc->get("active"); - assert(!active); + assertTrue (!active); std::string id = doc->get("_id")->toString(); } @@ -136,14 +136,14 @@ void MongoDBTest::testDBQueryRequest() try { std::string lastname = doc->get("lastname"); - assert(lastname.compare("Braem") == 0); + assertTrue (lastname.compare("Braem") == 0); std::string firstname = doc->get("firstname"); - assert(firstname.compare("Franky") == 0); + assertTrue (firstname.compare("Franky") == 0); Poco::Timestamp birthDateTimestamp = doc->get("birthdate"); Poco::DateTime birthDate(birthDateTimestamp); - assert(birthDate.year() == 1969 && birthDate.month() == 3 && birthDate.day() == 9); + assertTrue (birthDate.year() == 1969 && birthDate.month() == 3 && birthDate.day() == 9); Poco::Timestamp lastupdatedTimestamp = doc->get("lastupdated"); - assert(doc->isType("unknown")); + assertTrue (doc->isType("unknown")); std::string id = doc->get("_id")->toString(); } @@ -172,7 +172,7 @@ void MongoDBTest::testCountCommand() if ( response.documents().size() > 0 ) { Poco::MongoDB::Document::Ptr doc = response.documents()[0]; - assert(doc->getInteger("n") == 1); + assertTrue (doc->getInteger("n") == 1); } else { @@ -192,7 +192,7 @@ void MongoDBTest::testDBCountCommand() if ( response.documents().size() > 0 ) { Poco::MongoDB::Document::Ptr doc = response.documents()[0]; - assert(doc->getInteger("n") == 1); + assertTrue (doc->getInteger("n") == 1); } else { @@ -205,7 +205,7 @@ void MongoDBTest::testDBCount2Command() { Poco::MongoDB::Database db("team"); Poco::Int64 count = db.count(*_mongo, "players"); - assert(count == 1); + assertTrue (count == 1); } @@ -235,7 +235,7 @@ void MongoDBTest::testCursorRequest() _mongo->sendRequest(*insertRequest); Poco::Int64 count = db.count(*_mongo, "numbers"); - assert(count == 10000); + assertTrue (count == 10000); Poco::MongoDB::Cursor cursor("team", "numbers"); @@ -248,7 +248,7 @@ void MongoDBTest::testCursorRequest() break; response = cursor.next(*_mongo); } - assert(n == 10000); + assertTrue (n == 10000); Poco::MongoDB::QueryRequest drop("team.$cmd"); drop.setNumberToReturn(1); @@ -313,7 +313,7 @@ void MongoDBTest::testConnectionPool() if ( response.documents().size() > 0 ) { Poco::MongoDB::Document::Ptr doc = response.documents()[0]; - assert(doc->getInteger("n") == 1); + assertTrue (doc->getInteger("n") == 1); } else { @@ -326,7 +326,7 @@ void MongoDBTest::testObjectID() { ObjectId oid("536aeebba081de6815000002"); std::string str2 = oid.toString(); - assert(str2 == "536aeebba081de6815000002"); + assertTrue (str2 == "536aeebba081de6815000002"); } @@ -380,10 +380,10 @@ void MongoDBTest::testUUID() try { std::string name = doc->get("name"); - assert(name.compare("Barcelona") == 0); + assertTrue (name.compare("Barcelona") == 0); Poco::MongoDB::Binary::Ptr uuidBinary = doc->get("uuid"); - assert(uuid == uuidBinary->uuid()); + assertTrue (uuid == uuidBinary->uuid()); } catch(Poco::NotFoundException& nfe) { diff --git a/Net/testsuite/src/DNSTest.cpp b/Net/testsuite/src/DNSTest.cpp index 24660b1b3..5d3c8d662 100644 --- a/Net/testsuite/src/DNSTest.cpp +++ b/Net/testsuite/src/DNSTest.cpp @@ -39,14 +39,14 @@ void DNSTest::testHostByName() { HostEntry he1 = DNS::hostByName("aliastest.pocoproject.org"); // different systems report different canonical names, unfortunately. - assert (he1.name() == "dnstest.pocoproject.org" || he1.name() == "aliastest.pocoproject.org"); + assertTrue (he1.name() == "dnstest.pocoproject.org" || he1.name() == "aliastest.pocoproject.org"); #if !defined(POCO_HAVE_ADDRINFO) // getaddrinfo() does not report any aliases - assert (!he1.aliases().empty()); - assert (he1.aliases()[0] == "aliastest.pocoproject.org"); + assertTrue (!he1.aliases().empty()); + assertTrue (he1.aliases()[0] == "aliastest.pocoproject.org"); #endif - assert (he1.addresses().size() >= 1); - assert (he1.addresses()[0].toString() == "1.2.3.4"); + assertTrue (he1.addresses().size() >= 1); + assertTrue (he1.addresses()[0].toString() == "1.2.3.4"); try { @@ -66,10 +66,10 @@ void DNSTest::testHostByAddress() { IPAddress ip1("80.122.195.86"); HostEntry he1 = DNS::hostByAddress(ip1); - assert (he1.name() == "mailhost.appinf.com"); - assert (he1.aliases().empty()); - assert (he1.addresses().size() >= 1); - assert (he1.addresses()[0].toString() == "80.122.195.86"); + assertTrue (he1.name() == "mailhost.appinf.com"); + assertTrue (he1.aliases().empty()); + assertTrue (he1.addresses().size() >= 1); + assertTrue (he1.addresses()[0].toString() == "80.122.195.86"); IPAddress ip2("10.0.244.253"); try @@ -94,88 +94,88 @@ void DNSTest::testResolve() void DNSTest::testEncodeIDN() { std::string idn("d\xc3\xb6m\xc3\xa4in.example"); // d"om"ain.example - assert (DNS::isIDN(idn)); - assert (DNS::encodeIDN(idn) == "xn--dmin-moa0i.example"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--dmin-moa0i.example"); idn = ".d\xc3\xb6m\xc3\xa4in.example"; // .d"om"ain.example - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == ".xn--dmin-moa0i.example"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == ".xn--dmin-moa0i.example"); idn = "d\xc3\xb6m\xc3\xa4in.example."; // .d"om"ain.example. - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "xn--dmin-moa0i.example."); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--dmin-moa0i.example."); idn = "d\xc3\xb6m\xc3\xa4in"; // d"om"ain - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "xn--dmin-moa0i"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--dmin-moa0i"); idn = "\xc3\xa4""aaa.example"; // "aaaa.example - assert (DNS::isIDN(idn)); - assert (DNS::encodeIDN(idn) == "xn--aaa-pla.example"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--aaa-pla.example"); idn = "a\xc3\xa4""aa.example"; // a"aaa.example - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "xn--aaa-qla.example"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--aaa-qla.example"); idn = "foo.\xc3\xa2""bcd\xc3\xa9""f.example"; // foo.^abcd'ef.example - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "foo.xn--bcdf-9na9b.example"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "foo.xn--bcdf-9na9b.example"); idn = "\xe2\x98\x83.example"; // .example - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "xn--n3h.example"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--n3h.example"); idn = "\xe2\x98\x83."; // . - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "xn--n3h."); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--n3h."); idn = "\xe2\x98\x83"; // - assert(DNS::isIDN(idn)); - assert(DNS::encodeIDN(idn) == "xn--n3h"); + assertTrue (DNS::isIDN(idn)); + assertTrue (DNS::encodeIDN(idn) == "xn--n3h"); std::string dn = "www.pocoproject.org"; - assert (!DNS::isIDN(dn)); - assert (DNS::encodeIDN(dn) == "www.pocoproject.org"); + assertTrue (!DNS::isIDN(dn)); + assertTrue (DNS::encodeIDN(dn) == "www.pocoproject.org"); } void DNSTest::testDecodeIDN() { std::string enc("xn--dmin-moa0i.example"); - assert (DNS::isEncodedIDN(enc)); - assert (DNS::decodeIDN(enc) == "d\xc3\xb6m\xc3\xa4in.example"); // d"om"ain.example + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "d\xc3\xb6m\xc3\xa4in.example"); // d"om"ain.example enc = ".xn--dmin-moa0i.example"; - assert(DNS::isEncodedIDN(enc)); - assert(DNS::decodeIDN(enc) == ".d\xc3\xb6m\xc3\xa4in.example"); // .d"om"ain.example + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == ".d\xc3\xb6m\xc3\xa4in.example"); // .d"om"ain.example enc = "xn--dmin-moa0i.example."; - assert(DNS::isEncodedIDN(enc)); - assert(DNS::decodeIDN(enc) == "d\xc3\xb6m\xc3\xa4in.example."); // d"om"ain.example. + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "d\xc3\xb6m\xc3\xa4in.example."); // d"om"ain.example. enc = "xn--dmin-moa0i"; - assert(DNS::isEncodedIDN(enc)); - assert(DNS::decodeIDN(enc) == "d\xc3\xb6m\xc3\xa4in"); // d"om"ain + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "d\xc3\xb6m\xc3\xa4in"); // d"om"ain enc = "foo.xn--bcdf-9na9b.example"; - assert (DNS::isEncodedIDN(enc)); - assert (DNS::decodeIDN(enc) == "foo.\xc3\xa2""bcd\xc3\xa9""f.example"); // foo.^abcd'ef.example + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "foo.\xc3\xa2""bcd\xc3\xa9""f.example"); // foo.^abcd'ef.example enc = "xn--n3h.example"; - assert (DNS::isEncodedIDN(enc)); - assert (DNS::decodeIDN(enc) == "\xe2\x98\x83.example"); // .example + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "\xe2\x98\x83.example"); // .example enc = "xn--n3h."; - assert(DNS::isEncodedIDN(enc)); - assert(DNS::decodeIDN(enc) == "\xe2\x98\x83."); // . + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "\xe2\x98\x83."); // . enc = "xn--n3h"; - assert(DNS::isEncodedIDN(enc)); - assert(DNS::decodeIDN(enc) == "\xe2\x98\x83"); // + assertTrue (DNS::isEncodedIDN(enc)); + assertTrue (DNS::decodeIDN(enc) == "\xe2\x98\x83"); // std::string dn = "www.pocoproject.org"; - assert (!DNS::isEncodedIDN(dn)); - assert (DNS::decodeIDN(dn) == "www.pocoproject.org"); + assertTrue (!DNS::isEncodedIDN(dn)); + assertTrue (DNS::decodeIDN(dn) == "www.pocoproject.org"); } diff --git a/Net/testsuite/src/DatagramSocketTest.cpp b/Net/testsuite/src/DatagramSocketTest.cpp index 6d76ef57a..9821d29ef 100644 --- a/Net/testsuite/src/DatagramSocketTest.cpp +++ b/Net/testsuite/src/DatagramSocketTest.cpp @@ -51,10 +51,10 @@ void DatagramSocketTest::testEcho() char buffer[256]; ss.connect(SocketAddress("127.0.0.1", echoServer.port())); int n = ss.sendBytes("hello", 5); - assert (n == 5); + assertTrue (n == 5); n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -64,14 +64,14 @@ void DatagramSocketTest::testSendToReceiveFrom() UDPEchoServer echoServer(SocketAddress("127.0.0.1", 0)); DatagramSocket ss(SocketAddress::IPv4); int n = ss.sendTo("hello", 5, SocketAddress("127.0.0.1", echoServer.port())); - assert (n == 5); + assertTrue (n == 5); char buffer[256]; SocketAddress sa; n = ss.receiveFrom(buffer, sizeof(buffer), sa); - assert (sa.host() == echoServer.address().host()); - assert (sa.port() == echoServer.port()); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (sa.host() == echoServer.address().host()); + assertTrue (sa.port() == echoServer.port()); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -83,10 +83,10 @@ void DatagramSocketTest::testUnbound() char buffer[256]; ss.connect(SocketAddress("127.0.0.1", echoServer.port())); int n = ss.sendBytes("hello", 5); - assert (n == 5); + assertTrue (n == 5); n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -120,15 +120,15 @@ void DatagramSocketTest::testBroadcast() poco_socklen_t len = sizeof(opt); ss.impl()->setRawOption(IPPROTO_IP, IP_ONESBCAST, (const char*) &opt, len); ss.impl()->getRawOption(IPPROTO_IP, IP_ONESBCAST, &opt, len); - assert (opt == 1); + assertTrue (opt == 1); #endif int n = ss.sendTo("hello", 5, sa); - assert (n == 5); + assertTrue (n == 5); char buffer[256] = { 0 }; n = ss.receiveBytes(buffer, 5); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } diff --git a/Net/testsuite/src/DialogSocketTest.cpp b/Net/testsuite/src/DialogSocketTest.cpp index e38f11dec..2b6a5538c 100644 --- a/Net/testsuite/src/DialogSocketTest.cpp +++ b/Net/testsuite/src/DialogSocketTest.cpp @@ -40,53 +40,53 @@ void DialogSocketTest::testDialogSocket() ds.sendMessage("Hello, world!"); std::string str; ds.receiveMessage(str); - assert (str == "Hello, world!"); + assertTrue (str == "Hello, world!"); ds.sendString("Hello, World!\n"); ds.receiveMessage(str); - assert (str == "Hello, World!"); + assertTrue (str == "Hello, World!"); ds.sendMessage("EHLO", "appinf.com"); ds.receiveMessage(str); - assert (str == "EHLO appinf.com"); + assertTrue (str == "EHLO appinf.com"); ds.sendMessage("PUT", "local.txt", "remote.txt"); ds.receiveMessage(str); - assert (str == "PUT local.txt remote.txt"); + assertTrue (str == "PUT local.txt remote.txt"); ds.sendMessage("220 Hello, world!"); int status = ds.receiveStatusMessage(str); - assert (status == 220); - assert (str == "220 Hello, world!"); + assertTrue (status == 220); + assertTrue (str == "220 Hello, world!"); ds.sendString("220-line1\r\n220 line2\r\n"); status = ds.receiveStatusMessage(str); - assert (status == 220); - assert (str == "220-line1\n220 line2"); + assertTrue (status == 220); + assertTrue (str == "220-line1\n220 line2"); ds.sendString("220-line1\r\nline2\r\n220 line3\r\n"); status = ds.receiveStatusMessage(str); - assert (status == 220); - assert (str == "220-line1\nline2\n220 line3"); + assertTrue (status == 220); + assertTrue (str == "220-line1\nline2\n220 line3"); ds.sendMessage("Hello, world!"); status = ds.receiveStatusMessage(str); - assert (status == 0); - assert (str == "Hello, world!"); + assertTrue (status == 0); + assertTrue (str == "Hello, world!"); ds.sendString("Header\nMore Bytes"); status = ds.receiveStatusMessage(str); - assert (status == 0); - assert (str == "Header"); + assertTrue (status == 0); + assertTrue (str == "Header"); char buffer[16]; int n = ds.receiveRawBytes(buffer, sizeof(buffer)); - assert (n == 10); - assert (std::memcmp(buffer, "More Bytes", 10) == 0); + assertTrue (n == 10); + assertTrue (std::memcmp(buffer, "More Bytes", 10) == 0); ds.sendString("Even More Bytes"); n = ds.receiveRawBytes(buffer, sizeof(buffer)); - assert (n == 15); - assert (std::memcmp(buffer, "Even More Bytes", 15) == 0); + assertTrue (n == 15); + assertTrue (std::memcmp(buffer, "Even More Bytes", 15) == 0); } diff --git a/Net/testsuite/src/FTPClientSessionTest.cpp b/Net/testsuite/src/FTPClientSessionTest.cpp index ee889189f..ba804bd24 100644 --- a/Net/testsuite/src/FTPClientSessionTest.cpp +++ b/Net/testsuite/src/FTPClientSessionTest.cpp @@ -78,13 +78,13 @@ void FTPClientSessionTest::login(DialogServer& server, FTPClientSession& session server.addResponse("200 Type set to I"); session.login("user", "password"); std::string cmd = server.popCommand(); - assert (cmd == "USER user"); + assertTrue (cmd == "USER user"); cmd = server.popCommand(); - assert (cmd == "PASS password"); + assertTrue (cmd == "PASS password"); cmd = server.popCommand(); - assert (cmd == "TYPE I"); + assertTrue (cmd == "TYPE I"); - assert (session.getFileType() == FTPClientSession::TYPE_BINARY); + assertTrue (session.getFileType() == FTPClientSession::TYPE_BINARY); } @@ -93,25 +93,25 @@ void FTPClientSessionTest::testLogin1() DialogServer server; server.addResponse("220 localhost FTP ready"); FTPClientSession session("127.0.0.1", server.port()); - assert (session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (session.isOpen()); + assertTrue (!session.isLoggedIn()); login(server, session); - assert (session.isOpen()); - assert (session.isLoggedIn()); + assertTrue (session.isOpen()); + assertTrue (session.isLoggedIn()); server.addResponse("221 Good Bye"); session.logout(); - assert (session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (session.isOpen()); + assertTrue (!session.isLoggedIn()); server.clearCommands(); server.clearResponses(); login(server, session); - assert (session.isOpen()); - assert (session.isLoggedIn()); + assertTrue (session.isOpen()); + assertTrue (session.isLoggedIn()); server.addResponse("221 Good Bye"); session.close(); - assert (!session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (!session.isOpen()); + assertTrue (!session.isLoggedIn()); } @@ -124,12 +124,12 @@ void FTPClientSessionTest::testLogin2() server.addResponse("200 Type set to I"); Poco::UInt16 serverPort = server.port(); FTPClientSession session("127.0.0.1", serverPort, "user", "password"); - assert (session.isOpen()); - assert (session.isLoggedIn()); + assertTrue (session.isOpen()); + assertTrue (session.isLoggedIn()); server.addResponse("221 Good Bye"); session.close(); - assert (!session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (!session.isOpen()); + assertTrue (!session.isLoggedIn()); server.clearCommands(); server.clearResponses(); @@ -138,12 +138,12 @@ void FTPClientSessionTest::testLogin2() server.addResponse("230 Welcome"); server.addResponse("200 Type set to I"); session.open("127.0.0.1", serverPort, "user", "password"); - assert (session.isOpen()); - assert (session.isLoggedIn()); + assertTrue (session.isOpen()); + assertTrue (session.isLoggedIn()); server.addResponse("221 Good Bye"); session.close(); - assert (!session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (!session.isOpen()); + assertTrue (!session.isLoggedIn()); } @@ -155,13 +155,13 @@ void FTPClientSessionTest::testLogin3() server.addResponse("230 Welcome"); server.addResponse("200 Type set to I"); FTPClientSession session; - assert (!session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (!session.isOpen()); + assertTrue (!session.isLoggedIn()); session.open("127.0.0.1", server.port(), "user", "password"); server.addResponse("221 Good Bye"); session.close(); - assert (!session.isOpen()); - assert (!session.isLoggedIn()); + assertTrue (!session.isOpen()); + assertTrue (!session.isLoggedIn()); } @@ -214,53 +214,53 @@ void FTPClientSessionTest::testCommands() FTPClientSession session("127.0.0.1", server.port()); session.login("user", "password"); std::string cmd = server.popCommand(); - assert (cmd == "USER user"); + assertTrue (cmd == "USER user"); cmd = server.popCommand(); - assert (cmd == "PASS password"); + assertTrue (cmd == "PASS password"); cmd = server.popCommand(); - assert (cmd == "TYPE I"); + assertTrue (cmd == "TYPE I"); // systemType server.clearCommands(); server.addResponse("215 UNIX Type: L8 Version: dummyFTP 1.0"); std::string type = session.systemType(); cmd = server.popCommand(); - assert (cmd == "SYST"); - assert (type == "UNIX Type: L8 Version: dummyFTP 1.0"); + assertTrue (cmd == "SYST"); + assertTrue (type == "UNIX Type: L8 Version: dummyFTP 1.0"); // getWorkingDirectory server.addResponse("257 \"/usr/test\" is current directory"); std::string cwd = session.getWorkingDirectory(); cmd = server.popCommand(); - assert (cmd == "PWD"); - assert (cwd == "/usr/test"); + assertTrue (cmd == "PWD"); + assertTrue (cwd == "/usr/test"); // getWorkingDirectory (quotes in filename) server.addResponse("257 \"\"\"quote\"\"\" is current directory"); cwd = session.getWorkingDirectory(); cmd = server.popCommand(); - assert (cmd == "PWD"); - assert (cwd == "\"quote\""); + assertTrue (cmd == "PWD"); + assertTrue (cwd == "\"quote\""); // setWorkingDirectory server.addResponse("250 CWD OK"); session.setWorkingDirectory("test"); cmd = server.popCommand(); - assert (cmd == "CWD test"); + assertTrue (cmd == "CWD test"); server.addResponse("250 CDUP OK"); session.cdup(); cmd = server.popCommand(); - assert (cmd == "CDUP"); + assertTrue (cmd == "CDUP"); // rename server.addResponse("350 File exists, send destination name"); server.addResponse("250 Rename OK"); session.rename("old.txt", "new.txt"); cmd = server.popCommand(); - assert (cmd == "RNFR old.txt"); + assertTrue (cmd == "RNFR old.txt"); cmd = server.popCommand(); - assert (cmd == "RNTO new.txt"); + assertTrue (cmd == "RNTO new.txt"); // rename (failing) server.addResponse("550 not found"); @@ -278,7 +278,7 @@ void FTPClientSessionTest::testCommands() server.addResponse("250 delete ok"); session.remove("test.txt"); cmd = server.popCommand(); - assert (cmd == "DELE test.txt"); + assertTrue (cmd == "DELE test.txt"); // remove (failing) server.addResponse("550 not found"); @@ -296,7 +296,7 @@ void FTPClientSessionTest::testCommands() server.addResponse("257 dir created"); session.createDirectory("foo"); cmd = server.popCommand(); - assert (cmd == "MKD foo"); + assertTrue (cmd == "MKD foo"); // createDirectory (failing) server.addResponse("550 exists"); @@ -314,7 +314,7 @@ void FTPClientSessionTest::testCommands() server.addResponse("250 RMD OK"); session.removeDirectory("foo"); cmd = server.popCommand(); - assert (cmd == "RMD foo"); + assertTrue (cmd == "RMD foo"); // removeDirectory (failing) server.addResponse("550 not found"); @@ -353,10 +353,10 @@ void FTPClientSessionTest::testDownloadPORT() ActiveResult result = dl.download("test.txt"); std::string cmd = server.popCommandWait(); - assert (cmd.substr(0, 4) == "EPRT"); + assertTrue (cmd.substr(0, 4) == "EPRT"); cmd = server.popCommandWait(); - assert (cmd.substr(0, 4) == "PORT"); + assertTrue (cmd.substr(0, 4) == "PORT"); std::string dummy; int x, lo, hi; @@ -369,7 +369,7 @@ void FTPClientSessionTest::testDownloadPORT() int port = hi*256 + lo; cmd = server.popCommandWait(); - assert (cmd == "RETR test.txt"); + assertTrue (cmd == "RETR test.txt"); SocketAddress sa("127.0.0.1", (Poco::UInt16) port); DialogSocket dataSock; @@ -381,7 +381,7 @@ void FTPClientSessionTest::testDownloadPORT() result.wait(); std::string received = result.data(); - assert (received == data); + assertTrue (received == data); server.addResponse("221 Good Bye"); session.close(); @@ -407,7 +407,7 @@ void FTPClientSessionTest::testDownloadEPRT() ActiveResult result = dl.download("test.txt"); std::string cmd = server.popCommandWait(); - assert (cmd.substr(0, 4) == "EPRT"); + assertTrue (cmd.substr(0, 4) == "EPRT"); std::string dummy; char c; @@ -417,7 +417,7 @@ void FTPClientSessionTest::testDownloadEPRT() istr >> dummy >> c >> d >> c >> d >> c >> d >> c >> d >> c >> d >> c >> port >> c; cmd = server.popCommandWait(); - assert (cmd == "RETR test.txt"); + assertTrue (cmd == "RETR test.txt"); SocketAddress sa("127.0.0.1", (Poco::UInt16) port); DialogSocket dataSock; @@ -429,7 +429,7 @@ void FTPClientSessionTest::testDownloadEPRT() result.wait(); std::string received = result.data(); - assert (received == data); + assertTrue (received == data); server.addResponse("221 Good Bye"); session.close(); @@ -462,7 +462,7 @@ void FTPClientSessionTest::testDownloadPASV() StreamCopier::copyStream(istr, dataStr); session.endDownload(); std::string s(dataStr.str()); - assert (s == "This is some data\r\n"); + assertTrue (s == "This is some data\r\n"); server.addResponse("221 Good Bye"); session.close(); @@ -492,12 +492,12 @@ void FTPClientSessionTest::testDownloadEPSV() StreamCopier::copyStream(istr, dataStr); session.endDownload(); std::string s(dataStr.str()); - assert (s == "This is some data\r\n"); + assertTrue (s == "This is some data\r\n"); std::string cmd = server.popCommand(); - assert (cmd.substr(0, 4) == "EPSV"); + assertTrue (cmd.substr(0, 4) == "EPSV"); cmd = server.popCommand(); - assert (cmd == "RETR test.txt"); + assertTrue (cmd == "RETR test.txt"); server.addResponse("221 Good Bye"); session.close(); @@ -525,12 +525,12 @@ void FTPClientSessionTest::testUpload() ostr << "This is some data\r\n"; session.endUpload(); std::string s(dataServer.popCommandWait()); - assert (s == "This is some data"); + assertTrue (s == "This is some data"); std::string cmd = server.popCommand(); - assert (cmd.substr(0, 4) == "EPSV"); + assertTrue (cmd.substr(0, 4) == "EPSV"); cmd = server.popCommand(); - assert (cmd == "STOR test.txt"); + assertTrue (cmd == "STOR test.txt"); server.addResponse("221 Good Bye"); session.close(); @@ -560,12 +560,12 @@ void FTPClientSessionTest::testList() StreamCopier::copyStream(istr, dataStr); session.endList(); std::string s(dataStr.str()); - assert (s == "file1\r\nfile2\r\n"); + assertTrue (s == "file1\r\nfile2\r\n"); std::string cmd = server.popCommand(); - assert (cmd.substr(0, 4) == "EPSV"); + assertTrue (cmd.substr(0, 4) == "EPSV"); cmd = server.popCommand(); - assert (cmd == "NLST"); + assertTrue (cmd == "NLST"); server.addResponse("221 Good Bye"); session.close(); diff --git a/Net/testsuite/src/FTPStreamFactoryTest.cpp b/Net/testsuite/src/FTPStreamFactoryTest.cpp index d315dafcb..2d8b08119 100644 --- a/Net/testsuite/src/FTPStreamFactoryTest.cpp +++ b/Net/testsuite/src/FTPStreamFactoryTest.cpp @@ -90,7 +90,7 @@ void FTPStreamFactoryTest::testDownload() pStr.reset(); std::string s(dataStr.str()); - assert (s == "line1\r\nline2\r\n"); + assertTrue (s == "line1\r\nline2\r\n"); } @@ -132,7 +132,7 @@ void FTPStreamFactoryTest::testList() pStr.reset(); std::string s(dataStr.str()); - assert (s == "file1\r\nfile2\r\n"); + assertTrue (s == "file1\r\nfile2\r\n"); } @@ -174,7 +174,7 @@ void FTPStreamFactoryTest::testUserInfo() pStr.reset(); std::string s(dataStr.str()); - assert (s == "line1\r\nline2\r\n"); + assertTrue (s == "line1\r\nline2\r\n"); } @@ -217,7 +217,7 @@ void FTPStreamFactoryTest::testPasswordProvider() pStr.reset(); std::string s(dataStr.str()); - assert (s == "line1\r\nline2\r\n"); + assertTrue (s == "line1\r\nline2\r\n"); } diff --git a/Net/testsuite/src/HTMLFormTest.cpp b/Net/testsuite/src/HTMLFormTest.cpp index d77a3f94c..5aab59478 100644 --- a/Net/testsuite/src/HTMLFormTest.cpp +++ b/Net/testsuite/src/HTMLFormTest.cpp @@ -95,7 +95,7 @@ void HTMLFormTest::testWriteUrl() std::ostringstream ostr; form.write(ostr); std::string s = ostr.str(); - assert (s == "field1=value1&field2=value%202&field3=value%3D3&field4=value%264&field5=value%2B5"); + assertTrue (s == "field1=value1&field2=value%202&field3=value%3D3&field4=value%264&field5=value%2B5"); } @@ -115,7 +115,7 @@ void HTMLFormTest::testWriteMultipart() std::ostringstream ostr; form.write(ostr, "MIME_boundary_0123456789"); std::string s = ostr.str(); - assert (s == + assertTrue (s == "--MIME_boundary_0123456789\r\n" "Content-Disposition: form-data; name=\"field1\"\r\n" "\r\n" @@ -145,7 +145,7 @@ void HTMLFormTest::testWriteMultipart() "This is another attachment\r\n" "--MIME_boundary_0123456789--\r\n" ); - assert(s.length() == form.calculateContentLength()); + assertTrue (s.length() == form.calculateContentLength()); } @@ -153,11 +153,11 @@ void HTMLFormTest::testReadUrlGET() { HTTPRequest req("GET", "/form.cgi?field1=value1&field2=value%202&field3=value%3D3&field4=value%264"); HTMLForm form(req); - assert (form.size() == 4); - assert (form["field1"] == "value1"); - assert (form["field2"] == "value 2"); - assert (form["field3"] == "value=3"); - assert (form["field4"] == "value&4"); + assertTrue (form.size() == 4); + assertTrue (form["field1"] == "value1"); + assertTrue (form["field2"] == "value 2"); + assertTrue (form["field3"] == "value=3"); + assertTrue (form["field4"] == "value&4"); } @@ -165,22 +165,22 @@ void HTMLFormTest::testReadUrlGETMultiple() { HTTPRequest req("GET", "/form.cgi?field1=value1&field1=value%202&field1=value%3D3&field1=value%264"); HTMLForm form(req); - assert (form.size() == 4); + assertTrue (form.size() == 4); HTMLForm::ConstIterator it = form.find("field1"); - assert (it != form.end()); - assert (it->first == "field1" && it->second == "value1"); + assertTrue (it != form.end()); + assertTrue (it->first == "field1" && it->second == "value1"); ++it; - assert (it != form.end()); - assert (it->first == "field1" && it->second == "value 2"); + assertTrue (it != form.end()); + assertTrue (it->first == "field1" && it->second == "value 2"); ++it; - assert (it != form.end()); - assert (it->first == "field1" && it->second == "value=3"); + assertTrue (it != form.end()); + assertTrue (it->first == "field1" && it->second == "value=3"); ++it; - assert (it != form.end()); - assert (it->first == "field1" && it->second == "value&4"); + assertTrue (it != form.end()); + assertTrue (it->first == "field1" && it->second == "value&4"); ++it; - assert (it == form.end()); + assertTrue (it == form.end()); } @@ -189,12 +189,12 @@ void HTMLFormTest::testReadUrlPOST() HTTPRequest req("POST", "/form.cgi?field0=value0"); std::istringstream istr("field1=value1&field2=value%202&field3=value%3D3&field4=value%264"); HTMLForm form(req, istr); - assert (form.size() == 5); - assert (form["field0"] == "value0"); - assert (form["field1"] == "value1"); - assert (form["field2"] == "value 2"); - assert (form["field3"] == "value=3"); - assert (form["field4"] == "value&4"); + assertTrue (form.size() == 5); + assertTrue (form["field0"] == "value0"); + assertTrue (form["field1"] == "value1"); + assertTrue (form["field2"] == "value 2"); + assertTrue (form["field3"] == "value=3"); + assertTrue (form["field4"] == "value&4"); } @@ -203,12 +203,12 @@ void HTMLFormTest::testReadUrlPUT() HTTPRequest req("PUT", "/form.cgi?field0=value0"); std::istringstream istr("field1=value1&field2=value%202&field3=value%3D3&field4=value%264"); HTMLForm form(req, istr); - assert (form.size() == 5); - assert (form["field0"] == "value0"); - assert (form["field1"] == "value1"); - assert (form["field2"] == "value 2"); - assert (form["field3"] == "value=3"); - assert (form["field4"] == "value&4"); + assertTrue (form.size() == 5); + assertTrue (form["field0"] == "value0"); + assertTrue (form["field1"] == "value1"); + assertTrue (form["field2"] == "value 2"); + assertTrue (form["field3"] == "value=3"); + assertTrue (form["field4"] == "value&4"); } @@ -217,12 +217,12 @@ void HTMLFormTest::testReadUrlBOM() HTTPRequest req("PUT", "/form.cgi?field0=value0"); std::istringstream istr("\357\273\277field1=value1&field2=value%202&field3=value%3D3&field4=value%264"); HTMLForm form(req, istr); - assert (form.size() == 5); - assert (form["field0"] == "value0"); - assert (form["field1"] == "value1"); - assert (form["field2"] == "value 2"); - assert (form["field3"] == "value=3"); - assert (form["field4"] == "value&4"); + assertTrue (form.size() == 5); + assertTrue (form["field0"] == "value0"); + assertTrue (form["field1"] == "value1"); + assertTrue (form["field2"] == "value 2"); + assertTrue (form["field3"] == "value=3"); + assertTrue (form["field4"] == "value&4"); } @@ -257,15 +257,15 @@ void HTMLFormTest::testReadMultipart() req.setContentType(HTMLForm::ENCODING_MULTIPART + "; boundary=\"MIME_boundary_0123456789\""); StringPartHandler sah; HTMLForm form(req, istr, sah); - assert (form.size() == 4); - assert (form["field1"] == "value1"); - assert (form["field2"] == "value 2"); - assert (form["field3"] == "value=3"); - assert (form["field4"] == "value&4"); + assertTrue (form.size() == 4); + assertTrue (form["field1"] == "value1"); + assertTrue (form["field2"] == "value 2"); + assertTrue (form["field3"] == "value=3"); + assertTrue (form["field4"] == "value&4"); - assert (sah.type() == "text/plain"); - assert (sah.disp() == "file; name=\"attachment1\"; filename=\"att1.txt\""); - assert (sah.data() == "This is an attachment"); + assertTrue (sah.type() == "text/plain"); + assertTrue (sah.disp() == "file; name=\"attachment1\"; filename=\"att1.txt\""); + assertTrue (sah.data() == "This is an attachment"); } @@ -279,7 +279,7 @@ void HTMLFormTest::testSubmit1() HTTPRequest req("GET", "/form.cgi"); form.prepareSubmit(req); - assert (req.getURI() == "/form.cgi?field1=value1&field2=value%202&field3=value%3D3&field4=value%264"); + assertTrue (req.getURI() == "/form.cgi?field1=value1&field2=value%202&field3=value%3D3&field4=value%264"); } @@ -293,7 +293,7 @@ void HTMLFormTest::testSubmit2() HTTPRequest req("POST", "/form.cgi"); form.prepareSubmit(req); - assert (req.getContentType() == HTMLForm::ENCODING_URL); + assertTrue (req.getContentType() == HTMLForm::ENCODING_URL); } @@ -311,8 +311,8 @@ void HTMLFormTest::testSubmit3() expCT.append("; boundary=\""); expCT.append(form.boundary()); expCT.append("\""); - assert (req.getContentType() == expCT); - assert (req.getChunkedTransferEncoding()); + assertTrue (req.getContentType() == expCT); + assertTrue (req.getChunkedTransferEncoding()); } @@ -327,7 +327,7 @@ void HTMLFormTest::testSubmit4() HTTPRequest req("GET", "/form.cgi"); form.prepareSubmit(req); - assert (req.getURI() == "/form.cgi?field1=value1&field1=value%202&field1=value%3D3&field1=value%264"); + assertTrue (req.getURI() == "/form.cgi?field1=value1&field1=value%202&field1=value%3D3&field1=value%264"); } diff --git a/Net/testsuite/src/HTTPClientSessionTest.cpp b/Net/testsuite/src/HTTPClientSessionTest.cpp index b591b904a..fa178e959 100644 --- a/Net/testsuite/src/HTTPClientSessionTest.cpp +++ b/Net/testsuite/src/HTTPClientSessionTest.cpp @@ -46,11 +46,11 @@ void HTTPClientSessionTest::testGetSmall() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::SMALL_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPTestServer::SMALL_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPTestServer::SMALL_BODY); } @@ -62,11 +62,11 @@ void HTTPClientSessionTest::testGetLarge() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); } @@ -78,10 +78,10 @@ void HTTPClientSessionTest::testHead() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; - assert (StreamCopier::copyStream(rs, ostr) == 0); + assertTrue (StreamCopier::copyStream(rs, ostr) == 0); } @@ -95,10 +95,10 @@ void HTTPClientSessionTest::testPostSmallIdentity() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == body.length()); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -113,10 +113,10 @@ void HTTPClientSessionTest::testPostLargeIdentity() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == body.length()); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -130,11 +130,11 @@ void HTTPClientSessionTest::testPostSmallChunked() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -150,11 +150,11 @@ void HTTPClientSessionTest::testPostLargeChunked() os.flush(); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr, 16000); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -167,11 +167,11 @@ void HTTPClientSessionTest::testPostSmallClose() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (!response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (!response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -184,11 +184,11 @@ void HTTPClientSessionTest::testPostLargeClose() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (!response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (!response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -201,42 +201,42 @@ void HTTPClientSessionTest::testKeepAlive() s.sendRequest(request); HTTPResponse response; std::istream& rs1 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::SMALL_BODY.length()); - assert (response.getContentType() == "text/plain"); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPTestServer::SMALL_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getKeepAlive()); std::ostringstream ostr1; - assert (StreamCopier::copyStream(rs1, ostr1) == 0); + assertTrue (StreamCopier::copyStream(rs1, ostr1) == 0); request.setMethod(HTTPRequest::HTTP_GET); request.setURI("/small"); s.sendRequest(request); std::istream& rs2 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::SMALL_BODY.length()); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPTestServer::SMALL_BODY.length()); + assertTrue (response.getKeepAlive()); std::ostringstream ostr2; StreamCopier::copyStream(rs2, ostr2); - assert (ostr2.str() == HTTPTestServer::SMALL_BODY); + assertTrue (ostr2.str() == HTTPTestServer::SMALL_BODY); request.setMethod(HTTPRequest::HTTP_GET); request.setURI("/large"); s.sendRequest(request); std::istream& rs3 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getChunkedTransferEncoding()); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getKeepAlive()); std::ostringstream ostr3; StreamCopier::copyStream(rs3, ostr3); - assert (ostr3.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr3.str() == HTTPTestServer::LARGE_BODY); request.setMethod(HTTPRequest::HTTP_HEAD); request.setURI("/large"); s.sendRequest(request); std::istream& rs4= s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); - assert (!response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getKeepAlive()); std::ostringstream ostr4; - assert (StreamCopier::copyStream(rs4, ostr4) == 0); + assertTrue (StreamCopier::copyStream(rs4, ostr4) == 0); } @@ -249,11 +249,11 @@ void HTTPClientSessionTest::testProxy() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); } @@ -267,13 +267,13 @@ void HTTPClientSessionTest::testProxyAuth() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); std::string r = srv.lastRequest(); - assert (r.find("Proxy-Authorization: Basic dXNlcjpwYXNz\r\n") != std::string::npos); + assertTrue (r.find("Proxy-Authorization: Basic dXNlcjpwYXNz\r\n") != std::string::npos); } @@ -286,15 +286,15 @@ void HTTPClientSessionTest::testBypassProxy() HTTPClientSession s1("127.0.0.1", 80); s1.setProxyConfig(proxyConfig); - assert (s1.bypassProxy()); + assertTrue (s1.bypassProxy()); HTTPClientSession s2("127.0.0.1", 80); s2.setProxyConfig(proxyConfig); - assert (s2.bypassProxy()); + assertTrue (s2.bypassProxy()); HTTPClientSession s3("www.appinf.com", 80); s3.setProxyConfig(proxyConfig); - assert (!s3.bypassProxy()); + assertTrue (!s3.bypassProxy()); } @@ -308,14 +308,14 @@ void HTTPClientSessionTest::testExpectContinue() request.setExpectContinue(true); s.sendRequest(request) << body; HTTPResponse response; - assert (s.peekResponse(response)); - assert (response.getStatus() == HTTPResponse::HTTP_CONTINUE); + assertTrue (s.peekResponse(response)); + assertTrue (response.getStatus() == HTTPResponse::HTTP_CONTINUE); std::istream& rs = s.receiveResponse(response); - assert (response.getStatus() == HTTPResponse::HTTP_OK); - assert (response.getContentLength() == body.length()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_OK); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -329,13 +329,13 @@ void HTTPClientSessionTest::testExpectContinueFail() request.setExpectContinue(true); s.sendRequest(request) << body; HTTPResponse response; - assert (!s.peekResponse(response)); - assert (response.getStatus() == HTTPResponse::HTTP_BAD_REQUEST); + assertTrue (!s.peekResponse(response)); + assertTrue (response.getStatus() == HTTPResponse::HTTP_BAD_REQUEST); std::istream& rs = s.receiveResponse(response); - assert (response.getStatus() == HTTPResponse::HTTP_BAD_REQUEST); + assertTrue (response.getStatus() == HTTPResponse::HTTP_BAD_REQUEST); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str().empty()); + assertTrue (ostr.str().empty()); } diff --git a/Net/testsuite/src/HTTPCookieTest.cpp b/Net/testsuite/src/HTTPCookieTest.cpp index 168d0961e..301749a4b 100644 --- a/Net/testsuite/src/HTTPCookieTest.cpp +++ b/Net/testsuite/src/HTTPCookieTest.cpp @@ -46,64 +46,64 @@ HTTPCookieTest::~HTTPCookieTest() void HTTPCookieTest::testCookie() { HTTPCookie cookie("name", "value"); - assert (cookie.getName() == "name"); - assert (cookie.getValue() == "value"); - assert (cookie.toString() == "name=value"); + assertTrue (cookie.getName() == "name"); + assertTrue (cookie.getValue() == "value"); + assertTrue (cookie.toString() == "name=value"); cookie.setPath("/"); - assert (cookie.toString() == "name=value; path=/"); + assertTrue (cookie.toString() == "name=value; path=/"); cookie.setComment("comment"); - assert (cookie.toString() == "name=value; path=/"); + assertTrue (cookie.toString() == "name=value; path=/"); cookie.setDomain("appinf.com"); - assert (cookie.toString() == "name=value; domain=appinf.com; path=/"); + assertTrue (cookie.toString() == "name=value; domain=appinf.com; path=/"); cookie.setSecure(true); - assert (cookie.toString() == "name=value; domain=appinf.com; path=/; secure"); + assertTrue (cookie.toString() == "name=value; domain=appinf.com; path=/; secure"); cookie.setHttpOnly(true); - assert (cookie.toString() == "name=value; domain=appinf.com; path=/; secure; HttpOnly"); + assertTrue (cookie.toString() == "name=value; domain=appinf.com; path=/; secure; HttpOnly"); cookie.setPriority("Low"); - assert (cookie.toString() == "name=value; domain=appinf.com; path=/; Priority=Low; secure; HttpOnly"); + assertTrue (cookie.toString() == "name=value; domain=appinf.com; path=/; Priority=Low; secure; HttpOnly"); cookie.setPriority("Medium"); - assert (cookie.toString() == "name=value; domain=appinf.com; path=/; Priority=Medium; secure; HttpOnly"); + assertTrue (cookie.toString() == "name=value; domain=appinf.com; path=/; Priority=Medium; secure; HttpOnly"); cookie.setPriority("High"); - assert (cookie.toString() == "name=value; domain=appinf.com; path=/; Priority=High; secure; HttpOnly"); + assertTrue (cookie.toString() == "name=value; domain=appinf.com; path=/; Priority=High; secure; HttpOnly"); cookie.setPriority(""); cookie.setHttpOnly(false); cookie.setVersion(1); - assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; secure; Version=\"1\""); + assertTrue (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; secure; Version=\"1\""); cookie.setSecure(false); cookie.setMaxAge(100); - assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; Version=\"1\""); + assertTrue (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; Version=\"1\""); cookie.setHttpOnly(true); - assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); + assertTrue (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); cookie.setPriority("Low"); - assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Priority=\"Low\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); + assertTrue (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Priority=\"Low\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); cookie.setPriority("Medium"); - assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Priority=\"Medium\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); + assertTrue (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Priority=\"Medium\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); cookie.setPriority("High"); - assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Priority=\"High\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); + assertTrue (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Priority=\"High\"; Max-Age=\"100\"; HttpOnly; Version=\"1\""); } void HTTPCookieTest::testEscape() { std::string escaped = HTTPCookie::escape("this is a test."); - assert (escaped == "this%20is%20a%20test."); + assertTrue (escaped == "this%20is%20a%20test."); escaped = HTTPCookie::escape("\n\t@,;\"'"); - assert (escaped == "%0A%09@%2C%3B%22%27"); + assertTrue (escaped == "%0A%09@%2C%3B%22%27"); } void HTTPCookieTest::testUnescape() { std::string unescaped = HTTPCookie::unescape("this%20is%20a%20test!"); - assert (unescaped == "this is a test!"); + assertTrue (unescaped == "this is a test!"); unescaped = HTTPCookie::unescape("%0a%09@%2c%3b%22%27"); - assert (unescaped == "\n\t@,;\"'"); + assertTrue (unescaped == "\n\t@,;\"'"); } @@ -174,11 +174,11 @@ void HTTPCookieTest::testCookieExpiry(DateTime expiryTime) //assert that the cookie's expiry time reflects the time passed to //its constructor, within a delta of the lifetime of the cookie - assert (cookieExpireTime - expiryTime <= delta); + assertTrue (cookieExpireTime - expiryTime <= delta); //assert that the cookie's max age is the number of seconds between //the creation of the cookie and the expiry time passed to its //constuctor, within a delta of the lifetime of the cookie - assert (cookieMaxAge - expectedMaxAge <= delta.seconds()); + assertTrue (cookieMaxAge - expectedMaxAge <= delta.seconds()); } diff --git a/Net/testsuite/src/HTTPCredentialsTest.cpp b/Net/testsuite/src/HTTPCredentialsTest.cpp index f8c3f2fc5..ba4022c53 100644 --- a/Net/testsuite/src/HTTPCredentialsTest.cpp +++ b/Net/testsuite/src/HTTPCredentialsTest.cpp @@ -43,36 +43,36 @@ HTTPCredentialsTest::~HTTPCredentialsTest() void HTTPCredentialsTest::testBasicCredentials() { HTTPRequest request; - assert (!request.hasCredentials()); + assertTrue (!request.hasCredentials()); HTTPBasicCredentials cred("user", "secret"); cred.authenticate(request); - assert (request.hasCredentials()); + assertTrue (request.hasCredentials()); std::string scheme; std::string info; request.getCredentials(scheme, info); - assert (scheme == "Basic"); - assert (info == "dXNlcjpzZWNyZXQ="); + assertTrue (scheme == "Basic"); + assertTrue (info == "dXNlcjpzZWNyZXQ="); HTTPBasicCredentials cred2(request); - assert (cred2.getUsername() == "user"); - assert (cred2.getPassword() == "secret"); + assertTrue (cred2.getUsername() == "user"); + assertTrue (cred2.getPassword() == "secret"); } void HTTPCredentialsTest::testProxyBasicCredentials() { HTTPRequest request; - assert (!request.hasProxyCredentials()); + assertTrue (!request.hasProxyCredentials()); HTTPBasicCredentials cred("user", "secret"); cred.proxyAuthenticate(request); - assert (request.hasProxyCredentials()); + assertTrue (request.hasProxyCredentials()); std::string scheme; std::string info; request.getProxyCredentials(scheme, info); - assert (scheme == "Basic"); - assert (info == "dXNlcjpzZWNyZXQ="); + assertTrue (scheme == "Basic"); + assertTrue (info == "dXNlcjpzZWNyZXQ="); } @@ -93,8 +93,8 @@ void HTTPCredentialsTest::testBadCredentials() request.setCredentials("Test", "SomeData"); request.getCredentials(scheme, info); - assert (scheme == "Test"); - assert (info == "SomeData"); + assertTrue (scheme == "Test"); + assertTrue (info == "SomeData"); try { @@ -112,34 +112,34 @@ void HTTPCredentialsTest::testAuthenticationParams() const std::string authInfo("nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"40e4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\""); HTTPAuthenticationParams params(authInfo); - assert (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); - assert (params["realm"] == "TestDigest"); - assert (params["response"] == "40e4889cfbd0e561f71e3107a2863bc4"); - assert (params["uri"] == "/digest/"); - assert (params["username"] == "user"); - assert (params.size() == 5); - assert (params.toString() == authInfo); + assertTrue (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); + assertTrue (params["realm"] == "TestDigest"); + assertTrue (params["response"] == "40e4889cfbd0e561f71e3107a2863bc4"); + assertTrue (params["uri"] == "/digest/"); + assertTrue (params["username"] == "user"); + assertTrue (params.size() == 5); + assertTrue (params.toString() == authInfo); params.clear(); HTTPRequest request; request.set("Authorization", "Digest " + authInfo); params.fromRequest(request); - assert (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); - assert (params["realm"] == "TestDigest"); - assert (params["response"] == "40e4889cfbd0e561f71e3107a2863bc4"); - assert (params["uri"] == "/digest/"); - assert (params["username"] == "user"); - assert (params.size() == 5); + assertTrue (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); + assertTrue (params["realm"] == "TestDigest"); + assertTrue (params["response"] == "40e4889cfbd0e561f71e3107a2863bc4"); + assertTrue (params["uri"] == "/digest/"); + assertTrue (params["username"] == "user"); + assertTrue (params.size() == 5); params.clear(); HTTPResponse response; response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); params.fromResponse(response); - assert (params["realm"] == "TestDigest"); - assert (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); - assert (params.size() == 2); + assertTrue (params["realm"] == "TestDigest"); + assertTrue (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); + assertTrue (params.size() == 2); } @@ -150,9 +150,9 @@ void HTTPCredentialsTest::testAuthenticationParamsMultipleHeaders() response.add("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); HTTPAuthenticationParams params(response); - assert (params["realm"] == "TestDigest"); - assert (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); - assert (params.size() == 2); + assertTrue (params["realm"] == "TestDigest"); + assertTrue (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); + assertTrue (params.size() == 2); } @@ -164,7 +164,7 @@ void HTTPCredentialsTest::testDigestCredentials() response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); creds.authenticate(request, response); std::string auth = request.get("Authorization"); - assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); + assertTrue (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); } @@ -177,16 +177,16 @@ void HTTPCredentialsTest::testDigestCredentialsQoP() creds.authenticate(request, response); HTTPAuthenticationParams params(request); - assert (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); - assert (params["realm"] == "TestDigest"); - assert (params["response"] != "40e4889cfbd0e561f71e3107a2863bc4"); - assert (params["uri"] == "/digest/"); - assert (params["username"] == "user"); - assert (params["opaque"] == "opaque"); - assert (params["cnonce"] != ""); - assert (params["nc"] == "00000001"); - assert (params["qop"] == "auth"); - assert (params.size() == 9); + assertTrue (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); + assertTrue (params["realm"] == "TestDigest"); + assertTrue (params["response"] != "40e4889cfbd0e561f71e3107a2863bc4"); + assertTrue (params["uri"] == "/digest/"); + assertTrue (params["username"] == "user"); + assertTrue (params["opaque"] == "opaque"); + assertTrue (params["cnonce"] != ""); + assertTrue (params["nc"] == "00000001"); + assertTrue (params["qop"] == "auth"); + assertTrue (params.size() == 9); std::string cnonce = params["cnonce"]; std::string aresp = params["response"]; @@ -195,16 +195,16 @@ void HTTPCredentialsTest::testDigestCredentialsQoP() creds.updateAuthInfo(request); params.fromRequest(request); - assert (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); - assert (params["realm"] == "TestDigest"); - assert (params["response"] != aresp); - assert (params["uri"] == "/digest/"); - assert (params["username"] == "user"); - assert (params["opaque"] == "opaque"); - assert (params["cnonce"] == cnonce); - assert (params["nc"] == "00000002"); - assert (params["qop"] == "auth"); - assert (params.size() == 9); + assertTrue (params["nonce"] == "212573bb90170538efad012978ab811f%lu"); + assertTrue (params["realm"] == "TestDigest"); + assertTrue (params["response"] != aresp); + assertTrue (params["uri"] == "/digest/"); + assertTrue (params["username"] == "user"); + assertTrue (params["opaque"] == "opaque"); + assertTrue (params["cnonce"] == cnonce); + assertTrue (params["nc"] == "00000002"); + assertTrue (params["qop"] == "auth"); + assertTrue (params.size() == 9); } @@ -215,7 +215,7 @@ void HTTPCredentialsTest::testCredentialsBasic() HTTPResponse response; response.set("WWW-Authenticate", "Basic realm=\"TestBasic\""); creds.authenticate(request, response); - assert (request.get("Authorization") == "Basic dXNlcjpzM2NyM3Q="); + assertTrue (request.get("Authorization") == "Basic dXNlcjpzM2NyM3Q="); } @@ -226,7 +226,7 @@ void HTTPCredentialsTest::testProxyCredentialsBasic() HTTPResponse response; response.set("Proxy-Authenticate", "Basic realm=\"TestBasic\""); creds.proxyAuthenticate(request, response); - assert (request.get("Proxy-Authorization") == "Basic dXNlcjpzM2NyM3Q="); + assertTrue (request.get("Proxy-Authorization") == "Basic dXNlcjpzM2NyM3Q="); } @@ -238,7 +238,7 @@ void HTTPCredentialsTest::testCredentialsDigest() response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); creds.authenticate(request, response); std::string auth = request.get("Authorization"); - assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); + assertTrue (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); } @@ -251,7 +251,7 @@ void HTTPCredentialsTest::testCredentialsDigestMultipleHeaders() response.add("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); creds.authenticate(request, response); std::string auth = request.get("Authorization"); - assert (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); + assertTrue (auth == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); } @@ -262,7 +262,7 @@ void HTTPCredentialsTest::testProxyCredentialsDigest() HTTPResponse response; response.set("Proxy-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); creds.proxyAuthenticate(request, response); - assert (request.get("Proxy-Authorization") == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); + assertTrue (request.get("Proxy-Authorization") == "Digest username=\"user\", nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", uri=\"/digest/\", response=\"40e4889cfbd0e561f71e3107a2863bc4\""); } @@ -272,8 +272,8 @@ void HTTPCredentialsTest::testExtractCredentials() std::string username; std::string password; HTTPCredentials::extractCredentials(uri, username, password); - assert (username == "user"); - assert (password == "s3cr3t"); + assertTrue (username == "user"); + assertTrue (password == "s3cr3t"); } @@ -284,10 +284,10 @@ void HTTPCredentialsTest::testVerifyAuthInfo() HTTPResponse response; response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\""); creds.authenticate(request, response); - assert (creds.verifyAuthInfo(request)); + assertTrue (creds.verifyAuthInfo(request)); request.set("Authorization", "Digest nonce=\"212573bb90170538efad012978ab811f%lu\", realm=\"TestDigest\", response=\"xxe4889cfbd0e561f71e3107a2863bc4\", uri=\"/digest/\", username=\"user\""); - assert (!creds.verifyAuthInfo(request)); + assertTrue (!creds.verifyAuthInfo(request)); } @@ -298,10 +298,10 @@ void HTTPCredentialsTest::testVerifyAuthInfoQoP() HTTPResponse response; response.set("WWW-Authenticate", "Digest realm=\"TestDigest\", nonce=\"212573bb90170538efad012978ab811f%lu\", opaque=\"opaque\", qop=\"auth,auth-int\""); creds.authenticate(request, response); - assert (creds.verifyAuthInfo(request)); + assertTrue (creds.verifyAuthInfo(request)); request.set("Authorization", "Digest cnonce=\"f9c80ffd1c3bc4ee47ed92b704ba75a4\", nc=00000001, nonce=\"212573bb90170538efad012978ab811f%lu\", opaque=\"opaque\", qop=\"auth\", realm=\"TestDigest\", response=\"ff0e90b9aa019120ea0ed6e23ce95d9a\", uri=\"/digest/\", username=\"user\""); - assert (!creds.verifyAuthInfo(request)); + assertTrue (!creds.verifyAuthInfo(request)); } diff --git a/Net/testsuite/src/HTTPRequestTest.cpp b/Net/testsuite/src/HTTPRequestTest.cpp index 0f7d65be8..db03e4afb 100644 --- a/Net/testsuite/src/HTTPRequestTest.cpp +++ b/Net/testsuite/src/HTTPRequestTest.cpp @@ -38,7 +38,7 @@ void HTTPRequestTest::testWrite1() std::ostringstream ostr; request.write(ostr); std::string s = ostr.str(); - assert (s == "GET / HTTP/1.0\r\n\r\n"); + assertTrue (s == "GET / HTTP/1.0\r\n\r\n"); } @@ -51,7 +51,7 @@ void HTTPRequestTest::testWrite2() std::ostringstream ostr; request.write(ostr); std::string s = ostr.str(); - assert (s == "HEAD /index.html HTTP/1.1\r\nHost: localhost\r\nConnection: Keep-Alive\r\nUser-Agent: Poco\r\n\r\n"); + assertTrue (s == "HEAD /index.html HTTP/1.1\r\nHost: localhost\r\nConnection: Keep-Alive\r\nUser-Agent: Poco\r\n\r\n"); } @@ -66,7 +66,7 @@ void HTTPRequestTest::testWrite3() std::ostringstream ostr; request.write(ostr); std::string s = ostr.str(); - assert (s == "POST /test.cgi HTTP/1.1\r\nHost: localhost:8000\r\nConnection: Close\r\nUser-Agent: Poco\r\nContent-Length: 100\r\nContent-Type: text/plain\r\n\r\n"); + assertTrue (s == "POST /test.cgi HTTP/1.1\r\nHost: localhost:8000\r\nConnection: Close\r\nUser-Agent: Poco\r\nContent-Length: 100\r\nContent-Type: text/plain\r\n\r\n"); } @@ -79,7 +79,7 @@ void HTTPRequestTest::testWrite4() std::ostringstream ostr; request.write(ostr); std::string s = ostr.str(); - assert (s == "HEAD /index.html HTTP/1.1\r\nHost: [fe80::1]:88\r\nConnection: Keep-Alive\r\nUser-Agent: Poco\r\n\r\n"); + assertTrue (s == "HEAD /index.html HTTP/1.1\r\nHost: [fe80::1]:88\r\nConnection: Keep-Alive\r\nUser-Agent: Poco\r\n\r\n"); } @@ -89,11 +89,11 @@ void HTTPRequestTest::testRead1() std::istringstream istr(s); HTTPRequest request; request.read(istr); - assert (request.getMethod() == HTTPRequest::HTTP_GET); - assert (request.getURI() == "/"); - assert (request.getVersion() == HTTPMessage::HTTP_1_0); - assert (request.empty()); - assert (istr.get() == -1); + assertTrue (request.getMethod() == HTTPRequest::HTTP_GET); + assertTrue (request.getURI() == "/"); + assertTrue (request.getVersion() == HTTPMessage::HTTP_1_0); + assertTrue (request.empty()); + assertTrue (istr.get() == -1); } @@ -103,14 +103,14 @@ void HTTPRequestTest::testRead2() std::istringstream istr(s); HTTPRequest request; request.read(istr); - assert (request.getMethod() == HTTPRequest::HTTP_HEAD); - assert (request.getURI() == "/index.html"); - assert (request.getVersion() == HTTPMessage::HTTP_1_1); - assert (request.size() == 3); - assert (request["Connection"] == "Keep-Alive"); - assert (request["Host"] == "localhost"); - assert (request["User-Agent"] == "Poco"); - assert (istr.get() == -1); + assertTrue (request.getMethod() == HTTPRequest::HTTP_HEAD); + assertTrue (request.getURI() == "/index.html"); + assertTrue (request.getVersion() == HTTPMessage::HTTP_1_1); + assertTrue (request.size() == 3); + assertTrue (request["Connection"] == "Keep-Alive"); + assertTrue (request["Host"] == "localhost"); + assertTrue (request["User-Agent"] == "Poco"); + assertTrue (istr.get() == -1); } @@ -120,16 +120,16 @@ void HTTPRequestTest::testRead3() std::istringstream istr(s); HTTPRequest request; request.read(istr); - assert (request.getMethod() == HTTPRequest::HTTP_POST); - assert (request.getURI() == "/test.cgi"); - assert (request.getVersion() == HTTPMessage::HTTP_1_1); - assert (request.size() == 5); - assert (request["Connection"] == "Close"); - assert (request["Host"] == "localhost:8000"); - assert (request["User-Agent"] == "Poco"); - assert (request.getContentType() == "text/plain"); - assert (request.getContentLength() == 100); - assert (istr.get() == -1); + assertTrue (request.getMethod() == HTTPRequest::HTTP_POST); + assertTrue (request.getURI() == "/test.cgi"); + assertTrue (request.getVersion() == HTTPMessage::HTTP_1_1); + assertTrue (request.size() == 5); + assertTrue (request["Connection"] == "Close"); + assertTrue (request["Host"] == "localhost:8000"); + assertTrue (request["User-Agent"] == "Poco"); + assertTrue (request.getContentType() == "text/plain"); + assertTrue (request.getContentLength() == 100); + assertTrue (istr.get() == -1); } @@ -139,16 +139,16 @@ void HTTPRequestTest::testRead4() std::istringstream istr(s); HTTPRequest request; request.read(istr); - assert (request.getMethod() == HTTPRequest::HTTP_POST); - assert (request.getURI() == "/test.cgi"); - assert (request.getVersion() == HTTPMessage::HTTP_1_1); - assert (request.size() == 5); - assert (request["Connection"] == "Close"); - assert (request["Host"] == "localhost:8000"); - assert (request["User-Agent"] == "Poco"); - assert (request.getContentType() == "text/plain"); - assert (request.getContentLength() == 100); - assert (istr.get() == -1); + assertTrue (request.getMethod() == HTTPRequest::HTTP_POST); + assertTrue (request.getURI() == "/test.cgi"); + assertTrue (request.getVersion() == HTTPMessage::HTTP_1_1); + assertTrue (request.size() == 5); + assertTrue (request["Connection"] == "Close"); + assertTrue (request["Host"] == "localhost:8000"); + assertTrue (request["User-Agent"] == "Poco"); + assertTrue (request.getContentType() == "text/plain"); + assertTrue (request.getContentLength() == 100); + assertTrue (istr.get() == -1); } @@ -208,31 +208,31 @@ void HTTPRequestTest::testCookies() NameValueCollection cookies1; cookies1.add("cookie1", "value1"); request1.setCookies(cookies1); - assert (request1["Cookie"] == "cookie1=value1"); + assertTrue (request1["Cookie"] == "cookie1=value1"); HTTPRequest request2; NameValueCollection cookies2; cookies2.add("cookie2", "value2"); cookies2.add("cookie3", "value3"); request2.setCookies(cookies2); - assert (request2["Cookie"] == "cookie2=value2; cookie3=value3"); + assertTrue (request2["Cookie"] == "cookie2=value2; cookie3=value3"); request1.setCookies(cookies2); NameValueCollection cookies3; request1.getCookies(cookies3); - assert (cookies3.size() == 3); - assert (cookies3["cookie1"] == "value1"); - assert (cookies3["cookie2"] == "value2"); - assert (cookies3["cookie3"] == "value3"); + assertTrue (cookies3.size() == 3); + assertTrue (cookies3["cookie1"] == "value1"); + assertTrue (cookies3["cookie2"] == "value2"); + assertTrue (cookies3["cookie3"] == "value3"); HTTPRequest request3; request3.add("Cookie", "cookie1=value1"); request3.add("cookie", "cookie2=value2"); NameValueCollection cookies4; request3.getCookies(cookies4); - assert (cookies4.size() == 2); - assert (cookies4["cookie1"] == "value1"); - assert (cookies4["cookie2"] == "value2"); + assertTrue (cookies4.size() == 2); + assertTrue (cookies4["cookie1"] == "value1"); + assertTrue (cookies4["cookie2"] == "value2"); } diff --git a/Net/testsuite/src/HTTPResponseTest.cpp b/Net/testsuite/src/HTTPResponseTest.cpp index 009cff23b..89e0ffe45 100644 --- a/Net/testsuite/src/HTTPResponseTest.cpp +++ b/Net/testsuite/src/HTTPResponseTest.cpp @@ -39,7 +39,7 @@ void HTTPResponseTest::testWrite1() std::ostringstream ostr; response.write(ostr); std::string s = ostr.str(); - assert (s == "HTTP/1.0 200 OK\r\n\r\n"); + assertTrue (s == "HTTP/1.0 200 OK\r\n\r\n"); } @@ -51,7 +51,7 @@ void HTTPResponseTest::testWrite2() std::ostringstream ostr; response.write(ostr); std::string s = ostr.str(); - assert (s == "HTTP/1.1 301 Moved Permanently\r\nLocation: http://www.appinf.com/index.html\r\nServer: Poco/1.0\r\n\r\n"); + assertTrue (s == "HTTP/1.1 301 Moved Permanently\r\nLocation: http://www.appinf.com/index.html\r\nServer: Poco/1.0\r\n\r\n"); } @@ -61,11 +61,11 @@ void HTTPResponseTest::testRead1() std::istringstream istr(s); HTTPResponse response; response.read(istr); - assert (response.getStatus() == HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); - assert (response.getReason() == "Internal Server Error"); - assert (response.getVersion() == HTTPMessage::HTTP_1_1); - assert (response.empty()); - assert (istr.get() == -1); + assertTrue (response.getStatus() == HTTPResponse::HTTP_INTERNAL_SERVER_ERROR); + assertTrue (response.getReason() == "Internal Server Error"); + assertTrue (response.getVersion() == HTTPMessage::HTTP_1_1); + assertTrue (response.empty()); + assertTrue (istr.get() == -1); } @@ -75,13 +75,13 @@ void HTTPResponseTest::testRead2() std::istringstream istr(s); HTTPResponse response; response.read(istr); - assert (response.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY); - assert (response.getReason() == "Moved Permanently"); - assert (response.getVersion() == HTTPMessage::HTTP_1_0); - assert (response.size() == 2); - assert (response["Location"] == "http://www.appinf.com/index.html"); - assert (response["Server"] == "Poco/1.0"); - assert (istr.get() == -1); + assertTrue (response.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY); + assertTrue (response.getReason() == "Moved Permanently"); + assertTrue (response.getVersion() == HTTPMessage::HTTP_1_0); + assertTrue (response.size() == 2); + assertTrue (response["Location"] == "http://www.appinf.com/index.html"); + assertTrue (response["Server"] == "Poco/1.0"); + assertTrue (istr.get() == -1); } @@ -91,12 +91,12 @@ void HTTPResponseTest::testRead3() std::istringstream istr(s); HTTPResponse response; response.read(istr); - assert (response.getVersion() == HTTPMessage::HTTP_1_1); - assert (response.getStatus() == HTTPResponse::HTTP_OK); - assert (response.getReason() == ""); - assert (response.size() == 1); - assert (response.getContentLength() == 0); - assert (istr.get() == -1); + assertTrue (response.getVersion() == HTTPMessage::HTTP_1_1); + assertTrue (response.getStatus() == HTTPResponse::HTTP_OK); + assertTrue (response.getReason() == ""); + assertTrue (response.size() == 1); + assertTrue (response.getContentLength() == 0); + assertTrue (istr.get() == -1); } @@ -159,15 +159,15 @@ void HTTPResponseTest::testCookies() response.addCookie(cookie1); std::vector cookies; response.getCookies(cookies); - assert (cookies.size() == 1); - assert (cookie1.getVersion() == cookies[0].getVersion()); - assert (cookie1.getName() == cookies[0].getName()); - assert (cookie1.getValue() == cookies[0].getValue()); - assert (cookie1.getComment() == cookies[0].getComment()); - assert (cookie1.getDomain() == cookies[0].getDomain()); - assert (cookie1.getPath() == cookies[0].getPath()); - assert (cookie1.getSecure() == cookies[0].getSecure()); - assert (cookie1.getMaxAge() == cookies[0].getMaxAge()); + assertTrue (cookies.size() == 1); + assertTrue (cookie1.getVersion() == cookies[0].getVersion()); + assertTrue (cookie1.getName() == cookies[0].getName()); + assertTrue (cookie1.getValue() == cookies[0].getValue()); + assertTrue (cookie1.getComment() == cookies[0].getComment()); + assertTrue (cookie1.getDomain() == cookies[0].getDomain()); + assertTrue (cookie1.getPath() == cookies[0].getPath()); + assertTrue (cookie1.getSecure() == cookies[0].getSecure()); + assertTrue (cookie1.getMaxAge() == cookies[0].getMaxAge()); HTTPCookie cookie2("cookie2", "value2"); cookie2.setVersion(1); @@ -175,28 +175,28 @@ void HTTPResponseTest::testCookies() cookie2.setSecure(true); response.addCookie(cookie2); response.getCookies(cookies); - assert (cookies.size() == 2); + assertTrue (cookies.size() == 2); HTTPCookie cookie2a; if (cookies[0].getName() == cookie2.getName()) cookie2a = cookies[0]; else cookie2a = cookies[1]; - assert (cookie2.getVersion() == cookie2a.getVersion()); - assert (cookie2.getName() == cookie2a.getName()); - assert (cookie2.getValue() == cookie2a.getValue()); - assert (cookie2.getComment() == cookie2a.getComment()); - assert (cookie2.getDomain() == cookie2a.getDomain()); - assert (cookie2.getPath() == cookie2a.getPath()); - assert (cookie2.getSecure() == cookie2a.getSecure()); - assert (cookie2.getMaxAge() == cookie2a.getMaxAge()); + assertTrue (cookie2.getVersion() == cookie2a.getVersion()); + assertTrue (cookie2.getName() == cookie2a.getName()); + assertTrue (cookie2.getValue() == cookie2a.getValue()); + assertTrue (cookie2.getComment() == cookie2a.getComment()); + assertTrue (cookie2.getDomain() == cookie2a.getDomain()); + assertTrue (cookie2.getPath() == cookie2a.getPath()); + assertTrue (cookie2.getSecure() == cookie2a.getSecure()); + assertTrue (cookie2.getMaxAge() == cookie2a.getMaxAge()); HTTPResponse response2; response2.add("Set-Cookie", "name1=value1"); response2.add("Set-cookie", "name2=value2"); cookies.clear(); response2.getCookies(cookies); - assert (cookies.size() == 2); - assert (cookies[0].getName() == "name1" && cookies[1].getName() == "name2" + assertTrue (cookies.size() == 2); + assertTrue (cookies[0].getName() == "name1" && cookies[1].getName() == "name2" || cookies[0].getName() == "name2" && cookies[1].getName() == "name1"); } diff --git a/Net/testsuite/src/HTTPServerTest.cpp b/Net/testsuite/src/HTTPServerTest.cpp index c8440916f..ac22c06dc 100644 --- a/Net/testsuite/src/HTTPServerTest.cpp +++ b/Net/testsuite/src/HTTPServerTest.cpp @@ -153,9 +153,9 @@ void HTTPServerTest::testIdentityRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -176,9 +176,9 @@ void HTTPServerTest::testPutIdentityRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -199,10 +199,10 @@ void HTTPServerTest::testChunkedRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (rbody == body); } @@ -222,10 +222,10 @@ void HTTPServerTest::testClosedRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (!response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getChunkedTransferEncoding()); + assertTrue (rbody == body); } @@ -244,20 +244,20 @@ void HTTPServerTest::testIdentityRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getKeepAlive()); + assertTrue (rbody == body); body.assign(1000, 'y'); request.setContentLength((int) body.length()); request.setKeepAlive(false); cs.sendRequest(request) << body; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (!response.getKeepAlive()); - assert (rbody == body);} + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body);} void HTTPServerTest::testChunkedRequestKeepAlive() @@ -275,20 +275,20 @@ void HTTPServerTest::testChunkedRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (rbody == body); body.assign(1000, 'y'); request.setKeepAlive(false); cs.sendRequest(request) << body; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } @@ -305,11 +305,11 @@ void HTTPServerTest::testClosedRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (!response.getChunkedTransferEncoding()); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getChunkedTransferEncoding()); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } @@ -334,11 +334,11 @@ void HTTPServerTest::testMaxKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getKeepAlive()); + assertTrue (rbody == body); } { @@ -346,11 +346,11 @@ void HTTPServerTest::testMaxKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } { @@ -359,11 +359,11 @@ void HTTPServerTest::testMaxKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } } @@ -391,11 +391,11 @@ void HTTPServerTest::testKeepAliveTimeout() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getKeepAlive()); + assertTrue (rbody == body); } Poco::Thread::sleep(4000); @@ -405,11 +405,11 @@ void HTTPServerTest::testKeepAliveTimeout() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getKeepAlive()); + assertTrue (rbody == body); } } @@ -432,9 +432,9 @@ void HTTPServerTest::test100Continue() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -452,9 +452,9 @@ void HTTPServerTest::testRedirect() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_FOUND); - assert (response.get("Location") == "http://www.appinf.com/"); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_FOUND); + assertTrue (response.get("Location") == "http://www.appinf.com/"); + assertTrue (rbody.empty()); } @@ -472,9 +472,9 @@ void HTTPServerTest::testAuth() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED); - assert (response.get("WWW-Authenticate") == "Basic realm=\"/auth\""); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED); + assertTrue (response.get("WWW-Authenticate") == "Basic realm=\"/auth\""); + assertTrue (rbody.empty()); } @@ -492,8 +492,8 @@ void HTTPServerTest::testNotImpl() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_NOT_IMPLEMENTED); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_NOT_IMPLEMENTED); + assertTrue (rbody.empty()); } @@ -511,8 +511,8 @@ void HTTPServerTest::testBuffer() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_OK); - assert (rbody == "xxxxxxxxxx"); + assertTrue (response.getStatus() == HTTPResponse::HTTP_OK); + assertTrue (rbody == "xxxxxxxxxx"); } diff --git a/Net/testsuite/src/HTTPStreamFactoryTest.cpp b/Net/testsuite/src/HTTPStreamFactoryTest.cpp index 08b72cfea..5b80c9c19 100644 --- a/Net/testsuite/src/HTTPStreamFactoryTest.cpp +++ b/Net/testsuite/src/HTTPStreamFactoryTest.cpp @@ -51,7 +51,7 @@ void HTTPStreamFactoryTest::testNoRedirect() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); } @@ -68,7 +68,7 @@ void HTTPStreamFactoryTest::testEmptyPath() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPTestServer::SMALL_BODY); } @@ -86,7 +86,7 @@ void HTTPStreamFactoryTest::testRedirect() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); } @@ -102,7 +102,7 @@ void HTTPStreamFactoryTest::testProxy() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY); } diff --git a/Net/testsuite/src/ICMPClientTest.cpp b/Net/testsuite/src/ICMPClientTest.cpp index af9422f51..74a2c952b 100644 --- a/Net/testsuite/src/ICMPClientTest.cpp +++ b/Net/testsuite/src/ICMPClientTest.cpp @@ -45,23 +45,23 @@ ICMPClientTest::~ICMPClientTest() void ICMPClientTest::testPing() { - assert(ICMPClient::pingIPv4("127.0.0.1") > 0); + assertTrue (ICMPClient::pingIPv4("127.0.0.1") > 0); Poco::Net::ICMPClient icmpClient(IPAddress::IPv4); registerDelegates(icmpClient); - assert(icmpClient.ping("127.0.0.1") > 0); + assertTrue (icmpClient.ping("127.0.0.1") > 0); #if POCO_OS == POCO_OS_ANDROID - assert(icmpClient.ping("10.0.2.15", 4) > 0); - assert(icmpClient.ping("10.0.2.2", 4) > 0); + assertTrue (icmpClient.ping("10.0.2.15", 4) > 0); + assertTrue (icmpClient.ping("10.0.2.2", 4) > 0); #else - assert(icmpClient.ping("www.appinf.com", 4) > 0); + assertTrue (icmpClient.ping("www.appinf.com", 4) > 0); // warning: may fail depending on the existence of the addresses at test site // if so, adjust accordingly (i.e. specify non-existent or unreachable IP addresses) - assert(0 == icmpClient.ping("192.168.243.1")); - assert(0 == icmpClient.ping("10.11.12.13")); + assertTrue (0 == icmpClient.ping("192.168.243.1")); + assertTrue (0 == icmpClient.ping("10.11.12.13")); #endif unregisterDelegates(icmpClient); @@ -70,23 +70,23 @@ void ICMPClientTest::testPing() void ICMPClientTest::testBigPing() { - assert(ICMPClient::pingIPv4("127.0.0.1", 1, 96) > 0); + assertTrue (ICMPClient::pingIPv4("127.0.0.1", 1, 96) > 0); Poco::Net::ICMPClient icmpClient(IPAddress::IPv4, 96); registerDelegates(icmpClient); - assert(icmpClient.ping("127.0.0.1", 1) > 0); + assertTrue (icmpClient.ping("127.0.0.1", 1) > 0); #if POCO_OS == POCO_OS_ANDROID - assert(icmpClient.ping("10.0.2.15", 4) > 0); - assert(icmpClient.ping("10.0.2.2", 4) > 0); + assertTrue (icmpClient.ping("10.0.2.15", 4) > 0); + assertTrue (icmpClient.ping("10.0.2.2", 4) > 0); #else - assert(icmpClient.ping("www.appinf.com", 4) > 0); + assertTrue (icmpClient.ping("www.appinf.com", 4) > 0); // warning: may fail depending on the existence of the addresses at test site // if so, adjust accordingly (i.e. specify non-existent or unreachable IP addresses) - assert(0 == icmpClient.ping("192.168.243.1")); - assert(0 == icmpClient.ping("10.11.12.13")); + assertTrue (0 == icmpClient.ping("192.168.243.1")); + assertTrue (0 == icmpClient.ping("10.11.12.13")); #endif unregisterDelegates(icmpClient); diff --git a/Net/testsuite/src/ICMPSocketTest.cpp b/Net/testsuite/src/ICMPSocketTest.cpp index 676711299..f9000975a 100644 --- a/Net/testsuite/src/ICMPSocketTest.cpp +++ b/Net/testsuite/src/ICMPSocketTest.cpp @@ -67,7 +67,7 @@ void ICMPSocketTest::testSendToReceiveFrom() ss.sendTo(sa); ss.receiveFrom(sa); - assert(sr.host().toString() == sa.host().toString()); + assertTrue (sr.host().toString() == sa.host().toString()); ss.close(); } diff --git a/Net/testsuite/src/IPAddressTest.cpp b/Net/testsuite/src/IPAddressTest.cpp index 3900827cb..225e5b629 100644 --- a/Net/testsuite/src/IPAddressTest.cpp +++ b/Net/testsuite/src/IPAddressTest.cpp @@ -32,24 +32,24 @@ IPAddressTest::~IPAddressTest() void IPAddressTest::testStringConv() { IPAddress ia1("127.0.0.1"); - assert (ia1.family() == IPAddress::IPv4); - assert (ia1.toString() == "127.0.0.1"); + assertTrue (ia1.family() == IPAddress::IPv4); + assertTrue (ia1.toString() == "127.0.0.1"); IPAddress ia2("192.168.1.120"); - assert (ia2.family() == IPAddress::IPv4); - assert (ia2.toString() == "192.168.1.120"); + assertTrue (ia2.family() == IPAddress::IPv4); + assertTrue (ia2.toString() == "192.168.1.120"); IPAddress ia3("255.255.255.255"); - assert (ia3.family() == IPAddress::IPv4); - assert (ia3.toString() == "255.255.255.255"); + assertTrue (ia3.family() == IPAddress::IPv4); + assertTrue (ia3.toString() == "255.255.255.255"); IPAddress ia4("0.0.0.0"); - assert (ia4.family() == IPAddress::IPv4); - assert (ia4.toString() == "0.0.0.0"); + assertTrue (ia4.family() == IPAddress::IPv4); + assertTrue (ia4.toString() == "0.0.0.0"); IPAddress ia5(24, IPAddress::IPv4); - assert (ia5.family() == IPAddress::IPv4); - assert (ia5.toString() == "255.255.255.0"); + assertTrue (ia5.family() == IPAddress::IPv4); + assertTrue (ia5.toString() == "255.255.255.0"); } @@ -57,36 +57,36 @@ void IPAddressTest::testStringConv6() { #ifdef POCO_HAVE_IPv6 IPAddress ia0("::1"); - assert (ia0.family() == IPAddress::IPv6); - assert (ia0.toString() == "::1"); + assertTrue (ia0.family() == IPAddress::IPv6); + assertTrue (ia0.toString() == "::1"); IPAddress ia1("1080:0:0:0:8:600:200a:425c"); - assert (ia1.family() == IPAddress::IPv6); - assert (ia1.toString() == "1080::8:600:200a:425c"); + assertTrue (ia1.family() == IPAddress::IPv6); + assertTrue (ia1.toString() == "1080::8:600:200a:425c"); IPAddress ia2("1080::8:600:200A:425C"); - assert (ia2.family() == IPAddress::IPv6); - assert (ia2.toString() == "1080::8:600:200a:425c"); + assertTrue (ia2.family() == IPAddress::IPv6); + assertTrue (ia2.toString() == "1080::8:600:200a:425c"); IPAddress ia3("::192.168.1.120"); - assert (ia3.family() == IPAddress::IPv6); - assert (ia3.toString() == "::192.168.1.120"); + assertTrue (ia3.family() == IPAddress::IPv6); + assertTrue (ia3.toString() == "::192.168.1.120"); IPAddress ia4("::ffff:192.168.1.120"); - assert (ia4.family() == IPAddress::IPv6); - assert (ia4.toString() == "::ffff:192.168.1.120"); + assertTrue (ia4.family() == IPAddress::IPv6); + assertTrue (ia4.toString() == "::ffff:192.168.1.120"); IPAddress ia5(64, IPAddress::IPv6); - assert (ia5.family() == IPAddress::IPv6); - assert (ia5.toString() == "ffff:ffff:ffff:ffff::"); + assertTrue (ia5.family() == IPAddress::IPv6); + assertTrue (ia5.toString() == "ffff:ffff:ffff:ffff::"); IPAddress ia6(32, IPAddress::IPv6); - assert (ia6.family() == IPAddress::IPv6); - assert (ia6.toString() == "ffff:ffff::"); + assertTrue (ia6.family() == IPAddress::IPv6); + assertTrue (ia6.toString() == "ffff:ffff::"); IPAddress ia7("::"); - assert (ia7.family() == IPAddress::IPv6); - assert (ia7.toString() == "::"); + assertTrue (ia7.family() == IPAddress::IPv6); + assertTrue (ia7.toString() == "::"); #endif } @@ -94,9 +94,9 @@ void IPAddressTest::testStringConv6() void IPAddressTest::testParse() { IPAddress ip; - assert (IPAddress::tryParse("192.168.1.120", ip)); + assertTrue (IPAddress::tryParse("192.168.1.120", ip)); - assert (!IPAddress::tryParse("192.168.1.280", ip)); + assertTrue (!IPAddress::tryParse("192.168.1.280", ip)); ip = IPAddress::parse("192.168.1.120"); try @@ -113,203 +113,203 @@ void IPAddressTest::testParse() void IPAddressTest::testClassification() { IPAddress ip1("0.0.0.0"); // wildcard - assert (ip1.isWildcard()); - assert (!ip1.isBroadcast()); - assert (!ip1.isLoopback()); - assert (!ip1.isMulticast()); - assert (!ip1.isUnicast()); - assert (!ip1.isLinkLocal()); - assert (!ip1.isSiteLocal()); - assert (!ip1.isWellKnownMC()); - assert (!ip1.isNodeLocalMC()); - assert (!ip1.isLinkLocalMC()); - assert (!ip1.isSiteLocalMC()); - assert (!ip1.isOrgLocalMC()); - assert (!ip1.isGlobalMC()); + assertTrue (ip1.isWildcard()); + assertTrue (!ip1.isBroadcast()); + assertTrue (!ip1.isLoopback()); + assertTrue (!ip1.isMulticast()); + assertTrue (!ip1.isUnicast()); + assertTrue (!ip1.isLinkLocal()); + assertTrue (!ip1.isSiteLocal()); + assertTrue (!ip1.isWellKnownMC()); + assertTrue (!ip1.isNodeLocalMC()); + assertTrue (!ip1.isLinkLocalMC()); + assertTrue (!ip1.isSiteLocalMC()); + assertTrue (!ip1.isOrgLocalMC()); + assertTrue (!ip1.isGlobalMC()); IPAddress ip2("255.255.255.255"); // broadcast - assert (!ip2.isWildcard()); - assert (ip2.isBroadcast()); - assert (!ip2.isLoopback()); - assert (!ip2.isMulticast()); - assert (!ip2.isUnicast()); - assert (!ip2.isLinkLocal()); - assert (!ip2.isSiteLocal()); - assert (!ip2.isWellKnownMC()); - assert (!ip2.isNodeLocalMC()); - assert (!ip2.isLinkLocalMC()); - assert (!ip2.isSiteLocalMC()); - assert (!ip2.isOrgLocalMC()); - assert (!ip2.isGlobalMC()); + assertTrue (!ip2.isWildcard()); + assertTrue (ip2.isBroadcast()); + assertTrue (!ip2.isLoopback()); + assertTrue (!ip2.isMulticast()); + assertTrue (!ip2.isUnicast()); + assertTrue (!ip2.isLinkLocal()); + assertTrue (!ip2.isSiteLocal()); + assertTrue (!ip2.isWellKnownMC()); + assertTrue (!ip2.isNodeLocalMC()); + assertTrue (!ip2.isLinkLocalMC()); + assertTrue (!ip2.isSiteLocalMC()); + assertTrue (!ip2.isOrgLocalMC()); + assertTrue (!ip2.isGlobalMC()); IPAddress ip3("127.0.0.1"); // loopback - assert (!ip3.isWildcard()); - assert (!ip3.isBroadcast()); - assert (ip3.isLoopback()); - assert (!ip3.isMulticast()); - assert (ip3.isUnicast()); - assert (!ip3.isLinkLocal()); - assert (!ip3.isSiteLocal()); - assert (!ip3.isWellKnownMC()); - assert (!ip3.isNodeLocalMC()); - assert (!ip3.isLinkLocalMC()); - assert (!ip3.isSiteLocalMC()); - assert (!ip3.isOrgLocalMC()); - assert (!ip3.isGlobalMC()); + assertTrue (!ip3.isWildcard()); + assertTrue (!ip3.isBroadcast()); + assertTrue (ip3.isLoopback()); + assertTrue (!ip3.isMulticast()); + assertTrue (ip3.isUnicast()); + assertTrue (!ip3.isLinkLocal()); + assertTrue (!ip3.isSiteLocal()); + assertTrue (!ip3.isWellKnownMC()); + assertTrue (!ip3.isNodeLocalMC()); + assertTrue (!ip3.isLinkLocalMC()); + assertTrue (!ip3.isSiteLocalMC()); + assertTrue (!ip3.isOrgLocalMC()); + assertTrue (!ip3.isGlobalMC()); IPAddress ip4("80.122.195.86"); // unicast - assert (!ip4.isWildcard()); - assert (!ip4.isBroadcast()); - assert (!ip4.isLoopback()); - assert (!ip4.isMulticast()); - assert (ip4.isUnicast()); - assert (!ip4.isLinkLocal()); - assert (!ip4.isSiteLocal()); - assert (!ip4.isWellKnownMC()); - assert (!ip4.isNodeLocalMC()); - assert (!ip4.isLinkLocalMC()); - assert (!ip4.isSiteLocalMC()); - assert (!ip4.isOrgLocalMC()); - assert (!ip4.isGlobalMC()); + assertTrue (!ip4.isWildcard()); + assertTrue (!ip4.isBroadcast()); + assertTrue (!ip4.isLoopback()); + assertTrue (!ip4.isMulticast()); + assertTrue (ip4.isUnicast()); + assertTrue (!ip4.isLinkLocal()); + assertTrue (!ip4.isSiteLocal()); + assertTrue (!ip4.isWellKnownMC()); + assertTrue (!ip4.isNodeLocalMC()); + assertTrue (!ip4.isLinkLocalMC()); + assertTrue (!ip4.isSiteLocalMC()); + assertTrue (!ip4.isOrgLocalMC()); + assertTrue (!ip4.isGlobalMC()); IPAddress ip5("169.254.1.20"); // link local unicast - assert (!ip5.isWildcard()); - assert (!ip5.isBroadcast()); - assert (!ip5.isLoopback()); - assert (!ip5.isMulticast()); - assert (ip5.isUnicast()); - assert (ip5.isLinkLocal()); - assert (!ip5.isSiteLocal()); - assert (!ip5.isWellKnownMC()); - assert (!ip5.isNodeLocalMC()); - assert (!ip5.isLinkLocalMC()); - assert (!ip5.isSiteLocalMC()); - assert (!ip5.isOrgLocalMC()); - assert (!ip5.isGlobalMC()); + assertTrue (!ip5.isWildcard()); + assertTrue (!ip5.isBroadcast()); + assertTrue (!ip5.isLoopback()); + assertTrue (!ip5.isMulticast()); + assertTrue (ip5.isUnicast()); + assertTrue (ip5.isLinkLocal()); + assertTrue (!ip5.isSiteLocal()); + assertTrue (!ip5.isWellKnownMC()); + assertTrue (!ip5.isNodeLocalMC()); + assertTrue (!ip5.isLinkLocalMC()); + assertTrue (!ip5.isSiteLocalMC()); + assertTrue (!ip5.isOrgLocalMC()); + assertTrue (!ip5.isGlobalMC()); IPAddress ip6("192.168.1.120"); // site local unicast - assert (!ip6.isWildcard()); - assert (!ip6.isBroadcast()); - assert (!ip6.isLoopback()); - assert (!ip6.isMulticast()); - assert (ip6.isUnicast()); - assert (!ip6.isLinkLocal()); - assert (ip6.isSiteLocal()); - assert (!ip6.isWellKnownMC()); - assert (!ip6.isNodeLocalMC()); - assert (!ip6.isLinkLocalMC()); - assert (!ip6.isSiteLocalMC()); - assert (!ip6.isOrgLocalMC()); - assert (!ip6.isGlobalMC()); + assertTrue (!ip6.isWildcard()); + assertTrue (!ip6.isBroadcast()); + assertTrue (!ip6.isLoopback()); + assertTrue (!ip6.isMulticast()); + assertTrue (ip6.isUnicast()); + assertTrue (!ip6.isLinkLocal()); + assertTrue (ip6.isSiteLocal()); + assertTrue (!ip6.isWellKnownMC()); + assertTrue (!ip6.isNodeLocalMC()); + assertTrue (!ip6.isLinkLocalMC()); + assertTrue (!ip6.isSiteLocalMC()); + assertTrue (!ip6.isOrgLocalMC()); + assertTrue (!ip6.isGlobalMC()); IPAddress ip7("10.0.0.138"); // site local unicast - assert (!ip7.isWildcard()); - assert (!ip7.isBroadcast()); - assert (!ip7.isLoopback()); - assert (!ip7.isMulticast()); - assert (ip7.isUnicast()); - assert (!ip7.isLinkLocal()); - assert (ip7.isSiteLocal()); - assert (!ip7.isWellKnownMC()); - assert (!ip7.isNodeLocalMC()); - assert (!ip7.isLinkLocalMC()); - assert (!ip7.isSiteLocalMC()); - assert (!ip7.isOrgLocalMC()); - assert (!ip7.isGlobalMC()); + assertTrue (!ip7.isWildcard()); + assertTrue (!ip7.isBroadcast()); + assertTrue (!ip7.isLoopback()); + assertTrue (!ip7.isMulticast()); + assertTrue (ip7.isUnicast()); + assertTrue (!ip7.isLinkLocal()); + assertTrue (ip7.isSiteLocal()); + assertTrue (!ip7.isWellKnownMC()); + assertTrue (!ip7.isNodeLocalMC()); + assertTrue (!ip7.isLinkLocalMC()); + assertTrue (!ip7.isSiteLocalMC()); + assertTrue (!ip7.isOrgLocalMC()); + assertTrue (!ip7.isGlobalMC()); IPAddress ip8("172.18.1.200"); // site local unicast - assert (!ip8.isWildcard()); - assert (!ip8.isBroadcast()); - assert (!ip8.isLoopback()); - assert (!ip8.isMulticast()); - assert (ip8.isUnicast()); - assert (!ip8.isLinkLocal()); - assert (ip8.isSiteLocal()); - assert (!ip8.isWellKnownMC()); - assert (!ip8.isNodeLocalMC()); - assert (!ip8.isLinkLocalMC()); - assert (!ip8.isSiteLocalMC()); - assert (!ip8.isOrgLocalMC()); - assert (!ip8.isGlobalMC()); + assertTrue (!ip8.isWildcard()); + assertTrue (!ip8.isBroadcast()); + assertTrue (!ip8.isLoopback()); + assertTrue (!ip8.isMulticast()); + assertTrue (ip8.isUnicast()); + assertTrue (!ip8.isLinkLocal()); + assertTrue (ip8.isSiteLocal()); + assertTrue (!ip8.isWellKnownMC()); + assertTrue (!ip8.isNodeLocalMC()); + assertTrue (!ip8.isLinkLocalMC()); + assertTrue (!ip8.isSiteLocalMC()); + assertTrue (!ip8.isOrgLocalMC()); + assertTrue (!ip8.isGlobalMC()); } void IPAddressTest::testMCClassification() { IPAddress ip1("224.0.0.100"); // well-known multicast - assert (!ip1.isWildcard()); - assert (!ip1.isBroadcast()); - assert (!ip1.isLoopback()); - assert (ip1.isMulticast()); - assert (!ip1.isUnicast()); - assert (!ip1.isLinkLocal()); - assert (!ip1.isSiteLocal()); - assert (ip1.isWellKnownMC()); - assert (!ip1.isNodeLocalMC()); - assert (ip1.isLinkLocalMC()); // well known are in the range of link local - assert (!ip1.isSiteLocalMC()); - assert (!ip1.isOrgLocalMC()); - assert (!ip1.isGlobalMC()); + assertTrue (!ip1.isWildcard()); + assertTrue (!ip1.isBroadcast()); + assertTrue (!ip1.isLoopback()); + assertTrue (ip1.isMulticast()); + assertTrue (!ip1.isUnicast()); + assertTrue (!ip1.isLinkLocal()); + assertTrue (!ip1.isSiteLocal()); + assertTrue (ip1.isWellKnownMC()); + assertTrue (!ip1.isNodeLocalMC()); + assertTrue (ip1.isLinkLocalMC()); // well known are in the range of link local + assertTrue (!ip1.isSiteLocalMC()); + assertTrue (!ip1.isOrgLocalMC()); + assertTrue (!ip1.isGlobalMC()); IPAddress ip2("224.1.0.100"); // link local unicast - assert (!ip2.isWildcard()); - assert (!ip2.isBroadcast()); - assert (!ip2.isLoopback()); - assert (ip2.isMulticast()); - assert (!ip2.isUnicast()); - assert (!ip2.isLinkLocal()); - assert (!ip2.isSiteLocal()); - assert (!ip2.isWellKnownMC()); - assert (!ip2.isNodeLocalMC()); - assert (ip2.isLinkLocalMC()); - assert (!ip2.isSiteLocalMC()); - assert (!ip2.isOrgLocalMC()); - assert (ip2.isGlobalMC()); // link local fall in the range of global + assertTrue (!ip2.isWildcard()); + assertTrue (!ip2.isBroadcast()); + assertTrue (!ip2.isLoopback()); + assertTrue (ip2.isMulticast()); + assertTrue (!ip2.isUnicast()); + assertTrue (!ip2.isLinkLocal()); + assertTrue (!ip2.isSiteLocal()); + assertTrue (!ip2.isWellKnownMC()); + assertTrue (!ip2.isNodeLocalMC()); + assertTrue (ip2.isLinkLocalMC()); + assertTrue (!ip2.isSiteLocalMC()); + assertTrue (!ip2.isOrgLocalMC()); + assertTrue (ip2.isGlobalMC()); // link local fall in the range of global IPAddress ip3("239.255.0.100"); // site local unicast - assert (!ip3.isWildcard()); - assert (!ip3.isBroadcast()); - assert (!ip3.isLoopback()); - assert (ip3.isMulticast()); - assert (!ip3.isUnicast()); - assert (!ip3.isLinkLocal()); - assert (!ip3.isSiteLocal()); - assert (!ip3.isWellKnownMC()); - assert (!ip3.isNodeLocalMC()); - assert (!ip3.isLinkLocalMC()); - assert (ip3.isSiteLocalMC()); - assert (!ip3.isOrgLocalMC()); - assert (!ip3.isGlobalMC()); + assertTrue (!ip3.isWildcard()); + assertTrue (!ip3.isBroadcast()); + assertTrue (!ip3.isLoopback()); + assertTrue (ip3.isMulticast()); + assertTrue (!ip3.isUnicast()); + assertTrue (!ip3.isLinkLocal()); + assertTrue (!ip3.isSiteLocal()); + assertTrue (!ip3.isWellKnownMC()); + assertTrue (!ip3.isNodeLocalMC()); + assertTrue (!ip3.isLinkLocalMC()); + assertTrue (ip3.isSiteLocalMC()); + assertTrue (!ip3.isOrgLocalMC()); + assertTrue (!ip3.isGlobalMC()); IPAddress ip4("239.192.0.100"); // org local unicast - assert (!ip4.isWildcard()); - assert (!ip4.isBroadcast()); - assert (!ip4.isLoopback()); - assert (ip4.isMulticast()); - assert (!ip4.isUnicast()); - assert (!ip4.isLinkLocal()); - assert (!ip4.isSiteLocal()); - assert (!ip4.isWellKnownMC()); - assert (!ip4.isNodeLocalMC()); - assert (!ip4.isLinkLocalMC()); - assert (!ip4.isSiteLocalMC()); - assert (ip4.isOrgLocalMC()); - assert (!ip4.isGlobalMC()); + assertTrue (!ip4.isWildcard()); + assertTrue (!ip4.isBroadcast()); + assertTrue (!ip4.isLoopback()); + assertTrue (ip4.isMulticast()); + assertTrue (!ip4.isUnicast()); + assertTrue (!ip4.isLinkLocal()); + assertTrue (!ip4.isSiteLocal()); + assertTrue (!ip4.isWellKnownMC()); + assertTrue (!ip4.isNodeLocalMC()); + assertTrue (!ip4.isLinkLocalMC()); + assertTrue (!ip4.isSiteLocalMC()); + assertTrue (ip4.isOrgLocalMC()); + assertTrue (!ip4.isGlobalMC()); IPAddress ip5("224.2.127.254"); // global unicast - assert (!ip5.isWildcard()); - assert (!ip5.isBroadcast()); - assert (!ip5.isLoopback()); - assert (ip5.isMulticast()); - assert (!ip5.isUnicast()); - assert (!ip5.isLinkLocal()); - assert (!ip5.isSiteLocal()); - assert (!ip5.isWellKnownMC()); - assert (!ip5.isNodeLocalMC()); - assert (ip5.isLinkLocalMC()); // link local fall in the range of global - assert (!ip5.isSiteLocalMC()); - assert (!ip5.isOrgLocalMC()); - assert (ip5.isGlobalMC()); + assertTrue (!ip5.isWildcard()); + assertTrue (!ip5.isBroadcast()); + assertTrue (!ip5.isLoopback()); + assertTrue (ip5.isMulticast()); + assertTrue (!ip5.isUnicast()); + assertTrue (!ip5.isLinkLocal()); + assertTrue (!ip5.isSiteLocal()); + assertTrue (!ip5.isWellKnownMC()); + assertTrue (!ip5.isNodeLocalMC()); + assertTrue (ip5.isLinkLocalMC()); // link local fall in the range of global + assertTrue (!ip5.isSiteLocalMC()); + assertTrue (!ip5.isOrgLocalMC()); + assertTrue (ip5.isGlobalMC()); } @@ -317,109 +317,109 @@ void IPAddressTest::testClassification6() { #ifdef POCO_HAVE_IPv6 IPAddress ip1("::"); // wildcard - assert (ip1.isWildcard()); - assert (!ip1.isBroadcast()); - assert (!ip1.isLoopback()); - assert (!ip1.isMulticast()); - assert (!ip1.isUnicast()); - assert (!ip1.isLinkLocal()); - assert (!ip1.isSiteLocal()); - assert (!ip1.isWellKnownMC()); - assert (!ip1.isNodeLocalMC()); - assert (!ip1.isLinkLocalMC()); - assert (!ip1.isSiteLocalMC()); - assert (!ip1.isOrgLocalMC()); - assert (!ip1.isGlobalMC()); + assertTrue (ip1.isWildcard()); + assertTrue (!ip1.isBroadcast()); + assertTrue (!ip1.isLoopback()); + assertTrue (!ip1.isMulticast()); + assertTrue (!ip1.isUnicast()); + assertTrue (!ip1.isLinkLocal()); + assertTrue (!ip1.isSiteLocal()); + assertTrue (!ip1.isWellKnownMC()); + assertTrue (!ip1.isNodeLocalMC()); + assertTrue (!ip1.isLinkLocalMC()); + assertTrue (!ip1.isSiteLocalMC()); + assertTrue (!ip1.isOrgLocalMC()); + assertTrue (!ip1.isGlobalMC()); IPAddress ip3("::1"); // loopback - assert (!ip3.isWildcard()); - assert (!ip3.isBroadcast()); - assert (ip3.isLoopback()); - assert (!ip3.isMulticast()); - assert (ip3.isUnicast()); - assert (!ip3.isLinkLocal()); - assert (!ip3.isSiteLocal()); - assert (!ip3.isWellKnownMC()); - assert (!ip3.isNodeLocalMC()); - assert (!ip3.isLinkLocalMC()); - assert (!ip3.isSiteLocalMC()); - assert (!ip3.isOrgLocalMC()); - assert (!ip3.isGlobalMC()); + assertTrue (!ip3.isWildcard()); + assertTrue (!ip3.isBroadcast()); + assertTrue (ip3.isLoopback()); + assertTrue (!ip3.isMulticast()); + assertTrue (ip3.isUnicast()); + assertTrue (!ip3.isLinkLocal()); + assertTrue (!ip3.isSiteLocal()); + assertTrue (!ip3.isWellKnownMC()); + assertTrue (!ip3.isNodeLocalMC()); + assertTrue (!ip3.isLinkLocalMC()); + assertTrue (!ip3.isSiteLocalMC()); + assertTrue (!ip3.isOrgLocalMC()); + assertTrue (!ip3.isGlobalMC()); IPAddress ip4("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); // unicast - assert (!ip4.isWildcard()); - assert (!ip4.isBroadcast()); - assert (!ip4.isLoopback()); - assert (!ip4.isMulticast()); - assert (ip4.isUnicast()); - assert (!ip4.isLinkLocal()); - assert (!ip4.isSiteLocal()); - assert (!ip4.isWellKnownMC()); - assert (!ip4.isNodeLocalMC()); - assert (!ip4.isLinkLocalMC()); - assert (!ip4.isSiteLocalMC()); - assert (!ip4.isOrgLocalMC()); - assert (!ip4.isGlobalMC()); + assertTrue (!ip4.isWildcard()); + assertTrue (!ip4.isBroadcast()); + assertTrue (!ip4.isLoopback()); + assertTrue (!ip4.isMulticast()); + assertTrue (ip4.isUnicast()); + assertTrue (!ip4.isLinkLocal()); + assertTrue (!ip4.isSiteLocal()); + assertTrue (!ip4.isWellKnownMC()); + assertTrue (!ip4.isNodeLocalMC()); + assertTrue (!ip4.isLinkLocalMC()); + assertTrue (!ip4.isSiteLocalMC()); + assertTrue (!ip4.isOrgLocalMC()); + assertTrue (!ip4.isGlobalMC()); IPAddress ip5("fe80::21f:5bff:fec6:6707"); // link local unicast - assert (!ip5.isWildcard()); - assert (!ip5.isBroadcast()); - assert (!ip5.isLoopback()); - assert (!ip5.isMulticast()); - assert (ip5.isUnicast()); - assert (ip5.isLinkLocal()); - assert (!ip5.isSiteLocal()); - assert (!ip5.isWellKnownMC()); - assert (!ip5.isNodeLocalMC()); - assert (!ip5.isLinkLocalMC()); - assert (!ip5.isSiteLocalMC()); - assert (!ip5.isOrgLocalMC()); - assert (!ip5.isGlobalMC()); + assertTrue (!ip5.isWildcard()); + assertTrue (!ip5.isBroadcast()); + assertTrue (!ip5.isLoopback()); + assertTrue (!ip5.isMulticast()); + assertTrue (ip5.isUnicast()); + assertTrue (ip5.isLinkLocal()); + assertTrue (!ip5.isSiteLocal()); + assertTrue (!ip5.isWellKnownMC()); + assertTrue (!ip5.isNodeLocalMC()); + assertTrue (!ip5.isLinkLocalMC()); + assertTrue (!ip5.isSiteLocalMC()); + assertTrue (!ip5.isOrgLocalMC()); + assertTrue (!ip5.isGlobalMC()); IPAddress ip10("fe80::12"); // link local unicast - assert (!ip10.isWildcard()); - assert (!ip10.isBroadcast()); - assert (!ip10.isLoopback()); - assert (!ip10.isMulticast()); - assert (ip10.isUnicast()); - assert (ip10.isLinkLocal()); - assert (!ip10.isSiteLocal()); - assert (!ip10.isWellKnownMC()); - assert (!ip10.isNodeLocalMC()); - assert (!ip10.isLinkLocalMC()); - assert (!ip10.isSiteLocalMC()); - assert (!ip10.isOrgLocalMC()); - assert (!ip10.isGlobalMC()); + assertTrue (!ip10.isWildcard()); + assertTrue (!ip10.isBroadcast()); + assertTrue (!ip10.isLoopback()); + assertTrue (!ip10.isMulticast()); + assertTrue (ip10.isUnicast()); + assertTrue (ip10.isLinkLocal()); + assertTrue (!ip10.isSiteLocal()); + assertTrue (!ip10.isWellKnownMC()); + assertTrue (!ip10.isNodeLocalMC()); + assertTrue (!ip10.isLinkLocalMC()); + assertTrue (!ip10.isSiteLocalMC()); + assertTrue (!ip10.isOrgLocalMC()); + assertTrue (!ip10.isGlobalMC()); IPAddress ip6("fec0::21f:5bff:fec6:6707"); // site local unicast (RFC 4291) - assert (!ip6.isWildcard()); - assert (!ip6.isBroadcast()); - assert (!ip6.isLoopback()); - assert (!ip6.isMulticast()); - assert (ip6.isUnicast()); - assert (!ip6.isLinkLocal()); - assert (ip6.isSiteLocal()); - assert (!ip6.isWellKnownMC()); - assert (!ip6.isNodeLocalMC()); - assert (!ip6.isLinkLocalMC()); - assert (!ip6.isSiteLocalMC()); - assert (!ip6.isOrgLocalMC()); - assert (!ip6.isGlobalMC()); + assertTrue (!ip6.isWildcard()); + assertTrue (!ip6.isBroadcast()); + assertTrue (!ip6.isLoopback()); + assertTrue (!ip6.isMulticast()); + assertTrue (ip6.isUnicast()); + assertTrue (!ip6.isLinkLocal()); + assertTrue (ip6.isSiteLocal()); + assertTrue (!ip6.isWellKnownMC()); + assertTrue (!ip6.isNodeLocalMC()); + assertTrue (!ip6.isLinkLocalMC()); + assertTrue (!ip6.isSiteLocalMC()); + assertTrue (!ip6.isOrgLocalMC()); + assertTrue (!ip6.isGlobalMC()); IPAddress ip7("fc00::21f:5bff:fec6:6707"); // site local unicast (RFC 4193) - assert (!ip7.isWildcard()); - assert (!ip7.isBroadcast()); - assert (!ip7.isLoopback()); - assert (!ip7.isMulticast()); - assert (ip7.isUnicast()); - assert (!ip7.isLinkLocal()); - assert (ip7.isSiteLocal()); - assert (!ip7.isWellKnownMC()); - assert (!ip7.isNodeLocalMC()); - assert (!ip7.isLinkLocalMC()); - assert (!ip7.isSiteLocalMC()); - assert (!ip7.isOrgLocalMC()); - assert (!ip7.isGlobalMC()); + assertTrue (!ip7.isWildcard()); + assertTrue (!ip7.isBroadcast()); + assertTrue (!ip7.isLoopback()); + assertTrue (!ip7.isMulticast()); + assertTrue (ip7.isUnicast()); + assertTrue (!ip7.isLinkLocal()); + assertTrue (ip7.isSiteLocal()); + assertTrue (!ip7.isWellKnownMC()); + assertTrue (!ip7.isNodeLocalMC()); + assertTrue (!ip7.isLinkLocalMC()); + assertTrue (!ip7.isSiteLocalMC()); + assertTrue (!ip7.isOrgLocalMC()); + assertTrue (!ip7.isGlobalMC()); #endif } @@ -428,79 +428,79 @@ void IPAddressTest::testMCClassification6() { #ifdef POCO_HAVE_IPv6 IPAddress ip1("ff02:0:0:0:0:0:0:c"); // well-known link-local multicast - assert (!ip1.isWildcard()); - assert (!ip1.isBroadcast()); - assert (!ip1.isLoopback()); - assert (ip1.isMulticast()); - assert (!ip1.isUnicast()); - assert (!ip1.isLinkLocal()); - assert (!ip1.isSiteLocal()); - assert (ip1.isWellKnownMC()); - assert (!ip1.isNodeLocalMC()); - assert (ip1.isLinkLocalMC()); - assert (!ip1.isSiteLocalMC()); - assert (!ip1.isOrgLocalMC()); - assert (!ip1.isGlobalMC()); + assertTrue (!ip1.isWildcard()); + assertTrue (!ip1.isBroadcast()); + assertTrue (!ip1.isLoopback()); + assertTrue (ip1.isMulticast()); + assertTrue (!ip1.isUnicast()); + assertTrue (!ip1.isLinkLocal()); + assertTrue (!ip1.isSiteLocal()); + assertTrue (ip1.isWellKnownMC()); + assertTrue (!ip1.isNodeLocalMC()); + assertTrue (ip1.isLinkLocalMC()); + assertTrue (!ip1.isSiteLocalMC()); + assertTrue (!ip1.isOrgLocalMC()); + assertTrue (!ip1.isGlobalMC()); IPAddress ip2("ff01:0:0:0:0:0:0:FB"); // node-local unicast - assert (!ip2.isWildcard()); - assert (!ip2.isBroadcast()); - assert (!ip2.isLoopback()); - assert (ip2.isMulticast()); - assert (!ip2.isUnicast()); - assert (!ip2.isLinkLocal()); - assert (!ip2.isSiteLocal()); - assert (ip2.isWellKnownMC()); - assert (ip2.isNodeLocalMC()); - assert (!ip2.isLinkLocalMC()); - assert (!ip2.isSiteLocalMC()); - assert (!ip2.isOrgLocalMC()); - assert (!ip2.isGlobalMC()); + assertTrue (!ip2.isWildcard()); + assertTrue (!ip2.isBroadcast()); + assertTrue (!ip2.isLoopback()); + assertTrue (ip2.isMulticast()); + assertTrue (!ip2.isUnicast()); + assertTrue (!ip2.isLinkLocal()); + assertTrue (!ip2.isSiteLocal()); + assertTrue (ip2.isWellKnownMC()); + assertTrue (ip2.isNodeLocalMC()); + assertTrue (!ip2.isLinkLocalMC()); + assertTrue (!ip2.isSiteLocalMC()); + assertTrue (!ip2.isOrgLocalMC()); + assertTrue (!ip2.isGlobalMC()); IPAddress ip3("ff05:0:0:0:0:0:0:FB"); // site local unicast - assert (!ip3.isWildcard()); - assert (!ip3.isBroadcast()); - assert (!ip3.isLoopback()); - assert (ip3.isMulticast()); - assert (!ip3.isUnicast()); - assert (!ip3.isLinkLocal()); - assert (!ip3.isSiteLocal()); - assert (ip3.isWellKnownMC()); - assert (!ip3.isNodeLocalMC()); - assert (!ip3.isLinkLocalMC()); - assert (ip3.isSiteLocalMC()); - assert (!ip3.isOrgLocalMC()); - assert (!ip3.isGlobalMC()); + assertTrue (!ip3.isWildcard()); + assertTrue (!ip3.isBroadcast()); + assertTrue (!ip3.isLoopback()); + assertTrue (ip3.isMulticast()); + assertTrue (!ip3.isUnicast()); + assertTrue (!ip3.isLinkLocal()); + assertTrue (!ip3.isSiteLocal()); + assertTrue (ip3.isWellKnownMC()); + assertTrue (!ip3.isNodeLocalMC()); + assertTrue (!ip3.isLinkLocalMC()); + assertTrue (ip3.isSiteLocalMC()); + assertTrue (!ip3.isOrgLocalMC()); + assertTrue (!ip3.isGlobalMC()); IPAddress ip4("ff18:0:0:0:0:0:0:FB"); // org local unicast - assert (!ip4.isWildcard()); - assert (!ip4.isBroadcast()); - assert (!ip4.isLoopback()); - assert (ip4.isMulticast()); - assert (!ip4.isUnicast()); - assert (!ip4.isLinkLocal()); - assert (!ip4.isSiteLocal()); - assert (!ip4.isWellKnownMC()); - assert (!ip4.isNodeLocalMC()); - assert (!ip4.isLinkLocalMC()); - assert (!ip4.isSiteLocalMC()); - assert (ip4.isOrgLocalMC()); - assert (!ip4.isGlobalMC()); + assertTrue (!ip4.isWildcard()); + assertTrue (!ip4.isBroadcast()); + assertTrue (!ip4.isLoopback()); + assertTrue (ip4.isMulticast()); + assertTrue (!ip4.isUnicast()); + assertTrue (!ip4.isLinkLocal()); + assertTrue (!ip4.isSiteLocal()); + assertTrue (!ip4.isWellKnownMC()); + assertTrue (!ip4.isNodeLocalMC()); + assertTrue (!ip4.isLinkLocalMC()); + assertTrue (!ip4.isSiteLocalMC()); + assertTrue (ip4.isOrgLocalMC()); + assertTrue (!ip4.isGlobalMC()); IPAddress ip5("ff1f:0:0:0:0:0:0:FB"); // global unicast - assert (!ip5.isWildcard()); - assert (!ip5.isBroadcast()); - assert (!ip5.isLoopback()); - assert (ip5.isMulticast()); - assert (!ip5.isUnicast()); - assert (!ip5.isLinkLocal()); - assert (!ip5.isSiteLocal()); - assert (!ip5.isWellKnownMC()); - assert (!ip5.isNodeLocalMC()); - assert (!ip5.isLinkLocalMC()); - assert (!ip5.isSiteLocalMC()); - assert (!ip5.isOrgLocalMC()); - assert (ip5.isGlobalMC()); + assertTrue (!ip5.isWildcard()); + assertTrue (!ip5.isBroadcast()); + assertTrue (!ip5.isLoopback()); + assertTrue (ip5.isMulticast()); + assertTrue (!ip5.isUnicast()); + assertTrue (!ip5.isLinkLocal()); + assertTrue (!ip5.isSiteLocal()); + assertTrue (!ip5.isWellKnownMC()); + assertTrue (!ip5.isNodeLocalMC()); + assertTrue (!ip5.isLinkLocalMC()); + assertTrue (!ip5.isSiteLocalMC()); + assertTrue (!ip5.isOrgLocalMC()); + assertTrue (ip5.isGlobalMC()); #endif } @@ -512,51 +512,51 @@ void IPAddressTest::testRelationals() IPAddress ip3; IPAddress ip4("10.0.0.138"); - assert (ip1 != ip4); - assert (ip1 == ip2); - assert (!(ip1 != ip2)); - assert (!(ip1 == ip4)); - assert (ip1 > ip4); - assert (ip1 >= ip4); - assert (ip4 < ip1); - assert (ip4 <= ip1); - assert (!(ip1 < ip4)); - assert (!(ip1 <= ip4)); - assert (!(ip4 > ip1)); - assert (!(ip4 >= ip1)); + assertTrue (ip1 != ip4); + assertTrue (ip1 == ip2); + assertTrue (!(ip1 != ip2)); + assertTrue (!(ip1 == ip4)); + assertTrue (ip1 > ip4); + assertTrue (ip1 >= ip4); + assertTrue (ip4 < ip1); + assertTrue (ip4 <= ip1); + assertTrue (!(ip1 < ip4)); + assertTrue (!(ip1 <= ip4)); + assertTrue (!(ip4 > ip1)); + assertTrue (!(ip4 >= ip1)); ip3 = ip1; - assert (ip1 == ip3); + assertTrue (ip1 == ip3); ip3 = ip4; - assert (ip1 != ip3); - assert (ip3 == ip4); + assertTrue (ip1 != ip3); + assertTrue (ip3 == ip4); } void IPAddressTest::testWildcard() { IPAddress wildcard = IPAddress::wildcard(); - assert (wildcard.isWildcard()); - assert (wildcard.toString() == "0.0.0.0"); + assertTrue (wildcard.isWildcard()); + assertTrue (wildcard.toString() == "0.0.0.0"); } void IPAddressTest::testBroadcast() { IPAddress broadcast = IPAddress::broadcast(); - assert (broadcast.isBroadcast()); - assert (broadcast.toString() == "255.255.255.255"); + assertTrue (broadcast.isBroadcast()); + assertTrue (broadcast.toString() == "255.255.255.255"); } void IPAddressTest::testPrefixCons() { IPAddress ia1(15, IPAddress::IPv4); - assert(ia1.toString() == "255.254.0.0"); + assertTrue (ia1.toString() == "255.254.0.0"); #ifdef POCO_HAVE_IPv6 IPAddress ia2(62, IPAddress::IPv6); - assert(ia2.toString() == "ffff:ffff:ffff:fffc::"); + assertTrue (ia2.toString() == "ffff:ffff:ffff:fffc::"); #endif } @@ -564,32 +564,32 @@ void IPAddressTest::testPrefixCons() void IPAddressTest::testPrefixLen() { IPAddress ia1(15, IPAddress::IPv4); - assert(ia1.prefixLength() == 15); + assertTrue (ia1.prefixLength() == 15); IPAddress ia2(16, IPAddress::IPv4); - assert(ia2.prefixLength() == 16); + assertTrue (ia2.prefixLength() == 16); IPAddress ia3(23, IPAddress::IPv4); - assert(ia3.prefixLength() == 23); + assertTrue (ia3.prefixLength() == 23); IPAddress ia4(24, IPAddress::IPv4); - assert(ia4.prefixLength() == 24); + assertTrue (ia4.prefixLength() == 24); IPAddress ia5(25, IPAddress::IPv4); - assert(ia5.prefixLength() == 25); + assertTrue (ia5.prefixLength() == 25); #ifdef POCO_HAVE_IPv6 IPAddress ia6(62, IPAddress::IPv6); - assert(ia6.prefixLength() == 62); + assertTrue (ia6.prefixLength() == 62); IPAddress ia7(63, IPAddress::IPv6); - assert(ia7.prefixLength() == 63); + assertTrue (ia7.prefixLength() == 63); IPAddress ia8(64, IPAddress::IPv6); - assert(ia8.prefixLength() == 64); + assertTrue (ia8.prefixLength() == 64); IPAddress ia9(65, IPAddress::IPv6); - assert(ia9.prefixLength() == 65); + assertTrue (ia9.prefixLength() == 65); #endif } @@ -600,12 +600,12 @@ void IPAddressTest::testOperators() IPAddress mask(24, IPAddress::IPv4); IPAddress net = ip & mask; - assert(net.toString() == "10.0.0.0"); + assertTrue (net.toString() == "10.0.0.0"); IPAddress host("0.0.0.51"); - assert((net | host) == ip); + assertTrue ((net | host) == ip); - assert((~mask).toString() == "0.0.0.255"); + assertTrue ((~mask).toString() == "0.0.0.255"); } @@ -619,11 +619,11 @@ void IPAddressTest::testRelationals6() void IPAddressTest::testByteOrderMacros() { Poco::UInt16 a16 = 0xDEAD; - assert (poco_ntoh_16(a16) == ntohs(a16)); - assert (poco_hton_16(a16) == htons(a16)); + assertTrue (poco_ntoh_16(a16) == ntohs(a16)); + assertTrue (poco_hton_16(a16) == htons(a16)); Poco::UInt32 a32 = 0xDEADBEEF; - assert (poco_ntoh_32(a32) == ntohl(a32)); - assert (poco_hton_32(a32) == htonl(a32)); + assertTrue (poco_ntoh_32(a32) == ntohl(a32)); + assertTrue (poco_hton_32(a32) == htonl(a32)); } diff --git a/Net/testsuite/src/MailMessageTest.cpp b/Net/testsuite/src/MailMessageTest.cpp index 87d20bfba..7c1977e79 100644 --- a/Net/testsuite/src/MailMessageTest.cpp +++ b/Net/testsuite/src/MailMessageTest.cpp @@ -116,13 +116,13 @@ void MailMessageTest::testWriteQP() Timestamp ts(0); message.setDate(ts); - assert (!message.isMultipart()); + assertTrue (!message.isMultipart()); std::ostringstream str; message.write(str); std::string s = str.str(); - assert (s == + assertTrue (s == "Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n" "Content-Type: text/plain\r\n" "Subject: Test Message\r\n" @@ -158,7 +158,7 @@ void MailMessageTest::testWrite8Bit() std::ostringstream str; message.write(str); std::string s = str.str(); - assert (s == + assertTrue (s == "Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n" "Content-Type: text/plain\r\n" "Subject: Test Message\r\n" @@ -190,7 +190,7 @@ void MailMessageTest::testWriteBase64() std::ostringstream str; message.write(str); std::string s = str.str(); - assert (s == + assertTrue (s == "Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n" "Content-Type: text/plain\r\n" "Subject: Test Message\r\n" @@ -230,7 +230,7 @@ void MailMessageTest::testWriteManyRecipients() std::ostringstream str; message.write(str); std::string s = str.str(); - assert (s == + assertTrue (s == "Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n" "Content-Type: text/plain\r\n" "Subject: Test Message\r\n" @@ -260,7 +260,7 @@ void MailMessageTest::testWriteMultiPart() pSPS->headers().set("Content-ID", "abcd1234"); message.addAttachment("sample", pSPS); - assert (message.isMultipart()); + assertTrue (message.isMultipart()); std::ostringstream str; message.write(str); @@ -301,7 +301,7 @@ void MailMessageTest::testWriteMultiPart() msg += *it; } - assert (s == msg); + assertTrue (s == msg); } @@ -325,9 +325,9 @@ void MailMessageTest::testReadQP() MailMessage message; message.read(istr); - assert (message.getSender() == "poco@appinf.com"); - assert (message.getContentType() == "text/plain"); - assert (message.getContent() == + assertTrue (message.getSender() == "poco@appinf.com"); + assertTrue (message.getContentType() == "text/plain"); + assertTrue (message.getContent() == "Hello, world!\r\n" "This is a test for the MailMessage class.\r\n" "To test the quoted-printable encoding, we'll put an extra long line here. This should be enough.\r\n" @@ -352,9 +352,9 @@ void MailMessageTest::testReadDefaultTransferEncoding() MailMessage message; message.read(istr); - assert (message.getSender() == "poco@appinf.com"); - assert (message.getContentType() == "text/plain"); - assert (message.getContent() == + assertTrue (message.getSender() == "poco@appinf.com"); + assertTrue (message.getContentType() == "text/plain"); + assertTrue (message.getContent() == "Hello, world!\r\n" "This is a test for the MailMessage class.\r\n" ); @@ -378,9 +378,9 @@ void MailMessageTest::testRead8Bit() MailMessage message; message.read(istr); - assert (message.getSender() == "poco@appinf.com"); - assert (message.getContentType() == "text/plain"); - assert (message.getContent() == + assertTrue (message.getSender() == "poco@appinf.com"); + assertTrue (message.getContentType() == "text/plain"); + assertTrue (message.getContent() == "Hello, world!\r\n" "This is a test for the MailMessage class.\r\n" ); @@ -418,14 +418,14 @@ void MailMessageTest::testReadMultiPart() MailMessage message; message.read(istr, handler); - assert (handler.data().size() == 2); - assert (handler.data()[0] == "Hello World!\r\n"); - assert (handler.type()[0] == "text/plain"); - assert (handler.disp()[0] == "inline"); + assertTrue (handler.data().size() == 2); + assertTrue (handler.data()[0] == "Hello World!\r\n"); + assertTrue (handler.type()[0] == "text/plain"); + assertTrue (handler.disp()[0] == "inline"); - assert (handler.data()[1] == "This is some binary data. Really."); - assert (handler.type()[1] == "application/octet-stream; name=sample"); - assert (handler.disp()[1] == "attachment; filename=sample.dat"); + assertTrue (handler.data()[1] == "This is some binary data. Really."); + assertTrue (handler.type()[1] == "application/octet-stream; name=sample"); + assertTrue (handler.disp()[1] == "attachment; filename=sample.dat"); } @@ -459,9 +459,9 @@ void MailMessageTest::testReadMultiPartWithAttachmentNames() MailMessage message; message.read(istr); - assert (message.parts().size() == 2); - assert (message.parts()[1].name == "sample"); - assert (message.parts()[1].pSource->filename() == "sample.dat"); + assertTrue (message.parts().size() == 2); + assertTrue (message.parts()[1].name == "sample"); + assertTrue (message.parts()[1].pSource->filename() == "sample.dat"); } @@ -495,14 +495,14 @@ void MailMessageTest::testReadMultiPartDefaultTransferEncoding() MailMessage message; message.read(istr, handler); - assert (handler.data().size() == 2); - assert (handler.data()[0] == "Hello World!\r\n"); - assert (handler.type()[0] == "text/plain"); - assert (handler.disp()[0] == "inline"); + assertTrue (handler.data().size() == 2); + assertTrue (handler.data()[0] == "Hello World!\r\n"); + assertTrue (handler.type()[0] == "text/plain"); + assertTrue (handler.disp()[0] == "inline"); - assert (handler.data()[1] == "This is some binary data. Really."); - assert (handler.type()[1] == "application/octet-stream; name=sample"); - assert (handler.disp()[1] == "attachment; filename=sample.dat"); + assertTrue (handler.data()[1] == "This is some binary data. Really."); + assertTrue (handler.type()[1] == "application/octet-stream; name=sample"); + assertTrue (handler.disp()[1] == "attachment; filename=sample.dat"); } @@ -541,7 +541,7 @@ void MailMessageTest::testReadWriteMultiPart() message.write(ostr); std::string msgout(ostr.str()); - assert (msgout == msgin); + assertTrue (msgout == msgin); } @@ -587,27 +587,27 @@ void MailMessageTest::testReadWriteMultiPartStore() if (fps && fps->filename().size()) { std::string filename = fps->filename(); - assert (filename == "sample.dat"); + assertTrue (filename == "sample.dat"); std::string path = fps->path(); // for security reasons, the filesystem temporary // filename is not the same as attachment name std::size_t sz = (path.size() > filename.size()) ? filename.size() : path.size(); - assert (0 != icompare(path, path.size() - sz, sz, path)); + assertTrue (0 != icompare(path, path.size() - sz, sz, path)); Poco::FileInputStream fis(path); - assert (fis.good()); + assertTrue (fis.good()); std::string read; std::string line; while (std::getline(fis, line)) read += line; - assert (!read.empty()); - assert (read == "This is some binary data. Really."); + assertTrue (!read.empty()); + assertTrue (read == "This is some binary data. Really."); } } message.write(ostr); std::string msgout(ostr.str()); - assert (msgout == msgin); + assertTrue (msgout == msgin); } @@ -615,18 +615,18 @@ void MailMessageTest::testEncodeWord() { std::string plain("this is pure ASCII"); std::string encoded = MailMessage::encodeWord(plain, "ISO-8859-1"); - assert (encoded == plain); + assertTrue (encoded == plain); plain = "This text contains German Umlauts: \304\326"; encoded = MailMessage::encodeWord(plain, "ISO-8859-1"); - assert (encoded == "=?ISO-8859-1?q?This_text_contains_German_Umlauts=3A_=C4=D6?="); + assertTrue (encoded == "=?ISO-8859-1?q?This_text_contains_German_Umlauts=3A_=C4=D6?="); plain = "This text contains German Umlauts: \304\326. " "It is also a very long text. Longer than 75 " "characters. Long enough to become three lines " "after being word-encoded."; encoded = MailMessage::encodeWord(plain, "ISO-8859-1"); - assert (encoded == "=?ISO-8859-1?q?This_text_contains_German_Umlauts=3A_=C4=D6=2E_It_?=\r\n" + assertTrue (encoded == "=?ISO-8859-1?q?This_text_contains_German_Umlauts=3A_=C4=D6=2E_It_?=\r\n" " =?ISO-8859-1?q?is_also_a_very_long_text=2E_Longer_than_75_characters=2E_?=\r\n" " =?ISO-8859-1?q?Long_enough_to_become_three_lines_after_being_word-encode?=\r\n" " =?ISO-8859-1?q?d=2E?="); diff --git a/Net/testsuite/src/MailStreamTest.cpp b/Net/testsuite/src/MailStreamTest.cpp index 23116bba6..bea3b4af4 100644 --- a/Net/testsuite/src/MailStreamTest.cpp +++ b/Net/testsuite/src/MailStreamTest.cpp @@ -50,7 +50,7 @@ void MailStreamTest::testMailInputStream() std::ostringstream ostr; StreamCopier::copyStream(mis, ostr); std::string s(ostr.str()); - assert (s == + assertTrue (s == "From: john.doe@no.domain\r\n" "To: jane.doe@no.domain\r\n" "Subject: test\r\n" @@ -84,7 +84,7 @@ void MailStreamTest::testMailOutputStream() mos << msg; mos.close(); std::string s(ostr.str()); - assert (s == + assertTrue (s == "From: john.doe@no.domain\r\n" "To: jane.doe@no.domain\r\n" "Subject: test\r\n" diff --git a/Net/testsuite/src/MediaTypeTest.cpp b/Net/testsuite/src/MediaTypeTest.cpp index 91e970518..847150f1f 100644 --- a/Net/testsuite/src/MediaTypeTest.cpp +++ b/Net/testsuite/src/MediaTypeTest.cpp @@ -30,37 +30,37 @@ MediaTypeTest::~MediaTypeTest() void MediaTypeTest::testParse() { MediaType mt1("text/plain"); - assert (mt1.getType() == "text"); - assert (mt1.getSubType() == "plain"); - assert (mt1.parameters().empty()); + assertTrue (mt1.getType() == "text"); + assertTrue (mt1.getSubType() == "plain"); + assertTrue (mt1.parameters().empty()); MediaType mt2("text/xml;charset=us-ascii"); - assert (mt2.getType() == "text"); - assert (mt2.getSubType() == "xml"); - assert (!mt2.parameters().empty()); - assert (mt2.getParameter("charset") == "us-ascii"); + assertTrue (mt2.getType() == "text"); + assertTrue (mt2.getSubType() == "xml"); + assertTrue (!mt2.parameters().empty()); + assertTrue (mt2.getParameter("charset") == "us-ascii"); MediaType mt3("application/test; param1=value1; param2=\"value 2\""); - assert (mt3.getType() == "application"); - assert (mt3.getSubType() == "test"); - assert (!mt3.parameters().empty()); - assert (mt3.getParameter("param1") == "value1"); - assert (mt3.getParameter("PARAM2") == "value 2"); + assertTrue (mt3.getType() == "application"); + assertTrue (mt3.getSubType() == "test"); + assertTrue (!mt3.parameters().empty()); + assertTrue (mt3.getParameter("param1") == "value1"); + assertTrue (mt3.getParameter("PARAM2") == "value 2"); } void MediaTypeTest::testToString() { MediaType mt1("text", "plain"); - assert (mt1.toString() == "text/plain"); + assertTrue (mt1.toString() == "text/plain"); mt1.setParameter("charset", "iso-8859-1"); - assert (mt1.toString() == "text/plain; charset=iso-8859-1"); + assertTrue (mt1.toString() == "text/plain; charset=iso-8859-1"); MediaType mt2("application", "test"); mt2.setParameter("param1", "value1"); mt2.setParameter("param2", "value 2"); - assert (mt2.toString() == "application/test; param1=value1; param2=\"value 2\""); + assertTrue (mt2.toString() == "application/test; param1=value1; param2=\"value 2\""); } @@ -69,11 +69,11 @@ void MediaTypeTest::testMatch() MediaType mt1("Text/Plain"); MediaType mt2("text/plain"); MediaType mt3("text/xml"); - assert (mt1.matches(mt2)); - assert (!mt1.matches(mt3)); - assert (mt1.matches("text")); - assert (mt2.matches("text")); - assert (mt3.matches("text")); + assertTrue (mt1.matches(mt2)); + assertTrue (!mt1.matches(mt3)); + assertTrue (mt1.matches("text")); + assertTrue (mt2.matches("text")); + assertTrue (mt3.matches("text")); } @@ -85,27 +85,27 @@ void MediaTypeTest::testMatchRange() MediaType mt4("image/jpg"); MediaType mt5("text/*"); MediaType mt6("*/*"); - assert (mt1.matchesRange(mt5)); - assert (mt2.matchesRange(mt5)); - assert (mt3.matchesRange(mt5)); - assert (!mt4.matchesRange(mt5)); - assert (mt1.matchesRange(mt6)); - assert (mt2.matchesRange(mt6)); - assert (mt3.matchesRange(mt6)); - assert (mt4.matchesRange(mt6)); + assertTrue (mt1.matchesRange(mt5)); + assertTrue (mt2.matchesRange(mt5)); + assertTrue (mt3.matchesRange(mt5)); + assertTrue (!mt4.matchesRange(mt5)); + assertTrue (mt1.matchesRange(mt6)); + assertTrue (mt2.matchesRange(mt6)); + assertTrue (mt3.matchesRange(mt6)); + assertTrue (mt4.matchesRange(mt6)); - assert (mt5.matchesRange(mt1)); - assert (mt5.matchesRange(mt2)); - assert (mt5.matchesRange(mt3)); - assert (!mt5.matchesRange(mt4)); + assertTrue (mt5.matchesRange(mt1)); + assertTrue (mt5.matchesRange(mt2)); + assertTrue (mt5.matchesRange(mt3)); + assertTrue (!mt5.matchesRange(mt4)); - assert (mt1.matchesRange("text", "*")); - assert (mt2.matchesRange("text", "*")); - assert (mt3.matchesRange("text", "*")); - assert (!mt4.matchesRange("text", "*")); + assertTrue (mt1.matchesRange("text", "*")); + assertTrue (mt2.matchesRange("text", "*")); + assertTrue (mt3.matchesRange("text", "*")); + assertTrue (!mt4.matchesRange("text", "*")); - assert (mt1.matchesRange("*")); - assert (mt4.matchesRange("*")); + assertTrue (mt1.matchesRange("*")); + assertTrue (mt4.matchesRange("*")); } diff --git a/Net/testsuite/src/MessageHeaderTest.cpp b/Net/testsuite/src/MessageHeaderTest.cpp index 649b63b8f..e3c8bd374 100644 --- a/Net/testsuite/src/MessageHeaderTest.cpp +++ b/Net/testsuite/src/MessageHeaderTest.cpp @@ -41,7 +41,7 @@ void MessageHeaderTest::testWrite() std::ostringstream ostr; mh.write(ostr); std::string s = ostr.str(); - assert (s == "name1: value1\r\nname2: value2\r\nname3: value3\r\n"); + assertTrue (s == "name1: value1\r\nname2: value2\r\nname3: value3\r\n"); } @@ -51,10 +51,10 @@ void MessageHeaderTest::testRead1() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 3); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value2"); - assert (mh["name3"] == "value3"); + assertTrue (mh.size() == 3); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value2"); + assertTrue (mh["name3"] == "value3"); } @@ -64,10 +64,10 @@ void MessageHeaderTest::testRead2() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 3); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value2"); - assert (mh["name3"] == "value3"); + assertTrue (mh.size() == 3); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value2"); + assertTrue (mh["name3"] == "value3"); } @@ -77,8 +77,8 @@ void MessageHeaderTest::testRead3() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 1); - assert (mh["name1"] == "value1"); + assertTrue (mh.size() == 1); + assertTrue (mh["name1"] == "value1"); } @@ -89,15 +89,15 @@ void MessageHeaderTest::testRead4() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 2); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value2"); + assertTrue (mh.size() == 2); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value2"); int ch = istr.get(); - assert (ch == '\r'); + assertTrue (ch == '\r'); ch = istr.get(); - assert (ch == '\n'); + assertTrue (ch == '\n'); ch = istr.get(); - assert (ch == 's'); + assertTrue (ch == 's'); } @@ -107,10 +107,10 @@ void MessageHeaderTest::testRead5() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 3); - assert (mh["name1"] == ""); - assert (mh["name2"] == "value2"); - assert (mh["name3"] == "value3"); + assertTrue (mh.size() == 3); + assertTrue (mh["name1"] == ""); + assertTrue (mh["name2"] == "value2"); + assertTrue (mh["name3"] == "value3"); } @@ -120,10 +120,10 @@ void MessageHeaderTest::testReadFolding1() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 3); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value21 value22"); - assert (mh["name3"] == "value3"); + assertTrue (mh.size() == 3); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value21 value22"); + assertTrue (mh["name3"] == "value3"); } @@ -133,10 +133,10 @@ void MessageHeaderTest::testReadFolding2() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 3); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value21\tvalue22"); - assert (mh["name3"] == "value3"); + assertTrue (mh.size() == 3); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value21\tvalue22"); + assertTrue (mh["name3"] == "value3"); } @@ -146,9 +146,9 @@ void MessageHeaderTest::testReadFolding3() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 2); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value21 value22"); + assertTrue (mh.size() == 2); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value21 value22"); } @@ -158,9 +158,9 @@ void MessageHeaderTest::testReadFolding4() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 2); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value21 value22 value23"); + assertTrue (mh.size() == 2); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value21 value22 value23"); } @@ -170,10 +170,10 @@ void MessageHeaderTest::testReadFolding5() std::istringstream istr(s); MessageHeader mh; mh.read(istr); - assert (mh.size() == 3); - assert (mh["name1"] == "value1"); - assert (mh["name2"] == "value21 value22 value23"); - assert (mh["name3"] == "value3"); + assertTrue (mh.size() == 3); + assertTrue (mh["name1"] == "value1"); + assertTrue (mh["name2"] == "value21 value22 value23"); + assertTrue (mh["name3"] == "value3"); } @@ -216,74 +216,74 @@ void MessageHeaderTest::testSplitElements() std::string s; std::vector v; MessageHeader::splitElements(s, v); - assert (v.empty()); + assertTrue (v.empty()); s = "foo"; MessageHeader::splitElements(s, v); - assert (v.size() == 1); - assert (v[0] == "foo"); + assertTrue (v.size() == 1); + assertTrue (v[0] == "foo"); s = " foo "; MessageHeader::splitElements(s, v); - assert (v.size() == 1); - assert (v[0] == "foo"); + assertTrue (v.size() == 1); + assertTrue (v[0] == "foo"); s = "foo,bar"; MessageHeader::splitElements(s, v); - assert (v.size() == 2); - assert (v[0] == "foo"); - assert (v[1] == "bar"); + assertTrue (v.size() == 2); + assertTrue (v[0] == "foo"); + assertTrue (v[1] == "bar"); s = "foo,,bar"; MessageHeader::splitElements(s, v); - assert (v.size() == 2); - assert (v[0] == "foo"); - assert (v[1] == "bar"); + assertTrue (v.size() == 2); + assertTrue (v[0] == "foo"); + assertTrue (v[1] == "bar"); MessageHeader::splitElements(s, v, false); - assert (v.size() == 3); - assert (v[0] == "foo"); - assert (v[1] == ""); - assert (v[2] == "bar"); + assertTrue (v.size() == 3); + assertTrue (v[0] == "foo"); + assertTrue (v[1] == ""); + assertTrue (v[2] == "bar"); s = "foo;param=\"a,b\",bar;param=\"c,d\""; MessageHeader::splitElements(s, v); - assert (v.size() == 2); - assert (v[0] == "foo;param=\"a,b\""); - assert (v[1] == "bar;param=\"c,d\""); + assertTrue (v.size() == 2); + assertTrue (v[0] == "foo;param=\"a,b\""); + assertTrue (v[1] == "bar;param=\"c,d\""); s = "foo; param=\"a,b\", bar; param=\"c,d\""; MessageHeader::splitElements(s, v); - assert (v.size() == 2); - assert (v[0] == "foo; param=\"a,b\""); - assert (v[1] == "bar; param=\"c,d\""); + assertTrue (v.size() == 2); + assertTrue (v[0] == "foo; param=\"a,b\""); + assertTrue (v[1] == "bar; param=\"c,d\""); s = "foo, bar, f00, baz"; MessageHeader::splitElements(s, v); - assert (v.size() == 4); - assert (v[0] == "foo"); - assert (v[1] == "bar"); - assert (v[2] == "f00"); - assert (v[3] == "baz"); + assertTrue (v.size() == 4); + assertTrue (v[0] == "foo"); + assertTrue (v[1] == "bar"); + assertTrue (v[2] == "f00"); + assertTrue (v[3] == "baz"); s = "a,b,c"; MessageHeader::splitElements(s, v); - assert (v.size() == 3); - assert (v[0] == "a"); - assert (v[1] == "b"); - assert (v[2] == "c"); + assertTrue (v.size() == 3); + assertTrue (v[0] == "a"); + assertTrue (v[1] == "b"); + assertTrue (v[2] == "c"); s = "a=\"value=\\\\\\\"foo, bar\\\\\\\"\",b=foo"; MessageHeader::splitElements(s, v); - assert (v.size() == 2); - assert (v[0] == "a=\"value=\\\"foo, bar\\\"\""); - assert (v[1] == "b=foo"); + assertTrue (v.size() == 2); + assertTrue (v[0] == "a=\"value=\\\"foo, bar\\\"\""); + assertTrue (v[1] == "b=foo"); s = "a=\\\",b=\\\""; MessageHeader::splitElements(s, v); - assert (v.size() == 2); - assert (v[0] == "a=\""); - assert (v[1] == "b=\""); + assertTrue (v.size() == 2); + assertTrue (v[0] == "a=\""); + assertTrue (v[1] == "b=\""); } @@ -295,51 +295,51 @@ void MessageHeaderTest::testSplitParameters() NameValueCollection p; MessageHeader::splitParameters(s, v, p); - assert (v.empty()); - assert (p.empty()); + assertTrue (v.empty()); + assertTrue (p.empty()); s = "multipart/related"; MessageHeader::splitParameters(s, v, p); - assert (v == "multipart/related"); - assert (p.empty()); + assertTrue (v == "multipart/related"); + assertTrue (p.empty()); s = "multipart/related; boundary=MIME_boundary_01234567"; MessageHeader::splitParameters(s, v, p); - assert (v == "multipart/related"); - assert (p.size() == 1); - assert (p["boundary"] == "MIME_boundary_01234567"); + assertTrue (v == "multipart/related"); + assertTrue (p.size() == 1); + assertTrue (p["boundary"] == "MIME_boundary_01234567"); s = "multipart/related; boundary=\"MIME_boundary_76543210\""; MessageHeader::splitParameters(s, v, p); - assert (v == "multipart/related"); - assert (p.size() == 1); - assert (p["boundary"] == "MIME_boundary_76543210"); + assertTrue (v == "multipart/related"); + assertTrue (p.size() == 1); + assertTrue (p["boundary"] == "MIME_boundary_76543210"); s = "text/plain; charset=us-ascii"; MessageHeader::splitParameters(s, v, p); - assert (v == "text/plain"); - assert (p.size() == 1); - assert (p["charset"] == "us-ascii"); + assertTrue (v == "text/plain"); + assertTrue (p.size() == 1); + assertTrue (p["charset"] == "us-ascii"); s = "value; p1=foo; p2=bar"; MessageHeader::splitParameters(s, v, p); - assert (v == "value"); - assert (p.size() == 2); - assert (p["p1"] == "foo"); - assert (p["p2"] == "bar"); + assertTrue (v == "value"); + assertTrue (p.size() == 2); + assertTrue (p["p1"] == "foo"); + assertTrue (p["p2"] == "bar"); s = "value; p1=\"foo; bar\""; MessageHeader::splitParameters(s, v, p); - assert (v == "value"); - assert (p.size() == 1); - assert (p["p1"] == "foo; bar"); + assertTrue (v == "value"); + assertTrue (p.size() == 1); + assertTrue (p["p1"] == "foo; bar"); s = "value ; p1=foo ; p2=bar "; MessageHeader::splitParameters(s, v, p); - assert (v == "value"); - assert (p.size() == 2); - assert (p["p1"] == "foo"); - assert (p["p2"] == "bar"); + assertTrue (v == "value"); + assertTrue (p.size() == 2); + assertTrue (p["p1"] == "foo"); + assertTrue (p["p2"] == "bar"); } @@ -364,15 +364,15 @@ void MessageHeaderTest::testDecodeWord() { std::string coded("this is pure ASCII"); std::string decoded = MessageHeader::decodeWord(coded, "ISO-8859-1"); - assert(decoded == coded); + assertTrue (decoded == coded); coded = "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)"; decoded = MessageHeader::decodeWord(coded, "ISO-8859-1"); - assert(decoded == "(a b)"); + assertTrue (decoded == "(a b)"); coded = "Hello =?UTF-8?B?RnJhbmNpcw==?=, good bye"; decoded = MessageHeader::decodeWord(coded, "ISO-8859-1"); - assert(decoded == "Hello Francis, good bye"); + assertTrue (decoded == "Hello Francis, good bye"); } diff --git a/Net/testsuite/src/MulticastSocketTest.cpp b/Net/testsuite/src/MulticastSocketTest.cpp index c9fb2addc..7aa755fe2 100644 --- a/Net/testsuite/src/MulticastSocketTest.cpp +++ b/Net/testsuite/src/MulticastSocketTest.cpp @@ -52,11 +52,11 @@ void MulticastSocketTest::testMulticast() MulticastEchoServer echoServer; MulticastSocket ms(SocketAddress::IPv4); int n = ms.sendTo("hello", 5, echoServer.group()); - assert (n == 5); + assertTrue (n == 5); char buffer[256]; n = ms.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ms.close(); } catch (Poco::NotImplementedException e) diff --git a/Net/testsuite/src/MultipartReaderTest.cpp b/Net/testsuite/src/MultipartReaderTest.cpp index 092a19b09..5d51dfd6d 100644 --- a/Net/testsuite/src/MultipartReaderTest.cpp +++ b/Net/testsuite/src/MultipartReaderTest.cpp @@ -37,12 +37,12 @@ void MultipartReaderTest::testReadOnePart() std::string s("\r\n--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.boundary() == "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.boundary() == "MIME_boundary_01234567"); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -51,8 +51,8 @@ void MultipartReaderTest::testReadOnePart() part += (char) ch; ch = i.get(); } - assert (part == "this is part 1"); - assert (!r.hasNextPart()); + assertTrue (part == "this is part 1"); + assertTrue (!r.hasNextPart()); try { r.nextPart(h); @@ -69,11 +69,11 @@ void MultipartReaderTest::testReadTwoParts() std::string s("\r\n--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567\r\n\r\nthis is part 2\r\n\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -82,10 +82,10 @@ void MultipartReaderTest::testReadTwoParts() part += (char) ch; ch = i.get(); } - assert (part == "this is part 1"); - assert (r.hasNextPart()); + assertTrue (part == "this is part 1"); + assertTrue (r.hasNextPart()); r.nextPart(h); - assert (h.empty()); + assertTrue (h.empty()); std::istream& ii = r.stream(); part.clear(); ch = ii.get(); @@ -94,7 +94,7 @@ void MultipartReaderTest::testReadTwoParts() part += (char) ch; ch = ii.get(); } - assert (part == "this is part 2\r\n"); + assertTrue (part == "this is part 2\r\n"); try { @@ -112,11 +112,11 @@ void MultipartReaderTest::testReadEmptyLines() std::string s("\r\n--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is\r\npart 1\r\n\r\n--MIME_boundary_01234567\r\n\r\nthis\r\n\r\nis part 2\r\n\r\n\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -125,10 +125,10 @@ void MultipartReaderTest::testReadEmptyLines() part += (char) ch; ch = i.get(); } - assert (part == "this is\r\npart 1\r\n"); - assert (r.hasNextPart()); + assertTrue (part == "this is\r\npart 1\r\n"); + assertTrue (r.hasNextPart()); r.nextPart(h); - assert (h.empty()); + assertTrue (h.empty()); std::istream& ii = r.stream(); part.clear(); ch = ii.get(); @@ -137,7 +137,7 @@ void MultipartReaderTest::testReadEmptyLines() part += (char) ch; ch = ii.get(); } - assert (part == "this\r\n\r\nis part 2\r\n\r\n"); + assertTrue (part == "this\r\n\r\nis part 2\r\n\r\n"); try { @@ -158,11 +158,11 @@ void MultipartReaderTest::testReadLongPart() s.append("\r\n--MIME_boundary_01234567\r\n\r\nthis is part 2\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -171,10 +171,10 @@ void MultipartReaderTest::testReadLongPart() part += (char) ch; ch = i.get(); } - assert (part == longPart); - assert (r.hasNextPart()); + assertTrue (part == longPart); + assertTrue (r.hasNextPart()); r.nextPart(h); - assert (h.empty()); + assertTrue (h.empty()); std::istream& ii = r.stream(); part.clear(); ch = ii.get(); @@ -183,7 +183,7 @@ void MultipartReaderTest::testReadLongPart() part += (char) ch; ch = ii.get(); } - assert (part == "this is part 2"); + assertTrue (part == "this is part 2"); try { @@ -201,12 +201,12 @@ void MultipartReaderTest::testGuessBoundary() std::string s("\r\n--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (r.boundary() == "MIME_boundary_01234567"); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (r.boundary() == "MIME_boundary_01234567"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -215,8 +215,8 @@ void MultipartReaderTest::testGuessBoundary() part += (char) ch; ch = i.get(); } - assert (part == "this is part 1"); - assert (!r.hasNextPart()); + assertTrue (part == "this is part 1"); + assertTrue (!r.hasNextPart()); try { r.nextPart(h); @@ -233,11 +233,11 @@ void MultipartReaderTest::testPreamble() std::string s("this is the\r\npreamble\r\n--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -246,8 +246,8 @@ void MultipartReaderTest::testPreamble() part += (char) ch; ch = i.get(); } - assert (part == "this is part 1"); - assert (!r.hasNextPart()); + assertTrue (part == "this is part 1"); + assertTrue (!r.hasNextPart()); try { r.nextPart(h); @@ -264,7 +264,7 @@ void MultipartReaderTest::testBadBoundary() std::string s("\r\n--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567--\r\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_7654321"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; try { @@ -281,11 +281,11 @@ void MultipartReaderTest::testRobustness() std::string s("--MIME_boundary_01234567\rname1: value1\r\n\nthis is part 1\n--MIME_boundary_01234567--"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -294,8 +294,8 @@ void MultipartReaderTest::testRobustness() part += (char) ch; ch = i.get(); } - assert (part == "this is part 1"); - assert (!r.hasNextPart()); + assertTrue (part == "this is part 1"); + assertTrue (!r.hasNextPart()); try { r.nextPart(h); @@ -312,11 +312,11 @@ void MultipartReaderTest::testUnixLineEnds() std::string s("\n--MIME_boundary_01234567\nname1: value1\n\nthis is part 1\n--MIME_boundary_01234567\n\nthis is part 2\n\n--MIME_boundary_01234567--\n"); std::istringstream istr(s); MultipartReader r(istr, "MIME_boundary_01234567"); - assert (r.hasNextPart()); + assertTrue (r.hasNextPart()); MessageHeader h; r.nextPart(h); - assert (h.size() == 1); - assert (h["name1"] == "value1"); + assertTrue (h.size() == 1); + assertTrue (h["name1"] == "value1"); std::istream& i = r.stream(); int ch = i.get(); std::string part; @@ -325,10 +325,10 @@ void MultipartReaderTest::testUnixLineEnds() part += (char) ch; ch = i.get(); } - assert (part == "this is part 1"); - assert (r.hasNextPart()); + assertTrue (part == "this is part 1"); + assertTrue (r.hasNextPart()); r.nextPart(h); - assert (h.empty()); + assertTrue (h.empty()); std::istream& ii = r.stream(); part.clear(); ch = ii.get(); @@ -337,7 +337,7 @@ void MultipartReaderTest::testUnixLineEnds() part += (char) ch; ch = ii.get(); } - assert (part == "this is part 2\n"); + assertTrue (part == "this is part 2\n"); try { diff --git a/Net/testsuite/src/MultipartWriterTest.cpp b/Net/testsuite/src/MultipartWriterTest.cpp index 69d967001..6889a4500 100644 --- a/Net/testsuite/src/MultipartWriterTest.cpp +++ b/Net/testsuite/src/MultipartWriterTest.cpp @@ -34,14 +34,14 @@ void MultipartWriterTest::testWriteOnePart() { std::ostringstream ostr; MultipartWriter w(ostr, "MIME_boundary_01234567"); - assert (w.boundary() == "MIME_boundary_01234567"); + assertTrue (w.boundary() == "MIME_boundary_01234567"); MessageHeader h; h.set("name1", "value1"); w.nextPart(h); ostr << "this is part 1"; w.close(); std::string s = ostr.str(); - assert (s == "--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567--\r\n"); + assertTrue (s == "--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567--\r\n"); } @@ -58,7 +58,7 @@ void MultipartWriterTest::testWriteTwoParts() ostr << "this is part 2"; w.close(); std::string s = ostr.str(); - assert (s == "--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567\r\n\r\nthis is part 2\r\n--MIME_boundary_01234567--\r\n"); + assertTrue (s == "--MIME_boundary_01234567\r\nname1: value1\r\n\r\nthis is part 1\r\n--MIME_boundary_01234567\r\n\r\nthis is part 2\r\n--MIME_boundary_01234567--\r\n"); } @@ -67,8 +67,8 @@ void MultipartWriterTest::testBoundary() std::ostringstream ostr; MultipartWriter w(ostr); std::string boundary = w.boundary(); - assert (boundary.substr(0, 14) == "MIME_boundary_"); - assert (boundary.length() == 14 + 16); + assertTrue (boundary.substr(0, 14) == "MIME_boundary_"); + assertTrue (boundary.length() == 14 + 16); } diff --git a/Net/testsuite/src/NTPClientTest.cpp b/Net/testsuite/src/NTPClientTest.cpp index 976ee86c8..e0c772c87 100644 --- a/Net/testsuite/src/NTPClientTest.cpp +++ b/Net/testsuite/src/NTPClientTest.cpp @@ -56,7 +56,7 @@ void NTPClientTest::testTimeSync() } #endif - assert(_ntpClient.request("pool.ntp.org") > 0); + assertTrue (_ntpClient.request("pool.ntp.org") > 0); } diff --git a/Net/testsuite/src/NameValueCollectionTest.cpp b/Net/testsuite/src/NameValueCollectionTest.cpp index 0c6b760fd..4b033e6e7 100644 --- a/Net/testsuite/src/NameValueCollectionTest.cpp +++ b/Net/testsuite/src/NameValueCollectionTest.cpp @@ -33,19 +33,19 @@ void NameValueCollectionTest::testNameValueCollection() { NameValueCollection nvc; - assert (nvc.empty()); - assert (nvc.size() == 0); + assertTrue (nvc.empty()); + assertTrue (nvc.size() == 0); nvc.set("name", "value"); - assert (!nvc.empty()); - assert (nvc["name"] == "value"); - assert (nvc["Name"] == "value"); + assertTrue (!nvc.empty()); + assertTrue (nvc["name"] == "value"); + assertTrue (nvc["Name"] == "value"); nvc.set("name2", "value2"); - assert (nvc.get("name2") == "value2"); - assert (nvc.get("NAME2") == "value2"); + assertTrue (nvc.get("name2") == "value2"); + assertTrue (nvc.get("NAME2") == "value2"); - assert (nvc.size() == 2); + assertTrue (nvc.size() == 2); try { @@ -65,44 +65,44 @@ void NameValueCollectionTest::testNameValueCollection() { } - assert (nvc.get("name", "default") == "value"); - assert (nvc.get("name3", "default") == "default"); + assertTrue (nvc.get("name", "default") == "value"); + assertTrue (nvc.get("name3", "default") == "default"); - assert (nvc.has("name")); - assert (nvc.has("name2")); - assert (!nvc.has("name3")); + assertTrue (nvc.has("name")); + assertTrue (nvc.has("name2")); + assertTrue (!nvc.has("name3")); nvc.add("name3", "value3"); - assert (nvc.get("name3") == "value3"); + assertTrue (nvc.get("name3") == "value3"); nvc.add("name3", "value31"); NameValueCollection::ConstIterator it = nvc.find("Name3"); - assert (it != nvc.end()); + assertTrue (it != nvc.end()); std::string v1 = it->second; - assert (it->first == "name3"); + assertTrue (it->first == "name3"); ++it; - assert (it != nvc.end()); + assertTrue (it != nvc.end()); std::string v2 = it->second; - assert (it->first == "name3"); + assertTrue (it->first == "name3"); - assert ((v1 == "value3" && v2 == "value31") || (v1 == "value31" && v2 == "value3")); + assertTrue ((v1 == "value3" && v2 == "value31") || (v1 == "value31" && v2 == "value3")); nvc.erase("name3"); - assert (!nvc.has("name3")); - assert (nvc.find("name3") == nvc.end()); + assertTrue (!nvc.has("name3")); + assertTrue (nvc.find("name3") == nvc.end()); it = nvc.begin(); - assert (it != nvc.end()); + assertTrue (it != nvc.end()); ++it; - assert (it != nvc.end()); + assertTrue (it != nvc.end()); ++it; - assert (it == nvc.end()); + assertTrue (it == nvc.end()); nvc.clear(); - assert (nvc.empty()); + assertTrue (nvc.empty()); - assert (nvc.size() == 0); + assertTrue (nvc.size() == 0); } diff --git a/Net/testsuite/src/NetworkInterfaceTest.cpp b/Net/testsuite/src/NetworkInterfaceTest.cpp index 38deaf4d2..01f6ed96c 100644 --- a/Net/testsuite/src/NetworkInterfaceTest.cpp +++ b/Net/testsuite/src/NetworkInterfaceTest.cpp @@ -42,7 +42,7 @@ void NetworkInterfaceTest::testMap() try { NetworkInterface::Map m = NetworkInterface::map(false, false); - assert (!m.empty()); + assertTrue (!m.empty()); for (NetworkInterface::Map::const_iterator it = m.begin(); it != m.end(); ++it) { std::cout << std::endl << "=============" << std::endl; @@ -89,7 +89,7 @@ void NetworkInterfaceTest::testList() try { NetworkInterface::List list = NetworkInterface::list(false, false); - assert (!list.empty()); + assertTrue (!list.empty()); for (NetworkInterface::List::const_iterator it = list.begin(); it != list.end(); ++it) { std::cout << std::endl << "==============" << std::endl; @@ -136,7 +136,7 @@ void NetworkInterfaceTest::testForName() for (NetworkInterface::Map::const_iterator it = map.begin(); it != map.end(); ++it) { NetworkInterface ifc = NetworkInterface::forName(it->second.name()); - assert (ifc.name() == it->second.name()); + assertTrue (ifc.name() == it->second.name()); } } catch (Poco::NotImplementedException e) @@ -161,12 +161,12 @@ void NetworkInterfaceTest::testForAddress() if (it->second.supportsIPv4()) { NetworkInterface ifc = NetworkInterface::forAddress(it->second.firstAddress(IPAddress::IPv4)); - assert (ifc.firstAddress(IPAddress::IPv4) == it->second.firstAddress(IPAddress::IPv4)); + assertTrue (ifc.firstAddress(IPAddress::IPv4) == it->second.firstAddress(IPAddress::IPv4)); IPAddress addr(IPAddress::IPv4); - assert (addr.isWildcard()); + assertTrue (addr.isWildcard()); it->second.firstAddress(addr, IPAddress::IPv4); - assert (!addr.isWildcard()); + assertTrue (!addr.isWildcard()); } else { @@ -178,9 +178,9 @@ void NetworkInterfaceTest::testForAddress() catch (NotFoundException&) { } IPAddress addr(IPAddress::IPv4); - assert (addr.isWildcard()); + assertTrue (addr.isWildcard()); it->second.firstAddress(addr, IPAddress::IPv4); - assert (addr.isWildcard()); + assertTrue (addr.isWildcard()); } } } @@ -201,7 +201,7 @@ void NetworkInterfaceTest::testForIndex() for (NetworkInterface::Map::const_iterator it = map.begin(); it != map.end(); ++it) { NetworkInterface ifc = NetworkInterface::forIndex(it->second.index()); - assert (ifc.index() == it->second.index()); + assertTrue (ifc.index() == it->second.index()); } } catch (Poco::NotImplementedException e) @@ -218,12 +218,12 @@ void NetworkInterfaceTest::testMapIpOnly() try { NetworkInterface::Map m = NetworkInterface::map(true, false); - assert (!m.empty()); + assertTrue (!m.empty()); std::cout << std::endl; for (NetworkInterface::Map::const_iterator it = m.begin(); it != m.end(); ++it) { - assert(it->second.supportsIPv4() || it->second.supportsIPv6()); + assertTrue (it->second.supportsIPv4() || it->second.supportsIPv6()); std::cout << "Interface: (" << it->second.index() << ")" << std::endl; std::cout << "Address: " << it->second.address() << std::endl; NetworkInterface::MACAddress mac(it->second.macAddress()); @@ -245,10 +245,10 @@ void NetworkInterfaceTest::testMapUpOnly() try { NetworkInterface::Map m = NetworkInterface::map(false, true); - assert (!m.empty()); + assertTrue (!m.empty()); for (NetworkInterface::Map::const_iterator it = m.begin(); it != m.end(); ++it) { - assert(it->second.isUp()); + assertTrue (it->second.isUp()); } } catch (Poco::NotImplementedException e) @@ -265,9 +265,9 @@ void NetworkInterfaceTest::testListMapConformance() try { NetworkInterface::Map m = NetworkInterface::map(false, false); - assert (!m.empty()); + assertTrue (!m.empty()); NetworkInterface::List l = NetworkInterface::list(false, false); - assert (!l.empty()); + assertTrue (!l.empty()); int counter = 0; NetworkInterface::Map::const_iterator mapIt = m.begin(); @@ -286,7 +286,7 @@ void NetworkInterfaceTest::testListMapConformance() { if(listIt == l.end()) fail("wrong number of list items"); NetworkInterface::MACAddress lmac = listIt->macAddress(); - assert (lmac == mac); + assertTrue (lmac == mac); } } else @@ -296,7 +296,7 @@ void NetworkInterfaceTest::testListMapConformance() } } - assert (counter == l.size()); + assertTrue (counter == l.size()); } catch (Poco::NotImplementedException e) { diff --git a/Net/testsuite/src/OAuth10CredentialsTest.cpp b/Net/testsuite/src/OAuth10CredentialsTest.cpp index d177a3182..700ec5435 100644 --- a/Net/testsuite/src/OAuth10CredentialsTest.cpp +++ b/Net/testsuite/src/OAuth10CredentialsTest.cpp @@ -62,7 +62,7 @@ void OAuth10CredentialsTest::testCallback() creds.authenticate(request, uri); std::string auth = request.get("Authorization"); - assert (auth == "OAuth" + assertTrue (auth == "OAuth" " oauth_consumer_key=\"cChZNFj6T5R0TigYB9yd1w\"," " oauth_nonce=\"ea9ec8429b68d6b77cd5600adbbb0456\"," " oauth_signature=\"F1Li3tvehgcraF8DMJ7OyxO4w9Y%3D\"," @@ -110,7 +110,7 @@ void OAuth10CredentialsTest::testParams() creds.authenticate(request, uri, params); std::string auth = request.get("Authorization"); - assert (auth == "OAuth" + assertTrue (auth == "OAuth" " oauth_consumer_key=\"xvz1evFS4wEEPTGEFPHBog\"," " oauth_nonce=\"kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg\"," " oauth_signature=\"tnnArxj06cWHq44gCs1OSKk%2FjLY%3D\"," @@ -160,7 +160,7 @@ void OAuth10CredentialsTest::testRealm() creds.authenticate(request, uri, params); std::string auth = request.get("Authorization"); - assert (auth == "OAuth" + assertTrue (auth == "OAuth" " realm=\"Twitter API\"," " oauth_consumer_key=\"xvz1evFS4wEEPTGEFPHBog\"," " oauth_nonce=\"kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg\"," @@ -183,7 +183,7 @@ void OAuth10CredentialsTest::testPlaintext() std::string auth = request.get("Authorization"); - assert (auth == "OAuth" + assertTrue (auth == "OAuth" " oauth_consumer_key=\"consumerKey\"," " oauth_signature=\"consumerSecret%26\"," " oauth_signature_method=\"PLAINTEXT\"," @@ -206,8 +206,8 @@ void OAuth10CredentialsTest::testVerify() " oauth_version=\"1.0\""); OAuth10Credentials creds(request); - assert (creds.getConsumerKey() == "xvz1evFS4wEEPTGEFPHBog"); - assert (creds.getToken() == "370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb"); + assertTrue (creds.getConsumerKey() == "xvz1evFS4wEEPTGEFPHBog"); + assertTrue (creds.getToken() == "370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb"); creds.setConsumerSecret("kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw"); creds.setTokenSecret("LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"); @@ -215,7 +215,7 @@ void OAuth10CredentialsTest::testVerify() params.read(uri.getRawQuery()); params.read("status=Hello%20Ladies%20%2b%20Gentlemen%2c%20a%20signed%20OAuth%20request%21"); - assert (creds.verify(request, uri, params)); + assertTrue (creds.verify(request, uri, params)); } @@ -231,11 +231,11 @@ void OAuth10CredentialsTest::testVerifyPlaintext() " oauth_version=\"1.0\""); OAuth10Credentials creds(request); - assert (creds.getConsumerKey() == "consumerKey"); + assertTrue (creds.getConsumerKey() == "consumerKey"); creds.setConsumerSecret("consumerSecret"); - assert (creds.verify(request, uri)); - assert (creds.getCallback() == "http://localhost/sign-in-with-twitter/"); + assertTrue (creds.verify(request, uri)); + assertTrue (creds.getCallback() == "http://localhost/sign-in-with-twitter/"); } diff --git a/Net/testsuite/src/OAuth20CredentialsTest.cpp b/Net/testsuite/src/OAuth20CredentialsTest.cpp index dde41f805..9278ecf73 100644 --- a/Net/testsuite/src/OAuth20CredentialsTest.cpp +++ b/Net/testsuite/src/OAuth20CredentialsTest.cpp @@ -37,7 +37,7 @@ void OAuth20CredentialsTest::testAuthorize() HTTPRequest request(HTTPRequest::HTTP_GET, "/"); creds.authenticate(request); std::string auth = request.get("Authorization"); - assert (auth == "Bearer s3cr3tt0k3n"); + assertTrue (auth == "Bearer s3cr3tt0k3n"); } @@ -47,7 +47,7 @@ void OAuth20CredentialsTest::testAuthorizeCustomScheme() HTTPRequest request(HTTPRequest::HTTP_GET, "/"); creds.authenticate(request); std::string auth = request.get("Authorization"); - assert (auth == "token s3cr3tt0k3n"); + assertTrue (auth == "token s3cr3tt0k3n"); } @@ -56,7 +56,7 @@ void OAuth20CredentialsTest::testExtract() HTTPRequest request(HTTPRequest::HTTP_GET, "/"); request.set("Authorization", "Bearer s3cr3tt0k3n"); OAuth20Credentials creds(request); - assert (creds.getBearerToken() == "s3cr3tt0k3n"); + assertTrue (creds.getBearerToken() == "s3cr3tt0k3n"); } @@ -65,7 +65,7 @@ void OAuth20CredentialsTest::testExtractCustomScheme() HTTPRequest request(HTTPRequest::HTTP_GET, "/"); request.set("Authorization", "token s3cr3tt0k3n"); OAuth20Credentials creds(request, "token"); - assert (creds.getBearerToken() == "s3cr3tt0k3n"); + assertTrue (creds.getBearerToken() == "s3cr3tt0k3n"); } diff --git a/Net/testsuite/src/POP3ClientSessionTest.cpp b/Net/testsuite/src/POP3ClientSessionTest.cpp index 999805c7b..117c642ee 100644 --- a/Net/testsuite/src/POP3ClientSessionTest.cpp +++ b/Net/testsuite/src/POP3ClientSessionTest.cpp @@ -43,12 +43,12 @@ void POP3ClientSessionTest::testLogin() POP3ClientSession session("127.0.0.1", server.port()); session.login("user", "secret"); std::string cmd = server.popCommand(); - assert (cmd == "USER user"); + assertTrue (cmd == "USER user"); cmd = server.popCommand(); - assert (cmd == "PASS secret"); + assertTrue (cmd == "PASS secret"); session.close(); cmd = server.popCommand(); - assert (cmd == "QUIT"); + assertTrue (cmd == "QUIT"); } @@ -85,8 +85,8 @@ void POP3ClientSessionTest::testMessageCount() server.clearCommands(); int n = session.messageCount(); std::string cmd = server.popCommand(); - assert (cmd == "STAT"); - assert (n == 42); + assertTrue (cmd == "STAT"); + assertTrue (n == 42); session.close(); } @@ -111,14 +111,14 @@ void POP3ClientSessionTest::testList() std::vector infos; session.listMessages(infos); std::string cmd = server.popCommand(); - assert (cmd == "LIST"); - assert (infos.size() == 3); - assert (infos[0].id == 1); - assert (infos[0].size == 1234); - assert (infos[1].id == 2); - assert (infos[1].size == 5678); - assert (infos[2].id == 3); - assert (infos[2].size == 987); + assertTrue (cmd == "LIST"); + assertTrue (infos.size() == 3); + assertTrue (infos[0].id == 1); + assertTrue (infos[0].size == 1234); + assertTrue (infos[1].id == 2); + assertTrue (infos[1].size == 5678); + assertTrue (infos[2].id == 3); + assertTrue (infos[2].size == 987); session.close(); } @@ -150,9 +150,9 @@ void POP3ClientSessionTest::testRetrieveMessage() MailMessage message; session.retrieveMessage(1, message); std::string cmd = server.popCommand(); - assert (cmd == "RETR 1"); + assertTrue (cmd == "RETR 1"); - assert (message.getContent() == + assertTrue (message.getContent() == "Hello Jane,\r\n" "\r\n" "blah blah blah...\r\n" @@ -186,10 +186,10 @@ void POP3ClientSessionTest::testRetrieveHeader() MessageHeader header; session.retrieveHeader(1, header); std::string cmd = server.popCommand(); - assert (cmd == "TOP 1 0"); - assert (header.get("From") == "john.doe@no.where"); - assert (header.get("To") == "jane.doe@no.where"); - assert (header.get("Subject") == "test"); + assertTrue (cmd == "TOP 1 0"); + assertTrue (header.get("From") == "john.doe@no.where"); + assertTrue (header.get("To") == "jane.doe@no.where"); + assertTrue (header.get("Subject") == "test"); session.close(); } @@ -229,17 +229,17 @@ void POP3ClientSessionTest::testRetrieveMessages() MessageHeader header; session.retrieveHeader(1, header); std::string cmd = server.popCommand(); - assert (cmd == "TOP 1 0"); - assert (header.get("From") == "john.doe@no.where"); - assert (header.get("To") == "jane.doe@no.where"); - assert (header.get("Subject") == "test"); + assertTrue (cmd == "TOP 1 0"); + assertTrue (header.get("From") == "john.doe@no.where"); + assertTrue (header.get("To") == "jane.doe@no.where"); + assertTrue (header.get("Subject") == "test"); MailMessage message; session.retrieveMessage(2, message); cmd = server.popCommand(); - assert (cmd == "RETR 2"); + assertTrue (cmd == "RETR 2"); - assert (message.getContent() == + assertTrue (message.getContent() == "Hello Jane,\r\n" "\r\n" "blah blah blah...\r\n" @@ -264,7 +264,7 @@ void POP3ClientSessionTest::testDeleteMessage() server.clearCommands(); session.deleteMessage(42); std::string cmd = server.popCommand(); - assert (cmd == "DELE 42"); + assertTrue (cmd == "DELE 42"); session.close(); } diff --git a/Net/testsuite/src/PollSetTest.cpp b/Net/testsuite/src/PollSetTest.cpp index c385a6c45..f076b120c 100644 --- a/Net/testsuite/src/PollSetTest.cpp +++ b/Net/testsuite/src/PollSetTest.cpp @@ -57,8 +57,8 @@ void PollSetTest::testPoll() Stopwatch sw; sw.start(); Timespan timeout(1000000); - assert (ps.poll(timeout).empty()); - assert (sw.elapsed() >= 900000); + assertTrue (ps.poll(timeout).empty()); + assertTrue (sw.elapsed() >= 900000); sw.restart(); ps.add(ss2, PollSet::POLL_READ); @@ -66,10 +66,10 @@ void PollSetTest::testPoll() // ss1 must be writable, if polled for ps.update(ss1, PollSet::POLL_READ | PollSet::POLL_WRITE); PollSet::SocketModeMap sm = ps.poll(timeout); - assert (sm.find(ss1) != sm.end()); - assert (sm.find(ss2) == sm.end()); - assert (sm.find(ss1)->second == PollSet::POLL_WRITE); - assert (sw.elapsed() < 100000); + assertTrue (sm.find(ss1) != sm.end()); + assertTrue (sm.find(ss2) == sm.end()); + assertTrue (sm.find(ss1)->second == PollSet::POLL_WRITE); + assertTrue (sw.elapsed() < 100000); ps.update(ss1, PollSet::POLL_READ); @@ -77,38 +77,38 @@ void PollSetTest::testPoll() char buffer[256]; sw.restart(); sm = ps.poll(timeout); - assert (sm.find(ss1) != sm.end()); - assert (sm.find(ss2) == sm.end()); - assert (sm.find(ss1)->second == PollSet::POLL_READ); - assert (sw.elapsed() < 100000); + assertTrue (sm.find(ss1) != sm.end()); + assertTrue (sm.find(ss2) == sm.end()); + assertTrue (sm.find(ss1)->second == PollSet::POLL_READ); + assertTrue (sw.elapsed() < 100000); int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss2.sendBytes("HELLO", 5); sw.restart(); sm = ps.poll(timeout); - assert (sm.find(ss1) == sm.end()); - assert (sm.find(ss2) != sm.end()); - assert (sm.find(ss2)->second == PollSet::POLL_READ); - assert (sw.elapsed() < 100000); + assertTrue (sm.find(ss1) == sm.end()); + assertTrue (sm.find(ss2) != sm.end()); + assertTrue (sm.find(ss2)->second == PollSet::POLL_READ); + assertTrue (sw.elapsed() < 100000); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "HELLO"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "HELLO"); ps.remove(ss2); ss2.sendBytes("HELLO", 5); sw.restart(); sm = ps.poll(timeout); - assert (sm.empty()); + assertTrue (sm.empty()); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "HELLO"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "HELLO"); ss1.close(); ss2.close(); diff --git a/Net/testsuite/src/QuotedPrintableTest.cpp b/Net/testsuite/src/QuotedPrintableTest.cpp index cf6dbfe4c..fb7daf98a 100644 --- a/Net/testsuite/src/QuotedPrintableTest.cpp +++ b/Net/testsuite/src/QuotedPrintableTest.cpp @@ -43,7 +43,7 @@ void QuotedPrintableTest::testEncode() "\200\201\r\n"; encoder.close(); std::string txt = ostr.str(); - assert (txt == "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\r\n" + assertTrue (txt == "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\r\n" "Proin id odio sit amet metus dignissim porttitor.=20\r\n" "Aliquam nulla ipsum, faucibus non, aliquet quis, aliquet id, felis. Proin s=\r\n" "odales molestie arcu.\r\n" @@ -70,7 +70,7 @@ void QuotedPrintableTest::testDecode() str += (char) c; c = decoder.get(); } - assert (str == "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\r\n" + assertTrue (str == "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\r\n" "Proin id odio sit amet metus dignissim porttitor. \r\n" "Aliquam nulla ipsum, faucibus non, aliquet quis, aliquet id, felis. Proin sodales molestie arcu.\r\n" "\t\bSed suscipit, mi in facilisis feugiat, \t \r\n" diff --git a/Net/testsuite/src/RawSocketTest.cpp b/Net/testsuite/src/RawSocketTest.cpp index 146b9ab10..1f634b5ab 100644 --- a/Net/testsuite/src/RawSocketTest.cpp +++ b/Net/testsuite/src/RawSocketTest.cpp @@ -48,7 +48,7 @@ void RawSocketTest::testEchoIPv4() rs.connect(sa); int n = rs.sendBytes("hello", 5); - assert (5 == n); + assertTrue (5 == n); char buffer[256] = ""; unsigned char* ptr = (unsigned char*) buffer; @@ -57,8 +57,8 @@ void RawSocketTest::testEchoIPv4() int shift = ((buffer[0] & 0x0F) * 4); ptr += shift; - assert (5 == (n - shift)); - assert ("hello" == std::string((char*)ptr, 5)); + assertTrue (5 == (n - shift)); + assertTrue ("hello" == std::string((char*)ptr, 5)); rs.close(); } @@ -69,7 +69,7 @@ void RawSocketTest::testSendToReceiveFromIPv4() RawSocket rs(IPAddress::IPv4); int n = rs.sendTo("hello", 5, SocketAddress("127.0.0.1", 0)); - assert (n == 5); + assertTrue (n == 5); char buffer[256] = ""; unsigned char* ptr = (unsigned char*) buffer; @@ -78,8 +78,8 @@ void RawSocketTest::testSendToReceiveFromIPv4() int shift = ((buffer[0] & 0x0F) * 4); ptr += shift; - assert ((n - shift) == 5); - assert ("hello" == std::string((char*)ptr, 5)); + assertTrue ((n - shift) == 5); + assertTrue ("hello" == std::string((char*)ptr, 5)); rs.close(); } diff --git a/Net/testsuite/src/SMTPClientSessionTest.cpp b/Net/testsuite/src/SMTPClientSessionTest.cpp index 5263afd14..e4894ad00 100644 --- a/Net/testsuite/src/SMTPClientSessionTest.cpp +++ b/Net/testsuite/src/SMTPClientSessionTest.cpp @@ -43,10 +43,10 @@ void SMTPClientSessionTest::testLoginEHLO() SMTPClientSession session("127.0.0.1", server.port()); session.login("localhost"); std::string cmd = server.popCommand(); - assert (cmd == "EHLO localhost"); + assertTrue (cmd == "EHLO localhost"); session.close(); cmd = server.popCommand(); - assert (cmd == "QUIT"); + assertTrue (cmd == "QUIT"); } @@ -60,12 +60,12 @@ void SMTPClientSessionTest::testLoginHELO() SMTPClientSession session("127.0.0.1", server.port()); session.login("localhost"); std::string cmd = server.popCommand(); - assert (cmd == "EHLO localhost"); + assertTrue (cmd == "EHLO localhost"); cmd = server.popCommand(); - assert (cmd == "HELO localhost"); + assertTrue (cmd == "HELO localhost"); session.close(); cmd = server.popCommand(); - assert (cmd == "QUIT"); + assertTrue (cmd == "QUIT"); } @@ -108,31 +108,31 @@ void SMTPClientSessionTest::testSend() server.clearCommands(); session.sendMessage(message); std::string cmd = server.popCommandWait(); - assert (cmd == "MAIL FROM: "); + assertTrue (cmd == "MAIL FROM: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "DATA"); + assertTrue (cmd == "DATA"); cmd = server.popCommandWait(); - assert (cmd.substr(0, 4) == "Date"); + assertTrue (cmd.substr(0, 4) == "Date"); cmd = server.popCommandWait(); - assert (cmd == "Content-Type: text/plain"); + assertTrue (cmd == "Content-Type: text/plain"); cmd = server.popCommandWait(); - assert (cmd == "From: john.doe@no.where"); + assertTrue (cmd == "From: john.doe@no.where"); cmd = server.popCommandWait(); - assert (cmd == "Subject: Test Message"); + assertTrue (cmd == "Subject: Test Message"); cmd = server.popCommandWait(); - assert (cmd == "Content-Transfer-Encoding: quoted-printable"); + assertTrue (cmd == "Content-Transfer-Encoding: quoted-printable"); cmd = server.popCommandWait(); - assert (cmd == "To: Jane Doe "); + assertTrue (cmd == "To: Jane Doe "); cmd = server.popCommandWait(); - assert (cmd == "Hello"); + assertTrue (cmd == "Hello"); cmd = server.popCommandWait(); - assert (cmd == "blah blah"); + assertTrue (cmd == "blah blah"); cmd = server.popCommandWait(); - assert (cmd == "John"); + assertTrue (cmd == "John"); cmd = server.popCommandWait(); - assert (cmd == "."); + assertTrue (cmd == "."); session.close(); } @@ -167,37 +167,37 @@ void SMTPClientSessionTest::testSendMultiRecipient() server.clearCommands(); session.sendMessage(message); std::string cmd = server.popCommandWait(); - assert (cmd == "MAIL FROM: "); + assertTrue (cmd == "MAIL FROM: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "DATA"); + assertTrue (cmd == "DATA"); cmd = server.popCommandWait(); - assert (cmd.substr(0, 4) == "Date"); + assertTrue (cmd.substr(0, 4) == "Date"); cmd = server.popCommandWait(); - assert (cmd == "Content-Type: text/plain"); + assertTrue (cmd == "Content-Type: text/plain"); cmd = server.popCommandWait(); - assert (cmd == "From: john.doe@no.where"); + assertTrue (cmd == "From: john.doe@no.where"); cmd = server.popCommandWait(); - assert (cmd == "Subject: Test Message"); + assertTrue (cmd == "Subject: Test Message"); cmd = server.popCommandWait(); - assert (cmd == "Content-Transfer-Encoding: quoted-printable"); + assertTrue (cmd == "Content-Transfer-Encoding: quoted-printable"); cmd = server.popCommandWait(); - assert (cmd == "To: Jane Doe "); + assertTrue (cmd == "To: Jane Doe "); cmd = server.popCommandWait(); - assert (cmd == "CC: Jack Doe "); + assertTrue (cmd == "CC: Jack Doe "); cmd = server.popCommandWait(); - assert (cmd == "Hello"); + assertTrue (cmd == "Hello"); cmd = server.popCommandWait(); - assert (cmd == "blah blah"); + assertTrue (cmd == "blah blah"); cmd = server.popCommandWait(); - assert (cmd == "John"); + assertTrue (cmd == "John"); cmd = server.popCommandWait(); - assert (cmd == "."); + assertTrue (cmd == "."); session.close(); } @@ -237,37 +237,37 @@ void SMTPClientSessionTest::testMultiSeparateRecipient() server.clearCommands(); session.sendMessage(message, recipients); std::string cmd = server.popCommandWait(); - assert (cmd == "MAIL FROM: "); + assertTrue (cmd == "MAIL FROM: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "RCPT TO: "); + assertTrue (cmd == "RCPT TO: "); cmd = server.popCommandWait(); - assert (cmd == "DATA"); + assertTrue (cmd == "DATA"); cmd = server.popCommandWait(); - assert (cmd.substr(0, 4) == "Date"); + assertTrue (cmd.substr(0, 4) == "Date"); cmd = server.popCommandWait(); - assert (cmd == "Content-Type: text/plain"); + assertTrue (cmd == "Content-Type: text/plain"); cmd = server.popCommandWait(); - assert (cmd == "From: john.doe@no.where"); + assertTrue (cmd == "From: john.doe@no.where"); cmd = server.popCommandWait(); - assert (cmd == "Subject: Test Message"); + assertTrue (cmd == "Subject: Test Message"); cmd = server.popCommandWait(); - assert (cmd == "Content-Transfer-Encoding: quoted-printable"); + assertTrue (cmd == "Content-Transfer-Encoding: quoted-printable"); cmd = server.popCommandWait(); - assert (cmd == "To: Jane Doe "); + assertTrue (cmd == "To: Jane Doe "); cmd = server.popCommandWait(); - assert (cmd == "CC: Jack Doe , Joe Doe "); + assertTrue (cmd == "CC: Jack Doe , Joe Doe "); cmd = server.popCommandWait(); - assert (cmd == "Hello"); + assertTrue (cmd == "Hello"); cmd = server.popCommandWait(); - assert (cmd == "blah blah"); + assertTrue (cmd == "blah blah"); cmd = server.popCommandWait(); - assert (cmd == "John"); + assertTrue (cmd == "John"); cmd = server.popCommandWait(); - assert (cmd == "."); + assertTrue (cmd == "."); session.close(); } diff --git a/Net/testsuite/src/SocketAddressTest.cpp b/Net/testsuite/src/SocketAddressTest.cpp index a5f7d9ca2..652df2c72 100644 --- a/Net/testsuite/src/SocketAddressTest.cpp +++ b/Net/testsuite/src/SocketAddressTest.cpp @@ -38,24 +38,24 @@ SocketAddressTest::~SocketAddressTest() void SocketAddressTest::testSocketAddress() { SocketAddress wild; - assert (wild.host().isWildcard()); - assert (wild.port() == 0); + assertTrue (wild.host().isWildcard()); + assertTrue (wild.port() == 0); SocketAddress sa1("192.168.1.100", 100); - assert (sa1.af() == AF_INET); - assert (sa1.family() == SocketAddress::IPv4); - assert (sa1.host().toString() == "192.168.1.100"); - assert (sa1.port() == 100); - assert (sa1.toString() == "192.168.1.100:100"); + assertTrue (sa1.af() == AF_INET); + assertTrue (sa1.family() == SocketAddress::IPv4); + assertTrue (sa1.host().toString() == "192.168.1.100"); + assertTrue (sa1.port() == 100); + assertTrue (sa1.toString() == "192.168.1.100:100"); SocketAddress sa2("192.168.1.100", "100"); - assert (sa2.host().toString() == "192.168.1.100"); - assert (sa2.port() == 100); + assertTrue (sa2.host().toString() == "192.168.1.100"); + assertTrue (sa2.port() == 100); #if !defined(_WIN32_WCE) SocketAddress sa3("192.168.1.100", "ftp"); - assert (sa3.host().toString() == "192.168.1.100"); - assert (sa3.port() == 21); + assertTrue (sa3.host().toString() == "192.168.1.100"); + assertTrue (sa3.port() == 21); #endif try @@ -68,8 +68,8 @@ void SocketAddressTest::testSocketAddress() } SocketAddress sa4("pocoproject.org", 80); - assert (sa4.host().toString() == "162.209.7.4"); - assert (sa4.port() == 80); + assertTrue (sa4.host().toString() == "162.209.7.4"); + assertTrue (sa4.port() == 80); try { @@ -93,12 +93,12 @@ void SocketAddressTest::testSocketAddress() } SocketAddress sa7("192.168.2.120:88"); - assert (sa7.host().toString() == "192.168.2.120"); - assert (sa7.port() == 88); + assertTrue (sa7.host().toString() == "192.168.2.120"); + assertTrue (sa7.port() == 88); SocketAddress sa8("[192.168.2.120]:88"); - assert (sa8.host().toString() == "192.168.2.120"); - assert (sa8.port() == 88); + assertTrue (sa8.host().toString() == "192.168.2.120"); + assertTrue (sa8.port() == 88); try { @@ -119,16 +119,16 @@ void SocketAddressTest::testSocketAddress() } SocketAddress sa10("www6.pocoproject.org", 80); - assert (sa10.host().toString() == "162.209.7.4" || sa10.host().toString() == "[2001:4801:7819:74:be76:4eff:fe10:6b73]"); + assertTrue (sa10.host().toString() == "162.209.7.4" || sa10.host().toString() == "[2001:4801:7819:74:be76:4eff:fe10:6b73]"); SocketAddress sa11(SocketAddress::IPv4, "www6.pocoproject.org", 80); - assert (sa11.host().toString() == "162.209.7.4"); + assertTrue (sa11.host().toString() == "162.209.7.4"); #ifdef POCO_HAVE_IPv6 try { SocketAddress sa12(SocketAddress::IPv6, "www6.pocoproject.org", 80); - assert (sa12.host().toString() == "2001:4801:7819:74:be76:4eff:fe10:6b73"); + assertTrue (sa12.host().toString() == "2001:4801:7819:74:be76:4eff:fe10:6b73"); } catch (AddressFamilyMismatchException&) { @@ -142,13 +142,13 @@ void SocketAddressTest::testSocketRelationals() { SocketAddress sa1("192.168.1.100", 100); SocketAddress sa2("192.168.1.100:100"); - assert (sa1 == sa2); + assertTrue (sa1 == sa2); SocketAddress sa3("192.168.1.101", "99"); - assert (sa2 < sa3); + assertTrue (sa2 < sa3); SocketAddress sa4("192.168.1.101", "102"); - assert (sa3 < sa4); + assertTrue (sa3 < sa4); } @@ -156,18 +156,18 @@ void SocketAddressTest::testSocketAddress6() { #ifdef POCO_HAVE_IPv6 SocketAddress sa1("FE80::E6CE:8FFF:FE4A:EDD0", 100); - assert (sa1.af() == AF_INET6); - assert (sa1.family() == SocketAddress::IPv6); - assert (sa1.host().toString() == "fe80::e6ce:8fff:fe4a:edd0"); - assert (sa1.port() == 100); - assert (sa1.toString() == "[fe80::e6ce:8fff:fe4a:edd0]:100"); + assertTrue (sa1.af() == AF_INET6); + assertTrue (sa1.family() == SocketAddress::IPv6); + assertTrue (sa1.host().toString() == "fe80::e6ce:8fff:fe4a:edd0"); + assertTrue (sa1.port() == 100); + assertTrue (sa1.toString() == "[fe80::e6ce:8fff:fe4a:edd0]:100"); SocketAddress sa2("[FE80::E6CE:8FFF:FE4A:EDD0]:100"); - assert (sa2.af() == AF_INET6); - assert (sa2.family() == SocketAddress::IPv6); - assert (sa2.host().toString() == "fe80::e6ce:8fff:fe4a:edd0"); - assert (sa2.port() == 100); - assert (sa2.toString() == "[fe80::e6ce:8fff:fe4a:edd0]:100"); + assertTrue (sa2.af() == AF_INET6); + assertTrue (sa2.family() == SocketAddress::IPv6); + assertTrue (sa2.host().toString() == "fe80::e6ce:8fff:fe4a:edd0"); + assertTrue (sa2.port() == 100); + assertTrue (sa2.toString() == "[fe80::e6ce:8fff:fe4a:edd0]:100"); #endif } @@ -176,21 +176,21 @@ void SocketAddressTest::testSocketAddressUnixLocal() { #ifdef POCO_OS_FAMILY_UNIX SocketAddress sa1(SocketAddress::UNIX_LOCAL, "/tmp/sock1"); - assert (sa1.af() == AF_UNIX); - assert (sa1.family() == SocketAddress::UNIX_LOCAL); - assert (sa1.toString() == "/tmp/sock1"); + assertTrue (sa1.af() == AF_UNIX); + assertTrue (sa1.family() == SocketAddress::UNIX_LOCAL); + assertTrue (sa1.toString() == "/tmp/sock1"); SocketAddress sa2(SocketAddress::UNIX_LOCAL, "/tmp/sock2"); - assert (sa1 != sa2); - assert (sa1 < sa2); + assertTrue (sa1 != sa2); + assertTrue (sa1 < sa2); SocketAddress sa3(SocketAddress::UNIX_LOCAL, "/tmp/sock1"); - assert (sa1 == sa3); - assert (!(sa1 < sa3)); + assertTrue (sa1 == sa3); + assertTrue (!(sa1 < sa3)); SocketAddress sa4("/tmp/sock1"); - assert (sa1 == sa4); - assert (sa4.toString() == "/tmp/sock1"); + assertTrue (sa1 == sa4); + assertTrue (sa4.toString() == "/tmp/sock1"); #endif } diff --git a/Net/testsuite/src/SocketReactorTest.cpp b/Net/testsuite/src/SocketReactorTest.cpp index 54653fb25..96e8fcfca 100644 --- a/Net/testsuite/src/SocketReactorTest.cpp +++ b/Net/testsuite/src/SocketReactorTest.cpp @@ -318,10 +318,10 @@ void SocketReactorTest::testSocketReactor() ClientServiceHandler::resetData(); reactor.run(); std::string data(ClientServiceHandler::data()); - assert (data.size() == 1024); - assert (!ClientServiceHandler::readableError()); - assert (!ClientServiceHandler::writableError()); - assert (!ClientServiceHandler::timeoutError()); + assertTrue (data.size() == 1024); + assertTrue (!ClientServiceHandler::readableError()); + assertTrue (!ClientServiceHandler::writableError()); + assertTrue (!ClientServiceHandler::timeoutError()); } @@ -338,10 +338,10 @@ void SocketReactorTest::testSetSocketReactor() ClientServiceHandler::resetData(); reactor.run(); std::string data(ClientServiceHandler::data()); - assert(data.size() == 1024); - assert(!ClientServiceHandler::readableError()); - assert(!ClientServiceHandler::writableError()); - assert(!ClientServiceHandler::timeoutError()); + assertTrue (data.size() == 1024); + assertTrue (!ClientServiceHandler::readableError()); + assertTrue (!ClientServiceHandler::writableError()); + assertTrue (!ClientServiceHandler::timeoutError()); } @@ -360,10 +360,10 @@ void SocketReactorTest::testParallelSocketReactor() ClientServiceHandler::resetData(); reactor.run(); std::string data(ClientServiceHandler::data()); - assert (data.size() == 4096); - assert (!ClientServiceHandler::readableError()); - assert (!ClientServiceHandler::writableError()); - assert (!ClientServiceHandler::timeoutError()); + assertTrue (data.size() == 4096); + assertTrue (!ClientServiceHandler::readableError()); + assertTrue (!ClientServiceHandler::writableError()); + assertTrue (!ClientServiceHandler::timeoutError()); } @@ -373,11 +373,11 @@ void SocketReactorTest::testSocketConnectorFail() reactor.setTimeout(Poco::Timespan(3, 0)); SocketAddress sa("192.168.168.192", 12345); FailConnector connector(sa, reactor); - assert (!connector.failed()); - assert (!connector.shutdown()); + assertTrue (!connector.failed()); + assertTrue (!connector.shutdown()); reactor.run(); - assert (connector.failed()); - assert (connector.shutdown()); + assertTrue (connector.failed()); + assertTrue (connector.shutdown()); } @@ -391,7 +391,7 @@ void SocketReactorTest::testSocketConnectorTimeout() SocketAddress sa("127.0.0.1", ss.address().port()); SocketConnector connector(sa, reactor); reactor.run(); - assert (ClientServiceHandler::timeout()); + assertTrue (ClientServiceHandler::timeout()); } diff --git a/Net/testsuite/src/SocketStreamTest.cpp b/Net/testsuite/src/SocketStreamTest.cpp index 2e685ca0f..dad5a1e5c 100644 --- a/Net/testsuite/src/SocketStreamTest.cpp +++ b/Net/testsuite/src/SocketStreamTest.cpp @@ -50,16 +50,16 @@ void SocketStreamTest::testStreamEcho() ss.connect(SocketAddress("127.0.0.1", echoServer.port())); SocketStream str(ss); str << "hello"; - assert (str.good()); + assertTrue (str.good()); str.flush(); - assert (str.good()); + assertTrue (str.good()); ss.shutdownSend(); char buffer[5]; str.read(buffer, sizeof(buffer)); - assert (str.good()); - assert (str.gcount() == 5); - assert (std::string(buffer, 5) == "hello"); + assertTrue (str.good()); + assertTrue (str.gcount() == 5); + assertTrue (std::string(buffer, 5) == "hello"); ss.close(); } @@ -76,16 +76,16 @@ void SocketStreamTest::testLargeStreamEcho() ss.setReceiveBufferSize(msgSize); std::string payload(msgSize, 'x'); str << payload; - assert (str.good()); + assertTrue (str.good()); str.flush(); - assert (str.good()); + assertTrue (str.good()); ss.shutdownSend(); - assert (str.gcount() == 0); + assertTrue (str.gcount() == 0); char buffer[msgSize]; str.read(buffer, sizeof(buffer)); - assert (str.good()); - assert (str.gcount() == msgSize); + assertTrue (str.good()); + assertTrue (str.gcount() == msgSize); ss.close(); } @@ -100,21 +100,21 @@ void SocketStreamTest::testEOF() ss.connect(SocketAddress("127.0.0.1", echoServer.port())); str << "hello"; - assert (str.good()); + assertTrue (str.good()); str.flush(); - assert (str.good()); + assertTrue (str.good()); ss.shutdownSend(); char buffer[5]; str.read(buffer, sizeof(buffer)); - assert (str.good()); - assert (str.gcount() == 5); - assert (std::string(buffer, 5) == "hello"); + assertTrue (str.good()); + assertTrue (str.gcount() == 5); + assertTrue (std::string(buffer, 5) == "hello"); } int c = str.get(); - assert (c == -1); - assert (str.eof()); + assertTrue (c == -1); + assertTrue (str.eof()); ss.close(); } diff --git a/Net/testsuite/src/SocketTest.cpp b/Net/testsuite/src/SocketTest.cpp index 406a87c13..e42bcb666 100644 --- a/Net/testsuite/src/SocketTest.cpp +++ b/Net/testsuite/src/SocketTest.cpp @@ -55,11 +55,11 @@ void SocketTest::testEcho() StreamSocket ss; ss.connect(SocketAddress("127.0.0.1", echoServer.port())); int n = ss.sendBytes("hello", 5); - assert (n == 5); + assertTrue (n == 5); char buffer[256]; n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -72,19 +72,19 @@ void SocketTest::testPoll() Stopwatch sw; sw.start(); Timespan timeout(1000000); - assert (!ss.poll(timeout, Socket::SELECT_READ)); - assert (sw.elapsed() >= 900000); + assertTrue (!ss.poll(timeout, Socket::SELECT_READ)); + assertTrue (sw.elapsed() >= 900000); sw.restart(); - assert (ss.poll(timeout, Socket::SELECT_WRITE)); - assert (sw.elapsed() < 100000); + assertTrue (ss.poll(timeout, Socket::SELECT_WRITE)); + assertTrue (sw.elapsed() < 100000); ss.sendBytes("hello", 5); char buffer[256]; sw.restart(); - assert (ss.poll(timeout, Socket::SELECT_READ)); - assert (sw.elapsed() < 100000); + assertTrue (ss.poll(timeout, Socket::SELECT_READ)); + assertTrue (sw.elapsed() < 100000); int n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -97,12 +97,12 @@ void SocketTest::testAvailable() Timespan timeout(1000000); ss.sendBytes("hello", 5); char buffer[256]; - assert (ss.poll(timeout, Socket::SELECT_READ)); + assertTrue (ss.poll(timeout, Socket::SELECT_READ)); int av = ss.available(); - assert (av > 0 && av <= 5); + assertTrue (av > 0 && av <= 5); int n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -121,40 +121,40 @@ void SocketTest::testFIFOBuffer() f.readable += delegate(this, &SocketTest::onReadable); f.writable += delegate(this, &SocketTest::onWritable); - assert(0 == _notToReadable); - assert(0 == _readableToNot); - assert(0 == _notToWritable); - assert(0 == _writableToNot); + assertTrue (0 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (0 == _writableToNot); f.write(b); - assert(1 == _notToReadable); - assert(0 == _readableToNot); - assert(0 == _notToWritable); - assert(1 == _writableToNot); + assertTrue (1 == _notToReadable); + assertTrue (0 == _readableToNot); + assertTrue (0 == _notToWritable); + assertTrue (1 == _writableToNot); EchoServer echoServer; StreamSocket ss; ss.connect(SocketAddress("127.0.0.1", echoServer.port())); int n = ss.sendBytes(f); - assert (n == 5); - assert(1 == _notToReadable); - assert(1 == _readableToNot); - assert(1 == _notToWritable); - assert(1 == _writableToNot); - assert (f.isEmpty()); + assertTrue (n == 5); + assertTrue (1 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (1 == _writableToNot); + assertTrue (f.isEmpty()); n = ss.receiveBytes(f); - assert (n == 5); + assertTrue (n == 5); - assert(2 == _notToReadable); - assert(1 == _readableToNot); - assert(1 == _notToWritable); - assert(2 == _writableToNot); + assertTrue (2 == _notToReadable); + assertTrue (1 == _readableToNot); + assertTrue (1 == _notToWritable); + assertTrue (2 == _writableToNot); - assert (f[0] == 'h'); - assert (f[1] == 'e'); - assert (f[2] == 'l'); - assert (f[3] == 'l'); - assert (f[4] == 'o'); + assertTrue (f[0] == 'h'); + assertTrue (f[1] == 'e'); + assertTrue (f[2] == 'l'); + assertTrue (f[3] == 'l'); + assertTrue (f[4] == 'o'); f.readable -= delegate(this, &SocketTest::onReadable); f.writable -= delegate(this, &SocketTest::onWritable); @@ -225,15 +225,15 @@ void SocketTest::testNonBlocking() ss.setBlocking(false); Timespan timeout(1000000); - assert (ss.poll(timeout, Socket::SELECT_WRITE)); + assertTrue (ss.poll(timeout, Socket::SELECT_WRITE)); int n = ss.sendBytes("hello", 5); - assert (n == 5); + assertTrue (n == 5); char buffer[256]; - assert (ss.poll(timeout, Socket::SELECT_READ)); + assertTrue (ss.poll(timeout, Socket::SELECT_READ)); n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -247,8 +247,8 @@ void SocketTest::testAddress() StreamSocket ss; ss.connect(SocketAddress("127.0.0.1", serv.address().port())); StreamSocket css = serv.acceptConnection(); - assert (css.peerAddress().host() == ss.address().host()); - assert (css.peerAddress().port() == ss.address().port()); + assertTrue (css.peerAddress().host() == ss.address().host()); + assertTrue (css.peerAddress().port() == ss.address().port()); } @@ -258,12 +258,12 @@ void SocketTest::testAssign() StreamSocket ss1; StreamSocket ss2; - assert (ss1 != ss2); + assertTrue (ss1 != ss2); StreamSocket ss3(ss1); - assert (ss1 == ss3); + assertTrue (ss1 == ss3); ss3 = ss2; - assert (ss1 != ss3); - assert (ss2 == ss3); + assertTrue (ss1 != ss3); + assertTrue (ss2 == ss3); try { @@ -318,7 +318,7 @@ void SocketTest::testTimeout() std::cout << "actual receive timeout: " << timeout1.totalMicroseconds() << std::endl; // some socket implementations adjust the timeout value - // assert (ss.getReceiveTimeout() == timeout); + // assertTrue (ss.getReceiveTimeout() == timeout); Stopwatch sw; try { @@ -330,7 +330,7 @@ void SocketTest::testTimeout() catch (TimeoutException&) { } - assert (sw.elapsed() < 1000000); + assertTrue (sw.elapsed() < 1000000); timeout0 = ss.getSendTimeout(); ss.setSendTimeout(timeout); @@ -338,7 +338,7 @@ void SocketTest::testTimeout() std::cout << "original send timeout: " << timeout0.totalMicroseconds() << std::endl; std::cout << "requested send timeout: " << timeout.totalMicroseconds() << std::endl; std::cout << "actual send timeout: " << timeout1.totalMicroseconds() << std::endl; - // assert (ss.getSendTimeout() == timeout); + // assertTrue (ss.getSendTimeout() == timeout); } @@ -375,25 +375,25 @@ void SocketTest::testOptions() bool f; int t; ss.getLinger(f, t); - assert (f && t == 20); + assertTrue (f && t == 20); ss.setLinger(false, 0); ss.getLinger(f, t); - assert (!f); + assertTrue (!f); ss.setNoDelay(true); - assert (ss.getNoDelay()); + assertTrue (ss.getNoDelay()); ss.setNoDelay(false); - assert (!ss.getNoDelay()); + assertTrue (!ss.getNoDelay()); ss.setKeepAlive(true); - assert (ss.getKeepAlive()); + assertTrue (ss.getKeepAlive()); ss.setKeepAlive(false); - assert (!ss.getKeepAlive()); + assertTrue (!ss.getKeepAlive()); ss.setOOBInline(true); - assert (ss.getOOBInline()); + assertTrue (ss.getOOBInline()); ss.setOOBInline(false); - assert (!ss.getOOBInline()); + assertTrue (!ss.getOOBInline()); } @@ -410,10 +410,10 @@ void SocketTest::testSelect() Socket::SocketList exceptList; readList.push_back(ss); - assert (Socket::select(readList, writeList, exceptList, timeout) == 0); - assert (readList.empty()); - assert (writeList.empty()); - assert (exceptList.empty()); + assertTrue (Socket::select(readList, writeList, exceptList, timeout) == 0); + assertTrue (readList.empty()); + assertTrue (writeList.empty()); + assertTrue (exceptList.empty()); ss.sendBytes("hello", 5); @@ -421,15 +421,15 @@ void SocketTest::testSelect() readList.push_back(ss); writeList.push_back(ss); - assert (Socket::select(readList, writeList, exceptList, timeout) == 2); - assert (!readList.empty()); - assert (!writeList.empty()); - assert (exceptList.empty()); + assertTrue (Socket::select(readList, writeList, exceptList, timeout) == 2); + assertTrue (!readList.empty()); + assertTrue (!writeList.empty()); + assertTrue (exceptList.empty()); char buffer[256]; int n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); } @@ -449,10 +449,10 @@ void SocketTest::testSelect2() readList.push_back(ss1); readList.push_back(ss2); - assert (Socket::select(readList, writeList, exceptList, timeout) == 0); - assert (readList.empty()); - assert (writeList.empty()); - assert (exceptList.empty()); + assertTrue (Socket::select(readList, writeList, exceptList, timeout) == 0); + assertTrue (readList.empty()); + assertTrue (writeList.empty()); + assertTrue (exceptList.empty()); ss1.sendBytes("hello", 5); @@ -460,28 +460,28 @@ void SocketTest::testSelect2() readList.push_back(ss1); readList.push_back(ss2); - assert (Socket::select(readList, writeList, exceptList, timeout) == 1); + assertTrue (Socket::select(readList, writeList, exceptList, timeout) == 1); - assert (readList.size() == 1); - assert (readList[0] == ss1); - assert (writeList.empty()); - assert (exceptList.empty()); + assertTrue (readList.size() == 1); + assertTrue (readList[0] == ss1); + assertTrue (writeList.empty()); + assertTrue (exceptList.empty()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); + assertTrue (n == 5); readList.clear(); writeList.clear(); exceptList.clear(); writeList.push_back(ss1); writeList.push_back(ss2); - assert (Socket::select(readList, writeList, exceptList, timeout) == 2); - assert (readList.empty()); - assert (writeList.size() == 2); - assert (writeList[0] == ss1); - assert (writeList[1] == ss2); - assert (exceptList.empty()); + assertTrue (Socket::select(readList, writeList, exceptList, timeout) == 2); + assertTrue (readList.empty()); + assertTrue (writeList.size() == 2); + assertTrue (writeList[0] == ss1); + assertTrue (writeList[1] == ss2); + assertTrue (exceptList.empty()); ss1.close(); ss2.close(); @@ -496,7 +496,7 @@ void SocketTest::testSelect3() Timespan timeout(1000); int rc = Socket::select(readList, writeList, exceptList, timeout); - assert (rc == 0); + assertTrue (rc == 0); } @@ -514,11 +514,11 @@ void SocketTest::testEchoUnixLocal() StreamSocket ss(SocketAddress::UNIX_LOCAL); ss.connect(localAddr); int n = ss.sendBytes("hello", 5); - assert (n == 5); + assertTrue (n == 5); char buffer[256]; n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 5); - assert (std::string(buffer, n) == "hello"); + assertTrue (n == 5); + assertTrue (std::string(buffer, n) == "hello"); ss.close(); socketFile.remove(); #endif diff --git a/Net/testsuite/src/SyslogTest.cpp b/Net/testsuite/src/SyslogTest.cpp index c6aaa61af..41c2aae11 100644 --- a/Net/testsuite/src/SyslogTest.cpp +++ b/Net/testsuite/src/SyslogTest.cpp @@ -129,19 +129,19 @@ void SyslogTest::testListener() listener->open(); CachingChannel cl; listener->addChannel(&cl); - assert (cl.getCurrentSize() == 0); + assertTrue (cl.getCurrentSize() == 0); Poco::Message msg("asource", "amessage", Poco::Message::PRIO_CRITICAL); channel->log(msg); Poco::Thread::sleep(1000); listener->close(); channel->close(); - assert (cl.getCurrentSize() == 1); + assertTrue (cl.getCurrentSize() == 1); std::vector msgs; cl.getMessages(msgs, 0, 10); - assert (msgs.size() == 1); - assert (msgs[0].getSource() == "asource"); - assert (msgs[0].getText() == "amessage"); - assert (msgs[0].getPriority() == Poco::Message::PRIO_CRITICAL); + assertTrue (msgs.size() == 1); + assertTrue (msgs[0].getSource() == "asource"); + assertTrue (msgs[0].getText() == "amessage"); + assertTrue (msgs[0].getPriority() == Poco::Message::PRIO_CRITICAL); } @@ -155,11 +155,11 @@ void SyslogTest::testChannelOpenClose() CachingChannel cl; listener->addChannel(&cl); - assert (cl.getCurrentSize() == 0); + assertTrue (cl.getCurrentSize() == 0); Poco::Message msg1("source1", "message1", Poco::Message::PRIO_CRITICAL); channel->log(msg1); Poco::Thread::sleep(1000); - assert (cl.getCurrentSize() == 1); + assertTrue (cl.getCurrentSize() == 1); channel->close(); // close and re-open channel channel->open(); @@ -167,20 +167,20 @@ void SyslogTest::testChannelOpenClose() Poco::Message msg2("source2", "message2", Poco::Message::PRIO_ERROR); channel->log(msg2); Poco::Thread::sleep(1000); - assert (cl.getCurrentSize() == 2); + assertTrue (cl.getCurrentSize() == 2); listener->close(); std::vector msgs; cl.getMessages(msgs, 0, 10); - assert (msgs.size() == 2); + assertTrue (msgs.size() == 2); - assert (msgs[1].getSource() == "source1"); - assert (msgs[1].getText() == "message1"); - assert (msgs[1].getPriority() == Poco::Message::PRIO_CRITICAL); + assertTrue (msgs[1].getSource() == "source1"); + assertTrue (msgs[1].getText() == "message1"); + assertTrue (msgs[1].getPriority() == Poco::Message::PRIO_CRITICAL); - assert (msgs[0].getSource() == "source2"); - assert (msgs[0].getText() == "message2"); - assert (msgs[0].getPriority() == Poco::Message::PRIO_ERROR); + assertTrue (msgs[0].getSource() == "source2"); + assertTrue (msgs[0].getText() == "message2"); + assertTrue (msgs[0].getPriority() == Poco::Message::PRIO_ERROR); } @@ -194,20 +194,20 @@ void SyslogTest::testOldBSD() listener->open(); CachingChannel cl; listener->addChannel(&cl); - assert (cl.getCurrentSize() == 0); + assertTrue (cl.getCurrentSize() == 0); Poco::Message msg("asource", "amessage", Poco::Message::PRIO_CRITICAL); channel->log(msg); Poco::Thread::sleep(1000); listener->close(); channel->close(); - assert (cl.getCurrentSize() == 1); + assertTrue (cl.getCurrentSize() == 1); std::vector msgs; cl.getMessages(msgs, 0, 10); - assert (msgs.size() == 1); + assertTrue (msgs.size() == 1); // the source is lost with old BSD messages: we only send the local host name! - assert (msgs[0].getSource() == Poco::Net::DNS::thisHost().name()); - assert (msgs[0].getText() == "amessage"); - assert (msgs[0].getPriority() == Poco::Message::PRIO_CRITICAL); + assertTrue (msgs[0].getSource() == Poco::Net::DNS::thisHost().name()); + assertTrue (msgs[0].getText() == "amessage"); + assertTrue (msgs[0].getPriority() == Poco::Message::PRIO_CRITICAL); } @@ -220,7 +220,7 @@ void SyslogTest::testStructuredData() listener->open(); CachingChannel cl; listener->addChannel(&cl); - assert(cl.getCurrentSize() == 0); + assertTrue (cl.getCurrentSize() == 0); Poco::Message msg1("asource", "amessage", Poco::Message::PRIO_CRITICAL); msg1.set("structured-data", "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]"); channel->log(msg1); @@ -230,20 +230,20 @@ void SyslogTest::testStructuredData() Poco::Thread::sleep(1000); listener->close(); channel->close(); - assert(cl.getCurrentSize() == 2); + assertTrue (cl.getCurrentSize() == 2); std::vector msgs; cl.getMessages(msgs, 0, 10); - assert(msgs.size() == 2); + assertTrue (msgs.size() == 2); - assert(msgs[0].getSource() == "asource"); - assert(msgs[0].getText() == "amessage"); - assert(msgs[0].getPriority() == Poco::Message::PRIO_CRITICAL); - assert(msgs[0].get("structured-data") == "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"]"); + assertTrue (msgs[0].getSource() == "asource"); + assertTrue (msgs[0].getText() == "amessage"); + assertTrue (msgs[0].getPriority() == Poco::Message::PRIO_CRITICAL); + assertTrue (msgs[0].get("structured-data") == "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@32473 class=\"high\"]"); - assert(msgs[1].getSource() == "asource"); - assert(msgs[1].getText() == "amessage"); - assert(msgs[1].getPriority() == Poco::Message::PRIO_CRITICAL); - assert(msgs[1].get("structured-data") == "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]"); + assertTrue (msgs[1].getSource() == "asource"); + assertTrue (msgs[1].getText() == "amessage"); + assertTrue (msgs[1].getPriority() == Poco::Message::PRIO_CRITICAL); + assertTrue (msgs[1].get("structured-data") == "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]"); } diff --git a/Net/testsuite/src/TCPServerTest.cpp b/Net/testsuite/src/TCPServerTest.cpp index 59fa83cc7..97f715622 100644 --- a/Net/testsuite/src/TCPServerTest.cpp +++ b/Net/testsuite/src/TCPServerTest.cpp @@ -87,10 +87,10 @@ void TCPServerTest::testOneConnection() { TCPServer srv(new TCPServerConnectionFactoryImpl()); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", srv.socket().address().port()); StreamSocket ss1(sa); @@ -98,15 +98,15 @@ void TCPServerTest::testOneConnection() ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); ss1.close(); Thread::sleep(1000); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -114,10 +114,10 @@ void TCPServerTest::testTwoConnections() { TCPServer srv(new TCPServerConnectionFactoryImpl()); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", srv.socket().address().port()); StreamSocket ss1(sa); @@ -128,27 +128,27 @@ void TCPServerTest::testTwoConnections() char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); - assert (srv.currentConnections() == 2); - assert (srv.currentThreads() == 2); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (srv.currentConnections() == 2); + assertTrue (srv.currentThreads() == 2); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(1000); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss2.close(); Thread::sleep(1000); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -161,11 +161,11 @@ void TCPServerTest::testMultiConnections() pParams->setThreadIdleTime(100); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs, pParams); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.maxThreads() >= 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.maxThreads() >= 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", svs.address().port()); StreamSocket ss1(sa); @@ -180,65 +180,65 @@ void TCPServerTest::testMultiConnections() char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss3.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss4.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 4); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 4); StreamSocket ss5(sa); Thread::sleep(200); - assert (srv.queuedConnections() == 1); + assertTrue (srv.queuedConnections() == 1); StreamSocket ss6(sa); Thread::sleep(200); - assert (srv.queuedConnections() == 2); + assertTrue (srv.queuedConnections() == 2); ss1.close(); Thread::sleep(2000); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 1); - assert (srv.totalConnections() == 5); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 1); + assertTrue (srv.totalConnections() == 5); ss2.close(); Thread::sleep(2000); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss3.close(); Thread::sleep(2000); - assert (srv.currentConnections() == 3); - assert (srv.currentThreads() == 3); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 3); + assertTrue (srv.currentThreads() == 3); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss4.close(); Thread::sleep(2000); - assert (srv.currentConnections() == 2); - assert (srv.currentThreads() == 2); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 2); + assertTrue (srv.currentThreads() == 2); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss5.close(); ss6.close(); Thread::sleep(1000); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -249,7 +249,7 @@ void TCPServerTest::testThreadCapacity() pParams->setMaxThreads(64); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs, pParams); srv.start(); - assert (srv.maxThreads() >= 64); + assertTrue (srv.maxThreads() >= 64); } @@ -258,10 +258,10 @@ void TCPServerTest::testFilter() TCPServer srv(new TCPServerConnectionFactoryImpl()); srv.setConnectionFilter(new RejectFilter); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", srv.socket().address().port()); StreamSocket ss(sa); @@ -269,11 +269,11 @@ void TCPServerTest::testFilter() char buffer[256]; int n = ss.receiveBytes(buffer, sizeof(buffer)); - assert (n == 0); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (n == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); } diff --git a/Net/testsuite/src/WebSocketTest.cpp b/Net/testsuite/src/WebSocketTest.cpp index b832d8d1b..0e9f57546 100644 --- a/Net/testsuite/src/WebSocketTest.cpp +++ b/Net/testsuite/src/WebSocketTest.cpp @@ -128,25 +128,25 @@ void WebSocketTest::testWebSocket() char buffer[1024]; int flags; int n = ws.receiveFrame(buffer, sizeof(buffer), flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); - assert (flags == WebSocket::FRAME_TEXT); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_TEXT); for (int i = 2; i < 20; i++) { payload.assign(i, 'x'); ws.sendFrame(payload.data(), (int) payload.size()); n = ws.receiveFrame(buffer, sizeof(buffer), flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); - assert (flags == WebSocket::FRAME_TEXT); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_TEXT); ws.sendFrame(payload.data(), (int) payload.size()); Poco::Buffer pocobuffer(0); n = ws.receiveFrame(pocobuffer, flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), pocobuffer.begin(), 0, n) == 0); - assert (flags == WebSocket::FRAME_TEXT); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), pocobuffer.begin(), 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_TEXT); } for (int i = 125; i < 129; i++) @@ -154,36 +154,36 @@ void WebSocketTest::testWebSocket() payload.assign(i, 'x'); ws.sendFrame(payload.data(), (int) payload.size()); n = ws.receiveFrame(buffer, sizeof(buffer), flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); - assert (flags == WebSocket::FRAME_TEXT); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_TEXT); ws.sendFrame(payload.data(), (int) payload.size()); Poco::Buffer pocobuffer(0); n = ws.receiveFrame(pocobuffer, flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), pocobuffer.begin(), 0, n) == 0); - assert (flags == WebSocket::FRAME_TEXT); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), pocobuffer.begin(), 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_TEXT); } payload = "Hello, world!"; ws.sendFrame(payload.data(), (int) payload.size()); n = ws.receiveFrame(buffer, sizeof(buffer), flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); - assert (flags == WebSocket::FRAME_TEXT); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_TEXT); payload = "Hello, universe!"; ws.sendFrame(payload.data(), (int) payload.size(), WebSocket::FRAME_BINARY); n = ws.receiveFrame(buffer, sizeof(buffer), flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); - assert (flags == WebSocket::FRAME_BINARY); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assertTrue (flags == WebSocket::FRAME_BINARY); ws.shutdown(); n = ws.receiveFrame(buffer, sizeof(buffer), flags); - assert (n == 2); - assert ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE); + assertTrue (n == 2); + assertTrue ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE); server.stop(); } @@ -218,8 +218,8 @@ void WebSocketTest::testWebSocketLarge() n += ws.receiveFrame(buffer + n, sizeof(buffer) - n, flags); } while (n > 0 && n < msgSize); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); } @@ -246,16 +246,16 @@ void WebSocketTest::testOneLargeFrame(int msgSize) int n; n = ws.receiveFrame(buffer.begin(), buffer.size(), flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), buffer.begin(), 0, n) == 0); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), buffer.begin(), 0, n) == 0); ws.sendFrame(payload.data(), msgSize); Poco::Buffer pocobuffer(0); n = ws.receiveFrame(pocobuffer, flags); - assert (n == payload.size()); - assert (payload.compare(0, payload.size(), pocobuffer.begin(), 0, n) == 0); + assertTrue (n == payload.size()); + assertTrue (payload.compare(0, payload.size(), pocobuffer.begin(), 0, n) == 0); } diff --git a/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp b/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp index 31cab74b7..8607ad81a 100644 --- a/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp +++ b/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp @@ -95,11 +95,11 @@ void HTTPSClientSessionTest::testGetSmall() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); } @@ -111,11 +111,11 @@ void HTTPSClientSessionTest::testGetLarge() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); } @@ -127,10 +127,10 @@ void HTTPSClientSessionTest::testHead() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; - assert (StreamCopier::copyStream(rs, ostr) == 0); + assertTrue (StreamCopier::copyStream(rs, ostr) == 0); } @@ -144,10 +144,10 @@ void HTTPSClientSessionTest::testPostSmallIdentity() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == body.length()); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -162,10 +162,10 @@ void HTTPSClientSessionTest::testPostLargeIdentity() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == body.length()); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -179,11 +179,11 @@ void HTTPSClientSessionTest::testPostSmallChunked() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -197,11 +197,11 @@ void HTTPSClientSessionTest::testPostLargeChunked() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -222,11 +222,11 @@ void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } srv.stop(); } @@ -247,42 +247,42 @@ void HTTPSClientSessionTest::testKeepAlive() s.sendRequest(request); HTTPResponse response; std::istream& rs1 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response.getContentType() == "text/plain"); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getKeepAlive()); std::ostringstream ostr1; - assert (StreamCopier::copyStream(rs1, ostr1) == 0); + assertTrue (StreamCopier::copyStream(rs1, ostr1) == 0); request.setMethod(HTTPRequest::HTTP_GET); request.setURI("/small"); s.sendRequest(request); std::istream& rs2 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response.getKeepAlive()); std::ostringstream ostr2; StreamCopier::copyStream(rs2, ostr2); - assert (ostr2.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr2.str() == HTTPSTestServer::SMALL_BODY); request.setMethod(HTTPRequest::HTTP_GET); request.setURI("/large"); s.sendRequest(request); std::istream& rs3 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getChunkedTransferEncoding()); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getKeepAlive()); std::ostringstream ostr3; StreamCopier::copyStream(rs3, ostr3); - assert (ostr3.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr3.str() == HTTPSTestServer::LARGE_BODY); request.setMethod(HTTPRequest::HTTP_HEAD); request.setURI("/large"); s.sendRequest(request); std::istream& rs4 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); - assert (!response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getKeepAlive()); std::ostringstream ostr4; - assert (StreamCopier::copyStream(rs4, ostr4) == 0); + assertTrue (StreamCopier::copyStream(rs4, ostr4) == 0); } @@ -297,8 +297,8 @@ void HTTPSClientSessionTest::testInterop() std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); std::string str(ostr.str()); - assert (str == "This is a test file for NetSSL.\n"); - assert (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); + assertTrue (str == "This is a test file for NetSSL.\n"); + assertTrue (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); } @@ -318,8 +318,8 @@ void HTTPSClientSessionTest::testProxy() std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); std::string str(ostr.str()); - assert (str == "This is a test file for NetSSL.\n"); - assert (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); + assertTrue (str == "This is a test file for NetSSL.\n"); + assertTrue (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); } @@ -362,11 +362,11 @@ void HTTPSClientSessionTest::testCachedSession() Session::Ptr pSession1 = s1.sslSession(); HTTPResponse response1; std::istream& rs1 = s1.receiveResponse(response1); - assert (response1.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response1.getContentType() == "text/plain"); + assertTrue (response1.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response1.getContentType() == "text/plain"); std::ostringstream ostr1; StreamCopier::copyStream(rs1, ostr1); - assert (ostr1.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr1.str() == HTTPSTestServer::SMALL_BODY); HTTPSClientSession s2("127.0.0.1", srv.port(), pClientContext, pSession1); HTTPRequest request2(HTTPRequest::HTTP_GET, "/small"); @@ -374,26 +374,26 @@ void HTTPSClientSessionTest::testCachedSession() Session::Ptr pSession2 = s2.sslSession(); HTTPResponse response2; std::istream& rs2 = s2.receiveResponse(response2); - assert (response2.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response2.getContentType() == "text/plain"); + assertTrue (response2.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response2.getContentType() == "text/plain"); std::ostringstream ostr2; StreamCopier::copyStream(rs2, ostr2); - assert (ostr2.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr2.str() == HTTPSTestServer::SMALL_BODY); - assert (pSession1 == pSession2); + assertTrue (pSession1 == pSession2); HTTPRequest request3(HTTPRequest::HTTP_GET, "/small"); s2.sendRequest(request3); Session::Ptr pSession3 = s2.sslSession(); HTTPResponse response3; std::istream& rs3 = s2.receiveResponse(response3); - assert (response3.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response3.getContentType() == "text/plain"); + assertTrue (response3.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response3.getContentType() == "text/plain"); std::ostringstream ostr3; StreamCopier::copyStream(rs3, ostr3); - assert (ostr3.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr3.str() == HTTPSTestServer::SMALL_BODY); - assert (pSession1 == pSession3); + assertTrue (pSession1 == pSession3); Thread::sleep(15000); // wait for session to expire pServerContext->flushSessionCache(); @@ -403,13 +403,13 @@ void HTTPSClientSessionTest::testCachedSession() Session::Ptr pSession4 = s2.sslSession(); HTTPResponse response4; std::istream& rs4 = s2.receiveResponse(response4); - assert (response4.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response4.getContentType() == "text/plain"); + assertTrue (response4.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response4.getContentType() == "text/plain"); std::ostringstream ostr4; StreamCopier::copyStream(rs4, ostr4); - assert (ostr4.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr4.str() == HTTPSTestServer::SMALL_BODY); - assert (pSession1 != pSession4); + assertTrue (pSession1 != pSession4); } @@ -421,11 +421,11 @@ void HTTPSClientSessionTest::testUnknownContentLength() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); } @@ -437,12 +437,12 @@ void HTTPSClientSessionTest::testServerAbort() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPSTestServer::SMALL_BODY); - assert ( dynamic_cast( + assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); + assertTrue ( dynamic_cast( s.networkException()) != NULL ); } diff --git a/NetSSL_OpenSSL/testsuite/src/HTTPSServerTest.cpp b/NetSSL_OpenSSL/testsuite/src/HTTPSServerTest.cpp index 7a27f2d96..7c906f4a2 100644 --- a/NetSSL_OpenSSL/testsuite/src/HTTPSServerTest.cpp +++ b/NetSSL_OpenSSL/testsuite/src/HTTPSServerTest.cpp @@ -140,9 +140,9 @@ void HTTPSServerTest::testIdentityRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -163,10 +163,10 @@ void HTTPSServerTest::testChunkedRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (rbody == body); } @@ -188,20 +188,20 @@ void HTTPSServerTest::testIdentityRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getKeepAlive()); + assertTrue (rbody == body); body.assign(1000, 'y'); request.setContentLength((int) body.length()); request.setKeepAlive(false); cs.sendRequest(request) << body; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (!response.getKeepAlive()); - assert (rbody == body);} + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body);} void HTTPSServerTest::testChunkedRequestKeepAlive() @@ -222,20 +222,20 @@ void HTTPSServerTest::testChunkedRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (rbody == body); body.assign(1000, 'y'); request.setKeepAlive(false); cs.sendRequest(request) << body; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } @@ -257,9 +257,9 @@ void HTTPSServerTest::test100Continue() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -277,9 +277,9 @@ void HTTPSServerTest::testRedirect() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_FOUND); - assert (response.get("Location") == "http://www.appinf.com/"); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_FOUND); + assertTrue (response.get("Location") == "http://www.appinf.com/"); + assertTrue (rbody.empty()); } @@ -297,9 +297,9 @@ void HTTPSServerTest::testAuth() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED); - assert (response.get("WWW-Authenticate") == "Basic realm=\"/auth\""); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED); + assertTrue (response.get("WWW-Authenticate") == "Basic realm=\"/auth\""); + assertTrue (rbody.empty()); } @@ -317,8 +317,8 @@ void HTTPSServerTest::testNotImpl() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_NOT_IMPLEMENTED); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_NOT_IMPLEMENTED); + assertTrue (rbody.empty()); } diff --git a/NetSSL_OpenSSL/testsuite/src/HTTPSStreamFactoryTest.cpp b/NetSSL_OpenSSL/testsuite/src/HTTPSStreamFactoryTest.cpp index be8ce5654..9b1c80cb7 100644 --- a/NetSSL_OpenSSL/testsuite/src/HTTPSStreamFactoryTest.cpp +++ b/NetSSL_OpenSSL/testsuite/src/HTTPSStreamFactoryTest.cpp @@ -54,7 +54,7 @@ void HTTPSStreamFactoryTest::testNoRedirect() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); } @@ -71,7 +71,7 @@ void HTTPSStreamFactoryTest::testEmptyPath() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); } @@ -88,7 +88,7 @@ void HTTPSStreamFactoryTest::testRedirect() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); } @@ -107,7 +107,7 @@ void HTTPSStreamFactoryTest::testProxy() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str().length() > 0); + assertTrue (ostr.str().length() > 0); } diff --git a/NetSSL_OpenSSL/testsuite/src/TCPServerTest.cpp b/NetSSL_OpenSSL/testsuite/src/TCPServerTest.cpp index fe80294ac..8948178a8 100644 --- a/NetSSL_OpenSSL/testsuite/src/TCPServerTest.cpp +++ b/NetSSL_OpenSSL/testsuite/src/TCPServerTest.cpp @@ -88,10 +88,10 @@ void TCPServerTest::testOneConnection() SecureServerSocket svs(0); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", svs.address().port()); SecureStreamSocket ss1(sa); @@ -99,15 +99,15 @@ void TCPServerTest::testOneConnection() ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -116,10 +116,10 @@ void TCPServerTest::testTwoConnections() SecureServerSocket svs(0); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", svs.address().port()); SecureStreamSocket ss1(sa); @@ -130,27 +130,27 @@ void TCPServerTest::testTwoConnections() char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); - assert (srv.currentConnections() == 2); - assert (srv.currentThreads() == 2); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (srv.currentConnections() == 2); + assertTrue (srv.currentThreads() == 2); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss2.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -163,10 +163,10 @@ void TCPServerTest::testMultiConnections() pParams->setThreadIdleTime(100); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs, pParams); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", svs.address().port()); SecureStreamSocket ss1(sa); @@ -181,69 +181,69 @@ void TCPServerTest::testMultiConnections() char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss3.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss4.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 4); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 4); SecureStreamSocket ss5; ss5.setLazyHandshake(); ss5.connect(sa); Thread::sleep(200); - assert (srv.queuedConnections() == 1); + assertTrue (srv.queuedConnections() == 1); SecureStreamSocket ss6; ss6.setLazyHandshake(); ss6.connect(sa); Thread::sleep(200); - assert (srv.queuedConnections() == 2); + assertTrue (srv.queuedConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 1); - assert (srv.totalConnections() == 5); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 1); + assertTrue (srv.totalConnections() == 5); ss2.close(); Thread::sleep(300); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss3.close(); Thread::sleep(300); - assert (srv.currentConnections() == 3); - assert (srv.currentThreads() == 3); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 3); + assertTrue (srv.currentThreads() == 3); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss4.close(); Thread::sleep(300); - assert (srv.currentConnections() == 2); - assert (srv.currentThreads() == 2); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 2); + assertTrue (srv.currentThreads() == 2); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss5.close(); ss6.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -252,10 +252,10 @@ void TCPServerTest::testReuseSocket() SecureServerSocket svs(0); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("127.0.0.1", svs.address().port()); SecureStreamSocket ss1(sa); @@ -263,27 +263,27 @@ void TCPServerTest::testReuseSocket() ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); ss1.connect(sa); ss1.sendBytes(data.data(), (int) data.size()); n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -310,10 +310,10 @@ void TCPServerTest::testReuseSession() SecureServerSocket svs(0, 64, pServerContext); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); Context::Ptr pClientContext = new Context( Context::CLIENT_USE, @@ -328,56 +328,56 @@ void TCPServerTest::testReuseSession() SocketAddress sa("127.0.0.1", svs.address().port()); SecureStreamSocket ss1(sa, pClientContext); - assert (!ss1.sessionWasReused()); + assertTrue (!ss1.sessionWasReused()); std::string data("hello, world"); ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); Session::Ptr pSession = ss1.currentSession(); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); ss1.useSession(pSession); ss1.connect(sa); - assert (ss1.sessionWasReused()); - assert (ss1.currentSession() == pSession); + assertTrue (ss1.sessionWasReused()); + assertTrue (ss1.currentSession() == pSession); ss1.sendBytes(data.data(), (int) data.size()); n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); Thread::sleep(15000); // wait for session to expire pServerContext->flushSessionCache(); ss1.useSession(pSession); ss1.connect(sa); - assert (!ss1.sessionWasReused()); - assert (ss1.currentSession() != pSession); + assertTrue (!ss1.sessionWasReused()); + assertTrue (ss1.currentSession() != pSession); ss1.sendBytes(data.data(), (int) data.size()); n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 3); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 3); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } diff --git a/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp b/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp index cc14c9882..397974231 100644 --- a/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp +++ b/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp @@ -94,11 +94,11 @@ void HTTPSClientSessionTest::testGetSmall() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); } @@ -110,11 +110,11 @@ void HTTPSClientSessionTest::testGetLarge() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); } @@ -126,10 +126,10 @@ void HTTPSClientSessionTest::testHead() s.sendRequest(request); HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); + assertTrue (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); std::ostringstream ostr; - assert (StreamCopier::copyStream(rs, ostr) == 0); + assertTrue (StreamCopier::copyStream(rs, ostr) == 0); } @@ -143,10 +143,10 @@ void HTTPSClientSessionTest::testPostSmallIdentity() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == body.length()); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -161,10 +161,10 @@ void HTTPSClientSessionTest::testPostLargeIdentity() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getContentLength() == body.length()); + assertTrue (response.getContentLength() == body.length()); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -178,11 +178,11 @@ void HTTPSClientSessionTest::testPostSmallChunked() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -196,11 +196,11 @@ void HTTPSClientSessionTest::testPostLargeChunked() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } @@ -221,11 +221,11 @@ void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive() s.sendRequest(request) << body; HTTPResponse response; std::istream& rs = s.receiveResponse(response); - assert (response.getChunkedTransferEncoding()); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); - assert (ostr.str() == body); + assertTrue (ostr.str() == body); } srv.stop(); } @@ -246,42 +246,42 @@ void HTTPSClientSessionTest::testKeepAlive() s.sendRequest(request); HTTPResponse response; std::istream& rs1 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response.getContentType() == "text/plain"); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getKeepAlive()); std::ostringstream ostr1; - assert (StreamCopier::copyStream(rs1, ostr1) == 0); + assertTrue (StreamCopier::copyStream(rs1, ostr1) == 0); request.setMethod(HTTPRequest::HTTP_GET); request.setURI("/small"); s.sendRequest(request); std::istream& rs2 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response.getKeepAlive()); std::ostringstream ostr2; StreamCopier::copyStream(rs2, ostr2); - assert (ostr2.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr2.str() == HTTPSTestServer::SMALL_BODY); request.setMethod(HTTPRequest::HTTP_GET); request.setURI("/large"); s.sendRequest(request); std::istream& rs3 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getChunkedTransferEncoding()); - assert (response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (response.getKeepAlive()); std::ostringstream ostr3; StreamCopier::copyStream(rs3, ostr3); - assert (ostr3.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr3.str() == HTTPSTestServer::LARGE_BODY); request.setMethod(HTTPRequest::HTTP_HEAD); request.setURI("/large"); s.sendRequest(request); std::istream& rs4 = s.receiveResponse(response); - assert (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); - assert (response.getContentType() == "text/plain"); - assert (!response.getKeepAlive()); + assertTrue (response.getContentLength() == HTTPSTestServer::LARGE_BODY.length()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getKeepAlive()); std::ostringstream ostr4; - assert (StreamCopier::copyStream(rs4, ostr4) == 0); + assertTrue (StreamCopier::copyStream(rs4, ostr4) == 0); } @@ -297,14 +297,14 @@ void HTTPSClientSessionTest::testInterop() std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); std::string str(ostr.str()); - assert (str == "This is a test file for NetSSL.\n"); + assertTrue (str == "This is a test file for NetSSL.\n"); std::string commonName; std::set domainNames; cert.extractNames(commonName, domainNames); - assert (commonName == "secure.appinf.com" || commonName == "*.appinf.com"); - assert (domainNames.find("appinf.com") != domainNames.end() + assertTrue (commonName == "secure.appinf.com" || commonName == "*.appinf.com"); + assertTrue (domainNames.find("appinf.com") != domainNames.end() || domainNames.find("*.appinf.com") != domainNames.end()); } @@ -325,8 +325,8 @@ void HTTPSClientSessionTest::testProxy() std::ostringstream ostr; StreamCopier::copyStream(rs, ostr); std::string str(ostr.str()); - assert (str == "This is a test file for NetSSL.\n"); - assert (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); + assertTrue (str == "This is a test file for NetSSL.\n"); + assertTrue (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); } @@ -357,11 +357,11 @@ void HTTPSClientSessionTest::testCachedSession() Session::Ptr pSession1 = s1.sslSession(); HTTPResponse response1; std::istream& rs1 = s1.receiveResponse(response1); - assert (response1.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response1.getContentType() == "text/plain"); + assertTrue (response1.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response1.getContentType() == "text/plain"); std::ostringstream ostr1; StreamCopier::copyStream(rs1, ostr1); - assert (ostr1.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr1.str() == HTTPSTestServer::SMALL_BODY); HTTPSClientSession s2("localhost", srv.port(), pClientContext, pSession1); HTTPRequest request2(HTTPRequest::HTTP_GET, "/small"); @@ -369,26 +369,26 @@ void HTTPSClientSessionTest::testCachedSession() Session::Ptr pSession2 = s2.sslSession(); HTTPResponse response2; std::istream& rs2 = s2.receiveResponse(response2); - assert (response2.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response2.getContentType() == "text/plain"); + assertTrue (response2.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response2.getContentType() == "text/plain"); std::ostringstream ostr2; StreamCopier::copyStream(rs2, ostr2); - assert (ostr2.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr2.str() == HTTPSTestServer::SMALL_BODY); - assert (pSession1 == pSession2); + assertTrue (pSession1 == pSession2); HTTPRequest request3(HTTPRequest::HTTP_GET, "/small"); s2.sendRequest(request3); Session::Ptr pSession3 = s2.sslSession(); HTTPResponse response3; std::istream& rs3 = s2.receiveResponse(response3); - assert (response3.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response3.getContentType() == "text/plain"); + assertTrue (response3.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response3.getContentType() == "text/plain"); std::ostringstream ostr3; StreamCopier::copyStream(rs3, ostr3); - assert (ostr3.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr3.str() == HTTPSTestServer::SMALL_BODY); - assert (pSession1 == pSession3); + assertTrue (pSession1 == pSession3); Thread::sleep(15000); // wait for session to expire //pServerContext->flushSessionCache(); @@ -398,13 +398,13 @@ void HTTPSClientSessionTest::testCachedSession() Session::Ptr pSession4 = s2.sslSession(); HTTPResponse response4; std::istream& rs4 = s2.receiveResponse(response4); - assert (response4.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); - assert (response4.getContentType() == "text/plain"); + assertTrue (response4.getContentLength() == HTTPSTestServer::SMALL_BODY.length()); + assertTrue (response4.getContentType() == "text/plain"); std::ostringstream ostr4; StreamCopier::copyStream(rs4, ostr4); - assert (ostr4.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr4.str() == HTTPSTestServer::SMALL_BODY); - assert (pSession1 != pSession4); + assertTrue (pSession1 != pSession4); } diff --git a/NetSSL_Win/testsuite/src/HTTPSServerTest.cpp b/NetSSL_Win/testsuite/src/HTTPSServerTest.cpp index 2a29cae24..240c86591 100644 --- a/NetSSL_Win/testsuite/src/HTTPSServerTest.cpp +++ b/NetSSL_Win/testsuite/src/HTTPSServerTest.cpp @@ -141,9 +141,9 @@ void HTTPSServerTest::testIdentityRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -164,10 +164,10 @@ void HTTPSServerTest::testChunkedRequest() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (rbody == body); } @@ -189,20 +189,20 @@ void HTTPSServerTest::testIdentityRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getKeepAlive()); + assertTrue (rbody == body); body.assign(1000, 'y'); request.setContentLength((int) body.length()); request.setKeepAlive(false); cs.sendRequest(request) << body; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } @@ -224,20 +224,20 @@ void HTTPSServerTest::testChunkedRequestKeepAlive() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (rbody == body); body.assign(1000, 'y'); request.setKeepAlive(false); cs.sendRequest(request) << body; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); - assert (response.getContentType() == "text/plain"); - assert (response.getChunkedTransferEncoding()); - assert (!response.getKeepAlive()); - assert (rbody == body); + assertTrue (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (response.getChunkedTransferEncoding()); + assertTrue (!response.getKeepAlive()); + assertTrue (rbody == body); } @@ -259,9 +259,9 @@ void HTTPSServerTest::test100Continue() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getContentLength() == body.size()); - assert (response.getContentType() == "text/plain"); - assert (rbody == body); + assertTrue (response.getContentLength() == body.size()); + assertTrue (response.getContentType() == "text/plain"); + assertTrue (rbody == body); } @@ -279,9 +279,9 @@ void HTTPSServerTest::testRedirect() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_FOUND); - assert (response.get("Location") == "http://www.appinf.com/"); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_FOUND); + assertTrue (response.get("Location") == "http://www.appinf.com/"); + assertTrue (rbody.empty()); } @@ -299,9 +299,9 @@ void HTTPSServerTest::testAuth() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED); - assert (response.get("WWW-Authenticate") == "Basic realm=\"/auth\""); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED); + assertTrue (response.get("WWW-Authenticate") == "Basic realm=\"/auth\""); + assertTrue (rbody.empty()); } @@ -319,8 +319,8 @@ void HTTPSServerTest::testNotImpl() HTTPResponse response; std::string rbody; cs.receiveResponse(response) >> rbody; - assert (response.getStatus() == HTTPResponse::HTTP_NOT_IMPLEMENTED); - assert (rbody.empty()); + assertTrue (response.getStatus() == HTTPResponse::HTTP_NOT_IMPLEMENTED); + assertTrue (rbody.empty()); } diff --git a/NetSSL_Win/testsuite/src/HTTPSStreamFactoryTest.cpp b/NetSSL_Win/testsuite/src/HTTPSStreamFactoryTest.cpp index 145b20053..d78e16f74 100644 --- a/NetSSL_Win/testsuite/src/HTTPSStreamFactoryTest.cpp +++ b/NetSSL_Win/testsuite/src/HTTPSStreamFactoryTest.cpp @@ -54,7 +54,7 @@ void HTTPSStreamFactoryTest::testNoRedirect() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); } @@ -71,7 +71,7 @@ void HTTPSStreamFactoryTest::testEmptyPath() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPSTestServer::SMALL_BODY); + assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY); } @@ -88,7 +88,7 @@ void HTTPSStreamFactoryTest::testRedirect() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str() == HTTPSTestServer::LARGE_BODY); + assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY); } @@ -107,7 +107,7 @@ void HTTPSStreamFactoryTest::testProxy() #endif // POCO_ENABLE_CPP11 std::ostringstream ostr; StreamCopier::copyStream(*pStr.get(), ostr); - assert (ostr.str().length() > 0); + assertTrue (ostr.str().length() > 0); } diff --git a/NetSSL_Win/testsuite/src/TCPServerTest.cpp b/NetSSL_Win/testsuite/src/TCPServerTest.cpp index 9ab072dc1..f95c203b0 100644 --- a/NetSSL_Win/testsuite/src/TCPServerTest.cpp +++ b/NetSSL_Win/testsuite/src/TCPServerTest.cpp @@ -88,10 +88,10 @@ void TCPServerTest::testOneConnection() SecureServerSocket svs(0); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("localhost", svs.address().port()); SecureStreamSocket ss1(sa); @@ -99,15 +99,15 @@ void TCPServerTest::testOneConnection() ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -116,10 +116,10 @@ void TCPServerTest::testTwoConnections() SecureServerSocket svs(0); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("localhost", svs.address().port()); SecureStreamSocket ss1(sa); @@ -130,27 +130,27 @@ void TCPServerTest::testTwoConnections() char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); - assert (srv.currentConnections() == 2); - assert (srv.currentThreads() == 2); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (srv.currentConnections() == 2); + assertTrue (srv.currentThreads() == 2); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss2.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -163,10 +163,10 @@ void TCPServerTest::testMultiConnections() pParams->setThreadIdleTime(100); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs, pParams); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("localhost", svs.address().port()); SecureStreamSocket ss1(sa); @@ -181,69 +181,69 @@ void TCPServerTest::testMultiConnections() char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss2.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss3.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); n = ss4.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 4); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 4); SecureStreamSocket ss5; ss5.setLazyHandshake(); ss5.connect(sa); Thread::sleep(200); - assert (srv.queuedConnections() == 1); + assertTrue (srv.queuedConnections() == 1); SecureStreamSocket ss6; ss6.setLazyHandshake(); ss6.connect(sa); Thread::sleep(200); - assert (srv.queuedConnections() == 2); + assertTrue (srv.queuedConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 1); - assert (srv.totalConnections() == 5); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 1); + assertTrue (srv.totalConnections() == 5); ss2.close(); Thread::sleep(300); - assert (srv.currentConnections() == 4); - assert (srv.currentThreads() == 4); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 4); + assertTrue (srv.currentThreads() == 4); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss3.close(); Thread::sleep(300); - assert (srv.currentConnections() == 3); - assert (srv.currentThreads() == 3); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 3); + assertTrue (srv.currentThreads() == 3); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss4.close(); Thread::sleep(300); - assert (srv.currentConnections() == 2); - assert (srv.currentThreads() == 2); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 6); + assertTrue (srv.currentConnections() == 2); + assertTrue (srv.currentThreads() == 2); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 6); ss5.close(); ss6.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -252,10 +252,10 @@ void TCPServerTest::testReuseSocket() SecureServerSocket svs(0); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); SocketAddress sa("localhost", svs.address().port()); SecureStreamSocket ss1(sa); @@ -263,27 +263,27 @@ void TCPServerTest::testReuseSocket() ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); ss1.connect(sa); ss1.sendBytes(data.data(), (int) data.size()); n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } @@ -304,10 +304,10 @@ void TCPServerTest::testReuseSession() SecureServerSocket svs(0, 64, pServerContext); TCPServer srv(new TCPServerConnectionFactoryImpl(), svs); srv.start(); - assert (srv.currentConnections() == 0); - assert (srv.currentThreads() == 0); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 0); + assertTrue (srv.currentConnections() == 0); + assertTrue (srv.currentThreads() == 0); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 0); Context::Ptr pClientContext = new Context( Context::CLIENT_USE, @@ -316,56 +316,56 @@ void TCPServerTest::testReuseSession() SocketAddress sa("localhost", svs.address().port()); SecureStreamSocket ss1(sa, pClientContext); - assert (!ss1.sessionWasReused()); + assertTrue (!ss1.sessionWasReused()); std::string data("hello, world"); ss1.sendBytes(data.data(), (int) data.size()); char buffer[256]; int n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.currentThreads() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 1); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.currentThreads() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 1); Session::Ptr pSession = ss1.currentSession(); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); ss1.useSession(pSession); ss1.connect(sa); - assert (ss1.sessionWasReused()); - assert (ss1.currentSession() == pSession); + assertTrue (ss1.sessionWasReused()); + assertTrue (ss1.currentSession() == pSession); ss1.sendBytes(data.data(), (int) data.size()); n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 2); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 2); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); Thread::sleep(15000); // wait for session to expire //pServerContext->flushSessionCache(); ss1.useSession(pSession); ss1.connect(sa); - assert (!ss1.sessionWasReused()); - assert (ss1.currentSession() != pSession); + assertTrue (!ss1.sessionWasReused()); + assertTrue (ss1.currentSession() != pSession); ss1.sendBytes(data.data(), (int) data.size()); n = ss1.receiveBytes(buffer, sizeof(buffer)); - assert (n > 0); - assert (std::string(buffer, n) == data); - assert (srv.currentConnections() == 1); - assert (srv.queuedConnections() == 0); - assert (srv.totalConnections() == 3); + assertTrue (n > 0); + assertTrue (std::string(buffer, n) == data); + assertTrue (srv.currentConnections() == 1); + assertTrue (srv.queuedConnections() == 0); + assertTrue (srv.totalConnections() == 3); ss1.close(); Thread::sleep(300); - assert (srv.currentConnections() == 0); + assertTrue (srv.currentConnections() == 0); } diff --git a/Redis/testsuite/src/RedisTest.cpp b/Redis/testsuite/src/RedisTest.cpp index ff3dd591d..fb65fc05a 100644 --- a/Redis/testsuite/src/RedisTest.cpp +++ b/Redis/testsuite/src/RedisTest.cpp @@ -87,7 +87,7 @@ void RedisTest::testAPPEND() try { std::string result = _redis.execute(setCommand); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -102,7 +102,7 @@ void RedisTest::testAPPEND() try { Poco::Int64 result = _redis.execute(appendCommand); - assert(result == 11); + assertTrue (result == 11); } catch (RedisException& e) { @@ -117,7 +117,7 @@ void RedisTest::testAPPEND() try { BulkString result = _redis.execute(getCommand); - assert(result.value().compare("Hello World") == 0); + assertTrue (result.value().compare("Hello World") == 0); } catch (RedisException& e) { @@ -165,7 +165,7 @@ void RedisTest::testBLPOP() { Command rpush = Command::rpush("list1", values); Poco::Int64 result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -176,9 +176,9 @@ void RedisTest::testBLPOP() try { Array result = _redis.execute(blpop); - assert(result.size() == 2); - assert(result.get(0).value().compare("list1") == 0); - assert(result.get(1).value().compare("a") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("list1") == 0); + assertTrue (result.get(1).value().compare("a") == 0); } catch (RedisException& e) { @@ -222,7 +222,7 @@ void RedisTest::testBRPOP() { Command rpush = Command::rpush("list1", values); Poco::Int64 result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -233,9 +233,9 @@ void RedisTest::testBRPOP() try { Array result = _redis.execute(brpop); - assert(result.size() == 2); - assert(result.get(0).value().compare("list1") == 0); - assert(result.get(1).value().compare("c") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("list1") == 0); + assertTrue (result.get(1).value().compare("c") == 0); } catch (RedisException& e) { @@ -256,7 +256,7 @@ void RedisTest::testDECR() try { std::string result = _redis.execute(set); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -267,7 +267,7 @@ void RedisTest::testDECR() try { Poco::Int64 result = _redis.execute(decr); - assert(result == 9); + assertTrue (result == 9); } catch (RedisException& e) { @@ -278,7 +278,7 @@ void RedisTest::testDECR() try { std::string result = _redis.execute(set); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -313,8 +313,8 @@ void RedisTest::testECHO() try { BulkString result = _redis.execute(command); - assert(!result.isNull()); - assert(result.value().compare("Hello World") == 0); + assertTrue (!result.isNull()); + assertTrue (result.value().compare("Hello World") == 0); } catch (RedisException& e) { @@ -360,19 +360,19 @@ void RedisTest::testEVAL() try { Array value = _redis.execute(cmd); - assert(value.size() == 3); + assertTrue (value.size() == 3); Poco::Int64 i = value.get(0); - assert(i == 1); + assertTrue (i == 1); i = value.get(1); - assert(i == 2); + assertTrue (i == 2); Array a = value.get(2); - assert(a.size() == 2); + assertTrue (a.size() == 2); i = a.get(0); - assert(i == 3); + assertTrue (i == 3); BulkString s = a.get(1); - assert(s.value().compare("Hello World!") == 0); + assertTrue (s.value().compare("Hello World!") == 0); } catch (RedisException& e) { @@ -396,7 +396,7 @@ void RedisTest::testHDEL() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -407,7 +407,7 @@ void RedisTest::testHDEL() try { Poco::Int64 result = _redis.execute(hdel); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -418,7 +418,7 @@ void RedisTest::testHDEL() try { Poco::Int64 result = _redis.execute(hdel); - assert(result == 0); + assertTrue (result == 0); } catch (RedisException& e) { @@ -441,7 +441,7 @@ void RedisTest::testHEXISTS() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -452,7 +452,7 @@ void RedisTest::testHEXISTS() try { Poco::Int64 result = _redis.execute(hexists); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -463,7 +463,7 @@ void RedisTest::testHEXISTS() try { Poco::Int64 result = _redis.execute(hexists); - assert(result == 0); + assertTrue (result == 0); } catch (RedisException& e) { @@ -486,7 +486,7 @@ void RedisTest::testHGETALL() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -497,7 +497,7 @@ void RedisTest::testHGETALL() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -508,7 +508,7 @@ void RedisTest::testHGETALL() try { Array result = _redis.execute(hgetall); - assert(result.size() == 4); + assertTrue (result.size() == 4); } catch (RedisException& e) { @@ -531,7 +531,7 @@ void RedisTest::testHINCRBY() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -542,7 +542,7 @@ void RedisTest::testHINCRBY() try { Poco::Int64 n = _redis.execute(hincrby); - assert(n == 6); + assertTrue (n == 6); } catch (RedisException& e) { @@ -553,7 +553,7 @@ void RedisTest::testHINCRBY() try { Poco::Int64 n = _redis.execute(hincrby); - assert(n == 5); + assertTrue (n == 5); } catch (RedisException& e) { @@ -564,7 +564,7 @@ void RedisTest::testHINCRBY() try { Poco::Int64 n = _redis.execute(hincrby); - assert(n == -5); + assertTrue (n == -5); } catch (RedisException& e) { @@ -587,7 +587,7 @@ void RedisTest::testHKEYS() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -598,7 +598,7 @@ void RedisTest::testHKEYS() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -609,7 +609,7 @@ void RedisTest::testHKEYS() try { Poco::Int64 value = _redis.execute(hlen); - assert(value == 2); + assertTrue (value == 2); } catch (RedisException& e) { @@ -620,9 +620,9 @@ void RedisTest::testHKEYS() try { Array result = _redis.execute(hkeys); - assert(result.size() == 2); - assert(result.get(0).value().compare("field1") == 0); - assert(result.get(1).value().compare("field2") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("field1") == 0); + assertTrue (result.get(1).value().compare("field2") == 0); } catch (RedisException& e) { @@ -645,7 +645,7 @@ void RedisTest::testHMGET() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -656,7 +656,7 @@ void RedisTest::testHMGET() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -671,11 +671,11 @@ void RedisTest::testHMGET() try { Array result = _redis.execute(hmget); - assert(result.size() == 3); + assertTrue (result.size() == 3); - assert(result.get(0).value().compare("Hello") == 0); - assert(result.get(1).value().compare("World") == 0); - assert(result.get(2).isNull()); + assertTrue (result.get(0).value().compare("Hello") == 0); + assertTrue (result.get(1).value().compare("World") == 0); + assertTrue (result.get(2).isNull()); } catch (RedisException& e) { @@ -698,7 +698,7 @@ void RedisTest::testHSET() try { Poco::Int64 value = _redis.execute(hset); - assert(value == 1); + assertTrue (value == 1); } catch (RedisException& e) { @@ -709,7 +709,7 @@ void RedisTest::testHSET() try { BulkString s = _redis.execute(hget); - assert(s.value().compare("Hello") == 0); + assertTrue (s.value().compare("Hello") == 0); } catch (RedisException& e) { @@ -736,7 +736,7 @@ void RedisTest::testHMSET() try { std::string result = _redis.execute(hmset); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -747,7 +747,7 @@ void RedisTest::testHMSET() try { BulkString s = _redis.execute(hget); - assert(s.value().compare("Hello") == 0); + assertTrue (s.value().compare("Hello") == 0); } catch (RedisException& e) { @@ -758,7 +758,7 @@ void RedisTest::testHMSET() try { BulkString s = _redis.execute(hget); - assert(s.value().compare("World") == 0); + assertTrue (s.value().compare("World") == 0); } catch (RedisException& e) { @@ -787,7 +787,7 @@ void RedisTest::testHSTRLEN() try { std::string result = _redis.execute(hmset); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -798,7 +798,7 @@ void RedisTest::testHSTRLEN() try { Poco::Int64 len = _redis.execute(hstrlen); - assert(len == 10); + assertTrue (len == 10); } catch (RedisException& e) { @@ -809,7 +809,7 @@ void RedisTest::testHSTRLEN() try { Poco::Int64 len = _redis.execute(hstrlen); - assert(len == 2); + assertTrue (len == 2); } catch (RedisException& e) { @@ -820,7 +820,7 @@ void RedisTest::testHSTRLEN() try { Poco::Int64 len = _redis.execute(hstrlen); - assert(len == 4); + assertTrue (len == 4); } catch (RedisException& e) { @@ -847,7 +847,7 @@ void RedisTest::testHVALS() try { std::string result = _redis.execute(hmset); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -858,9 +858,9 @@ void RedisTest::testHVALS() try { Array result = _redis.execute(hvals); - assert(result.size() == 2); - assert(result.get(0).value().compare("Hello") == 0); - assert(result.get(1).value().compare("World") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("Hello") == 0); + assertTrue (result.get(1).value().compare("World") == 0); } catch (RedisException& e) { @@ -882,7 +882,7 @@ void RedisTest::testINCR() try { std::string result = _redis.execute(command); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -893,7 +893,7 @@ void RedisTest::testINCR() try { Poco::Int64 value = _redis.execute(command); - assert(value == 11); + assertTrue (value == 11); } catch (RedisException& e) { @@ -915,7 +915,7 @@ void RedisTest::testINCRBY() try { std::string result = _redis.execute(command); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -926,7 +926,7 @@ void RedisTest::testINCRBY() try { Poco::Int64 value = _redis.execute(command); - assert(value == 15); + assertTrue (value == 15); } catch (RedisException& e) { @@ -950,7 +950,7 @@ void RedisTest::testPING() try { std::string result = _redis.execute(command); - assert(result.compare("PONG") == 0); + assertTrue (result.compare("PONG") == 0); } catch (RedisException& e) { @@ -963,8 +963,8 @@ void RedisTest::testPING() try { BulkString result = _redis.execute(command); - assert(!result.isNull()); - assert(result.value().compare("Hello") == 0); + assertTrue (!result.isNull()); + assertTrue (result.value().compare("Hello") == 0); } catch (RedisException& e) { @@ -989,15 +989,15 @@ void RedisTest::testLPOP() { Command rpush = Command::rpush("mylist", "one"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "two"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); rpush = Command::rpush("mylist", "three"); result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1008,7 +1008,7 @@ void RedisTest::testLPOP() try { BulkString result = _redis.execute(lpop); - assert(result.value().compare("one") == 0); + assertTrue (result.value().compare("one") == 0); } catch (RedisException& e) { @@ -1020,9 +1020,9 @@ void RedisTest::testLPOP() { Array result = _redis.execute(lrange); - assert(result.size() == 2); - assert(result.get(0).value().compare("two") == 0); - assert(result.get(1).value().compare("three") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("two") == 0); + assertTrue (result.get(1).value().compare("three") == 0); } catch (RedisException& e) { @@ -1051,15 +1051,15 @@ void RedisTest::testLSET() { Command rpush = Command::rpush("mylist", "one"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "two"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); rpush = Command::rpush("mylist", "three"); result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1091,10 +1091,10 @@ void RedisTest::testLSET() { Array result = _redis.execute(lrange); - assert(result.size() == 3); - assert(result.get(0).value().compare("four") == 0); - assert(result.get(1).value().compare("five") == 0); - assert(result.get(2).value().compare("three") == 0); + assertTrue (result.size() == 3); + assertTrue (result.get(0).value().compare("four") == 0); + assertTrue (result.get(1).value().compare("five") == 0); + assertTrue (result.get(2).value().compare("three") == 0); } catch (RedisException& e) { @@ -1123,11 +1123,11 @@ void RedisTest::testLINDEX() { Command lpush = Command::lpush("mylist", "World"); Poco::Int64 result = _redis.execute(lpush); - assert(result == 1); + assertTrue (result == 1); lpush = Command::lpush("mylist", "Hello"); result = _redis.execute(lpush); - assert(result == 2); + assertTrue (result == 2); } catch (RedisException& e) { @@ -1138,7 +1138,7 @@ void RedisTest::testLINDEX() try { BulkString result = _redis.execute(lindex); - assert(result.value().compare("Hello") == 0); + assertTrue (result.value().compare("Hello") == 0); } catch (RedisException& e) { @@ -1162,23 +1162,23 @@ void RedisTest::testLINSERT() { Command rpush = Command::rpush("mylist", "Hello"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "World"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); Command linsert = Command::linsert("mylist", true, "World", "There"); result = _redis.execute(linsert); - assert(result == 3); + assertTrue (result == 3); Command lrange = Command::lrange("mylist", 0, -1); Array range = _redis.execute(lrange); - assert(range.size() == 3); + assertTrue (range.size() == 3); - assert(range.get(0).value().compare("Hello") == 0); - assert(range.get(1).value().compare("There") == 0); - assert(range.get(2).value().compare("World") == 0); + assertTrue (range.get(0).value().compare("Hello") == 0); + assertTrue (range.get(1).value().compare("There") == 0); + assertTrue (range.get(2).value().compare("World") == 0); } catch (RedisException& e) { @@ -1215,7 +1215,7 @@ void RedisTest::testLREM() list.push_back("hello"); Command rpush = Command::rpush("mylist", list); Poco::Int64 result = _redis.execute(rpush); - assert(result == 4); + assertTrue (result == 4); } catch (RedisException& e) { @@ -1226,7 +1226,7 @@ void RedisTest::testLREM() try { Poco::Int64 n = _redis.execute(lrem); - assert(n == 2); + assertTrue (n == 2); } catch (RedisException& e) { @@ -1242,9 +1242,9 @@ void RedisTest::testLREM() { Array result = _redis.execute(lrange); - assert(result.size() == 2); - assert(result.get(0).value().compare("hello") == 0); - assert(result.get(1).value().compare("foo") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("hello") == 0); + assertTrue (result.get(1).value().compare("foo") == 0); } catch (RedisException& e) { @@ -1272,15 +1272,15 @@ void RedisTest::testLTRIM() { Command rpush = Command::rpush("mylist", "one"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "two"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); rpush = Command::rpush("mylist", "three"); result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1291,7 +1291,7 @@ void RedisTest::testLTRIM() try { std::string result = _redis.execute(ltrim); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -1303,9 +1303,9 @@ void RedisTest::testLTRIM() { Array result = _redis.execute(lrange); - assert(result.size() == 2); - assert(result.get(0).value().compare("two") == 0); - assert(result.get(1).value().compare("three") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("two") == 0); + assertTrue (result.get(1).value().compare("three") == 0); } catch (RedisException& e) { @@ -1334,7 +1334,7 @@ void RedisTest::testMSET() try { std::string result = _redis.execute(command); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -1350,15 +1350,15 @@ void RedisTest::testMSET() { Array result = _redis.execute(command); - assert(result.size() == 3); + assertTrue (result.size() == 3); BulkString value = result.get(0); - assert(value.value().compare("Hello") == 0); + assertTrue (value.value().compare("Hello") == 0); value = result.get(1); - assert(value.value().compare("World") == 0); + assertTrue (value.value().compare("World") == 0); value = result.get(2); - assert(value.isNull()); + assertTrue (value.isNull()); } catch (RedisException& e) { @@ -1389,7 +1389,7 @@ void RedisTest::testMSETWithMap() try { std::string result = _redis.execute(mset); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -1406,15 +1406,15 @@ void RedisTest::testMSETWithMap() { Array result = _redis.execute(mget); - assert(result.size() == 3); + assertTrue (result.size() == 3); BulkString value = result.get(0); - assert(value.value().compare("Hello") == 0); + assertTrue (value.value().compare("Hello") == 0); value = result.get(1); - assert(value.value().compare("World") == 0); + assertTrue (value.value().compare("World") == 0); value = result.get(2); - assert(value.isNull()); + assertTrue (value.isNull()); } catch (RedisException& e) { @@ -1444,7 +1444,7 @@ void RedisTest::testMULTI() try { std::string result = _redis.execute(command); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -1461,7 +1461,7 @@ void RedisTest::testMULTI() try { std::string result = _redis.execute(command); - assert(result.compare("QUEUED") == 0); + assertTrue (result.compare("QUEUED") == 0); } catch (RedisException& e) { @@ -1478,7 +1478,7 @@ void RedisTest::testMULTI() try { std::string result = _redis.execute(command); - assert(result.compare("QUEUED") == 0); + assertTrue (result.compare("QUEUED") == 0); } catch (RedisException& e) { @@ -1494,12 +1494,12 @@ void RedisTest::testMULTI() try { Array result = _redis.execute(command); - assert(result.size() == 2); + assertTrue (result.size() == 2); Poco::Int64 v = result.get(0); - assert(v == 1); + assertTrue (v == 1); v = result.get(1); - assert(v == 1); + assertTrue (v == 1); } catch (RedisException& e) { @@ -1530,7 +1530,7 @@ void RedisTest::testPipeliningWithSendCommands() Array result = _redis.sendCommands(commands); // We expect 2 results - assert(result.size() == 2); + assertTrue (result.size() == 2); // The 2 results must be simple PONG strings for (size_t i = 0; i < 2; ++i) @@ -1538,7 +1538,7 @@ void RedisTest::testPipeliningWithSendCommands() try { std::string pong = result.get(i); - assert(pong.compare("PONG") == 0); + assertTrue (pong.compare("PONG") == 0); } catch (...) { @@ -1570,7 +1570,7 @@ void RedisTest::testPipeliningWithWriteCommand() try { _redis.readReply(pong); - assert(pong.compare("PONG") == 0); + assertTrue (pong.compare("PONG") == 0); } catch (RedisException& e) { @@ -1670,7 +1670,7 @@ void RedisTest::testSADD() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -1681,7 +1681,7 @@ void RedisTest::testSADD() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -1692,7 +1692,7 @@ void RedisTest::testSADD() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 0); + assertTrue (result == 0); } catch (RedisException& e) { @@ -1715,7 +1715,7 @@ void RedisTest::testSCARD() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -1726,7 +1726,7 @@ void RedisTest::testSCARD() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -1737,7 +1737,7 @@ void RedisTest::testSCARD() try { Poco::Int64 result = _redis.execute(scard); - assert(result == 2); + assertTrue (result == 2); } catch (RedisException& e) { @@ -1765,7 +1765,7 @@ void RedisTest::testSDIFF() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1780,7 +1780,7 @@ void RedisTest::testSDIFF() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1791,7 +1791,7 @@ void RedisTest::testSDIFF() try { Array result = _redis.execute(sdiff); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -1820,7 +1820,7 @@ void RedisTest::testSDIFFSTORE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1835,7 +1835,7 @@ void RedisTest::testSDIFFSTORE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1846,7 +1846,7 @@ void RedisTest::testSDIFFSTORE() try { Poco::Int64 result = _redis.execute(sdiffstore); - assert(result == 2); + assertTrue (result == 2); } catch (RedisException& e) { @@ -1857,7 +1857,7 @@ void RedisTest::testSDIFFSTORE() try { Array result = _redis.execute(smembers); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -1881,7 +1881,7 @@ void RedisTest::testSET() try { std::string result = _redis.execute(command); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -1894,7 +1894,7 @@ void RedisTest::testSET() try { BulkString result = _redis.execute(command); - assert(result.isNull()); + assertTrue (result.isNull()); } catch (RedisException& e) { @@ -1922,7 +1922,7 @@ void RedisTest::testSINTER() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1937,7 +1937,7 @@ void RedisTest::testSINTER() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1948,8 +1948,8 @@ void RedisTest::testSINTER() try { Array result = _redis.execute(sinter); - assert(result.size() == 1); - assert(result.get(0).value().compare("c") == 0); + assertTrue (result.size() == 1); + assertTrue (result.get(0).value().compare("c") == 0); } catch (RedisException& e) { @@ -1978,7 +1978,7 @@ void RedisTest::testSINTERSTORE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -1993,7 +1993,7 @@ void RedisTest::testSINTERSTORE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2004,7 +2004,7 @@ void RedisTest::testSINTERSTORE() try { Poco::Int64 result = _redis.execute(sinterstore); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2015,8 +2015,8 @@ void RedisTest::testSINTERSTORE() try { Array result = _redis.execute(smembers); - assert(result.size() == 1); - assert(result.get(0).value().compare("c") == 0); + assertTrue (result.size() == 1); + assertTrue (result.get(0).value().compare("c") == 0); } catch (RedisException& e) { @@ -2039,7 +2039,7 @@ void RedisTest::testSISMEMBER() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2050,7 +2050,7 @@ void RedisTest::testSISMEMBER() try { Poco::Int64 result = _redis.execute(sismember); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2061,7 +2061,7 @@ void RedisTest::testSISMEMBER() try { Poco::Int64 result = _redis.execute(sismember); - assert(result == 0); + assertTrue (result == 0); } catch (RedisException& e) { @@ -2084,7 +2084,7 @@ void RedisTest::testSMEMBERS() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2095,7 +2095,7 @@ void RedisTest::testSMEMBERS() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2106,7 +2106,7 @@ void RedisTest::testSMEMBERS() try { Array result = _redis.execute(smembers); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -2130,7 +2130,7 @@ void RedisTest::testSMOVE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2141,7 +2141,7 @@ void RedisTest::testSMOVE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2152,7 +2152,7 @@ void RedisTest::testSMOVE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2163,7 +2163,7 @@ void RedisTest::testSMOVE() try { Poco::Int64 result = _redis.execute(smove); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2174,8 +2174,8 @@ void RedisTest::testSMOVE() try { Array result = _redis.execute(smembers); - assert(result.size() == 1); - assert(result.get(0).value().compare("one") == 0); + assertTrue (result.size() == 1); + assertTrue (result.get(0).value().compare("one") == 0); } catch (RedisException& e) { @@ -2186,7 +2186,7 @@ void RedisTest::testSMOVE() try { Array result = _redis.execute(smembers); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -2209,7 +2209,7 @@ void RedisTest::testSPOP() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2220,7 +2220,7 @@ void RedisTest::testSPOP() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2231,7 +2231,7 @@ void RedisTest::testSPOP() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2242,7 +2242,7 @@ void RedisTest::testSPOP() try { BulkString result = _redis.execute(spop); - assert(!result.isNull()); + assertTrue (!result.isNull()); } catch (RedisException& e) { @@ -2253,7 +2253,7 @@ void RedisTest::testSPOP() try { Array result = _redis.execute(smembers); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -2264,7 +2264,7 @@ void RedisTest::testSPOP() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2275,7 +2275,7 @@ void RedisTest::testSPOP() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2287,7 +2287,7 @@ void RedisTest::testSPOP() try { Array result = _redis.execute(spop); - assert(result.size() == 3); + assertTrue (result.size() == 3); } catch (RedisException& e) { @@ -2316,7 +2316,7 @@ void RedisTest::testSRANDMEMBER() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2327,7 +2327,7 @@ void RedisTest::testSRANDMEMBER() try { BulkString result = _redis.execute(srandmember); - assert(!result.isNull()); + assertTrue (!result.isNull()); } catch (RedisException& e) { @@ -2338,7 +2338,7 @@ void RedisTest::testSRANDMEMBER() try { Array result = _redis.execute(srandmember); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -2349,7 +2349,7 @@ void RedisTest::testSRANDMEMBER() try { Array result = _redis.execute(srandmember); - assert(result.size() == 5); + assertTrue (result.size() == 5); } catch (RedisException& e) { @@ -2373,7 +2373,7 @@ void RedisTest::testSTRLEN() try { std::string result = _redis.execute(command); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -2388,7 +2388,7 @@ void RedisTest::testSTRLEN() { Poco::Int64 result = _redis.execute(command); - assert(result == 11); + assertTrue (result == 11); } catch (RedisException& e) { @@ -2411,7 +2411,7 @@ void RedisTest::testSREM() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2421,7 +2421,7 @@ void RedisTest::testSREM() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2431,7 +2431,7 @@ void RedisTest::testSREM() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2442,7 +2442,7 @@ void RedisTest::testSREM() try { Poco::Int64 result = _redis.execute(srem); - assert(result == 1); + assertTrue (result == 1); } catch (RedisException& e) { @@ -2453,7 +2453,7 @@ void RedisTest::testSREM() try { Poco::Int64 result = _redis.execute(srem); - assert(result == 0); + assertTrue (result == 0); } catch (RedisException& e) { @@ -2464,7 +2464,7 @@ void RedisTest::testSREM() try { Array result = _redis.execute(smembers); - assert(result.size() == 2); + assertTrue (result.size() == 2); } catch (RedisException& e) { @@ -2492,7 +2492,7 @@ void RedisTest::testSUNION() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2507,7 +2507,7 @@ void RedisTest::testSUNION() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2518,7 +2518,7 @@ void RedisTest::testSUNION() try { Array result = _redis.execute(sunion); - assert(result.size() == 5); + assertTrue (result.size() == 5); } catch (RedisException& e) { @@ -2547,7 +2547,7 @@ void RedisTest::testSUNIONSTORE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2562,7 +2562,7 @@ void RedisTest::testSUNIONSTORE() try { Poco::Int64 result = _redis.execute(sadd); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2573,7 +2573,7 @@ void RedisTest::testSUNIONSTORE() try { Poco::Int64 result = _redis.execute(sunionstore); - assert(result == 5); + assertTrue (result == 5); } catch (RedisException& e) { @@ -2584,7 +2584,7 @@ void RedisTest::testSUNIONSTORE() try { Array result = _redis.execute(smembers); - assert(result.size() == 5); + assertTrue (result.size() == 5); } catch (RedisException& e) { @@ -2605,7 +2605,7 @@ void RedisTest::testRENAME() try { std::string result = _redis.execute(set); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -2616,7 +2616,7 @@ void RedisTest::testRENAME() try { std::string result = _redis.execute(rename); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -2627,7 +2627,7 @@ void RedisTest::testRENAME() try { BulkString result = _redis.execute(get); - assert(result.value().compare("Hello") == 0); + assertTrue (result.value().compare("Hello") == 0); } catch (RedisException& e) { @@ -2648,7 +2648,7 @@ void RedisTest::testRENAMENX() try { std::string result = _redis.execute(set); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -2659,7 +2659,7 @@ void RedisTest::testRENAMENX() try { std::string result = _redis.execute(set); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); } catch (RedisException& e) { @@ -2670,7 +2670,7 @@ void RedisTest::testRENAMENX() try { Poco::Int64 result = _redis.execute(rename); - assert(result == 0); + assertTrue (result == 0); } catch (RedisException& e) { @@ -2681,7 +2681,7 @@ void RedisTest::testRENAMENX() try { BulkString result = _redis.execute(get); - assert(result.value().compare("World") == 0); + assertTrue (result.value().compare("World") == 0); } catch (RedisException& e) { @@ -2705,15 +2705,15 @@ void RedisTest::testRPOP() { Command rpush = Command::rpush("mylist", "one"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "two"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); rpush = Command::rpush("mylist", "three"); result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2724,7 +2724,7 @@ void RedisTest::testRPOP() try { BulkString result = _redis.execute(rpop); - assert(result.value().compare("three") == 0); + assertTrue (result.value().compare("three") == 0); } catch (RedisException& e) { @@ -2736,9 +2736,9 @@ void RedisTest::testRPOP() { Array result = _redis.execute(lrange); - assert(result.size() == 2); - assert(result.get(0).value().compare("one") == 0); - assert(result.get(1).value().compare("two") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("one") == 0); + assertTrue (result.get(1).value().compare("two") == 0); } catch (RedisException& e) { @@ -2782,15 +2782,15 @@ void RedisTest::testRPOPLPUSH() { Command rpush = Command::rpush("mylist", "one"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "two"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); rpush = Command::rpush("mylist", "three"); result = _redis.execute(rpush); - assert(result == 3); + assertTrue (result == 3); } catch (RedisException& e) { @@ -2801,7 +2801,7 @@ void RedisTest::testRPOPLPUSH() try { BulkString result = _redis.execute(rpoplpush); - assert(result.value().compare("three") == 0); + assertTrue (result.value().compare("three") == 0); } catch (RedisException& e) { @@ -2813,9 +2813,9 @@ void RedisTest::testRPOPLPUSH() { Array result = _redis.execute(lrange); - assert(result.size() == 2); - assert(result.get(0).value().compare("one") == 0); - assert(result.get(1).value().compare("two") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("one") == 0); + assertTrue (result.get(1).value().compare("two") == 0); } catch (RedisException& e) { @@ -2831,8 +2831,8 @@ void RedisTest::testRPOPLPUSH() { Array result = _redis.execute(lrange); - assert(result.size() == 1); - assert(result.get(0).value().compare("three") == 0); + assertTrue (result.size() == 1); + assertTrue (result.get(0).value().compare("three") == 0); } catch (RedisException& e) { @@ -2860,11 +2860,11 @@ void RedisTest::testRPUSH() { Command rpush = Command::rpush("mylist", "World"); Poco::Int64 result = _redis.execute(rpush); - assert(result == 1); + assertTrue (result == 1); rpush = Command::rpush("mylist", "Hello"); result = _redis.execute(rpush); - assert(result == 2); + assertTrue (result == 2); } catch (RedisException& e) { @@ -2875,7 +2875,7 @@ void RedisTest::testRPUSH() try { Poco::Int64 n = _redis.execute(llen); - assert(n == 2); + assertTrue (n == 2); } catch (RedisException& e) { @@ -2891,9 +2891,9 @@ void RedisTest::testRPUSH() { Array result = _redis.execute(lrange); - assert(result.size() == 2); - assert(result.get(0).value().compare("World") == 0); - assert(result.get(1).value().compare("Hello") == 0); + assertTrue (result.size() == 2); + assertTrue (result.get(0).value().compare("World") == 0); + assertTrue (result.get(1).value().compare("Hello") == 0); } catch (RedisException& e) { @@ -2916,16 +2916,16 @@ void RedisTest::testPool() PooledConnection pclient1(pool); PooledConnection pclient2(pool); - assert(pool.size() == 2); + assertTrue (pool.size() == 2); Command set = Command::set("mypoolkey", "Hello"); std::string result = ((Client::Ptr) pclient1)->execute(set); - assert(result.compare("OK") == 0); + assertTrue (result.compare("OK") == 0); Array get; get << "GET" << "mypoolkey"; BulkString keyValue = ((Client::Ptr) pclient2)->execute(get); - assert(keyValue.value().compare("Hello") == 0); + assertTrue (keyValue.value().compare("Hello") == 0); } diff --git a/Util/testsuite/src/AbstractConfigurationTest.cpp b/Util/testsuite/src/AbstractConfigurationTest.cpp index 79c0f9098..16351c881 100644 --- a/Util/testsuite/src/AbstractConfigurationTest.cpp +++ b/Util/testsuite/src/AbstractConfigurationTest.cpp @@ -44,11 +44,11 @@ void AbstractConfigurationTest::testHasProperty() { AutoPtr pConf = createConfiguration(); - assert (pConf->hasProperty("prop1")); - assert (pConf->hasProperty("prop2")); - assert (pConf->hasProperty("prop3.string1")); - assert (!pConf->hasProperty("prop3.string3")); - assert (!pConf->hasProperty("foobar")); + assertTrue (pConf->hasProperty("prop1")); + assertTrue (pConf->hasProperty("prop2")); + assertTrue (pConf->hasProperty("prop3.string1")); + assertTrue (!pConf->hasProperty("prop3.string3")); + assertTrue (!pConf->hasProperty("foobar")); } @@ -56,12 +56,12 @@ void AbstractConfigurationTest::testGetString() { AutoPtr pConf = createConfiguration(); - assert (pConf->getString("prop1") == "foo"); - assert (pConf->getString("prop2") == "bar"); - assert (pConf->getString("prop3.string1") == "foo"); - assert (pConf->getString("prop3.string2") == "bar"); - assert (pConf->getString("ref1") == "foobar"); - assert (pConf->getRawString("ref1") == "${prop3.string1}${prop3.string2}"); + assertTrue (pConf->getString("prop1") == "foo"); + assertTrue (pConf->getString("prop2") == "bar"); + assertTrue (pConf->getString("prop3.string1") == "foo"); + assertTrue (pConf->getString("prop3.string2") == "bar"); + assertTrue (pConf->getString("ref1") == "foobar"); + assertTrue (pConf->getRawString("ref1") == "${prop3.string1}${prop3.string2}"); try { @@ -72,11 +72,11 @@ void AbstractConfigurationTest::testGetString() { } - assert (pConf->getString("prop1", "FOO") == "foo"); - assert (pConf->getString("prop2", "BAR") == "bar"); - assert (pConf->getString("prop3.string1", "FOO") == "foo"); - assert (pConf->getString("prop3.string2", "BAR") == "bar"); - assert (pConf->getString("prop3.string3", "FOOBAR") == "FOOBAR"); + assertTrue (pConf->getString("prop1", "FOO") == "foo"); + assertTrue (pConf->getString("prop2", "BAR") == "bar"); + assertTrue (pConf->getString("prop3.string1", "FOO") == "foo"); + assertTrue (pConf->getString("prop3.string2", "BAR") == "bar"); + assertTrue (pConf->getString("prop3.string3", "FOOBAR") == "FOOBAR"); } @@ -84,11 +84,11 @@ void AbstractConfigurationTest::testGetInt() { AutoPtr pConf = createConfiguration(); - assert (pConf->getInt("prop4.int1") == 42); - assert (pConf->getInt("prop4.int2") == -42); - assert (pConf->getInt("prop4.hex") == 0x1f); - assert (pConf->getUInt("prop4.hex") == 0x1f); - assert (pConf->getInt("ref2") == 42); + assertTrue (pConf->getInt("prop4.int1") == 42); + assertTrue (pConf->getInt("prop4.int2") == -42); + assertTrue (pConf->getInt("prop4.hex") == 0x1f); + assertTrue (pConf->getUInt("prop4.hex") == 0x1f); + assertTrue (pConf->getInt("ref2") == 42); try { @@ -99,9 +99,9 @@ void AbstractConfigurationTest::testGetInt() { } - assert (pConf->getInt("prop4.int1", 100) == 42); - assert (pConf->getInt("prop4.int2", 100) == -42); - assert (pConf->getInt("prop4.int3", 100) == 100); + assertTrue (pConf->getInt("prop4.int1", 100) == 42); + assertTrue (pConf->getInt("prop4.int2", 100) == -42); + assertTrue (pConf->getInt("prop4.int3", 100) == 100); } @@ -110,12 +110,12 @@ void AbstractConfigurationTest::testGetInt64() #if defined(POCO_HAVE_INT64) AutoPtr pConf = createConfiguration(); - assert (pConf->getInt64("prop4.bigint1") == std::numeric_limits::max()); - assert (pConf->getInt64("prop4.bigint2") == std::numeric_limits::min()); - assert (pConf->getUInt64("prop4.biguint") == std::numeric_limits::max()); - assert (pConf->getInt64("prop4.hex") == 0x1f); - assert (pConf->getUInt64("prop4.hex") == 0x1f); - assert (pConf->getInt64("ref2") == 42); + assertTrue (pConf->getInt64("prop4.bigint1") == std::numeric_limits::max()); + assertTrue (pConf->getInt64("prop4.bigint2") == std::numeric_limits::min()); + assertTrue (pConf->getUInt64("prop4.biguint") == std::numeric_limits::max()); + assertTrue (pConf->getInt64("prop4.hex") == 0x1f); + assertTrue (pConf->getUInt64("prop4.hex") == 0x1f); + assertTrue (pConf->getInt64("ref2") == 42); try { @@ -127,9 +127,9 @@ void AbstractConfigurationTest::testGetInt64() { } - assert (pConf->getInt64("prop4.bigint1", 100) == std::numeric_limits::max()); - assert (pConf->getInt64("prop4.bigint2", 100) == std::numeric_limits::min()); - assert (pConf->getUInt64("prop4.biguint", 100) == std::numeric_limits::max()); + assertTrue (pConf->getInt64("prop4.bigint1", 100) == std::numeric_limits::max()); + assertTrue (pConf->getInt64("prop4.bigint2", 100) == std::numeric_limits::min()); + assertTrue (pConf->getUInt64("prop4.biguint", 100) == std::numeric_limits::max()); #endif } @@ -138,8 +138,8 @@ void AbstractConfigurationTest::testGetDouble() { AutoPtr pConf = createConfiguration(); - assert (pConf->getDouble("prop4.double1") == 1); - assert (pConf->getDouble("prop4.double2") == -1.5); + assertTrue (pConf->getDouble("prop4.double1") == 1); + assertTrue (pConf->getDouble("prop4.double2") == -1.5); try { @@ -150,9 +150,9 @@ void AbstractConfigurationTest::testGetDouble() { } - assert (pConf->getDouble("prop4.double1", 123.5) == 1); - assert (pConf->getDouble("prop4.double2", 123.5) == -1.5); - assert (pConf->getDouble("prop4.double3", 123.5) == 123.5); + assertTrue (pConf->getDouble("prop4.double1", 123.5) == 1); + assertTrue (pConf->getDouble("prop4.double2", 123.5) == -1.5); + assertTrue (pConf->getDouble("prop4.double3", 123.5) == 123.5); } @@ -160,14 +160,14 @@ void AbstractConfigurationTest::testGetBool() { AutoPtr pConf = createConfiguration(); - assert (pConf->getBool("prop4.bool1")); - assert (!pConf->getBool("prop4.bool2")); - assert (pConf->getBool("prop4.bool3")); - assert (!pConf->getBool("prop4.bool4")); - assert (pConf->getBool("prop4.bool5")); - assert (!pConf->getBool("prop4.bool6")); - assert (pConf->getBool("prop4.bool7")); - assert (!pConf->getBool("prop4.bool8")); + assertTrue (pConf->getBool("prop4.bool1")); + assertTrue (!pConf->getBool("prop4.bool2")); + assertTrue (pConf->getBool("prop4.bool3")); + assertTrue (!pConf->getBool("prop4.bool4")); + assertTrue (pConf->getBool("prop4.bool5")); + assertTrue (!pConf->getBool("prop4.bool6")); + assertTrue (pConf->getBool("prop4.bool7")); + assertTrue (!pConf->getBool("prop4.bool8")); try { @@ -178,10 +178,10 @@ void AbstractConfigurationTest::testGetBool() { } - assert (pConf->getBool("prop4.bool1", false)); - assert (!pConf->getBool("prop4.bool2", true)); - assert (pConf->getBool("prop4.boolx", true)); - assert (!pConf->getBool("prop4.booly", false)); + assertTrue (pConf->getBool("prop4.bool1", false)); + assertTrue (!pConf->getBool("prop4.bool2", true)); + assertTrue (pConf->getBool("prop4.boolx", true)); + assertTrue (!pConf->getBool("prop4.booly", false)); } @@ -189,8 +189,8 @@ void AbstractConfigurationTest::testExpand() { AutoPtr pConf = createConfiguration(); - assert (pConf->getString("ref1") == "foobar"); - assert (pConf->getInt("ref2") == 42); + assertTrue (pConf->getString("ref1") == "foobar"); + assertTrue (pConf->getInt("ref2") == 42); try { @@ -201,17 +201,17 @@ void AbstractConfigurationTest::testExpand() { } - assert (pConf->getString("ref5") == "${refx}"); - assert (pConf->getString("ref6") == "${refx}"); + assertTrue (pConf->getString("ref5") == "${refx}"); + assertTrue (pConf->getString("ref6") == "${refx}"); - assert (pConf->expand("answer=${prop4.int1}") == "answer=42"); - assert (pConf->expand("bool5='${prop4.bool5}'") == "bool5='Yes'"); - assert (pConf->expand("undef='${undef}'") == "undef='${undef}'"); - assert (pConf->expand("deep='${ref1}'") == "deep='foobar'"); - assert (pConf->expand("deep='${ref7}'") == "deep='foobar'"); + assertTrue (pConf->expand("answer=${prop4.int1}") == "answer=42"); + assertTrue (pConf->expand("bool5='${prop4.bool5}'") == "bool5='Yes'"); + assertTrue (pConf->expand("undef='${undef}'") == "undef='${undef}'"); + assertTrue (pConf->expand("deep='${ref1}'") == "deep='foobar'"); + assertTrue (pConf->expand("deep='${ref7}'") == "deep='foobar'"); - assert (pConf->getString("dollar.atend") == "foo$"); - assert (pConf->getString("dollar.middle") == "foo$bar"); + assertTrue (pConf->getString("dollar.atend") == "foo$"); + assertTrue (pConf->getString("dollar.middle") == "foo$bar"); } @@ -221,8 +221,8 @@ void AbstractConfigurationTest::testSetString() pConf->setString("set.string1", "foobar"); pConf->setString("set.string2", ""); - assert (pConf->getString("set.string1") == "foobar"); - assert (pConf->getString("set.string2") == ""); + assertTrue (pConf->getString("set.string1") == "foobar"); + assertTrue (pConf->getString("set.string2") == ""); } void AbstractConfigurationTest::testSetInt() @@ -232,9 +232,9 @@ void AbstractConfigurationTest::testSetInt() pConf->setInt("set.int1", 42); pConf->setInt("set.int2", -100); pConf->setInt("set.uint", 42U); - assert (pConf->getInt("set.int1") == 42); - assert (pConf->getInt("set.int2") == -100); - assert (pConf->getInt("set.uint") == 42U); + assertTrue (pConf->getInt("set.int1") == 42); + assertTrue (pConf->getInt("set.int2") == -100); + assertTrue (pConf->getInt("set.uint") == 42U); } @@ -247,9 +247,9 @@ void AbstractConfigurationTest::testSetInt64() pConf->setInt64("set.bigint2", std::numeric_limits::min()); pConf->setInt64("set.biguint", std::numeric_limits::max()); - assert (pConf->getInt64("set.bigint1") == std::numeric_limits::max()); - assert (pConf->getInt64("set.bigint2") == std::numeric_limits::min()); - assert (pConf->getInt64("set.biguint") == std::numeric_limits::max()); + assertTrue (pConf->getInt64("set.bigint1") == std::numeric_limits::max()); + assertTrue (pConf->getInt64("set.bigint2") == std::numeric_limits::min()); + assertTrue (pConf->getInt64("set.biguint") == std::numeric_limits::max()); #endif //defined(POCO_HAVE_INT64) } @@ -260,8 +260,8 @@ void AbstractConfigurationTest::testSetDouble() pConf->setDouble("set.double1", 1.5); pConf->setDouble("set.double2", -1.5); - assert (pConf->getDouble("set.double1") == 1.5); - assert (pConf->getDouble("set.double2") == -1.5); + assertTrue (pConf->getDouble("set.double1") == 1.5); + assertTrue (pConf->getDouble("set.double2") == -1.5); } @@ -271,8 +271,8 @@ void AbstractConfigurationTest::testSetBool() pConf->setBool("set.bool1", true); pConf->setBool("set.bool2", false); - assert (pConf->getBool("set.bool1")); - assert (!pConf->getBool("set.bool2")); + assertTrue (pConf->getBool("set.bool1")); + assertTrue (!pConf->getBool("set.bool2")); } @@ -284,28 +284,28 @@ void AbstractConfigurationTest::testChangeEvents() pConf->propertyChanged += Poco::delegate(this, &AbstractConfigurationTest::onPropertyChanged); pConf->setString("set.string1", "foobar"); - assert (_changingKey == "set.string1"); - assert (_changingValue == "foobar"); - assert (_changedKey == "set.string1"); - assert (_changedValue == "foobar"); + assertTrue (_changingKey == "set.string1"); + assertTrue (_changingValue == "foobar"); + assertTrue (_changedKey == "set.string1"); + assertTrue (_changedValue == "foobar"); pConf->setInt("set.int1", 42); - assert (_changingKey == "set.int1"); - assert (_changingValue == "42"); - assert (_changedKey == "set.int1"); - assert (_changedValue == "42"); + assertTrue (_changingKey == "set.int1"); + assertTrue (_changingValue == "42"); + assertTrue (_changedKey == "set.int1"); + assertTrue (_changedValue == "42"); pConf->setDouble("set.double1", 1.5); - assert (_changingKey == "set.double1"); - assert (_changingValue == "1.5"); - assert (_changedKey == "set.double1"); - assert (_changedValue == "1.5"); + assertTrue (_changingKey == "set.double1"); + assertTrue (_changingValue == "1.5"); + assertTrue (_changedKey == "set.double1"); + assertTrue (_changedValue == "1.5"); pConf->setBool("set.bool1", true); - assert (_changingKey == "set.bool1"); - assert (_changingValue == "true"); - assert (_changedKey == "set.bool1"); - assert (_changedValue == "true"); + assertTrue (_changingKey == "set.bool1"); + assertTrue (_changingValue == "true"); + assertTrue (_changedKey == "set.bool1"); + assertTrue (_changedValue == "true"); } @@ -317,8 +317,8 @@ void AbstractConfigurationTest::testRemoveEvents() pConf->propertyRemoved += Poco::delegate(this, &AbstractConfigurationTest::onPropertyRemoved); pConf->remove("prop4.bool1"); - assert (_removingKey == "prop4.bool1"); - assert (_removedKey == "prop4.bool1"); + assertTrue (_removingKey == "prop4.bool1"); + assertTrue (_removedKey == "prop4.bool1"); } @@ -328,31 +328,31 @@ void AbstractConfigurationTest::testKeys() AbstractConfiguration::Keys keys; pConf->keys(keys); - assert (keys.size() == 13); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref4") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref5") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref6") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "ref7") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "dollar") != keys.end()); + assertTrue (keys.size() == 13); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref4") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref5") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref6") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "ref7") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "dollar") != keys.end()); pConf->keys("prop1", keys); - assert (keys.empty()); + assertTrue (keys.empty()); pConf->keys("prop3", keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (!pConf->hasProperty("nonexistent.sub")); + assertTrue (!pConf->hasProperty("nonexistent.sub")); pConf->keys("nonexistent.sub", keys); - assert (keys.empty()); + assertTrue (keys.empty()); } @@ -361,37 +361,37 @@ void AbstractConfigurationTest::testRemove() AutoPtr pConf = createConfiguration(); AbstractConfiguration::Keys keys; - assert (pConf->hasProperty("prop1")); - assert (pConf->hasProperty("prop4.bool1")); - assert (pConf->hasProperty("prop4.bool2")); - assert (pConf->hasProperty("prop4.bool3")); + assertTrue (pConf->hasProperty("prop1")); + assertTrue (pConf->hasProperty("prop4.bool1")); + assertTrue (pConf->hasProperty("prop4.bool2")); + assertTrue (pConf->hasProperty("prop4.bool3")); pConf->keys(keys); - assert (keys.size() == 13); + assertTrue (keys.size() == 13); pConf->keys("prop4", keys); - assert (keys.size() == 17); + assertTrue (keys.size() == 17); pConf->remove("prop4.bool1"); - assert (!pConf->hasProperty("prop4.bool1")); - assert (pConf->hasProperty("prop4.bool2")); - assert (pConf->hasProperty("prop4.bool3")); + assertTrue (!pConf->hasProperty("prop4.bool1")); + assertTrue (pConf->hasProperty("prop4.bool2")); + assertTrue (pConf->hasProperty("prop4.bool3")); pConf->keys(keys); - assert (keys.size() == 13); + assertTrue (keys.size() == 13); pConf->keys("prop4", keys); - assert (keys.size() == 16); + assertTrue (keys.size() == 16); pConf->remove("prop4"); - assert (!pConf->hasProperty("prop4.bool1")); - assert (!pConf->hasProperty("prop4.bool2")); - assert (!pConf->hasProperty("prop4.bool3")); - assert (pConf->hasProperty("prop1")); + assertTrue (!pConf->hasProperty("prop4.bool1")); + assertTrue (!pConf->hasProperty("prop4.bool2")); + assertTrue (!pConf->hasProperty("prop4.bool3")); + assertTrue (pConf->hasProperty("prop1")); pConf->keys(keys); - assert (keys.size() == 12); + assertTrue (keys.size() == 12); pConf->keys("prop4", keys); - assert (keys.size() == 0); + assertTrue (keys.size() == 0); - assert (!pConf->hasProperty("nonexistent.sub.value")); + assertTrue (!pConf->hasProperty("nonexistent.sub.value")); pConf->remove("nonexistent.sub.value"); - assert (!pConf->hasProperty("nonexistent.sub.value")); + assertTrue (!pConf->hasProperty("nonexistent.sub.value")); } diff --git a/Util/testsuite/src/ConfigurationMapperTest.cpp b/Util/testsuite/src/ConfigurationMapperTest.cpp index 6ad61ce90..4b469dc86 100644 --- a/Util/testsuite/src/ConfigurationMapperTest.cpp +++ b/Util/testsuite/src/ConfigurationMapperTest.cpp @@ -38,31 +38,31 @@ void ConfigurationMapperTest::testMapper1() { AutoPtr pConf = createConfiguration(); AutoPtr pMapper = new ConfigurationMapper("", "", pConf); - assert (pMapper->hasProperty("prop5.string1")); - assert (pMapper->hasProperty("prop5.string1")); + assertTrue (pMapper->hasProperty("prop5.string1")); + assertTrue (pMapper->hasProperty("prop5.string1")); AbstractConfiguration::Keys keys; pMapper->keys(keys); - assert (keys.size() == 13); - assert (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); + assertTrue (keys.size() == 13); + assertTrue (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); pMapper->keys("prop5", keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); - assert (pMapper->getString("prop5.string1") == "foo"); - assert (pMapper->getString("prop5.sub1.string1") == "FOO"); + assertTrue (pMapper->getString("prop5.string1") == "foo"); + assertTrue (pMapper->getString("prop5.sub1.string1") == "FOO"); pMapper->setString("prop5.string3", "baz"); - assert (pMapper->getString("prop5.string3") == "baz"); - assert (pConf->getString("prop5.string3") == "baz"); + assertTrue (pMapper->getString("prop5.string3") == "baz"); + assertTrue (pConf->getString("prop5.string3") == "baz"); pMapper->remove("prop5.string3"); - assert (!pMapper->hasProperty("prop5.string3")); - assert (!pConf->hasProperty("prop5.string3")); + assertTrue (!pMapper->hasProperty("prop5.string3")); + assertTrue (!pConf->hasProperty("prop5.string3")); } @@ -71,35 +71,35 @@ void ConfigurationMapperTest::testMapper2() AutoPtr pConf = createConfiguration(); AutoPtr pMapper = new ConfigurationMapper("prop5", "root.conf", pConf); - assert (pMapper->hasProperty("root.conf.string1")); - assert (pMapper->hasProperty("root.conf.string2")); + assertTrue (pMapper->hasProperty("root.conf.string1")); + assertTrue (pMapper->hasProperty("root.conf.string2")); AbstractConfiguration::Keys keys; pMapper->keys(keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "root") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "root") != keys.end()); pMapper->keys("root", keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "conf") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "conf") != keys.end()); pMapper->keys("root.conf", keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); - assert (pMapper->getString("root.conf.string1") == "foo"); - assert (pMapper->getString("root.conf.sub1.string1") == "FOO"); + assertTrue (pMapper->getString("root.conf.string1") == "foo"); + assertTrue (pMapper->getString("root.conf.sub1.string1") == "FOO"); pMapper->setString("root.conf.string3", "baz"); - assert (pMapper->getString("root.conf.string3") == "baz"); - assert (pConf->getString("prop5.string3") == "baz"); + assertTrue (pMapper->getString("root.conf.string3") == "baz"); + assertTrue (pConf->getString("prop5.string3") == "baz"); pMapper->remove("root.conf.string3"); - assert (!pMapper->hasProperty("root.conf.string3")); - assert (!pConf->hasProperty("prop5.string3")); + assertTrue (!pMapper->hasProperty("root.conf.string3")); + assertTrue (!pConf->hasProperty("prop5.string3")); } @@ -108,35 +108,35 @@ void ConfigurationMapperTest::testMapper3() AutoPtr pConf = createConfiguration(); AutoPtr pMapper = new ConfigurationMapper("", "root", pConf); - assert (pMapper->hasProperty("root.prop5.string1")); - assert (pMapper->hasProperty("root.prop5.string2")); + assertTrue (pMapper->hasProperty("root.prop5.string1")); + assertTrue (pMapper->hasProperty("root.prop5.string2")); AbstractConfiguration::Keys keys; pMapper->keys(keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "root") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "root") != keys.end()); pMapper->keys("root", keys); - assert (keys.size() == 13); - assert (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); + assertTrue (keys.size() == 13); + assertTrue (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); pMapper->keys("root.prop5", keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); - assert (pMapper->getString("root.prop5.string1") == "foo"); - assert (pMapper->getString("root.prop5.sub1.string1") == "FOO"); + assertTrue (pMapper->getString("root.prop5.string1") == "foo"); + assertTrue (pMapper->getString("root.prop5.sub1.string1") == "FOO"); pMapper->setString("root.prop5.string3", "baz"); - assert (pMapper->getString("root.prop5.string3") == "baz"); - assert (pConf->getString("prop5.string3") == "baz"); + assertTrue (pMapper->getString("root.prop5.string3") == "baz"); + assertTrue (pConf->getString("prop5.string3") == "baz"); pMapper->remove("root.prop5.string3"); - assert (!pMapper->hasProperty("root.prop5.string3")); - assert (!pConf->hasProperty("prop5.string3")); + assertTrue (!pMapper->hasProperty("root.prop5.string3")); + assertTrue (!pConf->hasProperty("prop5.string3")); } @@ -145,27 +145,27 @@ void ConfigurationMapperTest::testMapper4() AutoPtr pConf = createConfiguration(); AutoPtr pMapper = new ConfigurationMapper("prop5", "", pConf); - assert (pMapper->hasProperty("string1")); - assert (pMapper->hasProperty("string2")); + assertTrue (pMapper->hasProperty("string1")); + assertTrue (pMapper->hasProperty("string2")); AbstractConfiguration::Keys keys; pMapper->keys(keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); - assert (pMapper->getString("string1") == "foo"); - assert (pMapper->getString("sub1.string1") == "FOO"); + assertTrue (pMapper->getString("string1") == "foo"); + assertTrue (pMapper->getString("sub1.string1") == "FOO"); pMapper->setString("string3", "baz"); - assert (pMapper->getString("string3") == "baz"); - assert (pConf->getString("prop5.string3") == "baz"); + assertTrue (pMapper->getString("string3") == "baz"); + assertTrue (pConf->getString("prop5.string3") == "baz"); pMapper->remove("string3"); - assert (!pMapper->hasProperty("string3")); - assert (!pConf->hasProperty("prop5.string3")); + assertTrue (!pMapper->hasProperty("string3")); + assertTrue (!pConf->hasProperty("prop5.string3")); } diff --git a/Util/testsuite/src/ConfigurationViewTest.cpp b/Util/testsuite/src/ConfigurationViewTest.cpp index 7a63436da..f023c9963 100644 --- a/Util/testsuite/src/ConfigurationViewTest.cpp +++ b/Util/testsuite/src/ConfigurationViewTest.cpp @@ -36,68 +36,68 @@ void ConfigurationViewTest::testView() { AutoPtr pConf = createConfiguration(); AutoPtr pView = pConf->createView(""); - assert (pView->hasProperty("prop1")); - assert (pView->hasProperty("prop2")); + assertTrue (pView->hasProperty("prop1")); + assertTrue (pView->hasProperty("prop2")); AbstractConfiguration::Keys keys; pView->keys(keys); - assert (keys.size() == 13); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); + assertTrue (keys.size() == 13); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); - assert (pView->getString("prop1") == "foo"); - assert (pView->getString("prop3.string1") == "foo"); + assertTrue (pView->getString("prop1") == "foo"); + assertTrue (pView->getString("prop3.string1") == "foo"); pView->setString("prop6", "foobar"); - assert (pConf->getString("prop6") == "foobar"); + assertTrue (pConf->getString("prop6") == "foobar"); pView = pConf->createView("prop1"); pView->keys(keys); - assert (keys.empty()); - assert (pView->hasProperty("prop1")); + assertTrue (keys.empty()); + assertTrue (pView->hasProperty("prop1")); pView->setString("prop11", "foobar"); - assert (pConf->getString("prop1.prop11") == "foobar"); + assertTrue (pConf->getString("prop1.prop11") == "foobar"); pView = pConf->createView("prop3"); pView->keys(keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (pView->getString("string1") == "foo"); - assert (pView->getString("string2") == "bar"); + assertTrue (pView->getString("string1") == "foo"); + assertTrue (pView->getString("string2") == "bar"); pView->setString("string3", "foobar"); - assert (pConf->getString("prop3.string3") == "foobar"); + assertTrue (pConf->getString("prop3.string3") == "foobar"); pView = pConf->createView("prop5"); pView->keys(keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "sub2") != keys.end()); - assert (pView->getString("sub1.string1") == "FOO"); - assert (pView->getString("sub2.string2") == "Bar"); + assertTrue (pView->getString("sub1.string1") == "FOO"); + assertTrue (pView->getString("sub2.string2") == "Bar"); pView = pConf->createView("prop5.sub1"); pView->keys(keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "string1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "string2") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "string1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "string2") != keys.end()); - assert (pView->getString("string1") == "FOO"); - assert (pView->getString("string2") == "BAR"); + assertTrue (pView->getString("string1") == "FOO"); + assertTrue (pView->getString("string2") == "BAR"); pView->setString("string3", "foobar"); - assert (pConf->getString("prop5.sub1.string3") == "foobar"); + assertTrue (pConf->getString("prop5.sub1.string3") == "foobar"); pView->remove("string3"); - assert (!pConf->hasProperty("prop5.sub1.string3")); + assertTrue (!pConf->hasProperty("prop5.sub1.string3")); } diff --git a/Util/testsuite/src/FilesystemConfigurationTest.cpp b/Util/testsuite/src/FilesystemConfigurationTest.cpp index e44fcc974..174d40888 100644 --- a/Util/testsuite/src/FilesystemConfigurationTest.cpp +++ b/Util/testsuite/src/FilesystemConfigurationTest.cpp @@ -44,38 +44,38 @@ void FilesystemConfigurationTest::testFilesystemConfiguration() config->setString("logging.formatters.f1.pattern", "[%p] %t"); config->setString("logging.channels.c1.class", "ConsoleChannel"); - assert (config->getString("logging.loggers.root.channel.class") == "ConsoleChannel"); - assert (config->getString("logging.loggers.app.name") == "Application"); - assert (config->getString("logging.loggers.app.channel") == "c1"); - assert (config->getString("logging.formatters.f1.class") == "PatternFormatter"); - assert (config->getString("logging.formatters.f1.pattern") == "[%p] %t"); + assertTrue (config->getString("logging.loggers.root.channel.class") == "ConsoleChannel"); + assertTrue (config->getString("logging.loggers.app.name") == "Application"); + assertTrue (config->getString("logging.loggers.app.channel") == "c1"); + assertTrue (config->getString("logging.formatters.f1.class") == "PatternFormatter"); + assertTrue (config->getString("logging.formatters.f1.pattern") == "[%p] %t"); config->setString("logging.loggers.app.channel", "c2"); - assert (config->getString("logging.loggers.app.channel") == "c2"); + assertTrue (config->getString("logging.loggers.app.channel") == "c2"); AbstractConfiguration::Keys keys; config->keys(keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "logging") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "logging") != keys.end()); config->keys("logging", keys); - assert (keys.size() == 3); - assert (std::find(keys.begin(), keys.end(), "loggers") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "formatters") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "channels") != keys.end()); + assertTrue (keys.size() == 3); + assertTrue (std::find(keys.begin(), keys.end(), "loggers") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "formatters") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "channels") != keys.end()); config->keys("logging.formatters", keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "f1") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "f1") != keys.end()); config->keys("logging.formatters.f1", keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "class") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "pattern") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "class") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "pattern") != keys.end()); - assert (config->hasProperty("logging.loggers.root.channel.class")); + assertTrue (config->hasProperty("logging.loggers.root.channel.class")); config->clear(); - assert (!config->hasProperty("logging.loggers.root.channel.class")); + assertTrue (!config->hasProperty("logging.loggers.root.channel.class")); } diff --git a/Util/testsuite/src/IniFileConfigurationTest.cpp b/Util/testsuite/src/IniFileConfigurationTest.cpp index 251c2f5df..dc20aa3d1 100644 --- a/Util/testsuite/src/IniFileConfigurationTest.cpp +++ b/Util/testsuite/src/IniFileConfigurationTest.cpp @@ -55,38 +55,38 @@ void IniFileConfigurationTest::testLoad() std::istringstream istr(iniFile); AutoPtr pConf = new IniFileConfiguration(istr); - assert (pConf->getString("prop1") == "value1"); - assert (pConf->getString("prop2") == "value2"); - assert (pConf->getString("section1.prop1") == "value3"); - assert (pConf->getString("Section1.Prop2") == "value4"); - assert (pConf->getString("section 2.prop1") == "value 5"); - assert (pConf->getString("section 2.prop2") == "value6"); - assert (pConf->getString("SECTION 2.PROP2") == "value6"); + assertTrue (pConf->getString("prop1") == "value1"); + assertTrue (pConf->getString("prop2") == "value2"); + assertTrue (pConf->getString("section1.prop1") == "value3"); + assertTrue (pConf->getString("Section1.Prop2") == "value4"); + assertTrue (pConf->getString("section 2.prop1") == "value 5"); + assertTrue (pConf->getString("section 2.prop2") == "value6"); + assertTrue (pConf->getString("SECTION 2.PROP2") == "value6"); AbstractConfiguration::Keys keys; pConf->keys(keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "section1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "section 2") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "section1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "section 2") != keys.end()); pConf->keys("Section1", keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); pConf->setString("prop1", "value11"); - assert (pConf->getString("PROP1") == "value11"); + assertTrue (pConf->getString("PROP1") == "value11"); pConf->setString("Prop1", "value12"); - assert (pConf->getString("prop1") == "value12"); + assertTrue (pConf->getString("prop1") == "value12"); pConf->keys(keys); - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "section1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "section 2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "Prop1") == keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "section1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "section 2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "Prop1") == keys.end()); } @@ -95,34 +95,34 @@ void IniFileConfigurationTest::testCaseInsensitiveRemove() AutoPtr pConf = createConfiguration(); AbstractConfiguration::Keys keys; - assert (pConf->hasProperty("Prop1")); - assert (pConf->hasProperty("prop4.BOOL1")); - assert (pConf->hasProperty("Prop4.bool2")); - assert (pConf->hasProperty("PROP4.Bool3")); + assertTrue (pConf->hasProperty("Prop1")); + assertTrue (pConf->hasProperty("prop4.BOOL1")); + assertTrue (pConf->hasProperty("Prop4.bool2")); + assertTrue (pConf->hasProperty("PROP4.Bool3")); pConf->keys(keys); - assert (keys.size() == 13); + assertTrue (keys.size() == 13); pConf->keys("prop4", keys); - assert (keys.size() == 17); + assertTrue (keys.size() == 17); pConf->remove("PROP4.Bool1"); - assert (pConf->hasProperty("Prop1")); - assert (!pConf->hasProperty("prop4.BOOL1")); - assert (pConf->hasProperty("Prop4.bool2")); - assert (pConf->hasProperty("PROP4.Bool3")); + assertTrue (pConf->hasProperty("Prop1")); + assertTrue (!pConf->hasProperty("prop4.BOOL1")); + assertTrue (pConf->hasProperty("Prop4.bool2")); + assertTrue (pConf->hasProperty("PROP4.Bool3")); pConf->keys(keys); - assert (keys.size() == 13); + assertTrue (keys.size() == 13); pConf->keys("PROP4", keys); - assert (keys.size() == 16); + assertTrue (keys.size() == 16); pConf->remove("Prop4"); - assert (pConf->hasProperty("Prop1")); - assert (!pConf->hasProperty("prop4.BOOL1")); - assert (!pConf->hasProperty("Prop4.bool2")); - assert (!pConf->hasProperty("PROP4.Bool3")); + assertTrue (pConf->hasProperty("Prop1")); + assertTrue (!pConf->hasProperty("prop4.BOOL1")); + assertTrue (!pConf->hasProperty("Prop4.bool2")); + assertTrue (!pConf->hasProperty("PROP4.Bool3")); pConf->keys(keys); - assert (keys.size() == 12); + assertTrue (keys.size() == 12); pConf->keys("prop4", keys); - assert (keys.size() == 0); + assertTrue (keys.size() == 0); } diff --git a/Util/testsuite/src/JSONConfigurationTest.cpp b/Util/testsuite/src/JSONConfigurationTest.cpp index 917cc18df..3c8fefd90 100644 --- a/Util/testsuite/src/JSONConfigurationTest.cpp +++ b/Util/testsuite/src/JSONConfigurationTest.cpp @@ -54,28 +54,28 @@ void JSONConfigurationTest::testLoad() catch(JSONException jsone) { std::cout << jsone.message() << std::endl; - assert(false); + assertTrue (false); } std::string property1 = config.getString("config.prop1"); - assert(property1.compare("value1") == 0); + assertTrue (property1.compare("value1") == 0); int property2 = config.getInt("config.prop2"); - assert(property2 == 10); + assertTrue (property2 == 10); int nonExistingProperty = config.getInt("config.prop7", 5); - assert(nonExistingProperty == 5); + assertTrue (nonExistingProperty == 5); std::string arrProperty = config.getString("config.prop3[1]"); - assert(arrProperty.compare("element2") == 0); + assertTrue (arrProperty.compare("element2") == 0); bool property35 = config.getBool("config.prop4.prop5"); - assert(! property35); + assertTrue (! property35); try { config.getString("propertyUnknown"); - assert(true); + assertTrue (true); } catch(NotFoundException nfe) { @@ -102,15 +102,15 @@ void JSONConfigurationTest::testSetArrayElement() // config.prop3[0] = "foo" config.setString("config.prop3[0]", "foo"); - assert(config.getString("config.prop3[0]") == "foo"); + assertTrue (config.getString("config.prop3[0]") == "foo"); // config.prop3[1] = "bar" config.setString("config.prop3[1]", "bar"); - assert(config.getString("config.prop3[1]") == "bar"); + assertTrue (config.getString("config.prop3[1]") == "bar"); // config.prop3[3] = "baz" config.setString("config.prop3[3]", "baz"); - assert(config.getString("config.prop3[3]") == "baz"); + assertTrue (config.getString("config.prop3[3]") == "baz"); } diff --git a/Util/testsuite/src/LayeredConfigurationTest.cpp b/Util/testsuite/src/LayeredConfigurationTest.cpp index 8aacb52cb..ba720da4c 100644 --- a/Util/testsuite/src/LayeredConfigurationTest.cpp +++ b/Util/testsuite/src/LayeredConfigurationTest.cpp @@ -42,9 +42,9 @@ void LayeredConfigurationTest::testEmpty() AbstractConfiguration::Keys keys; pLC->keys(keys); - assert (keys.empty()); + assertTrue (keys.empty()); - assert (!pLC->hasProperty("foo")); + assertTrue (!pLC->hasProperty("foo")); try { pLC->setString("foo", "bar"); @@ -77,18 +77,18 @@ void LayeredConfigurationTest::testOneLayer() AbstractConfiguration::Keys keys; pLC->keys(keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (pLC->getString("prop1") == "value1"); - assert (pLC->getString("prop2") == "value2"); + assertTrue (pLC->getString("prop1") == "value1"); + assertTrue (pLC->getString("prop2") == "value2"); pLC->setString("prop3", "value3"); - assert (pLC->getString("prop3") == "value3"); + assertTrue (pLC->getString("prop3") == "value3"); pLC->remove("prop3"); - assert (!pLC->hasProperty("prop3")); + assertTrue (!pLC->hasProperty("prop3")); } @@ -108,28 +108,28 @@ void LayeredConfigurationTest::testTwoLayers() AbstractConfiguration::Keys keys; pLC->keys(keys); - assert (keys.size() == 3); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); + assertTrue (keys.size() == 3); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); - assert (pLC->getString("prop1") == "value1"); - assert (pLC->getString("prop2") == "value2"); - assert (pLC->getString("prop3") == "value4"); + assertTrue (pLC->getString("prop1") == "value1"); + assertTrue (pLC->getString("prop2") == "value2"); + assertTrue (pLC->getString("prop3") == "value4"); pLC->setString("prop4", "value4"); - assert (pLC->getString("prop4") == "value4"); + assertTrue (pLC->getString("prop4") == "value4"); - assert (!pMC1->hasProperty("prop4")); - assert (pMC2->hasProperty("prop4")); + assertTrue (!pMC1->hasProperty("prop4")); + assertTrue (pMC2->hasProperty("prop4")); pLC->setString("prop1", "value11"); - assert (pLC->getString("prop1") == "value1"); - assert (pMC2->getString("prop1") == "value11"); + assertTrue (pLC->getString("prop1") == "value1"); + assertTrue (pMC2->getString("prop1") == "value11"); pLC->remove("prop1"); - assert (pLC->getString("prop1") == "value1"); - assert (!pMC2->hasProperty("prop1")); + assertTrue (pLC->getString("prop1") == "value1"); + assertTrue (!pMC2->hasProperty("prop1")); } @@ -152,11 +152,11 @@ void LayeredConfigurationTest::testThreeLayers() pLC->add(pMC2, 1); pLC->add(pMC3, -1); - assert (pLC->getString("prop1") == "value7"); - assert (pLC->getString("prop2") == "value2"); - assert (pLC->getString("prop3") == "value3"); - assert (pLC->getString("prop4") == "value5"); - assert (pLC->getString("prop5") == "value6"); + assertTrue (pLC->getString("prop1") == "value7"); + assertTrue (pLC->getString("prop2") == "value2"); + assertTrue (pLC->getString("prop3") == "value3"); + assertTrue (pLC->getString("prop4") == "value5"); + assertTrue (pLC->getString("prop5") == "value6"); } @@ -176,22 +176,22 @@ void LayeredConfigurationTest::testRemove() AbstractConfiguration::Keys keys; pLC->keys(keys); - assert (keys.size() == 3); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); + assertTrue (keys.size() == 3); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); - assert (pLC->getString("prop1") == "value1"); - assert (pLC->getString("prop2") == "value3"); - assert (pLC->getString("prop3") == "value4"); + assertTrue (pLC->getString("prop1") == "value1"); + assertTrue (pLC->getString("prop2") == "value3"); + assertTrue (pLC->getString("prop3") == "value4"); pLC->removeConfiguration(pMC2); keys.clear(); pLC->keys(keys); - assert (keys.size() == 2); + assertTrue (keys.size() == 2); - assert (pLC->getString("prop1") == "value1"); - assert (pLC->getString("prop2") == "value2"); + assertTrue (pLC->getString("prop1") == "value1"); + assertTrue (pLC->getString("prop2") == "value2"); } @@ -205,10 +205,10 @@ void LayeredConfigurationTest::testFind() pLC->add(pMC2, "label", -1); AutoPtr pFound = pLC->find("label"); - assert (pFound == pMC2); + assertTrue (pFound == pMC2); pFound = pLC->find("notfound"); - assert (pFound.isNull()); + assertTrue (pFound.isNull()); } diff --git a/Util/testsuite/src/LoggingConfiguratorTest.cpp b/Util/testsuite/src/LoggingConfiguratorTest.cpp index c5005912e..c9f8e3e67 100644 --- a/Util/testsuite/src/LoggingConfiguratorTest.cpp +++ b/Util/testsuite/src/LoggingConfiguratorTest.cpp @@ -86,7 +86,7 @@ void LoggingConfiguratorTest::testConfigurator() configurator.configure(pConfig); Logger& root = Logger::get(""); - assert (root.getLevel() == Message::PRIO_WARNING); + assertTrue (root.getLevel() == Message::PRIO_WARNING); FormattingChannel* pFC = dynamic_cast(root.getChannel()); assertNotNull (pFC); #if defined(_WIN32) && !defined(_WIN32_WCE) @@ -95,18 +95,18 @@ void LoggingConfiguratorTest::testConfigurator() assertNotNull (dynamic_cast(pFC->getChannel())); #endif assertNotNull (dynamic_cast(pFC->getFormatter())); - assert (static_cast(pFC->getFormatter())->getProperty("pattern") == "%s-[%p] %t"); + assertTrue (static_cast(pFC->getFormatter())->getProperty("pattern") == "%s-[%p] %t"); Logger& logger1 = Logger::get("logger1"); - assert (logger1.getLevel() == Message::PRIO_INFORMATION); + assertTrue (logger1.getLevel() == Message::PRIO_INFORMATION); pFC = dynamic_cast(logger1.getChannel()); assertNotNull (pFC); assertNotNull (dynamic_cast(pFC->getChannel())); assertNotNull (dynamic_cast(pFC->getFormatter())); - assert (static_cast(pFC->getFormatter())->getProperty("pattern") == "%s: [%p] %t"); + assertTrue (static_cast(pFC->getFormatter())->getProperty("pattern") == "%s: [%p] %t"); Logger& logger2 = Logger::get("logger2"); - assert (logger2.getLevel() == Message::PRIO_DEBUG); + assertTrue (logger2.getLevel() == Message::PRIO_DEBUG); assertNotNull (dynamic_cast(logger2.getChannel())); } diff --git a/Util/testsuite/src/MapConfigurationTest.cpp b/Util/testsuite/src/MapConfigurationTest.cpp index 9a0f04f8f..cfd2a2207 100644 --- a/Util/testsuite/src/MapConfigurationTest.cpp +++ b/Util/testsuite/src/MapConfigurationTest.cpp @@ -35,10 +35,10 @@ void MapConfigurationTest::testClear() AutoPtr pConf = new MapConfiguration; pConf->setString("foo", "bar"); - assert (pConf->hasProperty("foo")); + assertTrue (pConf->hasProperty("foo")); pConf->clear(); - assert (!pConf->hasProperty("foo")); + assertTrue (!pConf->hasProperty("foo")); } diff --git a/Util/testsuite/src/OptionProcessorTest.cpp b/Util/testsuite/src/OptionProcessorTest.cpp index 8df4dbf91..25874f00b 100644 --- a/Util/testsuite/src/OptionProcessorTest.cpp +++ b/Util/testsuite/src/OptionProcessorTest.cpp @@ -82,38 +82,38 @@ void OptionProcessorTest::testUnix() std::string name; std::string value; - assert (p1.process("-I/usr/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/include"); + assertTrue (p1.process("-I/usr/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/include"); - assert (p1.process("--include:/usr/local/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/local/include"); + assertTrue (p1.process("--include:/usr/local/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/local/include"); - assert (p1.process("-I", name, value)); - assert (name.empty()); - assert (value.empty()); - assert (p1.process("/usr/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/include"); + assertTrue (p1.process("-I", name, value)); + assertTrue (name.empty()); + assertTrue (value.empty()); + assertTrue (p1.process("/usr/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/include"); - assert (p1.process("-I", name, value)); - assert (name.empty()); - assert (value.empty()); - assert (p1.process("-L", name, value)); - assert (name == "include-dir"); - assert (value == "-L"); + assertTrue (p1.process("-I", name, value)); + assertTrue (name.empty()); + assertTrue (value.empty()); + assertTrue (p1.process("-L", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "-L"); - assert (p1.process("--lib=/usr/local/lib", name, value)); - assert (name == "library-dir"); - assert (value == "/usr/local/lib"); + assertTrue (p1.process("--lib=/usr/local/lib", name, value)); + assertTrue (name == "library-dir"); + assertTrue (value == "/usr/local/lib"); - assert (p1.process("-ofile", name, value)); - assert (name == "output"); - assert (value == "file"); + assertTrue (p1.process("-ofile", name, value)); + assertTrue (name == "output"); + assertTrue (value == "file"); - assert (!p1.process("src/file.cpp", name, value)); - assert (!p1.process("/src/file.cpp", name, value)); + assertTrue (!p1.process("src/file.cpp", name, value)); + assertTrue (!p1.process("/src/file.cpp", name, value)); try { @@ -124,9 +124,9 @@ void OptionProcessorTest::testUnix() { } - assert (p1.process("-g", name, value)); - assert (name == "debug"); - assert (value == ""); + assertTrue (p1.process("-g", name, value)); + assertTrue (name == "debug"); + assertTrue (value == ""); try { @@ -208,31 +208,31 @@ void OptionProcessorTest::testDefault() std::string name; std::string value; - assert (p1.process("/Inc:/usr/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/include"); + assertTrue (p1.process("/Inc:/usr/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/include"); - assert (p1.process("/include:/usr/local/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/local/include"); + assertTrue (p1.process("/include:/usr/local/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/local/include"); - assert (p1.process("/Inc", name, value)); - assert (name.empty()); - assert (value.empty()); - assert (p1.process("/usr/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/include"); + assertTrue (p1.process("/Inc", name, value)); + assertTrue (name.empty()); + assertTrue (value.empty()); + assertTrue (p1.process("/usr/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/include"); - assert (p1.process("/lib=/usr/local/lib", name, value)); - assert (name == "library-dir"); - assert (value == "/usr/local/lib"); + assertTrue (p1.process("/lib=/usr/local/lib", name, value)); + assertTrue (name == "library-dir"); + assertTrue (value == "/usr/local/lib"); - assert (p1.process("/out:file", name, value)); - assert (name == "output"); - assert (value == "file"); + assertTrue (p1.process("/out:file", name, value)); + assertTrue (name == "output"); + assertTrue (value == "file"); - assert (!p1.process("src/file.cpp", name, value)); - assert (!p1.process("\\src\\file.cpp", name, value)); + assertTrue (!p1.process("src/file.cpp", name, value)); + assertTrue (!p1.process("\\src\\file.cpp", name, value)); try { @@ -243,9 +243,9 @@ void OptionProcessorTest::testDefault() { } - assert (p1.process("/debug", name, value)); - assert (name == "debug"); - assert (value == ""); + assertTrue (p1.process("/debug", name, value)); + assertTrue (name == "debug"); + assertTrue (value == ""); try { @@ -297,7 +297,7 @@ void OptionProcessorTest::testRequired() { } - assert (p1.process("-o", name, value)); + assertTrue (p1.process("-o", name, value)); p1.checkRequired(); } @@ -322,35 +322,35 @@ void OptionProcessorTest::testArgs() std::string name; std::string value; - assert (p1.process("-I/usr/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/include"); + assertTrue (p1.process("-I/usr/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/include"); - assert (p1.process("--include:/usr/local/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/local/include"); + assertTrue (p1.process("--include:/usr/local/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/local/include"); - assert (p1.process("-I", name, value)); - assert (name.empty()); - assert (value.empty()); - assert (p1.process("/usr/include", name, value)); - assert (name == "include-dir"); - assert (value == "/usr/include"); + assertTrue (p1.process("-I", name, value)); + assertTrue (name.empty()); + assertTrue (value.empty()); + assertTrue (p1.process("/usr/include", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "/usr/include"); - assert (p1.process("-I", name, value)); - assert (name.empty()); - assert (value.empty()); - assert (p1.process("-L", name, value)); - assert (name == "include-dir"); - assert (value == "-L"); + assertTrue (p1.process("-I", name, value)); + assertTrue (name.empty()); + assertTrue (value.empty()); + assertTrue (p1.process("-L", name, value)); + assertTrue (name == "include-dir"); + assertTrue (value == "-L"); - assert (p1.process("-O", name, value)); - assert (name == "optimize"); - assert (value.empty()); + assertTrue (p1.process("-O", name, value)); + assertTrue (name == "optimize"); + assertTrue (value.empty()); - assert (p1.process("-O2", name, value)); - assert (name == "optimize"); - assert (value == "2"); + assertTrue (p1.process("-O2", name, value)); + assertTrue (name == "optimize"); + assertTrue (value == "2"); } diff --git a/Util/testsuite/src/OptionSetTest.cpp b/Util/testsuite/src/OptionSetTest.cpp index c857b9e60..33c5865df 100644 --- a/Util/testsuite/src/OptionSetTest.cpp +++ b/Util/testsuite/src/OptionSetTest.cpp @@ -67,38 +67,38 @@ void OptionSetTest::testOptionSet() .repeatable(true) .argument("path")); - assert (set.hasOption("include", false)); - assert (set.hasOption("I", true)); - assert (set.hasOption("Include", true)); - assert (set.hasOption("insert", false)); - assert (set.hasOption("it", true)); - assert (set.hasOption("Insert", false)); - assert (set.hasOption("item", false)); - assert (!set.hasOption("i", false)); - assert (!set.hasOption("in", false)); + assertTrue (set.hasOption("include", false)); + assertTrue (set.hasOption("I", true)); + assertTrue (set.hasOption("Include", true)); + assertTrue (set.hasOption("insert", false)); + assertTrue (set.hasOption("it", true)); + assertTrue (set.hasOption("Insert", false)); + assertTrue (set.hasOption("item", false)); + assertTrue (!set.hasOption("i", false)); + assertTrue (!set.hasOption("in", false)); - assert (set.hasOption("help")); - assert (set.hasOption("h", true)); - assert (set.hasOption("helper")); - assert (set.hasOption("H", true)); + assertTrue (set.hasOption("help")); + assertTrue (set.hasOption("h", true)); + assertTrue (set.hasOption("helper")); + assertTrue (set.hasOption("H", true)); const Option& opt1 = set.getOption("include"); - assert (opt1.fullName() == "include"); + assertTrue (opt1.fullName() == "include"); const Option& opt2 = set.getOption("item"); - assert (opt2.fullName() == "item"); + assertTrue (opt2.fullName() == "item"); const Option& opt3 = set.getOption("I", true); - assert (opt3.fullName() == "include-dir"); + assertTrue (opt3.fullName() == "include-dir"); const Option& opt4 = set.getOption("include-d"); - assert (opt4.fullName() == "include-dir"); + assertTrue (opt4.fullName() == "include-dir"); const Option& opt5 = set.getOption("help"); - assert (opt5.fullName() == "help"); + assertTrue (opt5.fullName() == "help"); const Option& opt6 = set.getOption("helpe"); - assert (opt6.fullName() == "helper"); + assertTrue (opt6.fullName() == "helper"); try { diff --git a/Util/testsuite/src/OptionTest.cpp b/Util/testsuite/src/OptionTest.cpp index fa4e77b2b..b08d08aea 100644 --- a/Util/testsuite/src/OptionTest.cpp +++ b/Util/testsuite/src/OptionTest.cpp @@ -53,44 +53,44 @@ void OptionTest::testOption() .repeatable(false) .argument("level", false); - assert (incOpt.shortName() == "I"); - assert (incOpt.fullName() == "include-dir"); - assert (incOpt.repeatable()); - assert (!incOpt.required()); - assert (incOpt.argumentName() == "path"); - assert (incOpt.argumentRequired()); - assert (incOpt.takesArgument()); + assertTrue (incOpt.shortName() == "I"); + assertTrue (incOpt.fullName() == "include-dir"); + assertTrue (incOpt.repeatable()); + assertTrue (!incOpt.required()); + assertTrue (incOpt.argumentName() == "path"); + assertTrue (incOpt.argumentRequired()); + assertTrue (incOpt.takesArgument()); - assert (libOpt.shortName() == "L"); - assert (libOpt.fullName() == "library-dir"); - assert (libOpt.repeatable()); - assert (!libOpt.required()); - assert (libOpt.argumentName() == "path"); - assert (libOpt.argumentRequired()); - assert (incOpt.takesArgument()); + assertTrue (libOpt.shortName() == "L"); + assertTrue (libOpt.fullName() == "library-dir"); + assertTrue (libOpt.repeatable()); + assertTrue (!libOpt.required()); + assertTrue (libOpt.argumentName() == "path"); + assertTrue (libOpt.argumentRequired()); + assertTrue (incOpt.takesArgument()); - assert (outOpt.shortName() == "o"); - assert (outOpt.fullName() == "output"); - assert (!outOpt.repeatable()); - assert (outOpt.required()); - assert (outOpt.argumentName() == "file"); - assert (outOpt.argumentRequired()); - assert (incOpt.takesArgument()); + assertTrue (outOpt.shortName() == "o"); + assertTrue (outOpt.fullName() == "output"); + assertTrue (!outOpt.repeatable()); + assertTrue (outOpt.required()); + assertTrue (outOpt.argumentName() == "file"); + assertTrue (outOpt.argumentRequired()); + assertTrue (incOpt.takesArgument()); - assert (vrbOpt.shortName() == "v"); - assert (vrbOpt.fullName() == "verbose"); - assert (!vrbOpt.repeatable()); - assert (!vrbOpt.required()); - assert (!vrbOpt.argumentRequired()); - assert (!vrbOpt.takesArgument()); + assertTrue (vrbOpt.shortName() == "v"); + assertTrue (vrbOpt.fullName() == "verbose"); + assertTrue (!vrbOpt.repeatable()); + assertTrue (!vrbOpt.required()); + assertTrue (!vrbOpt.argumentRequired()); + assertTrue (!vrbOpt.takesArgument()); - assert (optOpt.shortName() == "O"); - assert (optOpt.fullName() == "optimize"); - assert (!optOpt.repeatable()); - assert (!optOpt.required()); - assert (optOpt.argumentName() == "level"); - assert (optOpt.takesArgument()); - assert (!optOpt.argumentRequired()); + assertTrue (optOpt.shortName() == "O"); + assertTrue (optOpt.fullName() == "optimize"); + assertTrue (!optOpt.repeatable()); + assertTrue (!optOpt.required()); + assertTrue (optOpt.argumentName() == "level"); + assertTrue (optOpt.takesArgument()); + assertTrue (!optOpt.argumentRequired()); } @@ -101,22 +101,22 @@ void OptionTest::testMatches1() .repeatable(true) .argument("path"); - assert (incOpt.matchesShort("Iinclude")); - assert (incOpt.matchesPartial("include:include")); - assert (incOpt.matchesPartial("include-dir:include")); - assert (incOpt.matchesPartial("inc=include")); - assert (incOpt.matchesPartial("INCLUDE=include")); - assert (incOpt.matchesPartial("include")); - assert (incOpt.matchesShort("I")); - assert (incOpt.matchesPartial("i")); + assertTrue (incOpt.matchesShort("Iinclude")); + assertTrue (incOpt.matchesPartial("include:include")); + assertTrue (incOpt.matchesPartial("include-dir:include")); + assertTrue (incOpt.matchesPartial("inc=include")); + assertTrue (incOpt.matchesPartial("INCLUDE=include")); + assertTrue (incOpt.matchesPartial("include")); + assertTrue (incOpt.matchesShort("I")); + assertTrue (incOpt.matchesPartial("i")); - assert (incOpt.matchesFull("include-dir:include")); - assert (incOpt.matchesFull("INClude-dir:include")); - assert (!incOpt.matchesFull("include:include")); - assert (!incOpt.matchesFull("include-dir2:include")); + assertTrue (incOpt.matchesFull("include-dir:include")); + assertTrue (incOpt.matchesFull("INClude-dir:include")); + assertTrue (!incOpt.matchesFull("include:include")); + assertTrue (!incOpt.matchesFull("include-dir2:include")); - assert (!incOpt.matchesPartial("include-dir2=include")); - assert (!incOpt.matchesShort("linclude")); + assertTrue (!incOpt.matchesPartial("include-dir2=include")); + assertTrue (!incOpt.matchesShort("linclude")); } @@ -127,21 +127,21 @@ void OptionTest::testMatches2() .repeatable(true) .argument("path"); - assert (!incOpt.matchesShort("Iinclude")); - assert (incOpt.matchesPartial("include:include")); - assert (incOpt.matchesPartial("include-dir:include")); - assert (incOpt.matchesPartial("inc=include")); - assert (incOpt.matchesPartial("INCLUDE=include")); - assert (incOpt.matchesPartial("I")); - assert (incOpt.matchesPartial("i")); + assertTrue (!incOpt.matchesShort("Iinclude")); + assertTrue (incOpt.matchesPartial("include:include")); + assertTrue (incOpt.matchesPartial("include-dir:include")); + assertTrue (incOpt.matchesPartial("inc=include")); + assertTrue (incOpt.matchesPartial("INCLUDE=include")); + assertTrue (incOpt.matchesPartial("I")); + assertTrue (incOpt.matchesPartial("i")); - assert (incOpt.matchesFull("include-dir:include")); - assert (incOpt.matchesFull("INClude-dir:include")); - assert (!incOpt.matchesFull("include:include")); - assert (!incOpt.matchesFull("include-dir2:include")); + assertTrue (incOpt.matchesFull("include-dir:include")); + assertTrue (incOpt.matchesFull("INClude-dir:include")); + assertTrue (!incOpt.matchesFull("include:include")); + assertTrue (!incOpt.matchesFull("include-dir2:include")); - assert (!incOpt.matchesFull("include-dir2=include")); - assert (!incOpt.matchesShort("linclude")); + assertTrue (!incOpt.matchesFull("include-dir2=include")); + assertTrue (!incOpt.matchesShort("linclude")); } @@ -154,17 +154,17 @@ void OptionTest::testProcess1() std::string arg; incOpt.process("Iinclude", arg); - assert (arg == "include"); + assertTrue (arg == "include"); incOpt.process("I/usr/include", arg); - assert (arg == "/usr/include"); + assertTrue (arg == "/usr/include"); incOpt.process("include:/usr/local/include", arg); - assert (arg == "/usr/local/include"); + assertTrue (arg == "/usr/local/include"); incOpt.process("include=/proj/include", arg); - assert (arg == "/proj/include"); + assertTrue (arg == "/proj/include"); incOpt.process("include-dir=/usr/include", arg); - assert (arg == "/usr/include"); + assertTrue (arg == "/usr/include"); incOpt.process("Include-dir:/proj/include", arg); - assert (arg == "/proj/include"); + assertTrue (arg == "/proj/include"); try { @@ -199,9 +199,9 @@ void OptionTest::testProcess1() .repeatable(false); vrbOpt.process("v", arg); - assert (arg.empty()); + assertTrue (arg.empty()); vrbOpt.process("verbose", arg); - assert (arg.empty()); + assertTrue (arg.empty()); try { @@ -228,17 +228,17 @@ void OptionTest::testProcess1() .argument("level", false); optOpt.process("O", arg); - assert (arg.empty()); + assertTrue (arg.empty()); optOpt.process("O2", arg); - assert (arg == "2"); + assertTrue (arg == "2"); optOpt.process("optimize:1", arg); - assert (arg == "1"); + assertTrue (arg == "1"); optOpt.process("opt", arg); - assert (arg.empty()); + assertTrue (arg.empty()); optOpt.process("opt=3", arg); - assert (arg == "3"); + assertTrue (arg == "3"); optOpt.process("opt=", arg); - assert (arg.empty()); + assertTrue (arg.empty()); } @@ -251,13 +251,13 @@ void OptionTest::testProcess2() std::string arg; incOpt.process("include:/usr/local/include", arg); - assert (arg == "/usr/local/include"); + assertTrue (arg == "/usr/local/include"); incOpt.process("include=/proj/include", arg); - assert (arg == "/proj/include"); + assertTrue (arg == "/proj/include"); incOpt.process("include-dir=/usr/include", arg); - assert (arg == "/usr/include"); + assertTrue (arg == "/usr/include"); incOpt.process("Include-dir:/proj/include", arg); - assert (arg == "/proj/include"); + assertTrue (arg == "/proj/include"); try { @@ -301,9 +301,9 @@ void OptionTest::testProcess2() .repeatable(false); vrbOpt.process("v", arg); - assert (arg.empty()); + assertTrue (arg.empty()); vrbOpt.process("verbose", arg); - assert (arg.empty()); + assertTrue (arg.empty()); try { diff --git a/Util/testsuite/src/PropertyFileConfigurationTest.cpp b/Util/testsuite/src/PropertyFileConfigurationTest.cpp index d237c1c6c..695567f71 100644 --- a/Util/testsuite/src/PropertyFileConfigurationTest.cpp +++ b/Util/testsuite/src/PropertyFileConfigurationTest.cpp @@ -54,28 +54,28 @@ void PropertyFileConfigurationTest::testLoad() std::istringstream istr(propFile); AutoPtr pConf = new PropertyFileConfiguration(istr); - assert (pConf->getString("prop1") == "value1"); - assert (pConf->getString("prop2") == "value2"); - assert (pConf->getString("prop3.prop31") == "value3"); - assert (pConf->getString("prop3.prop32") == "value 4"); - assert (pConf->getString("prop3.prop33") == "value5, value6, value7, value8, value9"); - assert (pConf->getString("prop4") == "escaped[\t\r\n\f]"); - assert (pConf->getString("prop5") == "foo"); + assertTrue (pConf->getString("prop1") == "value1"); + assertTrue (pConf->getString("prop2") == "value2"); + assertTrue (pConf->getString("prop3.prop31") == "value3"); + assertTrue (pConf->getString("prop3.prop32") == "value 4"); + assertTrue (pConf->getString("prop3.prop33") == "value5, value6, value7, value8, value9"); + assertTrue (pConf->getString("prop4") == "escaped[\t\r\n\f]"); + assertTrue (pConf->getString("prop5") == "foo"); AbstractConfiguration::Keys keys; pConf->keys(keys); - assert (keys.size() == 5); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); + assertTrue (keys.size() == 5); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); pConf->keys("prop3", keys); - assert (keys.size() == 3); - assert (std::find(keys.begin(), keys.end(), "prop31") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop32") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop33") != keys.end()); + assertTrue (keys.size() == 3); + assertTrue (std::find(keys.begin(), keys.end(), "prop31") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop32") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop33") != keys.end()); try { @@ -99,7 +99,7 @@ void PropertyFileConfigurationTest::testSave() std::ostringstream ostr; pConf->save(ostr); std::string propFile = ostr.str(); - assert (propFile == "prop1: value1\n" + assertTrue (propFile == "prop1: value1\n" "prop2: 42\n" "prop3: value\\\\1\\txxx\n"); } diff --git a/Util/testsuite/src/SystemConfigurationTest.cpp b/Util/testsuite/src/SystemConfigurationTest.cpp index a4bd2aa2f..7caa80841 100644 --- a/Util/testsuite/src/SystemConfigurationTest.cpp +++ b/Util/testsuite/src/SystemConfigurationTest.cpp @@ -46,20 +46,20 @@ void SystemConfigurationTest::testProperties() { AutoPtr pConf = new SystemConfiguration; - assert (pConf->getString("system.osName") == Environment::osName()); - assert (pConf->getString("system.osVersion") == Environment::osVersion()); - assert (pConf->getString("system.osArchitecture") == Environment::osArchitecture()); - assert (pConf->getString("system.nodeName") == Environment::nodeName()); - assert (pConf->getString("system.currentDir") == Path::current()); - assert (pConf->getString("system.homeDir") == Path::home()); - assert (pConf->getString("system.tempDir") == Path::temp()); + assertTrue (pConf->getString("system.osName") == Environment::osName()); + assertTrue (pConf->getString("system.osVersion") == Environment::osVersion()); + assertTrue (pConf->getString("system.osArchitecture") == Environment::osArchitecture()); + assertTrue (pConf->getString("system.nodeName") == Environment::nodeName()); + assertTrue (pConf->getString("system.currentDir") == Path::current()); + assertTrue (pConf->getString("system.homeDir") == Path::home()); + assertTrue (pConf->getString("system.tempDir") == Path::temp()); std::string dateTime = pConf->getString("system.dateTime"); - assert (dateTime.size() == 20); + assertTrue (dateTime.size() == 20); #if !defined(POCO_VXWORKS) std::string pid = pConf->getString("system.pid"); - assert (Poco::NumberParser::parse64(pid) == Poco::Process::id()); + assertTrue (Poco::NumberParser::parse64(pid) == Poco::Process::id()); #endif #if defined(POCO_OS_FAMILY_WINDOWS) @@ -67,7 +67,7 @@ void SystemConfigurationTest::testProperties() #else std::string home = pConf->getString("system.env.HOME"); #endif - assert (!home.empty()); + assertTrue (!home.empty()); } @@ -77,31 +77,31 @@ void SystemConfigurationTest::testKeys() AbstractConfiguration::Keys keys; pConf->keys(keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "system") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "system") != keys.end()); pConf->keys("system", keys); #if defined(POCO_VXWORKS) - assert (keys.size() == 10); + assertTrue (keys.size() == 10); #else - assert (keys.size() == 16); + assertTrue (keys.size() == 16); #endif - assert (std::find(keys.begin(), keys.end(), "osName") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "osVersion") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "osArchitecture") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "nodeName") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "nodeId") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "currentDir") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "homeDir") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "configHomeDir") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "cacheHomeDir") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "dataHomeDir") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "tempDir") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "dateTime") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "osName") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "osVersion") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "osArchitecture") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "nodeName") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "nodeId") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "currentDir") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "homeDir") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "configHomeDir") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "cacheHomeDir") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "dataHomeDir") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "tempDir") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "dateTime") != keys.end()); #if !defined(POCO_VXWORKS) - assert (std::find(keys.begin(), keys.end(), "pid") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "pid") != keys.end()); #endif - assert (std::find(keys.begin(), keys.end(), "env") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "env") != keys.end()); } diff --git a/Util/testsuite/src/TimerTest.cpp b/Util/testsuite/src/TimerTest.cpp index 8b8fc5576..e95f0da68 100644 --- a/Util/testsuite/src/TimerTest.cpp +++ b/Util/testsuite/src/TimerTest.cpp @@ -41,12 +41,12 @@ void TimerTest::testScheduleTimestamp() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); timer.schedule(pTask, time); _event.wait(); - assert (pTask->lastExecution() >= time); + assertTrue (pTask->lastExecution() >= time); } @@ -63,12 +63,12 @@ void TimerTest::testScheduleClock() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); timer.schedule(pTask, clock); _event.wait(); - assert (pTask->lastExecution() >= time); + assertTrue (pTask->lastExecution() >= time); } @@ -80,24 +80,24 @@ void TimerTest::testScheduleInterval() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); timer.schedule(pTask, 500, 500); _event.wait(); - assert (time.elapsed() >= 590000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 590000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1190000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1190000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1790000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1790000); + assertTrue (pTask->lastExecution().elapsed() < 130000); pTask->cancel(); - assert (pTask->isCancelled()); + assertTrue (pTask->isCancelled()); } @@ -109,7 +109,7 @@ void TimerTest::testScheduleIntervalTimestamp() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); Timestamp scheduleTime; scheduleTime += 500 * 1000; @@ -117,19 +117,19 @@ void TimerTest::testScheduleIntervalTimestamp() timer.schedule(pTask, scheduleTime, 500); _event.wait(); - assert (time.elapsed() >= 590000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 590000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1190000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1190000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1790000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1790000); + assertTrue (pTask->lastExecution().elapsed() < 130000); pTask->cancel(); - assert (pTask->isCancelled()); + assertTrue (pTask->isCancelled()); } @@ -141,7 +141,7 @@ void TimerTest::testScheduleIntervalClock() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); Clock scheduleClock; scheduleClock += 500 * 1000; @@ -149,19 +149,19 @@ void TimerTest::testScheduleIntervalClock() timer.schedule(pTask, scheduleClock, 500); _event.wait(); - assert (time.elapsed() >= 590000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 590000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1190000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1190000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1790000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1790000); + assertTrue (pTask->lastExecution().elapsed() < 130000); pTask->cancel(); - assert (pTask->isCancelled()); + assertTrue (pTask->isCancelled()); } @@ -173,24 +173,24 @@ void TimerTest::testScheduleAtFixedRate() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); timer.scheduleAtFixedRate(pTask, 500, 500); _event.wait(); - assert (time.elapsed() >= 500000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 500000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1000000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1000000); + assertTrue (pTask->lastExecution().elapsed() < 130000); _event.wait(); - assert (time.elapsed() >= 1500000); - assert (pTask->lastExecution().elapsed() < 130000); + assertTrue (time.elapsed() >= 1500000); + assertTrue (pTask->lastExecution().elapsed() < 130000); pTask->cancel(); - assert (pTask->isCancelled()); + assertTrue (pTask->isCancelled()); } @@ -202,12 +202,12 @@ void TimerTest::testCancel() TimerTask::Ptr pTask = new TimerTaskAdapter(*this, &TimerTest::onTimer); - assert (pTask->lastExecution() == 0); + assertTrue (pTask->lastExecution() == 0); timer.scheduleAtFixedRate(pTask, 5000, 5000); pTask->cancel(); - assert (pTask->isCancelled()); + assertTrue (pTask->isCancelled()); try { @@ -238,7 +238,7 @@ void TimerTest::testCancelAllStop() timer.cancel(false); } - assert (true); // don't hang + assertTrue (true); // don't hang } @@ -256,7 +256,7 @@ void TimerTest::testCancelAllWaitStop() timer.cancel(true); } - assert (true); // don't hang + assertTrue (true); // don't hang } diff --git a/Util/testsuite/src/ValidatorTest.cpp b/Util/testsuite/src/ValidatorTest.cpp index 5e23e1274..f29941d0d 100644 --- a/Util/testsuite/src/ValidatorTest.cpp +++ b/Util/testsuite/src/ValidatorTest.cpp @@ -52,7 +52,7 @@ void ValidatorTest::testRegExpValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option does not match regular expression [0-9]+"); + assertTrue (s == "argument for option does not match regular expression [0-9]+"); } try @@ -63,7 +63,7 @@ void ValidatorTest::testRegExpValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option does not match regular expression [0-9]+"); + assertTrue (s == "argument for option does not match regular expression [0-9]+"); } try @@ -74,7 +74,7 @@ void ValidatorTest::testRegExpValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option does not match regular expression [0-9]+"); + assertTrue (s == "argument for option does not match regular expression [0-9]+"); } try @@ -85,7 +85,7 @@ void ValidatorTest::testRegExpValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option does not match regular expression [0-9]+"); + assertTrue (s == "argument for option does not match regular expression [0-9]+"); } } @@ -107,7 +107,7 @@ void ValidatorTest::testIntValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option must be in range 0 to 100"); + assertTrue (s == "argument for option must be in range 0 to 100"); } try @@ -118,7 +118,7 @@ void ValidatorTest::testIntValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option must be in range 0 to 100"); + assertTrue (s == "argument for option must be in range 0 to 100"); } try @@ -129,7 +129,7 @@ void ValidatorTest::testIntValidator() catch (InvalidArgumentException& exc) { std::string s(exc.message()); - assert (s == "argument for option must be an integer"); + assertTrue (s == "argument for option must be an integer"); } } diff --git a/Util/testsuite/src/WinConfigurationTest.cpp b/Util/testsuite/src/WinConfigurationTest.cpp index 8c2014c95..95ebde38c 100644 --- a/Util/testsuite/src/WinConfigurationTest.cpp +++ b/Util/testsuite/src/WinConfigurationTest.cpp @@ -43,24 +43,24 @@ void WinConfigurationTest::testConfiguration() { WinRegistryKey regKey("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test"); if (regKey.exists()) regKey.deleteKey(); - assert (!regKey.exists()); + assertTrue (!regKey.exists()); AutoPtr pReg = new WinRegistryConfiguration("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test"); pReg->setString("name1", "value1"); - assert (pReg->getString("name1") == "value1"); + assertTrue (pReg->getString("name1") == "value1"); pReg->setInt("name1", 1); // overwrite should also change type - assert (pReg->getInt("name1") == 1); + assertTrue (pReg->getInt("name1") == 1); pReg->setString("name2", "value2"); - assert (pReg->getString("name2") == "value2"); + assertTrue (pReg->getString("name2") == "value2"); #if defined(POCO_HAVE_INT64) pReg->setUInt64("name2", std::numeric_limits::max()); // overwrite should also change type - assert (pReg->getUInt64("name2") == std::numeric_limits::max()); + assertTrue (pReg->getUInt64("name2") == std::numeric_limits::max()); pReg->setInt64("name2", std::numeric_limits::min()); - assert (pReg->getInt64("name2") == std::numeric_limits::min()); + assertTrue (pReg->getInt64("name2") == std::numeric_limits::min()); /// write real int64 value type regKey.setInt64("name3", std::numeric_limits::max()); - assert (pReg->getInt64("name3") == std::numeric_limits::max()); + assertTrue (pReg->getInt64("name3") == std::numeric_limits::max()); #endif /// create fake binary data @@ -70,67 +70,67 @@ void WinConfigurationTest::testConfiguration() data[i] = rand() % 256; regKey.setBinary("name4", data); - assert (pReg->getString("name4") == std::string(data.begin(), data.end())); + assertTrue (pReg->getString("name4") == std::string(data.begin(), data.end())); - assert (pReg->hasProperty("name1")); - assert (pReg->hasProperty("name2")); + assertTrue (pReg->hasProperty("name1")); + assertTrue (pReg->hasProperty("name2")); std::string dfl = pReg->getString("nonexistent", "default"); - assert (dfl == "default"); + assertTrue (dfl == "default"); AutoPtr pView = pReg->createView("config"); dfl = pView->getString("sub.foo", "default"); - assert (dfl == "default"); + assertTrue (dfl == "default"); pView->setString("sub.foo", "bar"); - assert (pView->getString("sub.foo", "default") == "bar"); + assertTrue (pView->getString("sub.foo", "default") == "bar"); std::string value; - assert (pReg->convertToRegFormat("A.B.C", value) == "A\\B"); - assert (value == "C"); + assertTrue (pReg->convertToRegFormat("A.B.C", value) == "A\\B"); + assertTrue (value == "C"); Poco::Util::AbstractConfiguration::Keys keys; pReg->keys(keys); - assert (keys.size() == 5); - assert (std::find(keys.begin(), keys.end(), "name1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "name2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "name3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "name4") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "config") != keys.end()); + assertTrue (keys.size() == 5); + assertTrue (std::find(keys.begin(), keys.end(), "name1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "name2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "name3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "name4") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "config") != keys.end()); pReg->keys("config", keys); - assert (keys.size() == 1); - assert (std::find(keys.begin(), keys.end(), "sub") != keys.end()); + assertTrue (keys.size() == 1); + assertTrue (std::find(keys.begin(), keys.end(), "sub") != keys.end()); AutoPtr pRootReg = new WinRegistryConfiguration(""); - assert (pRootReg->getInt("HKEY_CURRENT_USER.Software.Applied Informatics.Test.name1") == 1); + assertTrue (pRootReg->getInt("HKEY_CURRENT_USER.Software.Applied Informatics.Test.name1") == 1); pRootReg->keys(keys); #if defined(_WIN32_WCE) - assert (keys.size() == 4); - assert (std::find(keys.begin(), keys.end(), "HKEY_CLASSES_ROOT") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_CURRENT_USER") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_LOCAL_MACHINE") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_USERS") != keys.end()); + assertTrue (keys.size() == 4); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_CLASSES_ROOT") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_CURRENT_USER") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_LOCAL_MACHINE") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_USERS") != keys.end()); #else - assert (keys.size() == 6); - assert (std::find(keys.begin(), keys.end(), "HKEY_CLASSES_ROOT") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_CURRENT_CONFIG") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_CURRENT_USER") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_LOCAL_MACHINE") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_PERFORMANCE_DATA") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "HKEY_USERS") != keys.end()); + assertTrue (keys.size() == 6); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_CLASSES_ROOT") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_CURRENT_CONFIG") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_CURRENT_USER") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_LOCAL_MACHINE") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_PERFORMANCE_DATA") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "HKEY_USERS") != keys.end()); #endif pRootReg->keys("HKEY_CURRENT_USER.Software.Applied Informatics.Test", keys); - assert (keys.size() == 5); - assert (std::find(keys.begin(), keys.end(), "name1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "name2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "name3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "name4") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "config") != keys.end()); + assertTrue (keys.size() == 5); + assertTrue (std::find(keys.begin(), keys.end(), "name1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "name2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "name3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "name4") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "config") != keys.end()); } diff --git a/Util/testsuite/src/WinRegistryTest.cpp b/Util/testsuite/src/WinRegistryTest.cpp index e78a10287..8bf2ee588 100644 --- a/Util/testsuite/src/WinRegistryTest.cpp +++ b/Util/testsuite/src/WinRegistryTest.cpp @@ -41,20 +41,20 @@ void WinRegistryTest::testRegistry() { WinRegistryKey regKey("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test"); if (regKey.exists()) regKey.deleteKey(); - assert (!regKey.exists()); + assertTrue (!regKey.exists()); regKey.setString("name1", "value1"); - assert (regKey.getString("name1") == "value1"); + assertTrue (regKey.getString("name1") == "value1"); regKey.setString("name1", "Value1"); - assert (regKey.getString("name1") == "Value1"); + assertTrue (regKey.getString("name1") == "Value1"); regKey.setString("name2", "value2"); - assert (regKey.getString("name2") == "value2"); - assert (regKey.exists("name1")); - assert (regKey.exists("name2")); - assert (regKey.exists()); + assertTrue (regKey.getString("name2") == "value2"); + assertTrue (regKey.exists("name1")); + assertTrue (regKey.exists("name2")); + assertTrue (regKey.exists()); WinRegistryKey regKeyRO("HKEY_CURRENT_USER\\Software\\Applied Informatics\\Test", true); - assert (regKeyRO.getString("name1") == "Value1"); + assertTrue (regKeyRO.getString("name1") == "Value1"); try { regKeyRO.setString("name1", "newValue1"); @@ -63,33 +63,33 @@ void WinRegistryTest::testRegistry() { std::string msg = exc.displayText(); } - assert (regKey.getString("name1") == "Value1"); + assertTrue (regKey.getString("name1") == "Value1"); WinRegistryKey::Values vals; regKey.values(vals); - assert (vals.size() == 2); - assert (vals[0] == "name1" || vals[0] == "name2"); - assert (vals[1] == "name1" || vals[1] == "name2"); - assert (vals[0] != vals[1]); + assertTrue (vals.size() == 2); + assertTrue (vals[0] == "name1" || vals[0] == "name2"); + assertTrue (vals[1] == "name1" || vals[1] == "name2"); + assertTrue (vals[0] != vals[1]); Environment::set("FOO", "bar"); regKey.setStringExpand("name3", "%FOO%"); - assert (regKey.getStringExpand("name3") == "bar"); + assertTrue (regKey.getStringExpand("name3") == "bar"); regKey.setInt("name4", 42); - assert (regKey.getInt("name4") == 42); + assertTrue (regKey.getInt("name4") == 42); - assert (regKey.exists("name4")); + assertTrue (regKey.exists("name4")); regKey.deleteValue("name4"); - assert (!regKey.exists("name4")); + assertTrue (!regKey.exists("name4")); #if defined(POCO_HAVE_INT64) regKey.setInt64("name5", std::numeric_limits::max()); - assert (regKey.getInt64("name5") == std::numeric_limits::max()); + assertTrue (regKey.getInt64("name5") == std::numeric_limits::max()); - assert (regKey.exists("name5")); + assertTrue (regKey.exists("name5")); regKey.deleteValue("name5"); - assert (!regKey.exists("name5")); + assertTrue (!regKey.exists("name5")); #endif const int dataSize = 127; @@ -97,14 +97,14 @@ void WinRegistryTest::testRegistry() for (int i = 0; i < dataSize; ++i) data[i] = rand() % 256; regKey.setBinary("binary", data); - assert (regKey.getBinary("binary") == data); + assertTrue (regKey.getBinary("binary") == data); - assert (regKey.exists("binary")); + assertTrue (regKey.exists("binary")); regKey.deleteValue("binary"); - assert (!regKey.exists("binary")); + assertTrue (!regKey.exists("binary")); regKey.deleteKey(); - assert (!regKey.exists()); + assertTrue (!regKey.exists()); } diff --git a/Util/testsuite/src/XMLConfigurationTest.cpp b/Util/testsuite/src/XMLConfigurationTest.cpp index 4976de4ff..b0836ff79 100644 --- a/Util/testsuite/src/XMLConfigurationTest.cpp +++ b/Util/testsuite/src/XMLConfigurationTest.cpp @@ -58,41 +58,41 @@ void XMLConfigurationTest::testLoad() std::istringstream istr(xmlFile); AutoPtr pConf = new XMLConfiguration(istr); - assert (pConf->getString("prop1") == "value1"); - assert (pConf->getString("prop2") == "value2"); - assert (pConf->getString("prop3.prop4[@attr]") == "value3"); - assert (pConf->getString("prop3.prop4[1][@attr]") == "value4"); - assert (pConf->getString("prop5") == "value5"); - assert (pConf->getString("prop5[0]") == "value5"); - assert (pConf->getString("prop5[1]") == "value6"); - assert (pConf->getString("prop5[@id=1]") == "value5"); - assert (pConf->getString("prop5[@id='2']") == "value6"); - assert (pConf->getString("prop6[@id=foo].prop7") == "value7"); - assert (pConf->getString("prop6[@id='bar'].prop7") == "value8"); + assertTrue (pConf->getString("prop1") == "value1"); + assertTrue (pConf->getString("prop2") == "value2"); + assertTrue (pConf->getString("prop3.prop4[@attr]") == "value3"); + assertTrue (pConf->getString("prop3.prop4[1][@attr]") == "value4"); + assertTrue (pConf->getString("prop5") == "value5"); + assertTrue (pConf->getString("prop5[0]") == "value5"); + assertTrue (pConf->getString("prop5[1]") == "value6"); + assertTrue (pConf->getString("prop5[@id=1]") == "value5"); + assertTrue (pConf->getString("prop5[@id='2']") == "value6"); + assertTrue (pConf->getString("prop6[@id=foo].prop7") == "value7"); + assertTrue (pConf->getString("prop6[@id='bar'].prop7") == "value8"); AbstractConfiguration::Keys keys; pConf->keys(keys); - assert (keys.size() == 7); - assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop5[1]") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop6") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop6[1]") != keys.end()); + assertTrue (keys.size() == 7); + assertTrue (std::find(keys.begin(), keys.end(), "prop1") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop2") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop3") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop5") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop5[1]") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop6") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop6[1]") != keys.end()); pConf->keys("prop3", keys); - assert (keys.size() == 2); - assert (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); - assert (std::find(keys.begin(), keys.end(), "prop4[1]") != keys.end()); + assertTrue (keys.size() == 2); + assertTrue (std::find(keys.begin(), keys.end(), "prop4") != keys.end()); + assertTrue (std::find(keys.begin(), keys.end(), "prop4[1]") != keys.end()); - assert (pConf->hasProperty("prop3.prop4[@attr]")); + assertTrue (pConf->hasProperty("prop3.prop4[@attr]")); pConf->remove("prop3.prop4[@attr]"); - assert (!pConf->hasProperty("prop3.prop4[@attr]")); + assertTrue (!pConf->hasProperty("prop3.prop4[@attr]")); - assert (pConf->hasProperty("prop3")); + assertTrue (pConf->hasProperty("prop3")); pConf->remove("prop3"); - assert (!pConf->hasProperty("prop3")); + assertTrue (!pConf->hasProperty("prop3")); try { @@ -122,29 +122,29 @@ void XMLConfigurationTest::testSave() std::ostringstream ostr; pConf->save(ostr); std::string s(ostr.str()); - assert (s == "\n"); + assertTrue (s == "\n"); pConf->setString("prop1", "value1"); - assert (pConf->getString("prop1") == "value1"); + assertTrue (pConf->getString("prop1") == "value1"); pConf->setString("prop2", "value2"); - assert (pConf->getString("prop2") == "value2"); + assertTrue (pConf->getString("prop2") == "value2"); pConf->setString("prop3.prop4[@attr]", "value3"); - assert (pConf->getString("prop3.prop4[@attr]") == "value3"); + assertTrue (pConf->getString("prop3.prop4[@attr]") == "value3"); pConf->setString("prop3.prop4[1][@attr]", "value4"); - assert (pConf->getString("prop3.prop4[1][@attr]") == "value4"); + assertTrue (pConf->getString("prop3.prop4[1][@attr]") == "value4"); pConf->setString("prop5", "value5a"); - assert (pConf->getString("prop5") == "value5a"); + assertTrue (pConf->getString("prop5") == "value5a"); pConf->setString("prop5[0]", "value5"); - assert (pConf->getString("prop5[0]") == "value5"); - assert (pConf->getString("prop5") == "value5"); + assertTrue (pConf->getString("prop5[0]") == "value5"); + assertTrue (pConf->getString("prop5") == "value5"); pConf->setString("prop5[1]", "value6"); - assert (pConf->getString("prop5[1]") == "value6"); + assertTrue (pConf->getString("prop5[1]") == "value6"); try { @@ -159,7 +159,7 @@ void XMLConfigurationTest::testSave() pConf->save(ostr2); s = ostr2.str(); - assert (s == + assertTrue (s == "\n" "\tvalue1\n" "\tvalue2\n" @@ -172,21 +172,21 @@ void XMLConfigurationTest::testSave() "\n"); pConf->setString("prop1", "value11"); - assert (pConf->getString("prop1") == "value11"); + assertTrue (pConf->getString("prop1") == "value11"); pConf->setString("prop2", "value21"); - assert (pConf->getString("prop2") == "value21"); + assertTrue (pConf->getString("prop2") == "value21"); pConf->setString("prop3.prop4[1][@attr]", "value41"); - assert (pConf->getString("prop3.prop4[1][@attr]") == "value41"); + assertTrue (pConf->getString("prop3.prop4[1][@attr]") == "value41"); pConf->setString("prop3.prop4[2][@attr]", "value42"); - assert (pConf->getString("prop3.prop4[2][@attr]") == "value42"); + assertTrue (pConf->getString("prop3.prop4[2][@attr]") == "value42"); std::ostringstream ostr3; pConf->save(ostr3); s = ostr3.str(); - assert (s == + assertTrue (s == "\n" "\tvalue11\n" "\tvalue21\n" @@ -210,13 +210,13 @@ void XMLConfigurationTest::testLoadAppendSave() pConf->load(istr); pConf->setString("prop2", "value2"); - assert (pConf->getString("prop2") == "value2"); + assertTrue (pConf->getString("prop2") == "value2"); std::ostringstream ostr; pConf->save(ostr); std::string s(ostr.str()); - assert (s == + assertTrue (s == "\n" "\tvalue1\n" "\tvalue2\n" @@ -247,17 +247,17 @@ void XMLConfigurationTest::testOtherDelimiter() std::istringstream istr(xmlFile); AutoPtr pConf = new XMLConfiguration(istr, '/'); - assert (pConf->getString("prop1") == "value1"); - assert (pConf->getString("prop2") == "value2"); - assert (pConf->getString("prop3/prop4[@attr]") == "value3"); - assert (pConf->getString("prop3/prop4[1][@attr]") == "value4"); - assert (pConf->getString("prop5") == "value5"); - assert (pConf->getString("prop5[0]") == "value5"); - assert (pConf->getString("prop5[1]") == "value6"); - assert (pConf->getString("prop5[@id=1]") == "value5"); - assert (pConf->getString("prop5[@id='2']") == "value6"); - assert (pConf->getString("prop6[@id=foo]/prop7") == "value7"); - assert (pConf->getString("prop6[@id='bar']/prop7") == "value8"); + assertTrue (pConf->getString("prop1") == "value1"); + assertTrue (pConf->getString("prop2") == "value2"); + assertTrue (pConf->getString("prop3/prop4[@attr]") == "value3"); + assertTrue (pConf->getString("prop3/prop4[1][@attr]") == "value4"); + assertTrue (pConf->getString("prop5") == "value5"); + assertTrue (pConf->getString("prop5[0]") == "value5"); + assertTrue (pConf->getString("prop5[1]") == "value6"); + assertTrue (pConf->getString("prop5[@id=1]") == "value5"); + assertTrue (pConf->getString("prop5[@id='2']") == "value6"); + assertTrue (pConf->getString("prop6[@id=foo]/prop7") == "value7"); + assertTrue (pConf->getString("prop6[@id='bar']/prop7") == "value8"); } @@ -275,7 +275,7 @@ void XMLConfigurationTest::testSaveEmpty() Poco::AutoPtr pConfig = new XMLConfiguration; std::ostringstream ostr; pConfig->save(ostr); - assert (ostr.str() == "\n"); + assertTrue (ostr.str() == "\n"); } @@ -285,7 +285,7 @@ void XMLConfigurationTest::testFromScratch() pConfig->setString("foo", "bar"); std::ostringstream ostr; pConfig->save(ostr); - assert (ostr.str() == "\n\tbar\n\n"); + assertTrue (ostr.str() == "\n\tbar\n\n"); } @@ -296,7 +296,7 @@ void XMLConfigurationTest::testLoadEmpty() pConfig->setString("foo", "bar"); std::ostringstream ostr; pConfig->save(ostr); - assert (ostr.str() == "\n\tbar\n\n"); + assertTrue (ostr.str() == "\n\tbar\n\n"); } diff --git a/XML/testsuite/src/AttributesImplTest.cpp b/XML/testsuite/src/AttributesImplTest.cpp index 98671ebb1..a36ede1cb 100644 --- a/XML/testsuite/src/AttributesImplTest.cpp +++ b/XML/testsuite/src/AttributesImplTest.cpp @@ -31,51 +31,51 @@ void AttributesImplTest::testNoNamespaces() { AttributesImpl attrs; - assert (attrs.getLength() == 0); - assert (attrs.getIndex("foo") == -1); - assert (attrs.getValue("foo").empty()); + assertTrue (attrs.getLength() == 0); + assertTrue (attrs.getIndex("foo") == -1); + assertTrue (attrs.getValue("foo").empty()); attrs.addAttribute("", "", "a1", "CDATA", "v1"); - assert (attrs.getLength() == 1); - assert (attrs.getIndex("a1") == 0); - assert (attrs.getQName(0) == "a1"); - assert (attrs.getType(0) == "CDATA"); - assert (attrs.getValue(0) == "v1"); - assert (attrs.isSpecified(0)); + assertTrue (attrs.getLength() == 1); + assertTrue (attrs.getIndex("a1") == 0); + assertTrue (attrs.getQName(0) == "a1"); + assertTrue (attrs.getType(0) == "CDATA"); + assertTrue (attrs.getValue(0) == "v1"); + assertTrue (attrs.isSpecified(0)); - assert (attrs.getType("a1") == "CDATA"); - assert (attrs.getValue("a1") == "v1"); + assertTrue (attrs.getType("a1") == "CDATA"); + assertTrue (attrs.getValue("a1") == "v1"); attrs.addAttribute("", "", "a2", "CDATA", "v2"); - assert (attrs.getLength() == 2); - assert (attrs.getIndex("a2") == 1); - assert (attrs.getQName(1) == "a2"); - assert (attrs.getType(1) == "CDATA"); - assert (attrs.getValue(1) == "v2"); - assert (attrs.isSpecified(1)); + assertTrue (attrs.getLength() == 2); + assertTrue (attrs.getIndex("a2") == 1); + assertTrue (attrs.getQName(1) == "a2"); + assertTrue (attrs.getType(1) == "CDATA"); + assertTrue (attrs.getValue(1) == "v2"); + assertTrue (attrs.isSpecified(1)); - assert (attrs.getType("a2") == "CDATA"); - assert (attrs.getValue("a2") == "v2"); + assertTrue (attrs.getType("a2") == "CDATA"); + assertTrue (attrs.getValue("a2") == "v2"); attrs.addAttribute("", "", "a3", "CDATA", "v3"); - assert (attrs.getLength() == 3); - assert (attrs.getIndex("a3") == 2); - assert (attrs.getValue("a3") == "v3"); + assertTrue (attrs.getLength() == 3); + assertTrue (attrs.getIndex("a3") == 2); + assertTrue (attrs.getValue("a3") == "v3"); attrs.removeAttribute(0); - assert (attrs.getLength() == 2); - assert (attrs.getIndex("a1") == -1); - assert (attrs.getIndex("a2") == 0); - assert (attrs.getIndex("a3") == 1); - assert (attrs.getQName(0) == "a2"); - assert (attrs.getQName(1) == "a3"); + assertTrue (attrs.getLength() == 2); + assertTrue (attrs.getIndex("a1") == -1); + assertTrue (attrs.getIndex("a2") == 0); + assertTrue (attrs.getIndex("a3") == 1); + assertTrue (attrs.getQName(0) == "a2"); + assertTrue (attrs.getQName(1) == "a3"); attrs.removeAttribute("a3"); - assert (attrs.getLength() == 1); - assert (attrs.getIndex("a1") == -1); - assert (attrs.getIndex("a2") == 0); - assert (attrs.getIndex("a3") == -1); - assert (attrs.getQName(0) == "a2"); + assertTrue (attrs.getLength() == 1); + assertTrue (attrs.getIndex("a1") == -1); + assertTrue (attrs.getIndex("a2") == 0); + assertTrue (attrs.getIndex("a3") == -1); + assertTrue (attrs.getQName(0) == "a2"); } @@ -83,64 +83,64 @@ void AttributesImplTest::testNamespaces() { AttributesImpl attrs; - assert (attrs.getLength() == 0); - assert (attrs.getIndex("urn:ns", "foo") == -1); - assert (attrs.getValue("urn:ns", "foo").empty()); + assertTrue (attrs.getLength() == 0); + assertTrue (attrs.getIndex("urn:ns", "foo") == -1); + assertTrue (attrs.getValue("urn:ns", "foo").empty()); attrs.addAttribute("urn:ns", "a1", "p:a1", "CDATA", "v1"); - assert (attrs.getLength() == 1); - assert (attrs.getIndex("urn:ns", "a1") == 0); - assert (attrs.getQName(0) == "p:a1"); - assert (attrs.getLocalName(0) == "a1"); - assert (attrs.getURI(0) == "urn:ns"); - assert (attrs.getType(0) == "CDATA"); - assert (attrs.getValue(0) == "v1"); - assert (attrs.isSpecified(0)); + assertTrue (attrs.getLength() == 1); + assertTrue (attrs.getIndex("urn:ns", "a1") == 0); + assertTrue (attrs.getQName(0) == "p:a1"); + assertTrue (attrs.getLocalName(0) == "a1"); + assertTrue (attrs.getURI(0) == "urn:ns"); + assertTrue (attrs.getType(0) == "CDATA"); + assertTrue (attrs.getValue(0) == "v1"); + assertTrue (attrs.isSpecified(0)); - assert (attrs.getType("urn:ns", "a1") == "CDATA"); - assert (attrs.getValue("urn:ns", "a1") == "v1"); + assertTrue (attrs.getType("urn:ns", "a1") == "CDATA"); + assertTrue (attrs.getValue("urn:ns", "a1") == "v1"); attrs.addAttribute("urn:ns", "a2", "p:a2", "CDATA", "v2"); - assert (attrs.getLength() == 2); - assert (attrs.getIndex("urn:ns", "a2") == 1); - assert (attrs.getQName(1) == "p:a2"); - assert (attrs.getLocalName(1) == "a2"); - assert (attrs.getURI(1) == "urn:ns"); - assert (attrs.getType(1) == "CDATA"); - assert (attrs.getValue(1) == "v2"); - assert (attrs.isSpecified(1)); + assertTrue (attrs.getLength() == 2); + assertTrue (attrs.getIndex("urn:ns", "a2") == 1); + assertTrue (attrs.getQName(1) == "p:a2"); + assertTrue (attrs.getLocalName(1) == "a2"); + assertTrue (attrs.getURI(1) == "urn:ns"); + assertTrue (attrs.getType(1) == "CDATA"); + assertTrue (attrs.getValue(1) == "v2"); + assertTrue (attrs.isSpecified(1)); - assert (attrs.getType("urn:ns", "a2") == "CDATA"); - assert (attrs.getValue("urn:ns", "a2") == "v2"); + assertTrue (attrs.getType("urn:ns", "a2") == "CDATA"); + assertTrue (attrs.getValue("urn:ns", "a2") == "v2"); - assert (attrs.getIndex("urn:ns2", "a2") == -1); + assertTrue (attrs.getIndex("urn:ns2", "a2") == -1); attrs.addAttribute("urn:ns2", "a3", "q:a3", "CDATA", "v3"); - assert (attrs.getLength() == 3); - assert (attrs.getIndex("urn:ns2", "a3") == 2); - assert (attrs.getValue("urn:ns2", "a3") == "v3"); + assertTrue (attrs.getLength() == 3); + assertTrue (attrs.getIndex("urn:ns2", "a3") == 2); + assertTrue (attrs.getValue("urn:ns2", "a3") == "v3"); attrs.removeAttribute(0); - assert (attrs.getLength() == 2); - assert (attrs.getIndex("urn:ns", "a1") == -1); - assert (attrs.getIndex("urn:ns", "a2") == 0); - assert (attrs.getIndex("urn:ns2", "a3") == 1); - assert (attrs.getQName(0) == "p:a2"); - assert (attrs.getLocalName(0) == "a2"); - assert (attrs.getURI(0) == "urn:ns"); - assert (attrs.getQName(1) == "q:a3"); - assert (attrs.getLocalName(1) == "a3"); - assert (attrs.getURI(1) == "urn:ns2"); + assertTrue (attrs.getLength() == 2); + assertTrue (attrs.getIndex("urn:ns", "a1") == -1); + assertTrue (attrs.getIndex("urn:ns", "a2") == 0); + assertTrue (attrs.getIndex("urn:ns2", "a3") == 1); + assertTrue (attrs.getQName(0) == "p:a2"); + assertTrue (attrs.getLocalName(0) == "a2"); + assertTrue (attrs.getURI(0) == "urn:ns"); + assertTrue (attrs.getQName(1) == "q:a3"); + assertTrue (attrs.getLocalName(1) == "a3"); + assertTrue (attrs.getURI(1) == "urn:ns2"); attrs.removeAttribute("urn:ns", "a3"); - assert (attrs.getLength() == 2); + assertTrue (attrs.getLength() == 2); attrs.removeAttribute("urn:ns2", "a3"); - assert (attrs.getLength() == 1); - assert (attrs.getIndex("urn:ns", "a1") == -1); - assert (attrs.getIndex("urn:ns", "a2") == 0); - assert (attrs.getIndex("urn:ns2", "a3") == -1); - assert (attrs.getQName(0) == "p:a2"); + assertTrue (attrs.getLength() == 1); + assertTrue (attrs.getIndex("urn:ns", "a1") == -1); + assertTrue (attrs.getIndex("urn:ns", "a2") == 0); + assertTrue (attrs.getIndex("urn:ns2", "a3") == -1); + assertTrue (attrs.getQName(0) == "p:a2"); } @@ -151,43 +151,43 @@ void AttributesImplTest::testAccessors() attrs.addAttribute("urn:ns1", "a2", "p:a2", "CDATA", "v2", false); attrs.addAttribute("urn:ns2", "a3", "q:a3", "CDATA", "v3", true); - assert (attrs.getQName(0) == "p:a1"); - assert (attrs.getQName(1) == "p:a2"); - assert (attrs.getQName(2) == "q:a3"); + assertTrue (attrs.getQName(0) == "p:a1"); + assertTrue (attrs.getQName(1) == "p:a2"); + assertTrue (attrs.getQName(2) == "q:a3"); - assert (attrs.getLocalName(0) == "a1"); - assert (attrs.getLocalName(1) == "a2"); - assert (attrs.getLocalName(2) == "a3"); + assertTrue (attrs.getLocalName(0) == "a1"); + assertTrue (attrs.getLocalName(1) == "a2"); + assertTrue (attrs.getLocalName(2) == "a3"); - assert (attrs.getURI(0) == "urn:ns1"); - assert (attrs.getURI(1) == "urn:ns1"); - assert (attrs.getURI(2) == "urn:ns2"); + assertTrue (attrs.getURI(0) == "urn:ns1"); + assertTrue (attrs.getURI(1) == "urn:ns1"); + assertTrue (attrs.getURI(2) == "urn:ns2"); - assert (attrs.getValue(0) == "v1"); - assert (attrs.getValue(1) == "v2"); - assert (attrs.getValue(2) == "v3"); + assertTrue (attrs.getValue(0) == "v1"); + assertTrue (attrs.getValue(1) == "v2"); + assertTrue (attrs.getValue(2) == "v3"); - assert (attrs.isSpecified(0)); - assert (!attrs.isSpecified(1)); - assert (attrs.isSpecified(2)); + assertTrue (attrs.isSpecified(0)); + assertTrue (!attrs.isSpecified(1)); + assertTrue (attrs.isSpecified(2)); attrs.setType(0, "NMTOKEN"); - assert (attrs.getType(0) == "NMTOKEN"); - assert (attrs.getType("urn:ns1", "a1") == "NMTOKEN"); + assertTrue (attrs.getType(0) == "NMTOKEN"); + assertTrue (attrs.getType("urn:ns1", "a1") == "NMTOKEN"); attrs.setValue(1, "v2 v2"); - assert (attrs.getValue(1) == "v2 v2"); - assert (attrs.getValue("urn:ns1", "a2") == "v2 v2"); - assert (attrs.isSpecified(1)); + assertTrue (attrs.getValue(1) == "v2 v2"); + assertTrue (attrs.getValue("urn:ns1", "a2") == "v2 v2"); + assertTrue (attrs.isSpecified(1)); attrs.setLocalName(2, "A3"); - assert (attrs.getLocalName(2) == "A3"); + assertTrue (attrs.getLocalName(2) == "A3"); attrs.setQName(2, "p:A3"); - assert (attrs.getQName(2) == "p:A3"); + assertTrue (attrs.getQName(2) == "p:A3"); attrs.setURI(2, "urn:ns1"); - assert (attrs.getURI(2) == "urn:ns1"); + assertTrue (attrs.getURI(2) == "urn:ns1"); - assert (attrs.getValue("urn:ns1", "A3") == "v3"); + assertTrue (attrs.getValue("urn:ns1", "A3") == "v3"); } @@ -201,23 +201,23 @@ void AttributesImplTest::testCopy() AttributesImpl attrs2; attrs2.setAttributes(attrs); - assert (attrs2.getLength() == 3); + assertTrue (attrs2.getLength() == 3); - assert (attrs2.getQName(0) == "p:a1"); - assert (attrs2.getQName(1) == "p:a2"); - assert (attrs2.getQName(2) == "q:a3"); + assertTrue (attrs2.getQName(0) == "p:a1"); + assertTrue (attrs2.getQName(1) == "p:a2"); + assertTrue (attrs2.getQName(2) == "q:a3"); - assert (attrs2.getLocalName(0) == "a1"); - assert (attrs2.getLocalName(1) == "a2"); - assert (attrs2.getLocalName(2) == "a3"); + assertTrue (attrs2.getLocalName(0) == "a1"); + assertTrue (attrs2.getLocalName(1) == "a2"); + assertTrue (attrs2.getLocalName(2) == "a3"); - assert (attrs2.getURI(0) == "urn:ns1"); - assert (attrs2.getURI(1) == "urn:ns1"); - assert (attrs2.getURI(2) == "urn:ns2"); + assertTrue (attrs2.getURI(0) == "urn:ns1"); + assertTrue (attrs2.getURI(1) == "urn:ns1"); + assertTrue (attrs2.getURI(2) == "urn:ns2"); - assert (attrs2.getValue(0) == "v1"); - assert (attrs2.getValue(1) == "v2"); - assert (attrs2.getValue(2) == "v3"); + assertTrue (attrs2.getValue(0) == "v1"); + assertTrue (attrs2.getValue(1) == "v2"); + assertTrue (attrs2.getValue(2) == "v3"); } diff --git a/XML/testsuite/src/ChildNodesTest.cpp b/XML/testsuite/src/ChildNodesTest.cpp index c8d38dbc6..80eaa785a 100644 --- a/XML/testsuite/src/ChildNodesTest.cpp +++ b/XML/testsuite/src/ChildNodesTest.cpp @@ -39,46 +39,46 @@ void ChildNodesTest::testChildNodes() AutoPtr pDoc = new Document; AutoPtr pRoot = pDoc->createElement("root"); - assert (!pRoot->hasChildNodes()); + assertTrue (!pRoot->hasChildNodes()); AutoPtr pNL = pRoot->childNodes(); - assert (pNL->length() == 0); + assertTrue (pNL->length() == 0); AutoPtr pChild1 = pDoc->createElement("child1"); pRoot->appendChild(pChild1); - assert (pRoot->hasChildNodes()); + assertTrue (pRoot->hasChildNodes()); - assert (pNL->length() == 1); - assert (pNL->item(0) == pChild1); + assertTrue (pNL->length() == 1); + assertTrue (pNL->item(0) == pChild1); AutoPtr pChild2 = pDoc->createElement("child2"); pRoot->appendChild(pChild2); - assert (pNL->length() == 2); - assert (pNL->item(0) == pChild1); - assert (pNL->item(1) == pChild2); + assertTrue (pNL->length() == 2); + assertTrue (pNL->item(0) == pChild1); + assertTrue (pNL->item(1) == pChild2); AutoPtr pChild0 = pDoc->createElement("child0"); pRoot->insertBefore(pChild0, pChild1); - assert (pNL->length() == 3); - assert (pNL->item(0) == pChild0); - assert (pNL->item(1) == pChild1); - assert (pNL->item(2) == pChild2); + assertTrue (pNL->length() == 3); + assertTrue (pNL->item(0) == pChild0); + assertTrue (pNL->item(1) == pChild1); + assertTrue (pNL->item(2) == pChild2); pRoot->removeChild(pChild1); - assert (pNL->length() == 2); - assert (pNL->item(0) == pChild0); - assert (pNL->item(1) == pChild2); + assertTrue (pNL->length() == 2); + assertTrue (pNL->item(0) == pChild0); + assertTrue (pNL->item(1) == pChild2); pRoot->removeChild(pChild0); - assert (pNL->length() == 1); - assert (pNL->item(0) == pChild2); + assertTrue (pNL->length() == 1); + assertTrue (pNL->item(0) == pChild2); pRoot->removeChild(pChild2); - assert (pNL->length() == 0); - assert (pNL->item(0) == 0); + assertTrue (pNL->length() == 0); + assertTrue (pNL->item(0) == 0); - assert (!pRoot->hasChildNodes()); + assertTrue (!pRoot->hasChildNodes()); } diff --git a/XML/testsuite/src/DocumentTest.cpp b/XML/testsuite/src/DocumentTest.cpp index 9aae63485..b65fa8eb1 100644 --- a/XML/testsuite/src/DocumentTest.cpp +++ b/XML/testsuite/src/DocumentTest.cpp @@ -44,13 +44,13 @@ void DocumentTest::testDocumentElement() AutoPtr pDoc = new Document; AutoPtr pRoot = pDoc->createElement("root"); - assert (pDoc->documentElement() == 0); + assertTrue (pDoc->documentElement() == 0); pDoc->appendChild(pRoot); - assert (pDoc->documentElement() == pRoot); + assertTrue (pDoc->documentElement() == pRoot); AutoPtr pText = pDoc->createTextNode(" "); pDoc->insertBefore(pText, pRoot); - assert (pDoc->documentElement() == pRoot); + assertTrue (pDoc->documentElement() == pRoot); } @@ -72,8 +72,8 @@ void DocumentTest::testImport() } AutoPtr pRoot2 = static_cast(pDoc2->importNode(pRoot1, false)); - assert (pRoot2->ownerDocument() == pDoc2); - assert (pRoot1->ownerDocument() == pDoc1); + assertTrue (pRoot2->ownerDocument() == pDoc2); + assertTrue (pRoot1->ownerDocument() == pDoc1); pDoc2->appendChild(pRoot2); } @@ -104,12 +104,12 @@ void DocumentTest::testImportDeep() } AutoPtr pRoot2 = static_cast(pDoc2->importNode(pRoot1, true)); - assert (pRoot2->ownerDocument() == pDoc2); - assert (pRoot2->firstChild()->ownerDocument() == pDoc2); - assert (pRoot2->firstChild()->firstChild()->ownerDocument() == pDoc2); - assert (pRoot1->ownerDocument() == pDoc1); - assert (pRoot1->firstChild()->ownerDocument() == pDoc1); - assert (pRoot1->firstChild()->firstChild()->ownerDocument() == pDoc1); + assertTrue (pRoot2->ownerDocument() == pDoc2); + assertTrue (pRoot2->firstChild()->ownerDocument() == pDoc2); + assertTrue (pRoot2->firstChild()->firstChild()->ownerDocument() == pDoc2); + assertTrue (pRoot1->ownerDocument() == pDoc1); + assertTrue (pRoot1->firstChild()->ownerDocument() == pDoc1); + assertTrue (pRoot1->firstChild()->firstChild()->ownerDocument() == pDoc1); pDoc2->appendChild(pRoot2); } @@ -123,28 +123,28 @@ void DocumentTest::testElementsByTagName() AutoPtr pNL1 = pDoc->getElementsByTagName("*"); AutoPtr pNL2 = pDoc->getElementsByTagName("elem"); - assert (pNL1->length() == 1); - assert (pNL1->item(0) == pRoot); - assert (pNL2->length() == 0); + assertTrue (pNL1->length() == 1); + assertTrue (pNL1->item(0) == pRoot); + assertTrue (pNL2->length() == 0); AutoPtr pElem1 = pDoc->createElement("elem"); pRoot->appendChild(pElem1); - assert (pNL1->length() == 2); - assert (pNL2->length() == 1); - assert (pNL1->item(0) == pRoot); - assert (pNL1->item(1) == pElem1); - assert (pNL2->item(0) == pElem1); + assertTrue (pNL1->length() == 2); + assertTrue (pNL2->length() == 1); + assertTrue (pNL1->item(0) == pRoot); + assertTrue (pNL1->item(1) == pElem1); + assertTrue (pNL2->item(0) == pElem1); AutoPtr pElem2 = pDoc->createElement("Elem"); pRoot->appendChild(pElem2); - assert (pNL1->length() == 3); - assert (pNL2->length() == 1); - assert (pNL1->item(0) == pRoot); - assert (pNL1->item(1) == pElem1); - assert (pNL1->item(2) == pElem2); - assert (pNL2->item(0) == pElem1); + assertTrue (pNL1->length() == 3); + assertTrue (pNL2->length() == 1); + assertTrue (pNL1->item(0) == pRoot); + assertTrue (pNL1->item(1) == pElem1); + assertTrue (pNL1->item(2) == pElem2); + assertTrue (pNL2->item(0) == pElem1); } @@ -156,28 +156,28 @@ void DocumentTest::testElementsByTagNameNS() AutoPtr pNL1 = pDoc->getElementsByTagNameNS("*", "*"); AutoPtr pNL2 = pDoc->getElementsByTagNameNS("*", "elem"); - assert (pNL1->length() == 1); - assert (pNL1->item(0) == pRoot); - assert (pNL2->length() == 0); + assertTrue (pNL1->length() == 1); + assertTrue (pNL1->item(0) == pRoot); + assertTrue (pNL2->length() == 0); AutoPtr pElem1 = pDoc->createElementNS("urn:ns1", "elem"); pRoot->appendChild(pElem1); - assert (pNL1->length() == 2); - assert (pNL2->length() == 1); - assert (pNL1->item(0) == pRoot); - assert (pNL1->item(1) == pElem1); - assert (pNL2->item(0) == pElem1); + assertTrue (pNL1->length() == 2); + assertTrue (pNL2->length() == 1); + assertTrue (pNL1->item(0) == pRoot); + assertTrue (pNL1->item(1) == pElem1); + assertTrue (pNL2->item(0) == pElem1); AutoPtr pElem2 = pDoc->createElementNS("urn:ns1", "Elem"); pRoot->appendChild(pElem2); - assert (pNL1->length() == 3); - assert (pNL2->length() == 1); - assert (pNL1->item(0) == pRoot); - assert (pNL1->item(1) == pElem1); - assert (pNL1->item(2) == pElem2); - assert (pNL2->item(0) == pElem1); + assertTrue (pNL1->length() == 3); + assertTrue (pNL2->length() == 1); + assertTrue (pNL1->item(0) == pRoot); + assertTrue (pNL1->item(1) == pElem1); + assertTrue (pNL1->item(2) == pElem2); + assertTrue (pNL2->item(0) == pElem1); } @@ -201,22 +201,22 @@ void DocumentTest::testElementById() pDoc->appendChild(pRoot); Element* pFound = pDoc->getElementById("0", "id"); - assert (pFound == pRoot); + assertTrue (pFound == pRoot); pFound = pDoc->getElementById("1", "id"); - assert (pFound == pElem1); + assertTrue (pFound == pElem1); pFound = pDoc->getElementById("2", "id"); - assert (pFound == pElem2); + assertTrue (pFound == pElem2); pFound = pDoc->getElementById("3", "id"); - assert (pFound == pElem3); + assertTrue (pFound == pElem3); pFound = pDoc->getElementById("4", "id"); - assert (pFound == 0); + assertTrue (pFound == 0); pFound = pDoc->getElementById("0", "ID"); - assert (pFound == 0); + assertTrue (pFound == 0); } @@ -240,25 +240,25 @@ void DocumentTest::testElementByIdNS() pDoc->appendChild(pRoot); Element* pFound = pDoc->getElementByIdNS("0", "urn:ns1", "id"); - assert (pFound == pRoot); + assertTrue (pFound == pRoot); pFound = pDoc->getElementByIdNS("1", "urn:ns1", "id"); - assert (pFound == pElem1); + assertTrue (pFound == pElem1); pFound = pDoc->getElementByIdNS("2", "urn:ns1", "id"); - assert (pFound == pElem2); + assertTrue (pFound == pElem2); pFound = pDoc->getElementByIdNS("3", "urn:ns1", "id"); - assert (pFound == pElem3); + assertTrue (pFound == pElem3); pFound = pDoc->getElementByIdNS("4", "urn:ns1", "id"); - assert (pFound == 0); + assertTrue (pFound == 0); pFound = pDoc->getElementByIdNS("0", "urn:ns1", "ID"); - assert (pFound == 0); + assertTrue (pFound == 0); pFound = pDoc->getElementByIdNS("0", "urn:ns2", "id"); - assert (pFound == 0); + assertTrue (pFound == 0); } diff --git a/XML/testsuite/src/DocumentTypeTest.cpp b/XML/testsuite/src/DocumentTypeTest.cpp index f33b781af..8f031a08f 100644 --- a/XML/testsuite/src/DocumentTypeTest.cpp +++ b/XML/testsuite/src/DocumentTypeTest.cpp @@ -43,48 +43,48 @@ void DocumentTypeTest::testDocumentType() { AutoPtr pDoctype = DOMImplementation::instance().createDocumentType("test", "public", "system"); - assert (pDoctype->ownerDocument() == 0); - assert (pDoctype->name() == "test"); - assert (pDoctype->publicId() == "public"); - assert (pDoctype->systemId() == "system"); + assertTrue (pDoctype->ownerDocument() == 0); + assertTrue (pDoctype->name() == "test"); + assertTrue (pDoctype->publicId() == "public"); + assertTrue (pDoctype->systemId() == "system"); AutoPtr pDoc = new Document(pDoctype); - assert (pDoc->doctype() == pDoctype); - assert (pDoctype->ownerDocument() == pDoc); + assertTrue (pDoc->doctype() == pDoctype); + assertTrue (pDoctype->ownerDocument() == pDoc); AutoPtr pEntities = pDoctype->entities(); AutoPtr pNotations = pDoctype->notations(); - assert (pEntities->length() == 0); - assert (pNotations->length() == 0); + assertTrue (pEntities->length() == 0); + assertTrue (pNotations->length() == 0); AutoPtr pEntity1 = pDoc->createEntity("entity1", "public1", "system1", ""); pDoctype->appendChild(pEntity1); - assert (pEntities->length() == 1); - assert (pNotations->length() == 0); - assert (pEntities->item(0) == pEntity1); - assert (pEntities->getNamedItem("entity1") == pEntity1); + assertTrue (pEntities->length() == 1); + assertTrue (pNotations->length() == 0); + assertTrue (pEntities->item(0) == pEntity1); + assertTrue (pEntities->getNamedItem("entity1") == pEntity1); AutoPtr pEntity2 = pDoc->createEntity("entity2", "public2", "system2", ""); pDoctype->appendChild(pEntity2); - assert (pEntities->length() == 2); - assert (pNotations->length() == 0); - assert (pEntities->item(0) == pEntity1); - assert (pEntities->item(1) == pEntity2); - assert (pEntities->getNamedItem("entity1") == pEntity1); - assert (pEntities->getNamedItem("entity2") == pEntity2); + assertTrue (pEntities->length() == 2); + assertTrue (pNotations->length() == 0); + assertTrue (pEntities->item(0) == pEntity1); + assertTrue (pEntities->item(1) == pEntity2); + assertTrue (pEntities->getNamedItem("entity1") == pEntity1); + assertTrue (pEntities->getNamedItem("entity2") == pEntity2); AutoPtr pNotation = pDoc->createNotation("notation", "public", "system"); pDoctype->appendChild(pNotation); - assert (pEntities->length() == 2); - assert (pNotations->length() == 1); - assert (pEntities->item(0) == pEntity1); - assert (pEntities->item(1) == pEntity2); - assert (pNotations->item(0) == pNotation); - assert (pEntities->getNamedItem("entity1") == pEntity1); - assert (pEntities->getNamedItem("entity2") == pEntity2); - assert (pNotations->getNamedItem("notation") == pNotation); + assertTrue (pEntities->length() == 2); + assertTrue (pNotations->length() == 1); + assertTrue (pEntities->item(0) == pEntity1); + assertTrue (pEntities->item(1) == pEntity2); + assertTrue (pNotations->item(0) == pNotation); + assertTrue (pEntities->getNamedItem("entity1") == pEntity1); + assertTrue (pEntities->getNamedItem("entity2") == pEntity2); + assertTrue (pNotations->getNamedItem("notation") == pNotation); } diff --git a/XML/testsuite/src/ElementTest.cpp b/XML/testsuite/src/ElementTest.cpp index cc44b1868..e109aa6a4 100644 --- a/XML/testsuite/src/ElementTest.cpp +++ b/XML/testsuite/src/ElementTest.cpp @@ -46,115 +46,115 @@ void ElementTest::testAttributes() AutoPtr pDoc = new Document; AutoPtr pElem = pDoc->createElement("elem"); - assert (!pElem->hasAttributes()); + assertTrue (!pElem->hasAttributes()); pElem->setAttribute("a1", "v1"); - assert (pElem->hasAttributes()); + assertTrue (pElem->hasAttributes()); - assert (pElem->hasAttribute("a1")); - assert (pElem->getAttribute("a1") == "v1"); + assertTrue (pElem->hasAttribute("a1")); + assertTrue (pElem->getAttribute("a1") == "v1"); Attr* pAttr1 = pElem->getAttributeNode("a1"); - assert (pAttr1 != 0); - assert (pAttr1->name() == "a1"); - assert (pAttr1->nodeName() == "a1"); - assert (pAttr1->value() == "v1"); - assert (pAttr1->nodeValue() == "v1"); - assert (pAttr1->ownerElement() == pElem); - assert (pAttr1->ownerDocument() == pDoc); - assert (pAttr1->innerText() == "v1"); + assertTrue (pAttr1 != 0); + assertTrue (pAttr1->name() == "a1"); + assertTrue (pAttr1->nodeName() == "a1"); + assertTrue (pAttr1->value() == "v1"); + assertTrue (pAttr1->nodeValue() == "v1"); + assertTrue (pAttr1->ownerElement() == pElem); + assertTrue (pAttr1->ownerDocument() == pDoc); + assertTrue (pAttr1->innerText() == "v1"); - assert (pAttr1->previousSibling() == 0); - assert (pAttr1->nextSibling() == 0); + assertTrue (pAttr1->previousSibling() == 0); + assertTrue (pAttr1->nextSibling() == 0); pAttr1->setValue("V1"); - assert (pElem->getAttribute("a1") == "V1"); + assertTrue (pElem->getAttribute("a1") == "V1"); pElem->setAttribute("a2", "v2"); - assert (pElem->hasAttribute("a1")); - assert (pElem->getAttribute("a1") == "V1"); - assert (pElem->hasAttribute("a2")); - assert (pElem->getAttribute("a2") == "v2"); + assertTrue (pElem->hasAttribute("a1")); + assertTrue (pElem->getAttribute("a1") == "V1"); + assertTrue (pElem->hasAttribute("a2")); + assertTrue (pElem->getAttribute("a2") == "v2"); Attr* pAttr2 = pElem->getAttributeNode("a2"); - assert (pAttr2 != 0); - assert (pAttr2->name() == "a2"); - assert (pAttr2->value() == "v2"); - assert (pAttr2->ownerElement() == pElem); + assertTrue (pAttr2 != 0); + assertTrue (pAttr2->name() == "a2"); + assertTrue (pAttr2->value() == "v2"); + assertTrue (pAttr2->ownerElement() == pElem); - assert (pAttr1->previousSibling() == 0); - assert (pAttr1->nextSibling() == pAttr2); - assert (pAttr2->previousSibling() == pAttr1); - assert (pAttr2->nextSibling() == 0); + assertTrue (pAttr1->previousSibling() == 0); + assertTrue (pAttr1->nextSibling() == pAttr2); + assertTrue (pAttr2->previousSibling() == pAttr1); + assertTrue (pAttr2->nextSibling() == 0); Attr* pAttr3 = pElem->getAttributeNode("a3"); - assert (pAttr3 == 0); + assertTrue (pAttr3 == 0); pAttr3 = pDoc->createAttribute("a3"); pAttr3->setValue("v3"); pElem->setAttributeNode(pAttr3); pAttr3->release(); - assert (pElem->hasAttribute("a1")); - assert (pElem->getAttribute("a1") == "V1"); - assert (pElem->hasAttribute("a2")); - assert (pElem->getAttribute("a2") == "v2"); - assert (pElem->hasAttribute("a3")); - assert (pElem->getAttribute("a3") == "v3"); + assertTrue (pElem->hasAttribute("a1")); + assertTrue (pElem->getAttribute("a1") == "V1"); + assertTrue (pElem->hasAttribute("a2")); + assertTrue (pElem->getAttribute("a2") == "v2"); + assertTrue (pElem->hasAttribute("a3")); + assertTrue (pElem->getAttribute("a3") == "v3"); - assert (pAttr1->previousSibling() == 0); - assert (pAttr1->nextSibling() == pAttr2); - assert (pAttr2->previousSibling() == pAttr1); - assert (pAttr2->nextSibling() == pAttr3); - assert (pAttr3->previousSibling() == pAttr2); - assert (pAttr3->nextSibling() == 0); + assertTrue (pAttr1->previousSibling() == 0); + assertTrue (pAttr1->nextSibling() == pAttr2); + assertTrue (pAttr2->previousSibling() == pAttr1); + assertTrue (pAttr2->nextSibling() == pAttr3); + assertTrue (pAttr3->previousSibling() == pAttr2); + assertTrue (pAttr3->nextSibling() == 0); pAttr2 = pDoc->createAttribute("a2"); pAttr2->setValue("V2"); pElem->setAttributeNode(pAttr2); pAttr2->release(); - assert (pElem->hasAttribute("a1")); - assert (pElem->getAttribute("a1") == "V1"); - assert (pElem->hasAttribute("a2")); - assert (pElem->getAttribute("a2") == "V2"); - assert (pElem->hasAttribute("a3")); - assert (pElem->getAttribute("a3") == "v3"); + assertTrue (pElem->hasAttribute("a1")); + assertTrue (pElem->getAttribute("a1") == "V1"); + assertTrue (pElem->hasAttribute("a2")); + assertTrue (pElem->getAttribute("a2") == "V2"); + assertTrue (pElem->hasAttribute("a3")); + assertTrue (pElem->getAttribute("a3") == "v3"); pAttr1 = pDoc->createAttribute("a1"); pAttr1->setValue("v1"); pElem->setAttributeNode(pAttr1); pAttr1->release(); - assert (pElem->hasAttribute("a1")); - assert (pElem->getAttribute("a1") == "v1"); - assert (pElem->hasAttribute("a2")); - assert (pElem->getAttribute("a2") == "V2"); - assert (pElem->hasAttribute("a3")); - assert (pElem->getAttribute("a3") == "v3"); + assertTrue (pElem->hasAttribute("a1")); + assertTrue (pElem->getAttribute("a1") == "v1"); + assertTrue (pElem->hasAttribute("a2")); + assertTrue (pElem->getAttribute("a2") == "V2"); + assertTrue (pElem->hasAttribute("a3")); + assertTrue (pElem->getAttribute("a3") == "v3"); pAttr3 = pDoc->createAttribute("a3"); pAttr3->setValue("V3"); pElem->setAttributeNode(pAttr3); pAttr3->release(); - assert (pElem->hasAttribute("a1")); - assert (pElem->getAttribute("a1") == "v1"); - assert (pElem->hasAttribute("a2")); - assert (pElem->getAttribute("a2") == "V2"); - assert (pElem->hasAttribute("a3")); - assert (pElem->getAttribute("a3") == "V3"); + assertTrue (pElem->hasAttribute("a1")); + assertTrue (pElem->getAttribute("a1") == "v1"); + assertTrue (pElem->hasAttribute("a2")); + assertTrue (pElem->getAttribute("a2") == "V2"); + assertTrue (pElem->hasAttribute("a3")); + assertTrue (pElem->getAttribute("a3") == "V3"); pElem->removeAttributeNode(pAttr3); - assert (!pElem->hasAttribute("a3")); + assertTrue (!pElem->hasAttribute("a3")); pElem->removeAttribute("a1"); - assert (!pElem->hasAttribute("a1")); + assertTrue (!pElem->hasAttribute("a1")); pElem->removeAttribute("a2"); - assert (!pElem->hasAttribute("a2")); + assertTrue (!pElem->hasAttribute("a2")); - assert (!pElem->hasAttributes()); + assertTrue (!pElem->hasAttributes()); } @@ -163,109 +163,109 @@ void ElementTest::testAttributesNS() AutoPtr pDoc = new Document; AutoPtr pElem = pDoc->createElementNS("urn:ns1", "p:elem"); - assert (pElem->namespaceURI() == "urn:ns1"); - assert (pElem->prefix() == "p"); - assert (pElem->tagName() == "p:elem"); - assert (pElem->localName() == "elem"); + assertTrue (pElem->namespaceURI() == "urn:ns1"); + assertTrue (pElem->prefix() == "p"); + assertTrue (pElem->tagName() == "p:elem"); + assertTrue (pElem->localName() == "elem"); - assert (!pElem->hasAttributes()); + assertTrue (!pElem->hasAttributes()); pElem->setAttributeNS("urn:ns1", "a1", "v1"); - assert (pElem->hasAttributes()); + assertTrue (pElem->hasAttributes()); - assert (pElem->hasAttributeNS("urn:ns1", "a1")); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "v1"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "v1"); Attr* pAttr1 = pElem->getAttributeNodeNS("urn:ns1", "a1"); - assert (pAttr1 != 0); - assert (pAttr1->name() == "a1"); - assert (pAttr1->namespaceURI() == "urn:ns1"); - assert (pAttr1->prefix().empty()); - assert (pAttr1->localName() == "a1"); - assert (pAttr1->nodeName() == "a1"); - assert (pAttr1->value() == "v1"); - assert (pAttr1->nodeValue() == "v1"); - assert (pAttr1->ownerElement() == pElem); + assertTrue (pAttr1 != 0); + assertTrue (pAttr1->name() == "a1"); + assertTrue (pAttr1->namespaceURI() == "urn:ns1"); + assertTrue (pAttr1->prefix().empty()); + assertTrue (pAttr1->localName() == "a1"); + assertTrue (pAttr1->nodeName() == "a1"); + assertTrue (pAttr1->value() == "v1"); + assertTrue (pAttr1->nodeValue() == "v1"); + assertTrue (pAttr1->ownerElement() == pElem); pAttr1->setValue("V1"); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); pElem->setAttributeNS("urn:ns1", "a2", "v2"); - assert (pElem->hasAttributeNS("urn:ns1", "a1")); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); - assert (pElem->hasAttributeNS("urn:ns1", "a2")); - assert (pElem->getAttributeNS("urn:ns1", "a2") == "v2"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a2") == "v2"); Attr* pAttr2 = pElem->getAttributeNodeNS("urn:ns1", "a2"); - assert (pAttr2 != 0); - assert (pAttr2->name() == "a2"); - assert (pAttr2->namespaceURI() == "urn:ns1"); - assert (pAttr2->prefix().empty()); - assert (pAttr2->localName() == "a2"); - assert (pAttr2->value() == "v2"); - assert (pAttr2->ownerElement() == pElem); + assertTrue (pAttr2 != 0); + assertTrue (pAttr2->name() == "a2"); + assertTrue (pAttr2->namespaceURI() == "urn:ns1"); + assertTrue (pAttr2->prefix().empty()); + assertTrue (pAttr2->localName() == "a2"); + assertTrue (pAttr2->value() == "v2"); + assertTrue (pAttr2->ownerElement() == pElem); Attr* pAttr3 = pElem->getAttributeNodeNS("urn:ns2", "p:a3"); - assert (pAttr3 == 0); + assertTrue (pAttr3 == 0); pAttr3 = pDoc->createAttributeNS("urn:ns2", "p:a3"); pAttr3->setValue("v3"); pElem->setAttributeNodeNS(pAttr3); pAttr3->release(); - assert (pElem->hasAttributeNS("urn:ns1", "a1")); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); - assert (pElem->hasAttributeNS("urn:ns1", "a2")); - assert (pElem->getAttributeNS("urn:ns1", "a2") == "v2"); - assert (pElem->hasAttributeNS("urn:ns2", "a3")); - assert (pElem->getAttributeNS("urn:ns2", "a3") == "v3"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a2") == "v2"); + assertTrue (pElem->hasAttributeNS("urn:ns2", "a3")); + assertTrue (pElem->getAttributeNS("urn:ns2", "a3") == "v3"); pAttr2 = pDoc->createAttributeNS("urn:ns1", "a2"); pAttr2->setValue("V2"); pElem->setAttributeNodeNS(pAttr2); pAttr2->release(); - assert (pElem->hasAttributeNS("urn:ns1", "a1")); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); - assert (pElem->hasAttributeNS("urn:ns1", "a2")); - assert (pElem->getAttributeNS("urn:ns1", "a2") == "V2"); - assert (pElem->hasAttributeNS("urn:ns2", "a3")); - assert (pElem->getAttributeNS("urn:ns2", "a3") == "v3"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "V1"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a2") == "V2"); + assertTrue (pElem->hasAttributeNS("urn:ns2", "a3")); + assertTrue (pElem->getAttributeNS("urn:ns2", "a3") == "v3"); pAttr1 = pDoc->createAttributeNS("urn:ns1", "a1"); pAttr1->setValue("v1"); pElem->setAttributeNodeNS(pAttr1); pAttr1->release(); - assert (pElem->hasAttributeNS("urn:ns1", "a1")); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "v1"); - assert (pElem->hasAttributeNS("urn:ns1", "a2")); - assert (pElem->getAttributeNS("urn:ns1", "a2") == "V2"); - assert (pElem->hasAttributeNS("urn:ns2", "a3")); - assert (pElem->getAttributeNS("urn:ns2", "a3") == "v3"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "v1"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a2") == "V2"); + assertTrue (pElem->hasAttributeNS("urn:ns2", "a3")); + assertTrue (pElem->getAttributeNS("urn:ns2", "a3") == "v3"); pAttr3 = pDoc->createAttributeNS("urn:ns2", "q:a3"); pAttr3->setValue("V3"); pElem->setAttributeNodeNS(pAttr3); pAttr3->release(); - assert (pElem->hasAttributeNS("urn:ns1", "a1")); - assert (pElem->getAttributeNS("urn:ns1", "a1") == "v1"); - assert (pElem->hasAttributeNS("urn:ns1", "a2")); - assert (pElem->getAttributeNS("urn:ns1", "a2") == "V2"); - assert (pElem->hasAttributeNS("urn:ns2", "a3")); - assert (pElem->getAttributeNS("urn:ns2", "a3") == "V3"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a1") == "v1"); + assertTrue (pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (pElem->getAttributeNS("urn:ns1", "a2") == "V2"); + assertTrue (pElem->hasAttributeNS("urn:ns2", "a3")); + assertTrue (pElem->getAttributeNS("urn:ns2", "a3") == "V3"); pElem->removeAttributeNode(pAttr3); - assert (!pElem->hasAttributeNS("urn:ns2", "a3")); + assertTrue (!pElem->hasAttributeNS("urn:ns2", "a3")); pElem->removeAttributeNS("urn:ns1", "a1"); - assert (!pElem->hasAttributeNS("urn:ns1", "a1")); + assertTrue (!pElem->hasAttributeNS("urn:ns1", "a1")); pElem->removeAttributeNS("urn:ns1", "a2"); - assert (!pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (!pElem->hasAttributeNS("urn:ns1", "a2")); - assert (!pElem->hasAttributes()); + assertTrue (!pElem->hasAttributes()); } @@ -275,42 +275,42 @@ void ElementTest::testAttrMap() AutoPtr pElem = pDoc->createElement("elem"); AutoPtr pNNM = pElem->attributes(); - assert (pNNM->length() == 0); + assertTrue (pNNM->length() == 0); pElem->setAttribute("a1", "v1"); - assert (pNNM->length() == 1); - assert (pNNM->item(0)->nodeName() == "a1"); - assert (pNNM->getNamedItem("a1")->nodeName() == "a1"); + assertTrue (pNNM->length() == 1); + assertTrue (pNNM->item(0)->nodeName() == "a1"); + assertTrue (pNNM->getNamedItem("a1")->nodeName() == "a1"); pElem->setAttribute("a2", "v2"); - assert (pNNM->length() == 2); - assert (pNNM->item(0)->nodeName() == "a1"); - assert (pNNM->getNamedItem("a1")->nodeName() == "a1"); - assert (pNNM->item(1)->nodeName() == "a2"); - assert (pNNM->getNamedItem("a2")->nodeName() == "a2"); + assertTrue (pNNM->length() == 2); + assertTrue (pNNM->item(0)->nodeName() == "a1"); + assertTrue (pNNM->getNamedItem("a1")->nodeName() == "a1"); + assertTrue (pNNM->item(1)->nodeName() == "a2"); + assertTrue (pNNM->getNamedItem("a2")->nodeName() == "a2"); Attr* pAttr = pDoc->createAttribute("a3"); pNNM->setNamedItem(pAttr); pAttr->release(); - assert (pNNM->length() == 3); - assert (pNNM->item(0)->nodeName() == "a1"); - assert (pNNM->getNamedItem("a1")->nodeName() == "a1"); - assert (pNNM->item(1)->nodeName() == "a2"); - assert (pNNM->getNamedItem("a2")->nodeName() == "a2"); - assert (pNNM->item(2)->nodeName() == "a3"); - assert (pNNM->getNamedItem("a3")->nodeName() == "a3"); + assertTrue (pNNM->length() == 3); + assertTrue (pNNM->item(0)->nodeName() == "a1"); + assertTrue (pNNM->getNamedItem("a1")->nodeName() == "a1"); + assertTrue (pNNM->item(1)->nodeName() == "a2"); + assertTrue (pNNM->getNamedItem("a2")->nodeName() == "a2"); + assertTrue (pNNM->item(2)->nodeName() == "a3"); + assertTrue (pNNM->getNamedItem("a3")->nodeName() == "a3"); pNNM->removeNamedItem("a2"); - assert (pNNM->length() == 2); - assert (!pElem->hasAttribute("a2")); + assertTrue (pNNM->length() == 2); + assertTrue (!pElem->hasAttribute("a2")); pNNM->removeNamedItem("a3"); - assert (pNNM->length() == 1); - assert (!pElem->hasAttribute("a3")); + assertTrue (pNNM->length() == 1); + assertTrue (!pElem->hasAttribute("a3")); pElem->removeAttribute("a1"); - assert (pNNM->length() == 0); + assertTrue (pNNM->length() == 0); } @@ -320,42 +320,42 @@ void ElementTest::testAttrMapNS() AutoPtr pElem = pDoc->createElementNS("urn:ns1", "elem"); AutoPtr pNNM = pElem->attributes(); - assert (pNNM->length() == 0); + assertTrue (pNNM->length() == 0); pElem->setAttributeNS("urn:ns1", "a1", "v1"); - assert (pNNM->length() == 1); - assert (pNNM->item(0)->nodeName() == "a1"); - assert (pNNM->getNamedItemNS("urn:ns1", "a1")->nodeName() == "a1"); + assertTrue (pNNM->length() == 1); + assertTrue (pNNM->item(0)->nodeName() == "a1"); + assertTrue (pNNM->getNamedItemNS("urn:ns1", "a1")->nodeName() == "a1"); pElem->setAttributeNS("urn:ns1", "a2", "v2"); - assert (pNNM->length() == 2); - assert (pNNM->item(0)->nodeName() == "a1"); - assert (pNNM->getNamedItem("a1")->nodeName() == "a1"); - assert (pNNM->item(1)->nodeName() == "a2"); - assert (pNNM->getNamedItem("a2")->nodeName() == "a2"); + assertTrue (pNNM->length() == 2); + assertTrue (pNNM->item(0)->nodeName() == "a1"); + assertTrue (pNNM->getNamedItem("a1")->nodeName() == "a1"); + assertTrue (pNNM->item(1)->nodeName() == "a2"); + assertTrue (pNNM->getNamedItem("a2")->nodeName() == "a2"); Attr* pAttr = pDoc->createAttributeNS("urn:ns2", "a3"); pNNM->setNamedItem(pAttr); pAttr->release(); - assert (pNNM->length() == 3); - assert (pNNM->item(0)->nodeName() == "a1"); - assert (pNNM->getNamedItemNS("urn:ns1", "a1")->nodeName() == "a1"); - assert (pNNM->item(1)->nodeName() == "a2"); - assert (pNNM->getNamedItemNS("urn:ns1", "a2")->nodeName() == "a2"); - assert (pNNM->item(2)->nodeName() == "a3"); - assert (pNNM->getNamedItemNS("urn:ns2", "a3")->nodeName() == "a3"); + assertTrue (pNNM->length() == 3); + assertTrue (pNNM->item(0)->nodeName() == "a1"); + assertTrue (pNNM->getNamedItemNS("urn:ns1", "a1")->nodeName() == "a1"); + assertTrue (pNNM->item(1)->nodeName() == "a2"); + assertTrue (pNNM->getNamedItemNS("urn:ns1", "a2")->nodeName() == "a2"); + assertTrue (pNNM->item(2)->nodeName() == "a3"); + assertTrue (pNNM->getNamedItemNS("urn:ns2", "a3")->nodeName() == "a3"); pNNM->removeNamedItemNS("urn:ns1", "a2"); - assert (pNNM->length() == 2); - assert (!pElem->hasAttributeNS("urn:ns1", "a2")); + assertTrue (pNNM->length() == 2); + assertTrue (!pElem->hasAttributeNS("urn:ns1", "a2")); pNNM->removeNamedItemNS("urn:ns2", "a3"); - assert (pNNM->length() == 1); - assert (!pElem->hasAttributeNS("urn:ns2", "a3")); + assertTrue (pNNM->length() == 1); + assertTrue (!pElem->hasAttributeNS("urn:ns2", "a3")); pElem->removeAttributeNS("urn:ns1", "a1"); - assert (pNNM->length() == 0); + assertTrue (pNNM->length() == 0); } @@ -366,79 +366,79 @@ void ElementTest::testElementsByTagName() AutoPtr pNL1 = pRoot->getElementsByTagName("*"); AutoPtr pNL2 = pRoot->getElementsByTagName("elem"); - assert (pNL1->length() == 0); - assert (pNL2->length() == 0); + assertTrue (pNL1->length() == 0); + assertTrue (pNL2->length() == 0); AutoPtr pElem1 = pDoc->createElement("elem"); pRoot->appendChild(pElem1); - assert (pNL1->length() == 1); - assert (pNL2->length() == 1); - assert (pNL1->item(0) == pElem1); - assert (pNL2->item(0) == pElem1); + assertTrue (pNL1->length() == 1); + assertTrue (pNL2->length() == 1); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL2->item(0) == pElem1); AutoPtr pElem2 = pDoc->createElement("Elem"); pRoot->appendChild(pElem2); - assert (pNL1->length() == 2); - assert (pNL2->length() == 1); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem2); - assert (pNL2->item(0) == pElem1); + assertTrue (pNL1->length() == 2); + assertTrue (pNL2->length() == 1); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem2); + assertTrue (pNL2->item(0) == pElem1); AutoPtr pElem3 = pDoc->createElement("elem"); pRoot->appendChild(pElem3); - assert (pNL1->length() == 3); - assert (pNL2->length() == 2); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem2); - assert (pNL1->item(2) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem3); + assertTrue (pNL1->length() == 3); + assertTrue (pNL2->length() == 2); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem2); + assertTrue (pNL1->item(2) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem3); AutoPtr pElem11 = pDoc->createElement("elem"); pElem1->appendChild(pElem11); - assert (pNL1->length() == 4); - assert (pNL2->length() == 3); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem11); - assert (pNL1->item(2) == pElem2); - assert (pNL1->item(3) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem11); - assert (pNL2->item(2) == pElem3); + assertTrue (pNL1->length() == 4); + assertTrue (pNL2->length() == 3); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem11); + assertTrue (pNL1->item(2) == pElem2); + assertTrue (pNL1->item(3) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem11); + assertTrue (pNL2->item(2) == pElem3); AutoPtr pElem12 = pDoc->createElement("Elem"); pElem1->appendChild(pElem12); - assert (pNL1->length() == 5); - assert (pNL2->length() == 3); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem11); - assert (pNL1->item(2) == pElem12); - assert (pNL1->item(3) == pElem2); - assert (pNL1->item(4) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem11); - assert (pNL2->item(2) == pElem3); + assertTrue (pNL1->length() == 5); + assertTrue (pNL2->length() == 3); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem11); + assertTrue (pNL1->item(2) == pElem12); + assertTrue (pNL1->item(3) == pElem2); + assertTrue (pNL1->item(4) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem11); + assertTrue (pNL2->item(2) == pElem3); AutoPtr pElem21 = pDoc->createElement("elem"); pElem2->appendChild(pElem21); - assert (pNL1->length() == 6); - assert (pNL2->length() == 4); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem11); - assert (pNL1->item(2) == pElem12); - assert (pNL1->item(3) == pElem2); - assert (pNL1->item(4) == pElem21); - assert (pNL1->item(5) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem11); - assert (pNL2->item(2) == pElem21); - assert (pNL2->item(3) == pElem3); + assertTrue (pNL1->length() == 6); + assertTrue (pNL2->length() == 4); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem11); + assertTrue (pNL1->item(2) == pElem12); + assertTrue (pNL1->item(3) == pElem2); + assertTrue (pNL1->item(4) == pElem21); + assertTrue (pNL1->item(5) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem11); + assertTrue (pNL2->item(2) == pElem21); + assertTrue (pNL2->item(3) == pElem3); } @@ -450,95 +450,95 @@ void ElementTest::testElementsByTagNameNS() AutoPtr pNL2 = pRoot->getElementsByTagNameNS("*", "elem"); AutoPtr pNL3 = pRoot->getElementsByTagNameNS("urn:ns1", "elem"); - assert (pNL1->length() == 0); - assert (pNL2->length() == 0); + assertTrue (pNL1->length() == 0); + assertTrue (pNL2->length() == 0); AutoPtr pElem1 = pDoc->createElementNS("urn:ns1", "elem"); pRoot->appendChild(pElem1); - assert (pNL1->length() == 1); - assert (pNL2->length() == 1); - assert (pNL3->length() == 1); - assert (pNL1->item(0) == pElem1); - assert (pNL2->item(0) == pElem1); - assert (pNL3->item(0) == pElem1); + assertTrue (pNL1->length() == 1); + assertTrue (pNL2->length() == 1); + assertTrue (pNL3->length() == 1); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL3->item(0) == pElem1); AutoPtr pElem2 = pDoc->createElementNS("urn:ns1", "Elem"); pRoot->appendChild(pElem2); - assert (pNL1->length() == 2); - assert (pNL2->length() == 1); - assert (pNL3->length() == 1); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem2); - assert (pNL2->item(0) == pElem1); - assert (pNL3->item(0) == pElem1); + assertTrue (pNL1->length() == 2); + assertTrue (pNL2->length() == 1); + assertTrue (pNL3->length() == 1); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem2); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL3->item(0) == pElem1); AutoPtr pElem3 = pDoc->createElementNS("urn:ns2", "elem"); pRoot->appendChild(pElem3); - assert (pNL1->length() == 3); - assert (pNL2->length() == 2); - assert (pNL3->length() == 1); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem2); - assert (pNL1->item(2) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem3); - assert (pNL3->item(0) == pElem1); + assertTrue (pNL1->length() == 3); + assertTrue (pNL2->length() == 2); + assertTrue (pNL3->length() == 1); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem2); + assertTrue (pNL1->item(2) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem3); + assertTrue (pNL3->item(0) == pElem1); AutoPtr pElem11 = pDoc->createElementNS("urn:ns1", "elem"); pElem1->appendChild(pElem11); - assert (pNL1->length() == 4); - assert (pNL2->length() == 3); - assert (pNL3->length() == 2); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem11); - assert (pNL1->item(2) == pElem2); - assert (pNL1->item(3) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem11); - assert (pNL2->item(2) == pElem3); - assert (pNL3->item(0) == pElem1); - assert (pNL3->item(1) == pElem11); + assertTrue (pNL1->length() == 4); + assertTrue (pNL2->length() == 3); + assertTrue (pNL3->length() == 2); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem11); + assertTrue (pNL1->item(2) == pElem2); + assertTrue (pNL1->item(3) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem11); + assertTrue (pNL2->item(2) == pElem3); + assertTrue (pNL3->item(0) == pElem1); + assertTrue (pNL3->item(1) == pElem11); AutoPtr pElem12 = pDoc->createElementNS("urn:ns1", "Elem"); pElem1->appendChild(pElem12); - assert (pNL1->length() == 5); - assert (pNL2->length() == 3); - assert (pNL3->length() == 2); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem11); - assert (pNL1->item(2) == pElem12); - assert (pNL1->item(3) == pElem2); - assert (pNL1->item(4) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem11); - assert (pNL2->item(2) == pElem3); - assert (pNL3->item(0) == pElem1); - assert (pNL3->item(1) == pElem11); + assertTrue (pNL1->length() == 5); + assertTrue (pNL2->length() == 3); + assertTrue (pNL3->length() == 2); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem11); + assertTrue (pNL1->item(2) == pElem12); + assertTrue (pNL1->item(3) == pElem2); + assertTrue (pNL1->item(4) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem11); + assertTrue (pNL2->item(2) == pElem3); + assertTrue (pNL3->item(0) == pElem1); + assertTrue (pNL3->item(1) == pElem11); AutoPtr pElem21 = pDoc->createElementNS("urn:ns1", "elem"); pElem2->appendChild(pElem21); - assert (pNL1->length() == 6); - assert (pNL2->length() == 4); - assert (pNL3->length() == 3); - assert (pNL1->item(0) == pElem1); - assert (pNL1->item(1) == pElem11); - assert (pNL1->item(2) == pElem12); - assert (pNL1->item(3) == pElem2); - assert (pNL1->item(4) == pElem21); - assert (pNL1->item(5) == pElem3); - assert (pNL2->item(0) == pElem1); - assert (pNL2->item(1) == pElem11); - assert (pNL2->item(2) == pElem21); - assert (pNL2->item(3) == pElem3); - assert (pNL3->item(0) == pElem1); - assert (pNL3->item(1) == pElem11); - assert (pNL3->item(2) == pElem21); + assertTrue (pNL1->length() == 6); + assertTrue (pNL2->length() == 4); + assertTrue (pNL3->length() == 3); + assertTrue (pNL1->item(0) == pElem1); + assertTrue (pNL1->item(1) == pElem11); + assertTrue (pNL1->item(2) == pElem12); + assertTrue (pNL1->item(3) == pElem2); + assertTrue (pNL1->item(4) == pElem21); + assertTrue (pNL1->item(5) == pElem3); + assertTrue (pNL2->item(0) == pElem1); + assertTrue (pNL2->item(1) == pElem11); + assertTrue (pNL2->item(2) == pElem21); + assertTrue (pNL2->item(3) == pElem3); + assertTrue (pNL3->item(0) == pElem1); + assertTrue (pNL3->item(1) == pElem11); + assertTrue (pNL3->item(2) == pElem21); } @@ -557,7 +557,7 @@ void ElementTest::testInnerText() pRoot->appendChild(pText3); XMLString innerText = pRoot->innerText(); - assert (innerText == "text1text2text3"); + assertTrue (innerText == "text1text2text3"); } @@ -575,12 +575,12 @@ void ElementTest::testChildElement() pRoot->appendChild(pElem3); pRoot->appendChild(pElem4); - assert (pRoot->getChildElement("elem1") == pElem1); - assert (pRoot->getChildElement("elem2") == pElem2); - assert (pRoot->getChildElement("elem3") == pElem3); - assert (pRoot->getChildElement("elem4") == 0); + assertTrue (pRoot->getChildElement("elem1") == pElem1); + assertTrue (pRoot->getChildElement("elem2") == pElem2); + assertTrue (pRoot->getChildElement("elem3") == pElem3); + assertTrue (pRoot->getChildElement("elem4") == 0); - assert (pElem1->getChildElement("elem11") == 0); + assertTrue (pElem1->getChildElement("elem11") == 0); } @@ -598,13 +598,13 @@ void ElementTest::testChildElementNS() pRoot->appendChild(pElem3); pRoot->appendChild(pElem4); - assert (pRoot->getChildElementNS("urn:ns", "elem1") == pElem1); - assert (pRoot->getChildElementNS("urn:ns", "elem2") == pElem2); - assert (pRoot->getChildElementNS("urn:ns", "elem3") == pElem3); - assert (pRoot->getChildElementNS("urn:ns", "elem4") == 0); - assert (pRoot->getChildElementNS("urn:NS", "elem1") == 0); + assertTrue (pRoot->getChildElementNS("urn:ns", "elem1") == pElem1); + assertTrue (pRoot->getChildElementNS("urn:ns", "elem2") == pElem2); + assertTrue (pRoot->getChildElementNS("urn:ns", "elem3") == pElem3); + assertTrue (pRoot->getChildElementNS("urn:ns", "elem4") == 0); + assertTrue (pRoot->getChildElementNS("urn:NS", "elem1") == 0); - assert (pElem1->getChildElementNS("urn:ns", "elem11") == 0); + assertTrue (pElem1->getChildElementNS("urn:ns", "elem11") == 0); } @@ -679,82 +679,82 @@ void ElementTest::testNodeByPath() pDoc->appendChild(pRoot); Node* pNode = pRoot->getNodeByPath("/"); - assert (pNode == pRoot); + assertTrue (pNode == pRoot); pNode = pRoot->getNodeByPath("/elem1"); - assert (pNode == pElem1); + assertTrue (pNode == pElem1); pNode = pDoc->getNodeByPath("/root/elem1"); - assert (pNode == pElem1); + assertTrue (pNode == pElem1); pNode = pRoot->getNodeByPath("/elem2"); - assert (pNode == pElem2); + assertTrue (pNode == pElem2); pNode = pRoot->getNodeByPath("/elem1/elemA"); - assert (pNode == pElem11); + assertTrue (pNode == pElem11); pNode = pRoot->getNodeByPath("/elem1/elemA[0]"); - assert (pNode == pElem11); + assertTrue (pNode == pElem11); pNode = pRoot->getNodeByPath("/elem1/elemA[1]"); - assert (pNode == pElem12); + assertTrue (pNode == pElem12); pNode = pRoot->getNodeByPath("/elem1/elemA[2]"); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pRoot->getNodeByPath("/elem2/elemB"); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pRoot->getNodeByPath("/elem2/elemB[0]"); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pRoot->getNodeByPath("/elem2/elemB[1]"); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPath("/elem2/elemB[2]"); - assert (pNode == pElem23); + assertTrue (pNode == pElem23); pNode = pRoot->getNodeByPath("/elem2/elemB[3]"); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pRoot->getNodeByPath("/elem2/elemB[@attr1]"); - assert (pNode && pNode->nodeValue() == "value1"); + assertTrue (pNode && pNode->nodeValue() == "value1"); pNode = pRoot->getNodeByPath("/elem2/elemB[@attr2]"); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pRoot->getNodeByPath("/elem2/elemB[@attr1='value2']"); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPath("/elem2/elemC[@attr1='value1']/elemC1"); - assert (pNode == pElem241); + assertTrue (pNode == pElem241); pNode = pRoot->getNodeByPath("/elem2/elemC[@attr1='value1']/elemC1[@attr1]"); - assert (pNode && pNode->nodeValue() == "value1"); + assertTrue (pNode && pNode->nodeValue() == "value1"); pNode = pDoc->getNodeByPath("//elemB[@attr1='value1']"); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pDoc->getNodeByPath("//elemB[@attr1='value2']"); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pDoc->getNodeByPath("//elemB[@attr1='value3']"); - assert (pNode == pElem23); + assertTrue (pNode == pElem23); pNode = pDoc->getNodeByPath("//elemB[@attr1='value4']"); - assert (pNode == pElem31); + assertTrue (pNode == pElem31); pNode = pDoc->getNodeByPath("//elemB[@attr1='value5']"); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pDoc->getNodeByPath("//[@attr1='value1']"); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pDoc->getNodeByPath("//[@attr1='value2']"); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPath("/elem2/*[@attr1='value2']"); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); } @@ -830,91 +830,91 @@ void ElementTest::testNodeByPathNS() nsMap.declarePrefix("NS2", "urn:ns2"); Node* pNode = pRoot->getNodeByPathNS("/", nsMap); - assert (pNode == pRoot); + assertTrue (pNode == pRoot); pNode = pRoot->getNodeByPathNS("/ns1:elem1", nsMap); - assert (pNode == pElem1); + assertTrue (pNode == pElem1); pNode = pDoc->getNodeByPathNS("/ns1:root/ns1:elem1", nsMap); - assert (pNode == pElem1); + assertTrue (pNode == pElem1); pNode = pRoot->getNodeByPathNS("/ns1:elem2", nsMap); - assert (pNode == pElem2); + assertTrue (pNode == pElem2); pNode = pRoot->getNodeByPathNS("/ns1:elem1/NS2:elemA", nsMap); - assert (pNode == pElem11); + assertTrue (pNode == pElem11); pNode = pRoot->getNodeByPathNS("/ns1:elem1/NS2:elemA[0]", nsMap); - assert (pNode == pElem11); + assertTrue (pNode == pElem11); pNode = pRoot->getNodeByPathNS("/ns1:elem1/NS2:elemA[1]", nsMap); - assert (pNode == pElem12); + assertTrue (pNode == pElem12); pNode = pRoot->getNodeByPathNS("/ns1:elem1/NS2:elemA[2]", nsMap); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB", nsMap); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[0]", nsMap); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[1]", nsMap); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[2]", nsMap); - assert (pNode == pElem23); + assertTrue (pNode == pElem23); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[3]", nsMap); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[@NS2:attr1]", nsMap); - assert (pNode && pNode->nodeValue() == "value1"); + assertTrue (pNode && pNode->nodeValue() == "value1"); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[@NS2:attr2]", nsMap); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemB[@NS2:attr1='value2']", nsMap); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemC[@NS2:attr1='value1']/NS2:elemC1", nsMap); - assert (pNode == pElem241); + assertTrue (pNode == pElem241); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:elemC[@NS2:attr1='value1']/NS2:elemC1[@NS2:attr1]", nsMap); - assert (pNode && pNode->nodeValue() == "value1"); + assertTrue (pNode && pNode->nodeValue() == "value1"); pNode = pRoot->getNodeByPathNS("/NS2:elem1", nsMap); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pDoc->getNodeByPathNS("//NS2:elemB[@NS2:attr1='value1']", nsMap); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pDoc->getNodeByPathNS("//NS2:elemB[@NS2:attr1='value2']", nsMap); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pDoc->getNodeByPathNS("//NS2:elemB[@NS2:attr1='value3']", nsMap); - assert (pNode == pElem23); + assertTrue (pNode == pElem23); pNode = pDoc->getNodeByPathNS("//NS2:elemB[@NS2:attr1='value4']", nsMap); - assert (pNode == pElem31); + assertTrue (pNode == pElem31); pNode = pDoc->getNodeByPathNS("//NS2:elemB[@NS2:attr1='value5']", nsMap); - assert (pNode == 0); + assertTrue (pNode == 0); pNode = pDoc->getNodeByPathNS("//[@NS2:attr1='value1']", nsMap); - assert (pNode == pElem21); + assertTrue (pNode == pElem21); pNode = pDoc->getNodeByPathNS("//[@NS2:attr1='value2']", nsMap); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPathNS("/ns1:elem2/*[@NS2:attr1='value2']", nsMap); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPathNS("/ns1:elem2/NS2:*[@NS2:attr1='value2']", nsMap); - assert (pNode == pElem22); + assertTrue (pNode == pElem22); pNode = pRoot->getNodeByPathNS("/ns1:elem2/ns1:*[@NS2:attr1='value2']", nsMap); - assert (pNode == 0); + assertTrue (pNode == 0); } diff --git a/XML/testsuite/src/EventTest.cpp b/XML/testsuite/src/EventTest.cpp index bd0094d3c..ed4262fe1 100644 --- a/XML/testsuite/src/EventTest.cpp +++ b/XML/testsuite/src/EventTest.cpp @@ -171,7 +171,7 @@ void EventTest::testInsert() const XMLString& log = TestEventListener::log(); - assert (log == + assertTrue (log == "docCap:DOMNodeInserted:CAPTURING_PHASE:root:#document:B:-:MODIFICATION:#document:::\n" "rootCap:DOMNodeInserted:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" "root:DOMNodeInserted:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" @@ -188,7 +188,7 @@ void EventTest::testInsert() AutoPtr pText = pDoc->createTextNode("text"); pRoot->appendChild(pText); - assert (log == + assertTrue (log == "docCap:DOMNodeInserted:CAPTURING_PHASE:#text:#document:B:-:MODIFICATION:root:::\n" "rootCap:DOMNodeInserted:CAPTURING_PHASE:#text:root:B:-:MODIFICATION:root:::\n" "root:DOMNodeInserted:BUBBLING_PHASE:#text:root:B:-:MODIFICATION:root:::\n" @@ -237,7 +237,7 @@ void EventTest::testInsertSubtree() pDoc->appendChild(pRoot); const XMLString& log = TestEventListener::log(); - assert (log == + assertTrue (log == "docCap:DOMNodeInserted:CAPTURING_PHASE:root:#document:B:-:MODIFICATION:#document:::\n" "rootCap:DOMNodeInserted:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" "root:DOMNodeInserted:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" @@ -289,7 +289,7 @@ void EventTest::testRemove() pRoot->removeChild(pText); const XMLString& log = TestEventListener::log(); - assert (log == + assertTrue (log == "docCap:DOMNodeRemoved:CAPTURING_PHASE:#text:#document:B:-:MODIFICATION:root:::\n" "rootCap:DOMNodeRemoved:CAPTURING_PHASE:#text:root:B:-:MODIFICATION:root:::\n" "root:DOMNodeRemoved:BUBBLING_PHASE:#text:root:B:-:MODIFICATION:root:::\n" @@ -340,7 +340,7 @@ void EventTest::testRemoveSubtree() pDoc->removeChild(pRoot); const XMLString& log = TestEventListener::log(); - assert (log == + assertTrue (log == "docCap:DOMNodeRemoved:CAPTURING_PHASE:root:#document:B:-:MODIFICATION:#document:::\n" "rootCap:DOMNodeRemoved:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" "root:DOMNodeRemoved:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" @@ -383,7 +383,7 @@ void EventTest::testCharacterData() pText->setData("modified"); const XMLString& log = TestEventListener::log(); - assert (log == + assertTrue (log == "docCap:DOMCharacterDataModified:CAPTURING_PHASE:#text:#document:B:-:MODIFICATION:::text:modified\n" "rootCap:DOMCharacterDataModified:CAPTURING_PHASE:#text:root:B:-:MODIFICATION:::text:modified\n" "textCap:DOMCharacterDataModified:AT_TARGET:#text:#text:B:-:MODIFICATION:::text:modified\n" @@ -421,7 +421,7 @@ void EventTest::testCancel() pText->setData("modified"); const XMLString& log = TestEventListener::log(); - assert (log == "docCap:DOMCharacterDataModified:CAPTURING_PHASE:#text:#document:B:-:MODIFICATION:::text:modified\n"); + assertTrue (log == "docCap:DOMCharacterDataModified:CAPTURING_PHASE:#text:#document:B:-:MODIFICATION:::text:modified\n"); } @@ -436,19 +436,19 @@ void EventTest::testAttributes() pRoot->setAttribute("a1", "v1"); const XMLString& log = TestEventListener::log(); - assert (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:ADDITION:a1:a1::v1\n"); + assertTrue (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:ADDITION:a1:a1::v1\n"); TestEventListener::reset(); pRoot->setAttribute("a1", "V1"); - assert (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:MODIFICATION:a1:a1:v1:V1\n"); + assertTrue (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:MODIFICATION:a1:a1:v1:V1\n"); TestEventListener::reset(); pRoot->setAttribute("a2", "v2"); - assert (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:ADDITION:a2:a2::v2\n"); + assertTrue (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:ADDITION:a2:a2::v2\n"); TestEventListener::reset(); pRoot->removeAttribute("a1"); - assert (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:REMOVAL:a1:a1:V1:\n"); + assertTrue (log == "root:DOMAttrModified:AT_TARGET:root:root:B:-:REMOVAL:a1:a1:V1:\n"); } @@ -481,7 +481,7 @@ void EventTest::testAddRemoveInEvent() pDoc->appendChild(pRoot); const XMLString& log = TestEventListener::log(); - assert (log == + assertTrue (log == "docCap:DOMNodeInserted:CAPTURING_PHASE:root:#document:B:-:MODIFICATION:#document:::\n" "rootCap:DOMNodeInserted:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" "root:DOMNodeInserted:AT_TARGET:root:root:B:-:MODIFICATION:#document:::\n" @@ -498,7 +498,7 @@ void EventTest::testAddRemoveInEvent() AutoPtr pText = pDoc->createTextNode("text"); pRoot->appendChild(pText); - assert (log == + assertTrue (log == "docCap:DOMNodeInserted:CAPTURING_PHASE:#text:#document:B:-:MODIFICATION:root:::\n" "rootCap:DOMNodeInserted:CAPTURING_PHASE:#text:root:B:-:MODIFICATION:root:::\n" "root:DOMNodeInserted:BUBBLING_PHASE:#text:root:B:-:MODIFICATION:root:::\n" @@ -526,19 +526,19 @@ void EventTest::testSuspended() pRoot->setAttribute("a1", "v1"); const XMLString& log = TestEventListener::log(); - assert (log.empty()); + assertTrue (log.empty()); TestEventListener::reset(); pRoot->setAttribute("a1", "V1"); - assert (log.empty()); + assertTrue (log.empty()); TestEventListener::reset(); pRoot->setAttribute("a2", "v2"); - assert (log.empty()); + assertTrue (log.empty()); TestEventListener::reset(); pRoot->removeAttribute("a1"); - assert (log.empty()); + assertTrue (log.empty()); } diff --git a/XML/testsuite/src/NamePoolTest.cpp b/XML/testsuite/src/NamePoolTest.cpp index b6965c3f2..eae5944a7 100644 --- a/XML/testsuite/src/NamePoolTest.cpp +++ b/XML/testsuite/src/NamePoolTest.cpp @@ -39,16 +39,16 @@ void NamePoolTest::testNamePool() pName = &pool->insert(name); const Name* pName2 = &pool->insert("pre:local", "http://www.appinf.com", "local"); - assert (pName == pName2); + assertTrue (pName == pName2); pName2 = &pool->insert("pre:local2", "http://www.appinf.com", "local2"); - assert (pName2 != pName); + assertTrue (pName2 != pName); pName2 = &pool->insert(name); - assert (pName2 == pName); + assertTrue (pName2 == pName); pName2 = &pool->insert(*pName); - assert (pName2 == pName); + assertTrue (pName2 == pName); } diff --git a/XML/testsuite/src/NameTest.cpp b/XML/testsuite/src/NameTest.cpp index 2182ad2d0..e45441e0d 100644 --- a/XML/testsuite/src/NameTest.cpp +++ b/XML/testsuite/src/NameTest.cpp @@ -33,18 +33,18 @@ void NameTest::testSplit() std::string prefix; std::string local; Name::split(qname, prefix, local); - assert (prefix.empty()); - assert (local == "name"); + assertTrue (prefix.empty()); + assertTrue (local == "name"); qname = "p:l"; Name::split(qname, prefix, local); - assert (prefix == "p"); - assert (local == "l"); + assertTrue (prefix == "p"); + assertTrue (local == "l"); qname = "pre:local"; Name::split(qname, prefix, local); - assert (prefix == "pre"); - assert (local == "local"); + assertTrue (prefix == "pre"); + assertTrue (local == "local"); } @@ -52,13 +52,13 @@ void NameTest::testLocalName() { std::string qname = "name"; std::string local = Name::localName(qname); - assert (local == "name"); + assertTrue (local == "name"); qname = "p:l"; local = Name::localName(qname); - assert (local == "l"); + assertTrue (local == "l"); qname = "pre:local"; local = Name::localName(qname); - assert (local == "local"); + assertTrue (local == "local"); } @@ -66,13 +66,13 @@ void NameTest::testPrefix() { std::string qname = "name"; std::string prefix = Name::prefix(qname); - assert (prefix.empty()); + assertTrue (prefix.empty()); qname = "p:l"; prefix = Name::prefix(qname); - assert (prefix == "p"); + assertTrue (prefix == "p"); qname = "pre:local"; prefix = Name::prefix(qname); - assert (prefix == "pre"); + assertTrue (prefix == "pre"); } @@ -80,29 +80,29 @@ void NameTest::testName() { std::string qname = "name"; Name name(qname); - assert (name.qname() == "name"); - assert (name.prefix().empty()); - assert (name.namespaceURI().empty()); - assert (name.localName().empty()); + assertTrue (name.qname() == "name"); + assertTrue (name.prefix().empty()); + assertTrue (name.namespaceURI().empty()); + assertTrue (name.localName().empty()); qname.clear(); name.assign(qname, "http://www.appinf.com/", "local"); - assert (name.qname().empty()); - assert (name.prefix().empty()); - assert (name.namespaceURI() == "http://www.appinf.com/"); - assert (name.localName() == "local"); + assertTrue (name.qname().empty()); + assertTrue (name.prefix().empty()); + assertTrue (name.namespaceURI() == "http://www.appinf.com/"); + assertTrue (name.localName() == "local"); Name name2("pre:local", "http://www.appinf.com/"); - assert (name2.qname() == "pre:local"); - assert (name2.prefix() == "pre"); - assert (name2.namespaceURI() == "http://www.appinf.com/"); - assert (name2.localName() == "local"); + assertTrue (name2.qname() == "pre:local"); + assertTrue (name2.prefix() == "pre"); + assertTrue (name2.namespaceURI() == "http://www.appinf.com/"); + assertTrue (name2.localName() == "local"); name2.assign("PRE:Local", "http://www.appinf.com/"); - assert (name2.qname() == "PRE:Local"); - assert (name2.prefix() == "PRE"); - assert (name2.namespaceURI() == "http://www.appinf.com/"); - assert (name2.localName() == "Local"); + assertTrue (name2.qname() == "PRE:Local"); + assertTrue (name2.prefix() == "PRE"); + assertTrue (name2.namespaceURI() == "http://www.appinf.com/"); + assertTrue (name2.localName() == "Local"); } @@ -112,23 +112,23 @@ void NameTest::testCompare() Name n2(n1); Name n3("pre:local2"); - assert (n1.equals(n2)); - assert (!n1.equals(n3)); + assertTrue (n1.equals(n2)); + assertTrue (!n1.equals(n3)); n1.assign("pre:local", "http://www.appinf.com", "local"); n2.assign("pre:local", "http://www.appinf.com", "local"); n3.assign("pre:local2", "http://www.appinf.com", "local2"); - assert (n1.equals(n2)); - assert (!n1.equals(n3)); + assertTrue (n1.equals(n2)); + assertTrue (!n1.equals(n3)); - assert (n1.equals("pre:local", "http://www.appinf.com", "local")); - assert (!n1.equals("pre:local", "", "")); - assert (n1.equalsWeakly("pre:local", "", "")); - assert (!n1.equalsWeakly("pre:local2", "", "")); - assert (!n1.equals("", "http://www.appinf.com", "local")); - assert (n1.equalsWeakly("", "http://www.appinf.com", "local")); - assert (!n1.equalsWeakly("", "http://www.appinf.com", "local2")); + assertTrue (n1.equals("pre:local", "http://www.appinf.com", "local")); + assertTrue (!n1.equals("pre:local", "", "")); + assertTrue (n1.equalsWeakly("pre:local", "", "")); + assertTrue (!n1.equalsWeakly("pre:local2", "", "")); + assertTrue (!n1.equals("", "http://www.appinf.com", "local")); + assertTrue (n1.equalsWeakly("", "http://www.appinf.com", "local")); + assertTrue (!n1.equalsWeakly("", "http://www.appinf.com", "local2")); } @@ -137,12 +137,12 @@ void NameTest::testSwap() Name n1("ns:name1", "http://www.appinf.com"); Name n2("ns:name2", "http://www.foobar.com"); n1.swap(n2); - assert (n1.qname() == "ns:name2"); - assert (n1.namespaceURI() == "http://www.foobar.com"); - assert (n1.localName() == "name2"); - assert (n2.qname() == "ns:name1"); - assert (n2.namespaceURI() == "http://www.appinf.com"); - assert (n2.localName() == "name1"); + assertTrue (n1.qname() == "ns:name2"); + assertTrue (n1.namespaceURI() == "http://www.foobar.com"); + assertTrue (n1.localName() == "name2"); + assertTrue (n2.qname() == "ns:name1"); + assertTrue (n2.namespaceURI() == "http://www.appinf.com"); + assertTrue (n2.localName() == "name1"); } diff --git a/XML/testsuite/src/NamespaceSupportTest.cpp b/XML/testsuite/src/NamespaceSupportTest.cpp index c676d6468..e82ea2af6 100644 --- a/XML/testsuite/src/NamespaceSupportTest.cpp +++ b/XML/testsuite/src/NamespaceSupportTest.cpp @@ -32,141 +32,141 @@ void NamespaceSupportTest::testNamespaceSupport() NamespaceSupport ns; NamespaceSupport::PrefixSet prefixes; ns.getDeclaredPrefixes(prefixes); - assert (prefixes.size() == 2); - assert (prefixes.find("xml") != prefixes.end()); - assert (prefixes.find("xmlns") != prefixes.end()); + assertTrue (prefixes.size() == 2); + assertTrue (prefixes.find("xml") != prefixes.end()); + assertTrue (prefixes.find("xmlns") != prefixes.end()); ns.getPrefixes(prefixes); - assert (prefixes.size() == 2); - assert (prefixes.find("xml") != prefixes.end()); - assert (prefixes.find("xmlns") != prefixes.end()); + assertTrue (prefixes.size() == 2); + assertTrue (prefixes.find("xml") != prefixes.end()); + assertTrue (prefixes.find("xmlns") != prefixes.end()); ns.pushContext(); ns.declarePrefix("ns1", "urn:ns1"); ns.declarePrefix("ns2", "urn:ns2"); ns.getDeclaredPrefixes(prefixes); - assert (prefixes.size() == 2); - assert (prefixes.find("ns1") != prefixes.end()); - assert (prefixes.find("ns2") != prefixes.end()); + assertTrue (prefixes.size() == 2); + assertTrue (prefixes.find("ns1") != prefixes.end()); + assertTrue (prefixes.find("ns2") != prefixes.end()); ns.pushContext(); ns.declarePrefix("ns3", "urn:ns3"); ns.getDeclaredPrefixes(prefixes); - assert (prefixes.size() == 1); - assert (prefixes.find("ns3") != prefixes.end()); + assertTrue (prefixes.size() == 1); + assertTrue (prefixes.find("ns3") != prefixes.end()); ns.getPrefixes(prefixes); - assert (prefixes.size() == 5); - assert (prefixes.find("xml") != prefixes.end()); - assert (prefixes.find("xmlns") != prefixes.end()); - assert (prefixes.find("ns1") != prefixes.end()); - assert (prefixes.find("ns2") != prefixes.end()); - assert (prefixes.find("ns3") != prefixes.end()); + assertTrue (prefixes.size() == 5); + assertTrue (prefixes.find("xml") != prefixes.end()); + assertTrue (prefixes.find("xmlns") != prefixes.end()); + assertTrue (prefixes.find("ns1") != prefixes.end()); + assertTrue (prefixes.find("ns2") != prefixes.end()); + assertTrue (prefixes.find("ns3") != prefixes.end()); ns.popContext(); ns.getDeclaredPrefixes(prefixes); - assert (prefixes.size() == 2); - assert (prefixes.find("ns1") != prefixes.end()); - assert (prefixes.find("ns2") != prefixes.end()); + assertTrue (prefixes.size() == 2); + assertTrue (prefixes.find("ns1") != prefixes.end()); + assertTrue (prefixes.find("ns2") != prefixes.end()); - assert (ns.isMapped("urn:ns1")); - assert (ns.isMapped("urn:ns2")); - assert (ns.isMapped("http://www.w3.org/XML/1998/namespace")); - assert (!ns.isMapped("urn:ns3")); + assertTrue (ns.isMapped("urn:ns1")); + assertTrue (ns.isMapped("urn:ns2")); + assertTrue (ns.isMapped("http://www.w3.org/XML/1998/namespace")); + assertTrue (!ns.isMapped("urn:ns3")); ns.getPrefixes("urn:ns2", prefixes); - assert (prefixes.size() == 1); - assert (prefixes.find("ns2") != prefixes.end()); + assertTrue (prefixes.size() == 1); + assertTrue (prefixes.find("ns2") != prefixes.end()); ns.pushContext(); ns.declarePrefix("", "urn:ns3"); ns.declarePrefix("NS2", "urn:ns2"); ns.getPrefixes("urn:ns2", prefixes); - assert (prefixes.size() == 2); - assert (prefixes.find("ns2") != prefixes.end()); - assert (prefixes.find("NS2") != prefixes.end()); + assertTrue (prefixes.size() == 2); + assertTrue (prefixes.find("ns2") != prefixes.end()); + assertTrue (prefixes.find("NS2") != prefixes.end()); ns.getPrefixes(prefixes); - assert (prefixes.size() == 5); - assert (prefixes.find("xml") != prefixes.end()); - assert (prefixes.find("xmlns") != prefixes.end()); - assert (prefixes.find("ns1") != prefixes.end()); - assert (prefixes.find("ns2") != prefixes.end()); - assert (prefixes.find("NS2") != prefixes.end()); + assertTrue (prefixes.size() == 5); + assertTrue (prefixes.find("xml") != prefixes.end()); + assertTrue (prefixes.find("xmlns") != prefixes.end()); + assertTrue (prefixes.find("ns1") != prefixes.end()); + assertTrue (prefixes.find("ns2") != prefixes.end()); + assertTrue (prefixes.find("NS2") != prefixes.end()); ns.getDeclaredPrefixes(prefixes); - assert (prefixes.size() == 2); - assert (prefixes.find("") != prefixes.end()); - assert (prefixes.find("NS2") != prefixes.end()); + assertTrue (prefixes.size() == 2); + assertTrue (prefixes.find("") != prefixes.end()); + assertTrue (prefixes.find("NS2") != prefixes.end()); - assert (ns.getPrefix("urn:ns3") == ""); - assert (ns.getPrefix("urn:ns2") == "NS2"); - assert (ns.getPrefix("urn:ns4") == ""); + assertTrue (ns.getPrefix("urn:ns3") == ""); + assertTrue (ns.getPrefix("urn:ns2") == "NS2"); + assertTrue (ns.getPrefix("urn:ns4") == ""); - assert (ns.isMapped("urn:ns3")); - assert (ns.isMapped("urn:ns2")); - assert (!ns.isMapped("urn:ns4")); + assertTrue (ns.isMapped("urn:ns3")); + assertTrue (ns.isMapped("urn:ns2")); + assertTrue (!ns.isMapped("urn:ns4")); - assert (ns.getURI("xml") == "http://www.w3.org/XML/1998/namespace"); - assert (ns.getURI("ns1") == "urn:ns1"); - assert (ns.getURI("") == "urn:ns3"); - assert (ns.getURI("NS2") == "urn:ns2"); + assertTrue (ns.getURI("xml") == "http://www.w3.org/XML/1998/namespace"); + assertTrue (ns.getURI("ns1") == "urn:ns1"); + assertTrue (ns.getURI("") == "urn:ns3"); + assertTrue (ns.getURI("NS2") == "urn:ns2"); std::string localName; std::string namespaceURI; bool declared = ns.processName("elem", namespaceURI, localName, false); - assert (declared); - assert (localName == "elem"); - assert (namespaceURI == "urn:ns3"); + assertTrue (declared); + assertTrue (localName == "elem"); + assertTrue (namespaceURI == "urn:ns3"); declared = ns.processName("NS2:elem", namespaceURI, localName, false); - assert (declared); - assert (localName == "elem"); - assert (namespaceURI == "urn:ns2"); + assertTrue (declared); + assertTrue (localName == "elem"); + assertTrue (namespaceURI == "urn:ns2"); declared = ns.processName("ns3:elem", namespaceURI, localName, false); - assert (!declared); - assert (localName == "elem"); - assert (namespaceURI == ""); + assertTrue (!declared); + assertTrue (localName == "elem"); + assertTrue (namespaceURI == ""); declared = ns.processName("ns2:attr", namespaceURI, localName, true); - assert (declared); - assert (localName == "attr"); - assert (namespaceURI == "urn:ns2"); + assertTrue (declared); + assertTrue (localName == "attr"); + assertTrue (namespaceURI == "urn:ns2"); declared = ns.processName("attr", namespaceURI, localName, true); - assert (declared); - assert (localName == "attr"); - assert (namespaceURI == ""); + assertTrue (declared); + assertTrue (localName == "attr"); + assertTrue (namespaceURI == ""); declared = ns.processName("ns3:attr", namespaceURI, localName, true); - assert (!declared); - assert (localName == "attr"); - assert (namespaceURI == ""); + assertTrue (!declared); + assertTrue (localName == "attr"); + assertTrue (namespaceURI == ""); ns.popContext(); - assert (ns.getURI("xml") == "http://www.w3.org/XML/1998/namespace"); - assert (ns.getURI("ns1") == "urn:ns1"); - assert (ns.getURI("") == ""); - assert (ns.getURI("NS2") == ""); + assertTrue (ns.getURI("xml") == "http://www.w3.org/XML/1998/namespace"); + assertTrue (ns.getURI("ns1") == "urn:ns1"); + assertTrue (ns.getURI("") == ""); + assertTrue (ns.getURI("NS2") == ""); declared = ns.processName("elem", namespaceURI, localName, false); - assert (declared); - assert (localName == "elem"); - assert (namespaceURI == ""); + assertTrue (declared); + assertTrue (localName == "elem"); + assertTrue (namespaceURI == ""); declared = ns.processName("ns2:elem", namespaceURI, localName, false); - assert (declared); - assert (localName == "elem"); - assert (namespaceURI == "urn:ns2"); + assertTrue (declared); + assertTrue (localName == "elem"); + assertTrue (namespaceURI == "urn:ns2"); declared = ns.processName("ns3:elem", namespaceURI, localName, false); - assert (!declared); - assert (localName == "elem"); - assert (namespaceURI == ""); + assertTrue (!declared); + assertTrue (localName == "elem"); + assertTrue (namespaceURI == ""); } diff --git a/XML/testsuite/src/NodeAppenderTest.cpp b/XML/testsuite/src/NodeAppenderTest.cpp index 929a81341..e492f77ed 100644 --- a/XML/testsuite/src/NodeAppenderTest.cpp +++ b/XML/testsuite/src/NodeAppenderTest.cpp @@ -52,20 +52,20 @@ void NodeAppenderTest::testAppendNode() appender.appendChild(pElem2); appender.appendChild(pElem3); - assert (pRoot->firstChild() == pElem1); - assert (pRoot->lastChild() == pElem3); + assertTrue (pRoot->firstChild() == pElem1); + assertTrue (pRoot->lastChild() == pElem3); - assert (pElem1->nextSibling() == pElem2); - assert (pElem2->nextSibling() == pElem3); - assert (pElem3->nextSibling() == 0); + assertTrue (pElem1->nextSibling() == pElem2); + assertTrue (pElem2->nextSibling() == pElem3); + assertTrue (pElem3->nextSibling() == 0); - assert (pElem1->previousSibling() == 0); - assert (pElem2->previousSibling() == pElem1); - assert (pElem3->previousSibling() == pElem2); + assertTrue (pElem1->previousSibling() == 0); + assertTrue (pElem2->previousSibling() == pElem1); + assertTrue (pElem3->previousSibling() == pElem2); - assert (pElem1->parentNode() == pRoot); - assert (pElem2->parentNode() == pRoot); - assert (pElem3->parentNode() == pRoot); + assertTrue (pElem1->parentNode() == pRoot); + assertTrue (pElem2->parentNode() == pRoot); + assertTrue (pElem3->parentNode() == pRoot); } @@ -93,29 +93,29 @@ void NodeAppenderTest::testAppendNodeList() pFrag3->appendChild(pElem4); appender.appendChild(pFrag1); - assert (pRoot->firstChild() == 0); + assertTrue (pRoot->firstChild() == 0); appender.appendChild(pFrag2); - assert (pRoot->firstChild() == pElem1); - assert (pRoot->lastChild() == pElem3); + assertTrue (pRoot->firstChild() == pElem1); + assertTrue (pRoot->lastChild() == pElem3); - assert (pElem1->nextSibling() == pElem2); - assert (pElem2->nextSibling() == pElem3); - assert (pElem3->nextSibling() == 0); + assertTrue (pElem1->nextSibling() == pElem2); + assertTrue (pElem2->nextSibling() == pElem3); + assertTrue (pElem3->nextSibling() == 0); - assert (pElem1->previousSibling() == 0); - assert (pElem2->previousSibling() == pElem1); - assert (pElem3->previousSibling() == pElem2); + assertTrue (pElem1->previousSibling() == 0); + assertTrue (pElem2->previousSibling() == pElem1); + assertTrue (pElem3->previousSibling() == pElem2); - assert (pElem1->parentNode() == pRoot); - assert (pElem2->parentNode() == pRoot); - assert (pElem3->parentNode() == pRoot); + assertTrue (pElem1->parentNode() == pRoot); + assertTrue (pElem2->parentNode() == pRoot); + assertTrue (pElem3->parentNode() == pRoot); appender.appendChild(pFrag3); - assert (pRoot->lastChild() == pElem4); - assert (pElem4->parentNode() == pRoot); - assert (pElem3->nextSibling() == pElem4); - assert (pElem4->previousSibling() == pElem3); + assertTrue (pRoot->lastChild() == pElem4); + assertTrue (pElem4->parentNode() == pRoot); + assertTrue (pElem3->nextSibling() == pElem4); + assertTrue (pElem4->previousSibling() == pElem3); } diff --git a/XML/testsuite/src/NodeIteratorTest.cpp b/XML/testsuite/src/NodeIteratorTest.cpp index 684df5022..222f286ef 100644 --- a/XML/testsuite/src/NodeIteratorTest.cpp +++ b/XML/testsuite/src/NodeIteratorTest.cpp @@ -71,19 +71,19 @@ void NodeIteratorTest::testShowAll() NodeIterator it(pRoot, NodeFilter::SHOW_ALL); - assert (it.nextNode() == pRoot); - assert (it.nextNode() == pElem1); - assert (it.nextNode() == pText1); - assert (it.nextNode() == pElem2); - assert (it.nextNode() == pText2); - assert (it.nextNode() == 0); + assertTrue (it.nextNode() == pRoot); + assertTrue (it.nextNode() == pElem1); + assertTrue (it.nextNode() == pText1); + assertTrue (it.nextNode() == pElem2); + assertTrue (it.nextNode() == pText2); + assertTrue (it.nextNode() == 0); - assert (it.previousNode() == pText2); - assert (it.previousNode() == pElem2); - assert (it.previousNode() == pText1); - assert (it.previousNode() == pElem1); - assert (it.previousNode() == pRoot); - assert (it.previousNode() == 0); + assertTrue (it.previousNode() == pText2); + assertTrue (it.previousNode() == pElem2); + assertTrue (it.previousNode() == pText1); + assertTrue (it.previousNode() == pElem1); + assertTrue (it.previousNode() == pRoot); + assertTrue (it.previousNode() == 0); } @@ -104,15 +104,15 @@ void NodeIteratorTest::testShowElements() NodeIterator it(pRoot, NodeFilter::SHOW_ELEMENT); - assert (it.nextNode() == pRoot); - assert (it.nextNode() == pElem1); - assert (it.nextNode() == pElem2); - assert (it.nextNode() == 0); + assertTrue (it.nextNode() == pRoot); + assertTrue (it.nextNode() == pElem1); + assertTrue (it.nextNode() == pElem2); + assertTrue (it.nextNode() == 0); - assert (it.previousNode() == pElem2); - assert (it.previousNode() == pElem1); - assert (it.previousNode() == pRoot); - assert (it.previousNode() == 0); + assertTrue (it.previousNode() == pElem2); + assertTrue (it.previousNode() == pElem1); + assertTrue (it.previousNode() == pRoot); + assertTrue (it.previousNode() == 0); } @@ -134,11 +134,11 @@ void NodeIteratorTest::testFilter() TestNodeFilter filter; NodeIterator it(pRoot, NodeFilter::SHOW_ELEMENT, &filter); - assert (it.nextNode() == pElem1); - assert (it.nextNode() == 0); + assertTrue (it.nextNode() == pElem1); + assertTrue (it.nextNode() == 0); - assert (it.previousNode() == pElem1); - assert (it.previousNode() == 0); + assertTrue (it.previousNode() == pElem1); + assertTrue (it.previousNode() == 0); } @@ -159,9 +159,9 @@ void NodeIteratorTest::testShowNothing() NodeIterator it(pRoot, 0); - assert (it.nextNode() == 0); + assertTrue (it.nextNode() == 0); - assert (it.previousNode() == 0); + assertTrue (it.previousNode() == 0); } diff --git a/XML/testsuite/src/NodeTest.cpp b/XML/testsuite/src/NodeTest.cpp index f1bf42256..538717efa 100644 --- a/XML/testsuite/src/NodeTest.cpp +++ b/XML/testsuite/src/NodeTest.cpp @@ -39,54 +39,54 @@ void NodeTest::testInsert() AutoPtr pDoc = new Document; AutoPtr pRoot = pDoc->createElement("root"); - assert (!pRoot->hasChildNodes()); - assert (pRoot->firstChild() == 0); - assert (pRoot->lastChild() == 0); + assertTrue (!pRoot->hasChildNodes()); + assertTrue (pRoot->firstChild() == 0); + assertTrue (pRoot->lastChild() == 0); AutoPtr pChild1 = pDoc->createElement("child1"); pRoot->insertBefore(pChild1, 0); - assert (pRoot->hasChildNodes()); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild1); + assertTrue (pRoot->hasChildNodes()); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild1); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); AutoPtr pChild3 = pDoc->createElement("child3"); pRoot->insertBefore(pChild3, 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild1); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild1); + assertTrue (pChild3->nextSibling() == 0); AutoPtr pChild0 = pDoc->createElement("child0"); pRoot->insertBefore(pChild0, pChild1); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild1); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild1); + assertTrue (pChild3->nextSibling() == 0); AutoPtr pChild2 = pDoc->createElement("child2"); pRoot->insertBefore(pChild2, pChild3); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == 0); } @@ -97,33 +97,33 @@ void NodeTest::testAppend() AutoPtr pChild1 = pDoc->createElement("child1"); pRoot->appendChild(pChild1); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild1); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild1); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); AutoPtr pChild2 = pDoc->createElement("child2"); pRoot->appendChild(pChild2); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild2); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild2); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == 0); AutoPtr pChild3 = pDoc->createElement("child3"); pRoot->appendChild(pChild3); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == 0); } @@ -145,40 +145,40 @@ void NodeTest::testRemove() pRoot->appendChild(pChild4); pRoot->removeChild(pChild2); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == 0); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild1); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild1); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); pRoot->removeChild(pChild4); - assert (pChild4->previousSibling() == 0); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild4->previousSibling() == 0); + assertTrue (pChild4->nextSibling() == 0); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild1); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild1); + assertTrue (pChild3->nextSibling() == 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild3); pRoot->removeChild(pChild1); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); - assert (pRoot->firstChild() == pChild3); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild3); + assertTrue (pRoot->lastChild() == pChild3); pRoot->removeChild(pChild3); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == 0); - assert (pRoot->firstChild() == 0); - assert (pRoot->lastChild() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == 0); + assertTrue (pRoot->firstChild() == 0); + assertTrue (pRoot->lastChild() == 0); } @@ -202,66 +202,66 @@ void NodeTest::testReplace() AutoPtr pChild11 = pDoc->createElement("child11"); pRoot->replaceChild(pChild11, pChild1); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild11); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild11); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild22 = pDoc->createElement("child22"); pRoot->replaceChild(pChild22, pChild2); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild11); - assert (pChild22->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild22); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild11); + assertTrue (pChild22->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild22); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild33 = pDoc->createElement("child33"); pRoot->replaceChild(pChild33, pChild3); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild11); - assert (pChild22->nextSibling() == pChild33); - assert (pChild33->previousSibling() == pChild22); - assert (pChild33->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild33); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild11); + assertTrue (pChild22->nextSibling() == pChild33); + assertTrue (pChild33->previousSibling() == pChild22); + assertTrue (pChild33->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild33); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild44 = pDoc->createElement("child44"); pRoot->replaceChild(pChild44, pChild4); - assert (pChild4->previousSibling() == 0); - assert (pChild4->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild44); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild11); - assert (pChild22->nextSibling() == pChild33); - assert (pChild33->previousSibling() == pChild22); - assert (pChild33->nextSibling() == pChild44); - assert (pChild44->previousSibling() == pChild33); - assert (pChild44->nextSibling() == 0); + assertTrue (pChild4->previousSibling() == 0); + assertTrue (pChild4->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild44); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild11); + assertTrue (pChild22->nextSibling() == pChild33); + assertTrue (pChild33->previousSibling() == pChild22); + assertTrue (pChild33->nextSibling() == pChild44); + assertTrue (pChild44->previousSibling() == pChild33); + assertTrue (pChild44->nextSibling() == 0); } @@ -271,59 +271,59 @@ void NodeTest::testInsertFragment1() AutoPtr pRoot = pDoc->createElement("root"); AutoPtr pFrag = pDoc->createDocumentFragment(); - assert (!pRoot->hasChildNodes()); - assert (pRoot->firstChild() == 0); - assert (pRoot->lastChild() == 0); + assertTrue (!pRoot->hasChildNodes()); + assertTrue (pRoot->firstChild() == 0); + assertTrue (pRoot->lastChild() == 0); AutoPtr pChild1 = pDoc->createElement("child1"); pFrag->appendChild(pChild1); pRoot->insertBefore(pFrag, 0); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild1); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild1); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); AutoPtr pChild3 = pDoc->createElement("child3"); pFrag->appendChild(pChild3); pRoot->insertBefore(pFrag, 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild1); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild1); + assertTrue (pChild3->nextSibling() == 0); AutoPtr pChild0 = pDoc->createElement("child0"); pFrag->appendChild(pChild0); pRoot->insertBefore(pFrag, pChild1); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild1); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild1); + assertTrue (pChild3->nextSibling() == 0); AutoPtr pChild2 = pDoc->createElement("child2"); pFrag->appendChild(pChild2); pRoot->insertBefore(pFrag, pChild3); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == 0); } @@ -333,87 +333,87 @@ void NodeTest::testInsertFragment2() AutoPtr pRoot = pDoc->createElement("root"); AutoPtr pFrag = pDoc->createDocumentFragment(); - assert (!pRoot->hasChildNodes()); - assert (pRoot->firstChild() == 0); - assert (pRoot->lastChild() == 0); + assertTrue (!pRoot->hasChildNodes()); + assertTrue (pRoot->firstChild() == 0); + assertTrue (pRoot->lastChild() == 0); AutoPtr pChild2 = pDoc->createElement("child2"); AutoPtr pChild3 = pDoc->createElement("child3"); pFrag->appendChild(pChild2); pFrag->appendChild(pChild3); pRoot->insertBefore(pFrag, 0); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); - assert (pRoot->firstChild() == pChild2); - assert (pRoot->lastChild() == pChild3); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); + assertTrue (pRoot->firstChild() == pChild2); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == 0); AutoPtr pChild6 = pDoc->createElement("child6"); AutoPtr pChild7 = pDoc->createElement("child7"); pFrag->appendChild(pChild6); pFrag->appendChild(pChild7); pRoot->insertBefore(pFrag, 0); - assert (pRoot->firstChild() == pChild2); - assert (pRoot->lastChild() == pChild7); + assertTrue (pRoot->firstChild() == pChild2); + assertTrue (pRoot->lastChild() == pChild7); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild3); - assert (pChild6->nextSibling() == pChild7); - assert (pChild7->previousSibling() == pChild6); - assert (pChild7->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild3); + assertTrue (pChild6->nextSibling() == pChild7); + assertTrue (pChild7->previousSibling() == pChild6); + assertTrue (pChild7->nextSibling() == 0); AutoPtr pChild0 = pDoc->createElement("child0"); AutoPtr pChild1 = pDoc->createElement("child1"); pFrag->appendChild(pChild0); pFrag->appendChild(pChild1); pRoot->insertBefore(pFrag, pChild2); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild7); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild7); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild3); - assert (pChild6->nextSibling() == pChild7); - assert (pChild7->previousSibling() == pChild6); - assert (pChild7->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild3); + assertTrue (pChild6->nextSibling() == pChild7); + assertTrue (pChild7->previousSibling() == pChild6); + assertTrue (pChild7->nextSibling() == 0); AutoPtr pChild4 = pDoc->createElement("child4"); AutoPtr pChild5 = pDoc->createElement("child5"); pFrag->appendChild(pChild4); pFrag->appendChild(pChild5); pRoot->insertBefore(pFrag, pChild6); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild7); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild7); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild5); - assert (pChild6->nextSibling() == pChild7); - assert (pChild7->previousSibling() == pChild6); - assert (pChild7->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild5); + assertTrue (pChild6->nextSibling() == pChild7); + assertTrue (pChild7->previousSibling() == pChild6); + assertTrue (pChild7->nextSibling() == 0); } @@ -423,9 +423,9 @@ void NodeTest::testInsertFragment3() AutoPtr pRoot = pDoc->createElement("root"); AutoPtr pFrag = pDoc->createDocumentFragment(); - assert (!pRoot->hasChildNodes()); - assert (pRoot->firstChild() == 0); - assert (pRoot->lastChild() == 0); + assertTrue (!pRoot->hasChildNodes()); + assertTrue (pRoot->firstChild() == 0); + assertTrue (pRoot->lastChild() == 0); AutoPtr pChild3 = pDoc->createElement("child3"); AutoPtr pChild4 = pDoc->createElement("child4"); @@ -434,17 +434,17 @@ void NodeTest::testInsertFragment3() pFrag->appendChild(pChild4); pFrag->appendChild(pChild5); pRoot->insertBefore(pFrag, 0); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); - assert (pRoot->firstChild() == pChild3); - assert (pRoot->lastChild() == pChild5); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); + assertTrue (pRoot->firstChild() == pChild3); + assertTrue (pRoot->lastChild() == pChild5); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == 0); AutoPtr pChild9 = pDoc->createElement("child9"); AutoPtr pChild10 = pDoc->createElement("child10"); @@ -453,21 +453,21 @@ void NodeTest::testInsertFragment3() pFrag->appendChild(pChild10); pFrag->appendChild(pChild11); pRoot->insertBefore(pFrag, 0); - assert (pRoot->firstChild() == pChild3); - assert (pRoot->lastChild() == pChild11); + assertTrue (pRoot->firstChild() == pChild3); + assertTrue (pRoot->lastChild() == pChild11); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild9); - assert (pChild9->previousSibling() == pChild5); - assert (pChild9->nextSibling() == pChild10); - assert (pChild10->previousSibling() == pChild9); - assert (pChild10->nextSibling() == pChild11); - assert (pChild11->previousSibling() == pChild10); - assert (pChild11->nextSibling() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild9); + assertTrue (pChild9->previousSibling() == pChild5); + assertTrue (pChild9->nextSibling() == pChild10); + assertTrue (pChild10->previousSibling() == pChild9); + assertTrue (pChild10->nextSibling() == pChild11); + assertTrue (pChild11->previousSibling() == pChild10); + assertTrue (pChild11->nextSibling() == 0); AutoPtr pChild0 = pDoc->createElement("child0"); AutoPtr pChild1 = pDoc->createElement("child1"); @@ -476,27 +476,27 @@ void NodeTest::testInsertFragment3() pFrag->appendChild(pChild1); pFrag->appendChild(pChild2); pRoot->insertBefore(pFrag, pChild3); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild11); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild11); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild9); - assert (pChild9->previousSibling() == pChild5); - assert (pChild9->nextSibling() == pChild10); - assert (pChild10->previousSibling() == pChild9); - assert (pChild10->nextSibling() == pChild11); - assert (pChild11->previousSibling() == pChild10); - assert (pChild11->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild9); + assertTrue (pChild9->previousSibling() == pChild5); + assertTrue (pChild9->nextSibling() == pChild10); + assertTrue (pChild10->previousSibling() == pChild9); + assertTrue (pChild10->nextSibling() == pChild11); + assertTrue (pChild11->previousSibling() == pChild10); + assertTrue (pChild11->nextSibling() == 0); AutoPtr pChild6 = pDoc->createElement("child6"); AutoPtr pChild7 = pDoc->createElement("child7"); @@ -505,33 +505,33 @@ void NodeTest::testInsertFragment3() pFrag->appendChild(pChild7); pFrag->appendChild(pChild8); pRoot->insertBefore(pFrag, pChild9); - assert (pRoot->firstChild() == pChild0); - assert (pRoot->lastChild() == pChild11); + assertTrue (pRoot->firstChild() == pChild0); + assertTrue (pRoot->lastChild() == pChild11); - assert (pChild0->previousSibling() == 0); - assert (pChild0->nextSibling() == pChild1); - assert (pChild1->previousSibling() == pChild0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild5); - assert (pChild6->nextSibling() == pChild7); - assert (pChild7->previousSibling() == pChild6); - assert (pChild7->nextSibling() == pChild8); - assert (pChild8->previousSibling() == pChild7); - assert (pChild8->nextSibling() == pChild9); - assert (pChild9->previousSibling() == pChild8); - assert (pChild9->nextSibling() == pChild10); - assert (pChild10->previousSibling() == pChild9); - assert (pChild10->nextSibling() == pChild11); - assert (pChild11->previousSibling() == pChild10); - assert (pChild11->nextSibling() == 0); + assertTrue (pChild0->previousSibling() == 0); + assertTrue (pChild0->nextSibling() == pChild1); + assertTrue (pChild1->previousSibling() == pChild0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild5); + assertTrue (pChild6->nextSibling() == pChild7); + assertTrue (pChild7->previousSibling() == pChild6); + assertTrue (pChild7->nextSibling() == pChild8); + assertTrue (pChild8->previousSibling() == pChild7); + assertTrue (pChild8->nextSibling() == pChild9); + assertTrue (pChild9->previousSibling() == pChild8); + assertTrue (pChild9->nextSibling() == pChild10); + assertTrue (pChild10->previousSibling() == pChild9); + assertTrue (pChild10->nextSibling() == pChild11); + assertTrue (pChild11->previousSibling() == pChild10); + assertTrue (pChild11->nextSibling() == 0); } @@ -544,37 +544,37 @@ void NodeTest::testAppendFragment1() AutoPtr pChild1 = pDoc->createElement("child1"); pFrag->appendChild(pChild1); pRoot->appendChild(pFrag); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild1); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild1); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); AutoPtr pChild2 = pDoc->createElement("child2"); pFrag->appendChild(pChild2); pRoot->appendChild(pFrag); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild2); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild2); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == 0); AutoPtr pChild3 = pDoc->createElement("child3"); pFrag->appendChild(pChild3); pRoot->appendChild(pFrag); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild3); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == 0); } @@ -589,53 +589,53 @@ void NodeTest::testAppendFragment2() pFrag->appendChild(pChild1); pFrag->appendChild(pChild2); pRoot->appendChild(pFrag); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild2); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild2); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == 0); AutoPtr pChild3 = pDoc->createElement("child3"); AutoPtr pChild4 = pDoc->createElement("child4"); pFrag->appendChild(pChild3); pFrag->appendChild(pChild4); pRoot->appendChild(pFrag); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild4); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild4); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild5 = pDoc->createElement("child5"); AutoPtr pChild6 = pDoc->createElement("child6"); pFrag->appendChild(pChild5); pFrag->appendChild(pChild6); pRoot->appendChild(pFrag); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild6); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild6); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild5); - assert (pChild6->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild5); + assertTrue (pChild6->nextSibling() == 0); } @@ -652,17 +652,17 @@ void NodeTest::testAppendFragment3() pFrag->appendChild(pChild2); pFrag->appendChild(pChild3); pRoot->appendChild(pFrag); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild3); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild3); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == 0); AutoPtr pChild4 = pDoc->createElement("child4"); AutoPtr pChild5 = pDoc->createElement("child5"); @@ -671,21 +671,21 @@ void NodeTest::testAppendFragment3() pFrag->appendChild(pChild5); pFrag->appendChild(pChild6); pRoot->appendChild(pFrag); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild6); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild6); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild5); - assert (pChild6->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild5); + assertTrue (pChild6->nextSibling() == 0); AutoPtr pChild7 = pDoc->createElement("child7"); AutoPtr pChild8 = pDoc->createElement("child8"); @@ -694,27 +694,27 @@ void NodeTest::testAppendFragment3() pFrag->appendChild(pChild8); pFrag->appendChild(pChild9); pRoot->appendChild(pFrag); - assert (pRoot->firstChild() == pChild1); - assert (pRoot->lastChild() == pChild9); + assertTrue (pRoot->firstChild() == pChild1); + assertTrue (pRoot->lastChild() == pChild9); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild1); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == pChild5); - assert (pChild5->previousSibling() == pChild4); - assert (pChild5->nextSibling() == pChild6); - assert (pChild6->previousSibling() == pChild5); - assert (pChild6->nextSibling() == pChild7); - assert (pChild7->previousSibling() == pChild6); - assert (pChild7->nextSibling() == pChild8); - assert (pChild8->previousSibling() == pChild7); - assert (pChild8->nextSibling() == pChild9); - assert (pChild9->previousSibling() == pChild8); - assert (pChild9->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild1); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == pChild5); + assertTrue (pChild5->previousSibling() == pChild4); + assertTrue (pChild5->nextSibling() == pChild6); + assertTrue (pChild6->previousSibling() == pChild5); + assertTrue (pChild6->nextSibling() == pChild7); + assertTrue (pChild7->previousSibling() == pChild6); + assertTrue (pChild7->nextSibling() == pChild8); + assertTrue (pChild8->previousSibling() == pChild7); + assertTrue (pChild8->nextSibling() == pChild9); + assertTrue (pChild9->previousSibling() == pChild8); + assertTrue (pChild9->nextSibling() == 0); } @@ -739,72 +739,72 @@ void NodeTest::testReplaceFragment1() AutoPtr pChild11 = pDoc->createElement("child11"); pFrag->appendChild(pChild11); pRoot->replaceChild(pFrag, pChild1); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild11); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild11); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild22 = pDoc->createElement("child22"); pFrag->appendChild(pChild22); pRoot->replaceChild(pFrag, pChild2); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild11); - assert (pChild22->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild22); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild11); + assertTrue (pChild22->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild22); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild33 = pDoc->createElement("child33"); pFrag->appendChild(pChild33); pRoot->replaceChild(pFrag, pChild3); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild11); - assert (pChild22->nextSibling() == pChild33); - assert (pChild33->previousSibling() == pChild22); - assert (pChild33->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild33); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild11); + assertTrue (pChild22->nextSibling() == pChild33); + assertTrue (pChild33->previousSibling() == pChild22); + assertTrue (pChild33->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild33); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild44 = pDoc->createElement("child44"); pFrag->appendChild(pChild44); pRoot->replaceChild(pFrag, pChild4); - assert (pChild4->previousSibling() == 0); - assert (pChild4->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild44); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild11); - assert (pChild22->nextSibling() == pChild33); - assert (pChild33->previousSibling() == pChild22); - assert (pChild33->nextSibling() == pChild44); - assert (pChild44->previousSibling() == pChild33); - assert (pChild44->nextSibling() == 0); + assertTrue (pChild4->previousSibling() == 0); + assertTrue (pChild4->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild44); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild11); + assertTrue (pChild22->nextSibling() == pChild33); + assertTrue (pChild33->previousSibling() == pChild22); + assertTrue (pChild33->nextSibling() == pChild44); + assertTrue (pChild44->previousSibling() == pChild33); + assertTrue (pChild44->nextSibling() == 0); } @@ -831,23 +831,23 @@ void NodeTest::testReplaceFragment2() pFrag->appendChild(pChild11); pFrag->appendChild(pChild12); pRoot->replaceChild(pFrag, pChild1); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild12); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild12); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild21 = pDoc->createElement("child21"); AutoPtr pChild22 = pDoc->createElement("child22"); @@ -855,22 +855,22 @@ void NodeTest::testReplaceFragment2() pFrag->appendChild(pChild22); pRoot->replaceChild(pFrag, pChild2); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild21); - assert (pChild21->previousSibling() == pChild12); - assert (pChild21->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild21); - assert (pChild22->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild22); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild21); + assertTrue (pChild21->previousSibling() == pChild12); + assertTrue (pChild21->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild21); + assertTrue (pChild22->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild22); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild31 = pDoc->createElement("child31"); AutoPtr pChild32 = pDoc->createElement("child32"); @@ -878,24 +878,24 @@ void NodeTest::testReplaceFragment2() pFrag->appendChild(pChild32); pRoot->replaceChild(pFrag, pChild3); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild21); - assert (pChild21->previousSibling() == pChild12); - assert (pChild21->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild21); - assert (pChild22->nextSibling() == pChild31); - assert (pChild31->previousSibling() == pChild22); - assert (pChild31->nextSibling() == pChild32); - assert (pChild32->previousSibling() == pChild31); - assert (pChild32->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild32); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild21); + assertTrue (pChild21->previousSibling() == pChild12); + assertTrue (pChild21->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild21); + assertTrue (pChild22->nextSibling() == pChild31); + assertTrue (pChild31->previousSibling() == pChild22); + assertTrue (pChild31->nextSibling() == pChild32); + assertTrue (pChild32->previousSibling() == pChild31); + assertTrue (pChild32->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild32); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild41 = pDoc->createElement("child41"); AutoPtr pChild42 = pDoc->createElement("child42"); @@ -903,26 +903,26 @@ void NodeTest::testReplaceFragment2() pFrag->appendChild(pChild42); pRoot->replaceChild(pFrag, pChild4); - assert (pChild4->previousSibling() == 0); - assert (pChild4->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild42); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild21); - assert (pChild21->previousSibling() == pChild12); - assert (pChild21->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild21); - assert (pChild22->nextSibling() == pChild31); - assert (pChild31->previousSibling() == pChild22); - assert (pChild31->nextSibling() == pChild32); - assert (pChild32->previousSibling() == pChild31); - assert (pChild32->nextSibling() == pChild41); - assert (pChild41->previousSibling() == pChild32); - assert (pChild41->nextSibling() == pChild42); - assert (pChild42->previousSibling() == pChild41); - assert (pChild42->nextSibling() == 0); + assertTrue (pChild4->previousSibling() == 0); + assertTrue (pChild4->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild42); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild21); + assertTrue (pChild21->previousSibling() == pChild12); + assertTrue (pChild21->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild21); + assertTrue (pChild22->nextSibling() == pChild31); + assertTrue (pChild31->previousSibling() == pChild22); + assertTrue (pChild31->nextSibling() == pChild32); + assertTrue (pChild32->previousSibling() == pChild31); + assertTrue (pChild32->nextSibling() == pChild41); + assertTrue (pChild41->previousSibling() == pChild32); + assertTrue (pChild41->nextSibling() == pChild42); + assertTrue (pChild42->previousSibling() == pChild41); + assertTrue (pChild42->nextSibling() == 0); } @@ -951,25 +951,25 @@ void NodeTest::testReplaceFragment3() pFrag->appendChild(pChild12); pFrag->appendChild(pChild13); pRoot->replaceChild(pFrag, pChild1); - assert (pFrag->firstChild() == 0); - assert (pFrag->lastChild() == 0); + assertTrue (pFrag->firstChild() == 0); + assertTrue (pFrag->lastChild() == 0); - assert (pChild1->previousSibling() == 0); - assert (pChild1->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild13); - assert (pChild13->previousSibling() == pChild12); - assert (pChild13->nextSibling() == pChild2); - assert (pChild2->previousSibling() == pChild13); - assert (pChild2->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild2); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild1->previousSibling() == 0); + assertTrue (pChild1->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild13); + assertTrue (pChild13->previousSibling() == pChild12); + assertTrue (pChild13->nextSibling() == pChild2); + assertTrue (pChild2->previousSibling() == pChild13); + assertTrue (pChild2->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild2); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild21 = pDoc->createElement("child21"); AutoPtr pChild22 = pDoc->createElement("child22"); @@ -979,26 +979,26 @@ void NodeTest::testReplaceFragment3() pFrag->appendChild(pChild23); pRoot->replaceChild(pFrag, pChild2); - assert (pChild2->previousSibling() == 0); - assert (pChild2->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild13); - assert (pChild13->previousSibling() == pChild12); - assert (pChild13->nextSibling() == pChild21); - assert (pChild21->previousSibling() == pChild13); - assert (pChild21->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild21); - assert (pChild22->nextSibling() == pChild23); - assert (pChild23->previousSibling() == pChild22); - assert (pChild23->nextSibling() == pChild3); - assert (pChild3->previousSibling() == pChild23); - assert (pChild3->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild3); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild2->previousSibling() == 0); + assertTrue (pChild2->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild13); + assertTrue (pChild13->previousSibling() == pChild12); + assertTrue (pChild13->nextSibling() == pChild21); + assertTrue (pChild21->previousSibling() == pChild13); + assertTrue (pChild21->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild21); + assertTrue (pChild22->nextSibling() == pChild23); + assertTrue (pChild23->previousSibling() == pChild22); + assertTrue (pChild23->nextSibling() == pChild3); + assertTrue (pChild3->previousSibling() == pChild23); + assertTrue (pChild3->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild3); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild31 = pDoc->createElement("child31"); AutoPtr pChild32 = pDoc->createElement("child32"); @@ -1008,30 +1008,30 @@ void NodeTest::testReplaceFragment3() pFrag->appendChild(pChild33); pRoot->replaceChild(pFrag, pChild3); - assert (pChild3->previousSibling() == 0); - assert (pChild3->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild4); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild13); - assert (pChild13->previousSibling() == pChild12); - assert (pChild13->nextSibling() == pChild21); - assert (pChild21->previousSibling() == pChild13); - assert (pChild21->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild21); - assert (pChild22->nextSibling() == pChild23); - assert (pChild23->previousSibling() == pChild22); - assert (pChild23->nextSibling() == pChild31); - assert (pChild31->previousSibling() == pChild23); - assert (pChild31->nextSibling() == pChild32); - assert (pChild32->previousSibling() == pChild31); - assert (pChild32->nextSibling() == pChild33); - assert (pChild33->previousSibling() == pChild32); - assert (pChild33->nextSibling() == pChild4); - assert (pChild4->previousSibling() == pChild33); - assert (pChild4->nextSibling() == 0); + assertTrue (pChild3->previousSibling() == 0); + assertTrue (pChild3->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild4); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild13); + assertTrue (pChild13->previousSibling() == pChild12); + assertTrue (pChild13->nextSibling() == pChild21); + assertTrue (pChild21->previousSibling() == pChild13); + assertTrue (pChild21->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild21); + assertTrue (pChild22->nextSibling() == pChild23); + assertTrue (pChild23->previousSibling() == pChild22); + assertTrue (pChild23->nextSibling() == pChild31); + assertTrue (pChild31->previousSibling() == pChild23); + assertTrue (pChild31->nextSibling() == pChild32); + assertTrue (pChild32->previousSibling() == pChild31); + assertTrue (pChild32->nextSibling() == pChild33); + assertTrue (pChild33->previousSibling() == pChild32); + assertTrue (pChild33->nextSibling() == pChild4); + assertTrue (pChild4->previousSibling() == pChild33); + assertTrue (pChild4->nextSibling() == 0); AutoPtr pChild41 = pDoc->createElement("child41"); AutoPtr pChild42 = pDoc->createElement("child42"); @@ -1041,34 +1041,34 @@ void NodeTest::testReplaceFragment3() pFrag->appendChild(pChild43); pRoot->replaceChild(pFrag, pChild4); - assert (pChild4->previousSibling() == 0); - assert (pChild4->nextSibling() == 0); - assert (pRoot->firstChild() == pChild11); - assert (pRoot->lastChild() == pChild43); - assert (pChild11->previousSibling() == 0); - assert (pChild11->nextSibling() == pChild12); - assert (pChild12->previousSibling() == pChild11); - assert (pChild12->nextSibling() == pChild13); - assert (pChild13->previousSibling() == pChild12); - assert (pChild13->nextSibling() == pChild21); - assert (pChild21->previousSibling() == pChild13); - assert (pChild21->nextSibling() == pChild22); - assert (pChild22->previousSibling() == pChild21); - assert (pChild22->nextSibling() == pChild23); - assert (pChild23->previousSibling() == pChild22); - assert (pChild23->nextSibling() == pChild31); - assert (pChild31->previousSibling() == pChild23); - assert (pChild31->nextSibling() == pChild32); - assert (pChild32->previousSibling() == pChild31); - assert (pChild32->nextSibling() == pChild33); - assert (pChild33->previousSibling() == pChild32); - assert (pChild33->nextSibling() == pChild41); - assert (pChild41->previousSibling() == pChild33); - assert (pChild41->nextSibling() == pChild42); - assert (pChild42->previousSibling() == pChild41); - assert (pChild42->nextSibling() == pChild43); - assert (pChild43->previousSibling() == pChild42); - assert (pChild43->nextSibling() == 0); + assertTrue (pChild4->previousSibling() == 0); + assertTrue (pChild4->nextSibling() == 0); + assertTrue (pRoot->firstChild() == pChild11); + assertTrue (pRoot->lastChild() == pChild43); + assertTrue (pChild11->previousSibling() == 0); + assertTrue (pChild11->nextSibling() == pChild12); + assertTrue (pChild12->previousSibling() == pChild11); + assertTrue (pChild12->nextSibling() == pChild13); + assertTrue (pChild13->previousSibling() == pChild12); + assertTrue (pChild13->nextSibling() == pChild21); + assertTrue (pChild21->previousSibling() == pChild13); + assertTrue (pChild21->nextSibling() == pChild22); + assertTrue (pChild22->previousSibling() == pChild21); + assertTrue (pChild22->nextSibling() == pChild23); + assertTrue (pChild23->previousSibling() == pChild22); + assertTrue (pChild23->nextSibling() == pChild31); + assertTrue (pChild31->previousSibling() == pChild23); + assertTrue (pChild31->nextSibling() == pChild32); + assertTrue (pChild32->previousSibling() == pChild31); + assertTrue (pChild32->nextSibling() == pChild33); + assertTrue (pChild33->previousSibling() == pChild32); + assertTrue (pChild33->nextSibling() == pChild41); + assertTrue (pChild41->previousSibling() == pChild33); + assertTrue (pChild41->nextSibling() == pChild42); + assertTrue (pChild42->previousSibling() == pChild41); + assertTrue (pChild42->nextSibling() == pChild43); + assertTrue (pChild43->previousSibling() == pChild42); + assertTrue (pChild43->nextSibling() == 0); } diff --git a/XML/testsuite/src/ParserWriterTest.cpp b/XML/testsuite/src/ParserWriterTest.cpp index 777c75882..3a6b5c265 100644 --- a/XML/testsuite/src/ParserWriterTest.cpp +++ b/XML/testsuite/src/ParserWriterTest.cpp @@ -51,7 +51,7 @@ void ParserWriterTest::testParseWriteXHTML() writer.writeNode(ostr, pDoc); std::string xml = ostr.str(); - assert (xml == XHTML); + assertTrue (xml == XHTML); } @@ -66,7 +66,7 @@ void ParserWriterTest::testParseWriteXHTML2() writer.writeNode(ostr, pDoc); std::string xml = ostr.str(); - assert (xml == XHTML2); + assertTrue (xml == XHTML2); } @@ -97,10 +97,10 @@ void ParserWriterTest::testParseWriteSimple() numChildren++; child = child->nextSibling(); } - assert (numChildren == 2); + assertTrue (numChildren == 2); std::string xml = ostr.str(); - assert (xml == simple); + assertTrue (xml == simple); } diff --git a/XML/testsuite/src/SAXParserTest.cpp b/XML/testsuite/src/SAXParserTest.cpp index 8ea3c8527..182bd4b80 100644 --- a/XML/testsuite/src/SAXParserTest.cpp +++ b/XML/testsuite/src/SAXParserTest.cpp @@ -76,7 +76,7 @@ void SAXParserTest::testSimple1() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, SIMPLE1); - assert (xml == ""); + assertTrue (xml == ""); } @@ -84,7 +84,7 @@ void SAXParserTest::testSimple2() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, SIMPLE2); - assert (xml == ""); + assertTrue (xml == ""); } @@ -92,7 +92,7 @@ void SAXParserTest::testAttributes() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, ATTRIBUTES); - assert (xml == ATTRIBUTES); + assertTrue (xml == ATTRIBUTES); } @@ -100,7 +100,7 @@ void SAXParserTest::testCDATA() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, CDATA); - assert (xml == CDATA); + assertTrue (xml == CDATA); } @@ -108,7 +108,7 @@ void SAXParserTest::testComment() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, COMMENT); - assert (xml == COMMENT); + assertTrue (xml == COMMENT); } @@ -116,7 +116,7 @@ void SAXParserTest::testPI() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, PROCESSING_INSTRUCTION); - assert (xml == PROCESSING_INSTRUCTION); + assertTrue (xml == PROCESSING_INSTRUCTION); } @@ -124,7 +124,7 @@ void SAXParserTest::testDTD() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, DTD); - assert (xml == ""); + assertTrue (xml == ""); } @@ -132,7 +132,7 @@ void SAXParserTest::testInternalEntity() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, INTERNAL_ENTITY); - assert (xml == "\n\tApplied Informatics\n"); + assertTrue (xml == "\n\tApplied Informatics\n"); } @@ -140,7 +140,7 @@ void SAXParserTest::testNotation() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, NOTATION); - assert (xml == "" + assertTrue (xml == "" "]>" ""); } @@ -150,7 +150,7 @@ void SAXParserTest::testExternalUnparsed() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, EXTERNAL_UNPARSED); - assert (xml == "" + assertTrue (xml == "" "]>" ""); } @@ -163,7 +163,7 @@ void SAXParserTest::testExternalParsed() parser.setEntityResolver(&resolver); parser.setFeature(XMLReader::FEATURE_EXTERNAL_GENERAL_ENTITIES, true); std::string xml = parse(parser, XMLWriter::CANONICAL, EXTERNAL_PARSED); - assert (xml == "\n\t\n\tAn external entity.\n\n\n"); + assertTrue (xml == "\n\t\n\tAn external entity.\n\n\n"); } @@ -171,7 +171,7 @@ void SAXParserTest::testDefaultNamespace() { SAXParser parser; std::string xml = parse(parser, XMLWriter::CANONICAL, DEFAULT_NAMESPACE); - assert (xml == DEFAULT_NAMESPACE); + assertTrue (xml == DEFAULT_NAMESPACE); } @@ -181,7 +181,7 @@ void SAXParserTest::testNamespaces() parser.setFeature(XMLReader::FEATURE_NAMESPACES, true); parser.setFeature(XMLReader::FEATURE_NAMESPACE_PREFIXES, true); std::string xml = parse(parser, XMLWriter::CANONICAL, NAMESPACES); - assert (xml == NAMESPACES); + assertTrue (xml == NAMESPACES); } @@ -191,7 +191,7 @@ void SAXParserTest::testNamespacesNoPrefixes() parser.setFeature(XMLReader::FEATURE_NAMESPACES, true); parser.setFeature(XMLReader::FEATURE_NAMESPACE_PREFIXES, false); std::string xml = parse(parser, XMLWriter::CANONICAL, NAMESPACES); - assert (xml == NAMESPACES); + assertTrue (xml == NAMESPACES); } @@ -200,7 +200,7 @@ void SAXParserTest::testNoNamespaces() SAXParser parser; parser.setFeature(XMLReader::FEATURE_NAMESPACES, false); std::string xml = parse(parser, XMLWriter::CANONICAL, NAMESPACES); - assert (xml == NAMESPACES); + assertTrue (xml == NAMESPACES); } @@ -241,7 +241,7 @@ void SAXParserTest::testUndeclaredNoNamespace() SAXParser parser; parser.setFeature(XMLReader::FEATURE_NAMESPACES, false); std::string xml = parse(parser, XMLWriter::CANONICAL, UNDECLARED_NAMESPACE); - assert (xml == UNDECLARED_NAMESPACE); + assertTrue (xml == UNDECLARED_NAMESPACE); } @@ -281,7 +281,7 @@ void SAXParserTest::testEncoding() parser.parse(&source); std::string xml = ostr.str(); - assert (xml == ENCODING); + assertTrue (xml == ENCODING); } @@ -291,7 +291,7 @@ void SAXParserTest::testCharacters() SAXParser parser; parser.setFeature(XMLReader::FEATURE_NAMESPACES, false); std::string result = parse(parser, XMLWriter::CANONICAL, xml); - assert (result == xml); + assertTrue (result == xml); } @@ -299,7 +299,7 @@ void SAXParserTest::testParseMemory() { SAXParser parser; std::string xml = parseMemory(parser, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT, WSDL); - assert (xml == WSDL); + assertTrue (xml == WSDL); } @@ -309,7 +309,7 @@ void SAXParserTest::testParsePartialReads() parser.setFeature("http://www.appinf.com/features/enable-partial-reads", true); std::string xml = parse(parser, XMLWriter::CANONICAL | XMLWriter::PRETTY_PRINT, WSDL); - assert (xml == WSDL); + assertTrue (xml == WSDL); } diff --git a/XML/testsuite/src/TextTest.cpp b/XML/testsuite/src/TextTest.cpp index 50baa6690..31fd815a3 100644 --- a/XML/testsuite/src/TextTest.cpp +++ b/XML/testsuite/src/TextTest.cpp @@ -40,9 +40,9 @@ void TextTest::testLength() { AutoPtr pDoc = new Document; AutoPtr pText1 = pDoc->createTextNode(""); - assert (pText1->length() == 0); + assertTrue (pText1->length() == 0); AutoPtr pText2 = pDoc->createTextNode("foo bar"); - assert (pText2->length() == 7); + assertTrue (pText2->length() == 7); } @@ -51,11 +51,11 @@ void TextTest::testSubstring() AutoPtr pDoc = new Document; AutoPtr pText1 = pDoc->createTextNode("foo bar"); XMLString str = pText1->substringData(0, 3); - assert (str == "foo"); + assertTrue (str == "foo"); str = pText1->substringData(4, 3); - assert (str == "bar"); + assertTrue (str == "bar"); str = pText1->substringData(3, 0); - assert (str == ""); + assertTrue (str == ""); } @@ -64,7 +64,7 @@ void TextTest::testAppend() AutoPtr pDoc = new Document; AutoPtr pText1 = pDoc->createTextNode("foo"); pText1->appendData("bar"); - assert (pText1->data() == "foobar"); + assertTrue (pText1->data() == "foobar"); } @@ -73,11 +73,11 @@ void TextTest::testInsert() AutoPtr pDoc = new Document; AutoPtr pText1 = pDoc->createTextNode("bar"); pText1->insertData(0, "foo"); - assert (pText1->data() == "foobar"); + assertTrue (pText1->data() == "foobar"); pText1->insertData(pText1->length(), "!"); - assert (pText1->data() == "foobar!"); + assertTrue (pText1->data() == "foobar!"); pText1->insertData(3, " "); - assert (pText1->data() == "foo bar!"); + assertTrue (pText1->data() == "foo bar!"); } @@ -86,13 +86,13 @@ void TextTest::testDelete() AutoPtr pDoc = new Document; AutoPtr pText1 = pDoc->createTextNode("foo bar"); pText1->deleteData(3, 1); - assert (pText1->data() == "foobar"); + assertTrue (pText1->data() == "foobar"); pText1->deleteData(0, 3); - assert (pText1->data() == "bar"); + assertTrue (pText1->data() == "bar"); pText1->deleteData(1, 0); - assert (pText1->data() == "bar"); + assertTrue (pText1->data() == "bar"); pText1->deleteData(0, pText1->length()); - assert (pText1->data() == ""); + assertTrue (pText1->data() == ""); } @@ -101,17 +101,17 @@ void TextTest::testReplace() AutoPtr pDoc = new Document; AutoPtr pText1 = pDoc->createTextNode("foo bar"); pText1->replaceData(0, 3, "FOO"); - assert (pText1->data() == "FOO bar"); + assertTrue (pText1->data() == "FOO bar"); pText1->replaceData(4, 3, "BAR!!!"); - assert (pText1->data() == "FOO BAR!!!"); + assertTrue (pText1->data() == "FOO BAR!!!"); pText1->replaceData(3, 1, "-"); - assert (pText1->data() == "FOO-BAR!!!"); + assertTrue (pText1->data() == "FOO-BAR!!!"); pText1->replaceData(3, 1, "---"); - assert (pText1->data() == "FOO---BAR!!!"); + assertTrue (pText1->data() == "FOO---BAR!!!"); pText1->replaceData(3, 3, " "); - assert (pText1->data() == "FOO BAR!!!"); + assertTrue (pText1->data() == "FOO BAR!!!"); pText1->replaceData(0, pText1->length(), "foo bar"); - assert (pText1->data() == "foo bar"); + assertTrue (pText1->data() == "foo bar"); } @@ -122,8 +122,8 @@ void TextTest::testSplit() AutoPtr pText1 = pDoc->createCDATASection("foobar"); pElem->appendChild(pText1); pText1->splitText(3); - assert (pElem->firstChild()->nodeValue() == "foo"); - assert (pElem->lastChild()->nodeValue() == "bar"); + assertTrue (pElem->firstChild()->nodeValue() == "foo"); + assertTrue (pElem->lastChild()->nodeValue() == "bar"); } @@ -134,8 +134,8 @@ void TextTest::testSplitCDATA() AutoPtr pText1 = pDoc->createTextNode("foobar"); pElem->appendChild(pText1); pText1->splitText(3); - assert (pElem->firstChild()->nodeValue() == "foo"); - assert (pElem->lastChild()->nodeValue() == "bar"); + assertTrue (pElem->firstChild()->nodeValue() == "foo"); + assertTrue (pElem->lastChild()->nodeValue() == "bar"); } diff --git a/XML/testsuite/src/TreeWalkerTest.cpp b/XML/testsuite/src/TreeWalkerTest.cpp index c973768dc..85c45dab5 100644 --- a/XML/testsuite/src/TreeWalkerTest.cpp +++ b/XML/testsuite/src/TreeWalkerTest.cpp @@ -82,37 +82,37 @@ void TreeWalkerTest::testShowAll() TreeWalker it(pRoot, NodeFilter::SHOW_ALL); - assert (it.currentNode() == pRoot); - assert (it.nextNode() == pElem1); - assert (it.nextNode() == pText1); - assert (it.nextNode() == pElem2); - assert (it.nextNode() == pText2); - assert (it.nextNode() == 0); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.nextNode() == pElem1); + assertTrue (it.nextNode() == pText1); + assertTrue (it.nextNode() == pElem2); + assertTrue (it.nextNode() == pText2); + assertTrue (it.nextNode() == 0); - assert (it.currentNode() == pText2); - assert (it.previousNode() == pElem2); - assert (it.previousNode() == pText1); - assert (it.previousNode() == pElem1); - assert (it.previousNode() == pRoot); - assert (it.previousNode() == 0); + assertTrue (it.currentNode() == pText2); + assertTrue (it.previousNode() == pElem2); + assertTrue (it.previousNode() == pText1); + assertTrue (it.previousNode() == pElem1); + assertTrue (it.previousNode() == pRoot); + assertTrue (it.previousNode() == 0); - assert (it.currentNode() == pRoot); - assert (it.parentNode() == 0); - assert (it.currentNode() == pRoot); - assert (it.firstChild() == pElem1); - assert (it.parentNode() == pRoot); - assert (it.lastChild() == pElem2); - assert (it.previousSibling() == pElem1); - assert (it.previousSibling() == 0); - assert (it.currentNode() == pElem1); - assert (it.nextSibling() == pElem2); - assert (it.nextSibling() == 0); - assert (it.currentNode() == pElem2); - assert (it.firstChild() == pText2); - assert (it.nextSibling() == 0); - assert (it.previousSibling() == 0); - assert (it.parentNode() == pElem2); - assert (it.lastChild() == pText2); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.parentNode() == 0); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.firstChild() == pElem1); + assertTrue (it.parentNode() == pRoot); + assertTrue (it.lastChild() == pElem2); + assertTrue (it.previousSibling() == pElem1); + assertTrue (it.previousSibling() == 0); + assertTrue (it.currentNode() == pElem1); + assertTrue (it.nextSibling() == pElem2); + assertTrue (it.nextSibling() == 0); + assertTrue (it.currentNode() == pElem2); + assertTrue (it.firstChild() == pText2); + assertTrue (it.nextSibling() == 0); + assertTrue (it.previousSibling() == 0); + assertTrue (it.parentNode() == pElem2); + assertTrue (it.lastChild() == pText2); } @@ -133,30 +133,30 @@ void TreeWalkerTest::testShowElements() TreeWalker it(pRoot, NodeFilter::SHOW_ELEMENT); - assert (it.currentNode() == pRoot); - assert (it.nextNode() == pElem1); - assert (it.nextNode() == pElem2); - assert (it.nextNode() == 0); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.nextNode() == pElem1); + assertTrue (it.nextNode() == pElem2); + assertTrue (it.nextNode() == 0); - assert (it.currentNode() == pElem2); - assert (it.previousNode() == pElem1); - assert (it.previousNode() == pRoot); - assert (it.previousNode() == 0); + assertTrue (it.currentNode() == pElem2); + assertTrue (it.previousNode() == pElem1); + assertTrue (it.previousNode() == pRoot); + assertTrue (it.previousNode() == 0); - assert (it.currentNode() == pRoot); - assert (it.parentNode() == 0); - assert (it.currentNode() == pRoot); - assert (it.firstChild() == pElem1); - assert (it.parentNode() == pRoot); - assert (it.lastChild() == pElem2); - assert (it.firstChild() == 0); - assert (it.currentNode() == pElem2); - assert (it.lastChild() == 0); - assert (it.currentNode() == pElem2); - assert (it.previousSibling() == pElem1); - assert (it.firstChild() == 0); - assert (it.lastChild() == 0); - assert (it.parentNode() == pRoot); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.parentNode() == 0); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.firstChild() == pElem1); + assertTrue (it.parentNode() == pRoot); + assertTrue (it.lastChild() == pElem2); + assertTrue (it.firstChild() == 0); + assertTrue (it.currentNode() == pElem2); + assertTrue (it.lastChild() == 0); + assertTrue (it.currentNode() == pElem2); + assertTrue (it.previousSibling() == pElem1); + assertTrue (it.firstChild() == 0); + assertTrue (it.lastChild() == 0); + assertTrue (it.parentNode() == pRoot); } @@ -178,80 +178,80 @@ void TreeWalkerTest::testFilter() SkipNodeFilter skipFilter; TreeWalker it1(pRoot, NodeFilter::SHOW_ELEMENT, &skipFilter); - assert (it1.nextNode() == pElem1); - assert (it1.nextNode() == 0); + assertTrue (it1.nextNode() == pElem1); + assertTrue (it1.nextNode() == 0); - assert (it1.currentNode() == pElem1); - assert (it1.previousNode() == 0); + assertTrue (it1.currentNode() == pElem1); + assertTrue (it1.previousNode() == 0); - assert (it1.parentNode() == 0); - assert (it1.firstChild() == 0); - assert (it1.lastChild() == 0); - assert (it1.nextSibling() == 0); - assert (it1.previousSibling() == 0); + assertTrue (it1.parentNode() == 0); + assertTrue (it1.firstChild() == 0); + assertTrue (it1.lastChild() == 0); + assertTrue (it1.nextSibling() == 0); + assertTrue (it1.previousSibling() == 0); TreeWalker it2(pRoot, NodeFilter::SHOW_ALL, &skipFilter); - assert (it2.nextNode() == pElem1); - assert (it2.nextNode() == pText1); - assert (it2.nextNode() == pText2); - assert (it2.nextNode() == 0); + assertTrue (it2.nextNode() == pElem1); + assertTrue (it2.nextNode() == pText1); + assertTrue (it2.nextNode() == pText2); + assertTrue (it2.nextNode() == 0); - assert (it2.currentNode() == pText2); - assert (it2.previousNode() == pText1); - assert (it2.previousNode() == pElem1); - assert (it2.previousNode() == 0); + assertTrue (it2.currentNode() == pText2); + assertTrue (it2.previousNode() == pText1); + assertTrue (it2.previousNode() == pElem1); + assertTrue (it2.previousNode() == 0); - assert (it2.currentNode() == pElem1); - assert (it2.parentNode() == 0); - assert (it2.nextSibling() == 0); - assert (it2.previousSibling() == 0); - assert (it2.firstChild() == pText1); - assert (it2.nextSibling() == 0); - assert (it2.previousSibling() == 0); - assert (it2.parentNode() == pElem1); + assertTrue (it2.currentNode() == pElem1); + assertTrue (it2.parentNode() == 0); + assertTrue (it2.nextSibling() == 0); + assertTrue (it2.previousSibling() == 0); + assertTrue (it2.firstChild() == pText1); + assertTrue (it2.nextSibling() == 0); + assertTrue (it2.previousSibling() == 0); + assertTrue (it2.parentNode() == pElem1); RejectNodeFilter rejectFilter; TreeWalker it3(pRoot, NodeFilter::SHOW_ELEMENT, &rejectFilter); - assert (it3.nextNode() == pElem1); - assert (it3.nextNode() == 0); + assertTrue (it3.nextNode() == pElem1); + assertTrue (it3.nextNode() == 0); - assert (it3.currentNode() == pElem1); - assert (it3.previousNode() == pRoot); - assert (it3.previousNode() == 0); + assertTrue (it3.currentNode() == pElem1); + assertTrue (it3.previousNode() == pRoot); + assertTrue (it3.previousNode() == 0); - assert (it3.currentNode() == pRoot); - assert (it3.parentNode() == 0); - assert (it3.firstChild() == pElem1); - assert (it3.nextSibling() == 0); - assert (it3.previousSibling() == 0); - assert (it3.parentNode() == pRoot); - assert (it3.lastChild() == pElem1); + assertTrue (it3.currentNode() == pRoot); + assertTrue (it3.parentNode() == 0); + assertTrue (it3.firstChild() == pElem1); + assertTrue (it3.nextSibling() == 0); + assertTrue (it3.previousSibling() == 0); + assertTrue (it3.parentNode() == pRoot); + assertTrue (it3.lastChild() == pElem1); TreeWalker it4(pRoot, NodeFilter::SHOW_ALL, &rejectFilter); - assert (it4.nextNode() == pElem1); - assert (it4.nextNode() == pText1); - assert (it4.nextNode() == 0); + assertTrue (it4.nextNode() == pElem1); + assertTrue (it4.nextNode() == pText1); + assertTrue (it4.nextNode() == 0); - assert (it4.currentNode() == pText1); - assert (it4.previousNode() == pElem1); - assert (it4.previousNode() == pRoot); - assert (it4.previousNode() == 0); + assertTrue (it4.currentNode() == pText1); + assertTrue (it4.previousNode() == pElem1); + assertTrue (it4.previousNode() == pRoot); + assertTrue (it4.previousNode() == 0); - assert (it4.currentNode() == pRoot); - assert (it4.parentNode() == 0); - assert (it4.firstChild() == pElem1); - assert (it4.firstChild() == pText1); - assert (it4.nextSibling() == 0); - assert (it4.previousSibling() == 0); - assert (it4.parentNode() == pElem1); - assert (it4.lastChild() == pText1); - assert (it4.parentNode() == pElem1); - assert (it4.nextSibling() == 0); - assert (it4.previousSibling() == 0); - assert (it4.parentNode() == pRoot); + assertTrue (it4.currentNode() == pRoot); + assertTrue (it4.parentNode() == 0); + assertTrue (it4.firstChild() == pElem1); + assertTrue (it4.firstChild() == pText1); + assertTrue (it4.nextSibling() == 0); + assertTrue (it4.previousSibling() == 0); + assertTrue (it4.parentNode() == pElem1); + assertTrue (it4.lastChild() == pText1); + assertTrue (it4.parentNode() == pElem1); + assertTrue (it4.nextSibling() == 0); + assertTrue (it4.previousSibling() == 0); + assertTrue (it4.parentNode() == pRoot); } @@ -272,15 +272,15 @@ void TreeWalkerTest::testShowNothing() TreeWalker it(pRoot, 0); - assert (it.nextNode() == 0); + assertTrue (it.nextNode() == 0); - assert (it.previousNode() == 0); + assertTrue (it.previousNode() == 0); - assert (it.currentNode() == pRoot); - assert (it.firstChild() == 0); - assert (it.lastChild() == 0); - assert (it.nextSibling() == 0); - assert (it.previousSibling() == 0); + assertTrue (it.currentNode() == pRoot); + assertTrue (it.firstChild() == 0); + assertTrue (it.lastChild() == 0); + assertTrue (it.nextSibling() == 0); + assertTrue (it.previousSibling() == 0); } diff --git a/XML/testsuite/src/XMLStreamParserTest.cpp b/XML/testsuite/src/XMLStreamParserTest.cpp index ab35dd2dc..0b8ac23ca 100644 --- a/XML/testsuite/src/XMLStreamParserTest.cpp +++ b/XML/testsuite/src/XMLStreamParserTest.cpp @@ -41,11 +41,11 @@ void XMLStreamParserTest::testParser() std::istringstream is("X"); XMLStreamParser p(is, "test"); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "X"); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "X"); p.next(); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -60,7 +60,7 @@ void XMLStreamParserTest::testParser() is.setstate(std::ios_base::badbit); p.next(); - assert(false); + assertTrue (false); } catch (const std::ios_base::failure&) { @@ -80,7 +80,7 @@ void XMLStreamParserTest::testParser() std::istringstream is(""); XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -92,7 +92,7 @@ void XMLStreamParserTest::testParser() std::istringstream is(""); XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root1"); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -132,7 +132,7 @@ void XMLStreamParserTest::testParser() XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root"); p.nextExpect(XMLStreamParser::EV_CHARACTERS); - assert(p.value() == 123); + assertTrue (p.value() == 123); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); } @@ -143,12 +143,12 @@ void XMLStreamParserTest::testParser() XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root"); - assert(p.attribute("a") == "a"); - assert(p.attribute("b", "B") == "b"); - assert(p.attribute("c", "C") == "C"); - assert(p.attribute("d") == 123); - assert(p.attribute("t") == true); - assert(p.attribute("f", false) == false); + assertTrue (p.attribute("a") == "a"); + assertTrue (p.attribute("b", "B") == "b"); + assertTrue (p.attribute("c", "C") == "C"); + assertTrue (p.attribute("d") == 123); + assertTrue (p.attribute("t") == true); + assertTrue (p.attribute("f", false) == false); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); } @@ -157,21 +157,21 @@ void XMLStreamParserTest::testParser() std::istringstream is(""); XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root"); - assert(p.attribute("a") == "a"); - assert(p.peek() == XMLStreamParser::EV_START_ELEMENT && p.localName() == "nested"); - assert(p.attribute("a") == "a"); + assertTrue (p.attribute("a") == "a"); + assertTrue (p.peek() == XMLStreamParser::EV_START_ELEMENT && p.localName() == "nested"); + assertTrue (p.attribute("a") == "a"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "nested"); - assert(p.attribute("a") == "A"); + assertTrue (p.attribute("a") == "A"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "inner"); - assert(p.attribute("a", "") == ""); + assertTrue (p.attribute("a", "") == ""); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); - assert(p.attribute("a") == "A"); - assert(p.peek() == XMLStreamParser::EV_END_ELEMENT); - assert(p.attribute("a") == "A"); // Still valid. + assertTrue (p.attribute("a") == "A"); + assertTrue (p.peek() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.attribute("a") == "A"); // Still valid. p.nextExpect(XMLStreamParser::EV_END_ELEMENT); - assert(p.attribute("a") == "a"); + assertTrue (p.attribute("a") == "a"); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); - assert(p.attribute("a", "") == ""); + assertTrue (p.attribute("a", "") == ""); } try @@ -179,9 +179,9 @@ void XMLStreamParserTest::testParser() std::istringstream is(""); XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root"); - assert(p.attribute("a") == "a"); + assertTrue (p.attribute("a") == "a"); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -194,7 +194,7 @@ void XMLStreamParserTest::testParser() XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root"); p.attribute("a"); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -207,43 +207,43 @@ void XMLStreamParserTest::testParser() std::istringstream is("x"); XMLStreamParser p(is, "peek", XMLStreamParser::RECEIVE_DEFAULT | XMLStreamParser::RECEIVE_ATTRIBUTES_EVENT); - assert(p.event() == XMLStreamParser::EV_EOF); + assertTrue (p.event() == XMLStreamParser::EV_EOF); - assert(p.peek() == XMLStreamParser::EV_START_ELEMENT); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); - assert(p.event() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.peek() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.event() == XMLStreamParser::EV_START_ELEMENT); - assert(p.peek() == XMLStreamParser::EV_START_ATTRIBUTE); - assert(p.event() == XMLStreamParser::EV_START_ATTRIBUTE); - assert(p.next() == XMLStreamParser::EV_START_ATTRIBUTE); + assertTrue (p.peek() == XMLStreamParser::EV_START_ATTRIBUTE); + assertTrue (p.event() == XMLStreamParser::EV_START_ATTRIBUTE); + assertTrue (p.next() == XMLStreamParser::EV_START_ATTRIBUTE); - assert(p.peek() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); - assert(p.event() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); + assertTrue (p.peek() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); + assertTrue (p.event() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); - assert(p.peek() == XMLStreamParser::EV_END_ATTRIBUTE); - assert(p.event() == XMLStreamParser::EV_END_ATTRIBUTE); - assert(p.next() == XMLStreamParser::EV_END_ATTRIBUTE); + assertTrue (p.peek() == XMLStreamParser::EV_END_ATTRIBUTE); + assertTrue (p.event() == XMLStreamParser::EV_END_ATTRIBUTE); + assertTrue (p.next() == XMLStreamParser::EV_END_ATTRIBUTE); - assert(p.peek() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); - assert(p.event() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); + assertTrue (p.peek() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); + assertTrue (p.event() == XMLStreamParser::EV_CHARACTERS && p.value() == "x"); - assert(p.peek() == XMLStreamParser::EV_START_ELEMENT); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); - assert(p.event() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.peek() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.event() == XMLStreamParser::EV_START_ELEMENT); - assert(p.peek() == XMLStreamParser::EV_END_ELEMENT); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); - assert(p.event() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.peek() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.event() == XMLStreamParser::EV_END_ELEMENT); - assert(p.peek() == XMLStreamParser::EV_END_ELEMENT); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); - assert(p.event() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.peek() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.event() == XMLStreamParser::EV_END_ELEMENT); - assert(p.peek() == XMLStreamParser::EV_EOF); - assert(p.next() == XMLStreamParser::EV_EOF); - assert(p.event() == XMLStreamParser::EV_EOF); + assertTrue (p.peek() == XMLStreamParser::EV_EOF); + assertTrue (p.next() == XMLStreamParser::EV_EOF); + assertTrue (p.event() == XMLStreamParser::EV_EOF); } // Test content processing. @@ -255,13 +255,13 @@ void XMLStreamParserTest::testParser() std::istringstream is(" \n\t "); XMLStreamParser p(is, "empty", XMLStreamParser::RECEIVE_DEFAULT | XMLStreamParser::RECEIVE_ATTRIBUTES_EVENT); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.content(Content::Empty); - assert(p.next() == XMLStreamParser::EV_START_ATTRIBUTE); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " x "); - assert(p.next() == XMLStreamParser::EV_END_ATTRIBUTE); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); - assert(p.next() == XMLStreamParser::EV_EOF); + assertTrue (p.next() == XMLStreamParser::EV_START_ATTRIBUTE); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " x "); + assertTrue (p.next() == XMLStreamParser::EV_END_ATTRIBUTE); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_EOF); } try @@ -269,10 +269,10 @@ void XMLStreamParserTest::testParser() std::istringstream is(" \n & X \t "); XMLStreamParser p(is, "empty"); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.content(Content::Empty); p.next(); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -285,11 +285,11 @@ void XMLStreamParserTest::testParser() std::istringstream is(" X "); XMLStreamParser p(is, "simple"); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.content(Content::Simple); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " X "); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); - assert(p.next() == XMLStreamParser::EV_EOF); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " X "); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_EOF); } try @@ -297,11 +297,11 @@ void XMLStreamParserTest::testParser() std::istringstream is(" ? "); XMLStreamParser p(is, "simple"); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.content(Content::Simple); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " ? "); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " ? "); p.next(); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -314,13 +314,13 @@ void XMLStreamParserTest::testParser() std::istringstream is("123"); XMLStreamParser p(is, "simple", XMLStreamParser::RECEIVE_DEFAULT | XMLStreamParser::RECEIVE_NAMESPACE_DECLS); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.nextExpect(XMLStreamParser::EV_START_NAMESPACE_DECL); p.content(Content::Simple); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "123"); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == "123"); p.nextExpect(XMLStreamParser::EV_END_NAMESPACE_DECL); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); - assert(p.next() == XMLStreamParser::EV_EOF); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_EOF); } try @@ -330,11 +330,11 @@ void XMLStreamParserTest::testParser() std::istringstream is("123"); XMLStreamParser p(is, "simple", XMLStreamParser::RECEIVE_DEFAULT | XMLStreamParser::RECEIVE_NAMESPACE_DECLS); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.nextExpect(XMLStreamParser::EV_START_NAMESPACE_DECL); p.content(Content::Simple); p.next(); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -352,28 +352,28 @@ void XMLStreamParserTest::testParser() "\n"); XMLStreamParser p(is, "complex", XMLStreamParser::RECEIVE_DEFAULT | XMLStreamParser::RECEIVE_ATTRIBUTES_EVENT); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); // root + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); // root p.content(Content::Complex); - assert(p.next() == XMLStreamParser::EV_START_ATTRIBUTE); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " x "); - assert(p.next() == XMLStreamParser::EV_END_ATTRIBUTE); + assertTrue (p.next() == XMLStreamParser::EV_START_ATTRIBUTE); + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " x "); + assertTrue (p.next() == XMLStreamParser::EV_END_ATTRIBUTE); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); // nested + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); // nested p.content(Content::Complex); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); // inner + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); // inner p.content(Content::Empty); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); // inner + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); // inner - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); // inner + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); // inner p.content(Content::Simple); - assert(p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " X "); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); // inner + assertTrue (p.next() == XMLStreamParser::EV_CHARACTERS && p.value() == " X "); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); // inner - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); // nested - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); // root - assert(p.next() == XMLStreamParser::EV_EOF); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); // nested + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); // root + assertTrue (p.next() == XMLStreamParser::EV_EOF); } try @@ -381,12 +381,12 @@ void XMLStreamParserTest::testParser() std::istringstream is(" \n X X "); XMLStreamParser p(is, "complex"); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); p.content(Content::Complex); - assert(p.next() == XMLStreamParser::EV_START_ELEMENT); - assert(p.next() == XMLStreamParser::EV_END_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_START_ELEMENT); + assertTrue (p.next() == XMLStreamParser::EV_END_ELEMENT); p.next(); - assert(false); + assertTrue (false); } catch (const Poco::Exception&) { @@ -418,31 +418,31 @@ void XMLStreamParserTest::testParser() p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root", Content::Complex); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "nested"); - assert(p.element() == "X"); + assertTrue (p.element() == "X"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "nested"); - assert(p.element() == ""); + assertTrue (p.element() == ""); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "nested"); - assert(p.element() == 123); + assertTrue (p.element() == 123); - assert(p.element("nested") == "Y"); - assert(p.element(QName("test", "nested")) == "Z"); + assertTrue (p.element("nested") == "Y"); + assertTrue (p.element(QName("test", "nested")) == "Z"); - assert(p.element("nested") == 234); - assert(p.element(QName("test", "nested")) == 345); + assertTrue (p.element("nested") == 234); + assertTrue (p.element(QName("test", "nested")) == 345); - assert(p.element("nested", "a") == "A"); - assert(p.element(QName("test", "nested"), "b") == "B"); + assertTrue (p.element("nested", "a") == "A"); + assertTrue (p.element(QName("test", "nested"), "b") == "B"); - assert(p.element("nested", "a") == "a" && p.element("nested1") == "A"); - assert(p.element(QName("test", "nested"), "b") == "b" && p.element(QName("test", "nested1")) == "B"); + assertTrue (p.element("nested", "a") == "a" && p.element("nested1") == "A"); + assertTrue (p.element(QName("test", "nested"), "b") == "b" && p.element(QName("test", "nested1")) == "B"); - assert(p.element("nested", 10) == 1); - assert(p.element(QName("test", "nested"), 20) == 2); + assertTrue (p.element("nested", 10) == 1); + assertTrue (p.element(QName("test", "nested"), 20) == 2); - assert(p.element("nested", 10) == 10 && p.element("nested1") == 1); - assert(p.element(QName("test", "nested"), 20) == 20 && p.element(QName("test", "nested1")) == 2); + assertTrue (p.element("nested", 10) == 10 && p.element("nested1") == 1); + assertTrue (p.element(QName("test", "nested"), 20) == 20 && p.element(QName("test", "nested1")) == 2); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); } @@ -461,12 +461,12 @@ void XMLStreamParserTest::testParser() //for (XMLStreamParser::EventType e: p) // v.push_back (e); - assert(v.size() == 5); - assert(v[0] == XMLStreamParser::EV_START_ELEMENT); - assert(v[1] == XMLStreamParser::EV_START_ELEMENT); - assert(v[2] == XMLStreamParser::EV_CHARACTERS); - assert(v[3] == XMLStreamParser::EV_END_ELEMENT); - assert(v[4] == XMLStreamParser::EV_END_ELEMENT); + assertTrue (v.size() == 5); + assertTrue (v[0] == XMLStreamParser::EV_START_ELEMENT); + assertTrue (v[1] == XMLStreamParser::EV_START_ELEMENT); + assertTrue (v[2] == XMLStreamParser::EV_CHARACTERS); + assertTrue (v[3] == XMLStreamParser::EV_END_ELEMENT); + assertTrue (v[4] == XMLStreamParser::EV_END_ELEMENT); } // Test space extraction into the std::string value. @@ -475,9 +475,9 @@ void XMLStreamParserTest::testParser() std::istringstream is(" b "); XMLStreamParser p(is, "test"); p.nextExpect(XMLStreamParser::EV_START_ELEMENT, "root"); - assert(p.attribute("a") == " a "); + assertTrue (p.attribute("a") == " a "); p.nextExpect(XMLStreamParser::EV_CHARACTERS); - assert(p.value() == " b "); + assertTrue (p.value() == " b "); p.nextExpect(XMLStreamParser::EV_END_ELEMENT); } } diff --git a/XML/testsuite/src/XMLWriterTest.cpp b/XML/testsuite/src/XMLWriterTest.cpp index 8e8499d6c..77898a1ee 100644 --- a/XML/testsuite/src/XMLWriterTest.cpp +++ b/XML/testsuite/src/XMLWriterTest.cpp @@ -40,7 +40,7 @@ void XMLWriterTest::testTrivial() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -53,7 +53,7 @@ void XMLWriterTest::testTrivialCanonical() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -66,7 +66,7 @@ void XMLWriterTest::testTrivialDecl() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -80,7 +80,7 @@ void XMLWriterTest::testTrivialDeclPretty() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n\n"); + assertTrue (xml == "\n\n"); } @@ -93,7 +93,7 @@ void XMLWriterTest::testTrivialFragment() writer.endElement("", "", "foo"); writer.endFragment(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -107,7 +107,7 @@ void XMLWriterTest::testTrivialFragmentPretty() writer.endElement("", "", "foo"); writer.endFragment(); std::string xml = str.str(); - assert (xml == "\n"); + assertTrue (xml == "\n"); } @@ -123,7 +123,7 @@ void XMLWriterTest::testDTDPretty() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n" + assertTrue (xml == "\n" "\n" "\n"); } @@ -141,7 +141,7 @@ void XMLWriterTest::testDTD() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "" + assertTrue (xml == "" "" ""); } @@ -159,7 +159,7 @@ void XMLWriterTest::testDTDPublic() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "" + assertTrue (xml == "" "" ""); } @@ -181,7 +181,7 @@ void XMLWriterTest::testDTDNotation() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n" + assertTrue (xml == "\n" "\n" "\t\n" @@ -206,7 +206,7 @@ void XMLWriterTest::testDTDEntity() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n" + assertTrue (xml == "\n" "\n" "\t\n" @@ -227,7 +227,7 @@ void XMLWriterTest::testAttributes() writer.endElement("", "", "el"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -244,7 +244,7 @@ void XMLWriterTest::testAttributesPretty() writer.endElement("", "", "el"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n"); + assertTrue (xml == "\n"); } @@ -256,7 +256,7 @@ void XMLWriterTest::testData() writer.dataElement("", "", "d", "data", "a1", "v1", "a2", "v2", "a3", "v3"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -268,7 +268,7 @@ void XMLWriterTest::testEmptyData() writer.dataElement("", "", "d", "", "a1", "v1", "a2", "v2", "a3", "v3"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -283,7 +283,7 @@ void XMLWriterTest::testDataPretty() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n\tdata\n\n"); + assertTrue (xml == "\n\tdata\n\n"); } @@ -298,7 +298,7 @@ void XMLWriterTest::testEmptyDataPretty() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n\t\n\n"); + assertTrue (xml == "\n\t\n\n"); } @@ -315,7 +315,7 @@ void XMLWriterTest::testComment() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n\n\t\n\tdata\n\n"); + assertTrue (xml == "\n\n\t\n\tdata\n\n"); } @@ -332,7 +332,7 @@ void XMLWriterTest::testPI() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "\n\n\t\n\tdata\n\n"); + assertTrue (xml == "\n\n\t\n\tdata\n\n"); } @@ -346,7 +346,7 @@ void XMLWriterTest::testCharacters() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "some "chars" that <must> be & escaped"); + assertTrue (xml == "some "chars" that <must> be & escaped"); } @@ -360,7 +360,7 @@ void XMLWriterTest::testEmptyCharacters() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -376,7 +376,7 @@ void XMLWriterTest::testCDATA() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == " be & escaped]]>"); + assertTrue (xml == " be & escaped]]>"); } @@ -392,7 +392,7 @@ void XMLWriterTest::testRawCharacters() writer.endElement("", "", "r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == " be & escaped]]>"); + assertTrue (xml == " be & escaped]]>"); } @@ -408,7 +408,7 @@ void XMLWriterTest::testAttributeCharacters() writer.endElement("", "", "el"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -424,7 +424,7 @@ void XMLWriterTest::testDefaultNamespace() writer.endPrefixMapping(""); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -438,7 +438,7 @@ void XMLWriterTest::testQNamespaces() writer.endElement("urn:ns", "r", "p:r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -453,7 +453,7 @@ void XMLWriterTest::testQNamespacesNested() writer.endElement("urn:ns", "r", "p:r"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -467,7 +467,7 @@ void XMLWriterTest::testNamespaces() writer.endElement("urn:ns", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -481,7 +481,7 @@ void XMLWriterTest::testNamespacesCanonical() writer.endElement("urn:ns", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -498,7 +498,7 @@ void XMLWriterTest::testAttributeNamespaces() writer.endElement("urn:ns", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -515,7 +515,7 @@ void XMLWriterTest::testAttributeNamespacesCanonical() writer.endElement("urn:ns", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == "data"); + assertTrue (xml == "data"); } @@ -532,7 +532,7 @@ void XMLWriterTest::testNamespacesNested() writer.endElement("urn:ns1", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -551,7 +551,7 @@ void XMLWriterTest::testNamespacesNestedCanonical() writer.endElement("urn:ns1", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -573,7 +573,7 @@ void XMLWriterTest::testExplicitNamespaces() writer.endElement("urn:ns1", "r", ""); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } @@ -642,7 +642,7 @@ void XMLWriterTest::testEmpty() writer.endElement("", "", "foo"); writer.endDocument(); std::string xml = str.str(); - assert (xml == ""); + assertTrue (xml == ""); } diff --git a/Zip/testsuite/src/CompressTest.cpp b/Zip/testsuite/src/CompressTest.cpp index 81ab8dabf..eff1791db 100644 --- a/Zip/testsuite/src/CompressTest.cpp +++ b/Zip/testsuite/src/CompressTest.cpp @@ -82,7 +82,7 @@ void CompressTest::testManipulator() zm.renameFile("test.zip", "renamedtest.zip"); zm.addFile("doc/othertest.zip", ZipTest::getTestFile("data", "test.zip")); ZipArchive archive=zm.commit(); - assert (archive.findHeader("doc/othertest.zip") != archive.headerEnd()); + assertTrue (archive.findHeader("doc/othertest.zip") != archive.headerEnd()); } @@ -99,8 +99,8 @@ void CompressTest::testManipulatorDel() zm.deleteFile("test.zip"); zm.addFile("doc/data.zip", ZipTest::getTestFile("data", "data.zip")); ZipArchive archive=zm.commit(); - assert (archive.findHeader("test.zip") == archive.headerEnd()); - assert (archive.findHeader("doc/data.zip") != archive.headerEnd()); + assertTrue (archive.findHeader("test.zip") == archive.headerEnd()); + assertTrue (archive.findHeader("doc/data.zip") != archive.headerEnd()); } @@ -117,8 +117,8 @@ void CompressTest::testManipulatorReplace() zm.replaceFile("test.zip", ZipTest::getTestFile("data", "doc.zip")); ZipArchive archive=zm.commit(); - assert (archive.findHeader("test.zip") != archive.headerEnd()); - assert (archive.findHeader("doc.zip") == archive.headerEnd()); + assertTrue (archive.findHeader("test.zip") != archive.headerEnd()); + assertTrue (archive.findHeader("doc.zip") == archive.headerEnd()); } @@ -131,26 +131,26 @@ void CompressTest::testSetZipComment() c.addFile(theFile, theFile.getFileName()); c.setZipComment(comment); ZipArchive a(c.close()); - assert(a.getZipComment() == comment); + assertTrue (a.getZipComment() == comment); } void CompressTest::createDataFile(const std::string& path, Poco::UInt64 size) { Poco::FileOutputStream out(path.c_str(), std::ios::trunc); - assert( ! out.fail() ); + assertTrue ( ! out.fail() ); Poco::Buffer buffer(MB); for(int i = 0; size != 0; i++) { std::memset(buffer.begin(), i, buffer.size()); Poco::UInt64 bytesToWrite = std::min(size, static_cast(buffer.size())); out.write(buffer.begin(), bytesToWrite); - assert( ! out.fail() ); + assertTrue ( ! out.fail() ); size -= bytesToWrite; } out.flush(); - assert( ! out.fail() ); + assertTrue ( ! out.fail() ); out.close(); - assert( ! out.fail() ); + assertTrue ( ! out.fail() ); } @@ -182,10 +182,10 @@ void CompressTest::testZip64() const std::string& path = it->first; Poco::UInt64 size = it->second; ZipArchive::FileHeaders::const_iterator it2 = a.findHeader(path); - assert (it2 != a.headerEnd()); + assertTrue (it2 != a.headerEnd()); const Poco::Zip::ZipLocalFileHeader& file = it2->second; - assert(file.getUncompressedSize() == size); - assert(file.getCompressedSize() == size); + assertTrue (file.getUncompressedSize() == size); + assertTrue (file.getCompressedSize() == size); } for (FileMap::const_iterator it = files.begin(); it != files.end(); it++) { diff --git a/Zip/testsuite/src/PartialStreamTest.cpp b/Zip/testsuite/src/PartialStreamTest.cpp index 76c276507..79ef176d6 100644 --- a/Zip/testsuite/src/PartialStreamTest.cpp +++ b/Zip/testsuite/src/PartialStreamTest.cpp @@ -43,7 +43,7 @@ void PartialStreamTest::testReading() char buf[124]; in.read(buf, 124); std::string res(buf, static_cast(in.gcount())); - assert (res == result); + assertTrue (res == result); } @@ -56,11 +56,11 @@ void PartialStreamTest::testWriting() std::ostringstream ostr; PartialOutputStream out(ostr, prefix.size(), postfix.size()); out.write(result.c_str(), static_cast(result.length())); - assert (out.good()); + assertTrue (out.good()); out.close(); std::string res (ostr.str()); - assert (out.bytesWritten() == message.size()); - assert (message == res); + assertTrue (out.bytesWritten() == message.size()); + assertTrue (message == res); } @@ -73,11 +73,11 @@ void PartialStreamTest::testWritingZero() std::ostringstream ostr; PartialOutputStream out(ostr, prefix.size(), postfix.size()); out.write(result.c_str(), static_cast(result.length())); - assert (out.good()); + assertTrue (out.good()); out.close(); std::string res (ostr.str()); - assert (out.bytesWritten() == message.size()); - assert (message == res); + assertTrue (out.bytesWritten() == message.size()); + assertTrue (message == res); } @@ -90,11 +90,11 @@ void PartialStreamTest::testWritingOne() std::ostringstream ostr; PartialOutputStream out(ostr, prefix.size(), postfix.size()); out.write(result.c_str(), static_cast(result.length())); - assert (out.good()); + assertTrue (out.good()); out.close(); std::string res (ostr.str()); - assert (out.bytesWritten() == message.size()); - assert (message == res); + assertTrue (out.bytesWritten() == message.size()); + assertTrue (message == res); } @@ -119,7 +119,7 @@ void PartialStreamTest::testAutoDetect() AutoDetectInputStream adi(istr, header, crc, false, 0); std::string result; Poco::StreamCopier::copyToString(adi, result); - assert (result.size() == 23); + assertTrue (result.size() == 23); } diff --git a/Zip/testsuite/src/ZipTest.cpp b/Zip/testsuite/src/ZipTest.cpp index 5d85c714e..aa72a7fb3 100644 --- a/Zip/testsuite/src/ZipTest.cpp +++ b/Zip/testsuite/src/ZipTest.cpp @@ -48,17 +48,17 @@ void ZipTest::testSkipSingleFile() { std::string testFile = getTestFile("data", "test.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); SkipCallback skip; ZipLocalFileHeader hdr(inp, false, skip); - assert (ZipCommon::HS_FAT == hdr.getHostSystem()); + assertTrue (ZipCommon::HS_FAT == hdr.getHostSystem()); int major = hdr.getMajorVersionNumber(); int POCO_UNUSED minor = hdr.getMinorVersionNumber(); - assert (major <= 2); + assertTrue (major <= 2); std::size_t hdrSize = hdr.getHeaderSize(); - assert (hdrSize > 30); + assertTrue (hdrSize > 30); ZipCommon::CompressionMethod POCO_UNUSED cm = hdr.getCompressionMethod(); - assert (!hdr.isEncrypted()); + assertTrue (!hdr.isEncrypted()); Poco::DateTime aDate = hdr.lastModifiedAt(); Poco::UInt64 POCO_UNUSED cS = hdr.getCompressedSize(); Poco::UInt64 POCO_UNUSED uS = hdr.getUncompressedSize(); @@ -70,14 +70,14 @@ void ZipTest::testDecompressSingleFile() { std::string testFile = getTestFile("data", "test.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); ZipArchive arch(inp); ZipArchive::FileHeaders::const_iterator it = arch.findHeader("testfile.txt"); - assert (it != arch.headerEnd()); + assertTrue (it != arch.headerEnd()); ZipInputStream zipin (inp, it->second); std::ostringstream out(std::ios::binary); Poco::StreamCopier::copyStream(zipin, out); - assert(!out.str().empty()); + assertTrue (!out.str().empty()); } @@ -85,14 +85,14 @@ void ZipTest::testDecompressSingleFileInDir() { std::string testFile = getTestFile("data","test.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); ZipArchive arch(inp); ZipArchive::FileHeaders::const_iterator it = arch.findHeader("testdir/testfile.txt"); - assert (it != arch.headerEnd()); + assertTrue (it != arch.headerEnd()); ZipInputStream zipin (inp, it->second); std::ostringstream out(std::ios::binary); Poco::StreamCopier::copyStream(zipin, out); - assert(!out.str().empty()); + assertTrue (!out.str().empty()); } @@ -100,13 +100,13 @@ void ZipTest::testCrcAndSizeAfterData() { std::string testFile = getTestFile("data", "data.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); Decompress dec(inp, Poco::Path::temp()); dec.EError += Poco::Delegate >(this, &ZipTest::onDecompressError); dec.decompressAllFiles(); dec.EError -= Poco::Delegate >(this, &ZipTest::onDecompressError); - assert (_errCnt == 0); - assert (!dec.mapping().empty()); + assertTrue (_errCnt == 0); + assertTrue (!dec.mapping().empty()); } @@ -114,7 +114,7 @@ void ZipTest::testCrcAndSizeAfterDataWithArchive() { std::string testFile = getTestFile("data", "data.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); Poco::Zip::ZipArchive zip(inp); inp.clear(); inp.seekg(0); @@ -161,13 +161,13 @@ void ZipTest::testDecompress() { std::string testFile = getTestFile("data", "test.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); Decompress dec(inp, Poco::Path::temp()); dec.EError += Poco::Delegate >(this, &ZipTest::onDecompressError); dec.decompressAllFiles(); dec.EError -= Poco::Delegate >(this, &ZipTest::onDecompressError); - assert (_errCnt == 0); - assert (!dec.mapping().empty()); + assertTrue (_errCnt == 0); + assertTrue (!dec.mapping().empty()); } @@ -175,13 +175,13 @@ void ZipTest::testDecompressFlat() { std::string testFile = getTestFile("data", "test.zip"); Poco::FileInputStream inp(testFile); - assert (inp.good()); + assertTrue (inp.good()); Decompress dec(inp, Poco::Path::temp(), true); dec.EError += Poco::Delegate >(this, &ZipTest::onDecompressError); dec.decompressAllFiles(); dec.EError -= Poco::Delegate >(this, &ZipTest::onDecompressError); - assert (_errCnt == 0); - assert (!dec.mapping().empty()); + assertTrue (_errCnt == 0); + assertTrue (!dec.mapping().empty()); } @@ -189,13 +189,13 @@ void ZipTest::testDecompressVuln() { std::string testFile = getTestFile("data", "vuln.zip"); Poco::FileInputStream inp(testFile); - assert(inp.good()); + assertTrue (inp.good()); Decompress dec(inp, Poco::Path::temp()); dec.EError += Poco::Delegate >(this, &ZipTest::onDecompressError); dec.decompressAllFiles(); dec.EError -= Poco::Delegate >(this, &ZipTest::onDecompressError); - assert (_errCnt == 1); - assert (dec.mapping().empty()); + assertTrue (_errCnt == 1); + assertTrue (dec.mapping().empty()); } @@ -203,20 +203,20 @@ void ZipTest::testDecompressFlatVuln() { std::string testFile = getTestFile("data", "vuln.zip"); Poco::FileInputStream inp(testFile); - assert(inp.good()); + assertTrue (inp.good()); Decompress dec(inp, Poco::Path::temp(), true); dec.EError += Poco::Delegate >(this, &ZipTest::onDecompressError); dec.decompressAllFiles(); dec.EError -= Poco::Delegate >(this, &ZipTest::onDecompressError); - assert (_errCnt == 0); - assert (!dec.mapping().empty()); + assertTrue (_errCnt == 0); + assertTrue (!dec.mapping().empty()); } void ZipTest::verifyDataFile(const std::string& path, Poco::UInt64 size) { Poco::FileInputStream in(path); - assert( ! in.fail() ); + assertTrue ( ! in.fail() ); Poco::Buffer buffer1(MB); Poco::Buffer buffer2(MB); for (int i = 0; size != 0; i++) @@ -225,13 +225,13 @@ void ZipTest::verifyDataFile(const std::string& path, Poco::UInt64 size) std::memset(buffer2.begin(), 0, buffer2.size()); Poco::UInt64 bytesToRead = std::min(size, static_cast(buffer2.size())); in.read(buffer2.begin(), bytesToRead); - assert (!in.fail() ); - assert (std::memcmp(buffer1.begin(), buffer2.begin(), static_cast(bytesToRead)) == 0); + assertTrue (!in.fail() ); + assertTrue (std::memcmp(buffer1.begin(), buffer2.begin(), static_cast(bytesToRead)) == 0); size -= bytesToRead; } char c; in.read(&c, 1); - assert ( in.eof() ); + assertTrue ( in.eof() ); } @@ -260,38 +260,38 @@ void ZipTest::testDecompressZip64() void ZipTest::testValidPath() { - assert (ZipCommon::isValidPath(".")); - assert (ZipCommon::isValidPath("file.txt")); - assert (ZipCommon::isValidPath(".file.txt")); - assert (ZipCommon::isValidPath("..file.txt")); - assert (ZipCommon::isValidPath("file.txt..")); - assert (ZipCommon::isValidPath(".file..txt")); - assert (ZipCommon::isValidPath("~file..txt")); - assert (ZipCommon::isValidPath("~file/~")); - assert (ZipCommon::isValidPath("dir/~")); - assert (ZipCommon::isValidPath("some")); - assert (ZipCommon::isValidPath("some/dir")); - assert (ZipCommon::isValidPath("some/dir/or/another")); - assert (ZipCommon::isValidPath("some/dir/./another")); - assert (ZipCommon::isValidPath("some/dir/or/another/file.txt")); - assert (ZipCommon::isValidPath("s~me\\d.r\\.or..\\an..her\\file.txt")); - assert (ZipCommon::isValidPath("some\\dir\\or\\another")); - assert (ZipCommon::isValidPath("some\\dir\\or\\another\\file.txt")); - assert (ZipCommon::isValidPath("s~me\\d.r/.or..\\an..her\\file.txt")); + assertTrue (ZipCommon::isValidPath(".")); + assertTrue (ZipCommon::isValidPath("file.txt")); + assertTrue (ZipCommon::isValidPath(".file.txt")); + assertTrue (ZipCommon::isValidPath("..file.txt")); + assertTrue (ZipCommon::isValidPath("file.txt..")); + assertTrue (ZipCommon::isValidPath(".file..txt")); + assertTrue (ZipCommon::isValidPath("~file..txt")); + assertTrue (ZipCommon::isValidPath("~file/~")); + assertTrue (ZipCommon::isValidPath("dir/~")); + assertTrue (ZipCommon::isValidPath("some")); + assertTrue (ZipCommon::isValidPath("some/dir")); + assertTrue (ZipCommon::isValidPath("some/dir/or/another")); + assertTrue (ZipCommon::isValidPath("some/dir/./another")); + assertTrue (ZipCommon::isValidPath("some/dir/or/another/file.txt")); + assertTrue (ZipCommon::isValidPath("s~me\\d.r\\.or..\\an..her\\file.txt")); + assertTrue (ZipCommon::isValidPath("some\\dir\\or\\another")); + assertTrue (ZipCommon::isValidPath("some\\dir\\or\\another\\file.txt")); + assertTrue (ZipCommon::isValidPath("s~me\\d.r/.or..\\an..her\\file.txt")); - assert (!ZipCommon::isValidPath("/../")); - assert (!ZipCommon::isValidPath("/")); - assert (!ZipCommon::isValidPath("\\..\\")); - assert (!ZipCommon::isValidPath("/..\\")); - assert (!ZipCommon::isValidPath("\\../")); - assert (!ZipCommon::isValidPath("..")); - assert (!ZipCommon::isValidPath("~/")); - assert (!ZipCommon::isValidPath("~/~")); - assert (!ZipCommon::isValidPath("/~")); - assert (!ZipCommon::isValidPath("/file.txt")); - assert (!ZipCommon::isValidPath("~/file.txt")); - assert (!ZipCommon::isValidPath("some/dir/or/../another/file.txt")); - assert (!ZipCommon::isValidPath("C:\\Windows\\system32")); + assertTrue (!ZipCommon::isValidPath("/../")); + assertTrue (!ZipCommon::isValidPath("/")); + assertTrue (!ZipCommon::isValidPath("\\..\\")); + assertTrue (!ZipCommon::isValidPath("/..\\")); + assertTrue (!ZipCommon::isValidPath("\\../")); + assertTrue (!ZipCommon::isValidPath("..")); + assertTrue (!ZipCommon::isValidPath("~/")); + assertTrue (!ZipCommon::isValidPath("~/~")); + assertTrue (!ZipCommon::isValidPath("/~")); + assertTrue (!ZipCommon::isValidPath("/file.txt")); + assertTrue (!ZipCommon::isValidPath("~/file.txt")); + assertTrue (!ZipCommon::isValidPath("some/dir/or/../another/file.txt")); + assertTrue (!ZipCommon::isValidPath("C:\\Windows\\system32")); }