Project
Loading...
Searching...
No Matches
test_ransUtils.cxx
Go to the documentation of this file.
1// Copyright 2019-2023 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#define BOOST_TEST_MODULE Utility test
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
19
20#undef NDEBUG
21#include <cassert>
22
23#include <vector>
24#include <type_traits>
25#include <array>
26
27#include <boost/test/unit_test.hpp>
28#include <boost/mpl/list.hpp>
29
30#include <fairlogger/Logger.h>
31
33
34BOOST_AUTO_TEST_CASE(test_checkBounds)
35{
36 std::vector<size_t> A(2);
37 BOOST_CHECK_THROW(o2::rans::utils::checkBounds(std::end(A), std::begin(A)), o2::rans::OutOfBoundsError);
39};
40
41BOOST_AUTO_TEST_CASE(test_checkAlphabetBitRange)
42{
43 using namespace o2::rans::utils;
44 BOOST_CHECK_EQUAL(getRangeBits(-1, -1), 0ul); // empty or single value -> 2**0 = 1
45 BOOST_CHECK_EQUAL(getRangeBits(-1, 0), 1ul); // 2 unique values -> 1 Bit
46 BOOST_CHECK_EQUAL(getRangeBits(-1, 1), 2ul); // 3 unique values -> 2 Bits
47 BOOST_CHECK_EQUAL(getRangeBits(-1, 2), 2ul); // 4 unique values -> 2 Bits
48 BOOST_CHECK_EQUAL(getRangeBits(-1, 3), 3ul); // 5 unique values -> 3 Bits
49};
common helper classes and functions
Definition A.h:16
void checkBounds(IT iteratorPosition, IT upperBound)
Definition utils.h:244
BOOST_CHECK_NO_THROW(algorithm::merge(target, other))
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
BOOST_AUTO_TEST_CASE(test_checkBounds)