Define wrap-safe snapshot sequencing

This commit is contained in:
Nomads_Reach
2026-08-16 00:06:06 -04:00
parent 840445075d
commit ca962e4511
4 changed files with 123 additions and 1 deletions
+10 -1
View File
@@ -1,4 +1,9 @@
from transport_policy import Delivery, delivery_for_packet_type, is_snapshot_packet
from transport_policy import (
Delivery,
delivery_for_packet_type,
is_snapshot_packet,
requires_application_sequence,
)
def test_snapshot_packets_use_unreliable_sequenced_delivery():
@@ -6,6 +11,8 @@ def test_snapshot_packets_use_unreliable_sequenced_delivery():
assert delivery_for_packet_type("npcState") is Delivery.UNRELIABLE_SEQUENCED
assert is_snapshot_packet("transform")
assert is_snapshot_packet("npcState")
assert requires_application_sequence("transform")
assert requires_application_sequence("npcState")
def test_gameplay_and_control_packets_use_reliable_ordered_delivery():
@@ -25,7 +32,9 @@ def test_gameplay_and_control_packets_use_reliable_ordered_delivery():
for packet_type in reliable_types:
assert delivery_for_packet_type(packet_type) is Delivery.RELIABLE_ORDERED
assert not is_snapshot_packet(packet_type)
assert not requires_application_sequence(packet_type)
def test_unknown_packet_types_never_default_to_unreliable():
assert delivery_for_packet_type("futureControlPacket") is Delivery.RELIABLE_ORDERED
assert not requires_application_sequence("futureControlPacket")