`BOOST_TEST(p1 == p2)` doesn't always test `p1 == p2`

Open
#340 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
testing-qa

Research direction

Start by tracing the BOOST_TEST(p1 == p2) handling for pointers to char and compare it with the original C++ expression semantics. Review existing behavior and tests, then determine whether a compatible correction or an explicit alternative is feasible; done means the behavior and resolution are covered by tests and clearly documented.

Written by the indexing model from the issue text.

Description

A user of Boost.Test has complained to me that the behavior of BOOST_TEST(p1 == p2) when p1 and p2 are pointers to char is surprising as it silently reinterprets the C++ expression p1 == p2 to mean something else, namely, strcmp(p1, p2) == 0. This is, in this user's opinion, a significant defect that justifies not using Boost.Test. (I don't necessarily agree.)

I suspect that it's much too late now to change this behavior, as who knows how much existing code already relies on it, so I'm not sure what can be done to address this complaint.

Dominant language
C++
Stars
213
Forks
149
Avg merge
18h 17m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

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 boostorg/test

All issues in boostorg/test

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.