Fixed graph reading in wrong
This commit is contained in:
+44
-7
@@ -7,20 +7,57 @@ void tearDown() { ; }
|
||||
|
||||
Graph testGraph;
|
||||
|
||||
void test_AllVerticesAdded(void)
|
||||
{
|
||||
void test_GraphReadsIn(void) {
|
||||
testGraph = ReadInGraph("test/input/graphPosLittle");
|
||||
TEST_ASSERT_EQUAL_INT(10, testGraph.nodeCount);
|
||||
}
|
||||
|
||||
void test_AllEdgesAdded(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(4, 2+3);
|
||||
void test_AllVerticesAdded(void) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
TEST_ASSERT_EQUAL_INT(i, testGraph.vertices.at(i).nodeNumber);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void test_AllEdgesAdded(void) {
|
||||
// Edges for vertex 1
|
||||
TEST_ASSERT_EQUAL_INT(7, testGraph.vertices.at(0).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(2, testGraph.vertices.at(0).edges.at(1).destination->nodeNumber + 1);
|
||||
// Edges for vertex 2
|
||||
TEST_ASSERT_EQUAL_INT(7, testGraph.vertices.at(1).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(5, testGraph.vertices.at(1).edges.at(1).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(1, testGraph.vertices.at(1).edges.at(2).destination->nodeNumber + 1);
|
||||
// Edges for vertex 3
|
||||
TEST_ASSERT_EQUAL_INT(6, testGraph.vertices.at(2).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(1, testGraph.vertices.at(2).edges.at(1).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(5, testGraph.vertices.at(2).edges.at(2).destination->nodeNumber + 1);
|
||||
// Edges for vertex 4
|
||||
TEST_ASSERT_EQUAL_INT(8, testGraph.vertices.at(3).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(10, testGraph.vertices.at(3).edges.at(1).destination->nodeNumber + 1);
|
||||
// Edges for vertex 5
|
||||
TEST_ASSERT_EQUAL_INT(3, testGraph.vertices.at(4).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(8, testGraph.vertices.at(4).edges.at(1).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(7, testGraph.vertices.at(4).edges.at(2).destination->nodeNumber + 1);
|
||||
// Edges for vertex 6
|
||||
TEST_ASSERT_EQUAL_INT(3, testGraph.vertices.at(5).edges.at(0).destination->nodeNumber + 1);
|
||||
// Edges for vertex 7
|
||||
TEST_ASSERT_EQUAL_INT(2, testGraph.vertices.at(6).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(9, testGraph.vertices.at(6).edges.at(1).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(1, testGraph.vertices.at(6).edges.at(2).destination->nodeNumber + 1);
|
||||
// Edges for vertex 8
|
||||
TEST_ASSERT_EQUAL_INT(5, testGraph.vertices.at(7).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(4, testGraph.vertices.at(7).edges.at(1).destination->nodeNumber + 1);
|
||||
// Edges for vertex 9
|
||||
TEST_ASSERT_EQUAL_INT(6, testGraph.vertices.at(8).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(10, testGraph.vertices.at(8).edges.at(1).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(7, testGraph.vertices.at(8).edges.at(2).destination->nodeNumber + 1);
|
||||
// Edges for vertex 10
|
||||
TEST_ASSERT_EQUAL_INT(4, testGraph.vertices.at(9).edges.at(0).destination->nodeNumber + 1);
|
||||
TEST_ASSERT_EQUAL_INT(9, testGraph.vertices.at(9).edges.at(1).destination->nodeNumber + 1);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_GraphReadsIn);
|
||||
RUN_TEST(test_AllVerticesAdded);
|
||||
RUN_TEST(test_AllEdgesAdded);
|
||||
return UNITY_END();
|
||||
|
||||
Reference in New Issue
Block a user