PageRenderTime 22ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/array/pad'
  2. require 'test/unit'
  3. class TC_Array_Prime < Test::Unit::TestCase
  4. def test_pad
  5. r = [0,1,2,3].pad(7,"x")
  6. x = [0,1,2,3,"x","x","x"]
  7. assert_equal(x,r)
  8. end
  9. def test_pad!
  10. a = [0,1,2,3]
  11. r = a.pad!(6,"y")
  12. x = [0,1,2,3,"y","y"]
  13. assert_equal(x,a)
  14. end
  15. def test_pad_negative
  16. r = [0,1,2,3].pad(-7,"n")
  17. x = ["n","n","n",0,1,2,3]
  18. assert_equal(x,r)
  19. end
  20. def test_pad_negative!
  21. a = [0,1,2,3]
  22. r = a.pad!(-6,"q")
  23. x = ["q","q",0,1,2,3]
  24. assert_equal(x,a)
  25. end
  26. end