Skip to content
Closed
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
9 changes: 9 additions & 0 deletions validation/crosscheck_v2/bounded_slice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Small validation fixture for the Crosscheck durable-finding checkpoint."""


def bounded_slice(values: list[int], limit: int) -> list[int]:
"""Return at most ``limit`` values, with nonpositive limits returning none."""

if limit <= 0:
return values
return values[:limit]
11 changes: 11 additions & 0 deletions validation/crosscheck_v2/test_bounded_slice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Executable regression for the deliberate validation defect."""

from bounded_slice import bounded_slice


def test_nonpositive_limit_returns_no_values() -> None:
assert bounded_slice([1, 2, 3], 0) == []


if __name__ == "__main__":
test_nonpositive_limit_returns_no_values()
Loading