Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Apr 25, 2024
1 parent 044a361 commit f8f25ca
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ jobs:
- name: Fetch Boost superproject
run: |
cd ..
git clone -b %GITHUB_BASE_REF% --depth 5 https://github.com/boostorg/boost.git
git clone -b $GITHUB_BASE_REF --depth 5 https://github.com/boostorg/boost.git
cd boost
git submodule update --init --depth 5 tools/build tools/boostdep
xcopy /s /e /q %GITHUB_WORKSPACE% libs\histogram\
xcopy /s /e /q $GITHUB_WORKSPACE libs\histogram\
python tools\boostdep\depinst\depinst.py -N units -N range -N accumulators --git_args "--depth 5 --jobs 2" histogram
- name: Prepare b2
run: cmd /c bootstrap & cd libs\histogram
# cxxstd=latest (aka 20) breaks VS 2022 in algorithm_project_test so we use cxxstd=17
# msvc-14.3 breaks test//serialization, more precisely axis_variant_serialization_test
- name: Test cxxstd=17 minimal
run: ..\..\b2 %B2_OPTS% cxxstd=17 test//minimal
run: ..\..\b2 $B2_OPTS cxxstd=17 test//minimal

56 changes: 28 additions & 28 deletions test/algorithm_reduce_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,39 @@ void run_tests() {
// - lower edge of shrink: pick bin which contains edge, lower <= x < upper
// - upper edge of shrink: pick bin which contains edge + 1, lower < x <= upper
{
auto h = make(Tag(), ID(0, 3));
auto h = make(Tag(), ID(0.0, 3.0));
const auto& ax = h.axis();
BOOST_TEST_EQ(ax.value(0), 0);
BOOST_TEST_EQ(ax.value(3), 3);
BOOST_TEST_EQ(ax.index(-1), -1);
BOOST_TEST_EQ(ax.index(3), 3);

BOOST_TEST_EQ(reduce(h, shrink(-1, 5)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, shrink(0, 3)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, shrink(1, 3)).axis(), ID(1, 3));
BOOST_TEST_EQ(reduce(h, shrink(1.001, 3)).axis(), ID(1, 3));
BOOST_TEST_EQ(reduce(h, shrink(1.999, 3)).axis(), ID(1, 3));
BOOST_TEST_EQ(reduce(h, shrink(2, 3)).axis(), ID(2, 3));
BOOST_TEST_EQ(reduce(h, shrink(0, 2.999)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, shrink(0, 2.001)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, shrink(0, 2)).axis(), ID(0, 2));
BOOST_TEST_EQ(reduce(h, shrink(0, 1.999)).axis(), ID(0, 2));

BOOST_TEST_EQ(reduce(h, crop(-1, 5)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, crop(0, 3)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, crop(1, 3)).axis(), ID(1, 3));
BOOST_TEST_EQ(reduce(h, crop(1.001, 3)).axis(), ID(1, 3));
BOOST_TEST_EQ(reduce(h, crop(1.999, 3)).axis(), ID(1, 3));
BOOST_TEST_EQ(reduce(h, crop(2, 3)).axis(), ID(2, 3));
BOOST_TEST_EQ(reduce(h, crop(0, 2.999)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, crop(0, 2.001)).axis(), ID(0, 3));
BOOST_TEST_EQ(reduce(h, crop(0, 2)).axis(), ID(0, 2));
BOOST_TEST_EQ(reduce(h, crop(0, 1.999)).axis(), ID(0, 2));
BOOST_TEST_EQ(ax.value(0), 0.0);
BOOST_TEST_EQ(ax.value(3), 3.0);
BOOST_TEST_EQ(ax.index(-1.0), -1);
BOOST_TEST_EQ(ax.index(3.0), 3);

BOOST_TEST_EQ(reduce(h, shrink(-1, 5)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(0, 3)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(1, 3)).axis(), ID(1.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(1.001, 3)).axis(), ID(1.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(1.999, 3)).axis(), ID(1.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(2, 3)).axis(), ID(2.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(0, 2.999)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(0, 2.001)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, shrink(0, 2)).axis(), ID(0.0, 2.0));
BOOST_TEST_EQ(reduce(h, shrink(0, 1.999)).axis(), ID(0.0, 2.0));

BOOST_TEST_EQ(reduce(h, crop(-1, 5)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(0, 3)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(1, 3)).axis(), ID(1.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(1.001, 3)).axis(), ID(1.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(1.999, 3)).axis(), ID(1.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(2, 3)).axis(), ID(2.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(0, 2.999)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(0, 2.001)).axis(), ID(0.0, 3.0));
BOOST_TEST_EQ(reduce(h, crop(0, 2)).axis(), ID(0.0, 2.0));
BOOST_TEST_EQ(reduce(h, crop(0, 1.999)).axis(), ID(0.0, 2.0));
}

// shrink and rebin
{
auto h = make_s(Tag(), std::vector<int>(), R(4, 1, 5, "1"), R(3, -1, 2, "2"));
auto h = make_s(Tag(), std::vector<int>(), R(4, 1.0, 5.0, "1"), R(3, -1.0, 2.0, "2"));

/*
matrix layout:
Expand Down

0 comments on commit f8f25ca

Please sign in to comment.