Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Regex::Reverse tricky test cases

by Roy Johnson (Monsignor)
on May 17, 2005 at 14:11 UTC ( [id://457821]=note: print w/replies, xml ) Need Help??


in reply to Re: Regex::Reverse tricky test cases
in thread Regex::Reverse tricky test cases

That's probably a good source for industrial-sized regexes, but the sticking point is: how do I know that what my program puts out is right? I don't have a lot of confidence in my ability to reverse them by hand, and even if I did, I'd only follow the same steps that my program does.

I guess the best thing to do would be to generate a few strings that the regex will match, then also generate the reverse of the string and match against the reversed regex, then compare the captures.


Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^3: Regex::Reverse tricky test cases
by radiantmatrix (Parson) on May 17, 2005 at 15:06 UTC

    I can't find your module. I can write tests for you, but not without access to your module and its interface.


    The Eightfold Path: 'use warnings;', 'use strict;', 'use diagnostics;', perltidy, CGI or CGI::Simple, try the CPAN first, big modules and small scripts, test first.

      As yet, it's not a module, it's just a program (and it almost certainly will not become a module, as the difficulties I had not recognized initially are substantial). It was not unexpected that I would find, once the real problems with reversal were pointed out, that they were over my head. But I wanted to understand the problem.

      If you are inclined to write tests for this, they would just be pairs: a regex and what it should reverse to.


      Caution: Contents may have been coded under pressure.

        That's not how I was thinking of writing tests. More like I would come up with a series of regexes on a static string, then compare the match with the match created by your 'reverse' application. If they match the same, then your app is working. That would narrow down what kind of regexes your app has issues with -- the way of testing you suggest is less useful, because you have to trust that I'm right. ;-)


        The Eightfold Path: 'use warnings;', 'use strict;', 'use diagnostics;', perltidy, CGI or CGI::Simple, try the CPAN first, big modules and small scripts, test first.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://457821]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-23 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found