一键导入
test-with-examples
For example-driven development: test cases as specifications, input/output pairs, documentation through examples.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
For example-driven development: test cases as specifications, input/output pairs, documentation through examples.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Conducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.
| name | test-with-examples |
| description | For example-driven development: test cases as specifications, input/output pairs, documentation through examples. |
Write tests as lists of (input, expected_output) pairs.
# Test cases as data
tests = [
(input1, expected1),
(input2, expected2),
(input3, expected3),
]
def run_tests(func, tests):
"""Run function on test cases."""
for inp, expected in tests:
result = func(inp)
assert result == expected, f"{func.__name__}({inp}) = {result}, expected {expected}"
print(f"All {len(tests)} tests pass.")
# lispytest.py - comprehensive test examples
lis_tests = [
("(quote (testing 1 (2.0) -3.14e159))", ['testing', 1, [2.0], -3.14e159]),
("(+ 2 2)", 4),
("(+ (* 2 100) (* 1 10))", 210),
("(if (> 6 5) (+ 1 1) (+ 2 2))", 2),
("(if (< 6 5) (+ 1 1) (+ 2 2))", 4),
("(define x 3)", None),
("x", 3),
("(+ x x)", 6),
("((lambda (x) (+ x x)) 5)", 10),
("(define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1))))))", None),
("(fact 10)", 3628800),
("(fact 50)", 30414093201713378043612608166064768844377641568960512000000000000),
]
# DocstringFixpoint.ipynb - rainfall tests
def test_rainfall():
assert 0/2 == rainfall([0, 0]), "no rain"
assert 5/1 == rainfall([5]), "one day"
assert 6/3 == rainfall([1, 2, 3]), "mean of several days"
assert 6/4 == rainfall([0, 1, 2, 3]), "non-integer mean"
assert 9/3 == rainfall([1, 2, -9, -100, 6]), "negative values ignored"
assert 7/5 == rainfall([1, 0, 2, 0, 4]), "zeros not ignored"
assert 8/3 == rainfall([1, 2, 5, -999, 404]), "values after -999 ignored"
return True
# Cryptarithmetic.ipynb - solver test examples
for solver in (solve, faster_solve):
assert "1 + 2 = 3" in set(solver("A + B = C"))
assert not set(solver("A + B = CDE")) # No solution
assert set(solver("A * B = CA")) == {
'5 * 3 = 15', '5 * 7 = 35', '4 * 6 = 24',
'8 * 6 = 48', '2 * 6 = 12', '5 * 9 = 45'
}
assert result == expected, message