"""ビルド用パス・必須ファイルの存在を確認する。"""
from pathlib import Path

import pytest

ROOT = Path(__file__).resolve().parent.parent
BUILD_DIR = ROOT / "build"
TARGET_DIR = ROOT / "target"


def test_build_sentences_txt_exists():
    """build/sentences.txt がリポジトリに同梱されている。"""
    assert BUILD_DIR.exists(), "build/ が存在すること"
    assert (BUILD_DIR / "sentences.txt").exists(), "build/sentences.txt が存在すること"


def test_export_onnx_has_build_and_target():
    """export_onnx が参照する BUILD_DIR / TARGET_DIR が定義されている。"""
    import sys
    sys.path.insert(0, str(ROOT))
    from export_onnx import BUILD_DIR as E_BUILD, TARGET_DIR as E_TARGET  # noqa: E402
    assert E_BUILD == BUILD_DIR
    assert E_TARGET == TARGET_DIR


def test_quantize_uses_build_and_target():
    """quantize が build/model_fp32.onnx を読み target に書く。"""
    import sys
    sys.path.insert(0, str(ROOT))
    from quantize import BUILD_DIR as Q_BUILD, TARGET_DIR as Q_TARGET  # noqa: E402
    from quantize import MODEL_FP32, MODEL_QUANT  # noqa: E402
    assert Q_BUILD == BUILD_DIR
    assert Q_TARGET == TARGET_DIR
    assert MODEL_FP32 == BUILD_DIR / "model_fp32.onnx"
    assert MODEL_QUANT == TARGET_DIR / "model_quantized.onnx"
