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,143 @@
|
||||
#include <Void/Core/Flags.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
|
||||
using namespace Void::Flags;
|
||||
|
||||
enum class Perm : unsigned { Read = 1, Write = 2, Exec = 4 };
|
||||
|
||||
// ── construction ──────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test flags_default_is_empty()
|
||||
{
|
||||
const Flags<Perm> f;
|
||||
Void::Testing::expect(f.none());
|
||||
Void::Testing::expect(!f.any());
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_single_bit()
|
||||
{
|
||||
const Flags<Perm> f{Perm::Read};
|
||||
Void::Testing::expect(f.test(Perm::Read));
|
||||
Void::Testing::expect(!f.test(Perm::Write));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_initializer_list()
|
||||
{
|
||||
const Flags<Perm> f{Perm::Read, Perm::Write};
|
||||
Void::Testing::expect(f.test(Perm::Read));
|
||||
Void::Testing::expect(f.test(Perm::Write));
|
||||
Void::Testing::expect(!f.test(Perm::Exec));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_make_flags()
|
||||
{
|
||||
const auto f = make_flags({Perm::Read, Perm::Exec});
|
||||
Void::Testing::expect(f.test(Perm::Read));
|
||||
Void::Testing::expect(!f.test(Perm::Write));
|
||||
Void::Testing::expect(f.test(Perm::Exec));
|
||||
}
|
||||
|
||||
// ── query ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test flags_all()
|
||||
{
|
||||
const Flags<Perm> f{Perm::Read, Perm::Write};
|
||||
Void::Testing::expect(f.all(Flags<Perm>{Perm::Read}));
|
||||
Void::Testing::expect(f.all(Flags<Perm>{Perm::Read, Perm::Write}));
|
||||
Void::Testing::expect(!f.all(Flags<Perm>{Perm::Read, Perm::Write, Perm::Exec}));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_any_of()
|
||||
{
|
||||
const Flags<Perm> f{Perm::Read};
|
||||
Void::Testing::expect(f.any_of(Flags<Perm>{Perm::Read, Perm::Exec}));
|
||||
Void::Testing::expect(!f.any_of(Flags<Perm>{Perm::Write, Perm::Exec}));
|
||||
}
|
||||
|
||||
// ── mutation ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test flags_set_unset()
|
||||
{
|
||||
Flags<Perm> f;
|
||||
f.set(Perm::Read);
|
||||
Void::Testing::expect(f.test(Perm::Read));
|
||||
f.unset(Perm::Read);
|
||||
Void::Testing::expect(!f.test(Perm::Read));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_toggle()
|
||||
{
|
||||
Flags<Perm> f{Perm::Write};
|
||||
f.toggle(Perm::Write);
|
||||
Void::Testing::expect(!f.test(Perm::Write));
|
||||
f.toggle(Perm::Write);
|
||||
Void::Testing::expect(f.test(Perm::Write));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_clear()
|
||||
{
|
||||
Flags<Perm> f{Perm::Read, Perm::Write, Perm::Exec};
|
||||
f.clear();
|
||||
Void::Testing::expect(f.none());
|
||||
}
|
||||
|
||||
// ── operators ─────────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test flags_or_operator()
|
||||
{
|
||||
const auto f = Flags<Perm>{Perm::Read} | Perm::Write;
|
||||
Void::Testing::expect(f.test(Perm::Read));
|
||||
Void::Testing::expect(f.test(Perm::Write));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_and_operator()
|
||||
{
|
||||
const Flags<Perm> a{Perm::Read, Perm::Write};
|
||||
const Flags<Perm> b{Perm::Write, Perm::Exec};
|
||||
const auto c = a & b;
|
||||
Void::Testing::expect(!c.test(Perm::Read));
|
||||
Void::Testing::expect(c.test(Perm::Write));
|
||||
Void::Testing::expect(!c.test(Perm::Exec));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_xor_operator()
|
||||
{
|
||||
const Flags<Perm> a{Perm::Read, Perm::Write};
|
||||
const Flags<Perm> b{Perm::Write, Perm::Exec};
|
||||
const auto c = a ^ b;
|
||||
Void::Testing::expect(c.test(Perm::Read));
|
||||
Void::Testing::expect(!c.test(Perm::Write));
|
||||
Void::Testing::expect(c.test(Perm::Exec));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_or_two_enums()
|
||||
{
|
||||
const auto f = Perm::Read | Perm::Exec;
|
||||
Void::Testing::expect(f.test(Perm::Read));
|
||||
Void::Testing::expect(!f.test(Perm::Write));
|
||||
Void::Testing::expect(f.test(Perm::Exec));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_equality()
|
||||
{
|
||||
const Flags<Perm> a{Perm::Read, Perm::Write};
|
||||
const Flags<Perm> b{Perm::Read, Perm::Write};
|
||||
const Flags<Perm> c{Perm::Read};
|
||||
Void::Testing::expect(a == b);
|
||||
Void::Testing::expect(!(a == c));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_bool_conversion()
|
||||
{
|
||||
const Flags<Perm> empty;
|
||||
const Flags<Perm> nonempty{Perm::Read};
|
||||
Void::Testing::expect(!static_cast<bool>(empty));
|
||||
Void::Testing::expect(static_cast<bool>(nonempty));
|
||||
}
|
||||
|
||||
Void::Testing::Test flags_raw_value()
|
||||
{
|
||||
const Flags<Perm> f{Perm::Read, Perm::Exec};
|
||||
Void::Testing::expect_eq(f.raw(), unsigned{5});
|
||||
}
|
||||
Reference in new issue
Block a user