1 #include <systemd/sd-bus-protocol.h>
2
3 #include <sdbusplus/message.hpp>
4 #include <sdbusplus/test/sdbus_mock.hpp>
5
6 #include <flat_map>
7 #include <string>
8
9 #include <gmock/gmock.h>
10 #include <gtest/gtest.h>
11
12 namespace
13 {
14
15 using testing::DoAll;
16 using testing::Return;
17 using testing::StrEq;
18
ACTION_TEMPLATE(SetReadValue,HAS_1_TEMPLATE_PARAMS (typename,T),AND_1_VALUE_PARAMS (value))19 ACTION_TEMPLATE(SetReadValue, HAS_1_TEMPLATE_PARAMS(typename, T),
20 AND_1_VALUE_PARAMS(value))
21 {
22 *static_cast<T*>(arg2) = value;
23 }
24
25 class FlatMapTest : public testing::Test
26 {
27 protected:
28 testing::StrictMock<sdbusplus::SdBusMock> mock;
29
SetUp()30 void SetUp() override
31 {
32 EXPECT_CALL(mock, sd_bus_message_new_method_call(testing::_, testing::_,
33 nullptr, nullptr,
34 nullptr, nullptr))
35 .WillRepeatedly(Return(0));
36 }
37
new_message()38 sdbusplus::message_t new_message()
39 {
40 return sdbusplus::get_mocked_new(&mock).new_method_call(
41 nullptr, nullptr, nullptr, nullptr);
42 }
43 };
44
45 // Test that flat_map compiles with the read/append functions
TEST_F(FlatMapTest,CompileTest)46 TEST_F(FlatMapTest, CompileTest)
47 {
48 std::flat_map<std::string, int> fmap{{"key1", 100}, {"key2", 200}};
49 // This test just verifies that the code compiles
50 SUCCEED();
51 }
52
53 } // namespace
54