File: test_subgraph.rb

package info (click to toggle)
ruby-graphviz 1.2.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 1,216 kB
  • sloc: ruby: 7,685; xml: 26; makefile: 17
file content (27 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'helper'

class GraphVizSubGraphTest < Test::Unit::TestCase
  def test_subgraph
    master1 = GraphViz::new(:G)
    master1.add_graph('cluster_cl1')

    master2 = GraphViz::new(:G)
    cl2 = GraphViz::new('cluster_cl1')
    master2.add_graph cl2

    assert_equal(master1.to_s, master2.to_s, "Wrong subgraph")
  end

  def test_to_graph
    m = GraphViz.new(:G)
    m.add_edges("m1", "m2")
    c = m.add_graph('c')
    c.add_edges("c1", "c2")

    assert_equal true, c.has_parent_graph?
    assert_equal false, m.has_parent_graph?

    ci = c.to_graph
    assert_equal false, ci.has_parent_graph?
  end
end