tmud-3.0.0/benchmark/
tmud-3.0.0/cmd/
tmud-3.0.0/cmd/objects/
tmud-3.0.0/cmd/tiny/
tmud-3.0.0/doc/SQLite/
tmud-3.0.0/doc/SQLite3/
tmud-3.0.0/doc/TernaryTrie/
tmud-3.0.0/farts/
tmud-3.0.0/lib/
tmud-3.0.0/lib/engine/
tmud-3.0.0/lib/farts/
tmud-3.0.0/logs/
# Code Generated by ZenTest v. 2.3.0
#                 classname: asrt / meth =  ratio%
#                    SockIO:   10 /    7 = 142.86%

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

class TestSockIO < Test::Unit::TestCase
  def setup
    @sock = SockIO.new(MockSocket.new("hello world\r\nfoobar"), 5)
  end

  def test_read
    assert_equal("hello", @sock.read)
    assert_equal(" worl", @sock.read)
    assert_equal("d\r\nfo", @sock.read)
  end

  def test_read_flush
    assert_equal("", @sock.read_flush)
  end

  def test_read_urgent
    assert_equal("hello", @sock.read_urgent)
    assert_equal(" worl", @sock.read_urgent)
    assert_equal("d\r\nfo", @sock.read_urgent)
  end

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

  def test_write_flush
    assert_equal("", @sock.write_flush)
  end

  def test_write_urgent
    assert_equal(13, @sock.write_urgent("hello world\r\n"))
  end
end