| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_gpuinfoopengl.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/hwidtranslatorstub.h"cxx . . $ `<file>/tests/src/common/hwidtranslatorstub.h`/ |
| 7 | #include "core/idatasource.h"cxx . . $ `<file>/src/core/idatasource.h`/ |
| 8 | #include "core/info/common/gpuinfoopengl.h"cxx . . $ `<file>/src/core/info/common/gpuinfoopengl.h`/ |
| 9 | |
| 10 | namespace Testscxx . . $ Tests/::GPUInfoOpenGLcxx . . $ Tests/GPUInfoOpenGL/ { |
| 11 | |
| 12 | class GPUInfoOpenGLDataSourceStubcxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub# : public IDataSourcecxx . . $ IDataSource#<stdcxx . . $ std/::stringcxx . . $ std/string#, int const> |
| 13 | { |
| 14 | public: |
| 15 | GPUInfoOpenGLDataSourceStubcxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#GPUInfoOpenGLDataSourceStub(d96256af6d38cfc3).(stdcxx . . $ std/::stringcxx . . $ std/string# source = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., stdcxx . . $ std/::stringcxx . . $ std/string# data = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) |
| 16 | : source_cxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#source_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(source)) |
| 17 | , data_cxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#data_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(data)) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | stdcxx . . $ std/::stringcxx . . $ std/string# sourcecxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#source(219584694fe2b248).() const override |
| 22 | { |
| 23 | return source_cxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).; |
| 24 | } |
| 25 | |
| 26 | bool readcxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#read(5e9573b50e400c4e).(stdcxx . . $ std/::stringcxx . . $ std/string# &data, int const &) override |
| 27 | { |
| 28 | data =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). data_cxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#data_.; |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | private: |
| 33 | stdcxx . . $ std/::stringcxx . . $ std/string# const source_cxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#source_.; |
| 34 | stdcxx . . $ std/::stringcxx . . $ std/string# const data_cxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#data_.; |
| 35 | }; |
| 36 | |
| 37 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("GPUInfoOpenGL tests", "[Info][GPUInfo][GPUInfoOpenGL]") |
| 38 | { |
| 39 | stdcxx . . $ std/::stringcxx . . $ std/string# const infoDatacxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).( |
| 40 | // clang-format off |
| 41 | "...\n\ |
| 42 | Extended renderer info (GLX_MESA_query_renderer):\n\ |
| 43 | ...\n\ |
| 44 | Max core profile version: 1.1\n\ |
| 45 | Max compat profile version: 2.2\n\ |
| 46 | ..."); // clang-format on |
| 47 | |
| 48 | Vendorcxx . . $ Vendor# vendor(Vendorcxx . . $ Vendor#::AMDcxx . . $ Vendor#AMD.); |
| 49 | int const gpuIndex = 0; |
| 50 | IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# pathcxx . . $ IGPUInfo#Path#Path(df8cb93b336b884d).("_sys_"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "_dev_"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).); |
| 51 | HWIDTranslatorStubcxx . . $ HWIDTranslatorStub# hwIDTranslator; |
| 52 | |
| 53 | ::GPUInfoOpenGLcxx . . $ GPUInfoOpenGL# tscxx . . $ GPUInfoOpenGL#GPUInfoOpenGL(24580567c8001d89).( |
| 54 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<GPUInfoOpenGLDataSourceStubcxx . . $ Tests/GPUInfoOpenGL/GPUInfoOpenGLDataSourceStub#>("glxinfo", infoData)); |
| 55 | |
| 56 | auto output = ts.provideInfocxx . . $ GPUInfoOpenGL#provideInfo(5b65f7e996e13d80).(vendor, gpuIndex, path, hwIDTranslator); |
| 57 | |
| 58 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides core version") |
| 59 | { |
| 60 | auto coreVersion = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).( |
| 61 | stdcxx . . $ std/::stringcxx . . $ std/string#(::GPUInfoOpenGLcxx . . $ GPUInfoOpenGL#::Keyscxx . . $ GPUInfoOpenGL#Keys#::coreVersioncxx . . $ GPUInfoOpenGL#Keys#coreVersion.), stdcxx . . $ std/::stringcxx . . $ std/string#("1.1")); |
| 62 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(coreVersion)); |
| 63 | } |
| 64 | |
| 65 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides compat version") |
| 66 | { |
| 67 | auto compatVersion = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).( |
| 68 | stdcxx . . $ std/::stringcxx . . $ std/string#(::GPUInfoOpenGLcxx . . $ GPUInfoOpenGL#::Keyscxx . . $ GPUInfoOpenGL#Keys#::compatVersioncxx . . $ GPUInfoOpenGL#Keys#compatVersion.), stdcxx . . $ std/::stringcxx . . $ std/string#("2.2")); |
| 69 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(compatVersion)); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | } // namespace Tests::GPUInfoOpenGL |