feat: Demo-Examples (Python/Rust/Go/C) mit Protokoll-Templates und Restore-Skript
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fb4e96919a
commit
64c2b7f0fd
21 changed files with 614 additions and 0 deletions
19
examples/python-calculator/PROTOKOLL.md
Normal file
19
examples/python-calculator/PROTOKOLL.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Demo-Protokoll: python-calculator
|
||||
|
||||
## Lauf 1
|
||||
|
||||
**Datum:**
|
||||
**Befehl:**
|
||||
```
|
||||
/optimize "Ergänze multiply, divide (wirft ZeroDivisionError bei 0) und power.
|
||||
Schreibe pytest-Tests für alle neuen Funktionen." \
|
||||
--test-cmd "pytest test_calculator.py -v"
|
||||
```
|
||||
**Startzeit:**
|
||||
**Endzeit:**
|
||||
**Dauer (min):**
|
||||
**Runden:**
|
||||
**Endergebnis:** PASS / PASS WITH CONCERNS / SHIP / NO-SHIP
|
||||
**Besonderheiten / Beobachtungen:**
|
||||
|
||||
---
|
||||
51
examples/python-calculator/README.md
Normal file
51
examples/python-calculator/README.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Python Calculator
|
||||
|
||||
Einfacher Taschenrechner mit `add()` und `subtract()`.
|
||||
Multiply, divide, power und Fehlerbehandlung fehlen noch.
|
||||
|
||||
## Aktueller Stand
|
||||
|
||||
```
|
||||
calculator.py add(), subtract()
|
||||
test_calculator.py 5 pytest-Tests (alle grün)
|
||||
```
|
||||
|
||||
## Demo: `/optimize` mit Test-Integration
|
||||
|
||||
```
|
||||
/optimize "Ergänze multiply, divide (wirft ZeroDivisionError bei 0) und power.
|
||||
Schreibe pytest-Tests für alle neuen Funktionen." \
|
||||
--test-cmd "pytest test_calculator.py -v"
|
||||
```
|
||||
|
||||
**Was pi-coder hier zeigt:**
|
||||
- Coder implementiert, committet
|
||||
- Extension führt `pytest` aus und übergibt das Ergebnis an den Judge
|
||||
- Judge bewertet Korrektheit anhand der Testergebnisse
|
||||
- Bei FAIL: Coder fixt, nächste Runde
|
||||
|
||||
## Voraussetzungen
|
||||
|
||||
```bash
|
||||
pip install pytest
|
||||
```
|
||||
|
||||
## Weitere Demo-Befehle nach dem `/optimize`-Lauf
|
||||
|
||||
```
|
||||
/quick_check "Sind alle Randfälle (negative Zahlen, floats) korrekt behandelt?"
|
||||
```
|
||||
Schnelle Einzel-Beurteilung ohne neuen Fix-Loop.
|
||||
|
||||
```
|
||||
/update_doku
|
||||
```
|
||||
Lässt den Coder Code-Kommentare ergänzen, README aktualisieren und eine
|
||||
Bedienungsanleitung erzeugen.
|
||||
|
||||
## Manueller Test
|
||||
|
||||
```bash
|
||||
pytest test_calculator.py -v
|
||||
python calculator.py
|
||||
```
|
||||
11
examples/python-calculator/calculator.py
Normal file
11
examples/python-calculator/calculator.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
def add(a, b):
|
||||
return a + b
|
||||
|
||||
|
||||
def subtract(a, b):
|
||||
return a - b
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(add(3, 4)) # 7
|
||||
print(subtract(10, 3)) # 7
|
||||
18
examples/python-calculator/test_calculator.py
Normal file
18
examples/python-calculator/test_calculator.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import pytest
|
||||
from calculator import add, subtract
|
||||
|
||||
|
||||
def test_add_positive():
|
||||
assert add(2, 3) == 5
|
||||
|
||||
def test_add_negative():
|
||||
assert add(-1, 1) == 0
|
||||
|
||||
def test_add_zero():
|
||||
assert add(0, 0) == 0
|
||||
|
||||
def test_subtract_basic():
|
||||
assert subtract(5, 3) == 2
|
||||
|
||||
def test_subtract_negative_result():
|
||||
assert subtract(3, 5) == -2
|
||||
Loading…
Add table
Add a link
Reference in a new issue