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
sessionm-cassandra-1.1.2 test/comparable_types_test.rb
sessionm-cassandra-1.1.1 test/comparable_types_test.rb
sessionm-cassandra-1.1.0 test/comparable_types_test.rb
cassandra-0.23.0 test/comparable_types_test.rb
cassandra-0.22.0 test/comparable_types_test.rb
cassandra-mavericks-0.21.1 test/comparable_types_test.rb
cassandra-0.21.0 test/comparable_types_test.rb
cassandra-0.20.0 test/comparable_types_test.rb
cassandra-0.19.0 test/comparable_types_test.rb
sessionm-cassandra-1.0.2 test/comparable_types_test.rb
cassandra-0.18.0 test/comparable_types_test.rb
sessionm-cassandra-1.0.1 test/comparable_types_test.rb
sessionm-cassandra-1.0.0 test/comparable_types_test.rb
cassandra-0.17.0 test/comparable_types_test.rb
cassandra-0.16.0 test/comparable_types_test.rb
cassandra-0.15.0 test/comparable_types_test.rb
cassandra-0.14.0 test/comparable_types_test.rb
cassandra-0.13.0 test/comparable_types_test.rb
hallelujah-cassandra-0.12.3 test/comparable_types_test.rb
mcmire-cassandra-0.12.3 test/comparable_types_test.rb