From ff982a1e677251ccb3a4bb90ab9f3e7f91e40f67 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 00:05:38 +0700 Subject: [PATCH] t27o: rust_std.t27 function test coverage 88 % -> 100 % (Closes #10550) One test names digits_upto, parse_unsigned, parse_signed, sum_u64, sum_usize, sum_i32 and sum_f32 directly: both sides of every bound, a lone sign, i64::MIN, u64::MAX exactly, an empty slice. t27c coverage 59 of 59; t27b 11/11; test-report 11/11 with 0 vacuous; a mutant of the digits_upto overflow guard fails it (and one existing test). Co-Authored-By: Claude Opus 5.5 --- .trinity/seals/t27o_T27oRustStd.json | 20 ++++++++--------- specs/tools/t27o/rust_std.t27 | 32 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/.trinity/seals/t27o_T27oRustStd.json b/.trinity/seals/t27o_T27oRustStd.json index 8137a05e69..c9298463cc 100644 --- a/.trinity/seals/t27o_T27oRustStd.json +++ b/.trinity/seals/t27o_T27oRustStd.json @@ -1,5 +1,5 @@ { - "built_by": "t27c-bootstrap@0.5.2+262746089", + "built_by": "t27c-bootstrap@0.5.2+9b556b7c3", "closure": [ { "spec": "specs/hosting/toolchain.t27", @@ -15,27 +15,27 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:2761293642eb099cc257c46cabb57edbcc63ce841f17c8392272c26a3c197256", - "gen_hash_rust": "sha256:455339c3be513e911ec8bbea8d4bab01b77bc3d6799dea488edccacd95147e64", - "gen_hash_verilog": "sha256:a15e71febb0aec7f75316957883dd7316168bf680b33c9aba0cd8fcda57433e4", - "gen_hash_zig": "sha256:29dc623cc1b486c76c74e3929f358c6808dfce7c80112b89204a53174ce44133", + "gen_hash_c": "sha256:e2f3310cb7a4bc69c3719299098b247d1b4deac743249978de470617b8abc7f1", + "gen_hash_rust": "sha256:054308d17bce7b04be20ef206e53be8ec05ff7174609b2598bcadc2dc38cdbd7", + "gen_hash_verilog": "sha256:ae1350281fd19042bc344b29572b65a18760f4d1d7f0a7703b1b03be9cd7137e", + "gen_hash_zig": "sha256:df61571a23405733bc65b2641f0e32e59098be2cc60f857c963c3a1bfeadb556", "module": "T27oRustStd", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-12T12:21:08Z", + "sealed_at": "2026-10-18T17:04:56Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:32ee8d8c4af07ad5db18cc961fc3965e491e806a0a40a6129b82aae40f1e4547", + "spec_hash": "sha256:ee1cf77e327861bfa2fe6ae0d4179a610f24e5603d028a53b075739448c0e73a", "spec_path": "specs/tools/t27o/rust_std.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 10, - "total": 10, + "passed": 11, + "total": 11, "vacuous": 0 }, "toolchain": { - "test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d", + "test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10", "zig": "0.16.0" } } \ No newline at end of file diff --git a/specs/tools/t27o/rust_std.t27 b/specs/tools/t27o/rust_std.t27 index 8da0f0a809..fd32d895e6 100644 --- a/specs/tools/t27o/rust_std.t27 +++ b/specs/tools/t27o/rust_std.t27 @@ -1409,3 +1409,35 @@ test std_strip_prefix_suffix_are_option_slices { assert(!starts_with_digit("x1")); assert(!starts_with_digit("")); } + +// The helpers the parse_* fns share, and the sums no other test named (t27c coverage: 52 of 59 fns +// before this test, #10522). Each bound is checked on both sides: the largest value that parses and +// the first one that does not. +test std_parse_helpers_and_the_other_sums_named_directly { + assert(digits_upto("123", 0, 999).? == 123); + assert(digits_upto("123", 1, 999).? == 23); + assert(digits_upto("999", 0, 999).? == 999); + assert(digits_upto("1000", 0, 999) == null); + assert(digits_upto("12a", 0, 999) == null); + assert(digits_upto("12", 2, 999) == null); + assert(parse_unsigned("+42", 100).? == 42); + assert(parse_unsigned("100", 100).? == 100); + assert(parse_unsigned("101", 100) == null); + assert(parse_unsigned("-42", 100) == null); + assert(parse_unsigned("+", 100) == null); + assert(parse_signed("-128", 127).? == -128); + assert(parse_signed("-129", 127) == null); + assert(parse_signed("+127", 127).? == 127); + assert(parse_signed("128", 127) == null); + assert(parse_signed("-", 127) == null); + assert(parse_signed("-9223372036854775808", 9223372036854775807).? == -9223372036854775807 - 1); + const a : [3]u64 = [1, 2, 18446744073709551612]; + assert(sum_u64(a[0 .. 3]) == 18446744073709551615); + assert(sum_u64(a[0 .. 0]) == 0); + const b : [2]usize = [3, 4]; + assert(sum_usize(b[0 .. 2]) == 7); + const c : [3]i32 = [-5, 7, -2147483646]; + assert(sum_i32(c[0 .. 3]) == -2147483644); + const d : [3]f32 = [0.5, 1.25, -2.0]; + assert(sum_f32(d[0 .. 3]) == -0.25); +}