/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
- require 'facets/array/pad'
- require 'test/unit'
- class TC_Array_Prime < Test::Unit::TestCase
- def test_pad
- r = [0,1,2,3].pad(7,"x")
- x = [0,1,2,3,"x","x","x"]
- assert_equal(x,r)
- end
- def test_pad!
- a = [0,1,2,3]
- r = a.pad!(6,"y")
- x = [0,1,2,3,"y","y"]
- assert_equal(x,a)
- end
- def test_pad_negative
- r = [0,1,2,3].pad(-7,"n")
- x = ["n","n","n",0,1,2,3]
- assert_equal(x,r)
- end
- def test_pad_negative!
- a = [0,1,2,3]
- r = a.pad!(-6,"q")
- x = ["q","q",0,1,2,3]
- assert_equal(x,a)
- end
- end