2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Removed "using namespace std;" from all sources. Appended std:: prefix to c++ standard classes. Included string.h where mem* function are used.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include "Exception.h"
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class DHTConnectionImplTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(DHTConnectionImplTest);
|
||||
@@ -26,22 +28,24 @@ void DHTConnectionImplTest::testWriteAndReadData()
|
||||
DHTConnectionImpl con2;
|
||||
uint16_t con2port = con2.bind(0);
|
||||
|
||||
string message1 = "hello world.";
|
||||
std::string message1 = "hello world.";
|
||||
con1.sendMessage(message1.c_str(), message1.size(), "localhost", con2port);
|
||||
|
||||
char readbuffer[100];
|
||||
string remoteHost;
|
||||
std::string remoteHost;
|
||||
uint16_t remotePort;
|
||||
{
|
||||
ssize_t rlength = con2.receiveMessage(readbuffer, sizeof(readbuffer), remoteHost, remotePort);
|
||||
CPPUNIT_ASSERT_EQUAL(string("127.0.0.1"), remoteHost);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("127.0.0.1"), remoteHost);
|
||||
CPPUNIT_ASSERT_EQUAL((ssize_t)message1.size(), rlength);
|
||||
readbuffer[rlength] = '\0';
|
||||
CPPUNIT_ASSERT_EQUAL(message1, string(readbuffer));
|
||||
CPPUNIT_ASSERT_EQUAL(message1, std::string(readbuffer));
|
||||
}
|
||||
} catch(Exception* e) {
|
||||
cerr << *e << endl;
|
||||
std::cerr << *e << std::endl;
|
||||
delete e;
|
||||
CPPUNIT_FAIL("exception thrown");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
Reference in New Issue
Block a user