search-algorithms/test/test-algorithm.cpp
2023-09-10 17:36:59 -05:00

24 lines
1.0 KiB
C++

#include <catch2/catch.hpp>
#include "algorithm.hpp"
TEST_CASE("Adding Graph") {
Graph testGraph = ReadInGraph("test/input/graphPosLittle");
REQUIRE( testGraph.nodeCount > 0 );
SECTION( "Vertices" ) {
REQUIRE( testGraph.vertices.at(1).nodeNumber == 1 );
REQUIRE( testGraph.vertices.at(2).nodeNumber == 2 );
REQUIRE( testGraph.vertices.at(3).nodeNumber == 3 );
REQUIRE( testGraph.vertices.at(4).nodeNumber == 4 );
REQUIRE( testGraph.vertices.at(5).nodeNumber == 5 );
REQUIRE( testGraph.vertices.at(6).nodeNumber == 6 );
REQUIRE( testGraph.vertices.at(7).nodeNumber == 7 );
REQUIRE( testGraph.vertices.at(8).nodeNumber == 8 );
REQUIRE( testGraph.vertices.at(9).nodeNumber == 9 );
REQUIRE( testGraph.vertices.at(10).nodeNumber == 10 );
}
SECTION( "Edges" ) {
REQUIRE( testGraph.vertices.at(1).edges.at(1).destination->nodeNumber == 7 );
REQUIRE( testGraph.vertices.at(1).edges.at(2).destination->nodeNumber == 2 );
}
}