|
2 | 2 | from .test_function import f_finite, f_infinite |
3 | 3 |
|
4 | 4 |
|
5 | | -def test_empty_regex(): |
| 5 | +def test_empty_pattern_yields_empty_string(): |
6 | 6 | regexEnumerator = RegexEnumerator(r'') |
7 | 7 | possibilities = [''] |
8 | | - |
9 | 8 | f_finite(regexEnumerator, possibilities) |
10 | 9 |
|
11 | 10 |
|
12 | | -def test_single_literal_char(): |
| 11 | +def test_single_literal_character(): |
13 | 12 | regexEnumerator = RegexEnumerator(r'a') |
14 | 13 | possibilities = ['a'] |
15 | | - |
16 | 14 | f_finite(regexEnumerator, possibilities) |
17 | 15 |
|
18 | 16 |
|
19 | | -def test_zero_or_more_quantifier(): |
| 17 | +def test_zero_or_more_quantifier_on_single_char(): |
20 | 18 | regexEnumerator = RegexEnumerator(r'a*') |
21 | 19 | possibilities = ['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'] |
22 | | - |
23 | 20 | f_infinite(regexEnumerator, possibilities) |
24 | 21 |
|
25 | 22 |
|
26 | | -def test_one_or_more_quantifier(): |
| 23 | +def test_one_or_more_quantifier_on_single_char(): |
27 | 24 | regexEnumerator = RegexEnumerator(r'a+') |
28 | 25 | possibilities = ['a', 'aa', 'aaa', 'aaaa', 'aaaaa'] |
29 | | - |
30 | 26 | f_infinite(regexEnumerator, possibilities) |
31 | 27 |
|
32 | 28 |
|
33 | | -def test_zero_or_one_quantifier(): |
| 29 | +def test_zero_or_one_quantifier_on_single_char(): |
34 | 30 | regexEnumerator = RegexEnumerator(r'a?') |
35 | 31 | possibilities = ['', 'a'] |
36 | | - |
37 | 32 | f_finite(regexEnumerator, possibilities) |
38 | 33 |
|
39 | 34 |
|
40 | | -def test_exact_repetition_quantifier(): |
| 35 | +def test_exact_repetition_quantifier_on_single_char(): |
41 | 36 | regexEnumerator = RegexEnumerator(r'a{2}') |
42 | 37 | possibilities = ['aa'] |
43 | | - |
44 | 38 | f_finite(regexEnumerator, possibilities) |
45 | 39 |
|
46 | 40 |
|
47 | | -def test_min_repetition_quantifier(): |
| 41 | +def test_minimum_repetition_quantifier_on_single_char(): |
48 | 42 | regexEnumerator = RegexEnumerator(r'a{2,}') |
49 | 43 | possibilities = ['aa', 'aaa', 'aaaa', 'aaaaa'] |
50 | | - |
51 | 44 | f_infinite(regexEnumerator, possibilities) |
52 | 45 |
|
53 | 46 |
|
54 | | -def test_min_max_repetition_quantifier(): |
| 47 | +def test_min_max_repetition_quantifier_on_single_char(): |
| 48 | + # `a{2,4}` yields 'aa', 'aaa', 'aaaa'. |
55 | 49 | regexEnumerator = RegexEnumerator(r'a{2,4}') |
56 | 50 | possibilities = ['aa', 'aaa', 'aaaa'] |
57 | | - |
58 | 51 | f_finite(regexEnumerator, possibilities) |
59 | 52 |
|
60 | 53 |
|
61 | | -def test_zero_repetition_quantifier(): |
| 54 | +def test_zero_times_repetition_quantifier_on_single_char(): |
62 | 55 | regexEnumerator = RegexEnumerator(r'a{0}') |
63 | 56 | possibilities = [''] |
64 | | - |
65 | 57 | f_finite(regexEnumerator, possibilities) |
66 | 58 |
|
67 | 59 |
|
68 | | -def test_literal_special_characters(): |
| 60 | +def test_escaped_literal_special_characters(): |
69 | 61 | regexEnumerator = RegexEnumerator(r'\*\+\?') |
70 | 62 | possibilities = ['*+?'] |
| 63 | + f_finite(regexEnumerator, possibilities) |
71 | 64 |
|
| 65 | + |
| 66 | +def test_single_character_class(): |
| 67 | + regexEnumerator = RegexEnumerator(r'[abc]') |
| 68 | + possibilities = ['a', 'b', 'c'] |
72 | 69 | f_finite(regexEnumerator, possibilities) |
73 | 70 |
|
74 | 71 |
|
75 | | -def test_additional_charset(): |
76 | | - regexEnumerator = RegexEnumerator( |
77 | | - r'[^\w\d\s]', additional_charset=['γ', 'β', 'α']) |
78 | | - possibilities = ['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', |
79 | | - ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '`', '{', '|', '}', '~', 'α', 'β', 'γ'] |
| 72 | +def test_single_escaped_character(): |
| 73 | + regexEnumerator = RegexEnumerator(r'\n') |
| 74 | + possibilities = ['\n'] |
| 75 | + f_finite(regexEnumerator, possibilities) |
| 76 | + |
80 | 77 |
|
| 78 | +def test_literal_dot_character(): |
| 79 | + regexEnumerator = RegexEnumerator(r'\.') |
| 80 | + possibilities = ['.'] |
81 | 81 | f_finite(regexEnumerator, possibilities) |
0 commit comments