test(B05): 사용자가 놓은 구조물 119.8 저장 · 다시 읽기 · 다시 열기 표시 그대로 확인
PLAN 19장 sub6 ② — 브레인 판정(다): 횡단 측점 · 파일 이름의 정수 m 격자 붙이기는 그대로 두고 ①(옵션 · 메모만 고칠 때 측점 그대로)로 마감. 구조물 정본 측점이 소수 그대로 남는지만 시험으로 굳힘. - 서버(임시 storage): manual 구조물 119.8 을 save_structures → load_structures 119.8 · resolve_extra_stations 119.8 · generate_sections 횡단 측점은 120(cross_00120m 한 장) · 그 뒤 다시 읽어도 정본 119.8 · 메모 그대로 - 화면(측점 칸): 119.8 을 실으면 5 + 19.8 로 보이고 칸을 안 고치면 119.8 로 읽힘 공유 storage 배정 프로젝트는 이번에 쓰지 않음. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVM3xZ1aUPcUTuW2WZSnwg
This commit is contained in:
@@ -72,6 +72,10 @@ out.shown = [fields.station.value, fields.remainder.value];
|
||||
out.untouched = fields.read(INTERVAL, true);
|
||||
fields.write(123.3721, INTERVAL);
|
||||
out.untouchedRaw = fields.read(INTERVAL, true);
|
||||
// 사용자가 놓은 119.8 — 다시 열면 5 + 19.8 로 보이고 그대로 읽힘
|
||||
fields.write(119.8, INTERVAL);
|
||||
out.r119 = [fields.station.value, fields.remainder.value, fields.read(INTERVAL, true)];
|
||||
fields.write(123.3721, INTERVAL);
|
||||
// 사용자가 잔여를 고치면 친 값으로
|
||||
fields.remainder.value = "5.2";
|
||||
fields.remainder.fire("change");
|
||||
|
||||
@@ -34,6 +34,7 @@ def test_칸을_안_고치면_실어_둔_측점_그대로(results):
|
||||
assert results["untouched"] == 123.37
|
||||
assert results["untouchedRaw"] == 123.3721
|
||||
assert results["retypedSame"] == 123.37
|
||||
assert results["r119"] == ["5", "19.8", 119.8]
|
||||
|
||||
|
||||
def test_칸을_고치면_친_값(results):
|
||||
@@ -49,3 +50,54 @@ def test_계획고_편집은_가까운_새_측점으로_옮김(results):
|
||||
}
|
||||
# 옮길 곳이 없으면 종전대로 지움
|
||||
assert "200.000" not in results["deleted"]["station_offsets"]
|
||||
|
||||
|
||||
# ── 서버 — 사용자가 놓은 구조물 측점은 소수 그대로(격자 붙이기는 횡단 측점에만) ─────────
|
||||
# 브레인 판정(다): 횡단 측점 · 파일 이름의 정수 m 격자 붙이기는 그대로 두고, 구조물 정본 측점만
|
||||
# 사용자가 놓은 소수 그대로 저장 · 다시 읽기. 임시 storage 에서만 씀(공유 storage 안 건드림).
|
||||
|
||||
|
||||
def _flat_sampler():
|
||||
import numpy as np
|
||||
|
||||
class _Flat:
|
||||
def sample_xy(self, xy):
|
||||
count = len(np.asarray(xy, dtype=np.float64))
|
||||
return np.full(count, 100.0), np.ones(count, dtype=bool)
|
||||
|
||||
return _Flat()
|
||||
|
||||
|
||||
def test_사용자_구조물_119_8_저장_다시_읽기_그대로(tmp_path):
|
||||
from B05_Profile.B05_Profile_Engine_Sections import cross_filename, resolve_extra_stations
|
||||
from B05_Profile.B05_Profile_Engine_Sections_Core import (
|
||||
SectionGenerationOptions,
|
||||
generate_sections,
|
||||
)
|
||||
from B05_Profile.B05_Profile_Structures_Repository import load_structures, save_structures
|
||||
from B05_Profile.B05_Profile_Structures_Schema import StructureInstance
|
||||
|
||||
item = StructureInstance(
|
||||
type_id="cross_drain_exposed",
|
||||
placement="point",
|
||||
chainage_m=119.8,
|
||||
memo="메모만",
|
||||
placement_source="manual",
|
||||
)
|
||||
save_structures(str(tmp_path), [item], base_revision=0)
|
||||
_, loaded = load_structures(str(tmp_path))
|
||||
assert [s.chainage_m for s in loaded] == [119.8]
|
||||
|
||||
extras = resolve_extra_stations(tmp_path, [])
|
||||
assert [chainage for chainage, _ in extras] == [119.8]
|
||||
sections = generate_sections(
|
||||
[[0.0, 0.0, 100.0], [300.0, 0.0, 100.0]],
|
||||
_flat_sampler(),
|
||||
SectionGenerationOptions(extra_stations=extras),
|
||||
)
|
||||
chainages = [round(s["chainage_m"], 3) for s in sections["longitudinal"]["stations"]]
|
||||
# 횡단 측점은 격자 120 으로 붙음(파일 이름 cross_00120m 한 장) — 정본 측점은 119.8 그대로
|
||||
assert 120.0 in chainages and 119.8 not in chainages
|
||||
assert cross_filename(119.8) == cross_filename(120.0)
|
||||
_, again = load_structures(str(tmp_path))
|
||||
assert [s.chainage_m for s in again] == [119.8] and again[0].memo == "메모만"
|
||||
|
||||
Reference in New Issue
Block a user