Sha256: 388a906d6fe366e97257a79c674196cfe3226c47d2619efa3d6dcdc0c718256b

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe SPCore::Interpolation do
  context '.interpolate_linear' do
    it 'should interpolate floating-point values' do
      x1, y1 = 0.0, 2.0
      x2, y2 = 1.0, 4.0
      x3, y3 = 0.5, 3.0
      result = SPCore::Interpolation.linear x1, y1, x2, y2, x3
      result.should eq(y3)
    end

    it 'should interpolate integer values' do
      x1, y1 = 0, 20
      x2, y2 = 10, 40
      x3, y3 = 5, 30
      result = SPCore::Interpolation.linear x1, y1, x2, y2, x3
      result.should eq(y3)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spcore-0.1.2 spec/lib/interpolation_spec.rb
spcore-0.1.1 spec/lib/interpolation_spec.rb
spcore-0.1.0 spec/lib/interpolation_spec.rb