Sha256: d8aa9ab7ce6fd6fdd2fb3f17af4195b40884baa22a24f8a37302a2fc3d87d146

Contents?: true

Size: 617 Bytes

Versions: 17

Compression:

Stored size: 617 Bytes

Contents

# -*- coding: utf-8 -*-
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")


describe "Tree Node Visitors" do

  before do
    ta = TreeNode.new( "a", nil )
    LeafNode.new("1", ta )
    LeafNode.new("2", ta )
    
    tb = TreeNode.new( "b", ta )
    LeafNode.new( "3", tb ) 
    
    @tree = ta
  end

  it DepthTreeNodeVisitor do
    visitor = DepthTreeNodeVisitor.new
    @tree.accept( visitor )
    visitor.depth.should == 0

    visitor = CloneTreeNodeVisitor.new
    @tree.accept( visitor )
    visitor.cloned_root.nr_nodes.should ==  @tree.nr_nodes
  end
  
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
tree.rb-0.3.12 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.11 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.10 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.9 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.8 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.7 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.6 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.5 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.4 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.3 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.2 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.1 spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb
tree.rb-0.3.0 spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
treevisitor-0.2.3 spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
treevisitor-0.2.2 spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
treevisitor-0.2.1 spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb
treevisitor-0.2.0 spec/treevisitor/visitors/depth_tree_node_visitor_spec.rb