aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/test/RefBackendTests.cpp
blob: 5154ea4c8fe10ec7d950eca42e1bd6e11a4651ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include <reference/RefBackend.hpp>
#include <reference/RefTensorHandleFactory.hpp>

#include <doctest/doctest.h>

using namespace armnn;

TEST_SUITE("RefBackendTests")
{
TEST_CASE("RefRegisterTensorHandleFactoriesMatchingImportFactoryId")
{
    auto refBackend = std::make_unique<RefBackend>();
    TensorHandleFactoryRegistry registry;
    refBackend->RegisterTensorHandleFactories(registry);

    // When calling RegisterTensorHandleFactories, CopyAndImportFactoryPair is registered
    // Get matching import factory id correctly
    CHECK((registry.GetMatchingImportFactoryId(RefTensorHandleFactory::GetIdStatic()) ==
           RefTensorHandleFactory::GetIdStatic()));
}

TEST_CASE("RefCreateWorkloadFactoryMatchingImportFactoryId")
{
    auto refBackend = std::make_unique<RefBackend>();
    TensorHandleFactoryRegistry registry;
    refBackend->CreateWorkloadFactory(registry);

    // When calling CreateWorkloadFactory, CopyAndImportFactoryPair is registered
    // Get matching import factory id correctly
    CHECK((registry.GetMatchingImportFactoryId(RefTensorHandleFactory::GetIdStatic()) ==
           RefTensorHandleFactory::GetIdStatic()));
}
}