Bounds checks in tests should be fatal assertions.

This commit is contained in:
Michael Jumper 2012-09-06 17:54:58 -07:00
parent 91d73c850f
commit d0bc7f2d7e
3 changed files with 12 additions and 12 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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]);