File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,33 @@ static void test_complex_grammar() {
205
205
);
206
206
}
207
207
208
+ static void test_special_chars () {
209
+ // A collection of tests to exercise special characters such as "."
210
+ test_grammar (
211
+ " special characters" ,
212
+ // Grammar
213
+ R"""(
214
+ root ::= ... "abc" ...
215
+ )""" ,
216
+ // Passing strings
217
+ {
218
+ " abcabcabc" ,
219
+ " aaaabcccc" ,
220
+ // NOTE: Also ensures that multi-byte characters still count as a single character
221
+ " π΅π β
abcβπ π΅"
222
+ },
223
+ // Failing strings
224
+ {
225
+ " aaabcccc" ,
226
+ " aaaaabcccc" ,
227
+ " aaaabccc" ,
228
+ " aaaabccccc" ,
229
+ " π΅π β
βabcββ
π π΅"
230
+ " π΅π abcπ π΅"
231
+ }
232
+ );
233
+ }
234
+
208
235
static void test_quantifiers () {
209
236
// A collection of tests to exercise * + and ? quantifiers
210
237
@@ -369,6 +396,7 @@ int main() {
369
396
fprintf (stdout, " Running grammar integration tests...\n " );
370
397
test_simple_grammar ();
371
398
test_complex_grammar ();
399
+ test_special_chars ();
372
400
test_quantifiers ();
373
401
test_failure_missing_root ();
374
402
test_failure_missing_reference ();
You canβt perform that action at this time.
0 commit comments