From 9dfe92336f92fcf028b87b04f12fbcea9f4248d2 Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Tue, 22 Dec 2020 14:01:43 +0000 Subject: [PATCH] Changed capitalization of Test and related classes to be more consistent with our general style --- dvmp/analysis/vm_mass.cxx | 2 +- util/benchmark.hh | 14 +++++++------- util/exception.hh | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dvmp/analysis/vm_mass.cxx b/dvmp/analysis/vm_mass.cxx index 7411955e..c98bf449 100644 --- a/dvmp/analysis/vm_mass.cxx +++ b/dvmp/analysis/vm_mass.cxx @@ -41,7 +41,7 @@ int vm_mass(const std::string& config_name) { // create our test definition // test_tag - eic::util::test vm_mass_resolution_test{ + eic::util::Test vm_mass_resolution_test{ {{"name", fmt::format("{}_{}_{}_mass_resolution", test_tag, vm_name, decay_name)}, {"title", diff --git a/util/benchmark.hh b/util/benchmark.hh index ad0f1774..c05954c1 100644 --- a/util/benchmark.hh +++ b/util/benchmark.hh @@ -14,7 +14,7 @@ // Usage Example 1 (single test): // ============================== // 1. define our test -// eic::util::test test1{ +// eic::util::Test test1{ // {{"name", "example_test"}, // {"title", "Example Test"}, // {"description", "This is an example of a test definition"}, @@ -28,13 +28,13 @@ // Usage Example 2 (multiple tests): // ================================= // 1. define our tests -// eic::util::test test1{ +// eic::util::Test test1{ // {{"name", "example_test"}, // {"title", "Example Test"}, // {"description", "This is an example of a test definition"}, // {"quantity", "efficiency"}, // {"target", "1"}}}; -// eic::util::test test2{ +// eic::util::Test test2{ // {{"name", "another_test"}, // {"title", "Another example Test"}, // {"description", "This is a second example of a test definition"}, @@ -49,8 +49,8 @@ // library namespace eic::util { -struct test_definition_error : exception { - test_definition_error(std::string_view msg) +struct TestDefinitionError : exception { + TestDefinitionError(std::string_view msg) : exception(msg, "test_definition_error") {} }; @@ -67,7 +67,7 @@ struct test_definition_error : exception { // - value: Actual value of <quantity> // - weight: Weight for this test (this is defaulted to 1.0 if not specified) // - result: pass/fail/error -struct test { +struct Test { test(nlohmann::json definition) : json{std::move(definition)} { // initialize with error (as we don't have a value yet) error(); @@ -75,7 +75,7 @@ struct test { for (const auto& field : {"name", "title", "description", "quantity", "target", "value", "result"}) { if (json.find(field) == json.end()) { - throw test_definition_error{ + throw TestDefinitionError{ fmt::format("Error in test definition: field '{}' missing", field)}; } } diff --git a/util/exception.hh b/util/exception.hh index 5eab3d86..d97ef27c 100644 --- a/util/exception.hh +++ b/util/exception.hh @@ -5,14 +5,14 @@ #include <string> namespace eic::util { -class exception : public std::exception { +class Exception : public std::exception { public: - exception(std::string_view msg, std::string_view type = "exception") + Exception(std::string_view msg, std::string_view type = "exception") : msg_{msg}, type_{type} {} virtual const char* what() const throw() { return msg_.c_str(); } virtual const char* type() const throw() { return type_.c_str(); } - virtual ~exception() throw() {} + virtual ~Exception() throw() {} private: std::string msg_; -- GitLab