Add 20+ new modules with tests: Pipeline, Matrix, Tokenizer, ScopeGuard, Bitset, Optional, Counted, Curry, TypeMap, Bench, DisjointSet, Histogram, StopWatch, and more
Also fixes Diff/Memo/PriorityQueue from previous session: LineDiff is now an alias for Edit<string> so count_op/apply work on line diffs; Memoized uses std::apply instead of type-based get to handle duplicate arg types. 874/877 tests pass (3 are platform-gated plugin tests). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb4dd58500
commit
58ff7b38a0
65 files changed
+8987
-37
No files matched your search
@@ -0,0 +1,109 @@
|
||||
#include <Void/Interval/Interval.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
|
||||
using namespace Void::Interval;
|
||||
|
||||
// ── contains ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test interval_contains_midpoint()
|
||||
{
|
||||
const auto iv = make_interval(0, 10);
|
||||
Void::Testing::expect(iv.contains(5));
|
||||
Void::Testing::expect(iv.contains(0));
|
||||
Void::Testing::expect(!iv.contains(10));
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_contains_closed()
|
||||
{
|
||||
const auto iv = make_interval(0, 10);
|
||||
Void::Testing::expect(iv.contains_closed(10));
|
||||
Void::Testing::expect(!iv.contains_closed(11));
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_empty()
|
||||
{
|
||||
const auto iv = make_interval(5, 5);
|
||||
Void::Testing::expect(iv.empty());
|
||||
Void::Testing::expect(!make_interval(1, 2).empty());
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_length()
|
||||
{
|
||||
const auto iv = make_interval(3, 8);
|
||||
Void::Testing::expect_eq(iv.length(), 5);
|
||||
}
|
||||
|
||||
// ── set operations ────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test interval_overlaps()
|
||||
{
|
||||
const auto a = make_interval(0, 5);
|
||||
const auto b = make_interval(3, 8);
|
||||
const auto c = make_interval(5, 9);
|
||||
Void::Testing::expect(a.overlaps(b));
|
||||
Void::Testing::expect(!a.overlaps(c));
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_adjacent()
|
||||
{
|
||||
const auto a = make_interval(0, 5);
|
||||
const auto b = make_interval(5, 10);
|
||||
Void::Testing::expect(a.adjacent(b));
|
||||
Void::Testing::expect(!a.adjacent(make_interval(6, 10)));
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_hull()
|
||||
{
|
||||
const auto a = make_interval(0, 5);
|
||||
const auto b = make_interval(3, 10);
|
||||
const auto h = a.hull(b);
|
||||
Void::Testing::expect_eq(h.lo, 0);
|
||||
Void::Testing::expect_eq(h.hi, 10);
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_intersection_overlap()
|
||||
{
|
||||
const auto a = make_interval(0, 8);
|
||||
const auto b = make_interval(4, 12);
|
||||
const auto i = a.intersection(b);
|
||||
Void::Testing::expect_eq(i.lo, 4);
|
||||
Void::Testing::expect_eq(i.hi, 8);
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_intersection_disjoint()
|
||||
{
|
||||
const auto a = make_interval(0, 3);
|
||||
const auto b = make_interval(5, 9);
|
||||
const auto i = a.intersection(b);
|
||||
Void::Testing::expect(i.empty());
|
||||
}
|
||||
|
||||
Void::Testing::Test interval_clamp_value()
|
||||
{
|
||||
const auto iv = make_interval(0, 10);
|
||||
Void::Testing::expect_eq(iv.clamp(-5), 0);
|
||||
Void::Testing::expect_eq(iv.clamp(5), 5);
|
||||
Void::Testing::expect_eq(iv.clamp(15), 10);
|
||||
}
|
||||
|
||||
// ── closed helper ─────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test interval_closed_helper()
|
||||
{
|
||||
const auto iv = closed(1, 5);
|
||||
Void::Testing::expect(iv.contains(1));
|
||||
Void::Testing::expect(iv.contains(5));
|
||||
Void::Testing::expect(!iv.contains(6));
|
||||
}
|
||||
|
||||
// ── equality ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test interval_equality()
|
||||
{
|
||||
const auto a = make_interval(0, 5);
|
||||
const auto b = make_interval(0, 5);
|
||||
const auto c = make_interval(0, 6);
|
||||
Void::Testing::expect(a == b);
|
||||
Void::Testing::expect(!(a == c));
|
||||
}
|
||||
Reference in new issue
Block a user