extends GutTest var _config: RuleConfig const _C = preload("res://src/core/constants.gd") func before_each(): _config = RuleConfig.standard() func _card(orig_id: int, deck_idx: int = 0) -> Card: var suit: int var rank: int if orig_id == 52: suit = 4; rank = 15 elif orig_id == 53: suit = 5; rank = 16 else: suit = orig_id % 4 rank = 2 + (orig_id / 4) var c := Card.create(orig_id, suit, rank) c.card_id = Card.card_id_from_deck(orig_id, deck_idx) return c func _cards(ids: Array) -> Array[Card]: var result: Array[Card] = [] for id in ids: result.append(_card(id as int)) return result func test_generate_includes_pass(): var hand := _cards([0]) var moves := MoveGenerator.generate(hand, 5, _config) var has_pass := false for m in moves: if m.type == -1 and m.cards.is_empty(): has_pass = true assert_true(has_pass) func test_generate_singles(): var hand := _cards([0, 4, 8]) var moves := MoveGenerator.generate(hand, 5, _config) var singles := 0 for m in moves: if m.type == _C.TYPE_SINGLE: singles += 1 assert_gt(singles, 0) func test_generate_pair(): var hand: Array[Card] = [_card(0, 0), _card(0, 1), _card(4, 0)] var moves := MoveGenerator.generate(hand, 5, _config) var has_pair := false for m in moves: if m.type == _C.TYPE_PAIR: has_pair = true assert_true(has_pair) func test_empty_hand_returns_pass_only(): var hand: Array[Card] = [] var moves := MoveGenerator.generate(hand, 5, _config) assert_eq(moves.size(), 1) assert_eq(moves[0].type, -1) func test_rule_config_standard(): var rc := RuleConfig.standard() assert_eq(rc.double_down_levels, 3) assert_false(rc.can_tribute_wild) func test_rule_config_huaian(): var rc := RuleConfig.huaian() assert_false(rc.same_suit_straight_beats_bomb) func test_rule_config_hash(): var rc := RuleConfig.standard() var h := rc.to_hash_data() assert_eq(h.double_down, 3)