| 1 | // |
| 2 | // SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | // |
| 4 | // SPDX-License-Identifier: Apache-2.0 |
| 5 | // |
| 6 | |
| 7 | #include "test/nextgen/common/test_registry.hpp" |
| 8 | |
| 9 | #include <utility> |
| 10 | #include <vector> |
| 11 | |
| 12 | namespace kai::test { |
| 13 | |
| 14 | namespace { |
| 15 | |
| 16 | std::vector<TestRegistry::Fn>& call_in_main_fns() { |
| 17 | static std::vector<TestRegistry::Fn> fns{}; |
| 18 | |
| 19 | return fns; |
| 20 | } |
| 21 | |
| 22 | } // namespace |
| 23 | |
| 24 | TestRegistry::Handle::Handle(Fn&& fn) { |
| 25 | call_in_main_fns().emplace_back(std::move(fn)); |
| 26 | } |
| 27 | |
| 28 | void TestRegistry::init() { |
| 29 | for (const TestRegistry::Fn& fn : call_in_main_fns()) { |
| 30 | fn(); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | } // namespace kai::test |