On Wed, May 11, 2011 at 10:46:54AM -0500, William Rowe wrote: > On 5/11/2011 9:51 AM, jor...@apache.org wrote: > > Author: jorton > > Date: Wed May 11 14:51:33 2011 > > New Revision: 1101905 > > > > URL: http://svn.apache.org/viewvc?rev=1101905&view=rev > > Log: > > * test/testfnmatch.c: Add a few more apr_fnmatch() tests to > > improve (already good!) coverage a little. > > (test_fnmatch_test): New test. > > Thanks for your work on this, Joe!
'tas but a trifle - thanks to *you* for slogging through this one, it looked like a tough nut to crack. > Note that I've been careful in prior tests to strike both match and > notmatch at the start, middle, end and beyond end of the string tested > (Jeff had tripped over one such edge case), and it's probably worth > repeating that exercise with these regex patterns. Unfortunately I've > been exhausted of cycles to take this any further, so it's great to > see others add on to the cases. OK, I will revisit that if I get a chance. I just wanted to make sure some of the more obscure branches were getting tested; gcov says this with the current code which is pretty good: File 'strings/apr_fnmatch.c' Lines executed:91.48% of 176 Branches executed:95.40% of 261 Taken at least once:81.61% of 261 Calls executed:100.00% of 17 I had one question actually, if you have a spare moment ever, there was a branch I could not work out how to trigger in fnmatch_ch(): if (**pattern == '[') { ++*pattern; ... while (**pattern) { /* ']' is an ordinary character at the start of the range pattern */ if ((**pattern == ']') && (*pattern > mismatch)) { That last expression (*pattern > mismatch) looks like it should always evaluate to true; I could not work out why that test should be necessary. When evaluating that line: a) mismatch always points to the first char in the *pattern on entry to the fn b) *pattern must have been incremented at least once since entry c) therefore, *pattern > mismatch must always be true Regards, Joe