libvieter/test/cron/test_parse.c

39 lines
745 B
C
Raw Permalink Normal View History

#include "acutest.h"
#include "vieter_cron.h"
void test_illegal_expressions() {
2023-01-18 13:53:50 +01:00
char *expressions[] = {
"4 *-7",
"4 *-7/4",
"4 7/*",
"0 0 30 2",
"0 /5",
"0 ",
"0",
" 0",
" 0 ",
"1 2 3 4~9",
"1 1-3-5",
"0 5/2-5",
"",
"1 1/2/3",
"*5 8",
"x 8",
NULL
};
int i = 0;
while (expressions[i] != NULL) {
vieter_cron_expression out;
2023-01-18 14:12:02 +01:00
TEST_CHECK_(vieter_cron_expr_parse(&out, expressions[i]) != vieter_cron_parse_ok, "%s should error", expressions[i]);
2023-01-18 13:53:50 +01:00
i++;
}
}
2023-01-18 13:53:50 +01:00
TEST_LIST = {
{"cron illegal expressions", test_illegal_expressions},
2023-01-18 13:53:50 +01:00
{NULL, NULL}
};