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
21// clang-format on
23#include "CepGen/Utils/Test.h"
25
26using 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
35int main(int argc, char* argv[]) {
36 cepgen::ArgumentsParser(argc, argv).parse();
37
39 TEST_TYPE(bool, true)
40 TEST_TYPE(bool, false)
41 TEST_TYPE(string, string("Héhéhé, test @ ünıc0d€ 🐗"))
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
55}
#define CG_TEST_SUMMARY
Definition Test.h:127
A generic command line arguments parser.
ArgumentsParser & parse()
Associate command-line arguments to parameters.
Validity interval for a variable.
Definition Limits.h:28
int main()
#define TEST_TYPE(type, object)