Modify

Opened 5 years ago

Closed 5 years ago

#7296 closed Bugs (fixed)

Bug-fix and improvements to test utility functions

Reported by: Marco Guazzone <marco.guazzone@…> Owned by: guwi17
Milestone: Boost 1.52.0 Component: uBLAS
Version: Boost Release Branch Severity: Problem
Keywords: Cc:

Description

Three years ago I introduced in libs/numeric/ublas/test/utils a small set of utility functions for testing purpose.

Now, I corrected some bugs and added new and hopefully useful functions.

Furthermore, I fixed the license part.

I attach a patch file along with the whole include file.

I tested it against the following tests:

begin_end
num_columns
num_rows
size
test_complex_norms

and all works.

I had to skip the following tests since they fail (not for the new version of utils.hpp):

test_assignment
test_coordinate_matrix_sort
test_inplace_solve

Could you add it?

Attachments (13)

utils.patch (10.1 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
Patch file for utils.hpp
utils.hpp (8.6 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
The new (i.e., already patched) utils.hpp
utils-new.patch (12.5 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
New patch file for utils.hpp
utils.2.hpp (11.0 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
The new (i.e., already patched by utils-new.patch) utils.hpp
utils-201208280915.patch (12.5 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
Patch file for utils.hpp to be applied against the version you currently find in boost trunk
utils_UBLA_UBLAS-201208280915.patch (1.2 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
Patch file for utils.hpp to be applied against the version of utils.hpp patched with utils-new.patch (i.e., the one named utils.2.hpp)
utils.3.hpp (11.0 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
The new (i.e., already patched by utils-201208280915.patch) utils.hpp file.
utils-fix_complex-201208281922.patch (7.9 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
Patch file for utils.hpp to make it works with complex numbers. To be applied to the version of utils.hpp in the current boost trunk.
utils.4.hpp (14.3 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
The new utils.hpp file that you should obtain after applying the utils-fix_complex-201208281922.patch patch.
test_ticket7296.cpp (8.1 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
Test case for utils.hpp. It also shows that now utils.hpp works with complex value types.
utils-201208301042.patch (19.0 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
Patch file for utils.hpp to be applied against utils.4.hpp
utils.5.hpp (17.7 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
The new patched utils.hpp (i.e., the one resulting after applying patch utils-201208301042.patch)
test_ticket7296.2.cpp (10.9 KB) - added by Marco Guazzone <marco.guazzone@…> 5 years ago.
The updated test_ticket7296.cpp for the new version of utils.hpp named utils.5.hpp

Download all attachments as: .zip

Change History (29)

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The new (i.e., already patched) utils.hpp

comment:1 Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The previously attached patch contained simpler macros but some output messages was less informative (for the user). Now, with the new attached patch utils-new.patch, those output messages are again informative.

Sorry for the inconvenience.

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

New patch file for utils.hpp

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The new (i.e., already patched by utils-new.patch) utils.hpp

comment:2 Changed 5 years ago by guwi17

(In [80267]) boost/numeric/ublas/triangular.hpp - applied patch, see #4024 libs/numeric/ublas/test/test_inplace_solve.cpp - fixed includes

libs/numeric/ublas/test/utils.hpp - applied patch (after s/BOOST_UBLA_TEST/BOOST_UBLAS_TEST/g), see #7296

comment:3 Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The previous patch file utils-new.patch contained bad macro names: BOOST_UBLA_TEST_CHECK_EQ and BOOST_UBLA_TEST_CHECK_EQUAL. Specifically, UBLA_ should be UBLAS_. The new attached patch fix this.

I attach two patches:

  • utils-201208280915.patch is the patch file to be used if applied against the original (unpatched) utils.hpp (i.e., the one you find in the actual boost trunk).
  • utils-201208280915.patch is the patch file to be used if applied against the patched utils.hpp (i.e., the ones named utils.2.hpp in the above attachments).

As before, I also attach the new (patched) version of utils.hpp.

Again, sorry for this inconvenience, and thanks to guwi17 for pointing it out.

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to be applied against the version you currently find in boost trunk

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to be applied against the version of utils.hpp patched with utils-new.patch (i.e., the one named utils.2.hpp)

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The new (i.e., already patched by utils-201208280915.patch) utils.hpp file.

comment:4 Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

In the last my comment, read the second utils-201208280915.patch as utils_UBLA_UBLAS-201208280915.patch.

comment:5 Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

To date, some macros in utils.hpp fail when the value type has a complex type.

I've tried to fix it and to test the fix I have created a test-suite for the macros contained in utils.hpp.

I'm going to upload the patch file together with the test suite.

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to make it works with complex numbers. To be applied to the version of utils.hpp in the current boost trunk.

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The new utils.hpp file that you should obtain after applying the utils-fix_complex-201208281922.patch patch.

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

Test case for utils.hpp. It also shows that now utils.hpp works with complex value types.

comment:6 Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

I've tried to make some macro more robust to complex expressions by using (when needed) macro expansion inside parenthesis. Furthermore,

  • I fixed a bug: I forgot to add an increment of the variable used to count test failures
  • I added two more macros for performing relative closeness comparison in case of vectors and matrices
  • I replaced the use of unsigned long with std::size_t (I think it's better)
  • I enhanced the doc

As usual, I add the new patch file (wrt utils.4.hpp) together with the whole new utils.hpp file and the updated test-case.

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

Patch file for utils.hpp to be applied against utils.4.hpp

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The new patched utils.hpp (i.e., the one resulting after applying patch utils-201208301042.patch)

Changed 5 years ago by Marco Guazzone <marco.guazzone@…>

The updated test_ticket7296.cpp for the new version of utils.hpp named utils.5.hpp

comment:7 Changed 5 years ago by guwi17

(In [80483]) boost/numeric/ublas/traits.hpp, libs/numeric/ublas/test/test_assignment.cpp, libs/numeric/ublas/test/begin_end.cpp: see #7296, fix test issues with unsigned integer types

comment:8 Changed 5 years ago by guwi17

(In [80485])

  • libs/numeric/ublas/test/utils.hpp : see #7296, improved macros
  • libs/numeric/ublas/test/Jamfile.v2 : add new test for utils.hpp

comment:9 Changed 5 years ago by guwi17

(In [80507])

  • libs/numeric/ublas/tests/utils.hpp: see #7296 - replace func by FUNCTION if compiled with MSVC

comment:10 Changed 5 years ago by guwi17

  • Milestone changed from To Be Determined to Boost 1.52.0
  • Status changed from new to assigned

comment:11 Changed 5 years ago by guwi17

(In [80563])

  • libs/numeric/ublas/test/test_ticket7296.cpp: see #7296 - add missing test

comment:12 Changed 5 years ago by guwi17

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:13 Changed 5 years ago by guwi17

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from Boost 1.52.0 to Boost Release Branch

comment:14 Changed 5 years ago by guwi17

(In [80624])

  • libs/numeric/ublas/test/utils.hpp: switch to boost::math::isnan, see #7296

comment:15 Changed 5 years ago by guwi17

(In [80644])

  • libs/numeric/ublas/test/test_triangular.cpp: switch to boost::timer and enable all tests, see #7296
  • libs/numeric/ublas/test/Jamfile.v2: add required lib boost_timer

comment:16 Changed 5 years ago by guwi17

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [80645]) merged [80483],[80487],[80586],[80591],[80592],[80599],[80600],[80624],[80625],[80643],[80644] into release:

  • fix #7296 (hopefully ;-)
  • see #7363 (must wait for a full test cycle before closing this task)

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain guwi17.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.