From 1c83ac043e53936c4de79cf8f564c77db16c6ffd Mon Sep 17 00:00:00 2001
From: Lukas Garbas <lukasgarba@gmail.com>
Date: Sat, 27 Apr 2019 12:03:56 +0200
Subject: [PATCH] test example

---
 test/graph_test.cpp  | 14 +++++++++++++-
 test/meson.build     |  4 ++++
 test/reader_test.cpp |  6 +++++-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/test/graph_test.cpp b/test/graph_test.cpp
index 0892e3a..a6ceac7 100644
--- a/test/graph_test.cpp
+++ b/test/graph_test.cpp
@@ -2,10 +2,22 @@
 #include <catch2/catch.hpp>
 
 #include <gp-bnb/graph.hpp>
-//#include <gp-bnb/MetisReader.hpp>
 
 // Tests for Graph data structure
 
+// Example 1.
 TEST_CASE("GraphStructureTest") {
 
+    // Petersen Graph
+    std::vector<std::vector<unsigned int>> adjacencies {
+        {2, 3, 4}, {1, 3, 7},
+        {2, 4, 8}, {3, 5, 9},
+        {1, 4, 10}, {1, 8, 9},
+        {2, 9, 10}, {3, 6, 10},
+        {4, 6, 7}, {5, 7, 8}
+    };
+    
+    graph g = graph(adjacencies);
+
+    REQUIRE(g.num_nodes() == 10);
 }
\ No newline at end of file
diff --git a/test/meson.build b/test/meson.build
index 8fbba70..7989abf 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -3,6 +3,10 @@ testexe = executable(
     'graph_test.cpp',
     'reader_test.cpp',
     'bnb_test.cpp', # tests source files to be compiled
+    '../bnb/graph.cpp',
+	'../bnb/partition.cpp',
+	'../bnb/metis_reader.cpp',
+	'../bnb/bnb.cpp',
     include_directories : inc)  # declared include directories in root :code:`meson.build`
 
 # test execution 
diff --git a/test/reader_test.cpp b/test/reader_test.cpp
index 5498bd0..d0ad476 100644
--- a/test/reader_test.cpp
+++ b/test/reader_test.cpp
@@ -1,10 +1,14 @@
 #include <catch2/catch.hpp>
 
 #include <gp-bnb/graph.hpp>
-//#include <gp-bnb/MetisReader.hpp>
+#include <gp-bnb/metis_reader.hpp>
 
 // Tests for MetisReader
 
 TEST_CASE("MetisReaderTest") {
     
+    std::string graphFile = "../test/inputs/tiny_01.graph";
+    graph g = metis_reader().read(graphFile);
+
+    REQUIRE(g.num_nodes() == 7);
 }
\ No newline at end of file
-- 
GitLab