File size: 1,050 Bytes
4c75661 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """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
|