|
tgen 1.5.0
|
Generation of strings. More...
Classes | |
| struct | tgen::str |
| String generator. More... | |
| struct | tgen::str::value |
| String value. More... | |
Generation of strings.
Regex syntax compatible with testlib's regex. Regexes may generate an empty string (for example, a{0}). Empty groups and alternatives are supported: a()b yields ab, and a| yields either a or the empty string.
Operations:
Operations defined by {n} and {l,r} are applied to what comes before it: a character, a group defined by [] or (), or {n}/{l,r} expressions.
Regex generation is uniform (each string has the same probability of being generated), as long as each generated string can be generated uniquely from the regex. Otherwise, the probability of each string being generated is proportional to the number of ways it can be generated from the regex.
Examples:
Prints a random string of 20 lower and uppercase letters.
Prints 2 uniformly random numbers in [0, 10^n].