microsoft / microsoft/STL

Test: Concept "archetype" test readability is poor

Open
#928 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

test
Dominant language
C++
Stars
11.2k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Many (all?) of the tests for standard library concepts have an archetype model in which one or more types are parameterized on an integral value. That value selects precisely one of the concept's requirements which the archetype will then violate. We then have either a sequence of static_asserts (or something more template-y where one function template calls another in a fold expression over an index sequence because Casey never met a problem that couldn't be solved with more complicated metaprogramming) that e.g. archetype<42> satisfies the concept but all specializations with a parameter lower than 42 do not.

Testing-wise this is all great, but the readability of these tests is poor. The mapping between parameter values and requirements is either undocumented and must be derived by scrutinizing the code or scattered around in comments // 11: don't satisfy frobnicate. If we could devise a way to encode these mappings in (probably scoped) enumerations with descriptive enumerator names, it would help tons.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by surveying the standard library concept tests that use parameterized archetypes and trace how each integral value maps to a violated requirement. The work is complete when those mappings are represented with descriptive, likely scoped enumerations and the tests remain behaviorally equivalent and easier to read.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.