blob: 37aece7c3299c502ce695cbf7d5521af1b0e8776 [file] [log] [blame]
telsoa015307bc12018-03-09 13:51:08 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// See LICENSE file in the project root for full license information.
4//
telsoa015307bc12018-03-09 13:51:08 +00005#define LOG_TAG "ArmnnDriverTests"
6#define BOOST_TEST_MODULE armnn_driver_tests
7#include <boost/test/unit_test.hpp>
8#include <log/log.h>
9
surmeh0149b9e102018-05-17 14:11:25 +010010#include "DriverTestHelpers.hpp"
telsoa015307bc12018-03-09 13:51:08 +000011
12BOOST_AUTO_TEST_SUITE(DriverTests)
13
surmeh0149b9e102018-05-17 14:11:25 +010014using ArmnnDriver = armnn_driver::ArmnnDriver;
15using DriverOptions = armnn_driver::DriverOptions;
16using namespace driverTestHelpers;
telsoa015307bc12018-03-09 13:51:08 +000017
18BOOST_AUTO_TEST_CASE(Init)
19{
20 // Making the driver object on the stack causes a weird libc error, so make it on the heap instead
21 auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef));
22
23 DeviceStatus status = driver->getStatus();
24 // Note double-parentheses to avoid compile error from Boost trying to printf the DeviceStatus
25 BOOST_TEST((status == DeviceStatus::AVAILABLE));
26}
27
28BOOST_AUTO_TEST_CASE(TestCapabilities)
29{
30 // Making the driver object on the stack causes a weird libc error, so make it on the heap instead
31 auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef));
32
33 ErrorStatus error;
34 Capabilities cap;
35
36 ArmnnDriver::getCapabilities_cb cb = [&](ErrorStatus status, const Capabilities& capabilities)
37 {
38 error = status;
39 cap = capabilities;
40 };
41
42 driver->getCapabilities(cb);
43
44 BOOST_TEST((int)error == (int)ErrorStatus::NONE);
45 BOOST_TEST(cap.float32Performance.execTime > 0.f);
46 BOOST_TEST(cap.float32Performance.powerUsage > 0.f);
47 BOOST_TEST(cap.quantized8Performance.execTime > 0.f);
48 BOOST_TEST(cap.quantized8Performance.powerUsage > 0.f);
49}
50
telsoa015307bc12018-03-09 13:51:08 +000051BOOST_AUTO_TEST_SUITE_END()