diff options
Diffstat (limited to 'tests/t_iovec.c')
| -rw-r--r-- | tests/t_iovec.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/t_iovec.c b/tests/t_iovec.c index 89f3fda..2553141 100644 --- a/tests/t_iovec.c +++ b/tests/t_iovec.c | |||
| @@ -18,13 +18,13 @@ static void case_increase_and_length(void) { | |||
| 18 | void *first, *second; | 18 | void *first, *second; |
| 19 | 19 | ||
| 20 | test_case("increase appends an entry and length is their sum"); | 20 | test_case("increase appends an entry and length is their sum"); |
| 21 | first = iovec_increase(&entries, &vector, 100); | 21 | first = iovec_new_chunk(&entries, &vector, 100); |
| 22 | CHECK(first != NULL); | 22 | CHECK(first != NULL); |
| 23 | CHECK_INT(entries, 1); | 23 | CHECK_INT(entries, 1); |
| 24 | CHECK_INT(vector[0].iov_len, 100); | 24 | CHECK_INT(vector[0].iov_len, 100); |
| 25 | CHECK_PTR(vector[0].iov_base, first); | 25 | CHECK_PTR(vector[0].iov_base, first); |
| 26 | 26 | ||
| 27 | second = iovec_increase(&entries, &vector, 50); | 27 | second = iovec_new_chunk(&entries, &vector, 50); |
| 28 | CHECK(second != NULL); | 28 | CHECK(second != NULL); |
| 29 | CHECK_INT(entries, 2); | 29 | CHECK_INT(entries, 2); |
| 30 | CHECK_INT(vector[1].iov_len, 50); | 30 | CHECK_INT(vector[1].iov_len, 50); |
| @@ -38,8 +38,8 @@ static void case_free_resets(void) { | |||
| 38 | struct iovec *vector = NULL; | 38 | struct iovec *vector = NULL; |
| 39 | 39 | ||
| 40 | test_case("free releases the entries and resets the vector"); | 40 | test_case("free releases the entries and resets the vector"); |
| 41 | CHECK(iovec_increase(&entries, &vector, 10) != NULL); | 41 | CHECK(iovec_new_chunk(&entries, &vector, 10) != NULL); |
| 42 | CHECK(iovec_increase(&entries, &vector, 10) != NULL); | 42 | CHECK(iovec_new_chunk(&entries, &vector, 10) != NULL); |
| 43 | iovec_free(&entries, &vector); | 43 | iovec_free(&entries, &vector); |
| 44 | CHECK_INT(entries, 0); | 44 | CHECK_INT(entries, 0); |
| 45 | CHECK_PTR(vector, NULL); | 45 | CHECK_PTR(vector, NULL); |
| @@ -52,12 +52,12 @@ static void case_fixlast_shrinks(void) { | |||
| 52 | char *block; | 52 | char *block; |
| 53 | 53 | ||
| 54 | test_case("fixlast trims the last entry to the bytes actually used"); | 54 | test_case("fixlast trims the last entry to the bytes actually used"); |
| 55 | CHECK(iovec_increase(&entries, &vector, 64) != NULL); | 55 | CHECK(iovec_new_chunk(&entries, &vector, 64) != NULL); |
| 56 | block = iovec_increase(&entries, &vector, 1000); | 56 | block = iovec_new_chunk(&entries, &vector, 1000); |
| 57 | CHECK(block != NULL); | 57 | CHECK(block != NULL); |
| 58 | memset(block, 'x', 20); | 58 | memset(block, 'x', 20); |
| 59 | 59 | ||
| 60 | iovec_fixlast(&entries, &vector, block + 20); | 60 | iovec_trim_last(&entries, &vector, block + 20); |
| 61 | CHECK_INT(entries, 2); | 61 | CHECK_INT(entries, 2); |
| 62 | CHECK_INT(vector[1].iov_len, 20); | 62 | CHECK_INT(vector[1].iov_len, 20); |
| 63 | CHECK_INT(iovec_length(&entries, (const struct iovec **)&vector), 84); | 63 | CHECK_INT(iovec_length(&entries, (const struct iovec **)&vector), 84); |
| @@ -71,7 +71,7 @@ static void case_fixlast_on_empty(void) { | |||
| 71 | struct iovec *vector = NULL; | 71 | struct iovec *vector = NULL; |
| 72 | 72 | ||
| 73 | test_case("fixlast on an empty vector does nothing"); | 73 | test_case("fixlast on an empty vector does nothing"); |
| 74 | iovec_fixlast(&entries, &vector, NULL); | 74 | iovec_trim_last(&entries, &vector, NULL); |
| 75 | CHECK_INT(entries, 0); | 75 | CHECK_INT(entries, 0); |
| 76 | CHECK_PTR(vector, NULL); | 76 | CHECK_PTR(vector, NULL); |
| 77 | } | 77 | } |
| @@ -103,9 +103,9 @@ static void case_fix_increase(void) { | |||
| 103 | char *block; | 103 | char *block; |
| 104 | 104 | ||
| 105 | test_case("fix_increase trims the previous entry and adds a new one"); | 105 | test_case("fix_increase trims the previous entry and adds a new one"); |
| 106 | block = iovec_increase(&entries, &vector, 500); | 106 | block = iovec_new_chunk(&entries, &vector, 500); |
| 107 | CHECK(block != NULL); | 107 | CHECK(block != NULL); |
| 108 | block = iovec_fix_increase_or_free(&entries, &vector, block + 30, 200); | 108 | block = iovec_next_chunk(&entries, &vector, block + 30, 200); |
| 109 | CHECK(block != NULL); | 109 | CHECK(block != NULL); |
| 110 | CHECK_INT(entries, 2); | 110 | CHECK_INT(entries, 2); |
| 111 | CHECK_INT(vector[0].iov_len, 30); | 111 | CHECK_INT(vector[0].iov_len, 30); |
