"""src/vkgs/src/segment_map.hpp (구간 모델 이어 달리기의 선택 로직) 을 g++ 로 컴파일해 시험한다. 창을 띄우지 않는다.""" import os import shutil import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[1] CXX = os.environ.get("CXX") or "g++" @pytest.mark.skipif(shutil.which(CXX) is None, reason="g++ 없음") def test_segment_map(tmp_path): lines = ["# 시험"] for k in range(3): lines.append(f"S {k} {100 * (k + 1)} {50.0 * k} 0 0 /a b/seg{k}/point_cloud.ply") for k in range(3): lines += [f"P {k} {x} 0" for x in range(50 * k, 50 * k + 50)] f = tmp_path / "segments.txt" f.write_text("\n".join(lines) + "\n") exe = tmp_path / "t" subprocess.run([CXX, "-std=c++20", "-O1", "-I", str(ROOT / "src/vkgs/src"), str(ROOT / "tests/cpp/test_segment_map.cpp"), "-o", str(exe)], check=True) r = subprocess.run([str(exe), str(f)], capture_output=True, text=True) assert r.returncode == 0, r.stdout + r.stderr