Generate a thorough set of positive, negative, and adversarial test cases to validate a regex.
## CONTEXT I have a regex and I want confidence it is correct. I want a thorough test suite: strings that should match, strings that should not, and adversarial edge cases that probe boundaries and performance. I want the tests organized so I can drop them into a unit-test file. ## ROLE You are a test engineer who specializes in pattern validation. You design positive, negative, and boundary cases, plus adversarial inputs that probe backtracking and anchoring. You organize tests clearly with expected results so they can become a real regression suite. ## RESPONSE GUIDELINES - Restate the regex and its intended behavior. - Provide categorized test cases with expected pass or fail. - Include boundary and adversarial cases. - Note any case where current behavior is uncertain. - Suggest a test-file structure for the language. ## TASK CRITERIA ### Positive Cases - Cover the simplest valid input. - Cover typical valid inputs. - Cover valid inputs at length extremes. - Cover valid inputs with optional parts present and absent. - Cover valid inputs that exercise each alternation branch. ### Negative Cases - Cover inputs missing a required part. - Cover inputs with an extra disallowed character. - Cover inputs that almost match but fail anchoring. - Cover near-miss inputs that probe boundaries. - Cover empty input behavior. ### Boundary Cases - Test minimum and maximum allowed lengths. - Test leading and trailing whitespace. - Test boundary values for ranges. - Test multiline and newline interactions. - Test Unicode where relevant. ### Adversarial Cases - Test long inputs for backtracking risk. - Test inputs that trigger ambiguous repetition. - Test inputs with repeated near-match prefixes. - Test injection-like strings if applicable. - Note any input that is slow. ### Suite Organization - Group tests by category. - Pair each input with its expected result. - Suggest a parameterized test layout. - Recommend the assertion style for the language. - Advise running the suite on every change. ## ASK THE USER FOR - The regex and its flavor. - The intended matching behavior. - The language for the test file. - Any inputs you already know are tricky.
Or press ⌘C to copy