diff --git a/elements-alexandria.spec b/elements-alexandria.spec index 16fcfa6..beda4d2 100644 --- a/elements-alexandria.spec +++ b/elements-alexandria.spec @@ -11,6 +11,8 @@ Source0: https://github.com/astrorama/Alexandria/archive/%{version}/%{nam Source1: cppreference-doxygen-web.tag.xml # Fix a bad memory access when fixing an axis Patch0: elements-alexandria_fixaxis.patch +# Fixes for failing tests on architectures other than x86_64 +Patch1: elements-alexandria_arch.patch %global elements_version 5.10 diff --git a/elements-alexandria_arch.patch b/elements-alexandria_arch.patch new file mode 100644 index 0000000..80668e9 --- /dev/null +++ b/elements-alexandria_arch.patch @@ -0,0 +1,1735 @@ +diff --git a/GridContainer/tests/src/GridContainer_test.cpp b/GridContainer/tests/src/GridContainer_test.cpp +index 9ca75c0..f4c3814 100644 +--- a/GridContainer/tests/src/GridContainer_test.cpp ++++ b/GridContainer/tests/src/GridContainer_test.cpp +@@ -1,22 +1,22 @@ + /* +- * Copyright (C) 2012-2020 Euclid Science Ground Segment +- * ++ * Copyright (C) 2012-2020 Euclid Science Ground Segment ++ * + * This library is free software; you can redistribute it and/or modify it under +- * the terms of the GNU Lesser General Public License as published by the Free +- * Software Foundation; either version 3.0 of the License, or (at your option) +- * any later version. +- * +- * This library is distributed in the hope that it will be useful, but WITHOUT ++ * the terms of the GNU Lesser General Public License as published by the Free ++ * Software Foundation; either version 3.0 of the License, or (at your option) ++ * any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +- * details. +- * +- * You should have received a copy of the GNU Lesser General Public License ++ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more ++ * details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., +- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +- +- /** ++ ++ /** + * @file GridContainer_test.cpp + * @date July 4, 2014 + * @author Nikolaos Apostolakos +@@ -25,8 +25,11 @@ + #include + #include + #include ++#include + #include "GridContainer/GridContainer.h" + ++using Elements::isEqual; ++ + struct GridContainer_Fixture { + typedef Euclid::GridContainer::GridContainer, int, int, int, int> GridContainerType; + typedef Euclid::GridContainer::GridAxis IntAxis; +@@ -45,13 +48,13 @@ BOOST_AUTO_TEST_SUITE (GridContainer_test) + //----------------------------------------------------------------------------- + // Test construction with GridAxis objects + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(GridAxisConstructor, GridContainer_Fixture) { +- ++ + // When + GridContainerType result_grid {axis1, axis2, axis3, axis4}; + auto& result_axes_tuple = result_grid.getAxesTuple(); +- ++ + // Then + BOOST_CHECK_EQUAL(result_grid.size(), total_size); + for (auto& value : result_grid) { +@@ -73,19 +76,19 @@ BOOST_FIXTURE_TEST_CASE(GridAxisConstructor, GridContainer_Fixture) { + BOOST_CHECK_EQUAL_COLLECTIONS( + std::get<3>(result_axes_tuple).begin(), std::get<3>(result_axes_tuple).end(), + axis4.begin(), axis4.end()); +- ++ + } + + //----------------------------------------------------------------------------- + // Test construction with GridAxis tuple + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(GridAxisTupleonstructor, GridContainer_Fixture) { +- ++ + // When + GridContainerType result_grid {axes_tuple}; + auto& result_axes_tuple = result_grid.getAxesTuple(); +- ++ + // Then + BOOST_CHECK_EQUAL(result_grid.size(), total_size); + for (auto& value : result_grid) { +@@ -107,137 +110,137 @@ BOOST_FIXTURE_TEST_CASE(GridAxisTupleonstructor, GridContainer_Fixture) { + BOOST_CHECK_EQUAL_COLLECTIONS( + std::get<3>(result_axes_tuple).begin(), std::get<3>(result_axes_tuple).end(), + axis4.begin(), axis4.end()); +- ++ + } + + //----------------------------------------------------------------------------- + // Test the rank method + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(rank, GridContainer_Fixture) { +- ++ + // When + GridContainerType grid {axes_tuple}; +- ++ + // Then + BOOST_CHECK_EQUAL(grid.axisNumber(), 4u); +- ++ + } + + //----------------------------------------------------------------------------- + // Test the getAxis method + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(getAxis, GridContainer_Fixture) { +- ++ + // When + GridContainerType grid {axes_tuple}; +- ++ + // Then + BOOST_CHECK_EQUAL(grid.getAxis<0>().name(), axis1.name()); + BOOST_CHECK_EQUAL(grid.getAxis<1>().name(), axis2.name()); + BOOST_CHECK_EQUAL(grid.getAxis<2>().name(), axis3.name()); + BOOST_CHECK_EQUAL(grid.getAxis<3>().name(), axis4.name()); +- ++ + } + + //----------------------------------------------------------------------------- + // Test the size method + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(size, GridContainer_Fixture) { +- ++ + // When + GridContainerType grid {axes_tuple}; +- ++ + // Then + BOOST_CHECK_EQUAL(grid.size(), total_size); +- ++ + } + + //----------------------------------------------------------------------------- + // Test the parenthesis operator + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(parenthesisOperator, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + double custom_value = 0; + for (auto& cell : grid) { + custom_value += 0.1; + cell = custom_value; + } +- ++ + // Then + double expected_value {0}; +- for (size_t coord4=0; coord4(fixed_index); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByIndex<0>(fixed_index); +- ++ + // Then + for (size_t coord4 = 0; coord4 < axis4.size(); ++coord4) { + for (size_t coord3 = 0; coord3 < axis3.size(); ++coord3) { +@@ -410,17 +413,17 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByIndex, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + for (size_t fixed_index=0; fixed_index(fixed_index); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByIndex<1>(fixed_index); +- ++ + // Then + for (size_t coord4 = 0; coord4 < axis4.size(); ++coord4) { + for (size_t coord3 = 0; coord3 < axis3.size(); ++coord3) { +@@ -444,17 +447,17 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByIndex, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + for (size_t fixed_index=0; fixed_index(fixed_index); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByIndex<2>(fixed_index); +- ++ + // Then + for (size_t coord4 = 0; coord4 < axis4.size(); ++coord4) { + for (size_t coord2 = 0; coord2 < axis2.size(); ++coord2) { +@@ -478,17 +481,17 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByIndex, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + for (size_t fixed_index=0; fixed_index(fixed_index); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByIndex<3>(fixed_index); +- ++ + // Then + for (size_t coord3 = 0; coord3 < axis3.size(); ++coord3) { + for (size_t coord2 = 0; coord2 < axis2.size(); ++coord2) { +@@ -512,25 +515,25 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByIndex, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + } + + //----------------------------------------------------------------------------- + // Test fixing iterator index out of bound exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(fixIteratorByIndexOutOfBound, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto iterator = grid.begin(); + auto const_iterator = const_grid.begin(); +- ++ + // Then + BOOST_CHECK_THROW(iterator.fixAxisByIndex<0>(axis1.size()), Elements::Exception); + BOOST_CHECK_THROW(iterator.fixAxisByIndex<1>(axis2.size()), Elements::Exception); +@@ -540,25 +543,25 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByIndexOutOfBound, GridContainer_Fixture) { + BOOST_CHECK_THROW(const_iterator.fixAxisByIndex<1>(axis2.size()), Elements::Exception); + BOOST_CHECK_THROW(const_iterator.fixAxisByIndex<2>(axis3.size()), Elements::Exception); + BOOST_CHECK_THROW(const_iterator.fixAxisByIndex<3>(axis4.size()), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test fixing iterator by index twice for same axis throws exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(fixIteratorByIndexTwiceForSameAxis, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto iterator = grid.begin().fixAxisByIndex<0>(0).fixAxisByIndex<1>(0) + .fixAxisByIndex<2>(0).fixAxisByIndex<3>(0); + auto const_iterator = const_grid.begin().fixAxisByIndex<0>(0).fixAxisByIndex<1>(0) + .fixAxisByIndex<2>(0).fixAxisByIndex<3>(0); +- ++ + // Then + iterator.fixAxisByIndex<0>(0); + iterator.fixAxisByIndex<1>(0); +@@ -568,27 +571,27 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByIndexTwiceForSameAxis, GridContainer_Fixtur + const_iterator.fixAxisByIndex<1>(0); + BOOST_CHECK_THROW(const_iterator.fixAxisByIndex<2>(1), Elements::Exception); + BOOST_CHECK_THROW(const_iterator.fixAxisByIndex<3>(1), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test fixing iterator by value + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(fixIteratorByValue, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + for (size_t fixed_index=0; fixed_index(axis1[fixed_index]); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByValue<0>(axis1[fixed_index]); +- ++ + // Then + for (size_t coord4 = 0; coord4 < axis4.size(); ++coord4) { + for (size_t coord3 = 0; coord3 < axis3.size(); ++coord3) { +@@ -612,17 +615,17 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByValue, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + for (size_t fixed_index=0; fixed_index(axis2[fixed_index]); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByValue<1>(axis2[fixed_index]); +- ++ + // Then + for (size_t coord4 = 0; coord4 < axis4.size(); ++coord4) { + for (size_t coord3 = 0; coord3 < axis3.size(); ++coord3) { +@@ -646,17 +649,17 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByValue, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + for (size_t fixed_index=0; fixed_index(axis3[fixed_index]); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByValue<2>(axis3[fixed_index]); +- ++ + // Then + for (size_t coord4 = 0; coord4 < axis4.size(); ++coord4) { + for (size_t coord2 = 0; coord2 < axis2.size(); ++coord2) { +@@ -680,17 +683,17 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByValue, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + for (size_t fixed_index=0; fixed_index(axis4[fixed_index]); + auto const_iterator = const_grid.begin(); + const_iterator.fixAxisByValue<3>(axis4[fixed_index]); +- ++ + // Then + for (size_t coord3 = 0; coord3 < axis3.size(); ++coord3) { + for (size_t coord2 = 0; coord2 < axis2.size(); ++coord2) { +@@ -714,25 +717,25 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByValue, GridContainer_Fixture) { + } + } + } +- ++ + } +- ++ + } + + //----------------------------------------------------------------------------- + // Test fixing iterator value not found exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(fixIteratorByValueNotFound, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto iterator = grid.begin(); + auto const_iterator = const_grid.begin(); +- ++ + // Then + BOOST_CHECK_THROW(iterator.fixAxisByValue<0>(axis1.size()+1), Elements::Exception); + BOOST_CHECK_THROW(iterator.fixAxisByValue<1>(axis2.size()+1), Elements::Exception); +@@ -742,25 +745,25 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByValueNotFound, GridContainer_Fixture) { + BOOST_CHECK_THROW(const_iterator.fixAxisByValue<1>(axis2.size()+1), Elements::Exception); + BOOST_CHECK_THROW(const_iterator.fixAxisByValue<2>(axis3.size()+1), Elements::Exception); + BOOST_CHECK_THROW(const_iterator.fixAxisByValue<3>(axis4.size()+1), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test fixing iterator by value twice for same axis throws exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(fixIteratorByValueTwiceForSameAxis, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto iterator = grid.begin().fixAxisByValue<0>(1).fixAxisByValue<1>(1) + .fixAxisByValue<2>(1).fixAxisByValue<3>(1); + auto const_iterator = const_grid.begin().fixAxisByValue<0>(1).fixAxisByValue<1>(1) + .fixAxisByValue<2>(1).fixAxisByValue<3>(1); +- ++ + // Then + iterator.fixAxisByValue<0>(1); + iterator.fixAxisByValue<1>(1); +@@ -770,43 +773,43 @@ BOOST_FIXTURE_TEST_CASE(fixIteratorByValueTwiceForSameAxis, GridContainer_Fixtur + const_iterator.fixAxisByValue<1>(1); + BOOST_CHECK_THROW(const_iterator.fixAxisByValue<2>(2), Elements::Exception); + BOOST_CHECK_THROW(const_iterator.fixAxisByValue<3>(2), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test fixing all exes of iterator by other iterator + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(fixIteratorAllAxes, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid1 {axes_tuple}; + auto iter1 = grid1.begin(); + GridContainerType grid2 {axes_tuple}; + auto iter2 = grid2.begin(); +- ++ + // When + iter1.fixAxisByIndex<0>(3).fixAxisByIndex<1>(2).fixAxisByIndex<2>(1).fixAxisByIndex<3>(0); + iter2.fixAllAxes(iter1); +- ++ + // Then + BOOST_CHECK_EQUAL(iter2.axisIndex<0>(), 3u); + BOOST_CHECK_EQUAL(iter2.axisIndex<1>(), 2u); + BOOST_CHECK_EQUAL(iter2.axisIndex<2>(), 1u); + BOOST_CHECK_EQUAL(iter2.axisIndex<3>(), 0u); +- ++ + } + + //----------------------------------------------------------------------------- + // Test slicing using index out of bound exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceByIndexOutOfBound, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // Then + BOOST_CHECK_THROW(grid.fixAxisByIndex<0>(axis1.size()), Elements::Exception); + BOOST_CHECK_THROW(grid.fixAxisByIndex<1>(axis2.size()), Elements::Exception); +@@ -816,19 +819,19 @@ BOOST_FIXTURE_TEST_CASE(sliceByIndexOutOfBound, GridContainer_Fixture) { + BOOST_CHECK_THROW(const_grid.fixAxisByIndex<1>(axis2.size()), Elements::Exception); + BOOST_CHECK_THROW(const_grid.fixAxisByIndex<2>(axis3.size()), Elements::Exception); + BOOST_CHECK_THROW(const_grid.fixAxisByIndex<3>(axis4.size()), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test slicing using index twice at the same axis throws exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceByIndexTwiceSameAxis, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto slice0 = grid.fixAxisByIndex<0>(0); + auto slice1 = grid.fixAxisByIndex<1>(0); +@@ -838,7 +841,7 @@ BOOST_FIXTURE_TEST_CASE(sliceByIndexTwiceSameAxis, GridContainer_Fixture) { + auto& const_slice1 = const_grid.fixAxisByIndex<1>(0); + auto& const_slice2 = const_grid.fixAxisByIndex<2>(0); + auto& const_slice3 = const_grid.fixAxisByIndex<3>(0); +- ++ + // Then + BOOST_CHECK_THROW(slice0.fixAxisByIndex<0>(0), Elements::Exception); + BOOST_CHECK_THROW(slice1.fixAxisByIndex<1>(0), Elements::Exception); +@@ -848,19 +851,19 @@ BOOST_FIXTURE_TEST_CASE(sliceByIndexTwiceSameAxis, GridContainer_Fixture) { + BOOST_CHECK_THROW(const_slice1.fixAxisByIndex<1>(0), Elements::Exception); + BOOST_CHECK_THROW(const_slice2.fixAxisByIndex<2>(1), Elements::Exception); + BOOST_CHECK_THROW(const_slice3.fixAxisByIndex<3>(1), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test slicing using value not found exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceByValueNotFound, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // Then + BOOST_CHECK_THROW(grid.fixAxisByValue<0>(axis1.size()+1), Elements::Exception); + BOOST_CHECK_THROW(grid.fixAxisByValue<1>(axis2.size()+1), Elements::Exception); +@@ -870,19 +873,19 @@ BOOST_FIXTURE_TEST_CASE(sliceByValueNotFound, GridContainer_Fixture) { + BOOST_CHECK_THROW(const_grid.fixAxisByValue<1>(axis2.size()+1), Elements::Exception); + BOOST_CHECK_THROW(const_grid.fixAxisByValue<2>(axis3.size()+1), Elements::Exception); + BOOST_CHECK_THROW(const_grid.fixAxisByValue<3>(axis4.size()+1), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test slicing using value twice at the same axis throws exception + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceByValueTwiceSameAxis, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto slice0 = grid.fixAxisByValue<0>(1); + auto slice1 = grid.fixAxisByValue<1>(1); +@@ -892,7 +895,7 @@ BOOST_FIXTURE_TEST_CASE(sliceByValueTwiceSameAxis, GridContainer_Fixture) { + auto& const_slice1 = const_grid.fixAxisByValue<1>(1); + auto& const_slice2 = const_grid.fixAxisByValue<2>(1); + auto& const_slice3 = const_grid.fixAxisByValue<3>(1); +- ++ + // Then + BOOST_CHECK_THROW(slice0.fixAxisByValue<0>(1), Elements::Exception); + BOOST_CHECK_THROW(slice1.fixAxisByValue<1>(1), Elements::Exception); +@@ -902,46 +905,46 @@ BOOST_FIXTURE_TEST_CASE(sliceByValueTwiceSameAxis, GridContainer_Fixture) { + BOOST_CHECK_THROW(const_slice1.fixAxisByValue<1>(1), Elements::Exception); + BOOST_CHECK_THROW(const_slice2.fixAxisByValue<2>(2), Elements::Exception); + BOOST_CHECK_THROW(const_slice3.fixAxisByValue<3>(2), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- + // Test that modifications to the slices are reflected to the original + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceChancesReflected, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + auto slice_index = grid.fixAxisByIndex<0>(2).fixAxisByIndex<1>(2).fixAxisByIndex<2>(2).fixAxisByIndex<3>(1); + auto slice_value = grid.fixAxisByValue<0>(2).fixAxisByValue<1>(2).fixAxisByValue<2>(2).fixAxisByValue<3>(1); +- ++ + // When + *slice_index.begin() = -10; + *slice_value.begin() = -20; +- +- ++ ++ + // Then + BOOST_CHECK_EQUAL(grid(2, 2, 2, 1), -10); + BOOST_CHECK_EQUAL(grid(1, 1, 1, 0), -20); +- ++ + } + + //----------------------------------------------------------------------------- + // Test that slices have correct axes and size + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceAxes, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; + std::vector expected_fixed_axis = {2}; +- ++ + // When + auto slice = grid.fixAxisByIndex<1>(1); + auto& const_slice = const_grid.fixAxisByIndex<1>(1); +- ++ + // Then + BOOST_CHECK_EQUAL(slice.size(), grid.size() / axis2.size()); + BOOST_CHECK_EQUAL(slice.getAxis<0>().name(), axis1.name()); +@@ -963,19 +966,19 @@ BOOST_FIXTURE_TEST_CASE(sliceAxes, GridContainer_Fixture) { + BOOST_CHECK_EQUAL_COLLECTIONS(const_slice.getAxis<2>().begin(), const_slice.getAxis<2>().end(), axis3.begin(), axis3.end()); + BOOST_CHECK_EQUAL(const_slice.getAxis<3>().name(), axis4.name()); + BOOST_CHECK_EQUAL_COLLECTIONS(const_slice.getAxis<3>().begin(), const_slice.getAxis<3>().end(), axis4.begin(), axis4.end()); +- ++ + } + + //----------------------------------------------------------------------------- + // Test that slices iterator works fine + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceIterator, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + const GridContainerType& const_grid = grid; +- ++ + // When + auto slice = grid.fixAxisByIndex<1>(1).fixAxisByIndex<3>(0); + auto slice_iter = slice.begin(); +@@ -983,7 +986,7 @@ BOOST_FIXTURE_TEST_CASE(sliceIterator, GridContainer_Fixture) { + auto& const_slice = const_grid.fixAxisByIndex<1>(1).fixAxisByIndex<3>(0); + auto const_slice_iter = const_slice.begin(); + auto const_grid_iter = const_grid.begin().fixAxisByIndex<1>(1).fixAxisByIndex<3>(0); +- ++ + // Then + for (; slice_iter!=slice.end(); ++slice_iter, ++grid_iter) { + BOOST_CHECK_EQUAL(*slice_iter, *grid_iter); +@@ -1001,15 +1004,15 @@ BOOST_FIXTURE_TEST_CASE(sliceIterator, GridContainer_Fixture) { + BOOST_CHECK_EQUAL(const_slice_iter.axisValue<3>(), const_grid_iter.axisValue<3>()); + } + BOOST_CHECK(const_grid_iter == const_grid.end()); +- ++ + } + + //----------------------------------------------------------------------------- + // Test that slices parenthesis operator works fine + //----------------------------------------------------------------------------- +- ++ + BOOST_FIXTURE_TEST_CASE(sliceParenthesisOperator, GridContainer_Fixture) { +- ++ + // Given + GridContainerType grid {axes_tuple}; + double custom_value = 0; +@@ -1017,10 +1020,10 @@ BOOST_FIXTURE_TEST_CASE(sliceParenthesisOperator, GridContainer_Fixture) { + custom_value += 0.1; + cell = custom_value; + } +- ++ + // When + auto slice = grid.fixAxisByIndex<1>(2).fixAxisByIndex<3>(1); +- ++ + // Then + for (size_t coord1=0; coord1(2).fixAxisByIndex<3>(1); +- ++ + // Then + for (size_t coord1=0; coord1(0).fixAxisByIndex<1>(2).fixAxisByIndex<2>(2).fixAxisByIndex<3>(1); +- ++ + // Then + BOOST_CHECK_EQUAL(slice.at(0, 0, 0, 0), 0.); + BOOST_CHECK_THROW(slice.at(1, 0, 0, 0), Elements::Exception); + BOOST_CHECK_THROW(slice.at(0, 1, 0, 0), Elements::Exception); + BOOST_CHECK_THROW(slice.at(0, 0, 1, 0), Elements::Exception); + BOOST_CHECK_THROW(slice.at(0, 0, 0, 1), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- +diff --git a/MathUtils/tests/src/interpolation/Spline_test.cpp b/MathUtils/tests/src/interpolation/Spline_test.cpp +index 76502bc..569ab70 100644 +--- a/MathUtils/tests/src/interpolation/Spline_test.cpp ++++ b/MathUtils/tests/src/interpolation/Spline_test.cpp +@@ -23,7 +23,6 @@ + */ + + #include +-#include + #include + #include "MathUtils/interpolation/interpolation.h" + #include "MathUtils/function/Piecewise.h" +@@ -33,8 +32,9 @@ using namespace Euclid::MathUtils; + + + struct Spline_Fixture { +- double close_tolerance{1.2E-2}; +- double small_tolerance{1E-12}; ++ const double eps = std::sqrt(std::numeric_limits::epsilon()); ++ const double close_tolerance{1.2E-2}; ++ const double small_tolerance{1E-12}; + + std::vector x, y; + +@@ -66,7 +66,13 @@ BOOST_FIXTURE_TEST_CASE(fx, Spline_Fixture) { + + // Then + for (size_t i = 0; i < y.size(); i++) { +- BOOST_CHECK_CLOSE(result[i], y[i], close_tolerance); ++ if (std::abs(result[i]) <= eps) { ++ BOOST_CHECK_SMALL(result[i], small_tolerance); ++ BOOST_CHECK_SMALL(y[i], small_tolerance); ++ } ++ else { ++ BOOST_CHECK_CLOSE(result[i], y[i], close_tolerance); ++ } + } + BOOST_CHECK_SMALL(outside1, small_tolerance); + BOOST_CHECK_SMALL(outside2, small_tolerance); +@@ -85,8 +91,18 @@ BOOST_FIXTURE_TEST_CASE(Spline_fx, Spline_Fixture) { + auto x0 = x[i + 1]; + auto& left = splines[i]; + auto& right = splines[i + 1]; +- BOOST_CHECK_CLOSE((*left)(x0), (*right)(x0), close_tolerance); +- BOOST_CHECK_CLOSE((*left)(x0), y[i + 1], close_tolerance); ++ auto left_val = (*left)(x0); ++ auto right_val = (*right)(x0); ++ ++ if (std::abs(left_val) <= eps || std::abs(right_val) <= eps) { ++ BOOST_CHECK_SMALL(left_val, small_tolerance); ++ BOOST_CHECK_SMALL(right_val, small_tolerance); ++ BOOST_CHECK_SMALL(y[i + 1], small_tolerance); ++ } ++ else { ++ BOOST_CHECK_CLOSE(left_val, right_val, close_tolerance); ++ BOOST_CHECK_CLOSE(left_val, y[i + 1], close_tolerance); ++ } + } + } + +@@ -106,7 +122,13 @@ BOOST_FIXTURE_TEST_CASE(Spline_dfx, Spline_Fixture) { + auto left_dy = derivative(*left, x0); + auto right_dy = derivative(*right, x0); + +- BOOST_CHECK_CLOSE(left_dy, right_dy, close_tolerance); ++ if (std::abs(left_dy) <= eps || std::abs(right_dy) <= eps) { ++ BOOST_CHECK_SMALL(left_dy, small_tolerance); ++ BOOST_CHECK_SMALL(right_dy, small_tolerance); ++ } ++ else { ++ BOOST_CHECK_CLOSE(left_dy, right_dy, close_tolerance); ++ } + } + } + +@@ -115,8 +137,6 @@ BOOST_FIXTURE_TEST_CASE(Spline_dfx, Spline_Fixture) { + // also the second derivative of the splines to each side must match + //----------------------------------------------------------------------------- + BOOST_FIXTURE_TEST_CASE(Spline_ddfx, Spline_Fixture) { +- const double eps = std::numeric_limits::epsilon(); +- + auto cubic_f = interpolate(x, y, InterpolationType::CUBIC_SPLINE); + auto cubic_pieces = dynamic_cast(cubic_f.get()); + auto& splines = cubic_pieces->getFunctions(); +diff --git a/Table/Table/CastVisitor.h b/Table/Table/CastVisitor.h +index 92f1c01..72557cb 100644 +--- a/Table/Table/CastVisitor.h ++++ b/Table/Table/CastVisitor.h +@@ -1,20 +1,20 @@ +-/* +- * Copyright (C) 2012-2020 Euclid Science Ground Segment +- * ++/* ++ * Copyright (C) 2012-2020 Euclid Science Ground Segment ++ * + * This library is free software; you can redistribute it and/or modify it under +- * the terms of the GNU Lesser General Public License as published by the Free +- * Software Foundation; either version 3.0 of the License, or (at your option) +- * any later version. +- * +- * This library is distributed in the hope that it will be useful, but WITHOUT ++ * the terms of the GNU Lesser General Public License as published by the Free ++ * Software Foundation; either version 3.0 of the License, or (at your option) ++ * any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +- * details. +- * +- * You should have received a copy of the GNU Lesser General Public License ++ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more ++ * details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., +- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +- */ ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ + + /** + * @file Table/CastVisitor.h +@@ -39,27 +39,27 @@ namespace Table { + + template + class CastVisitor : public boost::static_visitor { +- ++ + public: +- ++ + template + To operator() (const From& from, typename std::enable_if::value>::type* = 0) const { + return from; + } +- ++ + template + To operator() (const From&, typename std::enable_if::value>::type* = 0) const { + throw Elements::Exception() << "CastVisitor cannot convert " + << typeid(From).name() << " type to " << typeid(To).name(); + } +- ++ + }; + + template <> + class CastVisitor : public boost::static_visitor { +- ++ + public: +- ++ + template + std::string operator() (const From& from) const { + std::stringstream result {}; +@@ -71,25 +71,25 @@ public: + + template <> + class CastVisitor : public boost::static_visitor { +- ++ + template + static constexpr bool generic() { + return std::is_arithmetic::value; + } +- ++ + public: +- ++ + template + double operator() (const From& , typename std::enable_if()>::type* = 0) const { + throw Elements::Exception() << "CastVisitor cannot convert " + << typeid(From).name() << " type to " << typeid(double).name(); + } +- ++ + template + double operator() (const From& from, typename std::enable_if()>::type* = 0) const { + return from; + } +- ++ + double operator() (const std::string& from) const { + char *endptr = nullptr; + double value = std::strtod(from.c_str(), &endptr); +@@ -108,26 +108,26 @@ public: + + template <> + class CastVisitor : public boost::static_visitor { +- ++ + template + static constexpr bool generic() { + return std::is_arithmetic::value && + !std::is_same::value; + } +- ++ + public: +- ++ + template + double operator() (const From& , typename std::enable_if()>::type* = 0) const { + throw Elements::Exception() << "CastVisitor cannot convert " + << typeid(From).name() << " type to " << typeid(float).name(); + } +- ++ + template + float operator() (const From& from, typename std::enable_if()>::type* = 0) const { + return from; + } +- ++ + float operator() (const std::string& from) const { + char *endptr = nullptr; + float value = std::strtof(from.c_str(), &endptr); +@@ -146,28 +146,28 @@ public: + + template <> + class CastVisitor : public boost::static_visitor { +- ++ + template + static constexpr bool generic() { + return std::is_integral::value; + } +- ++ + public: +- ++ + template + double operator() (const From& , typename std::enable_if()>::type* = 0) const { + throw Elements::Exception() << "CastVisitor cannot convert " + << typeid(From).name() << " type to " << typeid(int64_t).name(); + } +- ++ + template + int64_t operator() (const From& from, typename std::enable_if()>::type* = 0) const { + return from; + } +- ++ + int64_t operator() (const std::string& from) const { + char *endptr = nullptr; +- int64_t value = std::strtol(from.c_str(), &endptr, 10); ++ int64_t value = std::strtoll(from.c_str(), &endptr, 10); + if (endptr == from.c_str()) { + throw Elements::Exception() << "CastVisitor cannot convert the string '" + << from << "' to " << typeid(int64_t).name(); +@@ -179,29 +179,29 @@ public: + + template <> + class CastVisitor : public boost::static_visitor { +- ++ + template + static constexpr bool generic() { + return std::is_integral::value && + !std::is_same::value; + } +- ++ + public: +- ++ + template + double operator() (const From& , typename std::enable_if()>::type* = 0) const { + throw Elements::Exception() << "CastVisitor cannot convert " + << typeid(From).name() << " type to " << typeid(int32_t).name(); + } +- ++ + template + int32_t operator() (const From& from, typename std::enable_if()>::type* = 0) const { + return from; + } +- ++ + int32_t operator() (const std::string& from) const { + char *endptr = nullptr; +- int64_t value = std::strtol(from.c_str(), &endptr, 10); ++ int64_t value = std::strtoll(from.c_str(), &endptr, 10); + if (endptr == from.c_str()) { + throw Elements::Exception() << "CastVisitor cannot convert the string '" + << from << "' to " << typeid(int32_t).name(); +@@ -217,16 +217,16 @@ public: + + template + class CastVisitor> : public boost::static_visitor> { +- ++ + public: +- ++ + template + std::vector operator() (const From& from) const { + std::vector result {}; + result.push_back(CastVisitor{}(from)); + return result; + } +- ++ + template + std::vector operator() (const std::vector& from) const { + std::vector result {}; +@@ -235,7 +235,7 @@ public: + } + return result; + } +- ++ + std::vector operator() (const std::string& from) const { + std::vector result {}; + boost::char_separator sep {","}; +@@ -245,12 +245,12 @@ public: + } + return result; + } +- ++ + // If the types match exactly we avoid an expensive copying + const std::vector& operator() (const std::vector& from) const { + return from; + } +- ++ + }; + + } /* namespace Table */ +diff --git a/XYDataset/src/lib/QualifiedName.cpp b/XYDataset/src/lib/QualifiedName.cpp +index 7d584be..4541f6a 100644 +--- a/XYDataset/src/lib/QualifiedName.cpp ++++ b/XYDataset/src/lib/QualifiedName.cpp +@@ -1,22 +1,22 @@ + /* +- * Copyright (C) 2012-2020 Euclid Science Ground Segment +- * ++ * Copyright (C) 2012-2020 Euclid Science Ground Segment ++ * + * This library is free software; you can redistribute it and/or modify it under +- * the terms of the GNU Lesser General Public License as published by the Free +- * Software Foundation; either version 3.0 of the License, or (at your option) +- * any later version. +- * +- * This library is distributed in the hope that it will be useful, but WITHOUT ++ * the terms of the GNU Lesser General Public License as published by the Free ++ * Software Foundation; either version 3.0 of the License, or (at your option) ++ * any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +- * details. +- * +- * You should have received a copy of the GNU Lesser General Public License ++ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more ++ * details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., +- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +- +- /** ++ ++ /** + * @file src/lib/QualifiedName.cpp + * @date May 19, 2014 + * @author Nikolaos Apostolakos +@@ -44,7 +44,7 @@ QualifiedName::QualifiedName(std::vector groups, std::string name) + } + m_qualified_name.append(m_dataset_name); + } +- ++ + std::vector getGroups(const std::string& qualified_name) { + std::vector groups {}; + boost::split(groups, qualified_name, boost::is_any_of("/")); +@@ -52,7 +52,7 @@ std::vector getGroups(const std::string& qualified_name) { + groups.pop_back(); + return groups; + } +- ++ + std::string getName(const std::string& qualified_name) { + std::vector groups {}; + boost::split(groups, qualified_name, boost::is_any_of("/")); +@@ -79,7 +79,7 @@ bool QualifiedName::belongsInGroup(const QualifiedName& group) const { + return false; + } + bool group_check = std::equal(group.m_groups.begin(), group.m_groups.end(), this->m_groups.begin()); +- return group_check ++ return group_check + ? group.m_dataset_name == this->m_groups.at(group.m_groups.size()) + : false; + } +@@ -93,13 +93,7 @@ size_t QualifiedName::hash() const { + } + + bool QualifiedName::operator<(const QualifiedName& other) const { +- size_t thisHash = this->hash(); +- size_t otherHash = other.hash(); +- if (thisHash != otherHash) { +- return thisHash < otherHash; +- } else{ +- return this->qualifiedName() < other.qualifiedName(); +- } ++ return this->qualifiedName() < other.qualifiedName(); + } + + bool QualifiedName::operator==(const QualifiedName& other) const { +diff --git a/XYDataset/tests/src/QualifiedName_test.cpp b/XYDataset/tests/src/QualifiedName_test.cpp +index 82798a1..1d8e9c4 100644 +--- a/XYDataset/tests/src/QualifiedName_test.cpp ++++ b/XYDataset/tests/src/QualifiedName_test.cpp +@@ -1,22 +1,22 @@ + /* +- * Copyright (C) 2012-2020 Euclid Science Ground Segment +- * ++ * Copyright (C) 2012-2020 Euclid Science Ground Segment ++ * + * This library is free software; you can redistribute it and/or modify it under +- * the terms of the GNU Lesser General Public License as published by the Free +- * Software Foundation; either version 3.0 of the License, or (at your option) +- * any later version. +- * +- * This library is distributed in the hope that it will be useful, but WITHOUT ++ * the terms of the GNU Lesser General Public License as published by the Free ++ * Software Foundation; either version 3.0 of the License, or (at your option) ++ * any later version. ++ * ++ * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +- * details. +- * +- * You should have received a copy of the GNU Lesser General Public License ++ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more ++ * details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., +- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +- +- /** ++ ++ /** + * @file tests/src/QualifiedName_test.cpp + * @date May 19, 2014 + * @author Nikolaos Apostolakos +@@ -38,12 +38,12 @@ BOOST_AUTO_TEST_SUITE (QualifiedName_test) + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(constructorExceptions_test) { +- ++ + BOOST_CHECK_THROW((Euclid::XYDataset::QualifiedName{{"","g"}, "b"}),Elements::Exception); + BOOST_CHECK_THROW((Euclid::XYDataset::QualifiedName{{"asd/sad", "g"}, "b"}), Elements::Exception); + BOOST_CHECK_THROW((Euclid::XYDataset::QualifiedName{{"a","g"}, ""}), Elements::Exception); + BOOST_CHECK_THROW((Euclid::XYDataset::QualifiedName{{"a","g"}, "bdf/sdf"}), Elements::Exception); +- ++ + } + + //----------------------------------------------------------------------------- +@@ -51,12 +51,12 @@ BOOST_AUTO_TEST_CASE(constructorExceptions_test) { + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(nameMethods_test) { +- ++ + // Given + std::string group1 = "TestGroup1"; + std::string group2 = "TestGroup2"; + std::string name = "TestName"; +- ++ + // When + Euclid::XYDataset::QualifiedName qualifiedName1 {{group1,group2}, name}; + auto groups1 = qualifiedName1.groups(); +@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(nameMethods_test) { + auto groups2 = qualifiedName2.groups(); + Euclid::XYDataset::QualifiedName qualifiedName3 {{}, name}; + auto groups3 = qualifiedName3.groups(); +- ++ + // Then + BOOST_CHECK_EQUAL(groups1.size(), 2); + BOOST_CHECK_EQUAL(groups1[0], group1); +@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(nameMethods_test) { + BOOST_CHECK_EQUAL(groups3.size(), 0); + BOOST_CHECK_EQUAL(qualifiedName3.datasetName(), name); + BOOST_CHECK_EQUAL(qualifiedName3.qualifiedName(), name); +- ++ + } + + //----------------------------------------------------------------------------- +@@ -86,10 +86,10 @@ BOOST_AUTO_TEST_CASE(nameMethods_test) { + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(belongsInGroup_test) { +- ++ + // Given + Euclid::XYDataset::QualifiedName qualified_name {"group1/group2/group3/name"}; +- ++ + // When + Euclid::XYDataset::QualifiedName group1 {"group1"}; + Euclid::XYDataset::QualifiedName group1_group2 {"group1/group2"}; +@@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(belongsInGroup_test) { + Euclid::XYDataset::QualifiedName wrong_group_1 {"wrong_group"}; + Euclid::XYDataset::QualifiedName wrong_group_2 {"group1group2"}; + Euclid::XYDataset::QualifiedName wrong_group_3 {"group1/group4/group3"}; +- ++ + // Then + BOOST_CHECK(qualified_name.belongsInGroup(group1)); + BOOST_CHECK(qualified_name.belongsInGroup(group1_group2)); +@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(belongsInGroup_test) { + BOOST_CHECK(!qualified_name.belongsInGroup(wrong_group_2)); + BOOST_CHECK(!qualified_name.belongsInGroup(wrong_group_3)); + BOOST_CHECK(!qualified_name.belongsInGroup(qualified_name)); +- ++ + } + + //----------------------------------------------------------------------------- +@@ -114,38 +114,38 @@ BOOST_AUTO_TEST_CASE(belongsInGroup_test) { + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(hashMethod_test) { +- ++ + // Given + Euclid::XYDataset::QualifiedName qualifiedName1 {{"group1","group2"}, "name"}; + Euclid::XYDataset::QualifiedName qualifiedName2 {{"group1","group2"}, "name"}; +- ++ + // Then + BOOST_CHECK_EQUAL(qualifiedName1.hash(), qualifiedName2.hash()); +- ++ + // Given + qualifiedName1 = Euclid::XYDataset::QualifiedName {{"group1","group2"}, "name"}; + qualifiedName2 = Euclid::XYDataset::QualifiedName {{"group1","group2"}, "name2"}; +- ++ + // Then + BOOST_CHECK_NE(qualifiedName1.hash(), qualifiedName2.hash()); +- ++ + // Given + qualifiedName1 = Euclid::XYDataset::QualifiedName {{"group1","group2"}, "name"}; + qualifiedName2 = Euclid::XYDataset::QualifiedName {{"group1","grou2"}, "name"}; +- ++ + // Then + BOOST_CHECK_NE(qualifiedName1.hash(), qualifiedName2.hash()); +- ++ + // Given + qualifiedName1 = Euclid::XYDataset::QualifiedName {{"group1","group2"}, "name"}; + qualifiedName2 = Euclid::XYDataset::QualifiedName {{"group1","group2"}, "name2"}; +- ++ + // Then + BOOST_CHECK_NE(qualifiedName1.hash(), qualifiedName2.hash()); +- ++ + // Given + std::hash stdHashFunction; +- ++ + // Then + BOOST_CHECK_EQUAL(qualifiedName1.hash(), stdHashFunction(qualifiedName1)); + } +@@ -155,24 +155,24 @@ BOOST_AUTO_TEST_CASE(hashMethod_test) { + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(comparison_test) { +- ++ + // Given + Euclid::XYDataset::QualifiedName qualifiedName1 {{"group1","group2"}, "name"}; + Euclid::XYDataset::QualifiedName qualifiedName2 {{"group1","group2"}, "name"}; +- ++ + // Then + BOOST_CHECK(!(qualifiedName1 < qualifiedName2)); + BOOST_CHECK(!(qualifiedName2 < qualifiedName1)); +- ++ + // Given + qualifiedName1 = Euclid::XYDataset::QualifiedName {{"agroup"}, "aname"}; + qualifiedName2 = Euclid::XYDataset::QualifiedName {{"bgroup"}, "aname"}; + Euclid::XYDataset::QualifiedName qualifiedName3 {{"bgroup"}, "bname"}; +- ++ + // Then +- BOOST_CHECK_EQUAL(qualifiedName1 < qualifiedName2, qualifiedName1.hash() < qualifiedName2.hash()); +- BOOST_CHECK_EQUAL(qualifiedName2 < qualifiedName3, qualifiedName2.hash() < qualifiedName3.hash()); +- BOOST_CHECK_EQUAL(qualifiedName1 < qualifiedName3, qualifiedName1.hash() < qualifiedName3.hash()); ++ BOOST_CHECK(qualifiedName1 < qualifiedName2); ++ BOOST_CHECK(qualifiedName2 < qualifiedName3); ++ BOOST_CHECK(qualifiedName1 < qualifiedName3); + + } + +@@ -181,20 +181,20 @@ BOOST_AUTO_TEST_CASE(comparison_test) { + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(equality_test) { +- +- ++ ++ + // Given + Euclid::XYDataset::QualifiedName qualifiedName1 {{"group1","group2"}, "name"}; + Euclid::XYDataset::QualifiedName qualifiedName2 {{"group1","group2"}, "name"}; +- ++ + // Then + BOOST_CHECK(qualifiedName1 == qualifiedName2); +- ++ + // Given + qualifiedName1 = Euclid::XYDataset::QualifiedName {{"agroup"}, "aname"}; + qualifiedName2 = Euclid::XYDataset::QualifiedName {{"bgroup"}, "aname"}; + Euclid::XYDataset::QualifiedName qualifiedName3 {{"bgroup"}, "bname"}; +- ++ + // Then + BOOST_CHECK(!(qualifiedName1 == qualifiedName2)); + BOOST_CHECK(!(qualifiedName2 == qualifiedName3)); +@@ -202,64 +202,34 @@ BOOST_AUTO_TEST_CASE(equality_test) { + + } + +-//----------------------------------------------------------------------------- +-// Check the ordering by hash +-//----------------------------------------------------------------------------- +- +-BOOST_AUTO_TEST_CASE(hashOrdering_test) { +- +- // Given +- Euclid::XYDataset::QualifiedName qualifiedName1 {{"SDSS"}, "g"}; +- Euclid::XYDataset::QualifiedName qualifiedName2 {{"COSMOS"}, "g"}; +- Euclid::XYDataset::QualifiedName qualifiedName3 {{"COSMOS"}, "z"}; +- +- // When +- std::set filterSet {}; +- filterSet.insert(qualifiedName1); +- filterSet.insert(qualifiedName2); +- filterSet.insert(qualifiedName3); +- +- // Then +- BOOST_CHECK(qualifiedName3.hash() < qualifiedName2.hash()); +- BOOST_CHECK(qualifiedName2.hash() < qualifiedName1.hash()); +- BOOST_CHECK(qualifiedName3.hash() < qualifiedName1.hash()); +- auto iterator = filterSet.begin(); +- BOOST_CHECK((*iterator) == qualifiedName3); +- ++iterator; +- BOOST_CHECK((*iterator) == qualifiedName2); +- ++iterator; +- BOOST_CHECK((*iterator) == qualifiedName1); +- +-} +- + //----------------------------------------------------------------------------- + // Check the ordering alphabetically + //----------------------------------------------------------------------------- + + BOOST_AUTO_TEST_CASE(alphabeticalOrdering_test) { +- ++ + // Given + Euclid::XYDataset::QualifiedName qualifiedName1 {{"SDSS"}, "g"}; + Euclid::XYDataset::QualifiedName qualifiedName2 {{"COSMOS"}, "g"}; + Euclid::XYDataset::QualifiedName qualifiedName3 {{"COSMOS"}, "z"}; +- ++ + // When + std::set filterSet {}; + filterSet.insert(qualifiedName1); + filterSet.insert(qualifiedName2); + filterSet.insert(qualifiedName3); +- ++ + // Then +- BOOST_CHECK(qualifiedName3.hash() < qualifiedName2.hash()); +- BOOST_CHECK(qualifiedName2.hash() < qualifiedName1.hash()); +- BOOST_CHECK(qualifiedName3.hash() < qualifiedName1.hash()); ++ BOOST_CHECK(qualifiedName3.hash() != qualifiedName2.hash()); ++ BOOST_CHECK(qualifiedName2.hash() != qualifiedName1.hash()); ++ BOOST_CHECK(qualifiedName3.hash() != qualifiedName1.hash()); + auto iterator = filterSet.begin(); + BOOST_CHECK((*iterator) == qualifiedName2); + ++iterator; + BOOST_CHECK((*iterator) == qualifiedName3); + ++iterator; + BOOST_CHECK((*iterator) == qualifiedName1); +- ++ + } + + BOOST_AUTO_TEST_SUITE_END ()