Skip to content

Commit 88544cf

Browse files
committed
Add CPP test writing empty graph to disk, and reading successfully.
1 parent ce0a4c7 commit 88544cf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

networkit/cpp/io/test/IOGTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <cassert>
1212
#include <chrono>
1313
#include <cstring>
14+
#include <filesystem>
1415
#include <fstream>
1516
#include <iostream>
1617
#include <limits>
@@ -646,6 +647,17 @@ TEST_F(IOGTest, testGraphToolBinaryReader) {
646647
EXPECT_FALSE(G.isDirected());
647648
}
648649

650+
TEST_F(IOGTest, testGraphToolBinaryEmptyFileCanBeRead) {
651+
Graph graph(0, false, true);
652+
GraphToolBinaryWriter writer;
653+
std::filesystem::path const path = "output/empty_graph.gt";
654+
writer.write(graph, path.c_str());
655+
656+
GraphToolBinaryReader reader;
657+
Graph graph_read = reader.read(path.c_str());
658+
EXPECT_EQ(graph.numberOfNodes(), graph_read.numberOfNodes());
659+
}
660+
649661
TEST_F(IOGTest, testGraphToolBinaryWriter) {
650662
Graph G(10, false, false);
651663
G.addEdge(0, 1);

0 commit comments

Comments
 (0)