Commit 1c512c3e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Test boolean types with true and false

parent 24bfd011
......@@ -78,14 +78,14 @@ except ImportError:
def import_DV(asnFile=''): # type: str -> Module
''' Generate DV.py from the user-provided asn1 file '''
global DV
if not DV:
if not DV or asnFile:
try:
module = asn1scc.asn2dataModel(asnFile)
DV = module.DV
return module
except TypeError as err:
logger.error('Could not execute asn2dataModel: ' + str(err))
sys.exit(1)
return module
def asn1sccToasn1ValueEditorTypes(dataview, name, asntype):
''' Convert an ASN.1 type from the Python AST of asn1scc v3
......
......@@ -11,12 +11,25 @@ Use py.test-2.7 to run these tests, and make sure you have installed pytest-qt
pip install --user pytest-qt
'''
def test_1(qtbot):
def test_true(qtbot):
''' Test with a single boolean type '''
expected = 'TRUE'
typename = "Ahah"
s = editor.SingleValueEditor('data/dv2.asn',
paramsAndTypes={'param': 'Ahah'})
widget = s.setupEdit('Ahah', defValue=expected)['editor']
paramsAndTypes={'param': typename})
widget = s.setupEdit(typename, defValue=expected)['editor']
widget.getVariable(dest=widget.asn1Instance)
result = widget.asn1Instance.GSER()
print result
assert result == expected
def test_false(qtbot):
''' Test with a single boolean type '''
expected = 'FALSE'
typename = "Ahah"
s = editor.SingleValueEditor('data/dv2.asn',
paramsAndTypes={'param': typename})
widget = s.setupEdit(typename, defValue=expected)['editor']
widget.getVariable(dest=widget.asn1Instance)
result = widget.asn1Instance.GSER()
print result
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment