Cleanup length checks.
Consolidate sortedIndex method tests and add one for `array` of `undefined`.