Add unittest suite for Sitzplatzverteilung with three scenarios

Covers three concrete seating layouts to exercise the GA's group
placement and splitting logic:
- three tables chained pairwise (2 seats each), three couples ->
  no group gets split, optimal score of 0.
- four tables in a line (2 seats each), two groups of four -> each
  group ends up split across one contiguous table pair (T1+T2 or
  T3+T4), never mixed across the middle seam.
- six tables in a circle (2 seats each), four groups of three ->
  each group is split exactly once (2+1), since no table has three
  seats; with the fixed seed the split pairs are also true circle
  neighbors.

Also documents how to run the suite in README.md, including the
PYTHONPATH workaround needed when a stray global env var shadows
the stdlib "tests" package name with an unrelated project's tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-07-09 12:42:45 +02:00
parent 405319b075
commit 9a52fe5550
2 changed files with 179 additions and 0 deletions
+11
View File
@@ -16,6 +16,7 @@ platz/
├── bin/ # environment + launcher scripts (.bat + .sh pairs)
├── cfg/ # GA cycle definition and penalty scheme
├── libs/ # the two Python modules (ga.py, Strukturdaten.py, platz.py)
├── tests/ # unittest suite for Strukturdaten.py
└── work/ # per-run input (table layout, guest list) and output
├── test1/
└── test2/
@@ -26,6 +27,16 @@ platz/
- `libs/Strukturdaten.py` — domain model for the seating problem (`Person`, `Gruppe`,
`Tisch`, `Strafliste`, `Sitzplatzverteilung`, `XMLConfig`).
## Running the tests
```bash
python -m unittest discover -s tests -p "test_*.py" -v
```
If a stray global `PYTHONPATH` entry shadows the standard-library `tests` package name
(unrelated to this project), clear it for the command, e.g. `PYTHONPATH= python -m
unittest discover -s tests -p "test_*.py" -v`.
## Setup
1. Install a Python interpreter (`py` on Windows / `python3` on Linux/macOS must be on