froydnj/trees — pull request #4 by rpav (2012-05-21 16:12:41+00:00)
Title: Bounds fix

This changes `UPPER-BOUND` and `LOWER-BOUND` to match the documented behavior (`PRED`-or-equal), by combining `TEST` and `PRED` to include or exclude branches appropriately.

Additionally, it fixes an edge case where the root node was not being considered as a potential match.

Included is a test that creates a tree of even numbers, and performs both `BOUND` functions on a random number `X` within range. For an even `X`, both functions should return `X`. For an odd `X`, the functions should return the appropriate next value.

The tests run for predicates `<`, `<=`, `>`, and `>=`, for all tree types. Running the tests on master without the changes will produce errors.