MCPcopy
hub / github.com/pika/pika / test_decode_signed_long_negative

Method test_decode_signed_long_negative

tests/unit/data_tests.py:94–104  ·  view source on GitHub ↗

Verify that type tag 'l' decodes as signed 64-bit (fixes #1531). RabbitMQ encodes negative longs (e.g. x-delay after delivery) with type tag 'l' and signed 64-bit representation.

(self)

Source from the content-addressed store, hash-verified

92 self.assertEqual(byte_count, 241)
93
94 def test_decode_signed_long_negative(self):
95 """Verify that type tag 'l' decodes as signed 64-bit (fixes #1531).
96
97 RabbitMQ encodes negative longs (e.g. x-delay after delivery)
98 with type tag 'l' and signed 64-bit representation.
99 """
100 # Table with x-delay = -30000 encoded as signed 64-bit 'l'
101 input = (b'\x00\x00\x00\x10'
102 b'\x07x-delayl\xff\xff\xff\xff\xff\xff\x8a\xd0')
103 result, _ = data.decode_table(input, 0)
104 self.assertEqual(result, {'x-delay': long(-30000)})
105
106 def test_encode_decode_negative_long_roundtrip(self):
107 """Verify negative long values round-trip correctly."""

Callers

nothing calls this directly

Calls 1

longClass · 0.90

Tested by

no test coverage detected