"""Emit the GEMM MAC-utilization bar charts.

A measured chart (load_ref) plus the theoretical-vs-measured overlay (load_ref).
Reads docs/diagrams/gemm_sweep.json and writes gemm_mac_utilization*.png into
docs/diagrams/gemm_plots/.
"""
from __future__ import annotations

from pathlib import Path

import pytest

from tests.gemm._gemm_plot_helpers import (
    GEMM_SWEEP_JSON,
    emit_mac_utilization_measured,
    emit_mac_utilization_theoretical_vs_measured,
)


@pytest.mark.skipif(
    not GEMM_SWEEP_JSON.exists(),
    reason="gemm_sweep.json absent; run scripts/gemm_sweep.py first",
)
def test_plot_gemm_mac_utilization_measured():
    out = emit_mac_utilization_measured()
    assert out is not None and Path(out).exists()


@pytest.mark.skipif(
    not GEMM_SWEEP_JSON.exists(),
    reason="gemm_sweep.json absent; run scripts/gemm_sweep.py first",
)
def test_plot_gemm_mac_utilization_theoretical_vs_measured():
    out = emit_mac_utilization_theoretical_vs_measured()
    assert out is not None and Path(out).exists()
