TerrainGen coverage


terraingen/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
11 / 11
100.0%
Branches:
11 / 12
91.7%
Functions:
2 / 2
100.0%

pipeline/features.cpp
Line Branch Exec Source
1 #include "terraingen/pipeline/features.h"
2
3 #include <algorithm>
4
5 namespace terraingen {
6
7 118 CraterFeatures PlacedCraters(const Terrain& terrain, const RasterGrid& grid, double spacing) {
8
2/2
✓ Branch 1 taken 118 times.
✓ Branch 6 taken 118 times.
118 return PlacedCraters(terrain.layers, grid, std::max(spacing, grid.Spacing(terrain.surface)));
9 }
10
11 69 BoulderFeatures PlacedBoulders(const Terrain& terrain, const RasterGrid& grid, double spacing) {
12
1/1
✓ Branch 1 taken 69 times.
69 const double resolved = std::max(spacing, grid.Spacing(terrain.surface));
13 69 BoulderFeatures placed;
14
2/2
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 69 times.
224 for (std::size_t n = 0; n < terrain.layers.size(); ++n) {
15
3/4
✓ Branch 2 taken 155 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 67 times.
✓ Branch 5 taken 88 times.
155 if (const auto* placer = dynamic_cast<const BoulderPlacer*>(terrain.layers[n].get())) {
16
1/1
✓ Branch 1 taken 67 times.
67 const TerrainGround ground(terrain, n);
17
2/2
✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
67 placed.Append(placer->BouldersOver(grid, resolved, &ground));
18 67 }
19 }
20 69 return placed;
21 }
22
23 } // namespace terraingen
24