Sha256: 2188fffccf84cacb22a66e4f33e9cbdcce1d58095cd555be50809317a87ca17d

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

require 'test/unit'

require 'rectify'

class TC_rectify < Test::Unit::TestCase

  def test_wrap_rectify
    assert(0.5.wrap_rectify(1) == 0.5)
    assert(5.5.wrap_rectify(1) =~ 0.5)
    assert(-7.25.wrap_rectify(2) =~ 0.75)
    assert(-7.25.wrap_rectify(2,0.5) =~ 1.75)
    assert(-7.25.wrap_rectify(0.5,2) =~ 1.75)
    assert(2.wrap_rectify(0.5,2) == 0.5)
    assert(0.5.wrap_rectify(0.5,2) == 0.5)
    assert(0.5.wrap_rectify(0,0) == 0)
  end
  
  def test_cut_rectify
    assert(0.5.cut_rectify(1) == 0.5)
    assert(5.5.cut_rectify(1) == 1)
    assert(-7.25.cut_rectify(2) == 0)
    assert(-7.25.cut_rectify(2,0.5) == 0.5)
    assert(-7.25.cut_rectify(0.5,2) == 0.5)
    assert(2.cut_rectify(0.5,2) == 2)
    assert(0.5.cut_rectify(0.5,2) == 0.5)
    assert(0.5.cut_rectify(0,0) == 0)
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eymiha_math-0.1.0 test/tc_rectify.rb