aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/transport/chttp2
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-12-22 13:49:30 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-12-22 13:49:30 -0800
commit7536af02cf218f8dcb1368bec6d86c65db95c9b4 (patch)
treecd560e1321aed28504aca5358dabbf49692a0956 /test/core/transport/chttp2
parent2d2963e5e919128929e8a62a17fbbc9f3fd684d9 (diff)
Eliminate gpr_ int types - and insist on C99 variants instead
Diffstat (limited to 'test/core/transport/chttp2')
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c6
-rw-r--r--test/core/transport/chttp2/stream_map_test.c50
-rw-r--r--test/core/transport/chttp2/varint_test.c7
3 files changed, 31 insertions, 32 deletions
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index fde352433b..39f4174eec 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -51,7 +51,7 @@ static void assert_str(const grpc_chttp2_hptbl *tbl, grpc_mdstr *mdstr,
GPR_ASSERT(gpr_slice_str_cmp(mdstr->slice, str) == 0);
}
-static void assert_index(const grpc_chttp2_hptbl *tbl, gpr_uint32 idx,
+static void assert_index(const grpc_chttp2_hptbl *tbl, uint32_t idx,
const char *key, const char *value) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(tbl, idx);
assert_str(tbl, md->key, key);
@@ -172,7 +172,7 @@ static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl *tbl,
static void test_find(void) {
grpc_chttp2_hptbl tbl;
- gpr_uint32 i;
+ uint32_t i;
char buffer[32];
grpc_mdelem *elem;
grpc_chttp2_hptbl_find_result r;
@@ -255,7 +255,7 @@ static void test_find(void) {
GPR_ASSERT(r.has_value == 1);
for (i = 0; i < tbl.num_ents; i++) {
- gpr_uint32 expect = 9999 - i;
+ uint32_t expect = 9999 - i;
gpr_ltoa(expect, buffer);
r = find_simple(&tbl, "test", buffer);
diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.c
index 81fb80f84f..527d2fe0ae 100644
--- a/test/core/transport/chttp2/stream_map_test.c
+++ b/test/core/transport/chttp2/stream_map_test.c
@@ -82,9 +82,9 @@ static void test_double_deletion(void) {
}
/* test add & lookup */
-static void test_basic_add_find(gpr_uint32 n) {
+static void test_basic_add_find(uint32_t n) {
grpc_chttp2_stream_map map;
- gpr_uint32 i;
+ uint32_t i;
size_t got;
LOG_TEST("test_basic_add_find");
@@ -93,36 +93,36 @@ static void test_basic_add_find(gpr_uint32 n) {
grpc_chttp2_stream_map_init(&map, 8);
GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map));
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i);
}
GPR_ASSERT(n == grpc_chttp2_stream_map_size(&map));
GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 0));
GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, n + 1));
for (i = 1; i <= n; i++) {
- got = (gpr_uintptr)grpc_chttp2_stream_map_find(&map, i);
+ got = (uintptr_t)grpc_chttp2_stream_map_find(&map, i);
GPR_ASSERT(i == got);
}
grpc_chttp2_stream_map_destroy(&map);
}
/* verify that for_each gets the right values during test_delete_evens_XXX */
-static void verify_for_each(void *user_data, gpr_uint32 stream_id, void *ptr) {
- gpr_uint32 *for_each_check = user_data;
+static void verify_for_each(void *user_data, uint32_t stream_id, void *ptr) {
+ uint32_t *for_each_check = user_data;
GPR_ASSERT(ptr);
GPR_ASSERT(*for_each_check == stream_id);
*for_each_check += 2;
}
-static void check_delete_evens(grpc_chttp2_stream_map *map, gpr_uint32 n) {
- gpr_uint32 for_each_check = 1;
- gpr_uint32 i;
+static void check_delete_evens(grpc_chttp2_stream_map *map, uint32_t n) {
+ uint32_t for_each_check = 1;
+ uint32_t i;
size_t got;
GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(map, 0));
GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(map, n + 1));
for (i = 1; i <= n; i++) {
if (i & 1) {
- got = (gpr_uintptr)grpc_chttp2_stream_map_find(map, i);
+ got = (uintptr_t)grpc_chttp2_stream_map_find(map, i);
GPR_ASSERT(i == got);
} else {
GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(map, i));
@@ -139,20 +139,20 @@ static void check_delete_evens(grpc_chttp2_stream_map *map, gpr_uint32 n) {
/* add a bunch of keys, delete the even ones, and make sure the map is
consistent */
-static void test_delete_evens_sweep(gpr_uint32 n) {
+static void test_delete_evens_sweep(uint32_t n) {
grpc_chttp2_stream_map map;
- gpr_uint32 i;
+ uint32_t i;
LOG_TEST("test_delete_evens_sweep");
gpr_log(GPR_INFO, "n = %d", n);
grpc_chttp2_stream_map_init(&map, 8);
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i);
}
for (i = 1; i <= n; i++) {
if ((i & 1) == 0) {
- GPR_ASSERT((void *)(gpr_uintptr)i ==
+ GPR_ASSERT((void *)(uintptr_t)i ==
grpc_chttp2_stream_map_delete(&map, i));
}
}
@@ -162,16 +162,16 @@ static void test_delete_evens_sweep(gpr_uint32 n) {
/* add a bunch of keys, delete the even ones immediately, and make sure the map
is consistent */
-static void test_delete_evens_incremental(gpr_uint32 n) {
+static void test_delete_evens_incremental(uint32_t n) {
grpc_chttp2_stream_map map;
- gpr_uint32 i;
+ uint32_t i;
LOG_TEST("test_delete_evens_incremental");
gpr_log(GPR_INFO, "n = %d", n);
grpc_chttp2_stream_map_init(&map, 8);
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i);
if ((i & 1) == 0) {
grpc_chttp2_stream_map_delete(&map, i);
}
@@ -182,10 +182,10 @@ static void test_delete_evens_incremental(gpr_uint32 n) {
/* add a bunch of keys, delete old ones after some time, ensure the
backing array does not grow */
-static void test_periodic_compaction(gpr_uint32 n) {
+static void test_periodic_compaction(uint32_t n) {
grpc_chttp2_stream_map map;
- gpr_uint32 i;
- gpr_uint32 del;
+ uint32_t i;
+ uint32_t del;
LOG_TEST("test_periodic_compaction");
gpr_log(GPR_INFO, "n = %d", n);
@@ -193,10 +193,10 @@ static void test_periodic_compaction(gpr_uint32 n) {
grpc_chttp2_stream_map_init(&map, 16);
GPR_ASSERT(map.capacity == 16);
for (i = 1; i <= n; i++) {
- grpc_chttp2_stream_map_add(&map, i, (void *)(gpr_uintptr)i);
+ grpc_chttp2_stream_map_add(&map, i, (void *)(uintptr_t)i);
if (i > 8) {
del = i - 8;
- GPR_ASSERT((void *)(gpr_uintptr)del ==
+ GPR_ASSERT((void *)(uintptr_t)del ==
grpc_chttp2_stream_map_delete(&map, del));
}
}
@@ -205,9 +205,9 @@ static void test_periodic_compaction(gpr_uint32 n) {
}
int main(int argc, char **argv) {
- gpr_uint32 n = 1;
- gpr_uint32 prev = 1;
- gpr_uint32 tmp;
+ uint32_t n = 1;
+ uint32_t prev = 1;
+ uint32_t tmp;
grpc_test_init(argc, argv);
diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.c
index 31fcb7e182..f06116a731 100644
--- a/test/core/transport/chttp2/varint_test.c
+++ b/test/core/transport/chttp2/varint_test.c
@@ -38,10 +38,9 @@
#include "test/core/util/test_config.h"
-static void test_varint(gpr_uint32 value, gpr_uint32 prefix_bits,
- gpr_uint8 prefix_or, const char *expect_bytes,
- size_t expect_length) {
- gpr_uint32 nbytes = GRPC_CHTTP2_VARINT_LENGTH(value, prefix_bits);
+static void test_varint(uint32_t value, uint32_t prefix_bits, uint8_t prefix_or,
+ const char *expect_bytes, size_t expect_length) {
+ uint32_t nbytes = GRPC_CHTTP2_VARINT_LENGTH(value, prefix_bits);
gpr_slice expect = gpr_slice_from_copied_buffer(expect_bytes, expect_length);
gpr_slice slice;
gpr_log(GPR_DEBUG, "Test: 0x%08x", value);