| Alexander Hansen | d257192 | 2025-10-02 20:18:17 +0200 | [diff] [blame^] | 1 | #include "server/Test/common.hpp" |
| 2 | #include "server/Test2/common.hpp" |
| 3 | |
| 4 | #include <print> |
| 5 | |
| 6 | #include <gtest/gtest.h> |
| 7 | |
| 8 | int main() |
| 9 | { |
| 10 | // We can access the property name as a symbol. |
| 11 | // The property name is constexpr. |
| 12 | |
| 13 | constexpr auto propName = |
| 14 | sdbusplus::common::server::Test::property_names::some_value; |
| 15 | |
| 16 | // The property name can be used as part of error logs. |
| 17 | |
| 18 | std::println("property {} not found \n", propName); |
| 19 | |
| 20 | // If the property is removed from the interface definition, it will cause a |
| 21 | // build failure in applications still using that property. That can work |
| 22 | // even if the application is not (yet) using PDI-generated bindings for |
| 23 | // it's DBus interactions. |
| 24 | |
| 25 | std::println("using property {} \n", |
| 26 | sdbusplus::common::server::Test2::property_names::new_value); |
| 27 | |
| 28 | EXPECT_EQ(sdbusplus::common::server::Test2::property_names::new_value, |
| 29 | "NewValue"); |
| 30 | |
| 31 | return 0; |
| 32 | } |