| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 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/common/gpuinforevision.h" |
| 9 | |
| 10 | namespace Tests::GPUInfoRevision { |
| 11 | |
| 12 | TEST_CASE("GPUInfoRevision tests", "[Info][GPUInfo][GPUInfoRevision]") |
| 13 | { |
| 14 | Vendor vendor(Vendor::AMD); |
| 15 | int const gpuIndex = 0; |
| 16 | IGPUInfo::Path path("_sys_", "_dev_"); |
| 17 | HWIDTranslatorStub hwIDTranslator; |
| 18 | |
| 19 | SECTION("Provides revision") |
| 20 | { |
| 21 | std::string const infoData("0x123"); |
| 22 | |
| 23 | ::GPUInfoRevision ts( |
| 24 | std::make_unique<StringPathDataSourceStub>("revision", infoData)); |
| 25 | auto output = ts.provideInfo(vendor, gpuIndex, path, hwIDTranslator); |
| 26 | |
| 27 | auto revision = std::make_pair(std::string(IGPUInfo::Keys::revision), |
| 28 | std::string("123")); |
| 29 | REQUIRE_THAT(output, Catch::Matchers::VectorContains(revision)); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | } // namespace Tests::GPUInfoRevision |