Sha256: 0f09b66eb975e0874d72ed985aef63a8d6851165ab6d5fd3f79f0ca509c20e36

Contents?: true

Size: 636 Bytes

Versions: 9

Compression:

Stored size: 636 Bytes

Contents

$:.unshift 'lib'

require "test/unit"
require 'caruby/util/tree'

class TreeTest < Test::Unit::TestCase
  def test_tree
    a = Tree.new(:a)
    assert_equal(a.root, :a, "Tree root incorrect")
    a << :b
    b = a[:b]
    assert_not_nil(b, "Subtree not found")
    assert_equal(b, a.children.first, "Subtree child not found")
    assert_equal(:b, b.root, "Subtree root incorrect")
    assert_nil(a[:b, :c], "Subtree at non-existing path incorrect")
    b << :c
    assert_equal(b[:c], a[:b, :c], "Subtree at path incorrect")
  end

  def test_fill
    assert_equal(Tree.new(:a).fill(:b, :c).root, :c, "Fill result incorrect")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
caruby-core-1.5.5 test/lib/caruby/util/tree_test.rb
caruby-core-1.5.4 test/lib/caruby/util/tree_test.rb
caruby-core-1.5.3 test/lib/caruby/util/tree_test.rb
caruby-core-1.5.2 test/lib/caruby/util/tree_test.rb
caruby-core-1.5.1 test/lib/caruby/util/tree_test.rb
caruby-core-1.4.9 test/lib/caruby/util/tree_test.rb
caruby-core-1.4.7 test/lib/caruby/util/tree_test.rb
caruby-core-1.4.6 test/lib/caruby/util/tree_test.rb
caruby-core-1.4.5 test/lib/caruby/util/tree_test.rb