fix(est): parse marine quantity formulas
This commit is contained in:
@@ -244,6 +244,80 @@ def test_fullwidth_unit_slash_and_ground_level_annotations():
|
||||
assert result["rows"][4]["TC"] == 35.32
|
||||
|
||||
|
||||
def test_marine_units_and_bullet_are_treated_as_labels():
|
||||
result = run(
|
||||
"math",
|
||||
r"""EstText.calculate([
|
||||
{Index:1,Code:'marine'},
|
||||
{LineData:' q = 2인 ÷12구멍 = \x120.17\x12 인/구멍'},
|
||||
{LineData:' ⊙ 480분 ÷ 88.42 = \x125.43\x12 본/일'},
|
||||
{LineData:' 노무비 : \x03156,379\x03 ÷ \x11122.66\x11 × 1척 = \x121,274.8\x12', SCheck:-1},
|
||||
{LineData:' ◎ 목재길이 L = 5.2m/EA × 3열 × 2단 × 3구역 = \x1293.6\x12 m'}
|
||||
])""",
|
||||
)
|
||||
assert result["errors"] == []
|
||||
assert [row["TC"] for row in result["rows"][1:]] == [0.17, 5.43, 1274.8, 93.6]
|
||||
|
||||
|
||||
def test_arrow_to_sketch_is_not_a_fraction():
|
||||
result = run(
|
||||
"math",
|
||||
r"""EstText.calculate([
|
||||
{Index:1,Code:'sketch'},
|
||||
{LineData:' L = 5.2m ⇒ ───────'},
|
||||
{LineData:' Q = L × 2 = \x1210.4\x12'}
|
||||
])""",
|
||||
)
|
||||
assert result["errors"] == []
|
||||
assert result["rows"][2]["TC"] == 10.4
|
||||
|
||||
|
||||
def test_greek_variables_and_implicit_multiplication_in_marine_formula():
|
||||
result = run(
|
||||
"math",
|
||||
r"""EstText.calculate([
|
||||
{Index:1,Code:'greek'},
|
||||
{LineData:' α = 1.0'},
|
||||
{LineData:' β = 0.6'},
|
||||
{LineData:' ι = 14.0 N = 7'},
|
||||
{LineData:' Tb = 0.08×α×β×ι (N + 2)'},
|
||||
{LineData:' Tc = Tb × 2 = \x1212.10\x12'}
|
||||
])""",
|
||||
)
|
||||
assert result["errors"] == []
|
||||
assert result["rows"][5]["TC"] == 12.1
|
||||
|
||||
|
||||
def test_parenthesized_variable_label_assigns_explicit_value():
|
||||
result = run(
|
||||
"math",
|
||||
r"""EstText.calculate([
|
||||
{Index:1,Code:'label'},
|
||||
{LineData:' 기타시간 (Te) : 10분'},
|
||||
{LineData:' Tc = Te × 2 = \x1220\x12'}
|
||||
])""",
|
||||
)
|
||||
assert result["errors"] == []
|
||||
assert result["rows"][2]["TC"] == 20
|
||||
|
||||
|
||||
def test_braced_arithmetic_and_survey_point_units():
|
||||
result = run(
|
||||
"math",
|
||||
r"""EstText.calculate([
|
||||
{Index:1,Code:'brace'},
|
||||
{LineData:' Q1 = { 6.0M×0.0002EA/M + 2.3M×0.0005EA/M + 1M×0.0005EA/M }'},
|
||||
{LineData:' Q = Q1 × 10000 = \x1228.5\x12'},
|
||||
{LineData:' 노무비 : \x03295,138\x03×3지점÷3지점×3인×4회 = \x123,541,656\x12',SCheck:-1},
|
||||
{LineData:' B{적재량} = 1500/11.5{5㎥×2.3} = \x12130.43\x12'}
|
||||
])""",
|
||||
)
|
||||
assert result["errors"] == []
|
||||
assert result["rows"][2]["TC"] == 28.5
|
||||
assert result["rows"][3]["TC"] == 3541656
|
||||
assert result["rows"][4]["TC"] == 130.43
|
||||
|
||||
|
||||
def test_spaced_metre_unit_is_not_a_second_variable_declaration():
|
||||
result = run(
|
||||
"math",
|
||||
|
||||
Reference in New Issue
Block a user