You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/runner.py
+14-6Lines changed: 14 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1406,26 +1406,34 @@ def test_strndup(self):
1406
1406
int main(int argc, char **argv) {
1407
1407
const char* source = "strndup - duplicate a specific number of bytes from a string";
1408
1408
1409
-
char* strdup_val = strndup(source, 7);
1410
-
printf("%s\\n", strdup_val);
1409
+
char* strdup_val = strndup(source, 0);
1410
+
printf("1:%s\\n", strdup_val);
1411
+
free(strdup_val);
1412
+
1413
+
strdup_val = strndup(source, 7);
1414
+
printf("2:%s\\n", strdup_val);
1411
1415
free(strdup_val);
1412
1416
1413
1417
strdup_val = strndup(source, 1000);
1414
-
printf("%s\\n", strdup_val);
1418
+
printf("3:%s\\n", strdup_val);
1415
1419
free(strdup_val);
1416
1420
1417
1421
strdup_val = strndup(source, 60);
1418
-
printf("%s\\n", strdup_val);
1422
+
printf("4:%s\\n", strdup_val);
1419
1423
free(strdup_val);
1420
1424
1421
1425
strdup_val = strndup(source, 19);
1422
-
printf("%s\\n", strdup_val);
1426
+
printf("5:%s\\n", strdup_val);
1427
+
free(strdup_val);
1428
+
1429
+
strdup_val = strndup(source, -1);
1430
+
printf("6:%s\\n", strdup_val);
1423
1431
free(strdup_val);
1424
1432
1425
1433
return 0;
1426
1434
}
1427
1435
'''
1428
-
self.do_run(src, 'strndup\nstrndup - duplicate a specific number of bytes from a string\nstrndup - duplicate a specific number of bytes from a string\nstrndup - duplicate\n')
1436
+
self.do_run(src, '1:\n2:strndup\n3:strndup - duplicate a specific number of bytes from a string\n4:strndup - duplicate a specific number of bytes from a string\n5:strndup - duplicate\n6:\n')
0 commit comments