Commit 038ec9c2 authored by Maxime Perrotin's avatar Maxime Perrotin

ValueGenerator: process strings like the other types

parent 0a457745
......@@ -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()
......
Markdown is supported
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