diff options
| author | Matthew Poletiek <matthew.poletiek@gmail.com> | 2020-12-08 21:03:16 -0600 |
|---|---|---|
| committer | Matthew Poletiek <matthew.poletiek@gmail.com> | 2020-12-08 21:03:16 -0600 |
| commit | e99416456afd4aa8bde42016826f9a345291cbf3 (patch) | |
| tree | a7a95639cd1cb5dbe2d91a2ca8e8defafac4296d /tests/unit/test_utils.py | |
| parent | 194cf4e5e0b6a2811103a9b739a72b9afe2b886c (diff) | |
| download | chirp-e99416456afd4aa8bde42016826f9a345291cbf3.tar.gz chirp-e99416456afd4aa8bde42016826f9a345291cbf3.tar.xz | |
Initial Commit
Diffstat (limited to 'tests/unit/test_utils.py')
| -rw-r--r-- | tests/unit/test_utils.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py new file mode 100644 index 0000000..575f3e3 --- /dev/null +++ b/tests/unit/test_utils.py @@ -0,0 +1,21 @@ +from chirp import util +from tests.unit import base + + +class TestUtils(base.BaseTest): + def test_hexprint_with_string(self): + util.hexprint('00000000000000') + + def test_hexprint_with_bytes(self): + util.hexprint(b'00000000000000') + + def test_struct_pack(self): + struct = util.StringStruct + + self.assertEqual('\x00c', + struct.pack('bc', 0, 'c')) + + def test_struct_unpack(self): + struct = util.StringStruct + + self.assertEqual((1, 'c'), struct.unpack('bc', '\x01c')) |
