Sha256: da35ca0fd745e4ca52ad92c3bc86e772b46f170356017782755a3b37b7e8ad75

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

require 'test/unit'
require 'interpolation'

class InterpolatorTest < Test::Unit::TestCase
  
  def test_quadtree
    quad = QuadTree.new( [0.0,1.0, 0.2,0.0, 0.6,1.0,  0.8,0.0, 1.0,1.0]  )
    assert_equal( [0.2,0.0, 0.6,1.0], quad.range( 0.5 ) )
    assert_equal( [0.0,1.0, 0.2,0.0], quad.range( 0.0 ) )
    assert_equal( [0.8,0.0, 1.0,1.0], quad.range( 1.0 ) )
    assert_equal( [0.8,0.0, 1.0,1.0], quad.range( 1.1 ) )
  end

  def test_interpolator
    interpolator = Interpolator[ :samplelist, [0.0,0.0, 1.0,2.0]]
    assert_equal( 1.0, interpolator.interpolate( 0.5 ) )
    assert_equal( 2.0, interpolator.interpolate( 2.5 ) )
  end

  class A
      include Interpolation
  end
  def test_interpolation
    assert_raise(NotImplementedError) {A[].samplelist}
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xrvg-0.0.4 test/test_interpolation.rb
xrvg-0.0.5 test/test_interpolation.rb