diff options
author | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
commit | f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 (patch) | |
tree | 2bdc90e361a8f6e0a81164cf67afec9f78f9b959 /tests/net/pop3/POP3ResponseTest.cpp | |
parent | Per-protocol include files. (diff) | |
download | vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.tar.gz vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.zip |
Boost/C++11 shared pointers.
Diffstat (limited to 'tests/net/pop3/POP3ResponseTest.cpp')
-rw-r--r-- | tests/net/pop3/POP3ResponseTest.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
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()); |