Sha256: 054c9fe39a18c6bf5285b5941769f0d7135a08becce81b4a2b1d3135b46da642

Contents?: true

Size: 1.61 KB

Versions: 12

Compression:

Stored size: 1.61 KB

Contents

require 'test_helper'

# Information class unit test class.
class ContainerNodeTest < Test::Unit::TestCase
   def test01
      nodes = []
      nodes.push(ContainerNode.new(nil))
      nodes.push(ContainerNode.new(nodes[0]))
      
      assert(nodes[0].size == 0)
      assert(nodes[1].size == 0)
      
      assert(nodes[0].first == nil)
      assert(nodes[0].last == nil)
      assert(nodes[1].first == nil)
      assert(nodes[1].last == nil)
      
      assert(nodes[0][0] == nil)
      assert(nodes[1][-1] == nil)
      
      count = 0
      nodes[0].each {|entry| count += 1}
      assert(count == 0)
      nodes[1].each {|entry| count += 1}
      assert(count == 0)
   end
   
   def test02
      node   = ContainerNode.new(nil)
      child1 = ContainerNode.new(nil)
      child2 = ContainerNode.new(nil)
      
      node.store(child1)
      assert(node.size == 1)
      assert(node[0] == child1)
      assert(node[-1] == child1)
      assert(node[0].parent == node)
      assert(node.first == child1)
      assert(node.last == child1)
      
      count = 0
      node.each {|entry| count += 1}
      assert(count == 1)
      
      node.store(child2)
      assert(node.size == 2)
      assert(node[0] == child1)
      assert(node[1] == child2)
      assert(node[-1] == child2)
      assert(node[-2] == child1)
      assert(node[0].parent == node)
      assert(node[1].parent == node)
      assert(node.first == child1)
      assert(node.last == child2)
   end
   
   def test03
      begin
         ContainerNode.new(nil).to_rtf
         flunk("Successfully called ContainerNode#to_rtf().")
      rescue => error
      end
   end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
thechrisoshow-ruby-rtf-0.2.0 test/container_node_test.rb
rtf-0.3.3 test/container_node_test.rb
rtf-0.3.2 test/container_node_test.rb
rtf-0.3.0 test/container_node_test.rb
panmind-rtf-0.4.1 test/container_node_test.rb
panmind-rtf-0.4.0 test/container_node_test.rb
clbustos-rtf-0.3.1 test/container_node_test.rb
panmind-rtf-0.3.1 test/container_node_test.rb
clbustos-rtf-0.3.0 test/container_node_test.rb
clbustos-rtf-0.2.2 test/container_node_test.rb
clbustos-rtf-0.2.1 test/container_node_test.rb
clbustos-rtf-0.1.2 test/container_node_test.rb