diff --git a/CHANGES.md b/CHANGES.md index d7b9594..4c9ed21 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,14 @@ # Changes +## Version 0.7.0 + +New Features: + + - Add data type `tlv8.DataType.UNSIGNED_INTEGER` to make a distinction between the default of + signed integers and unsigned integer. This is important for read network ports from TLV + structures + ## Version 0.6.0 New Features: diff --git a/setup.py b/setup.py index 2c78c95..4918c36 100644 --- a/setup.py +++ b/setup.py @@ -23,14 +23,14 @@ setuptools.setup( name='tlv8', packages=setuptools.find_packages(exclude=['tests']), - version='0.6.0', + version='0.7.0', description='Python module to handle type-length-value (TLV) encoded data 8-bit type, 8-bit length, and N-byte ' 'value as described within the Apple HomeKit Accessory Protocol Specification Non-Commercial Version ' 'Release R2.', author='Joachim Lusiardi', author_email='pypi@lusiardi.de', url='https://github.com/jlusiardi/tlv8_python', - download_url='https://github.com/jlusiardi/tlv8_python/archive/0.6.0.tar.gz', + download_url='https://github.com/jlusiardi/tlv8_python/archive/0.7.0.tar.gz', keywords=['TLV', 'Type-Length-Value', 'tlv8'], classifiers=[ 'License :: OSI Approved :: Apache Software License', diff --git a/tests/__init__.py b/tests/__init__.py index 1118bcf..83128b3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -15,7 +15,8 @@ # __all__ = [ - 'TestTLV8', 'TestTLV8Decode', 'TestTLV8Entry', 'TestTLV8Enum', 'TestTLV8EntryList', 'TestTLV8DeepDecode' + 'TestTLV8', 'TestTLV8Decode', 'TestTLV8Entry', 'TestTLV8Enum', 'TestTLV8EntryList', 'TestTLV8DeepDecode', + 'TestTLV8DecodeInteger' ] from tests.tlv8_encode_tests import TestTLV8 @@ -24,3 +25,4 @@ from tests.tlv8_entry_tests import TestTLV8Entry from tests.tlv8_enum_test import TestTLV8Enum from tests.tlv8_entrylist_tests import TestTLV8EntryList +from tests.tlv8_decode_integer_tests import TestTLV8DecodeInteger diff --git a/tests/tlv8_decode_integer_tests.py b/tests/tlv8_decode_integer_tests.py new file mode 100644 index 0000000..dbc8554 --- /dev/null +++ b/tests/tlv8_decode_integer_tests.py @@ -0,0 +1,175 @@ +# +# Copyright 2020 Joachim Lusiardi +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import unittest +from struct import pack + +import tlv8 + + +class TestTLV8DecodeInteger(unittest.TestCase): + def test_decode_int1_neg(self): + input_data = b'\x01\x01' + pack('