Branch Coverage

deps/libgit2/src/util/date.c
Criterion Covered Total %
branch 2 308 0.6


line true false branch
43 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 */
45 0 0 if (month < 0 || month > 11) /* array bounds */
0 0 if (month < 0 || month > 11) /* array bounds */
47 0 0 if (month < 2 || (year + 2) % 4)
0 0 if (month < 2 || (year + 2) % 4)
49 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)
129 0 0 for (i = 0; *date; date++, str++, i++) {
130 0 0 if (*date == *str)
132 0 0 if (toupper(*date) == toupper(*str))
134 0 0 if (!isalnum(*date))
146 0 0 } while (isalpha(date[i]));
157 0 0 for (i = 0; i < 12; i++) {
159 0 0 if (match >= 3) {
165 0 0 for (i = 0; i < 7; i++) {
167 0 0 if (match >= 3) {
173 0 0 for (i = 0; i < ARRAY_SIZE(timezone_names); i++) {
175 0 0 if (match >= 3 || match == strlen(timezone_names[i].name)) {
0 0 if (match >= 3 || match == strlen(timezone_names[i].name)) {
182 0 0 if (*offset == -1)
189 0 0 if (match_string(date, "PM") == 2) {
194 0 0 if (match_string(date, "AM") == 2) {
205 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) {
207 0 0 struct tm *r = (now_tm ? &check : tm);
212 0 0 if (year == -1) {
213 0 0 if (!now_tm)
217 0 0 else if (year >= 1970 && year < 2100)
0 0 else if (year >= 1970 && year < 2100)
219 0 0 else if (year > 70 && year < 100)
0 0 else if (year > 70 && year < 100)
221 0 0 else if (year < 38)
225 0 0 if (!now_tm)
234 0 0 if (now + 10*24*3600 < specified)
238 0 0 if (year != -1)
254 0 0 if (*end == c && isdigit(end[1]))
0 0 if (*end == c && isdigit(end[1]))
260 0 0 if (num3 < 0)
262 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) {
275 0 0 if (p_gmtime_r(&now, &now_tm))
278 0 0 if (num > 70) {
280 0 0 if (is_date(num, num2, num3, refuse_future, now, tm))
283 0 0 if (is_date(num, num3, num2, refuse_future, now, tm))
294 0 0 if (is_date(num3, num2, num, refuse_future, now, tm))
336 0 0 if (num >= 100000000 && nodate(tm)) {
0 0 if (num >= 100000000 && nodate(tm)) {
338 0 0 if (p_gmtime_r(&time, tm)) {
347 0 0 switch (*end) {
352 0 0 if (isdigit(end[1])) {
354 0 0 if (match)
367 0 0 } while (isdigit(date[n]));
370 0 0 if (n == 4) {
371 0 0 if (num <= 1400 && *offset == -1) {
0 0 if (num <= 1400 && *offset == -1) {
375 0 0 } else if (num > 1900 && num < 2100)
0 0 } else if (num > 1900 && num < 2100)
384 0 0 if (n > 2)
394 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) {
400 0 0 if (n == 2 && tm->tm_year < 0) {
0 0 if (n == 2 && tm->tm_year < 0) {
401 0 0 if (num < 10 && tm->tm_mday >= 0) {
0 0 if (num < 10 && tm->tm_mday >= 0) {
405 0 0 if (num >= 70) {
411 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)
424 0 0 if (n == 4) {
428 0 0 } else if (n != 2) {
430 0 0 } else if (*end == ':') {
433 0 0 if (end - (date + 1) != 5)
445 0 0 if (min < 60 && hour < 24) {
0 0 if (min < 60 && hour < 24) {
447 0 0 if (*date == '-')
464 0 0 if (*date < '0' || '9' <= *date)
0 0 if (*date < '0' || '9' <= *date)
467 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] != '-'))
471 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)
474 0 0 if (date[-1] == '-')
490 0 0 if (!timestamp)
492 0 0 if (!offset)
514 0 0 if (!c || c == '\n')
0 0 if (!c || c == '\n')
517 0 0 if (isalpha(c))
519 0 0 else if (isdigit(c))
521 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]))
524 0 0 if (!match) {
534 0 0 if (*offset == -1)
537 0 0 if (*timestamp == (git_time_t)-1)
540 0 0 if (!tm_gmt)
554 0 0 if (tm->tm_mday < 0)
556 0 0 if (tm->tm_mon < 0)
558 0 0 if (tm->tm_year < 0) {
560 0 0 if (tm->tm_mon > now->tm_mon)
583 0 0 if (tm->tm_hour < hour)
615 0 0 if (n) {
630 0 0 if (n) {
685 0 0 while (isalpha(*++end))
688 0 0 for (i = 0; i < 12; i++) {
690 0 0 if (match >= 3) {
697 0 0 for (s = special; s->name; s++) {
699 0 0 if (match_string(date, s->name) == len) {
706 0 0 if (!*num) {
707 0 0 for (i = 1; i < 11; i++) {
709 0 0 if (match_string(date, number_name[i]) == len) {
715 0 0 if (match_string(date, "last") == 4) {
723 0 0 while (tl->type) {
725 0 0 if (match_string(date, tl->type) >= len-1) {
734 0 0 for (i = 0; i < 7; i++) {
736 0 0 if (match >= 3) {
741 0 0 if (diff <= 0)
751 0 0 if (match_string(date, "months") >= 5) {
756 0 0 while (n < 0) {
765 0 0 if (match_string(date, "years") >= 4) {
781 0 0 switch (*end) {
786 0 0 if (isdigit(end[1])) {
788 0 0 if (match)
794 0 0 if (date[0] != '0' || end - date <= 2)
0 0 if (date[0] != '0' || end - date <= 2)
808 0 0 if (number) {
810 0 0 if (tm->tm_mday < 0 && number < 32)
0 0 if (tm->tm_mday < 0 && number < 32)
812 0 0 else if (tm->tm_mon < 0 && number < 13)
0 0 else if (tm->tm_mon < 0 && number < 13)
814 0 0 else if (tm->tm_year < 0) {
815 0 0 if (number > 1969 && number < 2100)
0 0 if (number > 1969 && number < 2100)
817 0 0 else if (number > 69 && number < 100)
0 0 else if (number > 69 && number < 100)
819 0 0 else if (number < 38)
843 0 0 if (!c)
846 0 0 if (isdigit(c)) {
852 0 0 if (isalpha(c))
856 0 0 if (!touched)
867 0 0 if (!parse_date_basic(date, ×tamp, &offset)) {
872 0 0 if (time(&time_sec) == -1)
884 0 3 GIT_ASSERT_ARG(out);
888 0 3 if (p_gmtime_r(&t, &gmt) == NULL)