IVGCVSW-3416 Create Command Handler Key class
[platform/upstream/armnn.git] / src / profiling / test / ProfilingTests.cpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5
6 #include "../CommandHandlerKey.hpp"
7
8 #include <boost/test/unit_test.hpp>
9
10 BOOST_AUTO_TEST_SUITE(ExternalProfiling)
11
12 BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons)
13 {
14     CommandHandlerKey testKey0(1, 1);
15     CommandHandlerKey testKey1(1, 1);
16     CommandHandlerKey testKey2(1, 1);
17     CommandHandlerKey testKey3(0, 0);
18     CommandHandlerKey testKey4(2, 2);
19     CommandHandlerKey testKey5(0, 2);
20
21     BOOST_CHECK(testKey1<testKey4);
22     BOOST_CHECK(testKey1>testKey3);
23     BOOST_CHECK(testKey1<=testKey4);
24     BOOST_CHECK(testKey1>=testKey3);
25     BOOST_CHECK(testKey1<=testKey2);
26     BOOST_CHECK(testKey1>=testKey2);
27     BOOST_CHECK(testKey1==testKey2);
28     BOOST_CHECK(testKey1==testKey1);
29
30     BOOST_CHECK(!(testKey1==testKey5));
31     BOOST_CHECK(!(testKey1!=testKey1));
32     BOOST_CHECK(testKey1!=testKey5);
33
34     BOOST_CHECK(testKey1==testKey2 && testKey2==testKey1);
35     BOOST_CHECK(testKey0==testKey1 && testKey1==testKey2 && testKey0==testKey2);
36
37     BOOST_CHECK(testKey1.GetPacketId()==1);
38     BOOST_CHECK(testKey1.GetVersion()==1);
39
40     std::vector<CommandHandlerKey> vect =
41         {
42             CommandHandlerKey(0,1), CommandHandlerKey(2,0), CommandHandlerKey(1,0),
43             CommandHandlerKey(2,1), CommandHandlerKey(1,1), CommandHandlerKey(0,1),
44             CommandHandlerKey(2,0), CommandHandlerKey(0,0)
45         };
46
47     std::sort(vect.begin(), vect.end());
48
49     std::vector<CommandHandlerKey> expectedVect =
50         {
51             CommandHandlerKey(0,0), CommandHandlerKey(0,1), CommandHandlerKey(0,1),
52             CommandHandlerKey(1,0), CommandHandlerKey(1,1), CommandHandlerKey(2,0),
53             CommandHandlerKey(2,0), CommandHandlerKey(2,1)
54         };
55
56     BOOST_CHECK(vect == expectedVect);
57 }
58
59 BOOST_AUTO_TEST_SUITE_END()