Sha256: bd3cf765f2cb30c0997bad23785e309e68f6d945fb59d478f51feaa54ab882c5

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

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

describe SPNet::LinkState do
  describe '.new' do
    it 'should assign from and to port locaters' do
      output = PortLocater.new :block_name => "block_A", :port_name => "OUT"
      input = PortLocater.new :block_name => "block_B", :port_name => "IN"
      link_state = LinkState.new :from => output, :to => input
      link_state.from.should eq(output)
      link_state.to.should eq(input)
    end
  end
  
  describe '#make_link' do
    it 'should make a Link object, given good blocks' do
      blocks = {
        "block_A" => TestBlock.new(:sample_rate => 2),
        "block_B" => TestBlock.new(:sample_rate => 2),
      }
      output = PortLocater.new :block_name => "block_A", :port_name => "OUT"
      input = PortLocater.new :block_name => "block_B", :port_name => "IN"
      link_state = LinkState.new :from => output, :to => input
      link = link_state.make_link blocks
      link.from.should eq blocks["block_A"].out_ports["OUT"]
      link.to.should eq blocks["block_B"].in_ports["IN"]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spnet-0.1.8 spec/storage/link_state_spec.rb
spnet-0.1.7 spec/storage/link_state_spec.rb
spnet-0.1.6 spec/storage/link_state_spec.rb
spnet-0.1.5 spec/storage/link_state_spec.rb