8000 Test+Python: improved python test debugging · cepgen/cepgen@5865ea6 · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
Test+Python: improved python test debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
forthommel committed May 9, 2023
1 parent 8e25b68 commit 5865ea6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure --verbose
6 changes: 3 additions & 3 deletions CepGen/Utils/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ namespace cepgen {
std::string replace_all(const std::string& str, const std::string& from, const std::string& to) {
auto out{str};
if (replace_all(out, from, to) == 0)
CG_DEBUG("replace_all") << "No occurrence of {"
<< replace_all(from, {{"\n", "\\n"}, {"\t", "\\t"}, {"\r", "\\r"}})
<< "} found in input string.";
CG_DEBUG_LOOP("replace_all") << "No occurrence of {"
<< replace_all(from, {{"\n", "\\n"}, {"\t", "\\t"}, {"\r", "\\r"}})
<< "} found in input string.";
return out;
}

Expand Down
3 changes: 3 additions & 0 deletions CepGenAddOns/PythonWrapper/test/python_particle_mod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ int main(int argc, char* argv[]) {
cepgen::ArgumentsParser(argc, argv).parse();

auto card = cepgen::CardsHandlerFactory::get().build(".py");
CG_DEBUG("main") << "Python cards handler successfully constructed.";

card->parseString(R"(
from Config.PDG_cfi import PDG, registerParticle
registerParticle(name='teston', pdgid=42, mass=42.42, width=1.1))",
new cepgen::Parameters);
CG_DEBUG("main") << "Configuration string successfully parsed.";

const auto& teston = cepgen::PDG::get()(42);
CG_TEST_EQUAL(teston.pdgid, 42, "new particle PDG id");
Expand Down

0 comments on commit 5865ea6

Please sign in to comment.
0