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
14
15namespace sequoia::testing
16{
18 {
19 public:
20 using free_test::free_test;
21
22 [[nodiscard]]
23 std::filesystem::path source_file() const;
24
25 void run_tests();
26 private:
27 using test_list = std::vector<std::filesystem::path>;
28 using opt_test_list = std::optional<test_list>;
29 using multi_test_list = std::vector<test_list>;
30
31 using prune_records = std::vector<prune_record>;
32 using opt_prune_records = std::optional<prune_records>;
33
34 enum class modification_time { very_early, early, late, very_late};
35
36 struct updated_file
37 {
38 std::filesystem::path file;
39 modification_time modification{modification_time::early};
40 };
41
42 struct test_outcomes
43 {
44 test_outcomes(opt_prune_records fail, opt_prune_records pass);
45
46 opt_prune_records failures{}, passes{};
47 };
48
49 struct file_states
50 {
51 std::vector<updated_file> stale;
52 std::vector<std::filesystem::path> to_run;
53 };
54
55 std::filesystem::file_time_type m_ResetTime{};
56
57 void test_exceptions(const project_paths& projPaths);
58
59 void test_dependencies(const project_paths& projPaths);
60
61 void test_prune_update(const project_paths& projPaths);
62
63 void test_instability_analysis_prune_upate(const project_paths& projPaths);
64
65 void check_tests_to_run(const reporter& description,
66 const project_paths& projPaths,
67 std::string_view cutoff,
68 const file_states& fileStates,
69 std::vector<prune_record> failures,
70 std::vector<prune_record> passes);
71
72 void check_data(std::string_view description, const test_outcomes& obtained, const test_outcomes& prediction);
73
74 [[nodiscard]]
75 static std::chrono::seconds to_duration(modification_time modTime);
76
77 static auto read(const std::filesystem::path& file) -> opt_prune_records;
78
79 static void write_or_remove(const project_paths& projPaths, const std::filesystem::path& file, const opt_prune_records& tests);
80
81 static void write_or_remove(const project_paths& projPaths, const std::filesystem::path& failureFile, const std::filesystem::path& passesFile, const test_outcomes& d);
82 };
83}
Facility to detect changes on disk and only run the relevant tests.
Core functionality for the testing framework.
class template from which all concrete tests should derive.
Definition: FreeTestCore.hpp:144
Definition: DependencyAnalyzerFreeTest.hpp:18
Paths used by the project.
Definition: ProjectPaths.hpp:467
Definition: Output.hpp:176