Sha256: 103423477918fad5da51d0f834af85f25c2341bbab68f9e15e6821a49ceade1a

Contents?: true

Size: 706 Bytes

Versions: 13

Compression:

Stored size: 706 Bytes

Contents

require 'test_helper'

class InterpTest < GSL::TestCase

  def test_bsearch
    x_array = GSL::Vector.alloc(0.0, 1.0, 2.0, 3.0, 4.0)

    res = GSL::Interp.bsearch(x_array, 1.5, 0, 4)
    refute res != 1, 'simple bsearch'

    res = x_array.bsearch(4.0, 0, 4)
    refute res != 3, 'upper endpoint bsearch'

    res = GSL::Interp.bsearch(x_array, 0.0, 0, 4)
    refute res != 0, 'lower endpoint bsearch'

    res = GSL::Interp.bsearch(x_array, 2.0, 0, 4)
    refute res != 2, 'degenerate bsearch'

    res = GSL::Interp.bsearch(x_array, 10.0, 0, 4)
    refute res != 3, 'out of bounds bsearch +'

    res = GSL::Interp.bsearch(x_array, -10.0, 0, 4)
    refute res != 0, 'out of bounds bsearch -'
  end

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
gsl-2.1.0.3 test/gsl/interp_test.rb
gsl-2.1.0.2 test/gsl/interp_test.rb
gsl-2.1.0.1 test/gsl/interp_test.rb
gsl-2.1.0 test/gsl/interp_test.rb
gsl-1.16.0.6 test/gsl/interp_test.rb
rb-gsl-1.16.0.5 test/gsl/interp_test.rb
rb-gsl-1.16.0.4 test/gsl/interp_test.rb
rb-gsl-1.16.0.3 test/gsl/interp_test.rb
rb-gsl-1.16.0.3.rc1 test/gsl/interp_test.rb
rb-gsl-1.16.0.2 test/gsl/interp_test.rb
rb-gsl-1.16.0.1 test/gsl/interp_test.rb
rb-gsl-1.16.0 test/gsl/interp_test.rb
rb-gsl-1.15.3.2 test/gsl/interp_test.rb