From d0bc7f2d7e84dcc196eaa4a13507c6fc2c8af08f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 6 Sep 2012 17:54:58 -0700 Subject: [PATCH] Bounds checks in tests should be fatal assertions. --- libguac/tests/client/buffer_pool.c | 8 ++++---- libguac/tests/client/layer_pool.c | 8 ++++---- libguac/tests/util/guac_pool.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libguac/tests/client/buffer_pool.c b/libguac/tests/client/buffer_pool.c index 2cd5f07f..eaf54566 100644 --- a/libguac/tests/client/buffer_pool.c +++ b/libguac/tests/client/buffer_pool.c @@ -63,8 +63,8 @@ void test_buffer_pool() { /* Index should be within pool size */ CU_ASSERT_PTR_NOT_NULL_FATAL(layer); - CU_ASSERT(layer->index < 0); - CU_ASSERT(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE); + CU_ASSERT_FATAL(layer->index < 0); + CU_ASSERT_FATAL(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE); /* This should be a layer we have not seen yet */ CU_ASSERT_FALSE(seen[-layer->index - 1]); @@ -77,8 +77,8 @@ void test_buffer_pool() { /* Now that pool is filled, we should get a previously seen layer */ layer = guac_client_alloc_buffer(client); - CU_ASSERT(layer->index < 0); - CU_ASSERT(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE); + CU_ASSERT_FATAL(layer->index < 0); + CU_ASSERT_FATAL(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE); CU_ASSERT_TRUE(seen[-layer->index - 1]); /* Free client */ diff --git a/libguac/tests/client/layer_pool.c b/libguac/tests/client/layer_pool.c index 7727d85b..0a5b9b76 100644 --- a/libguac/tests/client/layer_pool.c +++ b/libguac/tests/client/layer_pool.c @@ -63,8 +63,8 @@ void test_layer_pool() { /* Index should be within pool size */ CU_ASSERT_PTR_NOT_NULL_FATAL(layer); - CU_ASSERT(layer->index > 0); - CU_ASSERT(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE); + CU_ASSERT_FATAL(layer->index > 0); + CU_ASSERT_FATAL(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE); /* This should be a layer we have not seen yet */ CU_ASSERT_FALSE(seen[layer->index - 1]); @@ -77,8 +77,8 @@ void test_layer_pool() { /* Now that pool is filled, we should get a previously seen layer */ layer = guac_client_alloc_layer(client); - CU_ASSERT(layer->index > 0); - CU_ASSERT(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE); + CU_ASSERT_FATAL(layer->index > 0); + CU_ASSERT_FATAL(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE); CU_ASSERT_TRUE(seen[layer->index - 1]); /* Free client */ diff --git a/libguac/tests/util/guac_pool.c b/libguac/tests/util/guac_pool.c index cd08e60a..c4fba37e 100644 --- a/libguac/tests/util/guac_pool.c +++ b/libguac/tests/util/guac_pool.c @@ -65,8 +65,8 @@ void test_guac_pool() { value = guac_pool_next_int(pool); /* Value should be within pool size */ - CU_ASSERT(value >= 0); - CU_ASSERT(value < POOL_SIZE); + CU_ASSERT_FATAL(value >= 0); + CU_ASSERT_FATAL(value < POOL_SIZE); /* This should be an integer we have not seen yet */ CU_ASSERT_EQUAL(UNSEEN, seen[value]); @@ -84,8 +84,8 @@ void test_guac_pool() { value = guac_pool_next_int(pool); /* Value should be within pool size */ - CU_ASSERT(value >= 0); - CU_ASSERT(value < POOL_SIZE); + CU_ASSERT_FATAL(value >= 0); + CU_ASSERT_FATAL(value < POOL_SIZE); /* This should be an integer we have seen already */ CU_ASSERT_EQUAL(SEEN_PHASE_1, seen[value]);