test: started porting cron tests
This commit is contained in:
parent
c018d8d86c
commit
30e086ad6b
6 changed files with 97 additions and 119 deletions
|
|
@ -7,16 +7,16 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
typedef enum cron_parse_error {
|
||||
cron_parse_ok = 0,
|
||||
cron_parse_invalid_expression = 1,
|
||||
cron_parse_invalid_number = 2,
|
||||
cron_parse_out_of_range = 3,
|
||||
cron_parse_too_many_parts = 4,
|
||||
cron_parse_not_enough_parts = 5
|
||||
} cron_parse_error;
|
||||
typedef enum vieter_cron_parse_error {
|
||||
vieter_cron_parse_ok = 0,
|
||||
vieter_cron_parse_invalid_expression = 1,
|
||||
vieter_cron_parse_invalid_number = 2,
|
||||
vieter_cron_parse_out_of_range = 3,
|
||||
vieter_cron_parse_too_many_parts = 4,
|
||||
vieter_cron_parse_not_enough_parts = 5
|
||||
} vieter_cron_parse_error;
|
||||
|
||||
typedef struct cron_expression {
|
||||
typedef struct vieter_cron_expression {
|
||||
uint8_t *minutes;
|
||||
uint8_t *hours;
|
||||
uint8_t *days;
|
||||
|
|
@ -25,26 +25,29 @@ typedef struct cron_expression {
|
|||
uint8_t hour_count;
|
||||
uint8_t day_count;
|
||||
uint8_t month_count;
|
||||
} cron_expression;
|
||||
} vieter_cron_expression;
|
||||
|
||||
typedef struct cron_simple_time {
|
||||
typedef struct vieter_cron_simple_time {
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
int hour;
|
||||
int minute;
|
||||
} cron_simple_time;
|
||||
} vieter_cron_simple_time;
|
||||
|
||||
cron_expression *ce_init();
|
||||
vieter_cron_expression *ce_init();
|
||||
|
||||
void cron_ce_free(cron_expression *ce);
|
||||
void vieter_cron_ce_free(vieter_cron_expression *ce);
|
||||
|
||||
void cron_ce_next(cron_simple_time *out, cron_expression *ce,
|
||||
cron_simple_time *ref);
|
||||
void vieter_cron_ce_next(vieter_cron_simple_time *out,
|
||||
vieter_cron_expression *ce,
|
||||
vieter_cron_simple_time *ref);
|
||||
|
||||
void cron_ce_next_from_now(cron_simple_time *out, cron_expression *ce);
|
||||
void vieter_cron_ce_next_from_now(vieter_cron_simple_time *out,
|
||||
vieter_cron_expression *ce);
|
||||
|
||||
enum cron_parse_error cron_ce_parse_expression(cron_expression *out,
|
||||
const char *expression);
|
||||
enum vieter_cron_parse_error
|
||||
vieter_cron_parse_expression(vieter_cron_expression *out,
|
||||
const char *expression);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Reference in a new issue