From c627ab2ab6467e0ba56b496a9908047dd893ba85 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 9 Aug 2018 20:46:06 +0200 Subject: [PATCH] Fix DDCMS example to use true namespace names --- examples/ClientTests/CMakeLists.txt | 2 +- examples/ClientTests/src/TestConstantMultiplier.cpp | 8 ++++++-- examples/DDCMS/CMakeLists.txt | 11 +++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index d6f124cc7..345a85610 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -36,7 +36,7 @@ dd4hep_add_test_reg( ClientTests_namespace_constants COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/NamespaceConstants.xml -destroy -plugin DD4hep_VolumeDump -plugin DD4hep_TestConstantsMultiplier - REGEX_PASS "Constant: world_z = world::Z \\[number\\] -> 10\\*world_z = 1e\\+03" + REGEX_PASS "Constant: world_z = world::Z \\[number\\] -> world_z = 100" REGEX_FAIL "Exception" REGEX_FAIL "FAILED" ) diff --git a/examples/ClientTests/src/TestConstantMultiplier.cpp b/examples/ClientTests/src/TestConstantMultiplier.cpp index b2e86f94a..f2af38dc2 100644 --- a/examples/ClientTests/src/TestConstantMultiplier.cpp +++ b/examples/ClientTests/src/TestConstantMultiplier.cpp @@ -57,19 +57,23 @@ static int multiply_constants (Detector& detector, int argc, char** argv) { "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } + int num_test = 0; const auto& constants = detector.constants(); for(const auto e : constants) { Constant c = e.second; if ( c.dataType() == "number" ) { try { - double res = _multiply(c.name(),10.0); - printout(INFO,"TestConstantsMultiplier","+++ Constant: %-16s = %-16s [%s] -> 10*%-16s = %9.3g", + double res = _multiply(c.name(),1.0); + printout(INFO,"TestConstantsMultiplier","+++ Constant: %-16s = %-16s [%s] -> %-16s = %9.3g", c.name(), c->GetTitle(), c.dataType().c_str(), c.name(), res); + ++num_test; } catch(...) { } } } + printout(ALWAYS,"TestConstantsMultiplier", + "+++ Tested %d numeric constants for expression evaluation.",num_test); return 1; } diff --git a/examples/DDCMS/CMakeLists.txt b/examples/DDCMS/CMakeLists.txt index 41b33a8a5..a71cdae31 100644 --- a/examples/DDCMS/CMakeLists.txt +++ b/examples/DDCMS/CMakeLists.txt @@ -57,6 +57,17 @@ dd4hep_add_test_reg( DDCMS_TestShapes ) # # Test CMS tracker detector construction +dd4hep_add_test_reg( DDCMS_NamespaceConstants + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" + EXEC_ARGS geoPluginRun -destroy -print WARNING + -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/cms_tracker.xml + -plugin DD4hep_TestConstantsMultiplier + REGEX_PASS "Tested 2551 numeric constants for expression evaluation" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# +# Test CMS tracker detector construction dd4hep_add_test_reg( DDCMS_LoadGeometry COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh" EXEC_ARGS geoPluginRun -- GitLab