Sha256: 06b3b6e143aee396e3d6fa0849515a786267b3e33025e6b65a3c8b2ba492f8aa

Contents?: true

Size: 1.2 KB

Versions: 46

Compression:

Stored size: 1.2 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

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)
    assert_equal long, Long.new(long.to_s)
    assert_equal long, Long.new(long.to_i)
    assert_equal long, Long.new(long.to_guid)
  end

  def test_long_error
    assert_raises(Cassandra::Comparable::TypeError) do
      Long.new("bogus")
    end
  end

  def test_types_behave_well
    assert !(Long.new() == false)
  end

  def test_casting_unknown_class
    assert_raises(Cassandra::Comparable::TypeError) do
      Cassandra::Long.new({})
    end
  end

  def test_long_inspect
    obj = Long.new("\000\000\000\000\000\000\000\000")
    if RUBY_VERSION < '1.9'
      assert_equal "<Cassandra::Long##{obj.object_id} time: Thu Jan 01 00:00:00 UTC 1970, usecs: 0, jitter: 0, guid: 00000000-0000-0000>", obj.inspect
    else
      assert_equal "<Cassandra::Long##{obj.object_id} time: 1970-01-01 00:00:00 UTC, usecs: 0, jitter: 0, guid: 00000000-0000-0000>", obj.inspect
    end
  end

end

Version data entries

46 entries across 46 versions & 7 rubygems

Version Path
mcmire-cassandra-0.12.2 test/comparable_types_test.rb
cassilds-0.12.6 test/comparable_types_test.rb
cassilds-0.12.5 test/comparable_types_test.rb
cassilds-0.12.4 test/comparable_types_test.rb
cassilds-0.12.3 test/comparable_types_test.rb
cassilds-0.12.2 test/comparable_types_test.rb
cassilds-0.12.1 test/comparable_types_test.rb
cassandra-0.12.1 test/comparable_types_test.rb
cassandra-0.12.0 test/comparable_types_test.rb
cassilds-0.9.2 test/comparable_types_test.rb
cassilds-0.9.1 test/comparable_types_test.rb
cassandra-0.11.4 test/comparable_types_test.rb
cassandra-0.11.3 test/comparable_types_test.rb
cassandra-0.11.2 test/comparable_types_test.rb
cassandra-0.11.1 test/comparable_types_test.rb
cassandra-0.11.0 test/comparable_types_test.rb
cassandra-0.10.0 test/comparable_types_test.rb
cassandra-0.9.1 test/comparable_types_test.rb
cassandra-0.9.0 test/comparable_types_test.rb
jamesgolick-cassandra-0.8.2 test/comparable_types_test.rb