Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11359 closed Feature Requests (duplicate)

BOOST_CHECK_EQUAL_COLLECTIONS: can't control output operator

Reported by: weegreenblobbie@… Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc: weegreenblobbie@…, florian.rathgeber@…

Description

The BOOST_CHECK_EQUAL_COLLECTIONS does not use print_helper_t<T> or print_log_value<T> to print the values to screen like BOOST_CHECK_EQUAL does.

I work with data that is usually printed as hex. I can control when data should be printed as hex when I use BOOST_CHECK_EQUAL: http://stackoverflow.com/questions/17572583/boost-check-fails-to-compile-operator-for-custom-types

However, the same technique does not work with BOOST_CHECK_EQUAL_COLLECTIONS.

Please do one of the following:

1) Fix the collections version to use the same print helpers

2) Provide an easier way for the end user to control how data is displayed

Change History (7)

comment:1 by Raffi Enficiaud, 7 years ago

I believe this is a duplicate of #9390 that is already fixed. Would you please try the current develop branch?

comment:2 by weegreenblobbie@…, 7 years ago

I cloned and build the develop branch like so:

cd /tmp
git clone https://github.com/boostorg/boost.git boost-dev
cd boost-dev
git submodule update --init --recursive
git checkout develop
git submodule status | grep test
 954d3ab699ed474d9d2e95a8f81bbacf86865b26 libs/test (boost-1.56.0)
./bootstrap.sh --prefix=/opt/boost-dev
./b2 stage threading=multi link=shared
sudo ./b2 install threading=multi link=shared
sudo chmod -R 0755 /opt/boost-dev

But there is no difference in my output. I'll try updating submodule 'test' to the latest revision.

comment:3 by anonymous, 7 years ago

oops, my submodule update and check commands were transposed ...

in reply to:  3 comment:4 by Raffi Enficiaud, 7 years ago

Replying to anonymous:

oops, my submodule update and check commands were transposed ...

So, do you have the status for the develop branch? the commit 954d3ab699ed474d9d2e95a8f81bbacf86865b26 is the current master. You have to do

git checkout develop
git submodule init
git submodule update --recursive

comment:5 by weegreenblobbie@…, 7 years ago

I have confirmed that the HEAD of the develop for 'test' does work as expected!

Here is the command sequence that I used to clone and checkout the 'develop' branch for 'test':

cd /tmp
git clone https://github.com/boostorg/boost.git boost-dev
cd boost-dev
git checkout master
git submodule update --init --recursive
cd libs/test
git checkout develop
cd ../../
git submodule status | grep test
+704f827401301e15e46b9de883f8d5ec4739bbef libs/test (heads/develop)
./bootstrap.sh --prefix=/opt/boost-dev
./b2 stage threading=multi link=shared
sudo ./b2 install threading=multi link=shared
sudo chmod -R 0755 /opt/boost-dev

Some example output for my HEX example:

src/foobar/tests/test_Foo.cc(96): error: in "test_Foo_30": check { packet.begin(), packet.end() } == { data.begin(), data.end() } has failed.
Mismatch at position 1: 0x0000000000000001 != 0x0000000000000002
Mismatch at position 2: 0x0000000000000002 != 0x0000000000000003
Mismatch at position 3: 0x0000000000000003 != 0x0000000000000004
Mismatch at position 4: 0x0000000000000004 != 0x0000000000000005
Mismatch at position 5: 0x0000000000000005 != 0x0000000000000006

You can close this ticket and mark the milestone boost release.

comment:6 by Raffi Enficiaud, 7 years ago

Resolution: duplicate
Status: newclosed

comment:7 by florian.rathgeber@…, 7 years ago

Cc: florian.rathgeber@… added

Note that this fix prevents using BOOST_CHECK_EQUAL_COLLECTIONS to compare two nested vectors e.g. std::vector< std::vector<T> >.

Note: See TracTickets for help on using tickets.