vkgs-sim / tests /test_segment_map_cpp.py
kimjunhan's picture
Add files using upload-large-folder tool
4c75661 verified
Raw History Blame Contribute Delete
1.05 kB
"""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