Example #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)
Example #2
0
def test_signed_varint_decode_negative_12345():
    assert pyrobuf_util.from_signed_varint(b'\xf1\xc0\x01') == (-12345, 3)
Example #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)
Example #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)
Example #5
0
def test_signed_varint_decode_negative_1():
    assert pyrobuf_util.from_signed_varint(b'\x01') == (-1, 1)
Example #6
0
def test_signed_varint_decode_0():
    assert pyrobuf_util.from_signed_varint(b'\x00') == (0, 1)
Example #7
0
def test_signed_varint_decode_1():
    assert pyrobuf_util.from_signed_varint(b'\x02') == (1, 1)
Example #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)
Example #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)
Example #10
0
def test_signed_varint_decode_negative_12345():
    assert pyrobuf_util.from_signed_varint(b'\xf1\xc0\x01') == (-12345, 3)
Example #11
0
def test_signed_varint_decode_negative_1():
    assert pyrobuf_util.from_signed_varint(b'\x01') == (-1, 1)
Example #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)
Example #13
0
def test_signed_varint_decode_1():
    assert pyrobuf_util.from_signed_varint(b'\x02') == (1, 1)
Example #14
0
def test_signed_varint_decode_0():
    assert pyrobuf_util.from_signed_varint(b'\x00') == (0, 1)