Narumol Prangnawarat | 1c52a38 | 2022-01-13 11:47:35 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2022 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
Matthew Bentham | c1c5f2a | 2023-03-30 14:24:46 +0000 | [diff] [blame] | 6 | #include <backendsCommon/TensorHandleFactoryRegistry.hpp> |
Narumol Prangnawarat | 1c52a38 | 2022-01-13 11:47:35 +0000 | [diff] [blame] | 7 | #include <reference/RefBackend.hpp> |
| 8 | #include <reference/RefTensorHandleFactory.hpp> |
| 9 | |
Matthew Bentham | c1c5f2a | 2023-03-30 14:24:46 +0000 | [diff] [blame] | 10 | #include <armnn/backends/WorkloadFactory.hpp> |
Narumol Prangnawarat | 1c52a38 | 2022-01-13 11:47:35 +0000 | [diff] [blame] | 11 | #include <doctest/doctest.h> |
| 12 | |
| 13 | using namespace armnn; |
| 14 | |
| 15 | TEST_SUITE("RefBackendTests") |
| 16 | { |
| 17 | TEST_CASE("RefRegisterTensorHandleFactoriesMatchingImportFactoryId") |
| 18 | { |
| 19 | auto refBackend = std::make_unique<RefBackend>(); |
| 20 | TensorHandleFactoryRegistry registry; |
| 21 | refBackend->RegisterTensorHandleFactories(registry); |
| 22 | |
| 23 | // When calling RegisterTensorHandleFactories, CopyAndImportFactoryPair is registered |
| 24 | // Get matching import factory id correctly |
| 25 | CHECK((registry.GetMatchingImportFactoryId(RefTensorHandleFactory::GetIdStatic()) == |
| 26 | RefTensorHandleFactory::GetIdStatic())); |
| 27 | } |
| 28 | |
| 29 | TEST_CASE("RefCreateWorkloadFactoryMatchingImportFactoryId") |
| 30 | { |
| 31 | auto refBackend = std::make_unique<RefBackend>(); |
| 32 | TensorHandleFactoryRegistry registry; |
| 33 | refBackend->CreateWorkloadFactory(registry); |
| 34 | |
| 35 | // When calling CreateWorkloadFactory, CopyAndImportFactoryPair is registered |
| 36 | // Get matching import factory id correctly |
| 37 | CHECK((registry.GetMatchingImportFactoryId(RefTensorHandleFactory::GetIdStatic()) == |
| 38 | RefTensorHandleFactory::GetIdStatic())); |
| 39 | } |
| 40 | } |