OGS
TestDefinition.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <memory>
7#include <string>
8#include <string_view>
9#include <vector>
10
12
13namespace BaseLib
14{
15class ConfigTree;
16}
17
18namespace ApplicationsLib
19{
20class TestDefinition final
21{
22public:
26 TestDefinition(BaseLib::ConfigTree const& config_tree,
27 std::string const& reference_path,
28 std::string const& output_directory);
29
31 OGS_EXPORT_SYMBOL bool runTests() const;
32
34 OGS_EXPORT_SYMBOL bool runTests(std::string_view diff_tool_name) const;
35
38 std::string_view diff_tool_name) const;
39
41 OGS_EXPORT_SYMBOL bool hasTests(std::string_view diff_tool_name) const;
42
44 std::vector<std::string> const& getOutputFiles() const;
45
47 std::size_t numberOfTests() const;
48
49private:
51 {
52 std::string diff_tool_name;
53 std::string command_line;
54 };
55
56 static bool runCommandLines(std::vector<CommandLine> const& command_lines,
57 bool fail_on_empty);
58
59 std::vector<CommandLine> _command_lines;
60 std::vector<std::string> _output_files;
61};
62} // namespace ApplicationsLib
#define OGS_EXPORT_SYMBOL
OGS_EXPORT_SYMBOL bool runTests() const
Runs all configured test command lines.
std::vector< std::string > _output_files
static bool runCommandLines(std::vector< CommandLine > const &command_lines, bool fail_on_empty)
std::vector< CommandLine > _command_lines
TestDefinition(BaseLib::ConfigTree const &config_tree, std::string const &reference_path, std::string const &output_directory)
std::size_t numberOfTests() const
Returns the number of configured test command lines.
OGS_EXPORT_SYMBOL bool runTestsExcluding(std::string_view diff_tool_name) const
Runs all test command lines except those for the given diff tool.
std::vector< std::string > const & getOutputFiles() const
Returns all output files referenced by the configured test definitions.
OGS_EXPORT_SYMBOL bool hasTests(std::string_view diff_tool_name) const
Returns true if at least one test command line uses the given diff tool.