Skip to content
The Latent Daily
The Latent Daily

Sections

News & Industry
Knowledge & Learning
Research & Science
Tools, Software & Models
Developers & Builders
Hardware & Infrastructure
Society, Policy & Ethics
AI in Industries
People & Community
Special Formats

Tag

#Testing

Testing on The Latent Daily: 2 stories and 2 prompts. Latest: How to build an evaluation set for an LLM application.

4 items

Prompts tagged #Testing

Codingintermediate

Regex builder with matching and non-matching test cases

You are an expert in regular expressions. Write a regex for the following task. Regex engine: [e.g. "Python re", "JavaScript", "PCRE", "Java", ".NET", "grep -E", "PostgreSQL"] Task: [WHAT TO MATCH, e.g. "UK postcodes", "ISO 8601 dates", "order IDs like ORD-2026-000123"] Usage: [e.g. "validate a whole form field", "find all occurrences in log lines", "extract the number as a capture group"] Examples that MUST match: [LIST 3-10 EXAMPLES] Examples that must NOT match: [LIST 3-10 EXAMPLES] Please: 1. Restate the rules you will implement, including edge cases I may not have thought of (case, whitespace, leading zeros, Unicode). 2. Give the regex, and a verbose/commented version if the engine supports it. 3. Explain each part token by token. 4. Provide a test table with at least 8 matching and 8 non-matching strings, including tricky ones, and the expected result for each. 5. Provide a short test snippet in [LANGUAGE] that runs every case and prints any failure. 6. Mention performance risks (catastrophic backtracking) and any case a regex cannot reliably handle.

Works with: ChatGPT, Claude, Gemini, Any LLM

Codingintermediate

Unit test generator with edge cases

You are a test engineer who writes small, readable, deterministic unit tests. Language and test framework: [e.g. "Python 3.12 with pytest", "TypeScript with Vitest", "Java 21 with JUnit 5"] What the code should do (the specification): [DESCRIBE INTENDED BEHAVIOUR, INCLUDING ERROR CASES] Dependencies to mock, if any: [e.g. "the database client", "the HTTP call to the payment API", "the current time"] Code under test: ``` [PASTE FUNCTION OR CLASS] ``` Steps: 1. List the behaviours to test as a checklist, grouped into: normal cases, boundary and edge cases (empty, zero, negative, very large, unicode, None/null), invalid input and errors. 2. Point out any behaviour where the code and the specification disagree, or where the specification is silent. Do not "fix" the code; list these as questions. 3. Write the tests: - one behaviour per test, with a descriptive name (e.g. test_returns_zero_for_empty_cart) - Arrange / Act / Assert structure - use parameterized tests where several inputs check the same rule - no network, no real clock, no random values without a fixed seed 4. Say which tests you expect to FAIL with the current code and why. Use only the standard features of [FRAMEWORK] and any libraries already imported in the code.

Works with: ChatGPT, Claude, Gemini, GitHub Copilot Chat