| 10 | using namespace ::testing; |
| 11 | |
| 12 | TEST(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 | |
| 37 | TEST(GeometryGraphTests, CrossingLinestring) |
| 38 | { |
nothing calls this directly
no test coverage detected