Line data Source code
1 : #include <spdlog/sinks/sink.h> 2 : #include <spdlog/sinks/stdout_color_sinks.h> 3 : #include <spdlog/spdlog.h> 4 : #include <unistd.h> 5 : 6 : #include <catch2/catch_session.hpp> 7 : #include <iostream> 8 : 9 : std::string baseDir = ""; 10 : std::string benchmarkDir = ""; 11 : 12 1 : int main(int argc, char* argv[]) { 13 : // Logger 14 2 : std::shared_ptr<spdlog::sinks::sink> mySink = std::make_shared<spdlog::sinks::stderr_color_sink_mt>(); 15 1 : mySink->set_level(spdlog::level::info); 16 4 : spdlog::default_logger()->sinks() = {mySink}; 17 : 18 : // Setup 19 1 : using namespace Catch::Clara; 20 : 21 1 : assert(std::numeric_limits<double>::has_infinity); 22 1 : assert(std::numeric_limits<double>::is_iec559); 23 : 24 2 : Catch::Session session; 25 : 26 : // Based on https://github.com/catchorg/Catch2/blob/devel/docs/own-main.md#adding-your-own-command-line-options 27 2 : Parser cli = session.cli() 28 7 : | Opt(baseDir, "baseDir")["-d"]["--baseDir"]("Base data directory") 29 8 : | Opt(benchmarkDir, "benchmarkDir")["-b"]["--benchmarkDir"]("Benchmarks data directory"); 30 : 31 1 : session.cli(cli); 32 : 33 1 : int result = session.run(argc, argv); 34 : 35 : // Clean-up... 36 : 37 1 : return result; 38 : }