#include "config_store.hpp" #include #include #include int main() { using namespace adminive::example; const auto test_directory = std::filesystem::temp_directory_path() / "adminive_config_store_test"; const auto config_path = test_directory / "config" / "adminive.json"; std::filesystem::remove_all(test_directory); { Config_Store store(config_path); assert(std::filesystem::exists(config_path)); assert(store.radio_service().snapshot().profile_name == "Primary Radio Profile"); auto updated = store.radio_service().snapshot(); updated.profile_name = "Persisted Profile"; store.persist_radio_service(updated); assert(store.radio_service().snapshot().profile_name == "Persisted Profile"); assert(!std::filesystem::exists(config_path.string() + ".tmp")); } { Config_Store store(config_path); assert(store.radio_service().snapshot().profile_name == "Persisted Profile"); assert(store.default_device_type() == Device_Table_Type::serial); } std::filesystem::remove_all(test_directory); return 0; }