12 #include <doctest/doctest.h> 20 SwapRegistryStorage() :
armnn::BackendRegistry()
25 ~SwapRegistryStorage()
31 FactoryStorage m_TempStorage;
38 TEST_CASE(
"SwapRegistry")
40 using namespace armnn;
43 SwapRegistryStorage helper;
49 TEST_CASE(
"TestRegistryHelper")
51 using namespace armnn;
52 SwapRegistryStorage helper;
67 CHECK(called ==
false);
72 CHECK(called ==
false);
75 CHECK(called ==
true);
79 TEST_CASE(
"TestDirectCallToRegistry")
81 using namespace armnn;
82 SwapRegistryStorage helper;
95 CHECK(called ==
false);
100 CHECK(called ==
false);
103 CHECK(called ==
true);
114 TEST_CASE(
"ThrowBackendUnavailableException")
116 using namespace armnn;
118 const BackendId mockBackendId(
"MockDynamicBackend");
120 const std::string exceptionMessage(
"Mock error message to test unavailable backend");
136 auto backend = factoryFunc();
137 FAIL(
"Expected exception to have been thrown");
142 CHECK_EQ(e.
what(), exceptionMessage);
TEST_SUITE("TestConstTensorLayerVisitor")
FactoryFunction GetFactory(const BackendId &id) const
void Register(const BackendId &id, FactoryFunction factory)
static void Swap(BackendRegistry &instance, FactoryStorage &other)
For testing only.
virtual const char * what() const noexcept override
BackendRegistry & BackendRegistryInstance()
Copyright (c) 2021 ARM Limited and Contributors.
void Deregister(const BackendId &id)
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
Class for non-fatal exceptions raised while initialising a backend.