Versions 145 to 146
Lines 1–106 at 146 (were 1–83 at 145)
34import { ExperimentalMarkerProjection as MarkerProjection } from "../experimental/projection-marker.ts";
810
9−test("typed marker projection matches competing cyclic moves and removals", () => {
10− const db = new SqlState();
11− try {
12− const repo = Repo.init({ "f.txt": Array.from({ length: 12 }, (_, n) => `${n}\n`).join("") }),
13− graph = new Graph({ storage: new CachedStateStorage(db) }),
14− rng = new Rng(45131);
15− graph.add(repo.graph.atom("a0"));
16− const p = new MarkerProjection(db, graph, "f.txt", "typed-" + "cycle");
17− let state = p.apply(p.empty(), repo.graph.atom("a0")),
18− checks = 0;
19− const atoms = [];
20− const check = () => {
21− const view = repo.view();
22− assert.deepEqual(
23− p.lines(state),
24− view.lines("f.txt").map((x) => x.id),
25− );
26− for (let n = 0; n < 12; n++) {
27− const parent = view.parentOf(`a0.${n}`);
28− assert.equal(
29− (p.markers.get(state.locator, n + 1) as { parentKey: number }).parentKey,
30− parent.startsWith("^") ? 0 : graph.lineN(parent) + 1,
12+ test(`typed marker projection matches competing cyclic moves and removals (paged=${paged})`, () => {
32− }
33− checks++;
34− };
35− for (let j = 0; j < 24; j++) {
36− const offset = rng.int(12),
37− moves = Array.from({ length: 3 }, (_, i) => {
38− const line = `a0.${(offset + i) % 12}`,
39− candidate = `a0.${rng.int(12)}`;
40− return { line, parent: candidate === line ? "^f.txt" : candidate };
41− });
42− const atom = {
43− id: repo.graph.nextId(),
44− seq: repo.graph.size,
45− author: "fixture",
46− message: "move",
47− time: j,
48− inserts: [],
49− deletes: [],
50− writes: moves.flatMap((m) => [`P:${m.line}`, `G:${m.parent}`]),
51− reads: [],
52− holds: [],
53− needs: [],
54− resolves: [],
55− reasons: [],
56− deps: ["a0"],
57− moves,
59− repo.graph.add(atom);
60− repo.shared.add(atom.id);
61− graph.add(atom);
62− atoms.push(atom);
63− state = p.apply(state, atom);
64− check();
97+ "SELECT count(*) AS n FROM state WHERE collection LIKE '%sequence-resolver:%' OR collection LIKE '%sequence-relocation-work:%' OR collection LIKE '%move-adoption:%'",
66− for (const atom of atoms.filter((_, i) => i % 2 === 0)) {
67− repo.shared.delete(atom.id);
68− state = p.removeAtom(state, atom);
69− check();
70− }
71− assert.equal(
72− db.db
73− .prepare(
74− "SELECT count(*) AS n FROM state WHERE collection LIKE '%sequence-resolver:%' OR collection LIKE '%sequence-relocation-work:%'",
75− )
76− .get()!.n,
77− 0,
78− );
79− assert.equal(checks, 36);
80− } finally {
81− db.db.close();
82− }
83−});
- MCP
- compare on this site's /mcp
- CLI
- abso diff 145 146 src/engine/test/projection-marker-cycle.test.ts --json
- JSON
- /christopher/abso-core/compare/145..146?file=src%2Fengine%2Ftest%2Fprojection-marker-cycle.test.ts&format=json