./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
1 / 1
100.0%
Branches:
15 / 66
22.7%
Functions:
-
-%

include/terraingen/config/validate.h
Line Branch Exec Source
1 // SPDX-License-Identifier: BSD-3-Clause
2
3 /// @file
4 /// @brief Checking a configuration before building it: everything parsing cannot catch.
5 #pragma once
6
7 #include "terraingen/config/config.h"
8 #include "terraingen/raster/grid.h"
9
10 #include <cstddef>
11 #include <filesystem>
12 #include <optional>
13 #include <vector>
14
15 namespace terraingen {
16
17 /// What a valid configuration generates, as `ValidateConfig` finds it.
18
15/66
✓ Branch 1 taken 476 times.
✓ Branch 1 taken 91 times.
✗ Branch 2 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 14 taken 1 time.
✗ Branch 15 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 time.
✓ Branch 19 taken 1 time.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 time.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 time.
✓ Branch 25 taken 1 time.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 1 time.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 time.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 39 not taken.
✓ Branch 39 taken 1 time.
✗ Branch 40 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 43 not taken.
✗ Branch 45 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✓ Branch 57 taken 1 time.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
1107 struct ConfigSummary {
19 /// The source's grid; none without a source or for one without bounds, such as synthetic
20 /// noise.
21 std::optional<RasterGrid> source;
22 /// The grid each output covers, in order; none for a body mesh or a report.
23 std::vector<std::optional<RasterGrid>> outputGrids;
24 /// Craters the top-level crater layers are expected to generate over the output grid with the
25 /// most; unset when none generate or no output covers a grid.
26 std::optional<double> expectedCraters;
27 };
28
29 /// Checks everything parsing cannot, building the terrain to check it, and returns what it found.
30 /// @param directory Folder relative input paths resolve against; empty for the folder the
31 /// configuration was read from (`TerrainGenConfig::Directory`).
32 /// @throws ConfigError naming the first invalid value by its JSON path.
33 ConfigSummary ValidateConfig(const TerrainGenConfig& config,
34 const std::filesystem::path& directory = {});
35
36 } // namespace terraingen
37