Refactor the way we use memory context from isctest.c

This commit renames isctest {mctx,lctx} to test_{mctx,lctx} and cleans
up their usage in the individual unit tests.  This allows embedding
library .c files directly into the unit tests.
This commit is contained in:
Ondřej Surý
2019-11-09 14:01:08 +01:00
parent 229b7d85e8
commit 8de64964a3
17 changed files with 185 additions and 130 deletions

View File

@@ -65,7 +65,7 @@ isc_buffer_reserve_test(void **state) {
UNUSED(state);
b = NULL;
result = isc_buffer_allocate(mctx, &b, 1024);
result = isc_buffer_allocate(test_mctx, &b, 1024);
assert_int_equal(result, ISC_R_SUCCESS);
assert_int_equal(b->length, 1024);
@@ -135,7 +135,7 @@ isc_buffer_dynamic_test(void **state) {
UNUSED(state);
b = NULL;
result = isc_buffer_allocate(mctx, &b, last_length);
result = isc_buffer_allocate(test_mctx, &b, last_length);
assert_int_equal(result, ISC_R_SUCCESS);
assert_non_null(b);
assert_int_equal(b->length, last_length);
@@ -194,7 +194,7 @@ isc_buffer_copyregion_test(void **state) {
UNUSED(state);
result = isc_buffer_allocate(mctx, &b, sizeof(data));
result = isc_buffer_allocate(test_mctx, &b, sizeof(data));
assert_int_equal(result, ISC_R_SUCCESS);
/*
@@ -234,7 +234,7 @@ isc_buffer_printf_test(void **state) {
* Prepare a buffer with auto-reallocation enabled.
*/
b = NULL;
result = isc_buffer_allocate(mctx, &b, 0);
result = isc_buffer_allocate(test_mctx, &b, 0);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_setautorealloc(b, true);