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/Tests.cpp | |
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/Tests.cpp')
-rw-r--r-- | test/Tests.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/test/Tests.cpp b/test/Tests.cpp index a3a38b91..4628414e 100644 --- a/test/Tests.cpp +++ b/test/Tests.cpp @@ -1,35 +1,35 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // + #define LOG_TAG "ArmnnDriverTests" #include <log/log.h> -#include "DriverTestHelpers.hpp" - #ifndef DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #endif -#include <doctest/doctest.h> + +#include "DriverTestHelpers.hpp" using namespace android::hardware; using namespace driverTestHelpers; using namespace armnn_driver; -TEST_SUITE("DriverTests") +DOCTEST_TEST_SUITE("DriverTests") { -TEST_CASE("Init") +DOCTEST_TEST_CASE("Init") { // Making the driver object on the stack causes a weird libc error, so make it on the heap instead auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef)); V1_0::DeviceStatus status = driver->getStatus(); // Note double-parentheses to avoid compile error from doctest trying to printf the DeviceStatus - CHECK((status == V1_0::DeviceStatus::AVAILABLE)); + DOCTEST_CHECK((status == V1_0::DeviceStatus::AVAILABLE)); } -TEST_CASE("TestCapabilities") +DOCTEST_TEST_CASE("TestCapabilities") { // Making the driver object on the stack causes a weird libc error, so make it on the heap instead auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef)); @@ -45,11 +45,11 @@ TEST_CASE("TestCapabilities") driver->getCapabilities(cb); - CHECK((int)error == (int)V1_0::ErrorStatus::NONE); - CHECK(cap.float32Performance.execTime > 0.f); - CHECK(cap.float32Performance.powerUsage > 0.f); - CHECK(cap.quantized8Performance.execTime > 0.f); - CHECK(cap.quantized8Performance.powerUsage > 0.f); + DOCTEST_CHECK((int)error == (int)V1_0::ErrorStatus::NONE); + DOCTEST_CHECK(cap.float32Performance.execTime > 0.f); + DOCTEST_CHECK(cap.float32Performance.powerUsage > 0.f); + DOCTEST_CHECK(cap.quantized8Performance.execTime > 0.f); + DOCTEST_CHECK(cap.quantized8Performance.powerUsage > 0.f); } } |