aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/misc/importanceHelperTest.cpp8
-rw-r--r--tests/net/imap/IMAPParserTest.cpp13
-rw-r--r--tests/net/imap/IMAPTagTest.cpp16
-rw-r--r--tests/net/maildir/maildirStoreTest.cpp86
-rw-r--r--tests/net/pop3/POP3CommandTest.cpp47
-rw-r--r--tests/net/pop3/POP3ResponseTest.cpp80
-rw-r--r--tests/net/pop3/POP3StoreTest.cpp14
-rw-r--r--tests/net/pop3/POP3TestUtils.hpp15
-rw-r--r--tests/net/pop3/POP3UtilsTest.cpp10
-rw-r--r--tests/net/smtp/SMTPCommandSetTest.cpp28
-rw-r--r--tests/net/smtp/SMTPCommandTest.cpp44
-rw-r--r--tests/net/smtp/SMTPResponseTest.cpp70
-rw-r--r--tests/net/smtp/SMTPTransportTest.cpp80
-rw-r--r--tests/net/smtp/SMTPTransportTestUtils.hpp22
-rw-r--r--tests/parser/attachmentHelperTest.cpp70
-rw-r--r--tests/parser/bodyPartTest.cpp42
-rw-r--r--tests/parser/bodyTest.cpp4
-rw-r--r--tests/parser/charsetFilteredOutputStreamTest.cpp20
-rw-r--r--tests/parser/fileContentHandlerTest.cpp6
-rw-r--r--tests/parser/headerFieldTest.cpp19
-rw-r--r--tests/parser/headerTest.cpp54
-rw-r--r--tests/parser/htmlTextPartTest.cpp12
-rw-r--r--tests/parser/mailboxGroupTest.cpp4
-rw-r--r--tests/parser/mailboxTest.cpp9
-rw-r--r--tests/parser/messageIdSequenceTest.cpp6
-rw-r--r--tests/parser/messageTest.cpp6
-rw-r--r--tests/parser/parameterTest.cpp44
-rw-r--r--tests/parser/streamContentHandlerTest.cpp36
-rw-r--r--tests/parser/textTest.cpp20
-rw-r--r--tests/security/digest/md5Test.cpp2
-rw-r--r--tests/security/digest/sha1Test.cpp2
-rw-r--r--tests/testUtils.cpp4
-rw-r--r--tests/testUtils.hpp10
-rw-r--r--tests/utility/encoder/encoderTestUtils.hpp8
-rw-r--r--tests/utility/outputStreamSocketAdapterTest.cpp6
-rw-r--r--tests/utility/seekableInputStreamRegionAdapterTest.cpp30
-rw-r--r--tests/utility/smartPtrTest.cpp241
37 files changed, 469 insertions, 719 deletions
diff --git a/tests/misc/importanceHelperTest.cpp b/tests/misc/importanceHelperTest.cpp
index f4696efb..9a4b86f7 100644
--- a/tests/misc/importanceHelperTest.cpp
+++ b/tests/misc/importanceHelperTest.cpp
@@ -49,7 +49,7 @@ VMIME_TEST_SUITE_BEGIN(importanceHelperTest)
void testResetImportance()
{
- vmime::ref <vmime::header> hdr = vmime::create <vmime::header>();
+ vmime::shared_ptr <vmime::header> hdr = vmime::make_shared <vmime::header>();
hdr->getField("Importance")->setValue("xxx");
hdr->getField("X-Priority")->setValue("yyy");
@@ -69,7 +69,7 @@ VMIME_TEST_SUITE_BEGIN(importanceHelperTest)
void testSetImportanceImpl(const vmime::misc::importanceHelper::Importance i,
const std::string& ImportanceValue, const std::string& XPriorityValue)
{
- vmime::ref <vmime::header> hdr = vmime::create <vmime::header>();
+ vmime::shared_ptr <vmime::header> hdr = vmime::make_shared <vmime::header>();
vmime::misc::importanceHelper::setImportanceHeader(hdr, i);
@@ -117,12 +117,12 @@ VMIME_TEST_SUITE_BEGIN(importanceHelperTest)
const vmime::misc::importanceHelper::Importance i2,
const std::string& ImportanceValue, const std::string& XPriorityValue)
{
- vmime::ref <vmime::header> hdr1 = vmime::create <vmime::header>();
+ vmime::shared_ptr <vmime::header> hdr1 = vmime::make_shared <vmime::header>();
hdr1->getField("Importance")->setValue(ImportanceValue);
VASSERT_EQ("1", i1, vmime::misc::importanceHelper::getImportanceHeader(hdr1));
- vmime::ref <vmime::header> hdr2 = vmime::create <vmime::header>();
+ vmime::shared_ptr <vmime::header> hdr2 = vmime::make_shared <vmime::header>();
hdr2->getField("X-Priority")->setValue(XPriorityValue);
VASSERT_EQ("2", i2, vmime::misc::importanceHelper::getImportanceHeader(hdr2));
diff --git a/tests/net/imap/IMAPParserTest.cpp b/tests/net/imap/IMAPParserTest.cpp
index 93f6e6fd..30e8f574 100644
--- a/tests/net/imap/IMAPParserTest.cpp
+++ b/tests/net/imap/IMAPParserTest.cpp
@@ -37,18 +37,19 @@ VMIME_TEST_SUITE_BEGIN(IMAPParserTest)
// For Apple iCloud IMAP server
void testExtraSpaceInCapaResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
socket->localSend(
"* CAPABILITY IMAP4rev1 AUTH=ATOKEN AUTH=PLAIN \r\n" // extra space at end
"a001 OK Capability completed.\r\n");
- vmime::ref <vmime::net::imap::IMAPParser> parser =
- vmime::create <vmime::net::imap::IMAPParser>(tag, socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <vmime::net::imap::IMAPParser> parser =
+ vmime::make_shared <vmime::net::imap::IMAPParser>
+ (tag, vmime::dynamicCast <vmime::net::socket>(socket), toh);
parser->setStrict(false);
VASSERT_NO_THROW("non-strict mode", parser->readResponse(/* literalHandler */ NULL));
diff --git a/tests/net/imap/IMAPTagTest.cpp b/tests/net/imap/IMAPTagTest.cpp
index 26ed87c5..db04537a 100644
--- a/tests/net/imap/IMAPTagTest.cpp
+++ b/tests/net/imap/IMAPTagTest.cpp
@@ -38,16 +38,16 @@ VMIME_TEST_SUITE_BEGIN(imapTagTest)
void testConstruct()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
VASSERT_EQ("init", "a001", static_cast <vmime::string>(*tag));
}
void testIncrement()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
(*tag)++;
VASSERT_EQ("init", "a002", static_cast <vmime::string>(*tag));
@@ -61,8 +61,8 @@ VMIME_TEST_SUITE_BEGIN(imapTagTest)
void testReset()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
for (int i = tag->number() ; i < tag->maximumNumber() ; ++i)
(*tag)++;
@@ -76,8 +76,8 @@ VMIME_TEST_SUITE_BEGIN(imapTagTest)
void testNumber()
{
- vmime::ref <vmime::net::imap::IMAPTag> tag =
- vmime::create <vmime::net::imap::IMAPTag>();
+ vmime::shared_ptr <vmime::net::imap::IMAPTag> tag =
+ vmime::make_shared <vmime::net::imap::IMAPTag>();
for (int i = 0 ; i < 41 ; ++i)
(*tag)++;
diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
index 358e095f..34e8249c 100644
--- a/tests/net/maildir/maildirStoreTest.cpp
+++ b/tests/net/maildir/maildirStoreTest.cpp
@@ -187,7 +187,7 @@ public:
{
createMaildir(TEST_MAILDIR_KMAIL, TEST_MAILDIRFILES_KMAIL);
- vmime::ref <vmime::net::maildir::maildirStore> store =
+ vmime::shared_ptr <vmime::net::maildir::maildirStore> store =
vmime::dynamicCast <vmime::net::maildir::maildirStore>(createAndConnectStore());
VASSERT_EQ("*", "kmail", store->getFormat()->getName());
@@ -199,7 +199,7 @@ public:
{
createMaildir(TEST_MAILDIR_COURIER, TEST_MAILDIRFILES_COURIER);
- vmime::ref <vmime::net::maildir::maildirStore> store =
+ vmime::shared_ptr <vmime::net::maildir::maildirStore> store =
vmime::dynamicCast <vmime::net::maildir::maildirStore>(createAndConnectStore());
VASSERT_EQ("*", "courier", store->getFormat()->getName());
@@ -223,11 +223,11 @@ public:
createMaildir(dirs, files);
// Connect to store
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Get root folders, not recursive
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
rootFolders = rootFolder->getFolders(false);
VASSERT_EQ("1", 2, rootFolders.size());
@@ -253,11 +253,11 @@ public:
createMaildir(dirs, files);
// Connect to store
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Get all folders, recursive
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
allFolders = rootFolder->getFolders(true);
VASSERT_EQ("1", 5, allFolders.size());
@@ -285,10 +285,10 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
- vmime::ref <vmime::net::folder> folder = store->getFolder
+ vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder" / "SubSubFolder2");
int count, unseen;
@@ -298,7 +298,7 @@ public:
folder->open(vmime::net::folder::MODE_READ_ONLY);
- vmime::ref <vmime::net::message> msg = folder->getMessage(1);
+ vmime::shared_ptr <vmime::net::message> msg = folder->getMessage(1);
folder->fetchMessage(msg, vmime::net::fetchAttributes::SIZE);
@@ -346,17 +346,17 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Rename "Folder/SubFolder" to "Folder/foo"
- vmime::ref <vmime::net::folder> folder = store->getFolder
+ vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder");
folder->rename(fpath() / "Folder" / "foo");
// Ensure folder and its subfolders have been renamed
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
allFolders = rootFolder->getFolders(true);
VASSERT_EQ("1", 5, allFolders.size());
@@ -387,17 +387,17 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
// Destroy "Folder/SubFolder" (total: 3 folders)
- vmime::ref <vmime::net::folder> folder = store->getFolder
+ vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder");
folder->destroy();
// Ensure folder and its subfolders have been deleted and other folders still exist
- const std::vector <vmime::ref <vmime::net::folder> >
+ const std::vector <vmime::shared_ptr <vmime::net::folder> >
allFolders = rootFolder->getFolders(true);
VASSERT_EQ("1", 2, allFolders.size());
@@ -425,8 +425,8 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
VASSERT("1", store->getFolder(fpath() / "Folder" / "SubFolder")->exists());
VASSERT("2", !store->getFolder(fpath() / "Folder" / "SubSubFolder1")->exists());
@@ -451,8 +451,8 @@ public:
{
createMaildir(dirs, files);
- vmime::ref <vmime::net::store> store = createAndConnectStore();
- vmime::ref <vmime::net::folder> rootFolder = store->getRootFolder();
+ vmime::shared_ptr <vmime::net::store> store = createAndConnectStore();
+ vmime::shared_ptr <vmime::net::folder> rootFolder = store->getRootFolder();
VASSERT("Before", !store->getFolder(fpath() / "Folder" / "NewFolder")->exists());
@@ -469,12 +469,12 @@ private:
vmime::utility::file::path m_tempPath;
- vmime::ref <vmime::net::store> createAndConnectStore()
+ vmime::shared_ptr <vmime::net::store> createAndConnectStore()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::store> store =
+ vmime::shared_ptr <vmime::net::store> store =
session->getStore(getStoreURL());
store->connect();
@@ -482,8 +482,8 @@ private:
return store;
}
- const vmime::ref <vmime::net::folder> findFolder
- (const std::vector <vmime::ref <vmime::net::folder> >& folders,
+ const vmime::shared_ptr <vmime::net::folder> findFolder
+ (const std::vector <vmime::shared_ptr <vmime::net::folder> >& folders,
const vmime::net::folder::path& path)
{
for (unsigned int i = 0, n = folders.size() ; i < n ; ++i)
@@ -492,12 +492,12 @@ private:
return folders[i];
}
- return NULL;
+ return vmime::null;
}
const vmime::utility::url getStoreURL()
{
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
vmime::utility::url url(std::string("maildir://localhost")
@@ -508,15 +508,15 @@ private:
void createMaildir(const vmime::string* const dirs, const vmime::string* const files)
{
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
- vmime::ref <vmime::utility::file> rootDir = fsf->create(m_tempPath);
+ vmime::shared_ptr <vmime::utility::file> rootDir = fsf->create(m_tempPath);
rootDir->createDirectory(false);
for (vmime::string const* dir = dirs ; *dir != "*" ; ++dir)
{
- vmime::ref <vmime::utility::file> fdir = fsf->create(m_tempPath / fsf->stringToPath(*dir));
+ vmime::shared_ptr <vmime::utility::file> fdir = fsf->create(m_tempPath / fsf->stringToPath(*dir));
fdir->createDirectory(false);
}
@@ -524,39 +524,39 @@ private:
{
const vmime::string& contents = *(file + 1);
- vmime::ref <vmime::utility::file> ffile = fsf->create(m_tempPath / fsf->stringToPath(*file));
+ vmime::shared_ptr <vmime::utility::file> ffile = fsf->create(m_tempPath / fsf->stringToPath(*file));
ffile->createFile();
- vmime::ref <vmime::utility::fileWriter> fileWriter = ffile->getFileWriter();
- vmime::ref <vmime::utility::outputStream> os = fileWriter->getOutputStream();
+ vmime::shared_ptr <vmime::utility::fileWriter> fileWriter = ffile->getFileWriter();
+ vmime::shared_ptr <vmime::utility::outputStream> os = fileWriter->getOutputStream();
os->write(contents.data(), contents.length());
os->flush();
- fileWriter = NULL;
+ fileWriter = vmime::null;
}
}
void destroyMaildir()
{
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
recursiveDelete(fsf->create(m_tempPath));
}
- void recursiveDelete(vmime::ref <vmime::utility::file> dir)
+ void recursiveDelete(vmime::shared_ptr <vmime::utility::file> dir)
{
if (!dir->exists() || !dir->isDirectory())
return;
- vmime::ref <vmime::utility::fileIterator> files = dir->getFiles();
+ vmime::shared_ptr <vmime::utility::fileIterator> files = dir->getFiles();
// First, delete files and subdirectories in this directory
while (files->hasMoreElements())
{
- vmime::ref <vmime::utility::file> file = files->nextElement();
+ vmime::shared_ptr <vmime::utility::file> file = files->nextElement();
if (file->isDirectory())
{
diff --git a/tests/net/pop3/POP3CommandTest.cpp b/tests/net/pop3/POP3CommandTest.cpp
index 14c92be4..4733c96b 100644
--- a/tests/net/pop3/POP3CommandTest.cpp
+++ b/tests/net/pop3/POP3CommandTest.cpp
@@ -59,7 +59,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testCreateCommand()
{
- vmime::ref <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND", cmd->getText());
@@ -67,7 +67,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testCreateCommandParams()
{
- vmime::ref <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND param1 param2", cmd->getText());
@@ -75,7 +75,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testCAPA()
{
- vmime::ref <POP3Command> cmd = POP3Command::CAPA();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::CAPA();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "CAPA", cmd->getText());
@@ -83,7 +83,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testNOOP()
{
- vmime::ref <POP3Command> cmd = POP3Command::NOOP();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::NOOP();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "NOOP", cmd->getText());
@@ -91,7 +91,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testAUTH()
{
- vmime::ref <POP3Command> cmd = POP3Command::AUTH("saslmechanism");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::AUTH("saslmechanism");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "AUTH saslmechanism", cmd->getText());
@@ -99,7 +99,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testSTLS()
{
- vmime::ref <POP3Command> cmd = POP3Command::STLS();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::STLS();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "STLS", cmd->getText());
@@ -107,7 +107,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testAPOP()
{
- vmime::ref <POP3Command> cmd = POP3Command::APOP("user", "digest");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::APOP("user", "digest");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "APOP user digest", cmd->getText());
@@ -115,7 +115,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testUSER()
{
- vmime::ref <POP3Command> cmd = POP3Command::USER("user");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::USER("user");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "USER user", cmd->getText());
@@ -123,7 +123,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testPASS()
{
- vmime::ref <POP3Command> cmd = POP3Command::PASS("pass");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::PASS("pass");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "PASS pass", cmd->getText());
@@ -131,7 +131,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testSTAT()
{
- vmime::ref <POP3Command> cmd = POP3Command::STAT();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::STAT();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "STAT", cmd->getText());
@@ -139,7 +139,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testLIST()
{
- vmime::ref <POP3Command> cmd = POP3Command::LIST();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::LIST();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "LIST", cmd->getText());
@@ -147,7 +147,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testLISTMessage()
{
- vmime::ref <POP3Command> cmd = POP3Command::LIST(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::LIST(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "LIST 42", cmd->getText());
@@ -155,7 +155,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testUIDL()
{
- vmime::ref <POP3Command> cmd = POP3Command::UIDL();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::UIDL();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "UIDL", cmd->getText());
@@ -163,7 +163,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testUIDLMessage()
{
- vmime::ref <POP3Command> cmd = POP3Command::UIDL(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::UIDL(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "UIDL 42", cmd->getText());
@@ -171,7 +171,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testDELE()
{
- vmime::ref <POP3Command> cmd = POP3Command::DELE(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::DELE(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "DELE 42", cmd->getText());
@@ -179,7 +179,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testRETR()
{
- vmime::ref <POP3Command> cmd = POP3Command::RETR(42);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::RETR(42);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RETR 42", cmd->getText());
@@ -187,7 +187,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testTOP()
{
- vmime::ref <POP3Command> cmd = POP3Command::TOP(42, 567);
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::TOP(42, 567);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "TOP 42 567", cmd->getText());
@@ -195,7 +195,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testRSET()
{
- vmime::ref <POP3Command> cmd = POP3Command::RSET();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::RSET();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RSET", cmd->getText());
@@ -203,7 +203,7 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testQUIT()
{
- vmime::ref <POP3Command> cmd = POP3Command::QUIT();
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::QUIT();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "QUIT", cmd->getText());
@@ -211,11 +211,12 @@ VMIME_TEST_SUITE_BEGIN(POP3CommandTest)
void testWriteToSocket()
{
- vmime::ref <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <POP3Command> cmd = POP3Command::createCommand("MY_COMMAND param1 param2");
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (sok.dynamicCast <vmime::net::socket>(), vmime::null);
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(sok),
+ vmime::shared_ptr <vmime::net::timeoutHandler>());
cmd->send(conn);
diff --git a/tests/net/pop3/POP3ResponseTest.cpp b/tests/net/pop3/POP3ResponseTest.cpp
index f1fbcd54..2d3b3d32 100644
--- a/tests/net/pop3/POP3ResponseTest.cpp
+++ b/tests/net/pop3/POP3ResponseTest.cpp
@@ -47,15 +47,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseOK()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -67,15 +67,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseERR()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("-ERR Response Text\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_ERR, resp->getCode());
@@ -87,15 +87,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseReady()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+ challenge_string\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_READY, resp->getCode());
@@ -107,15 +107,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseInvalid()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("Invalid Response Text\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_ERR, resp->getCode());
@@ -127,15 +127,15 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testSingleLineResponseLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response terminated by LF\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -147,18 +147,18 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testMultiLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\r\n");
socket->localSend("Line 1\r\n");
socket->localSend("Line 2\r\n");
socket->localSend(".\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -172,18 +172,18 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
void testMultiLineResponseLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\n");
socket->localSend("Line 1\n");
socket->localSend("Line 2\n");
socket->localSend(".\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
@@ -202,11 +202,11 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
for (unsigned int i = 0 ; i < 5000 ; ++i)
data << "VMIME.VMIME\nVMIME\r\nVMIME_VMIME";
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Large Response Follows\n");
socket->localSend(data.str());
@@ -215,7 +215,7 @@ VMIME_TEST_SUITE_BEGIN(POP3ResponseTest)
vmime::string receivedData;
vmime::utility::outputStreamStringAdapter receivedDataStream(receivedData);
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readLargeResponse(conn, receivedDataStream, NULL, 0);
VASSERT_EQ("Code", POP3Response::CODE_OK, resp->getCode());
diff --git a/tests/net/pop3/POP3StoreTest.cpp b/tests/net/pop3/POP3StoreTest.cpp
index d938f472..5517f770 100644
--- a/tests/net/pop3/POP3StoreTest.cpp
+++ b/tests/net/pop3/POP3StoreTest.cpp
@@ -39,29 +39,29 @@ VMIME_TEST_SUITE_BEGIN(POP3StoreTest)
void testCreateFromURL()
{
- vmime::ref <vmime::net::session> sess
- = vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> sess
+ = vmime::make_shared <vmime::net::session>();
// POP3
vmime::utility::url url("pop3://pop3.vmime.org");
- vmime::ref <vmime::net::store> store = sess->getStore(url);
+ vmime::shared_ptr <vmime::net::store> store = sess->getStore(url);
VASSERT_TRUE("pop3", typeid(*store) == typeid(vmime::net::pop3::POP3Store));
// POP3S
vmime::utility::url url2("pop3s://pop3s.vmime.org");
- vmime::ref <vmime::net::store> store2 = sess->getStore(url2);
+ vmime::shared_ptr <vmime::net::store> store2 = sess->getStore(url2);
VASSERT_TRUE("pop3s", typeid(*store2) == typeid(vmime::net::pop3::POP3SStore));
}
void testConnectToInvalidServer()
{
- vmime::ref <vmime::net::session> sess
- = vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> sess
+ = vmime::make_shared <vmime::net::session>();
vmime::utility::url url("pop3://invalid-pop3-server");
- vmime::ref <vmime::net::store> store = sess->getStore(url);
+ vmime::shared_ptr <vmime::net::store> store = sess->getStore(url);
VASSERT_THROW("connect", store->connect(), vmime::exceptions::connection_error);
}
diff --git a/tests/net/pop3/POP3TestUtils.hpp b/tests/net/pop3/POP3TestUtils.hpp
index 26b6601a..1c6e8935 100644
--- a/tests/net/pop3/POP3TestUtils.hpp
+++ b/tests/net/pop3/POP3TestUtils.hpp
@@ -29,25 +29,26 @@ class POP3ConnectionTest : public vmime::net::pop3::POP3Connection
{
public:
- POP3ConnectionTest(vmime::ref <vmime::net::socket> socket,
- vmime::ref <vmime::net::timeoutHandler> timeoutHandler)
- : POP3Connection(NULL, NULL),
+ POP3ConnectionTest(vmime::shared_ptr <vmime::net::socket> socket,
+ vmime::shared_ptr <vmime::net::timeoutHandler> timeoutHandler)
+ : POP3Connection(vmime::shared_ptr <vmime::net::pop3::POP3Store>(),
+ vmime::shared_ptr <vmime::security::authenticator>()),
m_socket(socket), m_timeoutHandler(timeoutHandler)
{
}
- vmime::ref <vmime::net::socket> getSocket()
+ vmime::shared_ptr <vmime::net::socket> getSocket()
{
return m_socket;
}
- vmime::ref <vmime::net::timeoutHandler> getTimeoutHandler()
+ vmime::shared_ptr <vmime::net::timeoutHandler> getTimeoutHandler()
{
return m_timeoutHandler;
}
private:
- vmime::ref <vmime::net::socket> m_socket;
- vmime::ref <vmime::net::timeoutHandler> m_timeoutHandler;
+ vmime::shared_ptr <vmime::net::socket> m_socket;
+ vmime::shared_ptr <vmime::net::timeoutHandler> m_timeoutHandler;
};
diff --git a/tests/net/pop3/POP3UtilsTest.cpp b/tests/net/pop3/POP3UtilsTest.cpp
index 9d443ddb..55a99806 100644
--- a/tests/net/pop3/POP3UtilsTest.cpp
+++ b/tests/net/pop3/POP3UtilsTest.cpp
@@ -41,11 +41,11 @@ VMIME_TEST_SUITE_BEGIN(POP3UtilsTest)
void testParseMultiListOrUidlResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh = vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh = vmime::make_shared <testTimeoutHandler>();
- vmime::ref <POP3ConnectionTest> conn = vmime::create <POP3ConnectionTest>
- (socket.dynamicCast <vmime::net::socket>(), toh);
+ vmime::shared_ptr <POP3ConnectionTest> conn = vmime::make_shared <POP3ConnectionTest>
+ (vmime::dynamicCast <vmime::net::socket>(socket), toh);
socket->localSend("+OK Response Text\r\n");
socket->localSend("1 abcdef\r\n");
@@ -55,7 +55,7 @@ VMIME_TEST_SUITE_BEGIN(POP3UtilsTest)
socket->localSend("8 yz \r\n");
socket->localSend(".\r\n");
- vmime::ref <POP3Response> resp =
+ vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn);
std::map <int, vmime::string> result;
diff --git a/tests/net/smtp/SMTPCommandSetTest.cpp b/tests/net/smtp/SMTPCommandSetTest.cpp
index 0cf4b03b..af250078 100644
--- a/tests/net/smtp/SMTPCommandSetTest.cpp
+++ b/tests/net/smtp/SMTPCommandSetTest.cpp
@@ -46,7 +46,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testCreate()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
VASSERT_NOT_NULL("Not null", cset);
VASSERT_FALSE("Finished", cset->isFinished());
@@ -54,7 +54,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testCreatePipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
VASSERT_NOT_NULL("Not null", cset);
VASSERT_FALSE("Finished", cset->isFinished());
@@ -62,14 +62,14 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testAddCommand()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
VASSERT_NO_THROW("No throw 1", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1")));
VASSERT_EQ("Text", "MY_COMMAND1\r\n", cset->getText());
VASSERT_NO_THROW("No throw 2", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2")));
VASSERT_EQ("Text", "MY_COMMAND1\r\nMY_COMMAND2\r\n", cset->getText());
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cset->writeToSocket(sok);
VASSERT_FALSE("Finished", cset->isFinished());
@@ -83,14 +83,14 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testAddCommandPipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
VASSERT_NO_THROW("No throw 1", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1")));
VASSERT_EQ("Text", "MY_COMMAND1\r\n", cset->getText());
VASSERT_NO_THROW("No throw 2", cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2")));
VASSERT_EQ("Text", "MY_COMMAND1\r\nMY_COMMAND2\r\n", cset->getText());
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
vmime::string response;
cset->writeToSocket(sok);
@@ -105,12 +105,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testWriteToSocket()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
vmime::string response;
cset->writeToSocket(sok);
@@ -126,12 +126,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testWriteToSocketPipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
vmime::string response;
cset->writeToSocket(sok);
@@ -142,12 +142,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testGetLastCommandSent()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ false);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cset->writeToSocket(sok);
VASSERT_EQ("Cmd 1", "MY_COMMAND1", cset->getLastCommandSent()->getText());
@@ -158,12 +158,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandSetTest)
void testGetLastCommandSentPipeline()
{
- vmime::ref <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
+ vmime::shared_ptr <SMTPCommandSet> cset = SMTPCommandSet::create(/* pipelining */ true);
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND1"));
cset->addCommand(SMTPCommand::createCommand("MY_COMMAND2"));
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cset->writeToSocket(sok);
VASSERT_EQ("Cmd 1", "MY_COMMAND1", cset->getLastCommandSent()->getText());
diff --git a/tests/net/smtp/SMTPCommandTest.cpp b/tests/net/smtp/SMTPCommandTest.cpp
index 9a2c90fc..6d466865 100644
--- a/tests/net/smtp/SMTPCommandTest.cpp
+++ b/tests/net/smtp/SMTPCommandTest.cpp
@@ -57,7 +57,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testCreateCommand()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND", cmd->getText());
@@ -65,7 +65,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testCreateCommandParams()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MY_COMMAND param1 param2", cmd->getText());
@@ -73,7 +73,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testHELO()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::HELO("hostname");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::HELO("hostname");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "HELO hostname", cmd->getText());
@@ -81,7 +81,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testEHLO()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::EHLO("hostname");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::EHLO("hostname");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "EHLO hostname", cmd->getText());
@@ -89,7 +89,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testAUTH()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::AUTH("saslmechanism");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::AUTH("saslmechanism");
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "AUTH saslmechanism", cmd->getText());
@@ -97,7 +97,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testSTARTTLS()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::STARTTLS();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::STARTTLS();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "STARTTLS", cmd->getText());
@@ -105,7 +105,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL(vmime::mailbox("[email protected]"), false);
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL(vmime::mailbox("[email protected]"), false);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "MAIL FROM:<[email protected]>", cmd->getText());
@@ -113,7 +113,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_Encoded()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), false);
VASSERT_NOT_NULL("Not null", cmd);
@@ -122,7 +122,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_UTF8()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), true);
VASSERT_NOT_NULL("Not null", cmd);
@@ -131,7 +131,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_SIZE()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox("[email protected]"), false, 123456789);
VASSERT_NOT_NULL("Not null", cmd);
@@ -140,7 +140,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testMAIL_SIZE_UTF8()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::MAIL
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::MAIL
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), true, 123456789);
VASSERT_NOT_NULL("Not null", cmd);
@@ -149,7 +149,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRCPT()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RCPT(vmime::mailbox("[email protected]"), false);
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RCPT(vmime::mailbox("[email protected]"), false);
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RCPT TO:<[email protected]>", cmd->getText());
@@ -157,7 +157,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRCPT_Encoded()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RCPT
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RCPT
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), false);
VASSERT_NOT_NULL("Not null", cmd);
@@ -166,7 +166,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRCPT_UTF8()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RCPT
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RCPT
(vmime::mailbox(vmime::emailAddress("mailtest", "例え.テスト")), true);
VASSERT_NOT_NULL("Not null", cmd);
@@ -175,7 +175,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testRSET()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::RSET();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::RSET();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "RSET", cmd->getText());
@@ -183,7 +183,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testDATA()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::DATA();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::DATA();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "DATA", cmd->getText());
@@ -191,12 +191,12 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testBDAT()
{
- vmime::ref <SMTPCommand> cmd1 = SMTPCommand::BDAT(12345, false);
+ vmime::shared_ptr <SMTPCommand> cmd1 = SMTPCommand::BDAT(12345, false);
VASSERT_NOT_NULL("Not null", cmd1);
VASSERT_EQ("Text", "BDAT 12345", cmd1->getText());
- vmime::ref <SMTPCommand> cmd2 = SMTPCommand::BDAT(67890, true);
+ vmime::shared_ptr <SMTPCommand> cmd2 = SMTPCommand::BDAT(67890, true);
VASSERT_NOT_NULL("Not null", cmd2);
VASSERT_EQ("Text", "BDAT 67890 LAST", cmd2->getText());
@@ -204,7 +204,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testNOOP()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::NOOP();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::NOOP();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "NOOP", cmd->getText());
@@ -212,7 +212,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testQUIT()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::QUIT();
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::QUIT();
VASSERT_NOT_NULL("Not null", cmd);
VASSERT_EQ("Text", "QUIT", cmd->getText());
@@ -220,9 +220,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPCommandTest)
void testWriteToSocket()
{
- vmime::ref <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
+ vmime::shared_ptr <SMTPCommand> cmd = SMTPCommand::createCommand("MY_COMMAND param1 param2");
- vmime::ref <testSocket> sok = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> sok = vmime::make_shared <testSocket>();
cmd->writeToSocket(sok);
vmime::string response;
diff --git a/tests/net/smtp/SMTPResponseTest.cpp b/tests/net/smtp/SMTPResponseTest.cpp
index 5e75b6a7..352f46c2 100644
--- a/tests/net/smtp/SMTPResponseTest.cpp
+++ b/tests/net/smtp/SMTPResponseTest.cpp
@@ -43,15 +43,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testSingleLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("123 Response Text\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 123, resp->getCode());
@@ -61,15 +61,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testSingleLineResponseLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("123 Response Text\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 123, resp->getCode());
@@ -79,9 +79,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testMultiLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend
(
@@ -91,7 +91,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 123, resp->getCode());
@@ -107,9 +107,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testMultiLineResponseDifferentCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend
(
@@ -119,7 +119,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 0, resp->getCode());
@@ -135,9 +135,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testIncompleteMultiLineResponse()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>(1);
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>(1);
socket->localSend
(
@@ -155,9 +155,9 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testNoResponseText()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>(1);
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>(1);
socket->localSend
(
@@ -166,7 +166,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 250, resp->getCode());
@@ -176,15 +176,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testEnhancedStatusCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("250 2.1.5 OK fu13sm4720601wic.7 - gsmtp\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 250, resp->getCode());
@@ -197,15 +197,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testNoEnhancedStatusCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("354 Go ahead fu13sm4720601wic.7 - gsmtp\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 354, resp->getCode());
@@ -218,15 +218,15 @@ VMIME_TEST_SUITE_BEGIN(SMTPResponseTest)
void testInvalidEnhancedStatusCode()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
- vmime::ref <vmime::net::timeoutHandler> toh =
- vmime::create <testTimeoutHandler>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
+ vmime::shared_ptr <vmime::net::timeoutHandler> toh =
+ vmime::make_shared <testTimeoutHandler>();
socket->localSend("250 4.2 xxx\r\n");
vmime::net::smtp::SMTPResponse::state responseState;
- vmime::ref <vmime::net::smtp::SMTPResponse> resp =
+ vmime::shared_ptr <vmime::net::smtp::SMTPResponse> resp =
vmime::net::smtp::SMTPResponse::readResponse(socket, toh, responseState);
VASSERT_EQ("Code", 250, resp->getCode());
diff --git a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp
index 13c18309..5997588e 100644
--- a/tests/net/smtp/SMTPTransportTest.cpp
+++ b/tests/net/smtp/SMTPTransportTest.cpp
@@ -44,25 +44,25 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testConnectToInvalidServer()
{
- vmime::ref <vmime::net::session> sess
- = vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> sess
+ = vmime::make_shared <vmime::net::session>();
vmime::utility::url url("smtp://invalid-smtp-server");
- vmime::ref <vmime::net::transport> store = sess->getTransport(url);
+ vmime::shared_ptr <vmime::net::transport> store = sess->getTransport(url);
VASSERT_THROW("connect", store->connect(), vmime::exceptions::connection_error);
}
void testGreetingError()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <greetingErrorSMTPTestSocket> >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <greetingErrorSMTPTestSocket> >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
VASSERT_THROW("Connection", tr->connect(),
vmime::exceptions::connection_greeting_error);
@@ -70,23 +70,23 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testMAILandRCPT()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <MAILandRCPTSMTPTestSocket> >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <MAILandRCPTSMTPTestSocket> >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
VASSERT_NO_THROW("Connection", tr->connect());
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
vmime::string data("Message data");
vmime::utility::inputStreamStringAdapter is(data);
@@ -96,52 +96,52 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testChunking()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <chunkingSMTPTestSocket> >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <chunkingSMTPTestSocket> >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
tr->connect();
VASSERT("Test server should report it supports the CHUNKING extension!",
- tr.dynamicCast <vmime::net::smtp::SMTPTransport>()->getConnection()->hasExtension("CHUNKING"));
+ vmime::dynamicCast <vmime::net::smtp::SMTPTransport>(tr)->getConnection()->hasExtension("CHUNKING"));
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
- vmime::ref <vmime::message> msg = vmime::create <SMTPTestMessage>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <SMTPTestMessage>();
tr->send(msg, exp, recips);
}
void testSize_Chunking()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <bigMessageSMTPTestSocket <true> > >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <bigMessageSMTPTestSocket <true> > >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
tr->connect();
VASSERT("Test server should report it supports the SIZE extension!",
- tr.dynamicCast <vmime::net::smtp::SMTPTransport>()->getConnection()->hasExtension("SIZE"));
+ vmime::dynamicCast <vmime::net::smtp::SMTPTransport>(tr)->getConnection()->hasExtension("SIZE"));
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
- vmime::ref <vmime::message> msg = vmime::create <SMTPBigTestMessage4MB>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <SMTPBigTestMessage4MB>();
VASSERT_THROW("Connection", tr->send(msg, exp, recips),
vmime::net::smtp::SMTPMessageSizeExceedsMaxLimitsException);
@@ -149,26 +149,26 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest)
void testSize_NoChunking()
{
- vmime::ref <vmime::net::session> session =
- vmime::create <vmime::net::session>();
+ vmime::shared_ptr <vmime::net::session> session =
+ vmime::make_shared <vmime::net::session>();
- vmime::ref <vmime::net::transport> tr = session->getTransport
+ vmime::shared_ptr <vmime::net::transport> tr = session->getTransport
(vmime::utility::url("smtp://localhost"));
- tr->setSocketFactory(vmime::create <testSocketFactory <bigMessageSMTPTestSocket <false> > >());
- tr->setTimeoutHandlerFactory(vmime::create <testTimeoutHandlerFactory>());
+ tr->setSocketFactory(vmime::make_shared <testSocketFactory <bigMessageSMTPTestSocket <false> > >());
+ tr->setTimeoutHandlerFactory(vmime::make_shared <testTimeoutHandlerFactory>());
tr->connect();
VASSERT("Test server should report it supports the SIZE extension!",
- tr.dynamicCast <vmime::net::smtp::SMTPTransport>()->getConnection()->hasExtension("SIZE"));
+ vmime::dynamicCast <vmime::net::smtp::SMTPTransport>(tr)->getConnection()->hasExtension("SIZE"));
vmime::mailbox exp("[email protected]");
vmime::mailboxList recips;
- recips.appendMailbox(vmime::create <vmime::mailbox>("[email protected]"));
+ recips.appendMailbox(vmime::make_shared <vmime::mailbox>("[email protected]"));
- vmime::ref <vmime::message> msg = vmime::create <SMTPBigTestMessage4MB>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <SMTPBigTestMessage4MB>();
VASSERT_THROW("Connection", tr->send(msg, exp, recips),
vmime::net::smtp::SMTPMessageSizeExceedsMaxLimitsException);
diff --git a/tests/net/smtp/SMTPTransportTestUtils.hpp b/tests/net/smtp/SMTPTransportTestUtils.hpp
index b74f9783..dd7afeb5 100644
--- a/tests/net/smtp/SMTPTransportTestUtils.hpp
+++ b/tests/net/smtp/SMTPTransportTestUtils.hpp
@@ -410,7 +410,7 @@ public:
vmime::utility::stream::size_type getChunkBufferSize() const
{
- static vmime::net::smtp::SMTPChunkingOutputStreamAdapter chunkStream(NULL);
+ static vmime::net::smtp::SMTPChunkingOutputStreamAdapter chunkStream(vmime::null);
return chunkStream.getBlockSize();
}
@@ -456,13 +456,11 @@ public:
bigMessageSMTPTestSocket()
{
m_state = STATE_NOT_CONNECTED;
- m_bdatChunkCount = 0;
m_ehloSent = m_mailSent = m_rcptSent = m_quitSent = false;
}
~bigMessageSMTPTestSocket()
{
- VASSERT_EQ("BDAT chunk count", 3, m_bdatChunkCount);
VASSERT("Client must send the QUIT command", m_quitSent);
}
@@ -476,22 +474,6 @@ public:
void onDataReceived()
{
- if (m_state == STATE_DATA)
- {
- if (m_bdatChunkReceived != m_bdatChunkSize)
- {
- const size_type remaining = m_bdatChunkSize - m_bdatChunkReceived;
- const size_type received = localReceiveRaw(NULL, remaining);
-
- m_bdatChunkReceived += received;
- }
-
- if (m_bdatChunkReceived == m_bdatChunkSize)
- {
- m_state = STATE_COMMAND;
- }
- }
-
processCommand();
}
@@ -584,8 +566,6 @@ private:
};
int m_state;
- int m_bdatChunkCount;
- int m_bdatChunkSize, m_bdatChunkReceived;
bool m_ehloSent, m_mailSent, m_rcptSent, m_quitSent;
};
diff --git a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelperTest.cpp
index 0ddf2448..4d4a2623 100644
--- a/tests/parser/attachmentHelperTest.cpp
+++ b/tests/parser/attachmentHelperTest.cpp
@@ -39,9 +39,9 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
VMIME_TEST_LIST_END
- static const vmime::string getStructure(vmime::ref <vmime::bodyPart> part)
+ static const vmime::string getStructure(vmime::shared_ptr <vmime::bodyPart> part)
{
- vmime::ref <vmime::body> bdy = part->getBody();
+ vmime::shared_ptr <vmime::body> bdy = part->getBody();
vmime::string res = part->getBody()->getContentType().generate();
@@ -52,7 +52,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
for (size_t i = 0 ; i < bdy->getPartCount() ; ++i)
{
- vmime::ref <vmime::bodyPart> subPart = bdy->getPartAt(i);
+ vmime::shared_ptr <vmime::bodyPart> subPart = bdy->getPartAt(i);
if (i != 0)
res += ",";
@@ -63,9 +63,9 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
return res + "]";
}
- static const vmime::string extractBodyContents(vmime::ref <const vmime::bodyPart> part)
+ static const vmime::string extractBodyContents(vmime::shared_ptr <const vmime::bodyPart> part)
{
- vmime::ref <const vmime::contentHandler> cth = part->getBody()->getContents();
+ vmime::shared_ptr <const vmime::contentHandler> cth = part->getBody()->getContents();
vmime::string data;
vmime::utility::outputStreamStringAdapter os(data);
@@ -83,11 +83,11 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"The text\r\n"
"";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(data);
- vmime::ref <vmime::attachment> att = vmime::create <vmime::defaultAttachment>
- (vmime::create <vmime::stringContentHandler>("test"),
+ vmime::shared_ptr <vmime::attachment> att = vmime::make_shared <vmime::defaultAttachment>
+ (vmime::make_shared <vmime::stringContentHandler>("test"),
vmime::mediaType("image/jpeg"));
vmime::attachmentHelper::addAttachment(msg, att);
@@ -112,11 +112,11 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"--foo--\r\n"
"";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(data);
- vmime::ref <vmime::attachment> att = vmime::create <vmime::defaultAttachment>
- (vmime::create <vmime::stringContentHandler>("test"),
+ vmime::shared_ptr <vmime::attachment> att = vmime::make_shared <vmime::defaultAttachment>
+ (vmime::make_shared <vmime::stringContentHandler>("test"),
vmime::mediaType("image/jpeg"));
vmime::attachmentHelper::addAttachment(msg, att);
@@ -136,11 +136,11 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"\r\n"
"TWVzc2FnZSBib2R5";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(data);
- vmime::ref <vmime::attachment> att = vmime::create <vmime::defaultAttachment>
- (vmime::create <vmime::stringContentHandler>("test"),
+ vmime::shared_ptr <vmime::attachment> att = vmime::make_shared <vmime::defaultAttachment>
+ (vmime::make_shared <vmime::stringContentHandler>("test"),
vmime::mediaType("image/jpeg"));
vmime::attachmentHelper::addAttachment(msg, att);
@@ -155,7 +155,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
{
vmime::string data = "Content-Disposition: attachment\r\n\r\nFoo\r\n";
- vmime::ref <vmime::bodyPart> p = vmime::create <vmime::bodyPart>();
+ vmime::shared_ptr <vmime::bodyPart> p = vmime::make_shared <vmime::bodyPart>();
p->parse(data);
VASSERT_EQ("1", true, vmime::attachmentHelper::isBodyPartAnAttachment(p));
@@ -167,7 +167,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
{
vmime::string data = "Content-Type: multipart/*\r\n\r\nFoo\r\n";
- vmime::ref <vmime::bodyPart> p = vmime::create <vmime::bodyPart>();
+ vmime::shared_ptr <vmime::bodyPart> p = vmime::make_shared <vmime::bodyPart>();
p->parse(data);
VASSERT_EQ("1", false, vmime::attachmentHelper::isBodyPartAnAttachment(p));
@@ -184,7 +184,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
{
vmime::string data = "Content-Type: application/octet-stream\r\n\r\nFoo\r\n";
- vmime::ref <vmime::bodyPart> p = vmime::create <vmime::bodyPart>();
+ vmime::shared_ptr <vmime::bodyPart> p = vmime::make_shared <vmime::bodyPart>();
p->parse(data);
VASSERT_EQ("1", true, vmime::attachmentHelper::isBodyPartAnAttachment(p));
@@ -199,7 +199,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"Content-Id: bar\r\n"
"\r\nFoo\r\n";
- vmime::ref <vmime::bodyPart> p = vmime::create <vmime::bodyPart>();
+ vmime::shared_ptr <vmime::bodyPart> p = vmime::make_shared <vmime::bodyPart>();
p->parse(data);
VASSERT_EQ("1", false, vmime::attachmentHelper::isBodyPartAnAttachment(p));
@@ -215,10 +215,10 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"\r\n"
"Foo bar baz";
- vmime::ref <vmime::bodyPart> part = vmime::create <vmime::bodyPart>();
+ vmime::shared_ptr <vmime::bodyPart> part = vmime::make_shared <vmime::bodyPart>();
part->parse(data);
- vmime::ref <const vmime::attachment> att =
+ vmime::shared_ptr <const vmime::attachment> att =
vmime::attachmentHelper::getBodyPartAttachment(part);
VASSERT_EQ("1", "image/jpeg", att->getType().generate());
@@ -233,7 +233,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
VASSERT_EQ("5", "Foo bar baz", attData);
//VASSERT_EQ("6", part, att->getPart());
- VASSERT_EQ("6", part->generate(), att->getPart().dynamicCast <const vmime::component>()->generate());
+ VASSERT_EQ("6", part->generate(), vmime::dynamicCast <const vmime::component>(att->getPart())->generate());
//VASSERT_EQ("7", part->getHeader(), att->getHeader());
VASSERT_EQ("7", part->getHeader()->generate(), att->getHeader()->generate());
}
@@ -246,7 +246,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"\r\n"
"Message body";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(data);
const vmime::string attData =
@@ -256,7 +256,7 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"\r\n"
"QXR0YWNoZWQgbWVzc2FnZSBib2R5";
- vmime::ref <vmime::message> amsg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> amsg = vmime::make_shared <vmime::message>();
amsg->parse(attData);
vmime::attachmentHelper::addAttachment(msg, amsg);
@@ -265,20 +265,20 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
VASSERT_EQ("2", "Message body", extractBodyContents(msg->getBody()->getPartAt(0)));
// Ensure message has been encoded properly
- vmime::ref <const vmime::bodyPart> attPart = msg->getBody()->getPartAt(1);
- vmime::ref <const vmime::contentHandler> attCth = attPart->getBody()->getContents();
+ vmime::shared_ptr <const vmime::bodyPart> attPart = msg->getBody()->getPartAt(1);
+ vmime::shared_ptr <const vmime::contentHandler> attCth = attPart->getBody()->getContents();
vmime::string attDataOut;
vmime::utility::outputStreamStringAdapter attDataOutOs(attDataOut);
attCth->extract(attDataOutOs);
- vmime::ref <vmime::message> amsgOut = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> amsgOut = vmime::make_shared <vmime::message>();
amsgOut->parse(attDataOut);
- vmime::ref <vmime::header> hdr = amsgOut->getHeader();
+ vmime::shared_ptr <vmime::header> hdr = amsgOut->getHeader();
- VASSERT_EQ("3", "Attached message", hdr->Subject()->getValue().dynamicCast <vmime::text>()->generate());
+ VASSERT_EQ("3", "Attached message", hdr->Subject()->getValue <vmime::text>()->generate());
VASSERT_EQ("4", "Attached message body", extractBodyContents(amsgOut));
}
@@ -300,25 +300,25 @@ VMIME_TEST_SUITE_BEGIN(attachmentHelperTest)
"FooBar\r\n"
"--foo--\r\n";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(data);
VASSERT_EQ("0", 2, msg->getBody()->getPartCount());
- vmime::ref <const vmime::attachment> att = vmime::attachmentHelper::
+ vmime::shared_ptr <const vmime::attachment> att = vmime::attachmentHelper::
getBodyPartAttachment(msg->getBody()->getPartAt(0));
VASSERT("1", att != NULL);
- vmime::ref <const vmime::messageAttachment> msgAtt =
- att.dynamicCast <const vmime::messageAttachment>();
+ vmime::shared_ptr <const vmime::messageAttachment> msgAtt =
+ vmime::dynamicCast <const vmime::messageAttachment>(att);
VASSERT("2", msgAtt != NULL);
- vmime::ref <vmime::message> amsg = msgAtt->getMessage();
- vmime::ref <vmime::header> hdr = amsg->getHeader();
+ vmime::shared_ptr <vmime::message> amsg = msgAtt->getMessage();
+ vmime::shared_ptr <vmime::header> hdr = amsg->getHeader();
- VASSERT_EQ("3", "Attached message", hdr->Subject()->getValue().dynamicCast <vmime::text>()->generate());
+ VASSERT_EQ("3", "Attached message", hdr->Subject()->getValue <vmime::text>()->generate());
VASSERT_EQ("4", "Attached message body", extractBodyContents(amsg));
}
diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp
index 453982e0..f6f82f75 100644
--- a/tests/parser/bodyPartTest.cpp
+++ b/tests/parser/bodyPartTest.cpp
@@ -49,7 +49,7 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest)
buffer.begin() + c.getParsedOffset() + c.getParsedLength());
}
- static const vmime::string extractContents(const vmime::ref <const vmime::contentHandler> cts)
+ static const vmime::string extractContents(const vmime::shared_ptr <const vmime::contentHandler> cts)
{
std::ostringstream oss;
vmime::utility::outputStreamAdapter os(oss);
@@ -105,7 +105,7 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest)
{
vmime::bodyPart p1;
p1.getHeader()->getField("Foo")->setValue(vmime::string("bar"));
- p1.getBody()->setContents(vmime::create <vmime::stringContentHandler>("Baz"));
+ p1.getBody()->setContents(vmime::make_shared <vmime::stringContentHandler>("Baz"));
VASSERT_EQ("1", "Foo: bar\r\n\r\nBaz", p1.generate());
}
@@ -162,7 +162,7 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest)
"--=_+ZWjySayKqSf2CyrfnNpaAcO6-G1HpoXdHZ4YyswAWqEY39Q--\r\n"
"Epilog text";
- vmime::ref<vmime::message> msg = vmime::create<vmime::message>();
+ vmime::shared_ptr<vmime::message> msg = vmime::make_shared<vmime::message>();
std::string istr(testmail);
@@ -223,26 +223,26 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest)
/** Ensure '7bit' encoding is used when body is 7-bit only. */
void testGenerate7bit()
{
- vmime::ref <vmime::plainTextPart> p1 = vmime::create <vmime::plainTextPart>();
- p1->setText(vmime::create <vmime::stringContentHandler>("Part1 is US-ASCII only."));
+ vmime::shared_ptr <vmime::plainTextPart> p1 = vmime::make_shared <vmime::plainTextPart>();
+ p1->setText(vmime::make_shared <vmime::stringContentHandler>("Part1 is US-ASCII only."));
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
p1->generateIn(msg, msg);
- vmime::ref <vmime::header> header1 = msg->getBody()->getPartAt(0)->getHeader();
+ vmime::shared_ptr <vmime::header> header1 = msg->getBody()->getPartAt(0)->getHeader();
VASSERT_EQ("1", "7bit", header1->ContentTransferEncoding()->getValue()->generate());
}
void testTextUsageForQPEncoding()
{
- vmime::ref <vmime::plainTextPart> part = vmime::create <vmime::plainTextPart>();
- part->setText(vmime::create <vmime::stringContentHandler>("Part1-line1\r\nPart1-line2\r\n\x89"));
+ vmime::shared_ptr <vmime::plainTextPart> part = vmime::make_shared <vmime::plainTextPart>();
+ part->setText(vmime::make_shared <vmime::stringContentHandler>("Part1-line1\r\nPart1-line2\r\n\x89"));
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
part->generateIn(msg, msg);
- vmime::ref <vmime::body> body = msg->getBody()->getPartAt(0)->getBody();
- vmime::ref <vmime::header> header = msg->getBody()->getPartAt(0)->getHeader();
+ vmime::shared_ptr <vmime::body> body = msg->getBody()->getPartAt(0)->getBody();
+ vmime::shared_ptr <vmime::header> header = msg->getBody()->getPartAt(0)->getHeader();
std::ostringstream oss;
vmime::utility::outputStreamAdapter os(oss);
@@ -339,30 +339,30 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest)
oss << "\r\n"
<< "--MY-BOUNDARY--\r\n";
- vmime::ref <vmime::utility::inputStreamStringAdapter> is =
- vmime::create <vmime::utility::inputStreamStringAdapter>(oss.str());
+ vmime::shared_ptr <vmime::utility::inputStreamStringAdapter> is =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(oss.str());
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(is, oss.str().length());
- vmime::ref <vmime::body> body1 = msg->getBody()->getPartAt(0)->getBody();
- vmime::ref <const vmime::contentHandler> body1Cts = body1->getContents();
+ vmime::shared_ptr <vmime::body> body1 = msg->getBody()->getPartAt(0)->getBody();
+ vmime::shared_ptr <const vmime::contentHandler> body1Cts = body1->getContents();
- vmime::ref <vmime::body> body2 = msg->getBody()->getPartAt(1)->getBody();
- vmime::ref <const vmime::contentHandler> body2Cts = body2->getContents();
+ vmime::shared_ptr <vmime::body> body2 = msg->getBody()->getPartAt(1)->getBody();
+ vmime::shared_ptr <const vmime::contentHandler> body2Cts = body2->getContents();
vmime::string body1CtsExtracted;
vmime::utility::outputStreamStringAdapter body1CtsExtractStream(body1CtsExtracted);
body1Cts->extract(body1CtsExtractStream);
VASSERT_EQ("1.1", BODY1_LENGTH, body1Cts->getLength());
- VASSERT("1.2", body1Cts.dynamicCast <const vmime::streamContentHandler>() != NULL);
+ VASSERT("1.2", vmime::dynamicCast <const vmime::streamContentHandler>(body1Cts) != NULL);
VASSERT_EQ("1.3", BODY1_LENGTH, body1CtsExtracted.length());
VASSERT_EQ("1.4", BODY1_BEGIN, body1CtsExtracted.substr(0, BODY1_BEGIN.length()));
VASSERT_EQ("1.5", BODY1_END, body1CtsExtracted.substr(BODY1_LENGTH - BODY1_END.length(), BODY1_END.length()));
VASSERT_EQ("2.1", BODY2_LINE.length() * BODY2_REPEAT, body2Cts->getLength());
- VASSERT("2.2", body2Cts.dynamicCast <const vmime::streamContentHandler>() != NULL);
+ VASSERT("2.2", vmime::dynamicCast <const vmime::streamContentHandler>(body2Cts) != NULL);
}
VMIME_TEST_SUITE_END
diff --git a/tests/parser/bodyTest.cpp b/tests/parser/bodyTest.cpp
index bb4d966b..92a4575e 100644
--- a/tests/parser/bodyTest.cpp
+++ b/tests/parser/bodyTest.cpp
@@ -40,7 +40,7 @@ VMIME_TEST_SUITE_BEGIN(bodyTest)
// Quoted-Printable encoding
vmime::bodyPart p;
- p.getBody()->setContents(vmime::create <vmime::stringContentHandler>
+ p.getBody()->setContents(vmime::make_shared <vmime::stringContentHandler>
("Foo éé\r\né bar\r\nbaz"), vmime::mediaType("text", "plain"),
vmime::charset("utf-8"), vmime::encoding("quoted-printable"));
@@ -54,7 +54,7 @@ VMIME_TEST_SUITE_BEGIN(bodyTest)
void testGenerate_NonText()
{
vmime::bodyPart p;
- p.getBody()->setContents(vmime::create <vmime::stringContentHandler>
+ p.getBody()->setContents(vmime::make_shared <vmime::stringContentHandler>
("Binary\xfa\xfb\r\ndata\r\n\r\n\xfc"), vmime::mediaType("application", "octet-stream"),
vmime::charset("utf-8"), vmime::encoding("quoted-printable"));
diff --git a/tests/parser/charsetFilteredOutputStreamTest.cpp b/tests/parser/charsetFilteredOutputStreamTest.cpp
index 32c4c5f3..4c91a71c 100644
--- a/tests/parser/charsetFilteredOutputStreamTest.cpp
+++ b/tests/parser/charsetFilteredOutputStreamTest.cpp
@@ -42,12 +42,12 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest)
void testInputBufferUnderflow()
{
- vmime::ref <vmime::charsetConverter> cc =
+ vmime::shared_ptr <vmime::charsetConverter> cc =
vmime::charsetConverter::create("utf-8", "iso-8859-1");
vmime::string output;
vmime::utility::outputStreamStringAdapter os(output);
- vmime::ref <vmime::utility::filteredOutputStream> cfos = cc->getFilteredOutputStream(os);
+ vmime::shared_ptr <vmime::utility::filteredOutputStream> cfos = cc->getFilteredOutputStream(os);
VASSERT_NOT_NULL("filteredOutputStream availability", cfos);
@@ -73,12 +73,12 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest)
vmime::string actualOut;
vmime::utility::outputStreamStringAdapter osa(actualOut);
- vmime::ref <vmime::charsetConverter> conv =
+ vmime::shared_ptr <vmime::charsetConverter> conv =
vmime::charsetConverter::create
(vmime::charset("utf-8"),
vmime::charset("iso-8859-1"));
- vmime::ref <vmime::utility::charsetFilteredOutputStream> os =
+ vmime::shared_ptr <vmime::utility::charsetFilteredOutputStream> os =
conv->getFilteredOutputStream(osa);
VASSERT_NOT_NULL("filteredOutputStream availability", os);
@@ -114,10 +114,10 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest)
vmime::string actualOut;
vmime::utility::outputStreamStringAdapter osa(actualOut);
- vmime::ref <vmime::charsetConverter> conv =
+ vmime::shared_ptr <vmime::charsetConverter> conv =
vmime::charsetConverter::create(entry.fromCharset, entry.toCharset);
- vmime::ref <vmime::utility::charsetFilteredOutputStream> os =
+ vmime::shared_ptr <vmime::utility::charsetFilteredOutputStream> os =
conv->getFilteredOutputStream(osa);
VASSERT_NOT_NULL("filteredOutputStream availability", os);
@@ -151,10 +151,10 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest)
vmime::string actualOut;
vmime::utility::outputStreamStringAdapter osa(actualOut);
- vmime::ref <vmime::charsetConverter> conv =
+ vmime::shared_ptr <vmime::charsetConverter> conv =
vmime::charsetConverter::create(entry.fromCharset, entry.toCharset);
- vmime::ref <vmime::utility::charsetFilteredOutputStream> os =
+ vmime::shared_ptr <vmime::utility::charsetFilteredOutputStream> os =
conv->getFilteredOutputStream(osa);
VASSERT_NOT_NULL("filteredOutputStream availability", os);
@@ -191,10 +191,10 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest)
vmime::string actualOut;
vmime::utility::outputStreamStringAdapter osa(actualOut);
- vmime::ref <vmime::charsetConverter> conv =
+ vmime::shared_ptr <vmime::charsetConverter> conv =
vmime::charsetConverter::create(entry.fromCharset, entry.toCharset);
- vmime::ref <vmime::utility::charsetFilteredOutputStream> os =
+ vmime::shared_ptr <vmime::utility::charsetFilteredOutputStream> os =
conv->getFilteredOutputStream(osa);
VASSERT_NOT_NULL("filteredOutputStream availability", os);
diff --git a/tests/parser/fileContentHandlerTest.cpp b/tests/parser/fileContentHandlerTest.cpp
index b7373959..9d1459db 100644
--- a/tests/parser/fileContentHandlerTest.cpp
+++ b/tests/parser/fileContentHandlerTest.cpp
@@ -38,7 +38,7 @@ VMIME_TEST_SUITE_BEGIN(fileContentHandlerTest)
VMIME_TEST_LIST_END
- vmime::ref <vmime::utility::file> testFile;
+ vmime::shared_ptr <vmime::utility::file> testFile;
vmime::string testDataEncoded, testDataDecoded;
@@ -50,7 +50,7 @@ VMIME_TEST_SUITE_BEGIN(fileContentHandlerTest)
std::ostringstream testFilePath;
testFilePath << "/tmp/vmime_test_" << (rand() % 999999999);
- vmime::ref <vmime::utility::fileSystemFactory> fsf =
+ vmime::shared_ptr <vmime::utility::fileSystemFactory> fsf =
vmime::platform::getHandler()->getFileSystemFactory();
testFile = fsf->create(fsf->stringToPath(testFilePath.str()));
@@ -61,7 +61,7 @@ VMIME_TEST_SUITE_BEGIN(fileContentHandlerTest)
void tearDown()
{
testFile->remove();
- testFile = NULL;
+ testFile = vmime::null;
}
diff --git a/tests/parser/headerFieldTest.cpp b/tests/parser/headerFieldTest.cpp
index b551c781..5281a3a2 100644
--- a/tests/parser/headerFieldTest.cpp
+++ b/tests/parser/headerFieldTest.cpp
@@ -35,16 +35,17 @@ VMIME_TEST_SUITE_BEGIN(headerFieldTest)
void testBadValueType()
{
- vmime::headerFieldFactory *hfactory = vmime::headerFieldFactory::getInstance();
+ vmime::shared_ptr <vmime::headerFieldFactory> hfactory =
+ vmime::headerFieldFactory::getInstance();
// "To" header field accepts values of type "addressList"
- vmime::ref <vmime::headerField> to = hfactory->create(vmime::fields::TO);
+ vmime::shared_ptr <vmime::headerField> to = hfactory->create(vmime::fields::TO);
VASSERT_THROW("to",
to->setValue(vmime::mailbox("[email protected]")),
vmime::exceptions::bad_field_value_type);
// Unregistered header field accepts any value type
- vmime::ref <vmime::headerField> custom = hfactory->create("X-MyCustomHeader");
+ vmime::shared_ptr <vmime::headerField> custom = hfactory->create("X-MyCustomHeader");
VASSERT_NO_THROW("custom/1",
custom->setValue(vmime::mailbox("[email protected]")));
VASSERT_NO_THROW("custom/2",
@@ -57,11 +58,11 @@ VMIME_TEST_SUITE_BEGIN(headerFieldTest)
const vmime::string buffer = "Field: \r\n\tfield data";
- vmime::ref <vmime::headerField> hfield =
+ vmime::shared_ptr <vmime::headerField> hfield =
vmime::headerField::parseNext(ctx, buffer, 0, buffer.size());
- vmime::ref <vmime::text> hvalue =
- hfield->getValue().dynamicCast <vmime::text>();
+ vmime::shared_ptr <vmime::text> hvalue =
+ hfield->getValue <vmime::text>();
VASSERT_EQ("Field name", "Field", hfield->getName());
VASSERT_EQ("Field value", "field data", hvalue->getWholeBuffer());
@@ -73,11 +74,11 @@ VMIME_TEST_SUITE_BEGIN(headerFieldTest)
const vmime::string buffer = "Field: \r\n\tfield data ";
- vmime::ref <vmime::headerField> hfield =
+ vmime::shared_ptr <vmime::headerField> hfield =
vmime::headerField::parseNext(ctx, buffer, 0, buffer.size());
- vmime::ref <vmime::text> hvalue =
- hfield->getValue().dynamicCast <vmime::text>();
+ vmime::shared_ptr <vmime::text> hvalue =
+ hfield->getValue <vmime::text>();
VASSERT_EQ("Field name", "Field", hfield->getName());
VASSERT_EQ("Field value", toHex("field data"), toHex(hvalue->getWholeBuffer()));
diff --git a/tests/parser/headerTest.cpp b/tests/parser/headerTest.cpp
index 91eb03df..959fc631 100644
--- a/tests/parser/headerTest.cpp
+++ b/tests/parser/headerTest.cpp
@@ -100,10 +100,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("A", "a");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("A", "a");
hdr.appendField(hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(1), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -114,10 +114,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\n");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
hdr.appendField(hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(2), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -130,10 +130,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nC: c\r\n");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
hdr.insertFieldBefore(hdr.getField("C"), hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(3), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -146,10 +146,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nC: c\r\n");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
hdr.insertFieldBefore(1, hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(3), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -163,10 +163,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nC: c\r\n");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
hdr.insertFieldAfter(hdr.getField("A"), hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(3), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -179,10 +179,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nC: c\r\n");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("B", "b");
hdr.insertFieldAfter(0, hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(3), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -196,10 +196,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nB: b\r\nC: c\r\n");
- vmime::ref <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("Z", "z");
+ vmime::shared_ptr <vmime::headerField> hf = vmime::headerFieldFactory::getInstance()->create("Z", "z");
hdr.replaceField(hdr.getField("B"), hf);
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(3), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -217,13 +217,13 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
hdr1.removeField(hdr1.getField("B"));
hdr2.removeField(1);
- std::vector <vmime::ref <vmime::headerField> > res1 = hdr1.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res1 = hdr1.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(2), res1.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res1[0]));
VASSERT_EQ("Second value", "C: c", headerTest::getFieldValue(*res1[1]));
- std::vector <vmime::ref <vmime::headerField> > res2 = hdr2.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res2 = hdr2.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(2), res2.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res2[0]));
@@ -239,10 +239,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
hdr1.removeField(hdr1.getField("A"));
hdr2.removeField(0);
- std::vector <vmime::ref <vmime::headerField> > res1 = hdr1.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res1 = hdr1.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(0), res1.size());
- std::vector <vmime::ref <vmime::headerField> > res2 = hdr2.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res2 = hdr2.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(0), res2.size());
}
@@ -256,10 +256,10 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
hdr1.removeAllFields();
hdr2.removeAllFields();
- std::vector <vmime::ref <vmime::headerField> > res1 = hdr1.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res1 = hdr1.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(0), res1.size());
- std::vector <vmime::ref <vmime::headerField> > res2 = hdr2.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res2 = hdr2.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(0), res2.size());
}
@@ -295,7 +295,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("B: b\r\nA: a\r\nC: c\r\n");
- vmime::ref <vmime::headerField> res = hdr.getFieldAt(2);
+ vmime::shared_ptr <vmime::headerField> res = hdr.getFieldAt(2);
VASSERT_EQ("Value", "C: c", getFieldValue(*res));
}
@@ -306,7 +306,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nB: b1\r\nC: c\r\nB: b2\r\n");
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(4), res.size());
VASSERT_EQ("First value", "A: a", headerTest::getFieldValue(*res[0]));
@@ -320,7 +320,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("\r\n");
- std::vector <vmime::ref <vmime::headerField> > res = hdr.getFieldList();
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.getFieldList();
VASSERT_EQ("Count", static_cast <unsigned int>(0), res.size());
}
@@ -331,7 +331,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a\r\nB: b\r\nC: c\r\nB: d\r\n");
- vmime::ref <vmime::headerField> res = hdr.findField("B");
+ vmime::shared_ptr <vmime::headerField> res = hdr.findField("B");
VASSERT_EQ("Value", "B: b", getFieldValue(*res));
}
@@ -342,7 +342,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a1\nC: c1\n");
- std::vector <vmime::ref <vmime::headerField> > res = hdr.findAllFields("B");
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.findAllFields("B");
VASSERT_EQ("Count", static_cast <unsigned int>(0), res.size());
}
@@ -352,7 +352,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a1\nB: b1\nB: b2\nC: c1\n");
- std::vector <vmime::ref <vmime::headerField> > res = hdr.findAllFields("B");
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.findAllFields("B");
VASSERT_EQ("Count", static_cast <unsigned int>(2), res.size());
VASSERT_EQ("First value", "B: b1", headerTest::getFieldValue(*res[0]));
@@ -364,7 +364,7 @@ VMIME_TEST_SUITE_BEGIN(headerTest)
vmime::header hdr;
hdr.parse("A: a1\nB: b1\nB: b2\nC: c1\nC: c3\nC: c2\n");
- std::vector <vmime::ref <vmime::headerField> > res = hdr.findAllFields("C");
+ std::vector <vmime::shared_ptr <vmime::headerField> > res = hdr.findAllFields("C");
VASSERT_EQ("Count", static_cast <unsigned int>(3), res.size());
VASSERT_EQ("First value", "C: c1", headerTest::getFieldValue(*res[0]));
diff --git a/tests/parser/htmlTextPartTest.cpp b/tests/parser/htmlTextPartTest.cpp
index 0eb7bbaf..278a87c1 100644
--- a/tests/parser/htmlTextPartTest.cpp
+++ b/tests/parser/htmlTextPartTest.cpp
@@ -35,7 +35,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest)
static const vmime::string extractContent
- (vmime::ref <const vmime::contentHandler> cth)
+ (vmime::shared_ptr <const vmime::contentHandler> cth)
{
std::ostringstream oss;
vmime::utility::outputStreamAdapter osa(oss);
@@ -74,7 +74,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest)
"--LEVEL1--\r\n"
"";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(msgString);
// Sanity checks
@@ -129,7 +129,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest)
"--LEVEL1--\r\n"
"";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(msgString);
// Sanity checks
@@ -153,7 +153,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest)
VASSERT_EQ("has-obj2-pre", true, htmlPart.hasObject("cid:image2@test"));
// Check data in objects
- vmime::ref <const vmime::htmlTextPart::embeddedObject> obj;
+ vmime::shared_ptr <const vmime::htmlTextPart::embeddedObject> obj;
obj = htmlPart.findObject("image1@test");
@@ -201,7 +201,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest)
"--LEVEL1--\r\n"
"";
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->parse(msgString);
// Sanity checks
@@ -221,7 +221,7 @@ VMIME_TEST_SUITE_BEGIN(htmlTextPartTest)
VASSERT_EQ("has-obj-cid", false, htmlPart.hasObject("image1@test"));
// Check data
- vmime::ref <const vmime::htmlTextPart::embeddedObject> obj;
+ vmime::shared_ptr <const vmime::htmlTextPart::embeddedObject> obj;
obj = htmlPart.findObject("http://www.vmime.org/test/image1.png");
diff --git a/tests/parser/mailboxGroupTest.cpp b/tests/parser/mailboxGroupTest.cpp
index 49d22658..6c1319da 100644
--- a/tests/parser/mailboxGroupTest.cpp
+++ b/tests/parser/mailboxGroupTest.cpp
@@ -57,8 +57,8 @@ VMIME_TEST_SUITE_BEGIN(mailboxGroupTest)
VASSERT_EQ("count", 1, addrs.getAddressCount());
VASSERT_TRUE("is group", addrs.getAddressAt(0)->isGroup());
- vmime::ref <vmime::mailboxGroup> mgrp =
- addrs.getAddressAt(0).dynamicCast <vmime::mailboxGroup>();
+ vmime::shared_ptr <vmime::mailboxGroup> mgrp =
+ vmime::dynamicCast <vmime::mailboxGroup>(addrs.getAddressAt(0));
VASSERT_EQ("name", "group", mgrp->getName().getWholeBuffer());
VASSERT_EQ("count", 2, mgrp->getMailboxCount());
diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
index e6e4a608..6bf6670c 100644
--- a/tests/parser/mailboxTest.cpp
+++ b/tests/parser/mailboxTest.cpp
@@ -119,7 +119,8 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
VASSERT_EQ("count", 1, addrList.getAddressCount());
VASSERT_EQ("!group", false, addrList.getAddressAt(0)->isGroup());
- vmime::ref <vmime::mailbox> mbox = addrList.getAddressAt(0).dynamicCast <vmime::mailbox>();
+ vmime::shared_ptr <vmime::mailbox> mbox =
+ vmime::dynamicCast <vmime::mailbox>(addrList.getAddressAt(0));
VASSERT_EQ("name", "Full Name", mbox->getName());
VASSERT_EQ("email", "", mbox->getEmail());
@@ -132,8 +133,10 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
VASSERT_EQ("count", 2, addrList.getAddressCount());
- vmime::ref <vmime::mailbox> mbox1 = addrList.getAddressAt(0).dynamicCast <vmime::mailbox>();
- vmime::ref <vmime::mailbox> mbox2 = addrList.getAddressAt(1).dynamicCast <vmime::mailbox>();
+ vmime::shared_ptr <vmime::mailbox> mbox1 =
+ vmime::dynamicCast <vmime::mailbox>(addrList.getAddressAt(0));
+ vmime::shared_ptr <vmime::mailbox> mbox2 =
+ vmime::dynamicCast <vmime::mailbox>(addrList.getAddressAt(1));
VASSERT_EQ("name1", vmime::text(), mbox1->getName());
VASSERT_EQ("email1", "[email protected]", mbox1->getEmail());
diff --git a/tests/parser/messageIdSequenceTest.cpp b/tests/parser/messageIdSequenceTest.cpp
index ed6d0be3..bc5c7617 100644
--- a/tests/parser/messageIdSequenceTest.cpp
+++ b/tests/parser/messageIdSequenceTest.cpp
@@ -64,13 +64,13 @@ VMIME_TEST_SUITE_BEGIN(messageIdSequenceTest)
void testGenerate()
{
vmime::messageIdSequence s1;
- s1.appendMessageId(vmime::create <vmime::messageId>("a", "b"));
+ s1.appendMessageId(vmime::make_shared <vmime::messageId>("a", "b"));
VASSERT_EQ("1", "<a@b>", s1.generate());
vmime::messageIdSequence s2;
- s2.appendMessageId(vmime::create <vmime::messageId>("a", "b"));
- s2.appendMessageId(vmime::create <vmime::messageId>("c", "d"));
+ s2.appendMessageId(vmime::make_shared <vmime::messageId>("a", "b"));
+ s2.appendMessageId(vmime::make_shared <vmime::messageId>("c", "d"));
VASSERT_EQ("2", "<a@b> <c@d>", s2.generate());
}
diff --git a/tests/parser/messageTest.cpp b/tests/parser/messageTest.cpp
index 56605e39..a7a16813 100644
--- a/tests/parser/messageTest.cpp
+++ b/tests/parser/messageTest.cpp
@@ -35,12 +35,12 @@ VMIME_TEST_SUITE_BEGIN(messageTest)
{
vmime::generationContext ctx;
- vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
+ vmime::shared_ptr <vmime::message> msg = vmime::make_shared <vmime::message>();
msg->getHeader()->getField("Foo")->setValue(vmime::string("bar"));
vmime::htmlTextPart textPart;
- textPart.setPlainText(vmime::create <vmime::stringContentHandler>("Foo bar bazé foo foo foo"));
- textPart.setText(vmime::create <vmime::stringContentHandler>("Foo bar <strong>bazé</strong> foo foo foo"));
+ textPart.setPlainText(vmime::make_shared <vmime::stringContentHandler>("Foo bar bazé foo foo foo"));
+ textPart.setText(vmime::make_shared <vmime::stringContentHandler>("Foo bar <strong>bazé</strong> foo foo foo"));
textPart.generateIn(msg, msg);
// Estimated/computed generated size must be greater than the actual generated size
diff --git a/tests/parser/parameterTest.cpp b/tests/parser/parameterTest.cpp
index 3ebd6e35..3b0edebf 100644
--- a/tests/parser/parameterTest.cpp
+++ b/tests/parser/parameterTest.cpp
@@ -197,19 +197,19 @@ VMIME_TEST_SUITE_BEGIN(parameterTest)
{
// Simple parameter/value
parameterizedHeaderField p1;
- p1.appendParameter(vmime::create <vmime::parameter>("param1", "value1"));
+ p1.appendParameter(vmime::make_shared <vmime::parameter>("param1", "value1"));
VASSERT_EQ("1", "F: X; param1=value1", p1.generate());
// Value that needs quoting (1/2)
parameterizedHeaderField p2a;
- p2a.appendParameter(vmime::create <vmime::parameter>("param1", "value1a;value1b"));
+ p2a.appendParameter(vmime::make_shared <vmime::parameter>("param1", "value1a;value1b"));
VASSERT_EQ("2a", "F: X; param1=\"value1a;value1b\"", p2a.generate());
// Value that needs quoting (2/2)
parameterizedHeaderField p2b;
- p2b.appendParameter(vmime::create <vmime::parameter>("param1", "va\\lue\"1"));
+ p2b.appendParameter(vmime::make_shared <vmime::parameter>("param1", "va\\lue\"1"));
VASSERT_EQ("2b", "F: X; param1=\"va\\\\lue\\\"1\"", p2b.generate());
}
@@ -218,7 +218,7 @@ VMIME_TEST_SUITE_BEGIN(parameterTest)
{
// Extended parameter with charset specifier
parameterizedHeaderField p1;
- p1.appendParameter(vmime::create <vmime::parameter>("param1",
+ p1.appendParameter(vmime::make_shared <vmime::parameter>("param1",
vmime::word("value 1\xe9", vmime::charset("charset"))));
#if VMIME_ALWAYS_GENERATE_7BIT_PARAMETER
@@ -229,7 +229,7 @@ VMIME_TEST_SUITE_BEGIN(parameterTest)
// Value that spans on multiple lines
parameterizedHeaderField p2;
- p2.appendParameter(vmime::create <vmime::parameter>("param1",
+ p2.appendParameter(vmime::make_shared <vmime::parameter>("param1",
vmime::word("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
vmime::charset("charset"))));
@@ -256,7 +256,7 @@ VMIME_TEST_SUITE_BEGIN(parameterTest)
// Non-ASCII parameter value
parameterizedHeaderField p3;
- p3.appendParameter(vmime::create <vmime::parameter>("param1",
+ p3.appendParameter(vmime::make_shared <vmime::parameter>("param1",
vmime::word("δσσσσσσσσσσσσσσσσσσσσδσδα δσαδσδσαδσαδασδασ δσαδασδσα δσαδασδσα δασδασδασ δασαχφδδσα 2008.doc",
vmime::charset("utf-8"))));
@@ -325,28 +325,28 @@ VMIME_TEST_SUITE_BEGIN(parameterTest)
// Encode "tspecials"
void testEncodeTSpecials()
{
- VASSERT_EQ(" 1", "p=\"val(ue\"", vmime::create <vmime::parameter>("p", "val(ue")->generate());
- VASSERT_EQ(" 2", "p=\"val)ue\"", vmime::create <vmime::parameter>("p", "val)ue")->generate());
- VASSERT_EQ(" 3", "p=\"val<ue\"", vmime::create <vmime::parameter>("p", "val<ue")->generate());
- VASSERT_EQ(" 4", "p=\"val>ue\"", vmime::create <vmime::parameter>("p", "val>ue")->generate());
- VASSERT_EQ(" 5", "p=\"val@ue\"", vmime::create <vmime::parameter>("p", "val@ue")->generate());
- VASSERT_EQ(" 6", "p=\"val,ue\"", vmime::create <vmime::parameter>("p", "val,ue")->generate());
- VASSERT_EQ(" 7", "p=\"val;ue\"", vmime::create <vmime::parameter>("p", "val;ue")->generate());
- VASSERT_EQ(" 8", "p=\"val:ue\"", vmime::create <vmime::parameter>("p", "val:ue")->generate());
- VASSERT_EQ(" 9", "p=\"val/ue\"", vmime::create <vmime::parameter>("p", "val/ue")->generate());
- VASSERT_EQ("10", "p=\"val[ue\"", vmime::create <vmime::parameter>("p", "val[ue")->generate());
- VASSERT_EQ("11", "p=\"val]ue\"", vmime::create <vmime::parameter>("p", "val]ue")->generate());
- VASSERT_EQ("12", "p=\"val?ue\"", vmime::create <vmime::parameter>("p", "val?ue")->generate());
- VASSERT_EQ("13", "p=\"val=ue\"", vmime::create <vmime::parameter>("p", "val=ue")->generate());
- VASSERT_EQ("14", "p=\"val ue\"", vmime::create <vmime::parameter>("p", "val ue")->generate());
- VASSERT_EQ("15", "p=\"val\tue\"", vmime::create <vmime::parameter>("p", "val\tue")->generate());
+ VASSERT_EQ(" 1", "p=\"val(ue\"", vmime::make_shared <vmime::parameter>("p", "val(ue")->generate());
+ VASSERT_EQ(" 2", "p=\"val)ue\"", vmime::make_shared <vmime::parameter>("p", "val)ue")->generate());
+ VASSERT_EQ(" 3", "p=\"val<ue\"", vmime::make_shared <vmime::parameter>("p", "val<ue")->generate());
+ VASSERT_EQ(" 4", "p=\"val>ue\"", vmime::make_shared <vmime::parameter>("p", "val>ue")->generate());
+ VASSERT_EQ(" 5", "p=\"val@ue\"", vmime::make_shared <vmime::parameter>("p", "val@ue")->generate());
+ VASSERT_EQ(" 6", "p=\"val,ue\"", vmime::make_shared <vmime::parameter>("p", "val,ue")->generate());
+ VASSERT_EQ(" 7", "p=\"val;ue\"", vmime::make_shared <vmime::parameter>("p", "val;ue")->generate());
+ VASSERT_EQ(" 8", "p=\"val:ue\"", vmime::make_shared <vmime::parameter>("p", "val:ue")->generate());
+ VASSERT_EQ(" 9", "p=\"val/ue\"", vmime::make_shared <vmime::parameter>("p", "val/ue")->generate());
+ VASSERT_EQ("10", "p=\"val[ue\"", vmime::make_shared <vmime::parameter>("p", "val[ue")->generate());
+ VASSERT_EQ("11", "p=\"val]ue\"", vmime::make_shared <vmime::parameter>("p", "val]ue")->generate());
+ VASSERT_EQ("12", "p=\"val?ue\"", vmime::make_shared <vmime::parameter>("p", "val?ue")->generate());
+ VASSERT_EQ("13", "p=\"val=ue\"", vmime::make_shared <vmime::parameter>("p", "val=ue")->generate());
+ VASSERT_EQ("14", "p=\"val ue\"", vmime::make_shared <vmime::parameter>("p", "val ue")->generate());
+ VASSERT_EQ("15", "p=\"val\tue\"", vmime::make_shared <vmime::parameter>("p", "val\tue")->generate());
}
// http://sourceforge.net/projects/vmime/forums/forum/237356/topic/3812278
void testEncodeTSpecialsInRFC2231()
{
VASSERT_EQ("1", "filename*=UTF-8''my_file_name_%C3%B6%C3%A4%C3%BC_%281%29.txt",
- vmime::create <vmime::parameter>("filename", "my_file_name_\xc3\xb6\xc3\xa4\xc3\xbc_(1).txt")->generate());
+ vmime::make_shared <vmime::parameter>("filename", "my_file_name_\xc3\xb6\xc3\xa4\xc3\xbc_(1).txt")->generate());
}
void testWhitespaceBreaksTheValue()
diff --git a/tests/parser/streamContentHandlerTest.cpp b/tests/parser/streamContentHandlerTest.cpp
index 75b3d4d4..55680c93 100644
--- a/tests/parser/streamContentHandlerTest.cpp
+++ b/tests/parser/streamContentHandlerTest.cpp
@@ -51,8 +51,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
void testGetLength()
{
vmime::string data("Test Data");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length());
@@ -63,8 +63,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
void testIsEncoded()
{
vmime::string data("Test Data");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length());
@@ -73,8 +73,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
vmime::string data2("Zm9vEjRWYmFy=");
- vmime::ref <vmime::utility::inputStream> stream2 =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data2);
+ vmime::shared_ptr <vmime::utility::inputStream> stream2 =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data2);
vmime::streamContentHandler cth2(stream2, data2.length(), vmime::encoding("base64"));
@@ -85,8 +85,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
void testGetLength_Encoded()
{
vmime::string data("foo=12=34=56bar");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length(), vmime::encoding("quoted-printable"));
@@ -97,8 +97,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
void testExtract()
{
vmime::string data("Test Data");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length());
@@ -114,8 +114,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
{
vmime::string data
("QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODk=");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length(), vmime::encoding("base64"));
@@ -133,8 +133,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
{
vmime::string data
("QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODk=");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length(), vmime::encoding("base64"));
@@ -151,8 +151,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
void testGenerate()
{
vmime::string data("foo\x12\x34\x56 bar");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length());
@@ -168,8 +168,8 @@ VMIME_TEST_SUITE_BEGIN(streamContentHandlerTest)
void testGenerate_Encoded()
{
vmime::string data("foo=12=34=56bar");
- vmime::ref <vmime::utility::inputStream> stream =
- vmime::create <vmime::utility::inputStreamStringAdapter>(data);
+ vmime::shared_ptr <vmime::utility::inputStream> stream =
+ vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);
vmime::streamContentHandler cth(stream, data.length(), vmime::encoding("quoted-printable"));
diff --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp
index f4f30b1b..274687a5 100644
--- a/tests/parser/textTest.cpp
+++ b/tests/parser/textTest.cpp
@@ -104,7 +104,7 @@ VMIME_TEST_SUITE_BEGIN(textTest)
VASSERT_EQ("4.3", w1.getCharset(), t4.getWordAt(0)->getCharset());
vmime::word w2("Other", vmime::charset(vmime::charsets::US_ASCII));
- t4.appendWord(vmime::create <vmime::word>(w2));
+ t4.appendWord(vmime::make_shared <vmime::word>(w2));
vmime::text t5(t4);
@@ -296,8 +296,8 @@ VMIME_TEST_SUITE_BEGIN(textTest)
// White-space between two encoded words
vmime::text txt;
- txt.appendWord(vmime::create <vmime::word>("\xc3\x89t\xc3\xa9", "utf-8"));
- txt.appendWord(vmime::create <vmime::word>("Fran\xc3\xa7ois", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>("\xc3\x89t\xc3\xa9", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>("Fran\xc3\xa7ois", "utf-8"));
const vmime::string decoded = "\xc3\x89t\xc3\xa9""Fran\xc3\xa7ois";
const vmime::string encoded = "=?utf-8?B?w4l0w6k=?= =?utf-8?Q?Fran=C3=A7ois?=";
@@ -319,11 +319,11 @@ VMIME_TEST_SUITE_BEGIN(textTest)
{
// White-space between two encoded words (#2)
vmime::text txt;
- txt.appendWord(vmime::create <vmime::word>("Facture ", "utf-8"));
- txt.appendWord(vmime::create <vmime::word>("\xc3\xa0", "utf-8"));
- txt.appendWord(vmime::create <vmime::word>(" envoyer ", "utf-8"));
- txt.appendWord(vmime::create <vmime::word>("\xc3\xa0", "utf-8"));
- txt.appendWord(vmime::create <vmime::word>(" Martine", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>("Facture ", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>("\xc3\xa0", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>(" envoyer ", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>("\xc3\xa0", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>(" Martine", "utf-8"));
const vmime::string decoded = "Facture ""\xc3\xa0"" envoyer ""\xc3\xa0"" Martine";
const vmime::string encoded = "Facture =?utf-8?B?w6A=?= envoyer =?utf-8?B?w6A=?= Martine";
@@ -422,8 +422,8 @@ VMIME_TEST_SUITE_BEGIN(textTest)
VASSERT_EQ("generate1", "=?us-ascii?Q?Achim_?= =?utf-8?Q?Br=C3=A4ndt?= <[email protected]>", mbox.generate());
vmime::text txt;
- txt.appendWord(vmime::create <vmime::word>("Achim ", "us-ascii"));
- txt.appendWord(vmime::create <vmime::word>("Br\xc3\xa4ndt", "utf-8"));
+ txt.appendWord(vmime::make_shared <vmime::word>("Achim ", "us-ascii"));
+ txt.appendWord(vmime::make_shared <vmime::word>("Br\xc3\xa4ndt", "utf-8"));
mbox = vmime::mailbox(txt, "[email protected]");
VASSERT_EQ("generate2", "=?us-ascii?Q?Achim_?= =?utf-8?Q?Br=C3=A4ndt?= <[email protected]>", mbox.generate());
diff --git a/tests/security/digest/md5Test.cpp b/tests/security/digest/md5Test.cpp
index ec4e62b2..c7f0b521 100644
--- a/tests/security/digest/md5Test.cpp
+++ b/tests/security/digest/md5Test.cpp
@@ -27,7 +27,7 @@
#define INIT_DIGEST(var, algo) \
- vmime::ref <vmime::security::digest::messageDigest> var = \
+ vmime::shared_ptr <vmime::security::digest::messageDigest> var = \
vmime::security::digest::messageDigestFactory::getInstance()->create(algo)
diff --git a/tests/security/digest/sha1Test.cpp b/tests/security/digest/sha1Test.cpp
index 2accf8c7..c6ce1e65 100644
--- a/tests/security/digest/sha1Test.cpp
+++ b/tests/security/digest/sha1Test.cpp
@@ -27,7 +27,7 @@
#define INIT_DIGEST(var, algo) \
- vmime::ref <vmime::security::digest::messageDigest> var = \
+ vmime::shared_ptr <vmime::security::digest::messageDigest> var = \
vmime::security::digest::messageDigestFactory::getInstance()->create(algo)
diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp
index 93cb9e38..c22649e6 100644
--- a/tests/testUtils.cpp
+++ b/tests/testUtils.cpp
@@ -243,9 +243,9 @@ bool testTimeoutHandler::handleTimeOut()
// testTimeoutHandlerFactory : public vmime::net::timeoutHandlerFactory
-vmime::ref <vmime::net::timeoutHandler> testTimeoutHandlerFactory::create()
+vmime::shared_ptr <vmime::net::timeoutHandler> testTimeoutHandlerFactory::create()
{
- return vmime::create <testTimeoutHandler>();
+ return vmime::make_shared <testTimeoutHandler>();
}
diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp
index 01910cbc..fdcca575 100644
--- a/tests/testUtils.hpp
+++ b/tests/testUtils.hpp
@@ -315,14 +315,14 @@ class testSocketFactory : public vmime::net::socketFactory
{
public:
- vmime::ref <vmime::net::socket> create()
+ vmime::shared_ptr <vmime::net::socket> create()
{
- return vmime::create <T>();
+ return vmime::make_shared <T>();
}
- vmime::ref <vmime::net::socket> create(vmime::ref <vmime::net::timeoutHandler> /* th */)
+ vmime::shared_ptr <vmime::net::socket> create(vmime::shared_ptr <vmime::net::timeoutHandler> /* th */)
{
- return vmime::create <T>();
+ return vmime::make_shared <T>();
}
};
@@ -366,7 +366,7 @@ class testTimeoutHandlerFactory : public vmime::net::timeoutHandlerFactory
{
public:
- vmime::ref <vmime::net::timeoutHandler> create();
+ vmime::shared_ptr <vmime::net::timeoutHandler> create();
};
diff --git a/tests/utility/encoder/encoderTestUtils.hpp b/tests/utility/encoder/encoderTestUtils.hpp
index 0eb93871..d74c4709 100644
--- a/tests/utility/encoder/encoderTestUtils.hpp
+++ b/tests/utility/encoder/encoderTestUtils.hpp
@@ -23,10 +23,10 @@
// Helper function to obtain an encoder given its name
-static vmime::ref <vmime::utility::encoder::encoder> getEncoder(const vmime::string& name,
+static vmime::shared_ptr <vmime::utility::encoder::encoder> getEncoder(const vmime::string& name,
int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet())
{
- vmime::ref <vmime::utility::encoder::encoder> enc =
+ vmime::shared_ptr <vmime::utility::encoder::encoder> enc =
vmime::utility::encoder::encoderFactory::getInstance()->create(name);
enc->getProperties() = props;
@@ -42,7 +42,7 @@ static vmime::ref <vmime::utility::encoder::encoder> getEncoder(const vmime::str
static const vmime::string encode(const vmime::string& name, const vmime::string& in,
int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet())
{
- vmime::ref <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength, props);
+ vmime::shared_ptr <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength, props);
vmime::utility::inputStreamStringAdapter vin(in);
@@ -58,7 +58,7 @@ static const vmime::string encode(const vmime::string& name, const vmime::string
// Decoding helper function
static const vmime::string decode(const vmime::string& name, const vmime::string& in, int maxLineLength = 0)
{
- vmime::ref <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength);
+ vmime::shared_ptr <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength);
vmime::utility::inputStreamStringAdapter vin(in);
diff --git a/tests/utility/outputStreamSocketAdapterTest.cpp b/tests/utility/outputStreamSocketAdapterTest.cpp
index 920c7f47..417eff8b 100644
--- a/tests/utility/outputStreamSocketAdapterTest.cpp
+++ b/tests/utility/outputStreamSocketAdapterTest.cpp
@@ -37,7 +37,7 @@ VMIME_TEST_SUITE_BEGIN(outputStreamSocketAdapterTest)
void testWrite()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
vmime::utility::outputStreamSocketAdapter stream(*socket);
stream << "some data";
@@ -55,7 +55,7 @@ VMIME_TEST_SUITE_BEGIN(outputStreamSocketAdapterTest)
"\xc5\x9a\xc3\xb8\xc9\xb1\xc9\x9b\x20\xc9\x93\xc9\xa8\xc9\xb2\xc9"
"\x91\xc5\x95\xc9\xa3\x20\xc9\x96\xc9\x90\xca\x88\xc9\x92";
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
vmime::utility::outputStreamSocketAdapter stream(*socket);
stream.write(binaryData, sizeof(binaryData));
@@ -69,7 +69,7 @@ VMIME_TEST_SUITE_BEGIN(outputStreamSocketAdapterTest)
void testWriteCRLF()
{
- vmime::ref <testSocket> socket = vmime::create <testSocket>();
+ vmime::shared_ptr <testSocket> socket = vmime::make_shared <testSocket>();
vmime::utility::outputStreamSocketAdapter stream(*socket);
stream << "some data";
diff --git a/tests/utility/seekableInputStreamRegionAdapterTest.cpp b/tests/utility/seekableInputStreamRegionAdapterTest.cpp
index 3ed024e8..1c33c056 100644
--- a/tests/utility/seekableInputStreamRegionAdapterTest.cpp
+++ b/tests/utility/seekableInputStreamRegionAdapterTest.cpp
@@ -42,16 +42,16 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
VMIME_TEST_LIST_END
- vmime::ref <seekableInputStreamRegionAdapter> createStream
- (vmime::ref <seekableInputStream>* underlyingStream = NULL)
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> createStream
+ (vmime::shared_ptr <seekableInputStream>* underlyingStream = NULL)
{
vmime::string buffer("THIS IS A TEST BUFFER");
- vmime::ref <seekableInputStream> strStream =
- vmime::create <inputStreamStringAdapter>(buffer);
+ vmime::shared_ptr <seekableInputStream> strStream =
+ vmime::make_shared <inputStreamStringAdapter>(buffer);
- vmime::ref <seekableInputStreamRegionAdapter> rgnStream =
- vmime::create <seekableInputStreamRegionAdapter>(strStream, 10, 11);
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> rgnStream =
+ vmime::make_shared <seekableInputStreamRegionAdapter>(strStream, 10, 11);
if (underlyingStream)
*underlyingStream = strStream;
@@ -61,7 +61,7 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
void testInitialPosition()
{
- vmime::ref <seekableInputStreamRegionAdapter> stream = createStream();
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> stream = createStream();
VASSERT_EQ("Pos", 0, stream->getPosition());
VASSERT_FALSE("EOF", stream->eof());
@@ -69,7 +69,7 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
void testSeekAndGetPosition()
{
- vmime::ref <seekableInputStreamRegionAdapter> stream = createStream();
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> stream = createStream();
stream->seek(5);
@@ -84,11 +84,12 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
void testRead()
{
- vmime::ref <seekableInputStreamRegionAdapter> stream = createStream();
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> stream = createStream();
stream->seek(5);
stream::value_type buffer[100];
+ std::fill(vmime::begin(buffer), vmime::end(buffer), 0);
stream::size_type read = stream->read(buffer, 6);
VASSERT_EQ("Pos", 11, stream->getPosition());
@@ -99,7 +100,7 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
void testSkip()
{
- vmime::ref <seekableInputStreamRegionAdapter> stream = createStream();
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> stream = createStream();
stream->skip(5);
@@ -107,6 +108,7 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
VASSERT_FALSE("EOF 1", stream->eof());
stream::value_type buffer[100];
+ std::fill(vmime::begin(buffer), vmime::end(buffer), 0);
stream::size_type read = stream->read(buffer, 3);
VASSERT_EQ("Pos 2", 8, stream->getPosition());
@@ -122,7 +124,7 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
void testReset()
{
- vmime::ref <seekableInputStreamRegionAdapter> stream = createStream();
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> stream = createStream();
stream->skip(100);
stream->reset();
@@ -136,15 +138,17 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
// seekableInputStreamRegionAdapter should keep track of its own position
// in the underlying stream, and not be affected by possible seek/read
// operations on it...
- vmime::ref <seekableInputStream> ustream;
- vmime::ref <seekableInputStreamRegionAdapter> stream = createStream(&ustream);
+ vmime::shared_ptr <seekableInputStream> ustream;
+ vmime::shared_ptr <seekableInputStreamRegionAdapter> stream = createStream(&ustream);
stream->seek(5);
stream::value_type buffer1[100];
+ std::fill(vmime::begin(buffer1), vmime::end(buffer1), 0);
stream::size_type read = ustream->read(buffer1, 7);
stream::value_type buffer2[100];
+ std::fill(vmime::begin(buffer2), vmime::end(buffer2), 0);
stream::size_type read2 = stream->read(buffer2, 6);
VASSERT_EQ("Buffer 1", "THIS IS", vmime::string(buffer1, 0, 7));
diff --git a/tests/utility/smartPtrTest.cpp b/tests/utility/smartPtrTest.cpp
deleted file mode 100644
index 584adf3b..00000000
--- a/tests/utility/smartPtrTest.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-//
-// VMime library (http://www.vmime.org)
-// Copyright (C) 2002-2013 Vincent Richard <[email protected]>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 3 of
-// the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// Linking this library statically or dynamically with other modules is making
-// a combined work based on this library. Thus, the terms and conditions of
-// the GNU General Public License cover the whole combination.
-//
-
-#include "tests/testUtils.hpp"
-
-#include "vmime/utility/smartPtr.hpp"
-
-
-VMIME_TEST_SUITE_BEGIN(smartPtrTest)
-
- VMIME_TEST_LIST_BEGIN
- VMIME_TEST(testNull)
- VMIME_TEST(testRefCounting)
- VMIME_TEST(testWeakRef)
- VMIME_TEST(testCast)
- VMIME_TEST(testContainer)
- VMIME_TEST(testCompare)
- VMIME_TEST_LIST_END
-
-
- struct A : public vmime::object
- {
- int strongCount() const { return getRefManager()->getStrongRefCount(); }
- int weakCount() const { return getRefManager()->getWeakRefCount(); }
- };
-
- struct B : public virtual A { };
- struct C : public virtual A { };
- struct D : public B, public C { };
-
- class R : public A
- {
- public:
-
- R(bool* aliveFlag) : m_aliveFlag(aliveFlag) { *m_aliveFlag = true; }
- ~R() { *m_aliveFlag = false; }
-
- private:
-
- bool* m_aliveFlag;
- };
-
-
- void testNull()
- {
- vmime::ref <A> r1;
-
- VASSERT("1", r1 == NULL);
- VASSERT("2", r1 == 0);
- VASSERT("3", NULL == r1);
- VASSERT("4", 0 == r1);
- VASSERT("5", !r1);
- VASSERT("6", r1 == vmime::null);
- VASSERT("7", vmime::null == r1);
- VASSERT_EQ("8", static_cast <A*>(0), r1.get());
- }
-
- void testRefCounting()
- {
- bool o1_alive;
- vmime::ref <R> r1 = vmime::create <R>(&o1_alive);
-
- VASSERT("1", r1.get() != 0);
- VASSERT("2", o1_alive);
- VASSERT_EQ("3", 1, r1->strongCount());
- VASSERT_EQ("4", 1, r1->weakCount());
-
- vmime::ref <R> r2 = r1;
-
- VASSERT("5", o1_alive);
- VASSERT_EQ("6", 2, r1->strongCount());
- VASSERT_EQ("7", 2, r1->weakCount());
-
- bool o2_alive;
- vmime::ref <R> r3 = vmime::create <R>(&o2_alive);
-
- r2 = r3;
-
- VASSERT("8", o1_alive);
- VASSERT("9", o2_alive);
- VASSERT_EQ("10", 1, r1->strongCount());
- VASSERT_EQ("11", 2, r2->strongCount());
- VASSERT_EQ("12", 2, r3->strongCount());
-
- {
- vmime::ref <R> r4;
-
- r4 = r1;
-
- VASSERT("13", o1_alive);
- VASSERT("14", o2_alive);
- VASSERT_EQ("15", 2, r4->strongCount());
- VASSERT_EQ("16", 2, r1->strongCount());
-
- r1 = NULL;
-
- VASSERT("17", o1_alive);
- VASSERT("18", o2_alive);
- VASSERT_EQ("19", 1, r4->strongCount());
-
- // Here, object1 will be deleted
- }
-
- VASSERT("20", !o1_alive);
- VASSERT("21", o2_alive);
-
- {
- vmime::weak_ref <R> w1 = r3;
-
- VASSERT_EQ("22", 3, r3->weakCount());
- }
-
- VASSERT("23", o2_alive);
- VASSERT_EQ("24", 2, r3->strongCount());
- VASSERT_EQ("25", 2, r3->weakCount());
- }
-
- void testWeakRef()
- {
- vmime::ref <A> r1 = vmime::create <A>();
- vmime::weak_ref <A> w1 = r1;
-
- VASSERT("1", r1.get() != 0);
- VASSERT("2", r1.get() == w1.acquire().get());
-
- {
- vmime::ref <A> r2 = r1;
-
- VASSERT("3", r1.get() == r2.get());
- VASSERT("4", r1.get() == w1.acquire().get());
- }
-
- VASSERT("5", r1.get() != 0);
- VASSERT("6", r1.get() == w1.acquire().get());
-
- r1 = 0;
-
- VASSERT("7", w1.acquire().get() == 0);
- }
-
- void testCast()
- {
- // Explicit upcast
- vmime::ref <A> r1 = vmime::create <C>();
- vmime::ref <C> r2 = r1.dynamicCast <C>();
-
- VASSERT("1", r2.get() == dynamic_cast <C*>(r1.get()));
- VASSERT("2", 0 == r1.dynamicCast <B>().get());
-
- // Implicit downcast
- vmime::ref <D> r3 = vmime::create <D>();
- vmime::ref <A> r4 = r3;
-
- VASSERT("3", r4.get() == dynamic_cast <A*>(r3.get()));
- }
-
- void testContainer()
- {
- bool o1_alive;
- vmime::ref <R> r1 = vmime::create <R>(&o1_alive);
-
- bool o2_alive;
- vmime::ref <R> r2 = vmime::create <R>(&o2_alive);
-
- std::vector <vmime::ref <R> > v1;
- v1.push_back(r1);
- v1.push_back(r2);
-
- VASSERT("1", o1_alive);
- VASSERT_EQ("2", 2, r1->strongCount());
- VASSERT("3", o2_alive);
- VASSERT_EQ("4", 2, r2->strongCount());
-
- {
- std::vector <vmime::ref <R> > v2 = v1;
-
- VASSERT("5", o1_alive);
- VASSERT_EQ("6", 3, r1->strongCount());
- VASSERT("7", o2_alive);
- VASSERT_EQ("8", 3, r2->strongCount());
-
- v2[1] = NULL;
-
- VASSERT("9", o1_alive);
- VASSERT_EQ("10", 3, r1->strongCount());
- VASSERT("11", o2_alive);
- VASSERT_EQ("12", 2, r2->strongCount());
- }
-
- VASSERT("13", o1_alive);
- VASSERT_EQ("14", 2, r1->strongCount());
- VASSERT("15", o2_alive);
- VASSERT_EQ("16", 2, r2->strongCount());
- }
-
- void testCompare()
- {
- vmime::ref <A> r1 = vmime::create <A>();
- vmime::ref <A> r2 = vmime::create <B>();
- vmime::ref <A> r3 = vmime::create <C>();
- vmime::ref <A> r4 = r1;
-
- VASSERT("1", r1 != r2);
- VASSERT("2", r1.get() == r1);
- VASSERT("3", r1 == r1.get());
- VASSERT("4", r2 != r1.get());
- VASSERT("5", r1.get() != r2);
- VASSERT("6", r1 == r4);
- VASSERT("7", r1.get() == r4);
-
- std::vector <vmime::ref <A> > v;
- v.push_back(r1);
- v.push_back(r2);
-
- VASSERT("8", std::find(v.begin(), v.end(), r1) == v.begin());
- VASSERT("9", std::find(v.begin(), v.end(), r2) == v.begin() + 1);
- VASSERT("10", std::find(v.begin(), v.end(), r3) == v.end());
- }
-
-VMIME_TEST_SUITE_END
-