Skip to content

Updates to Ranges test machinery - #959

Merged
Stephan T. Lavavej (StephanTLavavej) merged 2 commits into
microsoft:masterfrom
CaseyCarter:peek
Jul 3, 2020
Merged

Stephan T. Lavavej (StephanTLavavej) merged 2 commits into
microsoft:masterfrom
CaseyCarter:peek

Conversation

@CaseyCarter

@CaseyCarter Casey Carter (CaseyCarter) commented Jul 1, 2020

Copy link
Copy Markdown
Contributor
  • Replace base member of test::iterator and test::sentinel with peek. The point is to break the abstraction and provide access to the internal pointer. There's no reason to mimic the behavior of iterator/sentinel adaptors, it just makes the test tool harder to use.

  • test::range::begin enforces the restriction that it may be called at most once for a single-pass range. test::range::_Unchecked_begin should be subject to the same restriction.

  • Remove default template arguments for the element types of ranges in the instantiation helpers (test_in, test_fwd_fwd, etc.) forcing the element types to be explicitly specified.

@CaseyCarter Casey Carter (CaseyCarter) added the test Related to test code label Jul 1, 2020
@CaseyCarter
Casey Carter (CaseyCarter) requested a review from a team as a code owner July 1, 2020 17:26
@CaseyCarter Casey Carter (CaseyCarter) changed the title Replace "base" member of test::iterator and test::sentinel with "peek" Updates to Ranges test machinery Jul 1, 2020
@miscco

Copy link
Copy Markdown
Contributor

This manages to both look great and create a terrible headache for all the coming merge conflicts

@CaseyCarter

Copy link
Copy Markdown
Contributor Author

This manages to both look great and create a terrible headache for all the coming merge conflicts

Stephan T. Lavavej (@StephanTLavavej) has been calling me "Merge Conflict" for years now.

@StephanTLavavej

Copy link
Copy Markdown
Member

Back when Billy O'Neal (@BillyONeal) and Casey Carter (@CaseyCarter) were in the same office, and were constantly submitting PRs with merge conflicts against each other, I placed a sticky note over their office nameplate, dubbing them Billy "Merge" O'Neal and Casey "Conflict" Carter. 😹

Comment thread tests/std/tests/P0896R4_ranges_alg_for_each/test.cpp
Comment thread tests/std/include/range_algorithm_support.hpp
* The point is to break the abstraction and provide access to the internal pointer. There's no reason to mimic the behavior of iterator/sentinel adaptors, it just makes the test tool harder to use.

* Enforce that `begin` is called at most once in `test::range::_Unchecked_begin`

* Remove default arguments to the `test_meow` functions in `<range_algorithm_support.hpp>`.
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for making it easier to test ranges!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ranges C++20/23 ranges test Related to test code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants