Prepare test for tune params

This commit is contained in:
ChillerDragon 2023-04-02 09:42:20 +02:00
parent 0013b9b8c0
commit da6d0cfc40

View file

@ -154,7 +154,7 @@ def test_parse_7_real_broadcast_input_snap() -> None:
assert packet.messages[2].message_name == 'snap_empty'
assert packet.messages[2].system_message is True
def teste_parse_7_real_rcon_and_input() -> None:
def test_parse_7_real_rcon_and_input() -> None:
data = b'\x02\x81\x02\x5b\x30\xe5\x81' \
b'\x40\x11\x09\x2b\x74\x75\x6e\x65\x20\x67\x72\x61\x76\x69\x74\x79\x20\x32\x30\x00' \
b'\x00\x11\x29\x80\x5a\x83\x5a\x28\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x21'
@ -173,3 +173,46 @@ def teste_parse_7_real_rcon_and_input() -> None:
assert inp.ack_snapshot == 5760
assert inp.intended_tick == 5763
assert inp.input_size == 40
def test_parse_7_real_tune_params_rcon_line_input_timing_snap_empty() -> None:
"""
This is a direct response to the packet from
test_parse_7_real_rcon_and_input()
copied straight from a packet dump of a vanilla 0.7 server
talking to a vanilla 0.7 client
"""
data = b'\x00\t\x04{FN\xb5' \
b'A\x86\x82\x0c\xa8\x0f\x88\x032\xa8\x14\xb0\x12\xb4\x07\x96\x02' \
b'\x9f\x01\xb0\xd1\x04\x80}\xac\x04\x9c\x17\x90\x1f\x98\xdb\x06' \
b'\x80\xb5\x18\x8c\x02\xbd\x01\xa0\xed\x1a\x88\x03\xbd\x01\xb8' \
b'\xc8!\x90\x01\x14\xbc\n\xa0\x9a\x0c\x88\x03\x80\xe2\t' \
b'\x98\xea\x01\xa4\x01\x00\xa4\x01\xa4\x01' \
b'@\xae\x83\x1b[08:52:58][tuning]: gravity changed to 20.00\x00' \
b'\x00\x04\x15\x83Z\n' \
b'\x00\x04\x0f\x84Z\x04'
packet = parse7(data)
assert len(packet.messages) == 4
tune = packet.messages[0]
rcon = packet.messages[1]
timing = packet.messages[2]
snap = packet.messages[3]
assert tune.message_name == 'sv_tune_params'
# assert tune.ground_control_speed == 10
assert rcon.message_name == 'rcon_line'
assert rcon.line == '[08:52:58][tuning]: gravity changed to 20.00'
assert timing.message_name == 'input_timing'
assert timing.input_pred_tick == 5763
assert timing.time_left == 10
assert snap.message_name == 'snap_empty'
assert snap.tick == 5764
assert snap.delta_tick == 4