mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Tidy up beast_asio
This commit is contained in:
@@ -81,15 +81,14 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeer.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeer.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerBasics.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerBasics.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerDetails.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerDetails.h" />
|
||||||
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerDetailsTcp.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogic.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogic.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerTest.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncClient.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerDetailsTcp.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncServer.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncClient.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncClient.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncServer.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncServer.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncClient.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_PeerTest.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncServer.h" />
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerType.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerTestType.h" />
|
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerType.h" />
|
|
||||||
<ClInclude Include="..\..\modules\beast_basics\beast_basics.h" />
|
<ClInclude Include="..\..\modules\beast_basics\beast_basics.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_basics\events\beast_DeadlineTimer.h" />
|
<ClInclude Include="..\..\modules\beast_basics\events\beast_DeadlineTimer.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_basics\events\beast_OncePerSecond.h" />
|
<ClInclude Include="..\..\modules\beast_basics\events\beast_OncePerSecond.h" />
|
||||||
@@ -310,7 +309,43 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerTests.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogic.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncClient.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncServer.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncClient.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncServer.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_PeerTest.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerUnitTests.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
@@ -322,30 +357,6 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncClient.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncServer.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncClient.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncServer.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_basics\beast_basics.cpp" />
|
<ClCompile Include="..\..\modules\beast_basics\beast_basics.cpp" />
|
||||||
<ClCompile Include="..\..\modules\beast_basics\events\beast_DeadlineTimer.cpp">
|
<ClCompile Include="..\..\modules\beast_basics\events\beast_DeadlineTimer.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@@ -152,9 +152,6 @@
|
|||||||
<Filter Include="beast_asio\tests">
|
<Filter Include="beast_asio\tests">
|
||||||
<UniqueIdentifier>{422da6a1-e57e-4a96-9fce-e5958c16026e}</UniqueIdentifier>
|
<UniqueIdentifier>{422da6a1-e57e-4a96-9fce-e5958c16026e}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="beast_asio\tests\detail">
|
|
||||||
<UniqueIdentifier>{5d8ed68a-e3b5-49f3-938b-fbe7365f6293}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
||||||
@@ -785,35 +782,32 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapperBasics.h">
|
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapperBasics.h">
|
||||||
<Filter>beast_asio\sockets</Filter>
|
<Filter>beast_asio\sockets</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerType.h">
|
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogic.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogic.h">
|
||||||
<Filter>beast_asio\tests</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerDetailsTcp.h">
|
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerDetails.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerDetails.h">
|
||||||
<Filter>beast_asio\tests</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerTest.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncServer.h">
|
||||||
<Filter>beast_asio\tests</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerTestType.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncClient.h">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncClient.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncServer.h">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncServer.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerType.h">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncClient.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerDetailsTcp.h">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncServer.h">
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncClient.h">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\modules\beast_asio\tests\beast_PeerTest.h">
|
||||||
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -1240,26 +1234,32 @@
|
|||||||
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerBasics.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerBasics.cpp">
|
||||||
<Filter>beast_asio\tests</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerTests.cpp">
|
|
||||||
<Filter>beast_asio\tests</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_asio\sockets\beast_Socket.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\sockets\beast_Socket.cpp">
|
||||||
<Filter>beast_asio\sockets</Filter>
|
<Filter>beast_asio\sockets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\sockets\beast_SocketBase.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\sockets\beast_SocketBase.cpp">
|
||||||
<Filter>beast_asio\sockets</Filter>
|
<Filter>beast_asio\sockets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncClient.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogic.cpp">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicAsyncServer.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncClient.cpp">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncClient.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicSyncServer.cpp">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_asio\tests\detail\beast_TestPeerLogicSyncServer.cpp">
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncClient.cpp">
|
||||||
<Filter>beast_asio\tests\detail</Filter>
|
<Filter>beast_asio\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerLogicAsyncServer.cpp">
|
||||||
|
<Filter>beast_asio\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_PeerTest.cpp">
|
||||||
|
<Filter>beast_asio\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerUnitTests.cpp">
|
||||||
|
<Filter>beast_asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ namespace beast
|
|||||||
#include "sockets/beast_SslContext.cpp"
|
#include "sockets/beast_SslContext.cpp"
|
||||||
|
|
||||||
#include "tests/beast_TestPeerBasics.cpp"
|
#include "tests/beast_TestPeerBasics.cpp"
|
||||||
#include "tests/beast_TestPeerTests.cpp"
|
#include "tests/beast_TestPeerLogic.cpp"
|
||||||
|
#include "tests/beast_TestPeerLogicSyncServer.cpp"
|
||||||
|
#include "tests/beast_TestPeerLogicSyncClient.cpp"
|
||||||
|
#include "tests/beast_TestPeerLogicAsyncServer.cpp"
|
||||||
|
#include "tests/beast_TestPeerLogicAsyncClient.cpp"
|
||||||
|
|
||||||
#include "tests/detail/beast_TestPeerLogicSyncServer.cpp"
|
#include "tests/beast_PeerTest.cpp"
|
||||||
#include "tests/detail/beast_TestPeerLogicSyncClient.cpp"
|
#include "tests/beast_TestPeerUnitTests.cpp"
|
||||||
#include "tests/detail/beast_TestPeerLogicAsyncServer.cpp"
|
|
||||||
#include "tests/detail/beast_TestPeerLogicAsyncClient.cpp"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,15 +60,13 @@ namespace beast
|
|||||||
#include "tests/beast_TestPeer.h"
|
#include "tests/beast_TestPeer.h"
|
||||||
#include "tests/beast_TestPeerDetails.h"
|
#include "tests/beast_TestPeerDetails.h"
|
||||||
#include "tests/beast_TestPeerLogic.h"
|
#include "tests/beast_TestPeerLogic.h"
|
||||||
#include "tests/beast_TestPeerTest.h"
|
#include "tests/beast_TestPeerLogicSyncServer.h"
|
||||||
|
#include "tests/beast_TestPeerLogicSyncClient.h"
|
||||||
#include "tests/detail/beast_TestPeerLogicSyncServer.h"
|
#include "tests/beast_TestPeerLogicAsyncServer.h"
|
||||||
#include "tests/detail/beast_TestPeerLogicSyncClient.h"
|
#include "tests/beast_TestPeerLogicAsyncClient.h"
|
||||||
#include "tests/detail/beast_TestPeerLogicAsyncServer.h"
|
#include "tests/beast_TestPeerType.h"
|
||||||
#include "tests/detail/beast_TestPeerLogicAsyncClient.h"
|
#include "tests/beast_TestPeerDetailsTcp.h"
|
||||||
#include "tests/detail/beast_TestPeerType.h"
|
#include "tests/beast_PeerTest.h"
|
||||||
#include "tests/detail/beast_TestPeerTestType.h"
|
|
||||||
#include "tests/detail/beast_TestPeerDetailsTcp.h"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
73
modules/beast_asio/tests/beast_PeerTest.cpp
Normal file
73
modules/beast_asio/tests/beast_PeerTest.cpp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
PeerTest::Result::Result ()
|
||||||
|
: m_ec (TestPeerBasics::make_error (TestPeerBasics::errc::skipped))
|
||||||
|
, m_message (m_ec.message ())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PeerTest::Result::Result (boost::system::error_code const& ec, String const& prefix)
|
||||||
|
: m_ec (ec)
|
||||||
|
, m_message ((prefix == String::empty) ? ec.message ()
|
||||||
|
: prefix + " " + ec.message ())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PeerTest::Result::failed () const noexcept
|
||||||
|
{
|
||||||
|
return TestPeerBasics::failure (m_ec);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PeerTest::Result::timedout () const noexcept
|
||||||
|
{
|
||||||
|
return m_ec == TestPeerBasics::make_error (TestPeerBasics::errc::timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
String PeerTest::Result::message () const noexcept
|
||||||
|
{
|
||||||
|
return m_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PeerTest::Result::report (UnitTest& test, bool reportPassingTests)
|
||||||
|
{
|
||||||
|
bool const success = test.unexpected (failed (), message ());
|
||||||
|
if (reportPassingTests && success)
|
||||||
|
test.logMessage (String ("pass ") + message());
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PeerTest::Results::Results ()
|
||||||
|
: name ("unknown")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PeerTest::Results::report (UnitTest& test, bool beginTestCase)
|
||||||
|
{
|
||||||
|
if (beginTestCase)
|
||||||
|
test.beginTestCase (name);
|
||||||
|
bool success = true;
|
||||||
|
if (! client.report (test))
|
||||||
|
success = false;
|
||||||
|
if (! server.report (test))
|
||||||
|
success = false;
|
||||||
|
return success;
|
||||||
|
}
|
||||||
205
modules/beast_asio/tests/beast_PeerTest.h
Normal file
205
modules/beast_asio/tests/beast_PeerTest.h
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
#ifndef RIPPLE_PEERTEST_H_INCLUDED
|
||||||
|
#define RIPPLE_PEERTEST_H_INCLUDED
|
||||||
|
|
||||||
|
/** Performs a test of two peers defined by template parameters.
|
||||||
|
*/
|
||||||
|
class PeerTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
/** How long to wait before aborting a peer and reporting a timeout.
|
||||||
|
|
||||||
|
@note Aborting synchronous logics may cause undefined behavior.
|
||||||
|
*/
|
||||||
|
defaultTimeoutSeconds = 30
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Holds the test results for one peer.
|
||||||
|
*/
|
||||||
|
class Result
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Default constructor indicates the test was skipped.
|
||||||
|
*/
|
||||||
|
Result ();
|
||||||
|
|
||||||
|
/** Construct from an error code.
|
||||||
|
The prefix is prepended to the error message.
|
||||||
|
*/
|
||||||
|
explicit Result (boost::system::error_code const& ec, String const& prefix = "");
|
||||||
|
|
||||||
|
/** Returns true if the peer failed.
|
||||||
|
*/
|
||||||
|
bool failed () const noexcept;
|
||||||
|
|
||||||
|
/** Convenience for determining if the peer timed out.
|
||||||
|
*/
|
||||||
|
bool timedout () const noexcept;
|
||||||
|
|
||||||
|
/** Provides a descriptive message.
|
||||||
|
This is suitable to pass to UnitTest::fail.
|
||||||
|
*/
|
||||||
|
String message () const noexcept;
|
||||||
|
|
||||||
|
/** Report the result to a UnitTest object.
|
||||||
|
A return value of true indicates success.
|
||||||
|
*/
|
||||||
|
bool report (UnitTest& test, bool reportPassingTests = false);
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::system::error_code m_ec;
|
||||||
|
String m_message;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Holds the results for both peers in a test.
|
||||||
|
*/
|
||||||
|
struct Results
|
||||||
|
{
|
||||||
|
String name; // A descriptive name for this test case.
|
||||||
|
Result client;
|
||||||
|
Result server;
|
||||||
|
|
||||||
|
Results ();
|
||||||
|
|
||||||
|
/** Report the results to a UnitTest object.
|
||||||
|
A return value of true indicates success.
|
||||||
|
@param beginTestCase `true` to call test.beginTestCase for you
|
||||||
|
*/
|
||||||
|
bool report (UnitTest& test, bool beginTestCase = true);
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Test two peers and return the results.
|
||||||
|
*/
|
||||||
|
template <typename Details, typename ServerLogic, typename ClientLogic, class Arg>
|
||||||
|
static Results run (Arg const& arg, int timeoutSeconds = defaultTimeoutSeconds)
|
||||||
|
{
|
||||||
|
Results results;
|
||||||
|
|
||||||
|
results.name = Details::getArgName (arg);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TestPeerType <ServerLogic, Details> server (arg);
|
||||||
|
|
||||||
|
results.name << " / " << server.name ();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TestPeerType <ClientLogic, Details> client (arg);
|
||||||
|
|
||||||
|
results.name << " / " << client.name ();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
server.start ();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
client.start ();
|
||||||
|
|
||||||
|
boost::system::error_code const ec =
|
||||||
|
client.join (timeoutSeconds);
|
||||||
|
|
||||||
|
results.client = Result (ec, client.name ());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::system::error_code const ec =
|
||||||
|
server.join (timeoutSeconds);
|
||||||
|
|
||||||
|
results.server = Result (ec, server.name ());
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
results.server = Result (TestPeerBasics::make_error (
|
||||||
|
TestPeerBasics::errc::exceptioned), server.name ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
results.client = Result (TestPeerBasics::make_error (
|
||||||
|
TestPeerBasics::errc::exceptioned), client.name ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
results.server = Result (TestPeerBasics::make_error (
|
||||||
|
TestPeerBasics::errc::exceptioned), server.name ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
results.client = Result (TestPeerBasics::make_error (
|
||||||
|
TestPeerBasics::errc::exceptioned), "client");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
results.server = Result (TestPeerBasics::make_error (
|
||||||
|
TestPeerBasics::errc::exceptioned), "server");
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Reports tests of Details for all known asynchronous logic combinations to a UnitTest.
|
||||||
|
*/
|
||||||
|
template <typename Details, class Arg>
|
||||||
|
static void report_async (UnitTest& test, Arg const& arg,
|
||||||
|
int timeoutSeconds = defaultTimeoutSeconds,
|
||||||
|
bool beginTestCase = true)
|
||||||
|
{
|
||||||
|
run <Details, TestPeerLogicAsyncServer, TestPeerLogicAsyncClient>
|
||||||
|
(arg, timeoutSeconds).report (test, beginTestCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Reports tests of Details against all known logic combinations to a UnitTest.
|
||||||
|
*/
|
||||||
|
template <typename Details, class Arg>
|
||||||
|
static void report (UnitTest& test, Arg const& arg,
|
||||||
|
int timeoutSeconds = defaultTimeoutSeconds,
|
||||||
|
bool beginTestCase = true)
|
||||||
|
{
|
||||||
|
run <Details, TestPeerLogicSyncServer, TestPeerLogicSyncClient>
|
||||||
|
(arg, timeoutSeconds).report (test, beginTestCase);
|
||||||
|
|
||||||
|
run <Details, TestPeerLogicSyncServer, TestPeerLogicAsyncClient>
|
||||||
|
(arg, timeoutSeconds).report (test, beginTestCase);
|
||||||
|
|
||||||
|
run <Details, TestPeerLogicAsyncServer, TestPeerLogicSyncClient>
|
||||||
|
(arg, timeoutSeconds).report (test, beginTestCase);
|
||||||
|
|
||||||
|
report_async <Details> (test, arg, timeoutSeconds, beginTestCase);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -22,9 +22,7 @@
|
|||||||
|
|
||||||
/** An abstract peer for unit tests.
|
/** An abstract peer for unit tests.
|
||||||
*/
|
*/
|
||||||
class TestPeer
|
class TestPeer : public TestPeerBasics
|
||||||
: public TestPeerBasics
|
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~TestPeer () { }
|
virtual ~TestPeer () { }
|
||||||
@@ -47,17 +45,6 @@ public:
|
|||||||
@return Any error code generated during the server operation.
|
@return Any error code generated during the server operation.
|
||||||
*/
|
*/
|
||||||
virtual boost::system::error_code join (int timeoutSeconds = -1) = 0;
|
virtual boost::system::error_code join (int timeoutSeconds = -1) = 0;
|
||||||
|
|
||||||
/** Runs a unit test on the specified pair of peers.
|
|
||||||
Returns true if the tests passed.
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
static bool runTest (UnitTest& test,
|
|
||||||
TestPeer& server,
|
|
||||||
TestPeer& client,
|
|
||||||
int timeoutSeconds,
|
|
||||||
String const& name);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,6 +17,51 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
TestPeerBasics::Role::Role (role_t role)
|
||||||
|
: m_role (role)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
String TestPeerBasics::Role::name () const noexcept
|
||||||
|
{
|
||||||
|
if (m_role == server)
|
||||||
|
return "server";
|
||||||
|
return "client";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TestPeerBasics::Role::operator== (role_t role) const noexcept
|
||||||
|
{
|
||||||
|
return m_role == role;
|
||||||
|
}
|
||||||
|
|
||||||
|
TestPeerBasics::Role::operator Socket::handshake_type () const noexcept
|
||||||
|
{
|
||||||
|
if (m_role == server)
|
||||||
|
return Socket::server;
|
||||||
|
return Socket::client;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TestPeerBasics::Model::Model (model_t model)
|
||||||
|
: m_model (model)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
String TestPeerBasics::Model::name () const noexcept
|
||||||
|
{
|
||||||
|
if (m_model == async)
|
||||||
|
return "async";
|
||||||
|
return "sync";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TestPeerBasics::Model::operator== (model_t model) const noexcept
|
||||||
|
{
|
||||||
|
return m_model == model;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
boost::system::error_category const& TestPeerBasics::test_category () noexcept
|
boost::system::error_category const& TestPeerBasics::test_category () noexcept
|
||||||
{
|
{
|
||||||
struct test_category_type : boost::system::error_category
|
struct test_category_type : boost::system::error_category
|
||||||
@@ -99,3 +144,5 @@ bool TestPeerBasics::unexpected (bool condition, boost::system::error_code& ec)
|
|||||||
return ! expected (condition, ec);
|
return ! expected (condition, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,48 @@
|
|||||||
|
|
||||||
@see TestPeer
|
@see TestPeer
|
||||||
*/
|
*/
|
||||||
struct TestPeerBasics
|
class TestPeerBasics
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
/** Identifies if the peer is a client or a server. */
|
||||||
|
struct Role
|
||||||
|
{
|
||||||
|
enum role_t
|
||||||
|
{
|
||||||
|
client,
|
||||||
|
server
|
||||||
|
};
|
||||||
|
|
||||||
|
Role (role_t role);
|
||||||
|
String name () const noexcept;
|
||||||
|
bool operator== (role_t role) const noexcept;
|
||||||
|
operator Socket::handshake_type () const noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
role_t m_role;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Selects between synchronous or asynchronous networking i/o usage. */
|
||||||
|
struct Model
|
||||||
|
{
|
||||||
|
enum model_t
|
||||||
|
{
|
||||||
|
sync,
|
||||||
|
async
|
||||||
|
};
|
||||||
|
|
||||||
|
Model (model_t model);
|
||||||
|
String name () const noexcept;
|
||||||
|
bool operator== (model_t model) const noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
model_t m_model;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Custom error codes for distinguishing test conditions
|
// Custom error codes for distinguishing test conditions
|
||||||
struct errc
|
struct errc
|
||||||
{
|
{
|
||||||
@@ -67,77 +107,6 @@ struct TestPeerBasics
|
|||||||
/** Set the error based on a passed condition and return the success.
|
/** Set the error based on a passed condition and return the success.
|
||||||
*/
|
*/
|
||||||
static bool unexpected (bool condition, boost::system::error_code& ec) noexcept;
|
static bool unexpected (bool condition, boost::system::error_code& ec) noexcept;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct Role
|
|
||||||
{
|
|
||||||
enum role_t
|
|
||||||
{
|
|
||||||
client,
|
|
||||||
server
|
|
||||||
};
|
|
||||||
|
|
||||||
Role (role_t role)
|
|
||||||
: m_role (role)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String name () const noexcept
|
|
||||||
{
|
|
||||||
if (m_role == server)
|
|
||||||
return "server";
|
|
||||||
return "client";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator== (role_t role) const noexcept
|
|
||||||
{
|
|
||||||
return m_role == role;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator Socket::handshake_type () const noexcept
|
|
||||||
{
|
|
||||||
if (m_role == server)
|
|
||||||
return Socket::server;
|
|
||||||
return Socket::client;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
role_t m_role;
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct Model
|
|
||||||
{
|
|
||||||
enum model_t
|
|
||||||
{
|
|
||||||
sync,
|
|
||||||
async
|
|
||||||
};
|
|
||||||
|
|
||||||
Model (model_t model)
|
|
||||||
: m_model (model)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String name () const noexcept
|
|
||||||
{
|
|
||||||
if (m_model == async)
|
|
||||||
return "async";
|
|
||||||
return "sync";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator== (model_t model) const noexcept
|
|
||||||
{
|
|
||||||
return m_model == model;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
model_t m_model;
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/** Base class of all detail objects.
|
/** Base class of all detail objects.
|
||||||
*/
|
*/
|
||||||
class TestPeerDetails : public Uncopyable
|
class TestPeerDetails
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~TestPeerDetails () { }
|
virtual ~TestPeerDetails () { }
|
||||||
|
|||||||
58
modules/beast_asio/tests/beast_TestPeerLogic.cpp
Normal file
58
modules/beast_asio/tests/beast_TestPeerLogic.cpp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
TestPeerLogic::TestPeerLogic (Socket& socket)
|
||||||
|
: m_socket (&socket)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TestPeerLogic::error_code& TestPeerLogic::error () noexcept
|
||||||
|
{
|
||||||
|
return m_ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
TestPeerLogic::error_code const& TestPeerLogic::error () const noexcept
|
||||||
|
{
|
||||||
|
return m_ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
TestPeerLogic::error_code const& TestPeerLogic::error (error_code const& ec) noexcept
|
||||||
|
{
|
||||||
|
return m_ec = ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
Socket& TestPeerLogic::socket () noexcept
|
||||||
|
{
|
||||||
|
return *m_socket;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPeerLogic::on_connect ()
|
||||||
|
{
|
||||||
|
pure_virtual ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPeerLogic::on_connect_async (error_code const&)
|
||||||
|
{
|
||||||
|
pure_virtual ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPeerLogic::pure_virtual ()
|
||||||
|
{
|
||||||
|
fatal_error ("A TestPeerLogic function was called incorrectly");
|
||||||
|
}
|
||||||
@@ -22,62 +22,31 @@
|
|||||||
|
|
||||||
/** Interface for implementing the logic part of a peer test.
|
/** Interface for implementing the logic part of a peer test.
|
||||||
*/
|
*/
|
||||||
class TestPeerLogic
|
class TestPeerLogic : public TestPeerBasics
|
||||||
: public TestPeerBasics
|
|
||||||
, public Uncopyable
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef boost::system::error_code error_code;
|
typedef boost::system::error_code error_code;
|
||||||
|
|
||||||
explicit TestPeerLogic (Socket& socket)
|
explicit TestPeerLogic (Socket& socket);
|
||||||
: m_socket (socket)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
error_code& error () noexcept
|
error_code& error () noexcept;
|
||||||
{
|
error_code const& error () const noexcept;
|
||||||
return m_ec;
|
error_code const& error (error_code const& ec) noexcept; // assigns to m_ec
|
||||||
}
|
|
||||||
|
|
||||||
error_code const& error () const noexcept
|
Socket& socket () noexcept;
|
||||||
{
|
|
||||||
return m_ec;
|
|
||||||
}
|
|
||||||
|
|
||||||
// also assigns, used for async handlers
|
|
||||||
error_code const& error (error_code const& ec) noexcept
|
|
||||||
{
|
|
||||||
return m_ec = ec;
|
|
||||||
}
|
|
||||||
|
|
||||||
Socket& socket () noexcept
|
|
||||||
{
|
|
||||||
return m_socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Role get_role () const noexcept = 0;
|
virtual Role get_role () const noexcept = 0;
|
||||||
|
|
||||||
virtual Model get_model () const noexcept = 0;
|
virtual Model get_model () const noexcept = 0;
|
||||||
|
|
||||||
virtual void on_connect ()
|
virtual void on_connect ();
|
||||||
{
|
virtual void on_connect_async (error_code const&);
|
||||||
pure_virtual ();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void on_connect_async (error_code const&)
|
|
||||||
{
|
|
||||||
pure_virtual ();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void pure_virtual ()
|
static void pure_virtual ();
|
||||||
{
|
|
||||||
fatal_error ("A TestPeerLogic function was called incorrectly");
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
error_code m_ec;
|
error_code m_ec;
|
||||||
Socket& m_socket;
|
Socket* m_socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef RIPPLE_TESTPEERTEST_H_INCLUDED
|
|
||||||
#define RIPPLE_TESTPEERTEST_H_INCLUDED
|
|
||||||
|
|
||||||
/** Performs a test of two peers defined by template parameters.
|
|
||||||
*/
|
|
||||||
struct TestPeerTest : protected TestPeerBasics
|
|
||||||
{
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/** How long to wait before aborting a peer and reporting a timeout.
|
|
||||||
|
|
||||||
@note Aborting synchronous logics may cause undefined behavior.
|
|
||||||
*/
|
|
||||||
defaultTimeoutSeconds = 30
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Holds the results for one peer. */
|
|
||||||
class Result : protected TestPeerBasics
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/** Default constructor indicates the test was skipped.
|
|
||||||
*/
|
|
||||||
Result ()
|
|
||||||
: m_ec (make_error (errc::skipped))
|
|
||||||
, m_message (m_ec.message ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Construct from an error code.
|
|
||||||
The prefix is prepended to the error message.
|
|
||||||
*/
|
|
||||||
explicit Result (boost::system::error_code const& ec, String const& prefix = "")
|
|
||||||
: m_ec (ec)
|
|
||||||
, m_message ((prefix == String::empty) ? ec.message ()
|
|
||||||
: prefix + " " + ec.message ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true if the peer failed.
|
|
||||||
*/
|
|
||||||
bool failed () const noexcept
|
|
||||||
{
|
|
||||||
return failure (m_ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convenience for determining if the peer timed out. */
|
|
||||||
bool timedout () const noexcept
|
|
||||||
{
|
|
||||||
return m_ec == make_error (errc::timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provides a descriptive message.
|
|
||||||
This is suitable to pass to UnitTest::fail.
|
|
||||||
*/
|
|
||||||
String message () const noexcept
|
|
||||||
{
|
|
||||||
return m_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report the result to a UnitTest object.
|
|
||||||
A return value of true indicates success.
|
|
||||||
*/
|
|
||||||
bool report (UnitTest& test)
|
|
||||||
{
|
|
||||||
bool const success = test.unexpected (failed (), message ());
|
|
||||||
#if 0
|
|
||||||
// Option to report passing tests
|
|
||||||
if (success)
|
|
||||||
test.logMessage (String ("passed ") + message());
|
|
||||||
#endif
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::system::error_code m_ec;
|
|
||||||
String m_message;
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Holds the results for both peers. */
|
|
||||||
struct Results
|
|
||||||
{
|
|
||||||
String name; // A descriptive name for this test case.
|
|
||||||
Result client;
|
|
||||||
Result server;
|
|
||||||
|
|
||||||
Results () : name ("unknown")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report the results to a UnitTest object.
|
|
||||||
A return value of true indicates success.
|
|
||||||
*/
|
|
||||||
bool report (UnitTest& test, bool beginTestCase = true)
|
|
||||||
{
|
|
||||||
if (beginTestCase)
|
|
||||||
test.beginTestCase (name);
|
|
||||||
bool success = true;
|
|
||||||
if (! client.report (test))
|
|
||||||
success = false;
|
|
||||||
if (! server.report (test))
|
|
||||||
success = false;
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -17,7 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class TestPeerTests : public UnitTest
|
/** UnitTest for the TestPeer family of objects.
|
||||||
|
*/
|
||||||
|
class TestPeerUnitTests : public UnitTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
@@ -25,14 +27,14 @@ public:
|
|||||||
timeoutSeconds = 3
|
timeoutSeconds = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
TestPeerTests () : UnitTest ("TestPeer", "beast", runManual)
|
TestPeerUnitTests () : UnitTest ("TestPeer", "beast")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Details, typename Arg >
|
template <typename Details, typename Arg >
|
||||||
void testDetails (Arg const& arg = Arg ())
|
void testDetails (Arg const& arg = Arg ())
|
||||||
{
|
{
|
||||||
TestPeerTestType::test <Details> (*this, arg, timeoutSeconds);
|
PeerTest::report <Details> (*this, arg, timeoutSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void runTest ()
|
void runTest ()
|
||||||
@@ -43,4 +45,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static TestPeerTests testPeerTests;
|
static TestPeerUnitTests testPeerUnitTests;
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef RIPPLE_TESTPEERTESTTYPE_H_INCLUDED
|
|
||||||
#define RIPPLE_TESTPEERTESTTYPE_H_INCLUDED
|
|
||||||
|
|
||||||
/** Performs a test of two peers defined by template parameters.
|
|
||||||
*/
|
|
||||||
class TestPeerTestType : public TestPeerTest
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/** Test two peers and return the results.
|
|
||||||
*/
|
|
||||||
template <typename Details, typename ServerLogic, typename ClientLogic, class Arg>
|
|
||||||
static Results run (Arg const& arg, int timeoutSeconds = defaultTimeoutSeconds)
|
|
||||||
{
|
|
||||||
Results results;
|
|
||||||
|
|
||||||
results.name = Details::getArgName (arg);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
TestPeerType <ServerLogic, Details> server (arg);
|
|
||||||
|
|
||||||
results.name << " / " << server.name ();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
TestPeerType <ClientLogic, Details> client (arg);
|
|
||||||
|
|
||||||
results.name << " / " << client.name ();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
server.start ();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.start ();
|
|
||||||
|
|
||||||
boost::system::error_code const ec =
|
|
||||||
client.join (timeoutSeconds);
|
|
||||||
|
|
||||||
results.client = Result (ec, client.name ());
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
boost::system::error_code const ec =
|
|
||||||
server.join (timeoutSeconds);
|
|
||||||
|
|
||||||
results.server = Result (ec, server.name ());
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
results.server = Result (make_error (
|
|
||||||
errc::exceptioned), server.name ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
results.client = Result (make_error (
|
|
||||||
errc::exceptioned), client.name ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
results.server = Result (make_error (
|
|
||||||
errc::exceptioned), server.name ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
results.client = Result (make_error (
|
|
||||||
errc::exceptioned), "client");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
results.server = Result (make_error (
|
|
||||||
errc::exceptioned), "server");
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Reports tests of Details against all known logic combinations to a UnitTest.
|
|
||||||
*/
|
|
||||||
template <typename Details, class Arg>
|
|
||||||
static void test (UnitTest& test, Arg const& arg,
|
|
||||||
int timeoutSeconds = defaultTimeoutSeconds,
|
|
||||||
bool beginTestCase = true)
|
|
||||||
{
|
|
||||||
run <Details, TestPeerLogicSyncServer, TestPeerLogicSyncClient> (arg, timeoutSeconds).report (test, beginTestCase);
|
|
||||||
run <Details, TestPeerLogicSyncServer, TestPeerLogicAsyncClient> (arg, timeoutSeconds).report (test, beginTestCase);
|
|
||||||
run <Details, TestPeerLogicAsyncServer, TestPeerLogicSyncClient> (arg, timeoutSeconds).report (test, beginTestCase);
|
|
||||||
run <Details, TestPeerLogicAsyncServer, TestPeerLogicAsyncClient> (arg, timeoutSeconds).report (test, beginTestCase);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -264,8 +264,6 @@ UnitTests::TestList UnitTests::selectTests (
|
|||||||
// If no trailing slash on package, try tests
|
// If no trailing slash on package, try tests
|
||||||
if (list.size () == 0 && indexOfDot == -1)
|
if (list.size () == 0 && indexOfDot == -1)
|
||||||
{
|
{
|
||||||
std::cout << "Trying package as test" << std::endl;
|
|
||||||
|
|
||||||
// Try "package" as a testname
|
// Try "package" as a testname
|
||||||
list = selectTest (package, tests);
|
list = selectTest (package, tests);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user