1 // 2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #include <backendsCommon/TensorHandleFactoryRegistry.hpp> 7 #include <reference/RefBackend.hpp> 8 #include <reference/RefTensorHandleFactory.hpp> 9 10 #include <armnn/backends/WorkloadFactory.hpp> 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 } 41