if (0 == char_op_switch && !last_was_op)
{
last_was_op = 1;
- rx_exp = rand () % 3;
+ rx_exp = rand () % 4;
switch (rx_exp)
{
current_char = '*';
break;
case 2:
+ current_char = '?';
+ break;
+ case 3:
if (i < rx_length - 1) // '|' cannot be at the end
current_char = '|';
else
last_was_op = 0;
}
- if (current_char != '+' && current_char != '*' && current_char != '|')
+ if (current_char != '+' && current_char != '*' && current_char != '?' &&
+ current_char != '|')
{
*matching_strp = current_char;
matching_strp++;
{"k|a+X*y+c|Q*e|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*g|N+V|t+L|P*j*3*9+X*h*J|J*6|b|E*i*f*R+S|Z|R|Y*Z|g*", 1,
{"kaXycQepRZKyRwY6nhkwVFWBegNVtLPj39XhJJ6bEifRSZRYZg"},
{nomatch}},
- {"k|a+X*y+c|Q*e|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*g|N+V|t+L|P*j*3*9+X*h*J|J*6|b|E*i*f*R+S|Z|R|Y*Z|g*", 1,
- {"kaXycQepRZKyRwY6nhkwVFWBegNVtLPj39XhJJ6bEifRSZRYZg"},
- {nomatch}}
+ {"ab?(abcd)?", 5,
+ {"ababcd", "abab", "aabcd", "a", "abb"},
+ {match, nomatch, match, match, nomatch}}
};
check_nfa = 0;
srand (time (NULL));
for (i = 0; i < 100; i++)
- check_rand += test_random (100, 150, 10);
+ check_rand += test_random (200, 250, 20);
return check_nfa + check_dfa + check_rand;
}