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
038ec9c2
Commit
038ec9c2
authored
Aug 16, 2016
by
Maxime Perrotin
Browse files
ValueGenerator: process strings like the other types
parent
0a457745
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/ValueGenerator.py
View file @
038ec9c2
...
...
@@ -117,12 +117,19 @@ def compute_combinations(asn1_ty, pool, dest, offset=None):
for
each
in
compute_sequenceof_combinations
(
basic
,
pool
,
dest
):
yield
each
elif
basic
.
kind
.
endswith
(
'StringType'
):
# Strings
for
n
in
xrange
(
int
(
basic
.
Min
),
int
(
basic
.
Max
)
+
1
):
yield
'"'
+
'X'
*
n
+
'"'
for
each
in
compute_string_combinations
(
basic
,
dest
):
yield
each
dest
.
Reset
(
state
)
def
compute_string_combinations
(
asn1_ty
,
dest
):
''' Return a combination of strings based on possible lengths '''
state
=
dest
.
GetState
()
for
n
in
xrange
(
int
(
asn1_ty
.
Min
),
int
(
asn1_ty
.
Max
)
+
1
):
dest
.
SetFromPyString
(
'X'
*
n
)
yield
'"'
+
'X'
*
n
+
'"'
dest
.
Reset
(
state
)
def
compute_integer_combinations
(
asn1_ty
,
dest
,
max_iter
=
0
):
''' Generator returning all integer values, with optional limit '''
state
=
dest
.
GetState
()
...
...
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