Bounds checks in tests should be fatal assertions.
This commit is contained in:
parent
91d73c850f
commit
d0bc7f2d7e
@ -63,8 +63,8 @@ void test_buffer_pool() {
|
|||||||
|
|
||||||
/* Index should be within pool size */
|
/* Index should be within pool size */
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(layer);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(layer);
|
||||||
CU_ASSERT(layer->index < 0);
|
CU_ASSERT_FATAL(layer->index < 0);
|
||||||
CU_ASSERT(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE);
|
CU_ASSERT_FATAL(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE);
|
||||||
|
|
||||||
/* This should be a layer we have not seen yet */
|
/* This should be a layer we have not seen yet */
|
||||||
CU_ASSERT_FALSE(seen[-layer->index - 1]);
|
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 */
|
/* Now that pool is filled, we should get a previously seen layer */
|
||||||
layer = guac_client_alloc_buffer(client);
|
layer = guac_client_alloc_buffer(client);
|
||||||
|
|
||||||
CU_ASSERT(layer->index < 0);
|
CU_ASSERT_FATAL(layer->index < 0);
|
||||||
CU_ASSERT(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE);
|
CU_ASSERT_FATAL(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE);
|
||||||
CU_ASSERT_TRUE(seen[-layer->index - 1]);
|
CU_ASSERT_TRUE(seen[-layer->index - 1]);
|
||||||
|
|
||||||
/* Free client */
|
/* Free client */
|
||||||
|
@ -63,8 +63,8 @@ void test_layer_pool() {
|
|||||||
|
|
||||||
/* Index should be within pool size */
|
/* Index should be within pool size */
|
||||||
CU_ASSERT_PTR_NOT_NULL_FATAL(layer);
|
CU_ASSERT_PTR_NOT_NULL_FATAL(layer);
|
||||||
CU_ASSERT(layer->index > 0);
|
CU_ASSERT_FATAL(layer->index > 0);
|
||||||
CU_ASSERT(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE);
|
CU_ASSERT_FATAL(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE);
|
||||||
|
|
||||||
/* This should be a layer we have not seen yet */
|
/* This should be a layer we have not seen yet */
|
||||||
CU_ASSERT_FALSE(seen[layer->index - 1]);
|
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 */
|
/* Now that pool is filled, we should get a previously seen layer */
|
||||||
layer = guac_client_alloc_layer(client);
|
layer = guac_client_alloc_layer(client);
|
||||||
|
|
||||||
CU_ASSERT(layer->index > 0);
|
CU_ASSERT_FATAL(layer->index > 0);
|
||||||
CU_ASSERT(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE);
|
CU_ASSERT_FATAL(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE);
|
||||||
CU_ASSERT_TRUE(seen[layer->index - 1]);
|
CU_ASSERT_TRUE(seen[layer->index - 1]);
|
||||||
|
|
||||||
/* Free client */
|
/* Free client */
|
||||||
|
@ -65,8 +65,8 @@ void test_guac_pool() {
|
|||||||
value = guac_pool_next_int(pool);
|
value = guac_pool_next_int(pool);
|
||||||
|
|
||||||
/* Value should be within pool size */
|
/* Value should be within pool size */
|
||||||
CU_ASSERT(value >= 0);
|
CU_ASSERT_FATAL(value >= 0);
|
||||||
CU_ASSERT(value < POOL_SIZE);
|
CU_ASSERT_FATAL(value < POOL_SIZE);
|
||||||
|
|
||||||
/* This should be an integer we have not seen yet */
|
/* This should be an integer we have not seen yet */
|
||||||
CU_ASSERT_EQUAL(UNSEEN, seen[value]);
|
CU_ASSERT_EQUAL(UNSEEN, seen[value]);
|
||||||
@ -84,8 +84,8 @@ void test_guac_pool() {
|
|||||||
value = guac_pool_next_int(pool);
|
value = guac_pool_next_int(pool);
|
||||||
|
|
||||||
/* Value should be within pool size */
|
/* Value should be within pool size */
|
||||||
CU_ASSERT(value >= 0);
|
CU_ASSERT_FATAL(value >= 0);
|
||||||
CU_ASSERT(value < POOL_SIZE);
|
CU_ASSERT_FATAL(value < POOL_SIZE);
|
||||||
|
|
||||||
/* This should be an integer we have seen already */
|
/* This should be an integer we have seen already */
|
||||||
CU_ASSERT_EQUAL(SEEN_PHASE_1, seen[value]);
|
CU_ASSERT_EQUAL(SEEN_PHASE_1, seen[value]);
|
||||||
|
Loading…
Reference in New Issue
Block a user