forked from EvergreenCrypto/docker-finance
root: macro: test: reorg/refactor unit/benchmark
This commit is contained in:
@@ -113,10 +113,10 @@ std::string make_timestamp()
|
|||||||
//! \ingroup cpp_macro
|
//! \ingroup cpp_macro
|
||||||
//! \details
|
//! \details
|
||||||
//! Example:
|
//! Example:
|
||||||
//! <br>  root [0] docker_finance::macro::load("test/test.C")<br>
|
//! <br>  root [0] docker_finance::macro::load("test/unit.C")<br>
|
||||||
//!
|
//!
|
||||||
//! Will load:
|
//! Will load:
|
||||||
//! <br>  root/macro/test/test.C<br>
|
//! <br>  root/macro/test/unit.C<br>
|
||||||
//!
|
//!
|
||||||
//! \note Parent directory is `root/macro`
|
//! \note Parent directory is `root/macro`
|
||||||
void load(const std::string& path)
|
void load(const std::string& path)
|
||||||
@@ -128,10 +128,10 @@ void load(const std::string& path)
|
|||||||
//! \ingroup cpp_macro
|
//! \ingroup cpp_macro
|
||||||
//! \details
|
//! \details
|
||||||
//! Example:
|
//! Example:
|
||||||
//! <br>  root [0] docker_finance::macro::load({"test/test.C", "../src/hash.hh"})<br>
|
//! <br>  root [0] docker_finance::macro::load({"test/unit.C", "../src/hash.hh"})<br>
|
||||||
//!
|
//!
|
||||||
//! Will load:
|
//! Will load:
|
||||||
//! <br>  root/macro/test/test.C and root/src/hash.hh<br>
|
//! <br>  root/macro/test/unit.C and root/src/hash.hh<br>
|
||||||
//!
|
//!
|
||||||
//! \note Parent directory is `root/macro`
|
//! \note Parent directory is `root/macro`
|
||||||
void load(const std::initializer_list<std::string>& paths)
|
void load(const std::initializer_list<std::string>& paths)
|
||||||
|
|||||||
@@ -105,9 +105,11 @@ void help()
|
|||||||
<< " 1. Use tab auto-complete to load docker-finance tests and run\n"
|
<< " 1. Use tab auto-complete to load docker-finance tests and run\n"
|
||||||
<< " unit tests and benchmarks:\n"
|
<< " unit tests and benchmarks:\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " root [0] docker_finance::macro::load(\"test/test.C\")\n"
|
<< " root [0] docker_finance::macro::load(\"test/unit.C\")\n"
|
||||||
<< " root [1] docker_finance::macro::Unit::run()\n"
|
<< " root [1] docker_finance::macro::test::Unit::run()\n"
|
||||||
<< " root [2] docker_finance::macro::Benchmark::run()\n"
|
<< " ...\n"
|
||||||
|
<< " root [2] docker_finance::macro::load(\"test/benchmark.C\")\n"
|
||||||
|
<< " root [3] docker_finance::macro::test::Benchmark::run()\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " 2. Load webserver and run registered commands:\n"
|
<< " 2. Load webserver and run registered commands:\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
|
|||||||
@@ -20,14 +20,12 @@
|
|||||||
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
//! \note File intended to be loaded into ROOT.cern framework / Cling interpreter
|
||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
|
|
||||||
#ifndef CONTAINER_SRC_ROOT_MACRO_TEST_TEST_C_
|
#ifndef CONTAINER_SRC_ROOT_MACRO_TEST_BENCHMARK_C_
|
||||||
#define CONTAINER_SRC_ROOT_MACRO_TEST_TEST_C_
|
#define CONTAINER_SRC_ROOT_MACRO_TEST_BENCHMARK_C_
|
||||||
|
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "../common/utility.hh"
|
#include "../common/utility.hh"
|
||||||
@@ -41,45 +39,12 @@ namespace docker_finance
|
|||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
namespace macro
|
namespace macro
|
||||||
{
|
{
|
||||||
//! \brief docker-finance unit tests
|
//! \namespace docker_finance::macro::test
|
||||||
//! \ingroup cpp_macro
|
//! \brief ROOT macros for docker-finance testing
|
||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
class Unit
|
namespace test
|
||||||
{
|
{
|
||||||
public:
|
//! \brief ROOT macro for docker-finance benchmarks
|
||||||
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<std::string> 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
|
|
||||||
//! \ingroup cpp_macro
|
//! \ingroup cpp_macro
|
||||||
//! \since docker-finance 1.0.0
|
//! \since docker-finance 1.0.0
|
||||||
class Benchmark
|
class Benchmark
|
||||||
@@ -105,6 +70,7 @@ class Benchmark
|
|||||||
{"../test/benchmark/random.hh"},
|
{"../test/benchmark/random.hh"},
|
||||||
{"../test/benchmark/utility.hh"}};
|
{"../test/benchmark/utility.hh"}};
|
||||||
|
|
||||||
|
namespace common = ::docker_finance::macro::common;
|
||||||
if (!loaded)
|
if (!loaded)
|
||||||
{
|
{
|
||||||
common::Command::load(paths);
|
common::Command::load(paths);
|
||||||
@@ -119,9 +85,10 @@ class Benchmark
|
|||||||
::benchmark::Shutdown();
|
::benchmark::Shutdown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} // namespace test
|
||||||
} // namespace macro
|
} // namespace macro
|
||||||
} // namespace docker_finance
|
} // 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
|
// # vim: sw=2 sts=2 si ai et
|
||||||
91
container/src/root/macro/test/unit.C
Normal file
91
container/src/root/macro/test/unit.C
Normal file
@@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! \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 <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#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<std::string> 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
|
||||||
Reference in New Issue
Block a user