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:
1 parent
da2e93c405
commit
28b94883fd
156 files changed
+278
-220
No files matched your search
@@ -0,0 +1,91 @@
|
||||
#include <Void/Containers/DisjointSet.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
|
||||
using namespace Void::DisjointSet;
|
||||
|
||||
Void::Testing::Test disjoint_initial_state()
|
||||
{
|
||||
DisjointSet ds{5};
|
||||
Void::Testing::expect_eq(ds.count(), std::size_t{5});
|
||||
Void::Testing::expect_eq(ds.size(), std::size_t{5});
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_each_element_own_component()
|
||||
{
|
||||
DisjointSet ds{4};
|
||||
for (std::size_t i = 0; i < 4; ++i)
|
||||
for (std::size_t j = i + 1; j < 4; ++j)
|
||||
Void::Testing::expect(!ds.connected(i, j));
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_unite_reduces_count()
|
||||
{
|
||||
DisjointSet ds{5};
|
||||
ds.unite(0, 1);
|
||||
Void::Testing::expect_eq(ds.count(), std::size_t{4});
|
||||
ds.unite(1, 2);
|
||||
Void::Testing::expect_eq(ds.count(), std::size_t{3});
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_unite_already_connected_noop()
|
||||
{
|
||||
DisjointSet ds{3};
|
||||
ds.unite(0, 1);
|
||||
const bool merged = ds.unite(0, 1);
|
||||
Void::Testing::expect(!merged);
|
||||
Void::Testing::expect_eq(ds.count(), std::size_t{2});
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_transitivity()
|
||||
{
|
||||
DisjointSet ds{5};
|
||||
ds.unite(0, 1);
|
||||
ds.unite(1, 2);
|
||||
Void::Testing::expect(ds.connected(0, 2));
|
||||
Void::Testing::expect(!ds.connected(0, 3));
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_unite_returns_true_first_time()
|
||||
{
|
||||
DisjointSet ds{4};
|
||||
Void::Testing::expect(ds.unite(2, 3));
|
||||
Void::Testing::expect(!ds.unite(2, 3));
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_full_merge_one_component()
|
||||
{
|
||||
DisjointSet ds{5};
|
||||
for (std::size_t i = 1; i < 5; ++i) ds.unite(0, i);
|
||||
Void::Testing::expect_eq(ds.count(), std::size_t{1});
|
||||
Void::Testing::expect(ds.connected(0, 4));
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_component_size()
|
||||
{
|
||||
DisjointSet ds{6};
|
||||
ds.unite(0, 1);
|
||||
ds.unite(1, 2);
|
||||
Void::Testing::expect_eq(ds.component_size(0), std::size_t{3});
|
||||
Void::Testing::expect_eq(ds.component_size(3), std::size_t{1});
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_out_of_range_throws()
|
||||
{
|
||||
DisjointSet ds{3};
|
||||
bool threw = false;
|
||||
try { [[maybe_unused]] auto r = ds.find(10); } catch (...) { threw = true; }
|
||||
Void::Testing::expect(threw);
|
||||
}
|
||||
|
||||
Void::Testing::Test disjoint_graph_connectivity()
|
||||
{
|
||||
// Graph: 0-1, 2-3, 3-4 → two components {0,1} and {2,3,4}
|
||||
DisjointSet ds{5};
|
||||
ds.unite(0, 1);
|
||||
ds.unite(2, 3);
|
||||
ds.unite(3, 4);
|
||||
Void::Testing::expect_eq(ds.count(), std::size_t{2});
|
||||
Void::Testing::expect(ds.connected(2, 4));
|
||||
Void::Testing::expect(!ds.connected(1, 4));
|
||||
}
|
||||
Reference in new issue
Block a user