#include "CoreController.h" #include #include #include #include static constexpr bool CAT_FILE_TO_CONSOLE = true; const std::string CONF_PATH = "/tmp/conf"; const std::string REBOOT_FILE = CONF_PATH + "/reboot.txt"; void catFileToConsole(); TEST_CASE( "Core Controller Reboot File Handling", "[reboot-file]" ) { if(not std::filesystem::exists(CONF_PATH)) { std::filesystem::create_directory(CONF_PATH); } CoreController ctrl; RebootFile rf; ctrl.performRebootFileHandling(true); catFileToConsole(); ctrl.parseRebootFile(REBOOT_FILE, rf); REQUIRE(rf.enabled == 1); REQUIRE(rf.enabled == 1); std::filesystem::remove_all(CONF_PATH); } void catFileToConsole() { if(CAT_FILE_TO_CONSOLE) { std::ifstream file(REBOOT_FILE); if (file.is_open()) { std::cout << file.rdbuf(); } } }