Skip to content

test: GoogleTest suites — containers, strings, text-processing #44

Closed

Description

@homer6

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.

Activity

  1. self-assigned this
    on Oct 31, 2026
  2. homer6 commented on Oct 31, 2026

    @homer6
    OwnerAuthor

    Delivered in #72.

    What changed

    • 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.
  3. homer6 commented on Oct 31, 2026

    @homer6
    OwnerAuthor

    Merged in #72 (0909a08) on the owner's approval.

    What changed

    • Since the PR was opened: rebased onto main. No other changes.

    Why

    • Approved by the owner; checks re-run after the rebase (snippets, links).

    Still open

    • Nothing for this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions