MCPcopy Create free account
hub / github.com/Notgnoshi/generative / TEST

Function TEST

tests/geometry-graph-tests.cpp:12–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace ::testing;
11
12TEST(GeometryGraphTests, SingleLinestring)
13{
14 const auto geometry = generative::io::from_wkt("LINESTRING(0 0, 1 1, 2 2)");
15 ASSERT_TRUE(geometry);
16 const auto coords = geometry->getCoordinates();
17 ASSERT_TRUE(coords);
18
19 const auto graph = generative::noding::GeometryGraph(*geometry);
20 const auto& nodes = graph.get_nodes();
21
22 ASSERT_THAT(nodes, SizeIs(3));
23 const auto& first = nodes.at(0);
24 const auto& second = nodes.at(1);
25 const auto& third = nodes.at(2);
26
27 // As an implementation detail, expect the IDs to be generated in order of discovery.
28 EXPECT_EQ(*first.point->getCoordinate(), coords->getAt(0));
29 EXPECT_EQ(*second.point->getCoordinate(), coords->getAt(1));
30 EXPECT_EQ(*third.point->getCoordinate(), coords->getAt(2));
31
32 EXPECT_THAT(first.adjacencies, UnorderedElementsAre(1));
33 EXPECT_THAT(second.adjacencies, UnorderedElementsAre(0, 2));
34 EXPECT_THAT(third.adjacencies, UnorderedElementsAre(1));
35}
36
37TEST(GeometryGraphTests, CrossingLinestring)
38{

Callers

nothing calls this directly

Calls 3

from_wktFunction · 0.85
GeometryGraphClass · 0.85
get_edge_pairsMethod · 0.80

Tested by

no test coverage detected