fedora-migrator /vendor/gems/facets-2.4.5/test/core/comparable/test_cmp.rb

Language Ruby Lines 36
MD5 Hash 853f6f50c46d90b18f168c1110ca8262 Estimated Cost $562 (why?)
Repository https://bitbucket.org/mediashelf/fedora-migrator View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
Back to Top