diff options
author | Mike Kelly <mike.kelly@arm.com> | 2021-10-14 12:35:58 +0100 |
---|---|---|
committer | Mike Kelly <mike.kelly@arm.com> | 2021-10-14 12:35:58 +0100 |
commit | e2d611e4502fb5dce8b8a398ccfc8d7ef29da96b (patch) | |
tree | 79d9178420924d57ed0ab23db46ff57159279886 /test/DriverTestHelpers.hpp | |
parent | 4bd8f7c96e01e081276c376fe5c34018e7b70d17 (diff) | |
download | android-nn-driver-e2d611e4502fb5dce8b8a398ccfc8d7ef29da96b.tar.gz |
IVGCVSW-6428 Remove asserts
* Changed asserts to check for errors and return appropriate values or
throw exceptions
* Changed unit tests to use Doctest's long macro names as the short
macro names clashed with Android's Logging macros
* Removed unused #includes
* Clarified ambiguous #includes
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Ice92a37590df727fd581d3be5ff2716665f26a13
Diffstat (limited to 'test/DriverTestHelpers.hpp')
-rw-r--r-- | test/DriverTestHelpers.hpp | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/test/DriverTestHelpers.hpp b/test/DriverTestHelpers.hpp index 36deeab4..383c8fc2 100644 --- a/test/DriverTestHelpers.hpp +++ b/test/DriverTestHelpers.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once @@ -12,30 +12,13 @@ #include <iosfwd> #include <android/hidl/allocator/1.0/IAllocator.h> -// Un-define some of the macros as they clash in 'third-party/doctest/doctest.h' -// and 'system/core/base/include/android-base/logging.h' -// macro redefined error[-Werror,-Wmacro-redefined] -#ifdef CHECK -#undef CHECK -#endif -#ifdef CHECK_EQ -#undef CHECK_EQ -#endif -#ifdef CHECK_NE -#undef CHECK_NE -#endif -#ifdef CHECK_GT -#undef CHECK_GT -#endif -#ifdef CHECK_LT -#undef CHECK_LT -#endif -#ifdef CHECK_GE -#undef CHECK_GE -#endif -#ifdef CHECK_LE -#undef CHECK_LE -#endif +// Some of the short name macros from 'third-party/doctest/doctest.h' clash with macros in +// 'system/core/base/include/android-base/logging.h' so we use the full DOCTEST macro names +#ifndef DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES +#define DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES +#endif // DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES + +#include <doctest/doctest.h> using RequestArgument = V1_0::RequestArgument; using ::android::hidl::allocator::V1_0::IAllocator; @@ -190,7 +173,7 @@ android::sp<IMemory> AddPoolAndGetData(uint32_t size, V1_0::Request& request) android::sp<IAllocator> allocator = IAllocator::getService("ashmem"); allocator->allocate(sizeof(T) * size, [&](bool success, const hidl_memory& mem) { - ARMNN_ASSERT(success); + DOCTEST_CHECK(success); pool = mem; }); |