Issue with printing std::vector content

Open
#2,960 6 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

  • #3199 by @afonsojanu — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
testing-qa

Research direction

Start by building the provided DebugTest TEST_CASE and running the test binary with "DebugTest" --success to reproduce the vector output. Trace the assertion-reporting path responsible for printing std::vector<uint8_t>; done means the reproduced vector content is displayed correctly, though the issue does not specify the expected formatting.

Written by the indexing model from the issue text.

Description

Describe the bug
There seems to be a bug when printing the content of some std::vectors.

Reproduction steps

TEST_CASE( "DebugTest", "[DebugTest]" )
{
    std::vector<uint8_t> vec = { 0x4e, 0xf2, 0xde, 0x6a, 0xa2, 0x9b, 0x66, 0x3d, 0x7b, 0x3e, 0x80, 0x2e, 0x22, 0x66, 0x48, 0x01, 0xeb, 0x10, 0x2d,
                                 0xc3, 0x5a, 0xfd, 0x61, 0xd5, 0xcb, 0x21, 0x23, 0xea, 0x94, 0x05, 0xc2, 0x92, 0xe4, 0xab, 0x05, 0xf9, 0xce, 0x65,
                                 0x54, 0xd8, 0x19, 0xd7, 0x0c, 0x04, 0x0d, 0x80, 0x7a, 0x70, 0x9e, 0xc5, 0x61, 0x61, 0xac, 0x09, 0x78, 0x12, 0xf8,
                                 0xaf, 0xf1, 0x16, 0xb0, 0x7f, 0x31, 0x97, 0x6c, 0x0e, 0xa0, 0xaa, 0x05, 0xfd, 0xd7, 0xaf, 0x5f, 0xfc, 0x39, 0xcf,
                                 0x91, 0x6d, 0x96, 0x4d, 0xc6, 0x46, 0xda, 0xc5, 0xae, 0x30, 0x5c, 0x3b, 0x6c, 0x83, 0x34, 0x63, 0x0c, 0x37, 0x05,
                                 0xed, 0x05, 0xf4, 0x01, 0xd5, 0xf6, 0x8e, 0xb3, 0x73, 0x6f, 0x79, 0x5e, 0x56, 0x35, 0x4d, 0x80, 0x69, 0x3a, 0x7d,
                                 0x77, 0x3d, 0xd4, 0x85, 0x54, 0x57, 0x62, 0x54, 0xd0, 0xca, 0x34, 0x0f, 0x6f, 0xe3, 0x88, 0x54, 0x2f, 0xb3, 0xcd,
                                 0xac, 0xfa, 0x09, 0xb3, 0xcc, 0x58, 0xf2, 0xe3, 0x98, 0xd7, 0x8e, 0x7d, 0x11, 0x15, 0x6b, 0xca, 0x67, 0x87, 0x21,
                                 0xb2, 0xa8, 0xea, 0x26, 0x42, 0x5f, 0x7b, 0x96, 0x5c, 0xd0, 0x9f, 0x26, 0xf4, 0x39, 0x61, 0xd0, 0x4a, 0x4b, 0xff };

    REQUIRE( vec == vec );
}

Execute the test binary with "DebugTest" --success

Result:

Image

Platform information:

  • OS: Windows 11 23H2
  • Compiler+version: Visual Studio 2022 v17.13.2 / 19.43.34808
  • Catch version: v3.8.0
Dominant language
C++
Stars
21.6k
Forks
3.4k
Avg merge
3d 12h
Merged PRs (30d)
5

Getting set up

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.

More from catchorg/Catch2

All issues in catchorg/Catch2

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.