[m-rev.] diff: test_tree_bitset failure on 32-bit

Peter Wang novalazy at gmail.com
Wed Jul 25 12:52:41 AEST 2012


Branches: main

Fix failure of `test_tree_bitset' on 32-bit platforms.

tests/hard_coded/test_tree_bitset.m:
	Work around `random.random' returning negative values,
	which are not acceptable elements for `tree_bitset'.

diff --git a/tests/hard_coded/test_tree_bitset.m b/tests/hard_coded/test_tree_bitset.m
index 1f26637..6323816 100644
--- a/tests/hard_coded/test_tree_bitset.m
+++ b/tests/hard_coded/test_tree_bitset.m
@@ -131,7 +131,9 @@ get_random_numbers(Num, List0, List, Supply0, Supply) :-
         Supply = Supply0
     ;
         % 1048576 = 2^20
-        random.random(0, 1048576, RN, Supply0, Supply1),
+        random.random(0, 1048576, RN0, Supply0, Supply1),
+        % random.random is broken and can produce numbers out of range.
+        RN = abs(RN0),
         get_random_numbers(Num - 1, [RN | List0], List, Supply1, Supply)
     ).
 

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list