Branch Coverage

deps/libgit2/src/date.c
Criterion Covered Total %
branch 5 314 1.5


line true false branch
42 0 0 if (year < 0 || year > 129) /* algo only works for 1970-2099 */
0 0 if (year < 0 || year > 129) /* algo only works for 1970-2099 */
44 0 0 if (month < 0 || month > 11) /* array bounds */
0 0 if (month < 0 || month > 11) /* array bounds */
46 0 0 if (month < 2 || (year + 2) % 4)
0 0 if (month < 2 || (year + 2) % 4)
48 0 0 if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_sec < 0)
0 0 if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_sec < 0)
0 0 if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_sec < 0)
128 0 0 for (i = 0; *date; date++, str++, i++) {
129 0 0 if (*date == *str)
131 0 0 if (toupper(*date) == toupper(*str))
133 0 0 if (!isalnum(*date))
145 0 0 } while (isalpha(date[i]));
156 0 0 for (i = 0; i < 12; i++) {
158 0 0 if (match >= 3) {
164 0 0 for (i = 0; i < 7; i++) {
166 0 0 if (match >= 3) {
172 0 0 for (i = 0; i < ARRAY_SIZE(timezone_names); i++) {
174 0 0 if (match >= 3 || match == strlen(timezone_names[i].name)) {
0 0 if (match >= 3 || match == strlen(timezone_names[i].name)) {
181 0 0 if (*offset == -1)
188 0 0 if (match_string(date, "PM") == 2) {
193 0 0 if (match_string(date, "AM") == 2) {
204 0 0 if (month > 0 && month < 13 && day > 0 && day < 32) {
0 0 if (month > 0 && month < 13 && day > 0 && day < 32) {
0 0 if (month > 0 && month < 13 && day > 0 && day < 32) {
0 0 if (month > 0 && month < 13 && day > 0 && day < 32) {
206 0 0 struct tm *r = (now_tm ? &check : tm);
211 0 0 if (year == -1) {
212 0 0 if (!now_tm)
216 0 0 else if (year >= 1970 && year < 2100)
0 0 else if (year >= 1970 && year < 2100)
218 0 0 else if (year > 70 && year < 100)
0 0 else if (year > 70 && year < 100)
220 0 0 else if (year < 38)
224 0 0 if (!now_tm)
233 0 0 if (now + 10*24*3600 < specified)
237 0 0 if (year != -1)
253 0 0 if (*end == c && isdigit(end[1]))
0 0 if (*end == c && isdigit(end[1]))
259 0 0 if (num3 < 0)
261 0 0 if (num < 25 && num2 >= 0 && num2 < 60 && num3 >= 0 && num3 <= 60) {
0 0 if (num < 25 && num2 >= 0 && num2 < 60 && num3 >= 0 && num3 <= 60) {
0 0 if (num < 25 && num2 >= 0 && num2 < 60 && num3 >= 0 && num3 <= 60) {
0 0 if (num < 25 && num2 >= 0 && num2 < 60 && num3 >= 0 && num3 <= 60) {
0 0 if (num < 25 && num2 >= 0 && num2 < 60 && num3 >= 0 && num3 <= 60) {
274 0 0 if (p_gmtime_r(&now, &now_tm))
277 0 0 if (num > 70) {
279 0 0 if (is_date(num, num2, num3, refuse_future, now, tm))
282 0 0 if (is_date(num, num3, num2, refuse_future, now, tm))
293 0 0 if (is_date(num3, num2, num, refuse_future, now, tm))
335 0 0 if (num >= 100000000 && nodate(tm)) {
0 0 if (num >= 100000000 && nodate(tm)) {
337 0 0 if (p_gmtime_r(&time, tm)) {
346 0 0 switch (*end) {
351 0 0 if (isdigit(end[1])) {
353 0 0 if (match)
366 0 0 } while (isdigit(date[n]));
369 0 0 if (n == 4) {
370 0 0 if (num <= 1400 && *offset == -1) {
0 0 if (num <= 1400 && *offset == -1) {
374 0 0 } else if (num > 1900 && num < 2100)
0 0 } else if (num > 1900 && num < 2100)
383 0 0 if (n > 2)
393 0 0 if (num > 0 && num < 32 && tm->tm_mday < 0) {
0 0 if (num > 0 && num < 32 && tm->tm_mday < 0) {
0 0 if (num > 0 && num < 32 && tm->tm_mday < 0) {
399 0 0 if (n == 2 && tm->tm_year < 0) {
0 0 if (n == 2 && tm->tm_year < 0) {
400 0 0 if (num < 10 && tm->tm_mday >= 0) {
0 0 if (num < 10 && tm->tm_mday >= 0) {
404 0 0 if (num >= 70) {
410 0 0 if (num > 0 && num < 13 && tm->tm_mon < 0)
0 0 if (num > 0 && num < 13 && tm->tm_mon < 0)
0 0 if (num > 0 && num < 13 && tm->tm_mon < 0)
423 0 0 if (n == 4) {
427 0 0 } else if (n != 2) {
429 0 0 } else if (*end == ':') {
432 0 0 if (end - (date + 1) != 5)
444 0 0 if (min < 60 && hour < 24) {
0 0 if (min < 60 && hour < 24) {
446 0 0 if (*date == '-')
463 0 0 if (*date < '0' || '9' <= *date)
0 0 if (*date < '0' || '9' <= *date)
466 0 0 if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
0 0 if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
0 0 if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
0 0 if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
470 0 0 if ((*end != '\0' && (*end != '\n')) || end != date + 4)
0 0 if ((*end != '\0' && (*end != '\n')) || end != date + 4)
0 0 if ((*end != '\0' && (*end != '\n')) || end != date + 4)
473 0 0 if (date[-1] == '-')
489 0 0 if (!timestamp)
491 0 0 if (!offset)
513 0 0 if (!c || c == '\n')
0 0 if (!c || c == '\n')
516 0 0 if (isalpha(c))
518 0 0 else if (isdigit(c))
520 0 0 else if ((c == '-' || c == '+') && isdigit(date[1]))
0 0 else if ((c == '-' || c == '+') && isdigit(date[1]))
0 0 else if ((c == '-' || c == '+') && isdigit(date[1]))
523 0 0 if (!match) {
533 0 0 if (*offset == -1)
536 0 0 if (*timestamp == (git_time_t)-1)
539 0 0 if (!tm_gmt)
553 0 0 if (tm->tm_mday < 0)
555 0 0 if (tm->tm_mon < 0)
557 0 0 if (tm->tm_year < 0) {
559 0 0 if (tm->tm_mon > now->tm_mon)
582 0 0 if (tm->tm_hour < hour)
614 0 0 if (n) {
629 0 0 if (n) {
684 0 0 while (isalpha(*++end))
687 0 0 for (i = 0; i < 12; i++) {
689 0 0 if (match >= 3) {
696 0 0 for (s = special; s->name; s++) {
698 0 0 if (match_string(date, s->name) == len) {
705 0 0 if (!*num) {
706 0 0 for (i = 1; i < 11; i++) {
708 0 0 if (match_string(date, number_name[i]) == len) {
714 0 0 if (match_string(date, "last") == 4) {
722 0 0 while (tl->type) {
724 0 0 if (match_string(date, tl->type) >= len-1) {
733 0 0 for (i = 0; i < 7; i++) {
735 0 0 if (match >= 3) {
740 0 0 if (diff <= 0)
750 0 0 if (match_string(date, "months") >= 5) {
755 0 0 while (n < 0) {
764 0 0 if (match_string(date, "years") >= 4) {
780 0 0 switch (*end) {
785 0 0 if (isdigit(end[1])) {
787 0 0 if (match)
793 0 0 if (date[0] != '0' || end - date <= 2)
0 0 if (date[0] != '0' || end - date <= 2)
807 0 0 if (number) {
809 0 0 if (tm->tm_mday < 0 && number < 32)
0 0 if (tm->tm_mday < 0 && number < 32)
811 0 0 else if (tm->tm_mon < 0 && number < 13)
0 0 else if (tm->tm_mon < 0 && number < 13)
813 0 0 else if (tm->tm_year < 0) {
814 0 0 if (number > 1969 && number < 2100)
0 0 if (number > 1969 && number < 2100)
816 0 0 else if (number > 69 && number < 100)
0 0 else if (number > 69 && number < 100)
818 0 0 else if (number < 38)
842 0 0 if (!c)
845 0 0 if (isdigit(c)) {
851 0 0 if (isalpha(c))
855 0 0 if (!touched)
866 0 0 if (!parse_date_basic(date, ×tamp, &offset)) {
871 0 0 if (time(&time_sec) == -1)
884 3 0 assert(out && date);
0 3 assert(out && date);
888 0 3 if (p_gmtime_r (&t, &gmt) == NULL)
899 3 0 if (written < 0 || (written > (int) len - 1))
0 3 if (written < 0 || (written > (int) len - 1))