Debian Codegraph @

tests/src/test_swinfokernel.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_swinfokernel.cpp`/
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #include <catch2/catch_all.hpp>
5
6 #include "common/stringdatasourcestub.h"cxx . . $ `<file>/tests/src/common/stringdatasourcestub.h`/
7 #include "core/info/common/swinfokernel.h"cxx . . $ `<file>/src/core/info/common/swinfokernel.h`/
8
9 namespace Testscxx . . $ Tests/::SWInfoKernelcxx . . $ Tests/SWInfoKernel/ {
10
11 TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("SWInfoKernel tests", "[Info][SWInfo][SWInfoKernel]")
12 {
13 SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides kernel version when /proc/version has a known format")
14 {
15 stdcxx . . $ std/::stringcxx . . $ std/string# const infoDatacxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).("Linux version 1.2.3_other_info ...");
16
17 ::SWInfoKernelcxx . . $ SWInfoKernel# tscxx . . $ SWInfoKernel#SWInfoKernel(d9a0eba8acfc8272).(
18 stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>("/proc/version", infoData));
19 auto output = ts.provideInfocxx . . $ SWInfoKernel#provideInfo(949cec684fe0bd75).();
20
21 auto kernelVersion = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(
22 stdcxx . . $ std/::stringcxx . . $ std/string#(ISWInfocxx . . $ ISWInfo#::Keyscxx . . $ ISWInfo#Keys#::kernelVersioncxx . . $ ISWInfo#Keys#kernelVersion.), stdcxx . . $ std/::stringcxx . . $ std/string#("1.2.3"));
23 REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(kernelVersion));
24 }
25
26 SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides fake kernel version (0.0.0) when...")
27 {
28 SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Cannot read /proc/version")
29 {
30 ::SWInfoKernelcxx . . $ SWInfoKernel# tscxx . . $ SWInfoKernel#SWInfoKernel(d9a0eba8acfc8272).(
31 stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>("/proc/version", "", false));
32 auto output = ts.provideInfocxx . . $ SWInfoKernel#provideInfo(949cec684fe0bd75).();
33
34 auto kernelVersion = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(
35 stdcxx . . $ std/::stringcxx . . $ std/string#(ISWInfocxx . . $ ISWInfo#::Keyscxx . . $ ISWInfo#Keys#::kernelVersioncxx . . $ ISWInfo#Keys#kernelVersion.), stdcxx . . $ std/::stringcxx . . $ std/string#("0.0.0"));
36 REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(kernelVersion));
37 }
38
39 SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("/proc/version data has an unknown format")
40 {
41 stdcxx . . $ std/::stringcxx . . $ std/string# const infoDatacxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).("Other format ...");
42
43 ::SWInfoKernelcxx . . $ SWInfoKernel# tscxx . . $ SWInfoKernel#SWInfoKernel(d9a0eba8acfc8272).(
44 stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>("/proc/version", infoData));
45 auto output = ts.provideInfocxx . . $ SWInfoKernel#provideInfo(949cec684fe0bd75).();
46
47 auto kernelVersion = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(
48 stdcxx . . $ std/::stringcxx . . $ std/string#(ISWInfocxx . . $ ISWInfo#::Keyscxx . . $ ISWInfo#Keys#::kernelVersioncxx . . $ ISWInfo#Keys#kernelVersion.), stdcxx . . $ std/::stringcxx . . $ std/string#("0.0.0"));
49 REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(kernelVersion));
50 }
51 }
52 }
53
54 } // namespace Tests::SWInfoKernel