Sha256: 6497eb38b52ba3546e76d3548d27f6e9b479fc0ba6c4c5a7379b4b135ce56811

Contents?: true

Size: 681 Bytes

Versions: 16

Compression:

Stored size: 681 Bytes

Contents

require 'facets/comparable/cmp.rb'
require 'test/unit'

class TestComparable < Test::Unit::TestCase

  def test_cmp
    assert_equal( -1, 3.cmp(4) )
    assert_equal(  0, 3.cmp(3) )
    assert_equal(  1, 3.cmp(2) )
  end

end

class TestNumericCompare < Test::Unit::TestCase

  def test_cmp
    assert_equal( -1, 3.cmp(4) )
    assert_equal(  0, 3.cmp(3) )
    assert_equal(  1, 3.cmp(2) )
  end

end

class TestStringCompare < Test::Unit::TestCase

  def test_cmp
    assert_equal( 0, "abc".cmp("abc") )
    assert_equal( -1, "abc".cmp("abcd") )
    assert_equal( 1, "abcd".cmp("abc") )
    assert_equal( -1, "abc".cmp("bcd") )
    assert_equal( 1, "bcd".cmp("abc") )
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/comparable/test_cmp.rb
facets-2.8.3 test/core/comparable/test_cmp.rb
facets-2.8.2 test/core/comparable/test_cmp.rb
facets-2.8.1 test/core/comparable/test_cmp.rb
facets-2.8.0 test/core/comparable/test_cmp.rb
facets-2.7.0 test/core/comparable/test_cmp.rb
facets-2.6.0 test/core/comparable/test_cmp.rb
facets-2.4.0 test/comparable/test_cmp.rb
facets-2.4.1 test/comparable/test_cmp.rb
facets-2.4.4 test/core/comparable/test_cmp.rb
facets-2.4.3 test/core/comparable/test_cmp.rb
facets-2.4.2 test/core/comparable/test_cmp.rb
facets-2.5.1 test/core/comparable/test_cmp.rb
facets-2.5.0 test/core/comparable/test_cmp.rb
facets-2.4.5 test/core/comparable/test_cmp.rb
facets-2.5.2 test/core/comparable/test_cmp.rb