Sha256: 4db9aaec7b4e3d249916d7122d8aea914f9afc51bdee759bc75154cc8cfe5b17

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

require 'test_helper'

require 'rgl/dot'
require 'rgl/adjacency'

class TestDot < Test::Unit::TestCase

  def assert_match(dot, pattern)
    assert(!(dot =~ pattern).nil?, "#{dot} doesn't match #{pattern}")
  end

  def test_to_dot_digraph
    graph = RGL::DirectedAdjacencyGraph[1, 2]
    dot   = graph.to_dot_graph.to_s

    assert_match(dot, /\{[^}]*\}/) # {...}
    assert_match(dot, /1\s*\[/)    # node 1
    assert_match(dot, /2\s*\[/)    # node 2
    assert_match(dot, /1\s*->\s*2/) # edge
  end

  def test_to_dot_graph
    graph = RGL::AdjacencyGraph[1, 2]
    dot   = graph.write_to_graphic_file
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rgl-0.5.0 test/dot_test.rb