| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_amdodfanauto.cpp`/ |
| 2 | // Copyright 2023 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/commandqueuestub.h"cxx . . $ `<file>/tests/src/common/commandqueuestub.h`/ |
| 7 | #include "common/vectorstringdatasourcestub.h"cxx . . $ `<file>/tests/src/common/vectorstringdatasourcestub.h`/ |
| 8 | #include "core/components/controls/amd/fan/overdrive/auto/odfanauto.h"cxx . . $ `<file>/src/core/components/controls/amd/fan/overdrive/auto/odfanauto.h`/ |
| 9 | |
| 10 | namespace Testscxx . . $ Tests/::AMDcxx . . $ Tests/AMD/::OdFanAutocxx . . $ Tests/AMD/OdFanAuto/ { |
| 11 | |
| 12 | class OdFanAutoTestAdaptercxx . . $ Tests/AMD/OdFanAuto/OdFanAutoTestAdapter# : public ::AMDcxx . . $ AMD/::OdFanAutocxx . . $ AMD/OdFanAuto# |
| 13 | { |
| 14 | public: |
| 15 | using ::AMDcxx . . $ AMD/::OdFanAutocxx . . $ AMD/OdFanAuto#::OdFanAutocxx . . $ Tests/AMD/OdFanAuto/OdFanAutoTestAdapter#OdFanAutoTestAdapter(8451adcacc379f23).; |
| 16 | |
| 17 | using ::AMDcxx . . $ AMD/::OdFanAutocxx . . $ AMD/OdFanAuto#::cleanControlcxx . . $ Tests/AMD/OdFanAuto/OdFanAutoTestAdapter#cleanControl(151e9138769f295e).; |
| 18 | using ::AMDcxx . . $ AMD/::OdFanAutocxx . . $ AMD/OdFanAuto#::syncControlcxx . . $ Tests/AMD/OdFanAuto/OdFanAutoTestAdapter#syncControl(151e9138769f295e).; |
| 19 | }; |
| 20 | |
| 21 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("AMD OdFanAuto tests", "[GPU][AMD][Fan][Overdrive][OdFanAuto]") |
| 22 | { |
| 23 | CommandQueueStubcxx . . $ CommandQueueStub# ctlCmds; |
| 24 | OdFanAutoTestAdaptercxx . . $ Tests/AMD/OdFanAuto/OdFanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("path")); |
| 25 | |
| 26 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Has OdFanAuto ID") |
| 27 | { |
| 28 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.ID() == ::AMD::OdFanAuto::ItemID); |
| 29 | } |
| 30 | |
| 31 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Is active by default") |
| 32 | { |
| 33 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.active()); |
| 34 | } |
| 35 | |
| 36 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate pre-init control commands") |
| 37 | { |
| 38 | ts.preInitcxx . . $ AMD/OdFanAuto#preInit(151e9138769f295e).(ctlCmds); |
| 39 | |
| 40 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 41 | } |
| 42 | |
| 43 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate post-init control commands") |
| 44 | { |
| 45 | ts.postInitcxx . . $ AMD/OdFanAuto#postInit(151e9138769f295e).(ctlCmds); |
| 46 | |
| 47 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 48 | } |
| 49 | |
| 50 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate clean control commands") |
| 51 | { |
| 52 | ts.cleanControlcxx . . $ AMD/OdFanAuto#cleanControl(151e9138769f295e).(ctlCmds); |
| 53 | |
| 54 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 55 | } |
| 56 | |
| 57 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does generate sync control commands the first time is sync") |
| 58 | { |
| 59 | ts.syncControlcxx . . $ AMD/OdFanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 60 | |
| 61 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 2); |
| 62 | auto &[path0, value0] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 63 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(path0 == "path"); |
| 64 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(value0 == "r"); |
| 65 | auto &[path1, value1] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().atcxx . . $ std/vector#at(b61e45a10b63f40a).(1); |
| 66 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(path1 == "path"); |
| 67 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(value1 == "c"); |
| 68 | } |
| 69 | |
| 70 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate sync control commands when is already active") |
| 71 | { |
| 72 | ts.syncControlcxx . . $ AMD/OdFanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 73 | ctlCmds.clearcxx . . $ CommandQueueStub#clear(49f6e7a06ebc5aa8).(); |
| 74 | |
| 75 | ts.syncControlcxx . . $ AMD/OdFanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 76 | |
| 77 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 78 | } |
| 79 | |
| 80 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does generate sync control commands when is reactivated") |
| 81 | { |
| 82 | ts.syncControlcxx . . $ AMD/OdFanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 83 | ts.activatecxx . . $ Control#activate(b45ddcbc8423892c).(false); |
| 84 | ts.cleancxx . . $ Control#clean(151e9138769f295e).(ctlCmds); |
| 85 | ts.activatecxx . . $ Control#activate(b45ddcbc8423892c).(true); |
| 86 | ctlCmds.clearcxx . . $ CommandQueueStub#clear(49f6e7a06ebc5aa8).(); |
| 87 | |
| 88 | ts.syncControlcxx . . $ AMD/OdFanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 89 | |
| 90 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 2); |
| 91 | auto &[path0, value0] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 92 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(path0 == "path"); |
| 93 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(value0 == "r"); |
| 94 | auto &[path1, value1] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().atcxx . . $ std/vector#at(b61e45a10b63f40a).(1); |
| 95 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(path1 == "path"); |
| 96 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(value1 == "c"); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | } // namespace Tests::AMD::OdFanAuto |