| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2022 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/hwidtranslatorstub.h" |
| 7 | #include "common/stringpathdatasourcestub.h" |
| 8 | #include "core/info/amd/gpuinfouniqueid.h" |
| 9 | |
| 10 | namespace Tests::AMD::GPUInfoUniqueID { |
| 11 | |
| 12 | TEST_CASE("GPUInfoUniqueID tests", "[AMD][Info][GPUInfo][GPUInfoUniqueID]") |
| 13 | { |
| 14 | Vendor vendor(Vendor::AMD); |
| 15 | int const gpuIndex = 0; |
| 16 | IGPUInfo::Path path("_sys_", "_dev_"); |
| 17 | HWIDTranslatorStub hwIDTranslator; |
| 18 | |
| 19 | SECTION("Provides the type given by its DataSource") |
| 20 | { |
| 21 | ::AMD::GPUInfoUniqueID ts(std::make_unique<StringPathDataSourceStub>( |
| 22 | "unique_id", "some_unique_id")); |
| 23 | auto output = ts.provideInfo(vendor, gpuIndex, path, hwIDTranslator); |
| 24 | |
| 25 | auto type = std::make_pair(std::string(::IGPUInfo::Keys::uniqueID), |
| 26 | std::string("SOME_UNIQUE_ID")); |
| 27 | REQUIRE_THAT(output, Catch::Matchers::VectorContains(type)); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | } // namespace Tests::AMD::GPUInfoUniqueID |