Exemplo n.º 1
0
def test_signed_varint_decode_negative_max_int64():
    assert pyrobuf_util.from_signed_varint(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01') == (-2**63, 10)
Exemplo n.º 2
0
def test_signed_varint_decode_negative_12345():
    assert pyrobuf_util.from_signed_varint(b'\xf1\xc0\x01') == (-12345, 3)
Exemplo n.º 3
0
def test_signed_varint_decode_negative_max_int32():
    assert pyrobuf_util.from_signed_varint(b'\xff\xff\xff\xff\x0f') == (-2**31, 5)
Exemplo n.º 4
0
def test_signed_varint_decode_max_int64():
    assert pyrobuf_util.from_signed_varint(b'\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01') == (2**63-1, 10)
Exemplo n.º 5
0
def test_signed_varint_decode_negative_1():
    assert pyrobuf_util.from_signed_varint(b'\x01') == (-1, 1)
Exemplo n.º 6
0
def test_signed_varint_decode_0():
    assert pyrobuf_util.from_signed_varint(b'\x00') == (0, 1)
Exemplo n.º 7
0
def test_signed_varint_decode_1():
    assert pyrobuf_util.from_signed_varint(b'\x02') == (1, 1)
Exemplo n.º 8
0
def test_signed_varint_decode_negative_max_int32():
    assert pyrobuf_util.from_signed_varint(b'\xff\xff\xff\xff\x0f') == (-2**31,
                                                                        5)
Exemplo n.º 9
0
def test_signed_varint_decode_negative_max_int64():
    assert pyrobuf_util.from_signed_varint(
        b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01') == (-2**63, 10)
Exemplo n.º 10
0
def test_signed_varint_decode_negative_12345():
    assert pyrobuf_util.from_signed_varint(b'\xf1\xc0\x01') == (-12345, 3)
Exemplo n.º 11
0
def test_signed_varint_decode_negative_1():
    assert pyrobuf_util.from_signed_varint(b'\x01') == (-1, 1)
Exemplo n.º 12
0
def test_signed_varint_decode_max_int64():
    assert pyrobuf_util.from_signed_varint(
        b'\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01') == (2**63 - 1, 10)
Exemplo n.º 13
0
def test_signed_varint_decode_1():
    assert pyrobuf_util.from_signed_varint(b'\x02') == (1, 1)
Exemplo n.º 14
0
def test_signed_varint_decode_0():
    assert pyrobuf_util.from_signed_varint(b'\x00') == (0, 1)