Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .trinity/seals/claw_ClawSuggest.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"built_by": "t27c-bootstrap@0.5.2+4ab200073",
"built_by": "t27c-bootstrap@0.5.2+9448ab4be",
"closure": [
{
"spec": "specs/claw/text.t27",
"spec_hash": "sha256:b65da69dff231c61a6d3a48558af9e17af42e1acbe3f4763348f1f0c2f118f21"
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:1c6dd4d239fd700edc472b628df24597dd11f5b63a76f1050aa09bffbd251da7",
"gen_hash_rust": "sha256:c719fcf00bf17ed2b6ff36cc2c500ee6dd6c593afde71753f543dc68d802d8bb",
"gen_hash_verilog": "sha256:7590f417bd9b0f1430ef2a6db553db3d0e35466f357b78a002621d2fd7e2cb42",
"gen_hash_zig": "sha256:a69878738101760c4f62d0be49005006e3cd0ccee945decf7c0b6fe2aa23001e",
"gen_hash_c": "sha256:7f8fd10201c8fc786ce03ed298ffc150166460c2d64cc3c3fea9714a21a59b77",
"gen_hash_rust": "sha256:b6ffaa050395bea50bd5acc89e83fe44216afa753f4f26279be723a3d60b8a43",
"gen_hash_verilog": "sha256:2a8ff2bd1b0b31cb34c8fc3f9fb5f4ec27c5a3b29f288c7cc6c9fe2f98c07383",
"gen_hash_zig": "sha256:35ccc87874786e0b00745b0e14f0b0434fa9aaa9140de5a1dc024c67dc5d5c67",
"module": "ClawSuggest",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-18T09:41:18Z",
"sealed_at": "2026-10-18T21:52:54Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:43afee144a92a59e27539c51a344ae9e03d88c14e3c5ab3d9f24cddedab6c325",
"spec_hash": "sha256:f63b4eb62478b8b94accec867c5e0e5ff908d340771a7fe45bdc54ba05f9ff6c",
"spec_path": "specs/claw/suggest.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 16,
"total": 16,
"passed": 22,
"total": 22,
"vacuous": 0
},
"toolchain": {
"test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d",
"test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10",
"zig": "0.16.0"
}
}
59 changes: 59 additions & 0 deletions specs/claw/suggest.t27
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,62 @@ test no_hunks_and_no_ranges_post_nothing {
assert plan(1, hf, hs, hc, hk, 0, df, ds, dl, out) == 0;
assert out[0] == V_OUTSIDE;
}

// Tests below were added by the mutation sweep of #10673 (tick 19); each names the mutants it kills.

// path_is_t27: each of the last two bytes is checked on its own (`return false` -> `return true` on '2' and on '7').
test each_byte_of_the_extension_is_checked {
var no : [3]str = ["a.t37", "a.t28", "a.t2"];
for i in 0..3 { assert path_is_t27(no[i], no[i].len) == false; }
}

// header_new_range edges: the digit '9' (`<= '9'` -> `< '9'`), seven-digit start and count (`> 7` -> `>= 7`).
test header_parse_takes_nine_and_seven_digits {
var out : [2]u32 = [0, 0];
var h1 : str = "@@ -9 +19,9 @@";
assert header_new_range(h1, h1.len, out) == true;
assert out[0] == 19;
assert out[1] == 9;
var h2 : str = "@@ -1 +1234567,7654321 @@";
assert header_new_range(h2, h2.len, out) == true;
assert out[0] == 1234567;
assert out[1] == 7654321;
}

// header_new_range: every byte the grammar fixes is checked by its own line. Each header below is
// wrong in exactly one place, and the parse must refuse it without writing (kills `return false` ->
// `return true` on the '-', the empty base count, the ' ' and '+' before the head range, an
// eight-digit head count, the ' @@' tail, and `p + 1` -> `p + 2` on the tail).
test header_parse_refuses_each_single_byte_fault {
var out : [2]u32 = [7, 7];
var bad : [8]str = ["@@ +1 +1 @@", "@@ -1, +1 @@", "@@ -1x +1 @@", "@@ -1 -1 @@", "@@ -1 +1,12345678 @@", "@@ -1 +1 x@@", "@@ -1 +1 @x", "@@ -1 +1@@ "];
for i in 0..8 {
assert header_new_range(bad[i], bad[i].len, out) == false;
assert out[0] == 7;
assert out[1] == 7;
}
}

// in_one_range: a one-line diff range covers its line (`dlen >= 1` -> `> 1`).
test a_one_line_diff_range_covers_its_line {
var df : [1]u32 = [1];
var ds : [1]u32 = [5];
var dl : [1]u32 = [1];
assert in_one_range(1, 5, 5, df, ds, dl, 1) == true;
assert in_one_range(1, 6, 6, df, ds, dl, 1) == false;
}

// hunk_unknown: two hunks sharing exactly one line overlap, read from the later one (`f1 <= l2` -> `<`).
test hunks_sharing_one_line_overlap_from_both_sides {
var hf : [2]u32 = [1, 1];
var hs : [2]u32 = [10, 12];
var hc : [2]u32 = [3, 3];
var hk : [2]u8 = [K_REPLACE, K_REPLACE];
assert hunk_unknown(0, 2, hf, hs, hc, hk) == true;
assert hunk_unknown(1, 2, hf, hs, hc, hk) == true;
}

// should_post: one comment is a review (`>= 1` -> `> 1`).
test one_comment_is_a_review {
assert should_post(1) == true;
}
Loading