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
32
#include "
rANS/internal/common/utils.h
"
33
34
BOOST_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
);
38
BOOST_CHECK_NO_THROW
(
o2::rans::utils::checkBounds
(std::begin(
A
), std::end(
A
)));
39
};
40
41
BOOST_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
};
utils.h
common helper classes and functions
A
Definition
A.h:16
o2::rans::OutOfBoundsError
Definition
exceptions.h:66
o2::rans::utils
Definition
typetraits.h:114
o2::rans::utils::checkBounds
void checkBounds(IT iteratorPosition, IT upperBound)
Definition
utils.h:244
BOOST_CHECK_NO_THROW
BOOST_CHECK_NO_THROW(algorithm::merge(target, other))
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(test_checkBounds)
Definition
test_ransUtils.cxx:34
Utilities
rANS
test
test_ransUtils.cxx
Generated on Tue Feb 25 2025 23:16:53 for Project by
1.9.8