Files
regexx/tests/harness.h
T

37 lines
1.5 KiB
C
Raw Normal View History

/* tests/harness.h - shared by hand-written and generated test cases.
* Ground truth for generated cases comes from CPython's own `re`
* module (concept.md Section 11); see gen.py. */
#ifndef REGEXX_TEST_HARNESS_H
#define REGEXX_TEST_HARNESS_H
#include "../regexx.h"
#include <stddef.h>
extern int tc_pass, tc_fail;
/* search/match/fullmatch: exp_spans holds 2*n_spans int64_t values,
* (start,end) for group 0, then group 1, 2, ... in order; -1,-1 means
* the group did not participate (or, for group 0 alone, that
* exp_matched is 0 and no spans are checked). */
void tc_search_family(const char *desc, const char *pat, int flags,
const char *subj, size_t subjlen, int kind,
int exp_matched, int n_spans, const long long *exp_spans);
/* finditer: exp_spans holds 2*n_matches int64_t values, (start,end) of
* the whole match for each match found, in order. */
void tc_finditer(const char *desc, const char *pat, int flags,
const char *subj, size_t subjlen,
int exp_n_matches, const long long *exp_spans);
void tc_sub(const char *desc, const char *pat, int flags,
const char *subj, size_t subjlen, const char *repl, int count,
const char *exp_result, int exp_n);
/* split: texts[i] == NULL means that list element is None in Python. */
void tc_split(const char *desc, const char *pat, int flags,
const char *subj, size_t subjlen, int maxsplit,
int n_items, const char *const *texts);
void harness_report(void);
#endif