summaryrefslogtreecommitdiffstats
path: root/test/Moretest
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2006-06-10 14:15:43 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2006-06-10 14:15:43 +0000
commita5271a18458defe3dd79763857034549fd376354 (patch)
tree45f75a433e83b814525fcf616004586022e7d768 /test/Moretest
parenta5eab1b87287f150bd033463b56a1a5f0d729131 (diff)
Added map_subfile functions (memory mapping from a non-zero file offset). Win32 implementation is untested.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7437 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'test/Moretest')
-rw-r--r--test/Moretest/bigarrays.ml20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/Moretest/bigarrays.ml b/test/Moretest/bigarrays.ml
index 302ade999..fadad4593 100644
--- a/test/Moretest/bigarrays.ml
+++ b/test/Moretest/bigarrays.ml
@@ -700,7 +700,25 @@ let _ =
if c.{i,j} <> float (100 * i + j) then ok := false
done
done;
- test 2 !ok true
+ test 2 !ok true;
+ let fd = Unix.openfile mapped_file [Unix.O_RDONLY] 0 in
+ let c = Array2.map_subfile fd float64 c_layout false (-1) 100 800L in
+ Unix.close fd;
+ let ok = ref true in
+ for i = 1 to 99 do
+ for j = 0 to 99 do
+ if c.{i-1,j} <> float (100 * i + j) then ok := false
+ done
+ done;
+ test 3 !ok true;
+ let fd = Unix.openfile mapped_file [Unix.O_RDONLY] 0 in
+ let c = Array2.map_subfile fd float64 c_layout false (-1) 100 79200L in
+ Unix.close fd;
+ let ok = ref true in
+ for j = 0 to 99 do
+ if c.{0,j} <> float (100 * 99 + j) then ok := false
+ done;
+ test 4 !ok true
end;
(* Force garbage collection of the mapped bigarrays above, otherwise
Win32 doesn't let us erase the file. Notice the begin...end above