test_packetio.rb

tmud-2.10.0/test/test_packetio.rb · 599 B

From the archive tmud-2.10.0.tar.gz

Download the archive   « Back to the archive contents

# Code Generated by ZenTest v. 2.3.0
#                 classname: asrt / meth =  ratio%
#                  PacketIO:    2 /    3 =  66.67%

unless defined? $ZENTEST and $ZENTEST
require 'test/unit'
require 'network/packetio'
require 'mocksocket'
end

class TestPacketIO < Test::Unit::TestCase
  def setup
    @data = ["hello world\000".size].pack("N") + "hello world\000foobar"
    sock = MockSocket.new(@data)
    @sock = PacketIO.new(sock)
  end

  def test_read
    assert_equal("hello world", @sock.read)
  end

  def test_write
    assert_equal(true, @sock.write("hello world\r\n"))
  end
end

Site Stats

Snippets: 1791
Codebases: 571