Sha256: 05ba50f6b012a25443de7b76cd25fcc8ef61024bce958e9bbb4c521c12f69c54
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require 'test/unit' require 'rgl/base' include RGL::Edge class TestEdge < Test::Unit::TestCase def test_directed_edge assert_raises(ArgumentError) {DirectedEdge.new} e = DirectedEdge.new 1,2 assert_equal(1,e.source) assert_equal(2,e.target) assert_equal([1,2],e.to_a) assert_equal("(1-2)",e.to_s) assert_equal("(2-1)",e.reverse.to_s) assert_equal([1,2],[e[0],e[1]]) assert(DirectedEdge[1,2].eql?(DirectedEdge.new(1,2))) assert(!DirectedEdge[1,2].eql?(DirectedEdge.new(1,3))) assert(!DirectedEdge[2,1].eql?(DirectedEdge.new(1,2))) end def test_undirected_edge assert_raises(ArgumentError) {UnDirectedEdge.new} e = UnDirectedEdge.new 1,2 assert_equal(1,e.source) assert_equal(2,e.target) assert_equal([1,2],e.to_a) assert_equal("(1=2)",e.to_s) assert(UnDirectedEdge.new(1,2).eql?(UnDirectedEdge.new(2,1))) assert(!UnDirectedEdge.new(1,3).eql?(UnDirectedEdge.new(2,1))) assert_equal(UnDirectedEdge.new(1,2).hash,UnDirectedEdge.new(1,2).hash) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rgl-0.3.1 | tests/TestEdge.rb |
rgl-0.3.0 | tests/TestEdge.rb |
rgl-0.4.0 | tests/TestEdge.rb |