Restructure into umbrella modules (~55 -> 16 targets)

Headers move, CMake targets merge, C++ namespaces stay unchanged:
- Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant
- Functional: Pipeline, Either, Result, Retry
- Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval
- Math: +Matrix, Numeric, Random, Histogram
- Text: Str, Format, Tokenizer, Diff, Encoding, Semver
- Data: Json, Csv, Ini
- Async: Coro, Concurrency, EventBus, Observable
- Time: +Bench
- Log: Log facade + Logging framework (facade now header-only, breaking
  the Stacktrace<->Log link cycle the merge would have created)
- System: FileSystem + Process
- Configuration: +Argparse
- Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail

Module system fixes:
- OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no
  longer depends on the alphabetical discovery order of src/ subdirs
  (Testing -> Text would have been silently dropped).
- Every header-only module now has a tracked module.cmake; previously the
  empty src/<Name> marker dirs were untracked, so a fresh clone would have
  silently skipped those modules.
- VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT.

Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files
prefixed: ResultBasic etc.). Test count verified identical (831) before and
after. README/CLAUDE.md module tables updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Fable 5 committed 2026-06-12 18:50:02 +03:00
1 parent da2e93c405
commit 28b94883fd
156 files changed
+278 -220

No files matched your search

+35 -16
View File
@@ -19,8 +19,8 @@ cmake --build build
# Run all tests
ctest --test-dir build
# Run a single standalone test binary directly
./build/tests/test_standalone_Logging_FileLogger
# Or run the single test binary directly (supports --filter, --parallel, ...)
./build/tests/VoidTests --filter "Json*"
```
Format code with:
@@ -30,35 +30,54 @@ clang-format -i <file>
## Architecture
VoidLibrary is a C++23 modular shared library. Each module is an independently installable CMake target under the `Void::` namespace.
VoidLibrary is a C++26 modular shared library organized as **umbrella modules** — one CMake target each, grouping related functionality. The C++ namespaces of absorbed components are unchanged (e.g. `Void::Ring` lives in `include/Void/Containers/Ring.hpp`, linked via `Void::Containers`).
| Module | Type | Contents |
|---|---|---|
| `Core` | INTERFACE | Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant |
| `Functional` | INTERFACE | Pipeline (+Curry, +Memo), Either (+Opt), Result, Retry |
| `Containers` | INTERFACE | Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval |
| `Math` | INTERFACE | Vec/Mat, Matrix, Numeric, Random, Histogram |
| `Text` | INTERFACE | Str, Format, Tokenizer, Diff, Encoding, Semver |
| `Data` | INTERFACE | Json, Csv, Ini |
| `Async` | INTERFACE | Coro (Task, Generator), Concurrency (ThreadPool, Channel, ParallelFor), EventBus, Observable |
| `Time` | INTERFACE | Stopwatch, Format (durations/ISO-8601), Bench |
| `Log` | SHARED | `Void::Log` header-only facade + `Void::Logging` framework |
| `System` | SHARED | FileSystem (Path, Query, TempDir) + Process |
| `Configuration` | SHARED | Config, Env + Argparse |
| `Stacktrace` | SHARED | Boost.Stacktrace capture, color helpers (kept separate to isolate the Boost dep) |
| `Plugin` | SHARED | dlopen loader, C ABI, hot reload |
| `StateMachine` | INTERFACE | compile-time variant-based FSM |
| `Testing` / `TestingMock` | STATIC / INTERFACE | test + mock frameworks |
`include/Void/Detail/` (e.g. `Enum.hpp` — P2996 enum reflection) is not a module; it is header-only and reachable from every module via the shared include root.
### Module system
`cmake/Module.cmake` defines `void_add_module(NAME ...)`. The root `CMakeLists.txt` auto-discovers every subdirectory under `src/` and calls it. A module with only headers becomes an `INTERFACE` library; one with `.cpp` sources becomes `SHARED` — except `Testing`, which is special-cased to `STATIC`.
`cmake/Module.cmake` defines `void_add_module(NAME ...)`. The root `CMakeLists.txt` auto-discovers every subdirectory under `src/` and calls it (or includes the dir's `module.cmake` if present), then calls `void_finalize_modules()`. A module with only headers becomes an `INTERFACE` library; one with `.cpp` sources becomes `SHARED` — except `Testing`, which is special-cased to `STATIC`.
Module layout:
- Headers: `include/Void/<ModuleName>/*.hpp`
- Sources: `src/<ModuleName>/*.cpp`
- CMake target: `Void_<ModuleName>` with alias `Void::<ModuleName>`
- Namespace: `Void::<ModuleName>`
- Headers: `include/Void/<Module>/*.hpp`
- Sources: `src/<Module>/*.cpp`
- CMake target: `Void_<Module>` with alias `Void::<Module>`
To add a new module, create `src/<ModuleName>/` and populate it — the build system picks it up automatically. If a module needs special dependency wiring, drop a `module.cmake` file inside the source directory (see `cmake/module.cmake.template` for the pattern).
Every header-only module **must** have at least a one-line `src/<Module>/module.cmake` (`void_add_module(<Module>)`) — git does not track empty directories, and discovery iterates `src/*`.
`void_add_module` accepts three dependency lists:
- `INTERNAL_DEPS` — other `Void::*` modules (linked unconditionally).
- `EXTERNAL_DEPS` — third-party targets fetched via `cmake/Dependencies.cmake` (`FetchContent`); add new ones there before referencing.
- `OPTIONAL_DEPS` — `Void::*` modules linked only if they exist; each present dep additionally defines `VOID_HAS_<UPPERCASE>` for conditional code.
- `OPTIONAL_DEPS` — `Void::*` modules linked only if they exist; each present dep additionally defines `VOID_HAS_<UPPERCASE>` for conditional code. Resolution is deferred to `void_finalize_modules()`, so it does not depend on discovery order.
### Tests
`tests/CMakeLists.txt` defines two test categories:
All tests compile into **one binary**, `build/tests/VoidTests` (registered as the single ctest entry):
| Category | Location | Binary | Links |
|---|---|---|---|
| Internal (kitchen-sink) | `tests/internal/*.cpp` | `VoidInternalTests` | all modules + `Void::Testing` |
| Standalone (isolated) | `tests/standalone/<ModuleName>/<name>.cpp` | `test_standalone_<ModuleName>_<name>` | its module only |
| Category | Location | Suite label |
|---|---|---|
| Standalone | `tests/standalone/<Module>/<Feature>.cpp` | `<Feature>` (file stem) |
| Internal (cross-module) | `tests/internal/*.cpp` | `internal_<stem>` |
Standalone tests are preferred for testing a single module in isolation.
**The `tests/standalone/<Module>` directory name must exactly match a module name** — the scanner iterates registered modules and silently skips unknown directories. After moving/renaming tests, compare the runner's total test count.
#### Writing a test
+1
View File
@@ -25,6 +25,7 @@ foreach(module_path ${children})
endif()
endif()
endforeach()
void_finalize_modules()
if(VOID_ENABLE_TESTING)
enable_testing()
+24 -12
View File
@@ -20,8 +20,8 @@ cmake --build build
# Run all tests
ctest --test-dir build
# Run a single standalone test binary directly
./build/tests/test_standalone_Logging_FileLogger
# Or run the test binary directly (per-suite filtering, parallel mode, ...)
./build/tests/VoidTests --filter "Json*"
```
### Optional build flags
@@ -46,16 +46,28 @@ Format code with `clang-format -i <file>`.
## Modules
| Module | Namespace | Description |
|---------------|-----------------------|-----------------------------------------------------------------------------|
| `Logging` | `Void::Logging` | Thread-safe `Logger` ABC with buffering, scopes, presets; ships `FileLogger` and `ConsoleLogger` sinks. |
| `Testing` | `Void::Testing` | Self-registering test framework with fixtures, tags, JUnit/console reporters, signal-handler crash capture. |
| `TestingMock` | `Void::TestingMock` | Header-only mock framework: `MockFunction`, `Mock<Derived>` CRTP base, matchers (`Eq`/`_`/`Lt`/`Le`/`Gt`/`Ge`/`Range`/`Pred`/`StartsWith`/`Contains`), move-only actions. |
| `Stacktrace` | `Void::Stacktrace` | Stack capture + source-snippet rendering via Boost.Stacktrace; ANSI color helpers. |
| `Result` | `Void::Result` | Header-only `Result<T,E> = std::expected<T,E>` plus `Error` with cause-chain context, `with_context()` helper, reflection-based struct `repr` (C++26 `<meta>`). |
| `FileSystem` | `Void::FileSystem` | Header-only path utilities returning `Result<T,E>`: `read_file`, `write_file`, `atomic_write`, `ensure_directory`, `remove_path`, RAII `TempDir`. |
| `Concurrency` | `Void::Concurrency` | Header-only `ThreadPool`, bounded MPMC `Channel<T>`, and `parallel_for` built on the pool. Testing runner uses the pool for `--parallel <n>` mode. |
| `Log` | `Void::Log` | Thin global log-sink layer used internally by all modules. Install any callable via `set_sink(fn)`; include `LoggingAdapter.hpp` to bridge to `Void::Logging`. |
Functionality is grouped into umbrella modules (one CMake target each).
The C++ namespaces of the absorbed components are unchanged — e.g.
`Void::Ring` lives in `Void::Containers`' headers.
| Module | Type | Contents (namespaces) |
|-----------------|-----------|-----------------------------------------------------------------------------|
| `Core` | INTERFACE | Scope guards, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant helpers. |
| `Functional` | INTERFACE | Pipeline (+Curry, +Memo), Either (+Opt), Result (`std::expected` + Error cause chains, reflection `repr`), Retry. |
| `Containers` | INTERFACE | Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval. |
| `Math` | INTERFACE | Vec/Mat, Matrix, Numeric, Random, Histogram. |
| `Text` | INTERFACE | Str, Format, Tokenizer, Diff, Encoding (Base64/Hex), Semver. |
| `Data` | INTERFACE | Json, Csv, Ini. |
| `Async` | INTERFACE | Coro (Task, Generator), Concurrency (ThreadPool, MPMC Channel, parallel_for), EventBus, Observable. |
| `Time` | INTERFACE | Stopwatch (+ScopedTimer), duration/ISO-8601 formatting, Bench. |
| `Log` | SHARED | `Void::Log` header-only facade (global sink, used by all modules) + `Void::Logging` framework (`Logger` ABC, ConsoleLogger, FileLogger). |
| `System` | SHARED | FileSystem path utilities (`Result`-based, RAII TempDir) + Process. |
| `Configuration` | SHARED | Layered key-value Config, Env + Argparse. |
| `Stacktrace` | SHARED | Stack capture + source snippets via Boost.Stacktrace; ANSI color helpers. |
| `Plugin` | SHARED | dlopen-based plugin loader with C ABI, hot reload, state transfer. |
| `StateMachine` | INTERFACE | Compile-time variant-based FSM. |
| `Testing` | STATIC | Self-registering test framework with fixtures, tags, JUnit/console reporters, crash capture. |
| `TestingMock` | INTERFACE | Mock framework: `MockFunction`, `Mock<Derived>`, matchers, move-only actions. |
## Adding a module
+31 -8
View File
@@ -1,5 +1,6 @@
set_property(GLOBAL PROPERTY VOID_MODULES "")
set_property(GLOBAL PROPERTY VOID_EXT_DEPS "")
set_property(GLOBAL PROPERTY VOID_PENDING_OPTIONAL_DEPS "")
function(void_add_module MODULE_NAME)
cmake_parse_arguments(ARG "" ""
@@ -46,14 +47,14 @@ function(void_add_module MODULE_NAME)
target_link_libraries(${TGT} ${SCOPE} ${PROJECT_NAME}::${int_dep})
endforeach()
get_property(CURRENT_MODULES GLOBAL PROPERTY VOID_MODULES)
foreach(opt_dep IN LISTS ARG_OPTIONAL_DEPS)
if(${opt_dep} IN_LIST CURRENT_MODULES)
target_link_libraries(${TGT} ${SCOPE} ${PROJECT_NAME}::${opt_dep})
string(TOUPPER ${opt_dep} UPPER_DEP)
target_compile_definitions(${TGT} ${SCOPE} VOID_HAS_${UPPER_DEP})
endif()
endforeach()
# Optional deps are resolved in void_finalize_modules() after every
# module has been discovered, so resolution does not depend on the
# alphabetical order in which src/ subdirectories are processed.
if(ARG_OPTIONAL_DEPS)
string(REPLACE ";" "," _opt_list "${ARG_OPTIONAL_DEPS}")
set_property(GLOBAL APPEND PROPERTY VOID_PENDING_OPTIONAL_DEPS
"${TGT}|${SCOPE}|${_opt_list}")
endif()
if(ARG_EXTERNAL_DEPS)
target_link_libraries(${TGT} ${SCOPE} ${ARG_EXTERNAL_DEPS})
@@ -138,3 +139,25 @@ function(void_add_module MODULE_NAME)
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endfunction()
# Resolve OPTIONAL_DEPS recorded by void_add_module(). Must be called once
# after all modules have been discovered. Each present dep is linked and
# defines VOID_HAS_<UPPERCASE_DEP> on the dependent target.
function(void_finalize_modules)
get_property(_modules GLOBAL PROPERTY VOID_MODULES)
get_property(_pending GLOBAL PROPERTY VOID_PENDING_OPTIONAL_DEPS)
foreach(_entry IN LISTS _pending)
string(REPLACE "|" ";" _parts "${_entry}")
list(GET _parts 0 _tgt)
list(GET _parts 1 _scope)
list(GET _parts 2 _deps_packed)
string(REPLACE "," ";" _deps "${_deps_packed}")
foreach(_dep IN LISTS _deps)
if(_dep IN_LIST _modules)
target_link_libraries(${_tgt} ${_scope} ${PROJECT_NAME}::${_dep})
string(TOUPPER ${_dep} _upper)
target_compile_definitions(${_tgt} ${_scope} VOID_HAS_${_upper})
endif()
endforeach()
endforeach()
endfunction()
+1 -1
View File
@@ -1,5 +1,5 @@
#example how add module
void_add_module(Logging
void_add_module(Log
INTERNAL_DEPS Core
EXTERNAL_DEPS glaze::glaze
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
#pragma once
#include <Void/Concurrency/ThreadPool.hpp>
#include <Void/Async/ThreadPool.hpp>
#include <concepts>
#include <future>
#include <vector>
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3 -3
View File
@@ -1,10 +1,10 @@
#pragma once
#include <Void/Configuration/Env.hpp>
#include <Void/FileSystem/Path.hpp>
#include <Void/System/Path.hpp>
#include <Void/Log/Log.hpp>
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <format>
#include <initializer_list>
+2 -2
View File
@@ -1,7 +1,7 @@
#pragma once
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <cstdlib>
#include <format>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
#pragma once
#include <Void/Random/Random.hpp>
#include <Void/Hash/Hash.hpp>
#include <Void/Math/Random.hpp>
#include <Void/Core/Hash.hpp>
#include <array>
#include <cstdint>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
#pragma once
#include <Void/Either/Either.hpp>
#include <Void/Functional/Either.hpp>
#include <functional>
#include <optional>
#include <stdexcept>
File renamed without changes.
@@ -1,6 +1,6 @@
#pragma once
#include <Void/Result/Error.hpp>
#include <Void/Functional/Error.hpp>
#include <concepts>
#include <expected>
File renamed without changes.
@@ -1,6 +1,6 @@
#pragma once
#include <Void/Logging/Logger.hpp>
#include <Void/Log/Logger.hpp>
#include <iosfwd>
@@ -1,6 +1,6 @@
#pragma once
#include <Void/Logging/Level.hpp>
#include <Void/Log/Level.hpp>
#include <chrono>
#include <source_location>
@@ -1,8 +1,8 @@
#pragma once
#include <Void/Logging/Logger.hpp>
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Log/Logger.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <filesystem>
#include <fstream>
File renamed without changes.
+32 -2
View File
@@ -1,6 +1,9 @@
#pragma once
#include <functional>
#include <mutex>
#include <shared_mutex>
#include <string_view>
#include <utility>
namespace Void::Log
{
@@ -21,14 +24,41 @@ namespace Void::Log
using Sink = std::function<void(
Level level, std::string_view module, std::string_view message)>;
namespace Detail
{
struct SinkState {
Sink sink;
std::shared_mutex mutex;
};
inline SinkState& sink_state()
{
static SinkState state;
return state;
}
} // namespace Detail
/// Install the global sink. Any previously installed sink is replaced.
/// Pass a default-constructed (empty) Sink to silence all output.
/// Thread-safe: the new sink is visible to all threads after this returns.
void set_sink(Sink sink);
inline void set_sink(Sink sink)
{
auto& state = Detail::sink_state();
std::unique_lock lock{state.mutex};
state.sink = std::move(sink);
}
/// Emit one log event through the global sink.
/// No-op (zero allocation) if no sink is installed.
/// Thread-safe with respect to set_sink() and concurrent log() calls.
void log(Level level, std::string_view module, std::string_view message);
inline void log(Level level, std::string_view module,
std::string_view message)
{
auto& state = Detail::sink_state();
std::shared_lock lock{state.mutex};
if (state.sink) {
state.sink(level, module, message);
}
}
} // namespace Void::Log
@@ -1,7 +1,7 @@
#pragma once
#include <Void/Logging/Entry.hpp>
#include <Void/Logging/Level.hpp>
#include <Void/Log/Entry.hpp>
#include <Void/Log/Level.hpp>
#include <concepts>
#include <cstddef>
+2 -2
View File
@@ -1,7 +1,7 @@
#pragma once
#include <Void/Detail/Enum.hpp>
#include <Void/Log/Log.hpp>
#include <Void/Logging/Logger.hpp>
#include <Void/Log/Logger.hpp>
// Bridge between Void::Log (the thin emission layer used by all modules) and
// Void::Logging::Logger (the full sink implementation).
@@ -11,7 +11,7 @@
//
// Example:
// #include <Void/Log/LoggingAdapter.hpp>
// #include <Void/Logging/ConsoleLogger.hpp>
// #include <Void/Log/ConsoleLogger.hpp>
//
// Void::Logging::ConsoleLogger logger;
// Void::Log::set_sink(Void::Log::make_sink(logger));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <ostream>
#include <string>
#include <vector>
@@ -1,8 +1,8 @@
#pragma once
#include <Void/Log/Log.hpp>
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <filesystem>
#include <format>
@@ -1,7 +1,7 @@
#pragma once
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <chrono>
#include <filesystem>
@@ -1,8 +1,8 @@
#pragma once
#include <Void/Log/Log.hpp>
#include <Void/Result/Error.hpp>
#include <Void/Result/Result.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <filesystem>
#include <format>
@@ -1,6 +1,6 @@
#pragma once
#include <Void/FileSystem/Path.hpp>
#include <Void/System/Path.hpp>
#include <Void/Log/Log.hpp>
#include <atomic>
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <Void/Result/Detail/Repr.hpp>
#include <Void/Functional/Detail/Repr.hpp>
#include <Void/Testing/Config.hpp>
#include <Void/Testing/Detail/Registry.hpp>
#include <concepts>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
View File
@@ -0,0 +1 @@
void_add_module(Async)
-3
View File
@@ -1,3 +0,0 @@
void_add_module(Concurrency
INTERNAL_DEPS Log
)
@@ -1,4 +1,4 @@
#include <Void/Argparse/Argparse.hpp>
#include <Void/Configuration/Argparse.hpp>
#include <sstream>
+1 -1
View File
@@ -1,3 +1,3 @@
void_add_module(Configuration
INTERNAL_DEPS Result FileSystem Log
INTERNAL_DEPS Functional System
)
+1
View File
@@ -0,0 +1 @@
void_add_module(Containers)
+1
View File
@@ -0,0 +1 @@
void_add_module(Core)
+1
View File
@@ -0,0 +1 @@
void_add_module(Data)
-3
View File
@@ -1,3 +0,0 @@
void_add_module(FileSystem
INTERNAL_DEPS Result Log
)
+1
View File
@@ -0,0 +1 @@
void_add_module(Functional)
@@ -1,5 +1,5 @@
#include <Void/Detail/Enum.hpp>
#include <Void/Logging/ConsoleLogger.hpp>
#include <Void/Log/ConsoleLogger.hpp>
#ifdef VOID_HAS_STACKTRACE
#include <Void/Stacktrace/Color.hpp>
File renamed without changes.
@@ -1,4 +1,4 @@
#include <Void/Logging/FileLogger.hpp>
#include <Void/Log/FileLogger.hpp>
#include <Void/Log/Log.hpp>
#include <format>
+1 -1
View File
@@ -1,4 +1,4 @@
#include <Void/Logging/Level.hpp>
#include <Void/Log/Level.hpp>
#include <string_view>
namespace Void::Logging
{
-28
View File
@@ -1,28 +0,0 @@
#include <Void/Log/Log.hpp>
#include <mutex>
#include <shared_mutex>
namespace Void::Log
{
namespace
{
Sink g_sink;
std::shared_mutex g_mutex;
} // namespace
void set_sink(Sink sink)
{
std::unique_lock lock{g_mutex};
g_sink = std::move(sink);
}
void log(Level level, std::string_view module, std::string_view message)
{
std::shared_lock lock{g_mutex};
if (g_sink) {
g_sink(level, module, message);
}
}
} // namespace Void::Log
@@ -1,4 +1,4 @@
#include <Void/Logging/Logger.hpp>
#include <Void/Log/Logger.hpp>
#include <utility> // std::exchange
+4 -1
View File
@@ -1 +1,4 @@
void_add_module(Log)
void_add_module(Log
INTERNAL_DEPS Functional
OPTIONAL_DEPS Stacktrace
)
-4
View File
@@ -1,4 +0,0 @@
void_add_module(Logging
INTERNAL_DEPS Result Log
OPTIONAL_DEPS Stacktrace
)
+1
View File
@@ -0,0 +1 @@
void_add_module(Math)
-3
View File
@@ -1,3 +0,0 @@
void_add_module(Process
INTERNAL_DEPS Result Log
)
-1
View File
@@ -1 +0,0 @@
void_add_module(Result)
+1 -1
View File
@@ -1,5 +1,5 @@
void_add_module(Stacktrace
INTERNAL_DEPS Result Log
INTERNAL_DEPS Functional
EXTERNAL_DEPS Boost::stacktrace_backtrace
DEPS_WIN32 dbghelp
DEPS_UNIX dl
+1
View File
@@ -0,0 +1 @@
void_add_module(StateMachine)
@@ -1,4 +1,4 @@
#include <Void/Process/Process.hpp>
#include <Void/System/Process.hpp>
#include <Void/Log/Log.hpp>
#include <format>
+3
View File
@@ -0,0 +1,3 @@
void_add_module(System
INTERNAL_DEPS Functional
)
+23 -23
View File
@@ -14,8 +14,8 @@
#include <Void/Testing/JUnitReporter.hpp>
#include <Void/Time/Format.hpp>
#ifdef VOID_HAS_CONCURRENCY
#include <Void/Concurrency/ThreadPool.hpp>
#ifdef VOID_HAS_ASYNC
#include <Void/Async/ThreadPool.hpp>
#include <future>
#endif
@@ -25,15 +25,15 @@
#include <cstdlib>
#endif
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
#include <Void/Log/LoggingAdapter.hpp>
#include <Void/Logging/ConsoleLogger.hpp>
#include <Void/Logging/FileLogger.hpp>
#include <Void/Logging/Level.hpp>
#include <Void/Log/ConsoleLogger.hpp>
#include <Void/Log/FileLogger.hpp>
#include <Void/Log/Level.hpp>
#endif
#ifdef VOID_HAS_STR
#include <Void/Str/Str.hpp>
#ifdef VOID_HAS_TEXT
#include <Void/Text/Str.hpp>
#endif
#include <algorithm>
@@ -345,7 +345,7 @@ namespace Void::Testing
constexpr std::size_t OPT_WIDTH = 23;
auto opt = [&](std::string_view name) {
#ifdef VOID_HAS_STR
#ifdef VOID_HAS_TEXT
return apply(green, Void::Str::pad_right(name, OPT_WIDTH));
#else
std::string s{name};
@@ -377,13 +377,13 @@ namespace Void::Testing
<< "\n"
<< " " << opt("--output <file>")
<< apply(dim, "Write reporter output to a file") << "\n"
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
<< " " << opt("--log-file <file>")
<< apply(dim,
"Mirror test events to <file> via Void::Logging")
<< "\n"
#endif
#ifdef VOID_HAS_CONCURRENCY
#ifdef VOID_HAS_ASYNC
<< " " << opt("--parallel <n>")
<< apply(dim,
"Run tests across n threads (no crash detection)")
@@ -414,7 +414,7 @@ namespace Void::Testing
auto reporter = create_reporter(config);
// ── Optional: file logger sink (requires Void::Logging) ──────────────────
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
std::unique_ptr<Void::Logging::FileLogger> log_sink;
if (!config.log_file.empty()) {
try {
@@ -433,7 +433,7 @@ namespace Void::Testing
#endif
// ── Optional: VOID_LOG_LEVEL auto-sink ───────────────────────────────────
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
std::unique_ptr<Void::Logging::ConsoleLogger> env_log;
{
#ifdef VOID_HAS_CONFIGURATION
@@ -463,7 +463,7 @@ namespace Void::Testing
Void::Log::set_sink(Void::Log::make_sink(*env_log));
}
}
#endif // VOID_HAS_LOGGING
#endif // VOID_HAS_LOG
if (config.list_only) {
for (const auto& t : tests) {
@@ -485,7 +485,7 @@ namespace Void::Testing
}
auto log_result = [&](const TestResult& r, const std::string& q) {
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
if (!log_sink) {
return;
}
@@ -523,7 +523,7 @@ namespace Void::Testing
// ── Optional: parallel execution (requires Void::Concurrency) ────────────
bool run_parallel = config.parallel_threads > 0;
#ifndef VOID_HAS_CONCURRENCY
#ifndef VOID_HAS_ASYNC
if (run_parallel) {
std::cerr << "warning: --parallel requires Void::Concurrency "
"(not linked); running sequentially\n";
@@ -532,9 +532,9 @@ namespace Void::Testing
#endif
if (run_parallel) {
#ifdef VOID_HAS_CONCURRENCY
#ifdef VOID_HAS_ASYNC
reporter->on_run_start(config, static_cast<int>(tests.size()));
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
if (log_sink) {
log_sink->info(std::format(
"run start (parallel, {} threads): {} test(s)",
@@ -575,10 +575,10 @@ namespace Void::Testing
suite_results[suite_index[test.suite]].tests.push_back(
std::move(result));
}
#endif // VOID_HAS_CONCURRENCY
#endif // VOID_HAS_ASYNC
} else {
reporter->on_run_start(config, static_cast<int>(tests.size()));
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
if (log_sink) {
log_sink->info(std::format("run start: {} test(s) discovered",
tests.size()));
@@ -587,7 +587,7 @@ namespace Void::Testing
if (config.shuffle) {
std::shuffle(tests.begin(), tests.end(),
std::mt19937{config.random_seed});
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
if (log_sink) {
log_sink->info(std::format("shuffle enabled (seed = {})",
config.random_seed));
@@ -609,7 +609,7 @@ namespace Void::Testing
[&](const auto& t) {
return t.suite == suite.name;
}));
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
if (log_sink) {
log_sink->info(std::format("suite start: {}",
suite.name));
@@ -653,7 +653,7 @@ namespace Void::Testing
}
run_result.total_duration = end_time - start_time;
reporter->on_run_end(run_result);
#ifdef VOID_HAS_LOGGING
#ifdef VOID_HAS_LOG
if (log_sink) {
log_sink->info(
std::format("run end: {} total / {} passed / {} failed / {} "
+1 -1
View File
@@ -1,3 +1,3 @@
void_add_module(Testing
OPTIONAL_DEPS Stacktrace Logging Concurrency Configuration Str
OPTIONAL_DEPS Stacktrace Log Async Configuration Text
)
+1 -1
View File
@@ -1 +1 @@
void_add_module(TestingMock INTERNAL_DEPS Testing Result)
void_add_module(TestingMock INTERNAL_DEPS Testing Functional)
+1
View File
@@ -0,0 +1 @@
void_add_module(Text)
+1
View File
@@ -0,0 +1 @@
void_add_module(Time)
Loaded 100 of 156 files, more files were not shown because too many files have changed in this diff. Show more