<p style="white-space: pre-wrap; word-wrap: break-word;">Some comments from my side as I also thought about tests and just saw this change.</p><p style="white-space: pre-wrap; word-wrap: break-word;">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.<br>This enables testing against correct length, padding, and proper handling of reserved-for-future-use (RFU) bits (as shown below).</p><p style="white-space: pre-wrap; word-wrap: break-word;">Moreover, classes that define the file via _construct might also be included into the test, not only the explicit encoding and decoding methods.</p><p style="white-space: pre-wrap; word-wrap: break-word;">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.<br></p><p><a href="https://gerrit.osmocom.org/c/pysim/+/24012">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/pysim/+/24012/4/pySim/ts_51_011.py">File pySim/ts_51_011.py:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/pysim/+/24012/4/pySim/ts_51_011.py@529">Patch Set #4, Line 529:</a> <code style="font-family:monospace,monospace">                                '{"spn": ["hello world", false, true]}']</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/pysim/+/24012">change 24012</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/pysim/+/24012"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: pysim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I02d884547f4982e0b8ed7ef21b8cda75237942e2 </div>
<div style="display:none"> Gerrit-Change-Number: 24012 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: Falkenber9 <robert.falkenberg@tu-dortmund.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Sun, 09 May 2021 18:37:09 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>