#!/usr/bin/env bash
set -euo pipefail

# Run Part 2 tests (Decision Table + Cause-Effect) and generate reports into docs/

ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT_DIR"

REPORT_HTML="docs/pytest_report_part2.html"
COV_HTML_DIR="docs/htmlcov_part2"

echo "Running Part 2 tests (decision table + cause-effect for program3/4)..."
pytest -v \
  tests/test_triangle_program3.py \
  tests/test_triangle_program4.py \
  --tb=short -rA --color=yes \
  --html="$REPORT_HTML" --self-contained-html \
  --cov=src --cov-report=html:"$COV_HTML_DIR"

echo "Report: $REPORT_HTML"
echo "Coverage HTML: $COV_HTML_DIR/index.html"
