mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-21 15:51:43 +02:00
enh(Net): additional tests for StreamSocket::sendFile()
This commit is contained in:
@@ -736,7 +736,9 @@ void SocketTest::testSendFile()
|
|||||||
ostr.close();
|
ostr.close();
|
||||||
|
|
||||||
Poco::FileInputStream istr(file.path());
|
Poco::FileInputStream istr(file.path());
|
||||||
ss.sendFile(istr);
|
std::streamsize n = ss.sendFile(istr);
|
||||||
|
assertTrue (n == file.getSize());
|
||||||
|
|
||||||
istr.close();
|
istr.close();
|
||||||
ss.close();
|
ss.close();
|
||||||
|
|
||||||
@@ -771,7 +773,9 @@ void SocketTest::testSendFileLarge()
|
|||||||
ostr.close();
|
ostr.close();
|
||||||
|
|
||||||
Poco::FileInputStream istr(file.path());
|
Poco::FileInputStream istr(file.path());
|
||||||
ss.sendFile(istr);
|
std::streamsize n = ss.sendFile(istr);
|
||||||
|
assertTrue (n == file.getSize());
|
||||||
|
|
||||||
istr.close();
|
istr.close();
|
||||||
ss.close();
|
ss.close();
|
||||||
|
|
||||||
@@ -809,7 +813,9 @@ void SocketTest::testSendFileRange()
|
|||||||
const std::streamsize count = 10000;
|
const std::streamsize count = 10000;
|
||||||
|
|
||||||
Poco::FileInputStream istr(file.path());
|
Poco::FileInputStream istr(file.path());
|
||||||
ss.sendFile(istr, offset, count);
|
std::streamsize n = ss.sendFile(istr, offset, count);
|
||||||
|
assertTrue (n == count);
|
||||||
|
|
||||||
istr.close();
|
istr.close();
|
||||||
ss.close();
|
ss.close();
|
||||||
|
|
||||||
|
@@ -259,7 +259,9 @@ void SecureStreamSocketTest::testSendFile()
|
|||||||
ostr.close();
|
ostr.close();
|
||||||
|
|
||||||
Poco::FileInputStream istr(file.path());
|
Poco::FileInputStream istr(file.path());
|
||||||
ss.sendFile(istr);
|
std::streamsize n = ss.sendFile(istr);
|
||||||
|
assertTrue (n == file.getSize());
|
||||||
|
|
||||||
istr.close();
|
istr.close();
|
||||||
ss.close();
|
ss.close();
|
||||||
|
|
||||||
@@ -294,7 +296,9 @@ void SecureStreamSocketTest::testSendFileLarge()
|
|||||||
ostr.close();
|
ostr.close();
|
||||||
|
|
||||||
Poco::FileInputStream istr(file.path());
|
Poco::FileInputStream istr(file.path());
|
||||||
ss.sendFile(istr);
|
std::streamsize n = ss.sendFile(istr);
|
||||||
|
assertTrue (n == file.getSize());
|
||||||
|
|
||||||
istr.close();
|
istr.close();
|
||||||
ss.close();
|
ss.close();
|
||||||
|
|
||||||
@@ -332,7 +336,9 @@ void SecureStreamSocketTest::testSendFileRange()
|
|||||||
const std::streamsize count = 10000;
|
const std::streamsize count = 10000;
|
||||||
|
|
||||||
Poco::FileInputStream istr(file.path());
|
Poco::FileInputStream istr(file.path());
|
||||||
ss.sendFile(istr, offset, count);
|
std::streamsize n = ss.sendFile(istr, offset, count);
|
||||||
|
assertTrue (n == count);
|
||||||
|
|
||||||
istr.close();
|
istr.close();
|
||||||
ss.close();
|
ss.close();
|
||||||
|
|
||||||
@@ -341,9 +347,6 @@ void SecureStreamSocketTest::testSendFileRange()
|
|||||||
Poco::Thread::sleep(100);
|
Poco::Thread::sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\n" << fileData.size() << std::endl;
|
|
||||||
std::cout << "\n" << CopyToStringConnection::data().size() << std::endl;
|
|
||||||
|
|
||||||
assertTrue (CopyToStringConnection::data() == fileData.substr(offset, count));
|
assertTrue (CopyToStringConnection::data() == fileData.substr(offset, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user