Sha256: a1ba096598f8f21735d3ddee74bf6f08a9ff63195805723ebc1d143ccc37771e
Contents?: true
Size: 954 Bytes
Versions: 2
Compression:
Stored size: 954 Bytes
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([1,2],[e[0],e[1]]) assert(DirectedEdge.new(1,2).eql?(DirectedEdge.new(1,2))) assert(!DirectedEdge.new(1,2).eql?(DirectedEdge.new(1,3))) assert(!DirectedEdge.new(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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rgl-0.2.2 | tests/TestEdge.rb |
rgl-0.2.3 | tests/TestEdge.rb |