Sha256: 71d7f502a9a379361dc153f5ae4a7f73ecf5b6fbfc38635bd169af0b2001070b

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

require 'test/unit'
require "#{File.expand_path(File.dirname(__FILE__))}/../lib/cassandra"

begin; require 'ruby-debug'; rescue LoadError; end

class ComparableTypesTest < Test::Unit::TestCase
  include Cassandra::Constants

  def test_long_sort
    ary = []
    10.times { ary << Long.new }
    assert_equal ary.sort, ary
  end
  
  def test_long_equality
    long = Long.new
    assert_equal long, Long.new(long.to_s)  
    assert_equal long, Long.new(long.to_i)  
  end
  
  def test_long_error
    assert_raises(Cassandra::Comparable::TypeError) do
      Long.new("bogus")
    end
  end

  def test_uuid_sort
    ary = []
    10.times { ary << UUID.new }
    assert_equal ary.sort, ary
  end
  
  def test_uuid_equality
    uuid = UUID.new
    assert_equal uuid, UUID.new(uuid.to_s)  
    assert_equal uuid, UUID.new(uuid.to_i)  
  end
  
  def test_uuid_error
    assert_raises(Cassandra::Comparable::TypeError) do
      UUID.new("bogus")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cassandra-0.4 test/comparable_types_test.rb