Beispiel #1
0
    def __init__(self,
                 mutated_field,
                 fields=[],
                 encoder=ENC_BITS_DEFAULT,
                 fuzzable=True,
                 name=None):
        '''
        :param mutated_field: (name of) field to perform mutations for each of its mutations
        :param fields: enclosed field(s) (default: [])
        :type encoder: BitsEncoder
        :param encoder: encoder for the container (default: ENC_BITS_DEFAULT)
        :param fuzzable: is container fuzzable (default: True)
        :param name: (unique) name of the container (default: None)

        :example:

            ::

                Template([
                    Group(['a', 'b', 'c'], name='letters'),
                    ForEach('letters', [
                        Group(['1', '2', '3'])
                    ])
                ])
                # results in the mutations: a1, a2, a3, b1, b2, b3, c1, c2, c3
        '''
        super(ForEach, self).__init__(fields=fields,
                                      encoder=encoder,
                                      fuzzable=fuzzable,
                                      name=name)
        kassert.not_none(mutated_field)
        self._mutated_field = mutated_field
Beispiel #2
0
    def __init__(self, mutated_field, fields=[], encoder=ENC_BITS_DEFAULT, fuzzable=True, name=None):
        '''
        :param mutated_field: (name of) field to perform mutations for each of its mutations
        :param fields: enclosed field(s) (default: [])
        :type encoder: BitsEncoder
        :param encoder: encoder for the container (default: ENC_BITS_DEFAULT)
        :param fuzzable: is container fuzzable (default: True)
        :param name: (unique) name of the container (default: None)

        :example:

            ::

                Template([
                    Group(['a', 'b', 'c'], name='letters'),
                    ForEach('letters', [
                        Group(['1', '2', '3'])
                    ])
                ])
                # results in the mutations: a1, a2, a3, b1, b2, b3, c1, c2, c3
        '''
        super(ForEach, self).__init__(fields=fields, encoder=encoder, fuzzable=fuzzable, name=name)
        kassert.not_none(mutated_field)
        self._mutated_field = mutated_field