Sequoia
Loading...
Searching...
No Matches
DependencyAnalyzerFreeTest.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2021. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
13
14namespace sequoia::testing
15{
17 {
18 public:
19 using free_test::free_test;
20
21 [[nodiscard]]
22 std::filesystem::path source_file() const;
23
24 void run_tests();
25 private:
26 using test_list = std::vector<std::filesystem::path>;
27 using opt_test_list = std::optional<test_list>;
28 using multi_test_list = std::vector<test_list>;
29
30 enum class modification_time { very_early, early, late, very_late};
31
32 struct updated_file
33 {
34 std::filesystem::path file;
35 modification_time modification{modification_time::early};
36 };
37
38 struct passing_tests
39 {
40 std::vector<std::filesystem::path> tests{};
41 modification_time modification{modification_time::early};
42 };
43
44 struct test_outcomes
45 {
46 test_outcomes(opt_test_list fail, opt_test_list pass);
47
48 opt_test_list failures{}, passes{};
49 };
50
51 struct file_states
52 {
53 std::vector<updated_file> stale;
54 std::vector<std::filesystem::path> to_run;
55 };
56
57 std::filesystem::file_time_type m_ResetTime{};
58
59 void test_exceptions(const project_paths& projPaths);
60
61 void test_dependencies(const project_paths& projPaths);
62
63 void test_prune_update(const project_paths& projPaths);
64
65 void test_instability_analysis_prune_upate(const project_paths& projPaths);
66
67 void check_tests_to_run(const reporter& description,
68 const project_paths& projPaths,
69 std::string_view cutoff,
70 const file_states& fileStates,
71 std::vector<std::filesystem::path> failures,
72 passing_tests passes);
73
74 void check_data(std::string_view description, const test_outcomes& obtained, const test_outcomes& prediction);
75
76 [[nodiscard]]
77 static std::chrono::seconds to_duration(modification_time modTime);
78
79 static auto read(const std::filesystem::path& file) -> opt_test_list;
80
81 static void write_or_remove(const project_paths& projPaths, const std::filesystem::path& file, const opt_test_list& tests);
82
83 static void write_or_remove(const project_paths& projPaths, const std::filesystem::path& failureFile, const std::filesystem::path& passesFile, const test_outcomes& d);
84 };
85}
Core functionality for the testing framework.
class template from which all concrete tests should derive.
Definition: FreeTestCore.hpp:144
Definition: DependencyAnalyzerFreeTest.hpp:17
Paths used by the project.
Definition: ProjectPaths.hpp:469
Definition: Output.hpp:186