in reply to Multiple testing methods

Not clear exactly what your requirement is, but it would be something like this:

if (faillengthtest($foo)) { if (failrepeattest($foo)) { #format the page with error msg 1 } else { #format the page with error msg 2 } } else { #format the page normally }

Might be a good idea to wrap your testing in two functions to make the code clearly expressed.

Update:

Actually to exercise all 4 combinations, the code should be (obviously you could tailer some branches, if they don't appear to be a real combination under your requirement):

if (faillengthtest($foo)) { if (failrepeattest($foo)) { #format the page with error msg 1 } else { #format the page with error msg 2 } } else { if (failrepeattest($foo)) { #format the page with error msg 3 } else { #format the page with normal message } }

Replies are listed 'Best First'.
Re^2: Multiple testing methods
by sulfericacid (Deacon) on Sep 26, 2004 at 19:04 UTC
    The problem with this code is one test is nested within the other. This means if the faillength test doesn't fail, there's no possible way for the repeat test to fail either.


    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid