Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
1c512c3e
Commit
1c512c3e
authored
Jul 16, 2016
by
Maxime Perrotin
Browse files
Test boolean types with true and false
parent
24bfd011
Changes
2
Show whitespace changes
Inline
Side-by-side
asn1_value_editor/standalone_editor.py
View file @
1c512c3e
...
...
@@ -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
...
...
test/pytest/test_standalone.py
View file @
1c512c3e
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment