| 34 | } |
| 35 | |
| 36 | static void test_string(ACL_FILE_HANDLE fd, ssize_t max, int debug) |
| 37 | { |
| 38 | ACL_VSTRING *vp = acl_vstring_mmap_alloc(fd, 1, max); |
| 39 | const char *s = "hello world!"; |
| 40 | |
| 41 | printf("-------------------------------------------------------\r\n"); |
| 42 | incr_string(vp, max - 1, NULL, debug); |
| 43 | |
| 44 | printf("-------------------------------------------------------\r\n"); |
| 45 | incr_string(vp, max - 1 - strlen(s), s, debug); |
| 46 | |
| 47 | printf("-------------------------------------------------------\r\n"); |
| 48 | incr_string(vp, max, NULL, debug); |
| 49 | |
| 50 | printf("-------------------------------------------------------\r\n"); |
| 51 | incr_string(vp, max + 2, NULL, debug); |
| 52 | |
| 53 | printf("-------------------------------------------------------\r\n"); |
| 54 | acl_vstring_strcat(vp, s); |
| 55 | incr_string(vp, max - strlen(s) - 1, NULL, debug); |
| 56 | |
| 57 | printf("-------------------------------------------------------\r\n"); |
| 58 | acl_vstring_strcat(vp, s); |
| 59 | incr_string(vp, max, NULL, debug); |
| 60 | |
| 61 | printf("-------------------------------------------------------\r\n"); |
| 62 | acl_vstring_strcat(vp, s); |
| 63 | incr_string(vp, max + 10, NULL, debug); |
| 64 | |
| 65 | printf(">>>[%s]\r\n", acl_vstring_str(vp)); |
| 66 | printf(">>>len: %ld, %ld, %p, %p\r\n", |
| 67 | (long) strlen(acl_vstring_str(vp)), |
| 68 | (long) ACL_VSTRING_LEN(vp), |
| 69 | acl_vstring_str(vp), acl_vstring_end(vp)); |
| 70 | acl_vstring_free(vp); |
| 71 | } |
| 72 | |
| 73 | static void usage(const char* procname) |
| 74 | { |
no test coverage detected
searching dependent graphs…