Skip to content

Cleanup tests to be friendlier to modules - #3034

Merged
Stephan T. Lavavej (StephanTLavavej) merged 7 commits into
microsoft:mainfrom
StephanTLavavej:cleanup-tests
Aug 16, 2022
Merged

Cleanup tests to be friendlier to modules#3034
Stephan T. Lavavej (StephanTLavavej) merged 7 commits into
microsoft:mainfrom
StephanTLavavej:cleanup-tests

Conversation

@StephanTLavavej

Copy link
Copy Markdown
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.

@AlexGuteniev

Copy link
Copy Markdown
Contributor
  • Use numeric_limits instead of macros.

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

@AlexGuteniev

Copy link
Copy Markdown
Contributor

Ah, never mind, it is test code.

@StephanTLavavej

Copy link
Copy Markdown
Member Author

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

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