From: Russell Bryant Date: Thu, 10 Jun 2010 13:17:51 +0000 (+0000) Subject: Fix an off by one error that caused a unit test to occasionally crash. X-Git-Tag: 11.0.0-beta1~2854 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bb906f87c5f251b50fb3925f6c67ca78dd3a8fa;p=thirdparty%2Fasterisk.git Fix an off by one error that caused a unit test to occasionally crash. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269711 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/tests/test_heap.c b/tests/test_heap.c index cb0bcffcc2..de48f0ae4d 100644 --- a/tests/test_heap.c +++ b/tests/test_heap.c @@ -241,7 +241,7 @@ AST_TEST_DEFINE(heap_test_3) i = test_size / 10; while (i--) { - random_index = ast_random() % test_size - 1; + random_index = ast_random() % test_size; node = ast_heap_remove(h, &nodes[random_index]); if (nodes[random_index].val != node->val){ ast_test_status_update(test, "Failed to remove what we expected to\n");