Skip to content
Snippets Groups Projects
Commit 1c83ac04 authored by Lukas Garbas's avatar Lukas Garbas
Browse files

test example

parent 0054c30a
Branches
No related merge requests found
......@@ -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
......@@ -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
......
#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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment