aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test/TimelineUtilityMethodsTests.cpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-22 11:07:45 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-25 16:07:45 +0000
commit830101c2debac8b3f22c048fad603f34b76bdca1 (patch)
treef398bcbd687503a79fcced3e34f0411f5864f94a /src/profiling/test/TimelineUtilityMethodsTests.cpp
parent48623a0f6f4681ce0d9525b1587b7f96bfd58519 (diff)
downloadarmnn-830101c2debac8b3f22c048fad603f34b76bdca1.tar.gz
IVGCVSW-4022 Create a DeclareLabel utility function
* Created new TimelineUtilityMethods class * Created the DeclareLabel utility methods inside the new class * Added unit tests Change-Id: Ife0f7853a556d48206b76baeb3934344a990bee9 Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/profiling/test/TimelineUtilityMethodsTests.cpp')
-rw-r--r--src/profiling/test/TimelineUtilityMethodsTests.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp
new file mode 100644
index 0000000000..c205712d62
--- /dev/null
+++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp
@@ -0,0 +1,45 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "SendCounterPacketTests.hpp"
+
+#include <SendTimelinePacket.hpp>
+#include <TimelineUtilityMethods.hpp>
+
+#include <boost/test/unit_test.hpp>
+
+using namespace armnn;
+using namespace armnn::profiling;
+
+BOOST_AUTO_TEST_SUITE(TimelineUtilityMethodsTests)
+
+BOOST_AUTO_TEST_CASE(DeclareLabelTest1)
+{
+ MockBufferManager mockBufferManager(1024);
+ SendTimelinePacket sendTimelinePacket(mockBufferManager);
+ TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+
+ // Try declaring an invalid (empty) label
+ BOOST_CHECK_THROW(timelineUtilityMethods.DeclareLabel(""), InvalidArgumentException);
+
+ // Try declaring an invalid (wrong SWTrace format) label
+ BOOST_CHECK_THROW(timelineUtilityMethods.DeclareLabel("inv@lid lab€l"), RuntimeException);
+
+ // Declare a valid label
+ const std::string labelName = "valid label";
+ ProfilingGuid labelGuid = 0;
+ BOOST_CHECK_NO_THROW(labelGuid = timelineUtilityMethods.DeclareLabel(labelName));
+ // TODO when the implementation of the profiling GUID generator is done, enable the following test
+ //BOOST_CHECK(labelGuid != ProfilingGuid(0));
+
+ // TODO when the implementation of the profiling GUID generator is done, enable the following tests
+ // Try adding the same label as before
+ //ProfilingGuid newLabelGuid = 0;
+ //BOOST_CHECK_NO_THROW(labelGuid = timelineUtilityMethods.DeclareLabel(labelName));
+ //BOOST_CHECK(newLabelGuid != ProfilingGuid(0));
+ //BOOST_CHECK(newLabelGuid == labelGuid);
+}
+
+BOOST_AUTO_TEST_SUITE_END()