tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
tests/general/array_binsearch.m:
Don't build up the arrays to test using random numbers, since these
produce different results on 32 and 64 bit systems. Instead, just
use manifest constant terms that happen to be identical to what
the random approach generated on 64 bit systems.
library/array.m:
When doing a binary search using a user-supplied comparison function,
do not use the builtin term comparison operation to compare elements.
Use separate loops for binary_search and approx_binary_search, since
using the loop for approx_binary_search in the implementation of
binary_search executes some unnecessary extra tests.
Improve the documentation of both binary_search and approx_binary_search.
tests/general/array_binsearch.{m,exp}:
Rewrite this test case to make it much tougher, testing the operation
of binary_search and approx_binary_search with both the builtin and
user-supplied comparison operations, and in the presence of repeated
elements, and with automatic verification of the results.
Estimated hours taken: 2
Branches: main
Add approximate as well as exact binary search to array.m. An approximate
search looks for the index of the largest element in the array that is
not greater than the value for which we are searching. This is useful for,
say, finding which line number corresponds to a particular offset into a file.
NEWS:
Mention the new additions.
library/array.m:
Added approx_binary_search and binary_search predicates.
tests/general/Mmakefile:
tests/general/array_binsearch.m:
tests/general/array_binsearch.exp:
Test case.