by tleb_ · 3y ago · 0 comments
assert isSorted(array, start, end) : "The input array for binary search is expected to be sorted";
That said, I think in many cases asserts tend to be fairly self-evident, they typically just list the invariants, e.g. assert start <= end;
assert (end - start) % stepSize == 0;
// some logic
assert pos - start >= 0;
assert pos - end < 0;
assert (pos-start) % stepSize == 0;
return pos;