Sha256: 5eb26e622dc0849f718275d592dd66269d4b3987e45c6bb6756fd4b18766e1d0

Contents?: true

Size: 1.67 KB

Versions: 18

Compression:

Stored size: 1.67 KB

Contents

# encoding: utf-8

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

class TestZmqFrame < ZmqTestCase
  def test_alloc
    frame = ZMQ::Frame("message")
    assert_instance_of ZMQ::Frame, frame
    assert_nil frame.destroy
  end

  def test_destroyed_frame
    frame = ZMQ::Frame("message")
    frame.destroy
    assert_raises ZMQ::Error do
      frame.data
    end
  end

  def test_alloc_empty
    frame = ZMQ::Frame.new
    assert_equal 0, frame.size
    frame.destroy
  end

  def test_size
    assert_equal 7, ZMQ::Frame("message").size
  end

  def test_data
    frame =  ZMQ::Frame("message")
    assert_equal "message", frame.data
    assert_equal "message", frame.to_s
    assert_equal "message", frame.to_str
  end

  def test_dup
    frame =  ZMQ::Frame("message")
    dup_frame = frame.dup
    assert_not_equal dup_frame.object_id, frame.object_id
    assert_equal frame.data, dup_frame.data
  end

  def test_strhex
    frame =  ZMQ::Frame("message")
    assert_equal "6D657373616765", frame.strhex
  end

  def test_data_equals
    frame =  ZMQ::Frame("message")
    assert frame.data_equals?("message")
    assert !frame.data_equals?("msg")
  end

  def test_equals
    frame =  ZMQ::Frame("message")
    assert_equal frame, ZMQ::Frame("message")
    assert_not_equal frame, ZMQ::Frame("msg")
  end

  def test_compare
    frame =  ZMQ::Frame("message")
    assert frame > ZMQ::Frame("msg")
    assert ZMQ::Frame("msg") < ZMQ::Frame("message")
  end

  def test_print
    frame =  ZMQ::Frame("message")
    assert_nil frame.print
    assert_nil frame.print("prefix")
  end

  def test_reset
    frame =  ZMQ::Frame("message")
    frame.reset("msg")
    assert_equal "msg", frame.data
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rbczmq-1.6.4 test/test_frame.rb
rbczmq-1.6.2 test/test_frame.rb
rbczmq-1.6 test/test_frame.rb
rbczmq-1.5 test/test_frame.rb
rbczmq-1.4 test/test_frame.rb
rbczmq-1.3 test/test_frame.rb
rbczmq-1.2 test/test_frame.rb
rbczmq-1.1 test/test_frame.rb
rbczmq-1.0 test/test_frame.rb
rbczmq-0.9 test/test_frame.rb
rbczmq-0.8 test/test_frame.rb
rbczmq-0.7 test/test_frame.rb
rbczmq-0.6 test/test_frame.rb
rbczmq-0.5 test/test_frame.rb
rbczmq-0.4 test/test_frame.rb
rbczmq-0.3 test/test_frame.rb
rbczmq-0.2 test/test_frame.rb
rbczmq-0.1 test/test_frame.rb