Sha256: b63e04814a7d46b038173ab51ce1e49c96ec949203ead2021a1e443ce33ba534

Contents?: true

Size: 975 Bytes

Versions: 1

Compression:

Stored size: 975 Bytes

Contents

require 'spec_helper'
require 'wukong'
require 'wukong/local_runner'

load Pathname.path_to(:examples, 'graph/minimum_spanning_tree.rb')

describe 'Minimum Spanning Tree', :examples_spec => true, :helpers => true do

  context Wukong::Widget::DisjointForest do
    subject{ Wukong::Widget::DisjointForest.new }

    context 'operations' do
      before do
        %w[ AUS DFW ATL JFK SFO LGA LAX ].each{|el| subject.add el }
        subject.union('DFW', 'AUS')
        subject.union('ATL', 'JFK')
        subject.union('ATL', 'DFW')
      end
      
      context '#find' do
        it 'collapses elements into a shallow tree during a find' do
          subject.parent['ATL'].should == 'JFK'
          subject.parent['JFK'].should == 'AUS'
          subject.find('ATL').should == 'AUS'
          subject.parent['ATL'].should == 'AUS'
        end
      end
      context '#union' do
        it 'joins shallow tree to deep tree' do
        end
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wukong-3.0.0.pre spec/examples/graph/minimum_spanning_tree_spec.rb