| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_cpuinfolscpu.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 "common/vectorstringdatasourcestub.h"cxx . . $ `<file>/tests/src/common/vectorstringdatasourcestub.h`/ |
| 8 | #include "core/info/common/cpuinfolscpu.h"cxx . . $ `<file>/src/core/info/common/cpuinfolscpu.h`/ |
| 9 | |
| 10 | namespace Testscxx . . $ Tests/::CPUInfoLsCpucxx . . $ Tests/CPUInfoLsCpu/ { |
| 11 | |
| 12 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("CPUInfoLsCpu tests", "[Info][CPUInfo][CPUInfoLsCpu]") |
| 13 | { |
| 14 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Returns empty info when there is no data") |
| 15 | { |
| 16 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 17 | |
| 18 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 19 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 20 | |
| 21 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 22 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(output.empty()); |
| 23 | } |
| 24 | |
| 25 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides architecture") |
| 26 | { |
| 27 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"Architecture: z48"}; |
| 28 | |
| 29 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 30 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 31 | |
| 32 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 33 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::archcxx . . $ CPUInfoLsCpu#Keys#arch.), |
| 34 | stdcxx . . $ std/::stringcxx . . $ std/string#("z48")); |
| 35 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 36 | } |
| 37 | |
| 38 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides operation mode") |
| 39 | { |
| 40 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"CPU op-mode(s): 48-bit"}; |
| 41 | |
| 42 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 43 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 44 | |
| 45 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 46 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::opModecxx . . $ CPUInfoLsCpu#Keys#opMode.), |
| 47 | stdcxx . . $ std/::stringcxx . . $ std/string#("48-bit")); |
| 48 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 49 | } |
| 50 | |
| 51 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides byte order") |
| 52 | { |
| 53 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{ |
| 54 | "Byte Order: Middle Endian"}; |
| 55 | |
| 56 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 57 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 58 | |
| 59 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 60 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::byteOrdercxx . . $ CPUInfoLsCpu#Keys#byteOrder.), |
| 61 | stdcxx . . $ std/::stringcxx . . $ std/string#("Middle Endian")); |
| 62 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 63 | } |
| 64 | |
| 65 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides virtualization") |
| 66 | { |
| 67 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"Virtualization: zzz"}; |
| 68 | |
| 69 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 70 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 71 | |
| 72 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 73 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::virtcxx . . $ CPUInfoLsCpu#Keys#virt.), |
| 74 | stdcxx . . $ std/::stringcxx . . $ std/string#("zzz")); |
| 75 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 76 | } |
| 77 | |
| 78 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides L1d cache size") |
| 79 | { |
| 80 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"L1d cache: 320K"}; |
| 81 | |
| 82 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 83 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 84 | |
| 85 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 86 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::l1dCachecxx . . $ CPUInfoLsCpu#Keys#l1dCache.), |
| 87 | stdcxx . . $ std/::stringcxx . . $ std/string#("320K")); |
| 88 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 89 | } |
| 90 | |
| 91 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides L1i cache size") |
| 92 | { |
| 93 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"L1i cache: 320K"}; |
| 94 | |
| 95 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 96 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 97 | |
| 98 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 99 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::l1iCachecxx . . $ CPUInfoLsCpu#Keys#l1iCache.), |
| 100 | stdcxx . . $ std/::stringcxx . . $ std/string#("320K")); |
| 101 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 102 | } |
| 103 | |
| 104 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides L2 cache size") |
| 105 | { |
| 106 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"L2 cache: 640K"}; |
| 107 | |
| 108 | ::CPUInfoLsCpucxx . . $ CPUInfoLsCpu# tscxx . . $ CPUInfoLsCpu#CPUInfoLsCpu(2fc9eef85304919b).( |
| 109 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>("lscpu", infoData)); |
| 110 | |
| 111 | auto output = ts.provideInfocxx . . $ CPUInfoLsCpu#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 112 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::CPUInfoLsCpucxx . . $ CPUInfoLsCpu#::Keyscxx . . $ CPUInfoLsCpu#Keys#::l2Cachecxx . . $ CPUInfoLsCpu#Keys#l2Cache.), |
| 113 | stdcxx . . $ std/::stringcxx . . $ std/string#("640K")); |
| 114 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | } // namespace Tests::CPUInfoLsCpu |