From 84f7da426cb897bcb49cabc0a258de340ac7c381 Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Thu, 4 Nov 2010 22:59:42 -0200 Subject: [PATCH] Added trigraph test. --- cxxmph/trigraph_test.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cxxmph/trigraph_test.cc diff --git a/cxxmph/trigraph_test.cc b/cxxmph/trigraph_test.cc new file mode 100644 index 0000000..6220138 --- /dev/null +++ b/cxxmph/trigraph_test.cc @@ -0,0 +1,22 @@ +#include + +#include "trigraph.h" + +using cxxmph::TriGraph; + +int main(int argc, char** argv) { + TriGraph g(4, 2); + g.AddEdge(TriGraph::Edge(0, 1, 2)); + g.AddEdge(TriGraph::Edge(1, 3, 2)); + assert(g.vertex_degree()[0] == 1); + assert(g.vertex_degree()[1] == 2); + assert(g.vertex_degree()[2] == 2); + assert(g.vertex_degree()[3] == 1); + g.RemoveEdge(0); + assert(g.vertex_degree()[0] == 0); + assert(g.vertex_degree()[1] == 1); + assert(g.vertex_degree()[2] == 1); + assert(g.vertex_degree()[3] == 1); + std::vector edges; + g.ExtractEdgesAndClear(&edges); +}