PageRenderTime 35ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 23 lines | 16 code | 6 blank | 1 comment | 0 complexity | 3ce46ce1272b9078c9029edff6c6bc16 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/rotate'
  2. require 'test/unit'
  3. class TC_Array_Rotate < Test::Unit::TestCase
  4. # rotate
  5. def test_rotate
  6. a = [1,2,3]
  7. assert_equal( [3,1,2], a.rotate, 'clockwise' )
  8. assert_equal( [2,3,1], a.rotate(-1), 'counter-clockwise' )
  9. end
  10. def test_rotate!
  11. a = [1,2,3]
  12. a.rotate!
  13. assert_equal( [3,1,2], a, 'clockwise' )
  14. a.rotate!(-1)
  15. assert_equal( [1,2,3], a, 'counter-clockwise' )
  16. end
  17. end