Branch Coverage

t/lib/MyTest.xs
Criterion Covered Total %
branch 3 306 0.9


line true false branch
28 0 0 if (ix == 0) RETVAL = SYSTIMEGM(&date);
35 2 0 localtime(epoch, &date);
36 2 0 auto sz = strftime(buf, sizeof(buf), fmt, &date);
37 0 2 if (!sz) croak("should not happen");
47 0 0 string tzname = ix == 0 ? string("GMT") : tzlocal()->name;
0 0 string tzname = ix == 0 ? string("GMT") : tzlocal()->name;
0 0 string tzname = ix == 0 ? string("GMT") : tzlocal()->name;
0 0 string tzname = ix == 0 ? string("GMT") : tzlocal()->name;
0 0 string tzname = ix == 0 ? string("GMT") : tzlocal()->name;
49 0 0 bool test = (hstr != NULL && strlen(hstr) > 0);
0 0 bool test = (hstr != NULL && strlen(hstr) > 0);
52 0 0 if (!sranded) { srand(time(NULL)); sranded = true; }
56 0 0 if (step == 0) {
64 0 0 for (ptime_t i = from; i < till; i += step) {
69 0 0 if (isrand) epoch = rand() % (2*disperse) - disperse;
73 0 0 if (ix == 0) {
74 0 0 gmtime(epoch, &date1);
77 0 0 localtime(epoch, &date1);
81 0 0 if (cnt % 100000 == 0 && !test) printf("TESTED #%d, last %04i-%02i-%02i %02i:%02i:%02i (off:%ld, dst=%d, zone=%s)\n", cnt, date2.tm_year+1900, date2.tm_mon+1, date2.tm_mday, date2.tm_hour, date2.tm_min, date2.tm_sec, date2.tm_gmtoff, date2.tm_isdst, date2.tm_zone);
0 0 if (cnt % 100000 == 0 && !test) printf("TESTED #%d, last %04i-%02i-%02i %02i:%02i:%02i (off:%ld, dst=%d, zone=%s)\n", cnt, date2.tm_year+1900, date2.tm_mon+1, date2.tm_mday, date2.tm_hour, date2.tm_min, date2.tm_sec, date2.tm_gmtoff, date2.tm_isdst, date2.tm_zone);
0 0 if (cnt % 100000 == 0 && !test) printf("TESTED #%d, last %04i-%02i-%02i %02i:%02i:%02i (off:%ld, dst=%d, zone=%s)\n", cnt, date2.tm_year+1900, date2.tm_mon+1, date2.tm_mday, date2.tm_hour, date2.tm_min, date2.tm_sec, date2.tm_gmtoff, date2.tm_isdst, date2.tm_zone);
83 0 0 if (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday ||
0 0 if (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday ||
0 0 if (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday ||
0 0 if (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday ||
84 0 0 date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec ||
0 0 date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec ||
0 0 date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec ||
85 0 0 date1.isdst != date2.tm_isdst || date1.gmtoff != date2.tm_gmtoff || strcmp(date1.zone, date2.tm_zone) != 0) {
0 0 date1.isdst != date2.tm_isdst || date1.gmtoff != date2.tm_gmtoff || strcmp(date1.zone, date2.tm_zone) != 0) {
93 0 0 );
98 0 0 if (!test) printf("TESTED %d TIMES\n", cnt);
0 0 if (!test) printf("TESTED %d TIMES\n", cnt);
108 0 0 bool test = (hstr != NULL && strlen(hstr) > 0);
0 0 bool test = (hstr != NULL && strlen(hstr) > 0);
111 0 0 if (!sranded) { srand(time(NULL)); sranded = true; }
115 0 0 if (step == 0) {
119 0 0 if (disperce_years > 200) disperce_years = 200;
124 0 0 for (ptime_t i = from; step > 0 ? (i < till) : (i > till); i += step) {
0 0 for (ptime_t i = from; step > 0 ? (i < till) : (i > till); i += step) {
129 0 0 if (isrand) {
130 0 0 if (ix == 0) {
159 0 0 if (ix == 0) gmtime(i, &date1);
0 0 if (ix == 0) gmtime(i, &date1);
160 0 0 else localtime(i, &date1);
163 0 0 if (ix == 1) date1.isdst = -1;
171 0 0 if (ix == 0) {
173 0 0 if (isrand) mytime = timegm(&date1); // need normalization
0 0 if (isrand) mytime = timegm(&date1); // need normalization
174 0 0 else mytime = timegml(&date1);
176 0 0 mytime = timelocal(&date1);
180 0 0 if (cnt % 100000 == 0 && !test) printf("TESTED #%d, last %04d-%02d-%02d %02d:%02d:%02d\n", cnt, date2.tm_year+1900, date2.tm_mon+1, date2.tm_mday, date2.tm_hour, date2.tm_min, date2.tm_sec);
0 0 if (cnt % 100000 == 0 && !test) printf("TESTED #%d, last %04d-%02d-%02d %02d:%02d:%02d\n", cnt, date2.tm_year+1900, date2.tm_mon+1, date2.tm_mday, date2.tm_hour, date2.tm_min, date2.tm_sec);
0 0 if (cnt % 100000 == 0 && !test) printf("TESTED #%d, last %04d-%02d-%02d %02d:%02d:%02d\n", cnt, date2.tm_year+1900, date2.tm_mon+1, date2.tm_mday, date2.tm_hour, date2.tm_min, date2.tm_sec);
182 0 0 bool same_ymdhms = (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday || date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec) ? false : true;
0 0 bool same_ymdhms = (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday || date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec) ? false : true;
0 0 bool same_ymdhms = (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday || date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec) ? false : true;
0 0 bool same_ymdhms = (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday || date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec) ? false : true;
0 0 bool same_ymdhms = (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday || date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec) ? false : true;
0 0 bool same_ymdhms = (date1.year != (date2.tm_year + 1900) || date1.mon != date2.tm_mon || date1.mday != date2.tm_mday || date1.hour != date2.tm_hour || date1.min != date2.tm_min || date1.sec != date2.tm_sec) ? false : true;
183 0 0 bool same_zone = (date1.isdst != date2.tm_isdst || date1.gmtoff != date2.tm_gmtoff || strcmp(date1.zone, date2.tm_zone) != 0) ? false : true;
0 0 bool same_zone = (date1.isdst != date2.tm_isdst || date1.gmtoff != date2.tm_gmtoff || strcmp(date1.zone, date2.tm_zone) != 0) ? false : true;
0 0 bool same_zone = (date1.isdst != date2.tm_isdst || date1.gmtoff != date2.tm_gmtoff || strcmp(date1.zone, date2.tm_zone) != 0) ? false : true;
184 0 0 bool same_date = same_ymdhms && same_zone;
0 0 bool same_date = same_ymdhms && same_zone;
186 0 0 if (mytime != truetime || !same_date) {
0 0 if (mytime != truetime || !same_date) {
187 0 0 if (truetime == -1) continue; // OS cannot handle such dates
189 0 0 if (same_ymdhms && ix == 1) { // if ambiguity, OS may return unpredicted results. Lets handle that.
0 0 if (same_ymdhms && ix == 1) { // if ambiguity, OS may return unpredicted results. Lets handle that.
192 0 0 mytime = timelocal(&tmpdate);
193 0 0 if (mytime == truetime) continue;
202 0 0 copy1.isdst, (int)tzlocal()->name.length(), tzlocal()->name.data()
0 0 copy1.isdst, (int)tzlocal()->name.length(), tzlocal()->name.data()
203 0 0 );
207 0 0 copy2.tm_year+1900, copy2.tm_mon+1, copy2.tm_mday, copy2.tm_hour, copy2.tm_min, copy2.tm_sec, copy2.tm_isdst, (int)tzlocal()->name.length(), tzlocal()->name.data()
0 0 copy2.tm_year+1900, copy2.tm_mon+1, copy2.tm_mday, copy2.tm_hour, copy2.tm_min, copy2.tm_sec, copy2.tm_isdst, (int)tzlocal()->name.length(), tzlocal()->name.data()
208 0 0 );
209 0 0 warn("diff is %lli", (long long)(mytime - truetime));
214 0 0 if (!test) printf("TESTED %d TIMES\n", cnt);
0 0 if (!test) printf("TESTED %d TIMES\n", cnt);
222 0 0 if (ix == 0) while(epoch++ < max_epoch) gmtime(epoch, &date);
0 0 if (ix == 0) while(epoch++ < max_epoch) gmtime(epoch, &date);
0 0 if (ix == 0) while(epoch++ < max_epoch) gmtime(epoch, &date);
223 0 0 else if (ix == 1) while(epoch++ < max_epoch) localtime(epoch, &date);
0 0 else if (ix == 1) while(epoch++ < max_epoch) localtime(epoch, &date);
0 0 else if (ix == 1) while(epoch++ < max_epoch) localtime(epoch, &date);
225 0 0 RETVAL = Array::create();
226 0 0 RETVAL.push(Simple(date.sec));
0 0 RETVAL.push(Simple(date.sec));
227 0 0 RETVAL.push(Simple(date.min));
0 0 RETVAL.push(Simple(date.min));
228 0 0 RETVAL.push(Simple(date.hour));
0 0 RETVAL.push(Simple(date.hour));
229 0 0 RETVAL.push(Simple(date.mday));
0 0 RETVAL.push(Simple(date.mday));
230 0 0 RETVAL.push(Simple(date.mon));
0 0 RETVAL.push(Simple(date.mon));
231 0 0 RETVAL.push(Simple(date.year));
0 0 RETVAL.push(Simple(date.year));
232 0 0 RETVAL.push(Simple(date.wday));
0 0 RETVAL.push(Simple(date.wday));
233 0 0 RETVAL.push(Simple(date.yday));
0 0 RETVAL.push(Simple(date.yday));
234 0 0 RETVAL.push(Simple(date.isdst));
0 0 RETVAL.push(Simple(date.isdst));
235 0 0 RETVAL.push(Simple(date.gmtoff));
0 0 RETVAL.push(Simple(date.gmtoff));
236 0 0 RETVAL.push(Simple(date.zone));
0 0 RETVAL.push(Simple(date.zone));
242 0 0 if (ix == 0) while(epoch++ < max_epoch) gmtime_r(&epoch, &date);
0 0 if (ix == 0) while(epoch++ < max_epoch) gmtime_r(&epoch, &date);
243 0 0 else if (ix == 1) while(epoch++ < max_epoch) localtime_r(&epoch, &date);
0 0 else if (ix == 1) while(epoch++ < max_epoch) localtime_r(&epoch, &date);
245 0 0 RETVAL = Array::create();
246 0 0 RETVAL.push(Simple(date.tm_sec));
0 0 RETVAL.push(Simple(date.tm_sec));
247 0 0 RETVAL.push(Simple(date.tm_min));
0 0 RETVAL.push(Simple(date.tm_min));
248 0 0 RETVAL.push(Simple(date.tm_hour));
0 0 RETVAL.push(Simple(date.tm_hour));
249 0 0 RETVAL.push(Simple(date.tm_mday));
0 0 RETVAL.push(Simple(date.tm_mday));
250 0 0 RETVAL.push(Simple(date.tm_mon));
0 0 RETVAL.push(Simple(date.tm_mon));
251 0 0 RETVAL.push(Simple(date.tm_year));
0 0 RETVAL.push(Simple(date.tm_year));
252 0 0 RETVAL.push(Simple(date.tm_wday));
0 0 RETVAL.push(Simple(date.tm_wday));
253 0 0 RETVAL.push(Simple(date.tm_yday));
0 0 RETVAL.push(Simple(date.tm_yday));
254 0 0 RETVAL.push(Simple(date.tm_isdst));
0 0 RETVAL.push(Simple(date.tm_isdst));
255 0 0 RETVAL.push(Simple(date.tm_gmtoff));
0 0 RETVAL.push(Simple(date.tm_gmtoff));
256 0 0 RETVAL.push(Simple(date.tm_zone));
0 0 RETVAL.push(Simple(date.tm_zone));
273 0 0 if (ix == 0) while (i++ < cnt) RETVAL += timegm(&date);
0 0 if (ix == 0) while (i++ < cnt) RETVAL += timegm(&date);
0 0 if (ix == 0) while (i++ < cnt) RETVAL += timegm(&date);
274 0 0 else if (ix == 1) while (i++ < cnt) RETVAL += timegml(&date);
0 0 else if (ix == 1) while (i++ < cnt) RETVAL += timegml(&date);
0 0 else if (ix == 1) while (i++ < cnt) RETVAL += timegml(&date);
275 0 0 else if (ix == 2) while (i++ < cnt) RETVAL += timelocal(&date);
0 0 else if (ix == 2) while (i++ < cnt) RETVAL += timelocal(&date);
0 0 else if (ix == 2) while (i++ < cnt) RETVAL += timelocal(&date);
276 0 0 else if (ix == 3) while (i++ < cnt) RETVAL += timelocall(&date);
0 0 else if (ix == 3) while (i++ < cnt) RETVAL += timelocall(&date);
0 0 else if (ix == 3) while (i++ < cnt) RETVAL += timelocall(&date);
293 0 0 if (ix == 0) while (i++ < cnt) RETVAL += timegm(&date);
0 0 if (ix == 0) while (i++ < cnt) RETVAL += timegm(&date);
294 0 0 else if (ix == 1) while (i++ < cnt) RETVAL += timelocal(&date);
0 0 else if (ix == 1) while (i++ < cnt) RETVAL += timelocal(&date);