[svn-commits] russell: trunk r269711 - /trunk/tests/test_heap.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 10 08:17:55 CDT 2010


Author: russell
Date: Thu Jun 10 08:17:51 2010
New Revision: 269711

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=269711
Log:
Fix an off by one error that caused a unit test to occasionally crash.

Modified:
    trunk/tests/test_heap.c

Modified: trunk/tests/test_heap.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_heap.c?view=diff&rev=269711&r1=269710&r2=269711
==============================================================================
--- trunk/tests/test_heap.c (original)
+++ trunk/tests/test_heap.c Thu Jun 10 08:17:51 2010
@@ -241,7 +241,7 @@
 
 	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");




More information about the svn-commits mailing list