unit-test-edge-cases v1.0 — 380 edge case tests across 6 languages

#1
by SalutefaceAAC - opened

🧪 unit-test-edge-cases v1.0 — Now Live!

Hi HF community!

I just published unit-test-edge-cases — a synthetic dataset of 380 curated (function, edge-case, unit-test) triples across 6 programming languages.

What's in it?

Each example is a complete, runnable unit test targeting a specific edge case in a well-known function pattern. Coverage spans:

  • Languages: Python (pytest), JavaScript (jest), TypeScript (jest), Go (testing), Java (JUnit 4), Rust (rust-test)
  • Functions tested: divide, factorial, reverse_string, find_max, binary_search, clamp, is_prime, Stack, merge_sorted, levenshtein, memoize, debounce, throttle, and more
  • Edge case types: empty inputs, zero/null handling, negative values, boundary values, unicode, type coercion, overflow, error conditions

Difficulty breakdown

Difficulty Count
easy 153
medium 207
hard 20

Intended uses

  • Fine-tuning code models to write more thorough tests
  • Benchmarking test generation quality
  • Teaching edge-case thinking

Schema

{
  "id": "...",
  "language": "python",
  "function_name": "factorial",
  "function_code": "...",
  "edge_case_type": "negative_input",
  "edge_case_description": "negative input raises ValueError",
  "test_framework": "pytest",
  "unit_test": "import pytest\n\ndef test_factorial_negative():\n    with pytest.raises(ValueError):\n        factorial(-1)",
  "difficulty": "medium"
}

Feedback and PRs welcome — especially for additional languages or edge case patterns!

Sign up or log in to comment