Sha256: 802a9ddcc88b112a360fe3a39b36fde6c10dd48f4e91428402a02175467cb3cc

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

require File.join( File.dirname(__FILE__) , '..', 'spec_helper' )


describe OSC::NetworkPacket do
  before :each do
    @empty = OSC::NetworkPacket.new( "" )
    @simple = OSC::NetworkPacket.new( "abc" )
  end
  
  it "should know if it's at the end of the stream" do
    @empty.eof?.must_equal true
  end
  
  it "should know the remainder in the stream" do
    @simple.rem.must_equal 3
  end
  
  it "should be able to skip positions" do
    @simple.skip( 1 )
    @simple.rem.must_equal 2
  end
  
  it "should be able to get a character from the stream" do
    @simple.getc.must_equal ?a
    @simple.getc.must_equal ?b
    @simple.getc.must_equal ?c
    @simple.eof?.must_equal true
  end
  
  it "should be able to get a number of characters from the stream" do
    @simple.getn(3).must_equal "abc"
  end

  it "outputs characters with ASCII/BINARY encoding" do
    @simple.getc.encoding.to_s.must_equal "ASCII-8BIT"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
osc-ruby-1.1.3 spec/unit/network_packet_spec.rb
osc-ruby-1.1.2 spec/unit/network_packet_spec.rb
osc-ruby-1.1.1 spec/unit/network_packet_spec.rb