Add Hash, Random, Uuid, Encoding, Bits, Math modules + make Testing deps optional
New header-only modules: - Void::Hash — FNV-1a 32/64, CRC-32, DJB2, MurmurHash3-32, UDL literals - Void::Random — Xoshiro256** PRNG, uniform_int/real, coin_flip, shuffle, random_string - Void::Uuid — v4 (random), v5_lite (name-based), parse, RFC 4122 namespaces - Void::Encoding — Base64 (standard + URL-safe), Hex encode/decode - Void::Bits — popcount, bit extract/deposit, rotation, align, byteswap, masks - Void::Math — Vec2/Vec3/Vec4, Mat4 (identity, translation, scale, rotation) Testing module: move Stacktrace from INTERNAL_DEPS to OPTIONAL_DEPS. Added Detail/Color.hpp shim that delegates to Stacktrace::Color when present or provides inline ANSI fallback otherwise. All Stacktrace calls in SignalHandler, ConsoleReporter, and Runner are gated on VOID_HAS_STACKTRACE. Fix Repr.hpp reflect_struct to handle template specializations that lack std::meta::identifier_of (now guarded by has_identifier check). 33/33 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
42268c6c35
commit
a09e000f0f
65 files changed
+4959
-138
No files matched your search
@@ -1,10 +1,12 @@
|
||||
// Cross-module integration tests for the kitchen-sink VoidInternalTests
|
||||
// binary. Exercises Logging + Result + Stacktrace + FileSystem working
|
||||
// binary. Exercises Logging + Result + Stacktrace + FileSystem + Log working
|
||||
// together — the kind of thing the standalone per-module tests can't
|
||||
// reach because they only link one module.
|
||||
|
||||
#include <Void/FileSystem/Path.hpp>
|
||||
#include <Void/FileSystem/TempDir.hpp>
|
||||
#include <Void/Log/Log.hpp>
|
||||
#include <Void/Log/LoggingAdapter.hpp>
|
||||
#include <Void/Logging/ConsoleLogger.hpp>
|
||||
#include <Void/Logging/FileLogger.hpp>
|
||||
#include <Void/Logging/Level.hpp>
|
||||
@@ -113,3 +115,57 @@ Void::Testing::Test error_chain_logged_to_file_roundtrip()
|
||||
Void::Testing::expect(content.find("socket closed") != std::string::npos);
|
||||
Void::Testing::expect(content.find("caused by:") != std::string::npos);
|
||||
}
|
||||
|
||||
// Void::Log + Void::Logging: make_sink() bridges the two modules so that
|
||||
// internal library events routed through Void::Log::log() surface in a
|
||||
// Void::Logging::ConsoleLogger captured via a stringstream.
|
||||
Void::Testing::Test log_adapter_routes_to_void_logging()
|
||||
{
|
||||
std::ostringstream out;
|
||||
Void::Logging::ConsoleLogger logger{out};
|
||||
logger.set_level(Void::Logging::Level::Trace);
|
||||
|
||||
Void::Log::set_sink(Void::Log::make_sink(logger));
|
||||
|
||||
Void::Log::log(
|
||||
Void::Log::Level::Info, "TestModule", "hello from Void::Log");
|
||||
Void::Log::log(Void::Log::Level::Warning, "TestModule", "a warning");
|
||||
|
||||
Void::Log::set_sink({});
|
||||
|
||||
const auto text = out.str();
|
||||
Void::Testing::expect(text.find("hello from Void::Log") !=
|
||||
std::string::npos);
|
||||
Void::Testing::expect(text.find("a warning") != std::string::npos);
|
||||
Void::Testing::expect(text.find("[TestModule]") != std::string::npos);
|
||||
}
|
||||
|
||||
// FileSystem operations now emit Void::Log events; verify they reach a sink.
|
||||
Void::Testing::Test filesystem_ops_emit_log_events()
|
||||
{
|
||||
int debug_count = 0;
|
||||
int warning_count = 0;
|
||||
Void::Log::set_sink(
|
||||
[&](Void::Log::Level l, std::string_view, std::string_view) {
|
||||
if (l == Void::Log::Level::Debug) {
|
||||
++debug_count;
|
||||
}
|
||||
if (l == Void::Log::Level::Warning) {
|
||||
++warning_count;
|
||||
}
|
||||
});
|
||||
|
||||
Void::FileSystem::TempDir tmp;
|
||||
auto p = tmp / "test.txt";
|
||||
(void)Void::FileSystem::write_file(p, "data");
|
||||
(void)Void::FileSystem::read_file(p);
|
||||
(void)Void::FileSystem::read_file(tmp / "nonexistent.txt");
|
||||
|
||||
Void::Log::set_sink({});
|
||||
|
||||
// TempDir creation + read success + write (no debug from write_file) = at
|
||||
// least 2
|
||||
Void::Testing::expect(debug_count >= 2);
|
||||
// Missing file read = 1 warning
|
||||
Void::Testing::expect(warning_count >= 1);
|
||||
}
|
||||
Reference in new issue
Block a user