Skip to content

test(splitter): add boundary tests for splits_of_paged (#325) - #403

Merged
Spagero763 merged 3 commits into
tributary-protocol:mainfrom
Hollujay:test/325-splits-of-paged-coverage
Jul 30, 2026
Merged

test(splitter): add boundary tests for splits_of_paged (#325)#403
Spagero763 merged 3 commits into
tributary-protocol:mainfrom
Hollujay:test/325-splits-of-paged-coverage

Conversation

@Hollujay

Copy link
Copy Markdown
Contributor

Description

splits_of_paged had no tests. Pagination logic is exactly the kind of code that silently breaks at its boundaries. This PR adds four test cases covering all edge cases identified in #325.

Changes

Added 4 tests to contracts/splitter/src/test.rs:

  • splits_of_paged_start_beyond_list_length — verifies that a start index equal to or greater than the list length returns an empty page
  • splits_of_paged_limit_zero — verifies that a limit of 0 returns an empty page regardless of start
  • splits_of_paged_runs_past_end — verifies that when fewer items remain than the requested limit, the page correctly stops at the end of the list
  • splits_of_paged_lands_exactly_on_last_item — verifies that a start + limit landing exactly on the last item returns that single item

CI

  • cargo fmt — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo test — all 68 tests pass

Closes #325

@Hollujay
Hollujay requested a review from Spagero763 as a code owner July 28, 2026 08:51
@Spagero763
Spagero763 merged commit aba3168 into tributary-protocol:main Jul 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for splits_of_paged

2 participants