cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
python_objects.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2022-2023 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
// clang-format off
20
#include "
CepGenAddOns/PythonWrapper/Environment.h
"
21
// clang-format on
22
#include "
CepGen/Utils/ArgumentsParser.h
"
23
#include "
CepGen/Utils/Test.h
"
24
#include "
CepGenAddOns/PythonWrapper/ObjectPtr.h
"
25
26
using namespace
std;
27
28
#define TEST_TYPE(type, object) \
29
{ \
30
auto py_obj = cepgen::python::ObjectPtr::make(object); \
31
auto ret = py_obj.value<type>(); \
32
CG_TEST_EQUAL(ret, object, std::string(#object)); \
33
}
34
35
int
main
(
int
argc,
char
* argv[]) {
36
cepgen::ArgumentsParser
(argc, argv).
parse
();
37
38
cepgen::python::Environment
env(
cepgen::ParametersList
{});
39
TEST_TYPE
(
bool
,
true
)
40
TEST_TYPE
(
bool
,
false
)
41
TEST_TYPE
(
string
,
string
(
"Héhéhé, test @ ünıc0d€ 🐗"
))
42
TEST_TYPE
(
cepgen::Limits
,
cepgen::Limits
(-2., 3.1))
43
TEST_TYPE
(
44
cepgen::ParametersList
,
45
cepgen::ParametersList
()
46
.set<int>(
"foo"
, 42)
47
.set<double>(
"bar"
, M_PI)
48
.set<std::string>(
"baz"
,
"héhé"
)
49
.set<bool>(
"flag"
,
true
)
50
.set<cepgen::ParametersList>(
51
"plist"
,
52
cepgen::ParametersList
().set<int>(
"foo"
, 10).set<double>(
"bar"
, 42.42).set<std::string>(
"baz"
,
"hîhî"
)))
53
54
CG_TEST_SUMMARY
;
55
}
ArgumentsParser.h
ObjectPtr.h
Test.h
CG_TEST_SUMMARY
#define CG_TEST_SUMMARY
Definition
Test.h:127
cepgen::ArgumentsParser
A generic command line arguments parser.
Definition
ArgumentsParser.h:31
cepgen::ArgumentsParser::parse
ArgumentsParser & parse()
Associate command-line arguments to parameters.
Definition
ArgumentsParser.cpp:106
cepgen::Limits
Validity interval for a variable.
Definition
Limits.h:28
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::python::Environment
Definition
Environment.h:28
Environment.h
main
int main()
Definition
pythia6_decay.cc:9
TEST_TYPE
#define TEST_TYPE(type, object)
Definition
python_objects.cc:28
CepGenAddOns
PythonWrapper
test
python_objects.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7