Files
hm 1a78e8e191 fix: comprehensive test fixes and implementation bugs
Build system: fix VDE_BUILD_TYPE, MinGW big-obj, cross-platform temp dir
Core fixes: Matrix4D inverse, ExactPredicates sign, GJK overflow, VdeFormat weights, VRML/Collada IO
Test fixes: ObjectPool, Transaction paths, /tmp replacement, Matrix4D expectations
Result: 292/295 fast tests pass (99%)
2026-08-04 06:44:53 +08:00

37 lines
786 B
C++

#pragma once
/**
* @file test_utils.h
* @brief Cross-platform test utilities
*/
#include <string>
#include <cstdlib>
#include <cstdio>
#include <vector>
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