Change in pysim[master]: filesystem: add unit tests for encoder/decoder methods

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Falkenber9 gerrit-no-reply at lists.osmocom.org
Sun May 9 18:37:09 UTC 2021


Falkenber9 has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/24012 )

Change subject: filesystem: add unit tests for encoder/decoder methods
......................................................................


Patch Set 4:

(1 comment)

Some comments from my side as I also thought about tests and just saw this change.

In my opinion, the test framework should not only include the direction _encode_decode_testvector, but also the opposite scenario, i.e. _decode_encode_testvector, with a bit vector (or hexstr) on both ends.
This enables testing against correct length, padding, and proper handling of reserved-for-future-use (RFU) bits (as shown below).

Moreover, classes that define the file via _construct might also be included into the test, not only the explicit encoding and decoding methods.

Future extensions of this approach could also include an option to test with invalid inputs to test for proper error handling of the encoders/decoders, e.g. too long strings, invalid characters, etc.

https://gerrit.osmocom.org/c/pysim/+/24012/4/pySim/ts_51_011.py 
File pySim/ts_51_011.py:

https://gerrit.osmocom.org/c/pysim/+/24012/4/pySim/ts_51_011.py@529 
PS4, Line 529: 				 '{"spn": ["hello world", false, true]}']
Here we have an example for a file that contains reserved-for-future-use (RFU) fields. A test that encodes and decodes a dict may not discover false handling of RFU fields or correct padding. In the opposite direction we have at least the chance to construct a test with RFU bits set to a specific pattern that should be maintained if decoded and encoded again.



-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24012
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I02d884547f4982e0b8ed7ef21b8cda75237942e2
Gerrit-Change-Number: 24012
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: Falkenber9 <robert.falkenberg at tu-dortmund.de>
Gerrit-Comment-Date: Sun, 09 May 2021 18:37:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210509/daade0f9/attachment.htm>


More information about the gerrit-log mailing list