#pragma once /** * @file test_utils.h * @brief Cross-platform test utilities */ #include #include #include #include namespace vde::test { /** * @brief Get a platform-appropriate temporary directory path */ inline std::string temp_dir() { #ifdef _WIN32 const char* tmp = std::getenv("TEMP"); if (!tmp) tmp = std::getenv("TMP"); if (!tmp) tmp = "C:\\Temp"; return std::string(tmp) + "\\"; #else return "/tmp/"; #endif } /** * @brief Generate a unique temporary file path with the given prefix and extension */ inline std::string temp_file(const std::string& prefix, const std::string& ext) { static int counter = 0; return temp_dir() + prefix + "_" + std::to_string(counter++) + ext; } } // namespace vde::test