diff options
author | Francis Murtagh <francis.murtagh@arm.com> | 2019-08-14 09:49:34 +0100 |
---|---|---|
committer | Francis Murtagh <francis.murtagh@arm.com> | 2019-08-14 09:49:34 +0100 |
commit | 1f7db45b73522752115ea482d1e85e88c044a664 (patch) | |
tree | 5f338c8cce8db41720be973de7bc9eb137a1e3fe /src/profiling/test/ProfilingTests.cpp | |
parent | 566e4adc16e4aa3bc1107c32af5df45f027424ca (diff) | |
download | armnn-1f7db45b73522752115ea482d1e85e88c044a664.tar.gz |
IVGCVSW-3416 Create Command Handler Key class
* Add CommandHandlerKey class with all comparison operators
* Add UnitTests to check key sorting in collection
Change-Id: Icbd493d1e51e681cbe22a9e70ab9428a8a2ad107
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
Diffstat (limited to 'src/profiling/test/ProfilingTests.cpp')
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp new file mode 100644 index 0000000000..5abab2fb78 --- /dev/null +++ b/src/profiling/test/ProfilingTests.cpp @@ -0,0 +1,59 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "../CommandHandlerKey.hpp" + +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_SUITE(ExternalProfiling) + +BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons) +{ + CommandHandlerKey testKey0(1, 1); + CommandHandlerKey testKey1(1, 1); + CommandHandlerKey testKey2(1, 1); + CommandHandlerKey testKey3(0, 0); + CommandHandlerKey testKey4(2, 2); + CommandHandlerKey testKey5(0, 2); + + BOOST_CHECK(testKey1<testKey4); + BOOST_CHECK(testKey1>testKey3); + BOOST_CHECK(testKey1<=testKey4); + BOOST_CHECK(testKey1>=testKey3); + BOOST_CHECK(testKey1<=testKey2); + BOOST_CHECK(testKey1>=testKey2); + BOOST_CHECK(testKey1==testKey2); + BOOST_CHECK(testKey1==testKey1); + + BOOST_CHECK(!(testKey1==testKey5)); + BOOST_CHECK(!(testKey1!=testKey1)); + BOOST_CHECK(testKey1!=testKey5); + + BOOST_CHECK(testKey1==testKey2 && testKey2==testKey1); + BOOST_CHECK(testKey0==testKey1 && testKey1==testKey2 && testKey0==testKey2); + + BOOST_CHECK(testKey1.GetPacketId()==1); + BOOST_CHECK(testKey1.GetVersion()==1); + + std::vector<CommandHandlerKey> vect = + { + CommandHandlerKey(0,1), CommandHandlerKey(2,0), CommandHandlerKey(1,0), + CommandHandlerKey(2,1), CommandHandlerKey(1,1), CommandHandlerKey(0,1), + CommandHandlerKey(2,0), CommandHandlerKey(0,0) + }; + + std::sort(vect.begin(), vect.end()); + + std::vector<CommandHandlerKey> expectedVect = + { + CommandHandlerKey(0,0), CommandHandlerKey(0,1), CommandHandlerKey(0,1), + CommandHandlerKey(1,0), CommandHandlerKey(1,1), CommandHandlerKey(2,0), + CommandHandlerKey(2,0), CommandHandlerKey(2,1) + }; + + BOOST_CHECK(vect == expectedVect); +} + +BOOST_AUTO_TEST_SUITE_END() |