[m-rev.] diff: bitmap test case
Simon Taylor
staylr at gmail.com
Sat Feb 24 14:53:06 AEDT 2007
Estimated hours taken: 0.25
Branches: main
tests/hard_coded/bitmap_test.{m,exp}:
Test case for the comparison bug I fixed earlier. The
added tests would fail on 32 bit machines without that fix
(the original problem only occurred on 64 bit machines).
Index: bitmap_test.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/bitmap_test.m,v
retrieving revision 1.1
diff -u -u -r1.1 bitmap_test.m
--- bitmap_test.m 13 Feb 2007 01:59:02 -0000 1.1
+++ bitmap_test.m 17 Feb 2007 01:21:13 -0000
@@ -230,8 +230,15 @@
(pred(in, di, uo) is det), di, uo) is det.
test_binary_op(OpStr, Op, Writer, !IO) :-
- BMLength = 64,
+ test_binary_op(8, OpStr, Op, Writer, !IO),
+ test_binary_op(64, OpStr, Op, Writer, !IO).
+:- pred test_binary_op(int, string, (func(tbitmap, tbitmap) = T),
+ pred(T, io, io), io, io).
+:- mode test_binary_op(in, in, (func(tbitmap_ui, tbitmap_di) = out is det),
+ (pred(in, di, uo) is det), di, uo) is det.
+
+test_binary_op(BMLength, OpStr, Op, Writer, !IO) :-
ZeroedBM = bitmap_tester.new(BMLength, no),
OnesBM = bitmap_tester.new(BMLength, yes),
Index: bitmap_test.exp
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/bitmap_test.exp,v
retrieving revision 1.1
diff -u -u -r1.1 bitmap_test.exp
--- bitmap_test.exp 13 Feb 2007 01:59:01 -0000 1.1
+++ bitmap_test.exp 17 Feb 2007 02:26:27 -0000
@@ -125,6 +125,13 @@
11011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.0011100
Copy to same bitmap
11011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.01011100.10100011.0011100
+union(zeroes, pattern) = 10111001
+union(ones, pattern) = 11111111
+union(pattern, ones) = 11111111
+union(pattern, zeroes) = 10111001
+union(pattern, alternating) = 10111011
+union(pattern, pattern) = 10111001
+union(alternating, alternating) = 10101010
union(zeroes, pattern) = 10111001.01000110.10111001.01000110.10111001.01000110.10111001.01000110
union(ones, pattern) = 11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111
union(pattern, ones) = 11111111.11111111.11111111.11111111.11111111.11111111.11111111.11111111
@@ -132,6 +139,13 @@
union(pattern, alternating) = 10111011.01010111.10111011.01010111.10111011.01010111.10111011.01010111
union(pattern, pattern) = 10111001.01000110.10111001.01000110.10111001.01000110.10111001.01000110
union(alternating, alternating) = 10101010.01010101.10101010.01010101.10101010.01010101.10101010.01010101
+intersect(zeroes, pattern) = 00000000
+intersect(ones, pattern) = 10111001
+intersect(pattern, ones) = 10111001
+intersect(pattern, zeroes) = 00000000
+intersect(pattern, alternating) = 10101000
+intersect(pattern, pattern) = 10111001
+intersect(alternating, alternating) = 10101010
intersect(zeroes, pattern) = 00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000
intersect(ones, pattern) = 10111001.01000110.10111001.01000110.10111001.01000110.10111001.01000110
intersect(pattern, ones) = 10111001.01000110.10111001.01000110.10111001.01000110.10111001.01000110
@@ -139,6 +153,13 @@
intersect(pattern, alternating) = 10101000.01000100.10101000.01000100.10101000.01000100.10101000.01000100
intersect(pattern, pattern) = 10111001.01000110.10111001.01000110.10111001.01000110.10111001.01000110
intersect(alternating, alternating) = 10101010.01010101.10101010.01010101.10101010.01010101.10101010.01010101
+difference(zeroes, pattern) = 00000000
+difference(ones, pattern) = 01000110
+difference(pattern, ones) = 00000000
+difference(pattern, zeroes) = 10111001
+difference(pattern, alternating) = 00010001
+difference(pattern, pattern) = 00000000
+difference(alternating, alternating) = 00000000
difference(zeroes, pattern) = 00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000
difference(ones, pattern) = 01000110.10111001.01000110.10111001.01000110.10111001.01000110.10111001
difference(pattern, ones) = 00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000
@@ -146,6 +167,13 @@
difference(pattern, alternating) = 00010001.00000010.00010001.00000010.00010001.00000010.00010001.00000010
difference(pattern, pattern) = 00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000
difference(alternating, alternating) = 00000000.00000000.00000000.00000000.00000000.00000000.00000000.00000000
+xor(zeroes, pattern) = 10111001
+xor(ones, pattern) = 01000110
+xor(pattern, ones) = 01000110
+xor(pattern, zeroes) = 10111001
+xor(pattern, alternating) = 00010011
+xor(pattern, pattern) = 00000000
+xor(alternating, alternating) = 00000000
xor(zeroes, pattern) = 10111001.01000110.10111001.01000110.10111001.01000110.10111001.01000110
xor(ones, pattern) = 01000110.10111001.01000110.10111001.01000110.10111001.01000110.10111001
xor(pattern, ones) = 01000110.10111001.01000110.10111001.01000110.10111001.01000110.10111001
@@ -160,6 +188,20 @@
ordering(pattern, alternating) = '>'
ordering(pattern, pattern) = '='
ordering(alternating, alternating) = '='
+ordering(zeroes, pattern) = '<'
+ordering(ones, pattern) = '>'
+ordering(pattern, ones) = '<'
+ordering(pattern, zeroes) = '>'
+ordering(pattern, alternating) = '>'
+ordering(pattern, pattern) = '='
+ordering(alternating, alternating) = '='
+test_unify(zeroes, pattern) = no
+test_unify(ones, pattern) = no
+test_unify(pattern, ones) = no
+test_unify(pattern, zeroes) = no
+test_unify(pattern, alternating) = no
+test_unify(pattern, pattern) = yes
+test_unify(alternating, alternating) = yes
test_unify(zeroes, pattern) = no
test_unify(ones, pattern) = no
test_unify(pattern, ones) = no
--------------------------------------------------------------------------
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