Skip to content

Commit

Permalink
Enable -n inf on the CLI of grammarinator-generate (#257)
Browse files Browse the repository at this point in the history
The help string of `-n` has been mentioning `inf` as a valid value
and the code has been prepared for continuous generation for years,
but the argument parser never accepted anything but integers.
  • Loading branch information
akosthekiss authored Nov 24, 2024
1 parent 4f7d817 commit 4139f7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grammarinator/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
from .tool import DefaultGeneratorFactory, DefaultPopulation, GeneratorTool


def int_or_inf(value):
return inf if value == 'inf' else int(value)


def process_args(args):
args.generator = import_object(args.generator)
args.model = import_object(args.model)
Expand Down Expand Up @@ -113,7 +117,7 @@ def execute():
help='output file name pattern (default: %(default)s).')
parser.add_argument('--stdout', dest='out', action='store_const', const='', default=SUPPRESS,
help='print test cases to stdout (alias for --out=%(const)r)')
parser.add_argument('-n', default=1, type=int, metavar='NUM',
parser.add_argument('-n', default=1, type=int_or_inf, metavar='NUM',
help='number of tests to generate, \'inf\' for continuous generation (default: %(default)s).')
parser.add_argument('--random-seed', type=int, metavar='NUM',
help='initialize random number generator with fixed seed (not set by default).')
Expand Down

0 comments on commit 4139f7f

Please sign in to comment.