blob: 4d55adfe637aba73787f3eb08e301753f21335b9 [file] [log] [blame]
Narumol Prangnawarat1c52a382022-01-13 11:47:35 +00001//
2// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
Matthew Benthamc1c5f2a2023-03-30 14:24:46 +00006#include <backendsCommon/TensorHandleFactoryRegistry.hpp>
Narumol Prangnawarat1c52a382022-01-13 11:47:35 +00007#include <reference/RefBackend.hpp>
8#include <reference/RefTensorHandleFactory.hpp>
9
Matthew Benthamc1c5f2a2023-03-30 14:24:46 +000010#include <armnn/backends/WorkloadFactory.hpp>
Narumol Prangnawarat1c52a382022-01-13 11:47:35 +000011#include <doctest/doctest.h>
12
13using namespace armnn;
14
15TEST_SUITE("RefBackendTests")
16{
17TEST_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
29TEST_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}