9 my $templateFile = 'testLits.h.template';
10 my $outFile = 'testLits.h';
12 open(TF, $templateFile);
14 open(OUT, '>'.$outFile);
20 foreach my $line (<TF>) {
21 $line =~ s/\@amount/$amount/g;
23 if ($line =~ /\@forEachRandomString/) {
28 } elsif ($inLoop == 1) {
29 if ($line =~ /\@end/) {
32 for (my $i=0; $i<$amount; $i++) {
33 my $str = randomCString($maxLen);
36 $lt =~ s/\@str/\"$str\"/g;
51 my $len = int(rand($_[0]+1));
55 for (my $i=0; $i<$len; $i++) {
56 my $cn = int(rand(255)) + 1;
58 if ($lastWasHex && ($c =~ /[0-9A-Fa-f]/)) {
60 $str .= sprintf("\\x%02X", $cn);
61 } elsif ($c =~ /[\t\n\013\f\r]/) {
63 $c =~ tr/\t\n\013\f\r/tnvfr/;
65 } elsif ($cn<32 || $cn>126) {
67 $str .= sprintf("\\x%02X", $cn);