From 7249ca3a6fdf51f6b7ea66ac6854edd5e02ae5ec Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 15 Jul 2026 20:00:24 +0900 Subject: feat: MMLパーサーと意味解析を厳格化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ppmckの終端分岐付きリピートとL制御トラックを実装 - case、構文構造、音長、エフェクト値域の検証を強化 - Pyxel拡張コマンドのarityと参照検証を追加 - リピート展開上限と構文・意味エラー時の合成停止を追加 - BNF、設計書、適合監査、回帰テストを更新 --- tests/test_error_codes.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/test_error_codes.py') diff --git a/tests/test_error_codes.py b/tests/test_error_codes.py index 538056f..22c9592 100644 --- a/tests/test_error_codes.py +++ b/tests/test_error_codes.py @@ -82,17 +82,17 @@ def test_syntax_unexpected_token(compose_mml): assert result["valid"] is True -# --- SEMANTIC_OUTSIDE_TRACK --- -def test_semantic_outside_track_ppmck(compose_mml): +# --- commands outside tracks are syntax errors --- +def test_command_outside_track_ppmck(compose_mml): result = compose_mml(action="validate", mml="t120\nA l4\n c", mode="ppmck") - assert result["valid"] is True - assert _find_code(result, ErrorCode.SEMANTIC_OUTSIDE_TRACK.value, "warnings") + assert result["valid"] is False + assert _find_code(result, ErrorCode.SYNTAX_UNEXPECTED_TOKEN.value, "errors") -def test_semantic_outside_track_pyxel(compose_mml): +def test_command_outside_track_pyxel(compose_mml): result = compose_mml(action="validate", mml="T120\n0: L4\n C", mode="pyxel") - assert result["valid"] is True - assert _find_code(result, ErrorCode.SEMANTIC_OUTSIDE_TRACK.value, "warnings") + assert result["valid"] is False + assert _find_code(result, ErrorCode.SYNTAX_UNEXPECTED_TOKEN.value, "errors") # --- SYNTAX_UNTERMINATED_REPEAT --- @@ -193,7 +193,7 @@ def test_semantic_note_out_of_range_pyxel(compose_mml): # --- SEMANTIC_CHANNEL_MISMATCH --- def test_semantic_channel_mismatch_ppmck_triangle_duty(compose_mml): result = compose_mml(action="validate", mml="T t120 l4 @2\n c", mode="ppmck") - assert _find_code(result, ErrorCode.SEMANTIC_CHANNEL_MISMATCH.value, "warnings") + assert _find_code(result, ErrorCode.SEMANTIC_CHANNEL_MISMATCH.value, "errors") def test_semantic_channel_mismatch_ppmck_noise_pitch(compose_mml): @@ -203,7 +203,7 @@ def test_semantic_channel_mismatch_ppmck_noise_pitch(compose_mml): def test_semantic_channel_mismatch_pyxel_triangle_at(compose_mml): result = compose_mml(action="validate", mml="2: T120 L4 @1\n C", mode="pyxel") - assert _find_code(result, ErrorCode.SEMANTIC_CHANNEL_MISMATCH.value, "warnings") + assert _find_code(result, ErrorCode.SEMANTIC_CHANNEL_MISMATCH.value, "errors") # --- SYNTAX_UNTERMINATED_HEADER --- -- cgit v1.2.3