From d86042141ef0a0e77935f4b48d1a627fc1ec776b Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Sun, 28 Aug 2016 15:19:31 +0200 Subject: Initial commit, allows for storing simpel values and boost::hana adapted structs at "key" --- tests/CMakeLists.txt | 8 ++++++++ tests/test1.cpp | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/test1.cpp (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..1260e05 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,8 @@ +set(CTEST_ENVIRONMENT + "XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}" + "HOME=${CMAKE_CURRENT_BINARY_DIR}" +) + +add_executable(test1 test1.cpp) +target_link_libraries(test1 PRIVATE configpp) +add_test(NAME test1 COMMAND test1) \ No newline at end of file diff --git a/tests/test1.cpp b/tests/test1.cpp new file mode 100644 index 0000000..fedcb48 --- /dev/null +++ b/tests/test1.cpp @@ -0,0 +1,19 @@ + +#include "configpp.hpp" + +struct Data { + int i; + float f; + std::string str; +}; + +BOOST_HANA_ADAPT_STRUCT(Data, i, f, str); + +int main() { + configpp::Config& config = configpp::Config::get("configpp_test1"); + + config.set("int", 1); + config.set("float", 1.0f); + config.set("string", "yolo"); + config.set("struct", Data{1, 1.0f, "yolo"}); +} -- cgit v1.2.3-70-g09d2