| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_swinfo.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "core/info/swinfo.h"cxx . . $ `<file>/src/core/info/swinfo.h`/ |
| 7 | |
| 8 | namespace Testscxx . . $ Tests/::SWInfocxx . . $ Tests/SWInfo/ { |
| 9 | |
| 10 | class ProviderStubcxx . . $ Tests/SWInfo/ProviderStub# : public ISWInfocxx . . $ ISWInfo#::IProvidercxx . . $ ISWInfo#IProvider# |
| 11 | { |
| 12 | public: |
| 13 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#>> provideInfocxx . . $ Tests/SWInfo/ProviderStub#provideInfo(949cec684fe0bd75).() const override |
| 14 | { |
| 15 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#>> infocxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 16 | info.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("info_key", "info"); |
| 17 | return infocxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("SWInfo tests", "[Info][SWInfo]") |
| 22 | { |
| 23 | ::SWInfocxx . . $ SWInfo# ts; |
| 24 | |
| 25 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Software info is collected on initialization") |
| 26 | { |
| 27 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.keys().empty()); |
| 28 | |
| 29 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<ISWInfocxx . . $ ISWInfo#::IProvidercxx . . $ ISWInfo#IProvider#>> providerscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 30 | providers.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ProviderStubcxx . . $ Tests/SWInfo/ProviderStub#>()); |
| 31 | |
| 32 | ts.initializecxx . . $ SWInfo#initialize(97df72f1a8cecba1).(providers); |
| 33 | auto keys = ts.keyscxx . . $ SWInfo#keys(491c255a7e496038).(); |
| 34 | |
| 35 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(keys.size() == 1); |
| 36 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(keys.front() == "info_key"); |
| 37 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.info("info_key") == "info"); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | } // namespace Tests::SWInfo |