Branch Coverage

Easy_XS.xs
Criterion Covered Total %
branch 112 136 82.3


line true false branch
38 13 5 for (i = 0; i < items; i++) {
41 0 13 if (SvROK(ST(i))) croak("not a string");
43 1 12 if (SvUTF8(ST(i))) isutf8 = YES;
46 1 12 if (svt == SVt_NULL) {
52 7 5 char *string = SvPV(ST(i), length);
53 0 12 if (string == NULL) croak("could not find a string for argument %d", i + 1);
56 1 11 if (length == 0) {
65 40 11 for (ptr = string; *ptr != '\0'; ptr++) {
66 34 6 if (!isdigit(*ptr)) {
72 35 5 if (csvtype == CSV_STRING && *ptr == '"') length++;
2 33 if (csvtype == CSV_STRING && *ptr == '"') length++;
79 6 5 if (csvtype == CSV_STRING) finallength += 2; // beginning and trailing quote
90 13 5 for (i = 0; i < items; i++) {
92 8 5 if (i != 0) {
99 7 6 if (field.type == CSV_STRING) *optr++ = '"';
101 11 2 if (field.string != NULL) {
103 40 11 for (ptr = field.string; *ptr != '\0'; ptr++) {
107 2 38 if (*ptr == '"') {
114 7 6 if (field.type == CSV_STRING) *optr++ = '"';
122 1 4 if (isutf8) SvUTF8_on(retval);
134 0 25 if (SvROK(string)) croak("not a string");
138 25 0 char *str = SvPV(string, len);
139 0 25 if (len == 0) XSRETURN(0);
149 214 13 for ( ptr = str; *ptr != '\0'; ptr++ ) {
150 53 161 if ( field == NULL ) {
156 19 34 if (*ptr == '"') {
163 1 33 else if (*ptr == ',') {
164 1 0 EXTEND( SP, st_pos + 1 );
0 1 EXTEND( SP, st_pos + 1 );
170 1 32 else if (
171 0 1 ( *ptr == '\n' && *(ptr+1) == '\0' )
172 3 29 || ( *ptr == '\r' && *(ptr+1) == '\n' && *(ptr+2) == '\0' )
3 0 || ( *ptr == '\r' && *(ptr+1) == '\n' && *(ptr+2) == '\0' )
3 0 || ( *ptr == '\r' && *(ptr+1) == '\n' && *(ptr+2) == '\0' )
184 100 90 if ( !quoted ) {
187 21 0 EXTEND( SP, st_pos + 1 );
0 21 EXTEND( SP, st_pos + 1 );
196 2 1 if (*(ptr+1) == '\0') {
198 2 0 if (ptr > field && *(ptr-1) == '\r') {
1 1 if (ptr > field && *(ptr-1) == '\r') {
217 26 64 if ( *ptr == '"' ) {
219 8 18 if ( *(ptr + 1) == '"' ) {
225 14 4 else if ( *(ptr + 1) == ','
226 5 9 || *(ptr + 1) == '\0'
227 2 3 || ( *(ptr + 1) == '\n' && *(ptr + 2) == '\0' ) // trailing newline
0 2 || ( *(ptr + 1) == '\n' && *(ptr + 2) == '\0' ) // trailing newline
228 2 1 || ( *(ptr + 1) == '\r' && *(ptr + 2) == '\n' && *(ptr + 3) == '\0' ) // trailing CRLF
2 0 || ( *(ptr + 1) == '\r' && *(ptr + 2) == '\n' && *(ptr + 3) == '\0' ) // trailing CRLF
2 0 || ( *(ptr + 1) == '\r' && *(ptr + 2) == '\n' && *(ptr + 3) == '\0' ) // trailing CRLF
230 13 4 if (!requires_unescape) {
233 2 11 if (isutf8) SvUTF8_on(tmp);
234 13 0 EXTEND( SP, st_pos + 1 );
0 13 EXTEND( SP, st_pos + 1 );
246 34 4 for (i = 0, fieldptr = field; fieldptr < ptr; fieldptr++) {
248 8 26 if (*fieldptr == '"') {
255 1 3 if (isutf8) SvUTF8_on(tmpsv);
256 4 0 EXTEND( SP, st_pos + 1 );
0 4 EXTEND( SP, st_pos + 1 );
265 2 15 if (*(ptr+1) == '\n') break;
268 4 11 if (*(ptr+1) == ',') ptr++;
285 6 15 if (field != NULL && !quoted) {
5 1 if (field != NULL && !quoted) {
286 5 0 EXTEND( SP, st_pos + 1 );
0 5 EXTEND( SP, st_pos + 1 );
290 1 15 else if (field != NULL) {
294 2 13 else if (*(ptr-1) == ',') {
295 2 0 EXTEND( SP, st_pos + 1 );
0 2 EXTEND( SP, st_pos + 1 );