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