diff --git a/container/src/root/macro/common/utility.hh b/container/src/root/macro/common/utility.hh index b791f42..95149bd 100644 --- a/container/src/root/macro/common/utility.hh +++ b/container/src/root/macro/common/utility.hh @@ -113,10 +113,10 @@ std::string make_timestamp() //! \ingroup cpp_macro //! \details //! Example: -//!
  root [0] docker_finance::macro::load("test/test.C")
+//!
  root [0] docker_finance::macro::load("test/unit.C")
//! //! Will load: -//!
  root/macro/test/test.C
+//!
  root/macro/test/unit.C
//! //! \note Parent directory is `root/macro` void load(const std::string& path) @@ -128,10 +128,10 @@ void load(const std::string& path) //! \ingroup cpp_macro //! \details //! Example: -//!
  root [0] docker_finance::macro::load({"test/test.C", "../src/hash.hh"})
+//!
  root [0] docker_finance::macro::load({"test/unit.C", "../src/hash.hh"})
//! //! Will load: -//!
  root/macro/test/test.C and root/src/hash.hh
+//!
  root/macro/test/unit.C and root/src/hash.hh
//! //! \note Parent directory is `root/macro` void load(const std::initializer_list& paths) diff --git a/container/src/root/macro/rootlogon.C b/container/src/root/macro/rootlogon.C index a770935..7d9a72b 100644 --- a/container/src/root/macro/rootlogon.C +++ b/container/src/root/macro/rootlogon.C @@ -105,9 +105,11 @@ void help() << " 1. Use tab auto-complete to load docker-finance tests and run\n" << " unit tests and benchmarks:\n" << "\n" - << " root [0] docker_finance::macro::load(\"test/test.C\")\n" - << " root [1] docker_finance::macro::Unit::run()\n" - << " root [2] docker_finance::macro::Benchmark::run()\n" + << " root [0] docker_finance::macro::load(\"test/unit.C\")\n" + << " root [1] docker_finance::macro::test::Unit::run()\n" + << " ...\n" + << " root [2] docker_finance::macro::load(\"test/benchmark.C\")\n" + << " root [3] docker_finance::macro::test::Benchmark::run()\n" << "\n" << " 2. Load webserver and run registered commands:\n" << "\n" diff --git a/container/src/root/macro/test/test.C b/container/src/root/macro/test/benchmark.C similarity index 69% rename from container/src/root/macro/test/test.C rename to container/src/root/macro/test/benchmark.C index a8e9013..fba4ae5 100644 --- a/container/src/root/macro/test/test.C +++ b/container/src/root/macro/test/benchmark.C @@ -20,14 +20,12 @@ //! \note File intended to be loaded into ROOT.cern framework / Cling interpreter //! \since docker-finance 1.0.0 -#ifndef CONTAINER_SRC_ROOT_MACRO_TEST_TEST_C_ -#define CONTAINER_SRC_ROOT_MACRO_TEST_TEST_C_ +#ifndef CONTAINER_SRC_ROOT_MACRO_TEST_BENCHMARK_C_ +#define CONTAINER_SRC_ROOT_MACRO_TEST_BENCHMARK_C_ #include -#include #include -#include #include #include "../common/utility.hh" @@ -41,45 +39,12 @@ namespace docker_finance //! \since docker-finance 1.0.0 namespace macro { -//! \brief docker-finance unit tests -//! \ingroup cpp_macro +//! \namespace docker_finance::macro::test +//! \brief ROOT macros for docker-finance testing //! \since docker-finance 1.0.0 -class Unit +namespace test { - public: - Unit() = default; - ~Unit() = default; - - Unit(const Unit&) = default; - Unit& operator=(const Unit&) = default; - - Unit(Unit&&) = default; - Unit& operator=(Unit&&) = default; - - public: - //! \brief Macro for running all tests - //! \todo parameter arg that takes list of tests - static int run() - { - static bool loaded{false}; - static const std::initializer_list paths{ - {"../test/unit/hash.hh"}, - {"../test/unit/random.hh"}, - {"../test/unit/type.hh"}, - {"../test/unit/utility.hh"}}; - - if (!loaded) - { - common::Command::load(paths); - loaded = true; - } - - ::testing::InitGoogleTest(); - return RUN_ALL_TESTS(); // TODO(unassigned): caller do something about this - } -}; - -//! \brief docker-finance benchmarks +//! \brief ROOT macro for docker-finance benchmarks //! \ingroup cpp_macro //! \since docker-finance 1.0.0 class Benchmark @@ -105,6 +70,7 @@ class Benchmark {"../test/benchmark/random.hh"}, {"../test/benchmark/utility.hh"}}; + namespace common = ::docker_finance::macro::common; if (!loaded) { common::Command::load(paths); @@ -119,9 +85,10 @@ class Benchmark ::benchmark::Shutdown(); } }; +} // namespace test } // namespace macro } // namespace docker_finance -#endif // CONTAINER_SRC_ROOT_MACRO_TEST_TEST_C_ +#endif // CONTAINER_SRC_ROOT_MACRO_TEST_BENCHMARK_C_ // # vim: sw=2 sts=2 si ai et diff --git a/container/src/root/macro/test/unit.C b/container/src/root/macro/test/unit.C new file mode 100644 index 0000000..6457fc5 --- /dev/null +++ b/container/src/root/macro/test/unit.C @@ -0,0 +1,91 @@ +// docker-finance | modern accounting for the power-user +// +// Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! \file +//! \author Aaron Fiore (Founder, Evergreen Crypto LLC) +//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter +//! \since docker-finance 1.0.0 + +#ifndef CONTAINER_SRC_ROOT_MACRO_TEST_UNIT_C_ +#define CONTAINER_SRC_ROOT_MACRO_TEST_UNIT_C_ + +#include + +#include +#include + +#include "../common/utility.hh" + +//! \namespace docker_finance +//! \since docker-finance 1.0.0 +namespace docker_finance +{ +//! \namespace docker_finance::macro +//! \brief ROOT macros +//! \since docker-finance 1.0.0 +namespace macro +{ +//! \namespace docker_finance::macro::test +//! \brief ROOT macros for docker-finance testing +//! \since docker-finance 1.0.0 +namespace test +{ +//! \brief ROOT macro for docker-finance unit tests +//! \ingroup cpp_macro +//! \since docker-finance 1.0.0 +class Unit +{ + public: + Unit() = default; + ~Unit() = default; + + Unit(const Unit&) = default; + Unit& operator=(const Unit&) = default; + + Unit(Unit&&) = default; + Unit& operator=(Unit&&) = default; + + public: + //! \brief Macro for running all tests + //! \todo parameter arg that takes list of tests + static int run() + { + static bool loaded{false}; + static const std::initializer_list paths{ + {"../test/unit/hash.hh"}, + {"../test/unit/random.hh"}, + {"../test/unit/type.hh"}, + {"../test/unit/utility.hh"}}; + + namespace common = ::docker_finance::macro::common; + if (!loaded) + { + common::Command::load(paths); + loaded = true; + } + + ::testing::InitGoogleTest(); + return RUN_ALL_TESTS(); // TODO(unassigned): caller do something about this + } +}; +} // namespace test +} // namespace macro +} // namespace docker_finance + +#endif // CONTAINER_SRC_ROOT_MACRO_TEST_UNIT_C_ + +// # vim: sw=2 sts=2 si ai et