From 339b002aa33bb2b91b3213194dfa17d034fddbcc Mon Sep 17 00:00:00 2001 From: alexgutteridge Date: Fri, 31 Aug 2007 05:47:07 +0000 Subject: [PATCH] git-svn-id: http://igraph.rubyforge.org/svn/trunk@42 71f48855-0bbf-4aa5-930d-4df415e86613 --- test/tc_directedness.rb~ | 31 --------------------------- test/tc_shortest_paths.rb~ | 44 -------------------------------------- test/tc_spanning.rb~ | 33 ---------------------------- test/tc_spectral.rb~ | 12 ----------- test/tc_thrash.rb~ | 13 ----------- test/tc_transitivity.rb~ | 25 ---------------------- 6 files changed, 158 deletions(-) delete mode 100644 test/tc_directedness.rb~ delete mode 100644 test/tc_shortest_paths.rb~ delete mode 100644 test/tc_spanning.rb~ delete mode 100644 test/tc_spectral.rb~ delete mode 100644 test/tc_thrash.rb~ delete mode 100644 test/tc_transitivity.rb~ diff --git a/test/tc_directedness.rb~ b/test/tc_directedness.rb~ deleted file mode 100644 index 1e1d7aa..0000000 --- a/test/tc_directedness.rb~ +++ /dev/null @@ -1,31 +0,0 @@ -require 'test/unit' -require 'igraph' - -class TestGraph < Test::Unit::TestCase - def test_directed - - g = IGraph.new(['A','B','B','C','C','D'],false) - - g.to_directed(IGraph::ARBITRARY) - assert g.are_connected?('A','B') || g.are_connected?('B','A') - assert !(g.are_connected?('A','B') && g.are_connected?('B','A')) - - g = IGraph.new(['A','B','B','C','C','D'],false) - - g.to_directed(IGraph::MUTUAL) - assert g.are_connected?('A','B') && g.are_connected?('B','A') - - end - def test_undirected - g = IGraph.new(['A','B','B','A','B','C','C','D'],true) - - g.to_undirected(IGraph::EACH) - assert_equal 4, g.ecount - - g = IGraph.new(['A','B','B','A','B','C','C','D'],true) - - g.to_undirected(IGraph::COLLAPSE) - assert_equal 3, g.ecount - - end -end diff --git a/test/tc_shortest_paths.rb~ b/test/tc_shortest_paths.rb~ deleted file mode 100644 index 0960ecd..0000000 --- a/test/tc_shortest_paths.rb~ +++ /dev/null @@ -1,44 +0,0 @@ -require 'test/unit' -require 'igraph' - -class TestGraph < Test::Unit::TestCase - def test_shortest_paths - graph = IGraph.new(['A','B','C','D'],true) - m = graph.shortest_paths(['A'],IGraph::ALL) - assert_equal 1, m[0][1] - assert_equal 0, m[0][0] - assert_equal graph.vcount, m[0].size - assert_equal nil, m[0][2] - end - - def test_get_shortest_paths - graph = IGraph.new(['A','B','C','D'],true) - m = graph.get_shortest_paths('A',['B'],IGraph::ALL) - assert_equal ['A','B'], m[0] - #assert_equal [], m[1] - end - - def test_get_all_shortest_paths - graph = IGraph.new(['A','B','A','C','B','D','C','D'],true) - m = graph.get_all_shortest_paths('A',['D'],IGraph::ALL) - assert_equal 2, m.length - end - - def test_average_path_length - graph = IGraph.new(['A','B','A','C','B','D','C','D'],true) - m = graph.average_path_length(true,true) - assert_equal 1.2, m - end - - def test_diameter_girth - graph = IGraph.new(['A','B','A','C','B','D'],true) - m = graph.diameter(true,true) - assert_equal 3, m.length - assert_raises IGraphError do - graph.girth - end - graph = IGraph.new(['A','B','A','C','B','D','C','D'],true) - assert_equal 4, graph.girth.length - end - -end diff --git a/test/tc_spanning.rb~ b/test/tc_spanning.rb~ deleted file mode 100644 index 3ca9f16..0000000 --- a/test/tc_spanning.rb~ +++ /dev/null @@ -1,33 +0,0 @@ -require 'test/unit' -require 'igraph' - -class TestGraph < Test::Unit::TestCase - def test_closeness - g = IGraph.new(['A','B','B','C','C','D'],true) - assert_equal [0.75], g.closeness(['B'],IGraph::ALL) - end - def test_betweenness - g = IGraph.new(['A','B','B','C','C','D'],true) - assert_equal [0,2], g.betweenness(['A','B'],true) - end - def test_edge_betweenness - g = IGraph.new(['A','B','C','D'],true) - assert_equal [1,1], g.edge_betweenness(true) - end - def test_pagerank - g = IGraph.new(['A','B','C','D','E','B','F','B'],true) - assert_equal 67, (g.pagerank(['B'],true,100,0.01,0.8)[0] * 100).to_i - end - def test_constraint - g = IGraph.new(['A','B','C','D'],true) - assert_equal [1], g.constraint(['A']) - assert_raises IGraphError do - g.constraint(['A'],[3]) - end - assert_equal [1], g.constraint(['A'],[2,3]) - end - def test_maxdegree - g = IGraph.new(['A','B','C','D','A','E','A','F'],true) - assert_equal 3, g.maxdegree(g.vertices,IGraph::ALL,true) - end -end diff --git a/test/tc_spectral.rb~ b/test/tc_spectral.rb~ deleted file mode 100644 index cfd4a10..0000000 --- a/test/tc_spectral.rb~ +++ /dev/null @@ -1,12 +0,0 @@ -require 'test/unit' -require 'igraph' - -class TestGraph < Test::Unit::TestCase - def test_laplacian - g = IGraph.new(['A','B','C','D'],true) - m = g.laplacian(false) - p m - m = g.laplacian(true) - p m - end -end diff --git a/test/tc_thrash.rb~ b/test/tc_thrash.rb~ deleted file mode 100644 index 56c39a5..0000000 --- a/test/tc_thrash.rb~ +++ /dev/null @@ -1,13 +0,0 @@ -require 'test/unit' -require 'igraph' - -class TestGraph < Test::Unit::TestCase - def test_thrash - g = IGraph.new([],true) - 10_000.times do |x| - g.add_vertex(x) - end - assert_equal 10_000, g.vcount - end -end - diff --git a/test/tc_transitivity.rb~ b/test/tc_transitivity.rb~ deleted file mode 100644 index d9b0805..0000000 --- a/test/tc_transitivity.rb~ +++ /dev/null @@ -1,25 +0,0 @@ -require 'test/unit' -require 'igraph' - -class TestGraph < Test::Unit::TestCase - def test_subcomponent - g = IGraph.new([1,2,3,4]) - assert_equal [1,2], g.subcomponent(1,IGraph::ALL) - end - def test_subgraph - g = IGraph.new([1,2,3,4]) - h = g.subgraph([1,2]) - assert_equal 2, h.vcount - assert_equal [1,2], h.vertices - end - def test_clusters - g = IGraph.new([1,2,3,4]) - assert_equal 2, g.clusters(IGraph::WEAK).length - assert_equal [1,2], g.clusters(IGraph::WEAK)[0] - end - def test_decompose - g = IGraph.new([1,2,3,4]) - assert_equal 2, g.decompose(IGraph::WEAK).length - assert_equal [1,2], g.decompose(IGraph::WEAK)[0].vertices - end -end