Repository navigation
Description
The snippet checker proves every ```cpp block compiles; nothing proves the examples do what the pages say (printed output, values in comments, which overload is chosen, iterator invalidation rules, exception behaviour). Several wrong comments were only found by running code by hand (e.g. localization.md promised `1,234,567.89` but printed `1.23457e+06`; a wrong `byteswap` value).
Build a full GoogleTest unit-test suite that turns the reference's claims into assertions.
Proposed
tests/with a CMake project (CMakePresets.json: gcc-15, clang-22-libc++, and a Docker gcc-16 preset for C++26 features), fetching GoogleTest viaFetchContent(pinned release tag).- One test file per reference page, mirroring
docs/examples/(tests/containers/vector_test.cpp, …). Each test names the page and section it checks, e.g.TEST(Vector, PushBackInvalidatesOnReallocation). - Every concrete claim on a page becomes an assertion: documented outputs (
EXPECT_EQon formatted strings), values in comments,static_assertfor type/trait claims,EXPECT_THROWfor documented exceptions, invalidation/complexity claims where observable. Behaviour that's implementation-defined is asserted per toolchain or skipped with a reason (GTEST_SKIP). - Features missing on a toolchain are gated on feature-test macros (
__cpp_lib_*) and reported as skipped, not silently dropped. - Wrong claims found by the tests get fixed on the page in the same PR, and listed.
- A
tools/run_tests.sh(no CI — Actions is disabled; run locally) and a section inCLAUDE.md/README on running it.
Split
One sub-issue/PR per area, matching the snippet work: containers + strings + text-processing; algorithms + ranges + iterators + utilities + concepts; memory … diagnostics + language-support; language; plus the harness (CMake, presets, GoogleTest, runner) first.
Acceptance
cmake --workflow --preset gcc-15builds and runs all tests green; Clang 22 + libc++ green or skipped with reasons; GCC 16 (Docker) runs the C++26 tests.- Every reference page has a test file; the README index notes coverage.
Sub-issues
- test: GoogleTest harness — CMake, presets, support helpers, runner #43 harness (first)
- test: GoogleTest suites — containers, strings, text-processing #44 containers, strings, text-processing
- test: GoogleTest suites — algorithms, ranges, iterators, utilities, concepts #45 algorithms, ranges, iterators, utilities, concepts
- test: GoogleTest suites — memory through diagnostics, language support, named requirements #46 memory … diagnostics, language support, named requirements
- test: GoogleTest suites — language #47 language
This issue closes when all sub-issues are delivered.
Activity
homer6 commentedon Oct 31, 2026
All sub-issues delivered:
What changed
tests/with one test file per reference page; run withtools/run_tests.sh gcc-15|clang-22|gcc-16. With test(language): GoogleTest suites for every language page #73 and test: GoogleTest suites for memory through diagnostics, language support, named requirements #78 merged it covers every page (~790 tests on GCC 16).std::bitsetis C++98,partial_sortsorts the smallest,inplace_vector::try_push_backreturnsoptional<T&>, a failed>>stores 0).Why
Still open