Project
Loading...
Searching...
No Matches
TestParameters.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 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
12#include "TestParameters.h"
13#include <array>
14
15TestParameters::TestParameters() : path(""), isTestFileInManuNumbering{false}, isSegmentationRun3{true}
16{
17 auto& ts = boost::unit_test::framework::master_test_suite();
18 auto n = ts.argc;
19 if (n >= 2) {
20 std::string testpos{"--testpos"};
21 std::string testnumbering{"--manunumbering"};
22 std::string testrun2{"--run2"};
23 for (auto i = 0; i < n; i++) {
24 if (testpos == ts.argv[i] && i < n - 1) {
25 path = ts.argv[i + 1];
26 ++i;
27 }
28 if (testnumbering == ts.argv[i]) {
30 }
31 if (testrun2 == ts.argv[i]) {
32 isSegmentationRun3 = false;
33 }
34 }
35 }
36}
37
38boost::test_tools::assertion_result TestParameters::operator()(boost::unit_test_framework::test_unit_id)
39{
40 return !path.empty();
41}
42
43std::ostream& operator<<(std::ostream& os, const TestParameters& params)
44{
45 os << "path:" << params.path
46 << " manu:" << params.isTestFileInManuNumbering
47 << " run3:" << params.isSegmentationRun3;
48 return os;
49}
50
51std::array<int, 64> refManu2ds_st345 = {
52 63, 62, 61, 60, 59, 57, 56, 53, 51, 50, 47, 45, 44, 41, 38, 35,
53 36, 33, 34, 37, 32, 39, 40, 42, 43, 46, 48, 49, 52, 54, 55, 58,
54 7, 8, 5, 2, 6, 1, 3, 0, 4, 9, 10, 15, 17, 18, 22, 25,
55 31, 30, 29, 28, 27, 26, 24, 23, 20, 21, 16, 19, 12, 14, 11, 13};
56
57std::array<int, 64> refManu2ds_st12 = {
58 36, 35, 34, 33, 32, 37, 38, 43, 45, 47, 49, 50, 53, 41, 39, 40,
59 63, 62, 61, 60, 59, 58, 56, 57, 54, 55, 52, 51, 48, 46, 44, 42,
60 31, 30, 29, 28, 27, 26, 25, 24, 22, 23, 20, 18, 17, 15, 13, 11,
61 4, 3, 2, 1, 0, 5, 6, 10, 12, 14, 16, 19, 21, 8, 7, 9};
62
63int manu2ds(int deId, int ch)
64{
65 if (deId < 500) {
66 return refManu2ds_st12[ch];
67 }
68 return refManu2ds_st345[ch];
69}
70
71std::array<int, 64> reverse(std::array<int, 64> a)
72{
73 std::array<int, 64> r;
74 for (auto i = 0; i < a.size(); i++) {
75 r[a[i]] = i;
76 }
77 return r;
78}
79
80int ds2manu(int deId, int ch)
81{
82 static std::array<int, 64> ds2manu_st12 = reverse(refManu2ds_st12);
83 static std::array<int, 64> ds2manu_st345 = reverse(refManu2ds_st345);
84 if (deId < 500) {
85 return ds2manu_st12[ch];
86 }
87 return ds2manu_st345[ch];
88}
int32_t i
int ds2manu(int deId, int ch)
std::array< int, 64 > refManu2ds_st345
std::array< int, 64 > reverse(std::array< int, 64 > a)
int manu2ds(int deId, int ch)
std::array< int, 64 > refManu2ds_st12
std::ostream & operator<<(std::ostream &os, const TestParameters &params)
GLdouble n
Definition glcorearb.h:1982
GLenum const GLfloat * params
Definition glcorearb.h:272
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
boost::test_tools::assertion_result operator()(boost::unit_test_framework::test_unit_id)
bool isTestFileInManuNumbering