Commit c9ab6dbe authored by jselbie's avatar jselbie

differentiate CTestRecvFromEx into IPV4 and IPV6 tests

parent 1c3f44c4
......@@ -78,7 +78,8 @@ void RunUnitTests()
boost::shared_ptr<CTestMessageHandler> spTestMessageHandler(new CTestMessageHandler);
boost::shared_ptr<CTestCmdLineParser> spTestCmdLineParser(new CTestCmdLineParser);
boost::shared_ptr<CTestClientLogic> spTestClientLogic(new CTestClientLogic);
boost::shared_ptr<CTestRecvFromEx> spTestRecvFromEx(new CTestRecvFromEx);
boost::shared_ptr<CTestRecvFromExIPV4> spTestRecvFromEx4(new CTestRecvFromExIPV4);
boost::shared_ptr<CTestRecvFromExIPV6> spTestRecvFromEx6(new CTestRecvFromExIPV6);
boost::shared_ptr<CTestFastHash> spTestFastHash(new CTestFastHash);
boost::shared_ptr<CTestPolling> spTestPolling(new CTestPolling);
......@@ -89,7 +90,8 @@ void RunUnitTests()
vecTests.push_back(spTestMessageHandler.get());
vecTests.push_back(spTestCmdLineParser.get());
vecTests.push_back(spTestClientLogic.get());
vecTests.push_back(spTestRecvFromEx.get());
vecTests.push_back(spTestRecvFromEx4.get());
vecTests.push_back(spTestRecvFromEx6.get());
vecTests.push_back(spTestFastHash.get());
vecTests.push_back(spTestPolling.get());
......
......@@ -23,27 +23,19 @@
#include "stunsocket.h"
HRESULT CTestRecvFromEx::Run()
HRESULT CTestRecvFromExIPV4::Run()
{
HRESULT hr1=S_OK, hr2=S_OK;
HRESULT hr = S_OK;
return CTestRecvFromEx::DoTest(false); // ipv4
hr1 = DoTest(false); // ipv4
printf("Test result of recvfromex on ipv4. Result: %s\n", SUCCEEDED(hr1)?"Pass":"Fail");
hr2 = DoTest(true); // ipv6
printf("Test result of recvfromex on ipv6. Result: %s\n", SUCCEEDED(hr2)?"Pass":"Fail");
}
Chk(hr1);
Chk(hr2);
Cleanup:
return hr;
HRESULT CTestRecvFromExIPV6::Run()
{
return CTestRecvFromEx::DoTest(true); // ipv6
}
// This test validates that the EnablePktInfoOption set on a socket allows us to get at the destination IP address for incoming packets
// This is needed so that we can correctly insert an origin address into responses from the server
// Otherwise, the server doesn't have a way of knowing which interface a packet arrived on when it's listening on INADDR_ANY (all available addresses)
......
......@@ -23,15 +23,23 @@
#include "unittest.h"
class CTestRecvFromEx : public IUnitTest
class CTestRecvFromEx
{
public:
HRESULT DoTest(bool fUseIPV6);
static HRESULT DoTest(bool fUseIPV6);
};
class CTestRecvFromExIPV4 : public IUnitTest
{
HRESULT Run();
UT_DECLARE_TEST_NAME("CTestRecvFromEx(IPV4)");
};
UT_DECLARE_TEST_NAME("CTestRecvFromEx");
class CTestRecvFromExIPV6 : public IUnitTest
{
HRESULT Run();
UT_DECLARE_TEST_NAME("CTestRecvFromEx(IPV6)");
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment