PageRenderTime 111ms CodeModel.GetById 40ms app.highlight 8ms RepoModel.GetById 51ms app.codeStats 0ms

/vendor/gems/facets-2.4.5/test/core/array/test_pad.rb

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 33 lines | 26 code | 7 blank | 0 comment | 0 complexity | e92ccf5cfb5b619c1277086e145d2058 MD5 | raw file
 1require 'facets/array/pad'
 2require 'test/unit'
 3
 4class TC_Array_Prime < Test::Unit::TestCase
 5
 6  def test_pad
 7    r = [0,1,2,3].pad(7,"x")
 8    x = [0,1,2,3,"x","x","x"]
 9    assert_equal(x,r)
10  end
11
12  def test_pad!
13    a = [0,1,2,3]
14    r = a.pad!(6,"y")
15    x = [0,1,2,3,"y","y"]
16    assert_equal(x,a)
17  end
18
19  def test_pad_negative
20    r = [0,1,2,3].pad(-7,"n")
21    x = ["n","n","n",0,1,2,3]
22    assert_equal(x,r)
23  end
24
25  def test_pad_negative!
26    a = [0,1,2,3]
27    r = a.pad!(-6,"q")
28    x = ["q","q",0,1,2,3]
29    assert_equal(x,a)
30  end
31
32end
33