Here is what you are missing.

In the example that I provided, there is a general case matching algorithm and a special case matching algorithm. To get correct behaviour for all kinds of regular expressions, you sometimes need to use the general algorithm. To get the specified speed for some common regular expressions, you sometimes else need to use the special case matching algorithm.

The public specification does not say where the boundary between the special case and the general case is. It is a basic fact of life that there is a good chance of finding bugs around that boundary.

What I am saying is that you'll find corner cases along that boundary which are nowhere visible or obvious in the specification, and it is a very good idea to have white-box tests for those corner cases.

In pseudo-code, your implementation will contains something that looks like this:

if (some conditions here) { use special case with performance guarantees } else { use general case that may be slow }
You need white-box testing to be sure that you're testing that all regex features which can show up under both implementations are tested under them. If you just use black-box testing, then your tests that the construct x{3,5} works properly may only test one implementation and your tests won't notice if it fails in the other. This is exactly what happened in Perl 5.6.0.

I really hope that this explanation is enough for you to understand the issue. If it is not then I really don't know how I can say this more clearly.


In reply to Re^12: Corner cases are not always "code smell" by tilly
in thread Neither system testing nor user acceptance testing is the repeat of unit testing (OT) by pg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.