# Path: mcm/librouteros/connections.py
# def enclen( length ):
# def declen( bytes ):
# def decsnt( sentence ):
# def encsnt( sentence ):
# def encword( word ):
# def log_snt( logger, sentence, direction ):
#     def __init__( self, sock, log ):
#     def writeSnt( self, snt ):
#     def readSnt( self ):
#     def readSock( self, length ):
#     def writeSock( self, string ):
#     def getLen( self ):
#     def close( self ):
#         XOR = 0
#         XOR = 0x8000
#         XOR = 0xC00000
#         XOR = 0xE0000000
# class ReaderWriter:
# 
# Path: mcm/librouteros/exceptions.py
# class ConnError( LibError ):
#     '''
#     Connection related errors.
#     '''


import unittest
import pytest
from socket import SHUT_RDWR, error as SOCKET_ERROR, timeout as SOCKET_TIMEOUT, socket
from mock import MagicMock, call, patch
from mcm.librouteros import connections
from mcm.librouteros.exceptions import ConnError
# -*- coding: UTF-8 -*-




integers = (0, 127 ,130 ,2097140 ,268435440)
encoded = (b'\x00', b'\x7f', b'\x80\x82', b'\xdf\xff\xf4', b'\xef\xff\xff\xf0')


@pytest.mark.parametrize("integer,encoded", zip(integers, encoded))
def test_encoding(integer, encoded):
    assert connections.enclen(integer) == encoded


@pytest.mark.parametrize("encoded,integer", zip(encoded, integers))
def test_decoding(encoded, integer):
    assert connections.declen(encoded) == integer



# Path: mcm/librouteros/connections.py
# def enclen( length ):
# def declen( bytes ):
# def decsnt( sentence ):
# def encsnt( sentence ):
# def encword( word ):
# def log_snt( logger, sentence, direction ):
#     def __init__( self, sock, log ):
#     def writeSnt( self, snt ):
#     def readSnt( self ):
#     def readSock( self, length ):
#     def writeSock( self, string ):
#     def getLen( self ):
#     def close( self ):
#         XOR = 0
#         XOR = 0x8000
#         XOR = 0xC00000
#         XOR = 0xE0000000
# class ReaderWriter:
# 
# Path: mcm/librouteros/exceptions.py
# class ConnError( LibError ):
#     '''
#     Connection related errors.
#     '''


# Path: tests/test_connections.py
import unittest
import pytest
from socket import SHUT_RDWR, error as SOCKET_ERROR, timeout as SOCKET_TIMEOUT, socket
from mock import MagicMock, call, patch
from mcm.librouteros import connections
from mcm.librouteros.exceptions import ConnError

# -*- coding: UTF-8 -*-




integers = (0, 127 ,130 ,2097140 ,268435440)
encoded = (b'\x00', b'\x7f', b'\x80\x82', b'\xdf\xff\xf4', b'\xef\xff\xff\xf0')


@pytest.mark.parametrize("integer,encoded", zip(integers, encoded))
def test_encoding(integer, encoded):
    assert connections.enclen(integer) == encoded


@pytest.mark.parametrize("encoded,integer", zip(encoded, integers))
def test_decoding(encoded, integer):
    assert connections.declen(encoded) == integer



def test_raises_if_lenghth_is_too_big():