2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include "../CommandHandlerKey.hpp"
8 #include <boost/test/unit_test.hpp>
10 BOOST_AUTO_TEST_SUITE(ExternalProfiling)
12 BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons)
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);
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);
30 BOOST_CHECK(!(testKey1==testKey5));
31 BOOST_CHECK(!(testKey1!=testKey1));
32 BOOST_CHECK(testKey1!=testKey5);
34 BOOST_CHECK(testKey1==testKey2 && testKey2==testKey1);
35 BOOST_CHECK(testKey0==testKey1 && testKey1==testKey2 && testKey0==testKey2);
37 BOOST_CHECK(testKey1.GetPacketId()==1);
38 BOOST_CHECK(testKey1.GetVersion()==1);
40 std::vector<CommandHandlerKey> vect =
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)
47 std::sort(vect.begin(), vect.end());
49 std::vector<CommandHandlerKey> expectedVect =
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)
56 BOOST_CHECK(vect == expectedVect);
59 BOOST_AUTO_TEST_SUITE_END()