Fix several bugs in svn_rangelist_intersect. Augment its test suite
commitbe39dff52d40986c9cace77778c67645f5b65274
authorglasser <glasser@612f8ebc-c883-4be0-9ee0-a4e9ef946e3a>
Fri, 1 Feb 2008 03:56:09 +0000 (1 03:56 +0000)
committerglasser <glasser@612f8ebc-c883-4be0-9ee0-a4e9ef946e3a>
Fri, 1 Feb 2008 03:56:09 +0000 (1 03:56 +0000)
tree17c054354e675b9b43e5335264da7808e72335be
parentcc0af0dc42fe0d8335896fc78a6fb2ce26f42ae1
Fix several bugs in svn_rangelist_intersect.  Augment its test suite
(and svn_rangelist_remove's) with tests based on randomly generated
data.  Fix test suite to output ranges (in failure messages) the same
way that the real code does (ie, add 1 to 'start', don't reverse the
meaning of '*', and just print one number for single-revision
ranges).

* subversion/libsvn_subr/mergeinfo.c
  (rangelist_intersect_or_remove): Make sure that elt1 is initialized
   each time through the loop.  When intersecting, make sure that all
   generated ranges are actually in both ranges by using MIN/MAX.
   Make sure that extra "whiteboard" elements are only combined into
   *lastrange for 'remove' mode, not 'intersect'.

* subversion/tests/libsvn_subr/mergeinfo-test.c
  (range_to_string): New.
  (verify_ranges_match): Use range_to_string.
  (RANDOM_REV_ARRAY_LENGTH, random_rev_array_seed,
   randomly_fill_rev_array, rev_array_to_rangelist): New helper
   functions.
  (test_rangelist_remove_randomly, test_rangelist_intersect_randomly):
   New tests.
  (test_funcs): Add test_rangelist_remove_randomly and
   test_rangelist_intersect_randomly.  Mark test_rangelist_intersect
   as passing.

git-svn-id: http://svn.collab.net/repos/svn/trunk@29126 612f8ebc-c883-4be0-9ee0-a4e9ef946e3a
subversion/libsvn_subr/mergeinfo.c
subversion/tests/libsvn_subr/mergeinfo-test.c