Skip to content

Commit 19beb5e

Browse files
committed
add tests for strat coverage when disabling implicit entrance/exits
1 parent 483a7a1 commit 19beb5e

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tests/asserts/keywords.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,63 @@ def check_speed_states(strat, err_fn):
695695
msg = f"🔴ERROR: Door orientation '{node_orientation}' inconsistent with connection position '{door_position}': {nodeRef}:{node['name']}"
696696
messages["reds"].append(msg)
697697
messages["counts"]["reds"] += 1
698+
699+
if node.get("useImplicitLeaveNormally") is False and not any(
700+
s["link"][1] == node["id"]
701+
and s.get("exitCondition", {}).get("leaveNormally") is not None
702+
for s in room["strats"]
703+
):
704+
msg = f"🔴ERROR: Node disables useImplicitLeaveNormally but has no leaveNormally strat: {nodeRef}:{node['name']}"
705+
messages["reds"].append(msg)
706+
messages["counts"]["reds"] += 1
698707

708+
if node.get("useImplicitComeInNormally") is False and not any(
709+
s["link"][0] == node["id"]
710+
and s.get("entranceCondition", {}).get("comeInNormally") is not None
711+
for s in room["strats"]
712+
):
713+
msg = f"🔴ERROR: Node disables useImplicitComeInNormally but has no comeInNormally strat: {nodeRef}:{node['name']}"
714+
messages["reds"].append(msg)
715+
messages["counts"]["reds"] += 1
716+
717+
if node.get("useImplicitComeInWithMockball") is False and not any(
718+
s["link"][0] == node["id"]
719+
and s.get("entranceCondition", {}).get("comeInWithMockball") is not None
720+
for s in room["strats"]
721+
):
722+
msg = f"🔴ERROR: Node disables useImplicitComeInWithMockball but has no comeInWithMockball strat: {nodeRef}:{node['name']}"
723+
messages["reds"].append(msg)
724+
messages["counts"]["reds"] += 1
725+
726+
if node.get("useImplicitCarryGModeBackThrough") is False and not any(
727+
s["link"][0] == node["id"]
728+
and s.get("entranceCondition", {}).get("comeInWithGMode") is not None
729+
and s.get("exitCondition", {}).get("leaveWithGMode") is not None
730+
for s in room["strats"]
731+
):
732+
if room["id"] == 321:
733+
# Toilet Bowl is an exception where there legitimately is no comeInWithGMode+leaveWithGMode strat
734+
pass
735+
else:
736+
msg = f"🔴ERROR: Node disables useImplicitCarryGModeBackThrough but has no comeInWithGMode+leaveWithGMode strat: {nodeRef}:{node['name']}"
737+
messages["reds"].append(msg)
738+
messages["counts"]["reds"] += 1
739+
740+
if node.get("useImplicitCarryGModeMorphBackThrough") is False and not any(
741+
s["link"][0] == node["id"]
742+
and s.get("entranceCondition", {}).get("comeInWithGMode") is not None
743+
and s.get("exitCondition", {}).get("leaveWithGMode") is not None
744+
and s["exitCondition"]["leaveWithGMode"]["morphed"]
745+
for s in room["strats"]
746+
):
747+
if room["id"] == 321 or node["nodeSubType"] == "elevator":
748+
# Toilet Bowl and elevators are an exception where there legitimately is no comeInWithGMode+leaveWithGMode morphed strat
749+
pass
750+
else:
751+
msg = f"🔴ERROR: Node disables useImplicitCarryGModeMorphBackThrough but has no comeInWithGMode+leaveWithGMode morphed strat: {nodeRef}:{node['name']}"
752+
messages["reds"].append(msg)
753+
messages["counts"]["reds"] += 1
754+
699755
# Document Links
700756
link_set = set()
701757
for link_from in room["links"]:

0 commit comments

Comments
 (0)