| Store | Cart

regular expression

From: Peter Hansen <pet...@engcorp.com>
Sat, 26 Mar 2005 06:53:06 -0500
Bengt Richter wrote:
> On Fri, 25 Mar 2005 23:54:32 -0500, Peter Hansen <peter at engcorp.com> wrote:>>Suggestion: whip up a variety of automated test cases and>>make sure you run them all whenever you make changes to>>this code...> > Goes to show you ;-/ Do we need more tests than these?
[snip loads of tests]

Hmm... if I were doing this for real, not only would the
tests actually *tell* me when there was a failure, but
I would also throw in a few more cases involving larger
strings that more closely represent the expected real
inputs (i.e. using some numbers like 3.1415 and using
some strings that have the periods as punctuation such
as in the OP's original first "test case").  That way
if, during maintenance, somebody changes the algorithm
significantly, I'll be confident that it still covers
the broader set of cases, as well as the (exhaustive?)
set you've defined, which appear at first glance to
cover all the possible combinations of x and 3 and .
that might happen...

I'd also probably be generating most of the existing
test cases automatically, just to be sure I've got
100% coverage.  Are you sure you didn't leave out one?
And what about, say, ".." or ".x3."?  :-)

-Peter

Recent Messages in this Thread
aaron Mar 26, 2005 02:07 am
Bengt Richter Mar 26, 2005 04:30 am
Peter Hansen Mar 26, 2005 04:54 am
Bengt Richter Mar 26, 2005 07:41 am
Peter Hansen Mar 26, 2005 11:53 am
Paul McGuire Mar 27, 2005 07:05 am
Messages in this thread