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