You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #41. Depends on #43. Write GoogleTest tests for every page in: docs/examples/containers, docs/examples/strings, docs/examples/text-processing.
One tests/<area>/<page>_test.cpp per page; test names reference the page section (TEST(Vector, ReserveDoesNotChangeSize)).
Every concrete claim on the page becomes an assertion: documented output (capture and EXPECT_EQ), values in comments, static_assert for type/trait claims, EXPECT_THROW for documented exceptions, invalidation and complexity claims where observable.
Implementation-defined behaviour: assert per toolchain or GTEST_SKIP with the reason. Missing library features: skip via feature-test macros, never silently drop.
If a test shows a page is wrong, fix the page in the same PR and list each fix.
Run on GCC 15 and Clang 22 + libc++; C++26 tests on Docker GCC 16.
Acceptance: every page in these folders has a test file; all presets green or skipped with reasons; page fixes listed in the PR.
tests/containers/**: 23 files, 162 tests, one per page in sequence, associative, unordered, adaptors, views and the README. The existing vector_test.cpp is extended.
tests/strings/**: 4 files, 30 tests (README, char_traits, string, and the extended string_view).
tests/text-processing/**: 9 files, 78 tests (README, the extended charconv, formatting, localization, regex, text-encoding, and the three null-terminated string pages).
Page fixes:
inplace_vector.md: the try_* functions return optional<T&> (P3981R2, 202603L), and GCC 16.2 does ship the header.
vector.md: array<bool, N>.
unordered_map.md: set max_load_factor before reserve.
charconv.md: diagram no longer skips leading spaces.
README.md / formatting.md: to_string is locale-affected only before C++26.
localization.md: macOS de_DE output.
null-terminated-byte-strings.md: libstdc++ on macOS lacks the C++ strchr overloads.
text-encoding.md: locale::encoding() also needs -lstdc++exp.
Why
Every page in the three folders now has a test file, as the acceptance criteria require.
Page claims are asserted:
captured output, values from comments, static_assert for type and trait claims, and EXPECT_THROW for documented exceptions;
invalidation and stability checks where they can be observed.
Each page fix comes from a test that failed and was checked against the toolchain:
inplace_vector against GCC 16.2's header and P3981R2 on open-std / cppreference;
the rehash count on libstdc++ and libc++;
link errors on GCC 15 and 16.
tools/run_tests.sh:
gcc-15: 380/380 passed
clang-22: 380/380 passed
gcc-16: 383/383 passed
Every skip prints a reason: a feature macro, a missing named locale, a platform header, or -lstdc++exp.
check_snippets.py reports 0 new failures.
Still open
The std::hive tests are gated and have never been compiled, because no local toolchain ships <hive>.
text_encoding::environment() output isn't asserted: it needs -lstdc++exp and a controlled LANG.
Complexity claims and undefined-behaviour claims are not asserted.
Activity
test: add a worked example test file for every docs/examples area
homer6 commentedon Oct 31, 2026
Delivered in #72.
What changed
tests/containers/**: 23 files, 162 tests, one per page in sequence, associative, unordered, adaptors, views and the README. The existingvector_test.cppis extended.tests/strings/**: 4 files, 30 tests (README, char_traits, string, and the extendedstring_view).tests/text-processing/**: 9 files, 78 tests (README, the extendedcharconv, formatting, localization, regex, text-encoding, and the three null-terminated string pages).inplace_vector.md: thetry_*functions returnoptional<T&>(P3981R2,202603L), and GCC 16.2 does ship the header.vector.md:array<bool, N>.unordered_map.md: setmax_load_factorbeforereserve.charconv.md: diagram no longer skips leading spaces.README.md/formatting.md:to_stringis locale-affected only before C++26.localization.md: macOS de_DE output.null-terminated-byte-strings.md: libstdc++ on macOS lacks the C++strchroverloads.text-encoding.md:locale::encoding()also needs-lstdc++exp.Why
static_assertfor type and trait claims, andEXPECT_THROWfor documented exceptions;tools/run_tests.sh:-lstdc++exp.check_snippets.pyreports 0 new failures.Still open
std::hivetests are gated and have never been compiled, because no local toolchain ships<hive>.text_encoding::environment()output isn't asserted: it needs-lstdc++expand a controlledLANG.homer6 commentedon Oct 31, 2026
Merged in #72 (0909a08) on the owner's approval.
What changed
main. No other changes.Why
Still open