test/common/seed.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // SPDX-FileCopyrightText: Copyright 2025-2026 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| 3 | // | ||
| 4 | // SPDX-License-Identifier: Apache-2.0 | ||
| 5 | // | ||
| 6 | |||
| 7 | #include "test/common/seed.hpp" | ||
| 8 | |||
| 9 | #include <gtest/gtest.h> | ||
| 10 | |||
| 11 | #include <algorithm> | ||
| 12 | |||
| 13 | namespace kai::test { | ||
| 14 | |||
| 15 | 75195 | std::uint32_t global_test_seed() { | |
| 16 | 75195 | const auto* unit_test = testing::UnitTest::GetInstance(); | |
| 17 | |||
| 18 |
1/2✓ Branch 0 taken 75195 times.
✗ Branch 1 not taken.
|
75195 | if (!unit_test) { |
| 19 | ✗ | return 0; | |
| 20 | } | ||
| 21 | |||
| 22 | 75195 | return static_cast<std::uint32_t>(std::max(0, unit_test->random_seed())); | |
| 23 | 75195 | } | |
| 24 | |||
| 25 | 65144 | std::string current_test_key() { | |
| 26 | 65144 | const auto* info = testing::UnitTest::GetInstance()->current_test_info(); | |
| 27 | |||
| 28 |
1/2✓ Branch 0 taken 65144 times.
✗ Branch 1 not taken.
|
65144 | if (!info) { |
| 29 | ✗ | return "UnknownTest"; | |
| 30 | } | ||
| 31 | |||
| 32 |
4/8✓ Branch 0 taken 65144 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 65144 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 65144 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 22016 times.
✗ Branch 7 not taken.
|
65144 | return std::string(info->test_suite_name()) + "::" + info->name(); |
| 33 | 65144 | } | |
| 34 | |||
| 35 | } // namespace kai::test | ||
| 36 |