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

+146
View File
@@ -0,0 +1,146 @@
#include <Void/Containers/Ring.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
#include <string>
#include <thread>
#include <vector>
// ── SpscRing ──────────────────────────────────────────────────────────────────
Void::Testing::Test spsc_empty_on_construction()
{
Void::Ring::SpscRing<int, 8> ring;
Void::Testing::expect(ring.empty());
}
Void::Testing::Test spsc_push_pop_single()
{
Void::Ring::SpscRing<int, 8> ring;
Void::Testing::expect(ring.push(42));
const auto v = ring.pop();
Void::Testing::expect(v.has_value());
Void::Testing::expect_eq(*v, 42);
}
Void::Testing::Test spsc_pop_empty_returns_nullopt()
{
Void::Ring::SpscRing<int, 8> ring;
Void::Testing::expect(!ring.pop().has_value());
}
Void::Testing::Test spsc_full_push_returns_false()
{
Void::Ring::SpscRing<int, 4> ring; // capacity = 3
Void::Testing::expect(ring.push(1));
Void::Testing::expect(ring.push(2));
Void::Testing::expect(ring.push(3));
Void::Testing::expect(!ring.push(4)); // full
}
Void::Testing::Test spsc_fifo_order()
{
Void::Ring::SpscRing<int, 8> ring;
for (int i = 0; i < 5; ++i) ring.push(i);
for (int i = 0; i < 5; ++i) {
const auto v = ring.pop();
Void::Testing::expect(v.has_value());
Void::Testing::expect_eq(*v, i);
}
}
Void::Testing::Test spsc_capacity_is_n_minus_one()
{
Void::Testing::expect_eq(Void::Ring::SpscRing<int, 16>::capacity(),
std::size_t{15});
}
Void::Testing::Test spsc_full_flag()
{
Void::Ring::SpscRing<int, 4> ring;
ring.push(1); ring.push(2); ring.push(3);
Void::Testing::expect(ring.full());
}
Void::Testing::Test spsc_string_values()
{
Void::Ring::SpscRing<std::string, 4> ring;
ring.push(std::string{"hello"});
const auto v = ring.pop();
Void::Testing::expect(v.has_value());
Void::Testing::expect_eq(*v, std::string{"hello"});
}
// @tag threading
Void::Testing::Test spsc_producer_consumer_threads()
{
Void::Ring::SpscRing<int, 64> ring;
constexpr int N = 50;
std::vector<int> received;
received.reserve(N);
std::thread producer([&] {
for (int i = 0; i < N; ++i) {
while (!ring.push(i)) {}
}
});
std::thread consumer([&] {
int got = 0;
while (got < N) {
auto v = ring.pop();
if (v) { received.push_back(*v); ++got; }
}
});
producer.join();
consumer.join();
Void::Testing::expect_eq(received.size(), std::size_t{N});
for (int i = 0; i < N; ++i) {
Void::Testing::expect_eq(received[i], i);
}
}
// ── MpscRing ──────────────────────────────────────────────────────────────────
Void::Testing::Test mpsc_push_pop_single()
{
Void::Ring::MpscRing<int, 8> ring;
Void::Testing::expect(ring.push(99));
const auto v = ring.pop();
Void::Testing::expect(v.has_value());
Void::Testing::expect_eq(*v, 99);
}
Void::Testing::Test mpsc_empty_on_construction()
{
Void::Ring::MpscRing<int, 8> ring;
Void::Testing::expect(ring.empty());
}
// @tag threading
Void::Testing::Test mpsc_two_producers_one_consumer()
{
Void::Ring::MpscRing<int, 128> ring;
constexpr int N = 40;
std::atomic<int> total{0};
std::thread p1([&] {
for (int i = 0; i < N; ++i) while (!ring.push(1)) {}
});
std::thread p2([&] {
for (int i = 0; i < N; ++i) while (!ring.push(2)) {}
});
std::thread consumer([&] {
int got = 0;
while (got < N * 2) {
auto v = ring.pop();
if (v) { total.fetch_add(*v, std::memory_order_relaxed); ++got; }
}
});
p1.join(); p2.join(); consumer.join();
Void::Testing::expect_eq(total.load(), N * 3); // N×1 + N×2 = 3N
}