@Test
public void testFuzzySearch() {

	final float[] base = new float[] { 1, 4, 4, 5, 7.3f, 8, 10, 23.4f, 23.4f, 34 };
	final float[] nullBase = null;
	final float[] emptyBase = new float[0];

	// empty arrays
	assertEquals(-1, ArrayUtils.fuzzySearch(nullBase, 5, true));
	assertEquals(-1, ArrayUtils.fuzzySearch(emptyBase, 5, false));

	// value outside the array
	assertEquals(0, ArrayUtils.fuzzySearch(base, 0.1f, true));
	assertEquals(-1, ArrayUtils.fuzzySearch(base, 0.1f, false));
	assertEquals(-1, ArrayUtils.fuzzySearch(base, 101, true));
	assertEquals(base.length - 1, ArrayUtils.fuzzySearch(base, 101, false));

	// normal case
	assertEquals(3, ArrayUtils.fuzzySearch(base, 5, true));

	// toTheRight in case of exact match
	assertEquals(1, ArrayUtils.fuzzySearch(base, 4, true));
	assertEquals(2, ArrayUtils.fuzzySearch(base, 4, false));

	// fuzzy match
	assertEquals(4, ArrayUtils.fuzzySearch(base, 7, true));
	assertEquals(3, ArrayUtils.fuzzySearch(base, 7, false));
}