AgentSkillsCN

Boj Test

Boj Test

SKILL.md

boj-test

Test Baekjoon solution code with example cases and edge cases.

Triggers

  • /boj-test
  • "테스트 케이스 실행"
  • "run test cases"
  • "백준 테스트"

Workflow

Step 1: Find Recent Python Files

Search for recently modified Python files in the repository:

  • Look in Greedy_Algorithm/, Dynamic_Programming/, problems/, and root directory
  • Filter for bj_*.py or solution.py patterns
  • Sort by modification time (most recent first)

Use Glob to find files:

code
**/*.py

Step 2: Select File to Test

Use AskUserQuestion to confirm which file to test:

code
question: "Which file do you want to test?"
header: "Select File"
options:
  - label: "[most recent file]"
    description: "Modified: [timestamp]"
  - label: "[second recent file]"
    description: "Modified: [timestamp]"
  - label: "[third recent file]"
    description: "Modified: [timestamp]"

Step 3: Extract Problem Number

From the selected file:

  • bj_1234.py → problem number: 1234
  • problems/1234/solution.py → problem number: 1234

Step 4: Load Test Cases

Check if problems/[number]/description.md exists:

  • If yes: Parse example inputs/outputs from the file
  • If no: Ask user to provide test cases or run /boj-fetch first

Step 5: Generate Additional Test Cases

Based on problem analysis, generate edge cases:

  • Minimum input values
  • Maximum input values (within reasonable limits)
  • Empty or single-element inputs
  • Boundary conditions

Step 6: Run Tests

For each test case, execute the Python code:

bash
echo "[input]" | python3 [file_path]

Compare output with expected output:

  • Trim whitespace for comparison
  • Handle floating point precision if needed

Step 7: Report Results

Output test results in this format:

code
## Test Results for bj_1234.py

### Example Cases
| # | Status | Input | Expected | Actual |
|---|--------|-------|----------|--------|
| 1 | PASS   | ...   | ...      | ...    |
| 2 | FAIL   | ...   | ...      | ...    |

### Edge Cases
| # | Status | Input | Output |
|---|--------|-------|--------|
| 1 | PASS   | ...   | ...    |

### Summary
- Total: X tests
- Passed: Y
- Failed: Z

If any test fails:

  • Show the diff between expected and actual
  • Suggest possible issues

Notes

  • Use timeout for execution (max 5 seconds per test)
  • Capture stderr for runtime errors
  • Handle cases where code expects multiple lines of input
  • Preserve exact output formatting for comparison