IVGCVSW-5963 'Move unit tests to new framework'
* Used doctest in ArmNN unit tests
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: Ia9cf5fc72775878885c5f864abf2c56b3a935f1a
diff --git a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
index 0917927..f307d98 100644
--- a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
+++ b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
@@ -8,37 +8,35 @@
#include <SocketProfilingConnection.hpp>
#include <Processes.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test_suite.hpp>
+#include <doctest/doctest.h>
-
-BOOST_AUTO_TEST_SUITE(BasePipeServerTests)
-
+TEST_SUITE("BasePipeServerTests")
+{
using namespace armnn;
using namespace arm::pipe;
-BOOST_AUTO_TEST_CASE(BasePipeServerTest)
+TEST_CASE("BasePipeServerTest")
{
// Setup the mock service to bind to the UDS.
std::string udsNamespace = "gatord_namespace";
// Try to initialize a listening socket through the ConnectionHandler
- BOOST_CHECK_NO_THROW(ConnectionHandler connectionHandler(udsNamespace, true));
+ CHECK_NOTHROW(ConnectionHandler connectionHandler(udsNamespace, true));
- // The socket should close once we leave the scope of BOOST_CHECK_NO_THROW
+ // The socket should close once we leave the scope of CHECK_NOTHROW
// and socketProfilingConnection should fail to connect
- BOOST_CHECK_THROW(profiling::SocketProfilingConnection socketProfilingConnection,
+ CHECK_THROWS_AS(profiling::SocketProfilingConnection socketProfilingConnection,
arm::pipe::SocketConnectionException);
// Try to initialize a listening socket through the ConnectionHandler again
ConnectionHandler connectionHandler(udsNamespace, true);
// socketProfilingConnection should connect now
profiling::SocketProfilingConnection socketProfilingConnection;
- BOOST_TEST(socketProfilingConnection.IsOpen());
+ CHECK(socketProfilingConnection.IsOpen());
auto basePipeServer = connectionHandler.GetNewBasePipeServer(false);
// GetNewBasePipeServer will return null if it fails to create a socket
- BOOST_TEST(basePipeServer.get());
+ CHECK(basePipeServer.get());
profiling::BufferManager bufferManager;
profiling::SendCounterPacket sendCounterPacket(bufferManager);
@@ -50,15 +48,15 @@
const unsigned char* readBuffer = packetBuffer->GetReadableData();
unsigned int readBufferSize = packetBuffer->GetSize();
- BOOST_TEST(readBuffer);
- BOOST_TEST(readBufferSize > 0u);
+ CHECK(readBuffer);
+ CHECK(readBufferSize > 0u);
socketProfilingConnection.WritePacket(readBuffer,readBufferSize);
bufferManager.MarkRead(packetBuffer);
- BOOST_TEST(basePipeServer.get()->WaitForStreamMetaData());
- BOOST_TEST(basePipeServer.get()->GetStreamMetadataPid() == armnnUtils::Processes::GetCurrentId());
- BOOST_TEST(basePipeServer.get()->GetStreamMetadataMaxDataLen() == MAX_METADATA_PACKET_LENGTH);
+ CHECK(basePipeServer.get()->WaitForStreamMetaData());
+ CHECK(basePipeServer.get()->GetStreamMetadataPid() == armnnUtils::Processes::GetCurrentId());
+ CHECK(basePipeServer.get()->GetStreamMetadataMaxDataLen() == MAX_METADATA_PACKET_LENGTH);
// Now try a simple PeriodicCounterSelectionPacket
sendCounterPacket.SendPeriodicCounterSelectionPacket(50, {1,2,3,4,5});
@@ -67,18 +65,18 @@
readBuffer = packetBuffer->GetReadableData();
readBufferSize = packetBuffer->GetSize();
- BOOST_TEST(readBuffer);
- BOOST_TEST(readBufferSize > 0u);
+ CHECK(readBuffer);
+ CHECK(readBufferSize > 0u);
socketProfilingConnection.WritePacket(readBuffer,readBufferSize);
bufferManager.MarkRead(packetBuffer);
auto packet1 = basePipeServer.get()->WaitForPacket(500);
- BOOST_TEST(!packet1.IsEmpty());
- BOOST_TEST(packet1.GetPacketFamily() == 0);
- BOOST_TEST(packet1.GetPacketId() == 4);
- BOOST_TEST(packet1.GetLength() == 14);
+ CHECK(!packet1.IsEmpty());
+ CHECK(packet1.GetPacketFamily() == 0);
+ CHECK(packet1.GetPacketId() == 4);
+ CHECK(packet1.GetLength() == 14);
// Try and send the packet back to the client
basePipeServer.get()->SendPacket(packet1.GetPacketFamily(),
@@ -88,12 +86,12 @@
auto packet2 = socketProfilingConnection.ReadPacket(500);
- BOOST_TEST(!packet2.IsEmpty());
- BOOST_TEST(packet2.GetPacketFamily() == 0);
- BOOST_TEST(packet2.GetPacketId() == 4);
- BOOST_TEST(packet2.GetLength() == 14);
+ CHECK(!packet2.IsEmpty());
+ CHECK(packet2.GetPacketFamily() == 0);
+ CHECK(packet2.GetPacketId() == 4);
+ CHECK(packet2.GetLength() == 14);
socketProfilingConnection.Close();
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+}
\ No newline at end of file