mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-20 12:28:33 +03:00
test_files: Test decoder also with ff-padded input
It's customary in the SIM card universe to right-pad data with ff bytes. So far we only test decoders without such padding, which is unrealistic. Let's also tests the decoders with extra 'ff' padding present. For some files this doesn't make sense, so we add a _test_no_pad class attribute that can be spcified to prevent this new "test with ff-padding" from being executed for the test data of the class. Change-Id: I7f5cbb4a6f91040fe9adef9da0a1f30f9f156dae
This commit is contained in:
@@ -117,6 +117,7 @@ class EF_AD(TransparentEF):
|
||||
_test_de_encode = [
|
||||
( "000000", { 'ms_operation_mode' : 'normal', 'additional_info' : '0000', 'rfu' : '' } ),
|
||||
]
|
||||
_test_no_pad = True
|
||||
|
||||
class OP_MODE(enum.IntEnum):
|
||||
normal = 0x00
|
||||
|
||||
@@ -639,6 +639,7 @@ class EF_PL(TransRecEF):
|
||||
( '656e', "en" ),
|
||||
( 'ffff', None ),
|
||||
]
|
||||
|
||||
def __init__(self, fid='2f05', sfid=0x05, name='EF.PL', desc='Preferred Languages'):
|
||||
super().__init__(fid, sfid=sfid, name=name,
|
||||
desc=desc, rec_len=2, size=(2, None))
|
||||
|
||||
@@ -526,6 +526,7 @@ class EF_ECC(LinFixedEF):
|
||||
"marine_guard": False, "mountain_rescue": False,
|
||||
"manual_ecall": False, "automatic_ecall": False } } ),
|
||||
]
|
||||
_test_no_pad = True
|
||||
cc_construct = BcdAdapter(Rpad(Bytes(3)))
|
||||
category_construct = FlagsEnum(Byte, police=1, ambulance=2, fire_brigade=3, marine_guard=4,
|
||||
mountain_rescue=5, manual_ecall=6, automatic_ecall=7)
|
||||
@@ -588,6 +589,8 @@ class EF_AD(TransparentEF):
|
||||
"prose_services": False, "extended_drx": False },
|
||||
"rfu": 0, "mnc_len": 2, "extensions": b'' } ),
|
||||
]
|
||||
_test_no_pad = True
|
||||
|
||||
class OP_MODE(enum.IntEnum):
|
||||
normal = 0x00
|
||||
type_approval = 0x80
|
||||
|
||||
@@ -141,6 +141,7 @@ class EF_ADN(LinFixedEF):
|
||||
"numbering_plan_id": "isdn_e164"},
|
||||
"dialing_nr": "491721217212", "cap_conf_id": 255, "ext1_record_id": 255} )
|
||||
]
|
||||
_test_no_pad = True
|
||||
|
||||
def __init__(self, fid='6f3a', sfid=None, name='EF.ADN', desc='Abbreviated Dialing Numbers', ext=1, **kwargs):
|
||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(14, 30), **kwargs)
|
||||
@@ -215,6 +216,7 @@ class EF_SMSP(LinFixedEF):
|
||||
"call_number": "" },
|
||||
"tp_pid": "00", "tp_dcs": "00", "tp_vp_minutes": 1440 } ),
|
||||
]
|
||||
_test_no_pad = True
|
||||
class ValidityPeriodAdapter(Adapter):
|
||||
def _decode(self, obj, context, path):
|
||||
if obj <= 143:
|
||||
@@ -565,6 +567,8 @@ class EF_AD(TransparentEF):
|
||||
( "00ffff",
|
||||
{ "ms_operation_mode": "normal", "rfu1": 255, "rfu2": 127, "ofm": True, "extensions": None } ),
|
||||
]
|
||||
_test_no_pad = True
|
||||
|
||||
class OP_MODE(enum.IntEnum):
|
||||
normal = 0x00
|
||||
type_approval = 0x80
|
||||
@@ -871,6 +875,8 @@ class EF_MWIS(LinFixedEF):
|
||||
False}, "num_waiting_voicemail": 0, "num_waiting_fax": 0, "num_waiting_email": 0,
|
||||
"num_waiting_other": 0, "num_waiting_videomail": None} ),
|
||||
]
|
||||
_test_no_pad = True
|
||||
|
||||
def __init__(self, fid='6fca', sfid=None, name='EF.MWIS', rec_len=(5, 6),
|
||||
desc='Message Waiting Indication Status', **kwargs):
|
||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user