Skip to content

Add comprehensive tests for kf::views::adjacent and kf::views::pairwise with edge case coverage#25

Merged
SergiusTheBest merged 3 commits intomainfrom
copilot/fix-24
Jul 29, 2025
Merged

Add comprehensive tests for kf::views::adjacent and kf::views::pairwise with edge case coverage#25
SergiusTheBest merged 3 commits intomainfrom
copilot/fix-24

Conversation

Copy link
Contributor

Copilot AI commented Jul 29, 2025

This PR significantly expands the test coverage for kf::views::adjacent and kf::views::pairwise in the AdjacentView.cpp test file, focusing on comprehensive edge case testing while maintaining compatibility with the project's no-exceptions requirement.

Changes Made

Extended Original Test Scenario

  • Added tests for adjacent<3> and adjacent<4> to the existing 4-element array scenario
  • Demonstrates sliding window behavior with larger N values

Added Dedicated Pairwise Testing

  • Created a separate SCENARIO("views::pairwise") to explicitly test the pairwise view
  • Uses a 5-element array to verify the pairwise functionality works correctly

Added Comprehensive Edge Case Testing

  • Tests with single-element arrays using adjacent<1>
  • Tests with two-element arrays using both adjacent<2> and pairwise
  • New: Tests for when adjacent window is larger than input range
    • adjacent<3> on 2-element array (should return empty view)
    • pairwise on 1-element array (should return empty view)
  • Ensures the views handle all boundary conditions correctly

Code Quality

  • All tests follow the existing BDD pattern using SCENARIO/GIVEN/WHEN/THEN structure
  • Maintains consistent coding style, spacing, and naming conventions
  • Uses only std::array for containers to avoid C++ exceptions per project requirements
  • Uses std::equal for range comparison following established patterns
  • No exceptions are used, ensuring compatibility with kernel driver environment

The test file now provides comprehensive coverage of the adjacent view functionality including proper handling of edge cases where the sliding window is larger than the input range.

Fixes #24.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: SergiusTheBest <4660722+SergiusTheBest@users.noreply.github.com>
Copilot AI changed the title [WIP] Add more tests for kf::views::adjacent Add comprehensive tests for kf::views::adjacent and kf::views::pairwise Jul 29, 2025
Copilot AI requested a review from SergiusTheBest July 29, 2025 21:04
… adjacent windows

Co-authored-by: SergiusTheBest <4660722+SergiusTheBest@users.noreply.github.com>
Copilot AI changed the title Add comprehensive tests for kf::views::adjacent and kf::views::pairwise Add comprehensive tests for kf::views::adjacent and kf::views::pairwise with edge case coverage Jul 29, 2025
Copilot AI requested a review from SergiusTheBest July 29, 2025 21:22
@SergiusTheBest SergiusTheBest marked this pull request as ready for review July 29, 2025 21:27
@SergiusTheBest SergiusTheBest merged commit 9a5dffe into main Jul 29, 2025
2 checks passed
@SergiusTheBest SergiusTheBest deleted the copilot/fix-24 branch July 29, 2025 21:28
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 more tests for kf::views::adjacent

2 participants