File size: 1,967 Bytes
463f868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from compiler.patterns.effects import EFFECT_PATTERNS


def _get_pattern(patterns, name):
    return next((p for p in patterns if p.name == name), None)


test_cases = [
    # Draw patterns
    ("draw_cards", "カードを2枚引く", True),
    ("draw_cards", "カードを3枚引く", True),
    ("draw_one", "引く", True),
    ("draw_one", "引き入れる", False),  # Excluded
    # Blade patterns (with verbose regex)
    ("add_blades", "ブレード+1", True),
    ("add_blades", "ブレード+2", True),
    ("add_blades", "ブレード+3", True),
    ("add_blades", "ブレードスコア場合", False),  # Excluded context
    # Heart patterns (with verbose regex)
    ("add_hearts", "ハート+1", True),
    ("add_hearts", "ハート+2", True),
    # Recovery patterns
    ("recover_member", "控え室から手札に加える", True),
    ("recover_live", "控え室からライブカードを手札に加える", True),
    # Look patterns
    ("look_deck_top", "デッキの一番上を見る", True),
    ("look_deck", "デッキを3枚見て", True),
    # New patterns (gap coverage)
    ("recover_from_success_zone", "成功ライブカード置き場から手札に加える", True),
    ("play_from_hand", "手札からステージに出す", True),
]

failed = False
print("Running manual test_effect_matches...")
for name, text, should_match in test_cases:
    pattern = _get_pattern(EFFECT_PATTERNS, name)
    if pattern is None:
        print(f"ERROR: Pattern '{name}' not found")
        failed = True
        continue

    match = pattern.matches(text)
    matched = bool(match)
    if matched != should_match:
        print(f"FAIL: {name} on '{text}' -> Got {matched}, Expected {should_match}")
        failed = True
    else:
        # print(f"PASS: {name} on '{text}'")
        pass

if not failed:
    print("ALL TESTS PASSED")
else:
    print("SOME TESTS FAILED")