Sha256: 36e995c2453fac3f15cd4e8b24b4f9fa6b86955c69f0218c2875d337fe8d6b8d

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "SGF::Tree" do

  before :each do
    @tree = get_tree_from 'spec/data/ff4_ex.sgf'
  end

  it "should have two gametrees" do
    @tree.games.size.should == 2
  end

  it "should have a decent inspect" do
    inspect = @tree.inspect
    inspect.should match /SGF::Tree/
    inspect.should match /#{@tree.object_id}/
    inspect.should match /2 Games/
    inspect.should match /62 Nodes/
  end

  it "should use preorder traversal for each" do
    @tree = get_tree_from 'spec/data/example1.sgf'
    array = []
    @tree.each {|node| array << node}
    array[0].c.should == "root"
    array[1].c.should == "a"
    array[2].c.should == "b"
  end

  it "should load a file properly" do
    @tree.class.should == SGF::Tree
    @tree.root.children.size.should == 2
    @tree.root.children[0].children.size.should == 5
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
SgfParser-2.0.0 spec/tree_spec.rb