Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tests to be friendlier to modules #3034

Merged
merged 7 commits into from
Aug 16, 2022

Conversation

StephanTLavavej
Copy link
Member

While experimentally running tests/std with Standard Library Modules, I encountered unnecessary dependencies on macros and non-Standard code. Although we're a long way from routinely running module configurations in tests/std, I'd like to clean up what I've found so far.

  • Avoid _Is_any_of_v. We can use is_same_v instead of this internal machinery, at minimal verbosity cost.
  • Use numeric_limits instead of macros.
  • Avoid ambiguity with std::integral, std::numbers, std::expected. After import std; using namespace std;, if test code has global-scope integral, numbers, and expected, mentioning them unqualified is ambiguous. (This is theoretically an issue for headers too, as any header is allowed to drag in any other header.)
  • Avoid the <cinttypes> print macros. These are difficult to read in any event, and static_casts are probably less annoying.

@StephanTLavavej StephanTLavavej added the test Related to test code label Aug 15, 2022
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner August 15, 2022 04:25
@AlexGuteniev
Copy link
Contributor

  • Use numeric_limits instead of macros.

Think the reverse was deliberate for throughput. <limits> is relatively heavy.

@AlexGuteniev
Copy link
Contributor

Ah, never mind, it is test code.

@StephanTLavavej StephanTLavavej self-assigned this Aug 16, 2022
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 5775a22 into microsoft:main Aug 16, 2022
@StephanTLavavej StephanTLavavej deleted the cleanup-tests branch August 16, 2022 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Related to test code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants