Skip to content

Commit d92f3a3

Browse files
committed
Update tests to use bigarray-compat package instead of bigarray
1 parent 436a032 commit d92f3a3

File tree

11 files changed

+149
-148
lines changed

11 files changed

+149
-148
lines changed

Makefile.tests

Lines changed: 77 additions & 76 deletions
Large diffs are not rendered by default.

tests/test-alignment/test_alignment.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ let test_struct_tail_padding _ =
242242
*)
243243
let test_bigarray_alignment _ =
244244
let module M = struct
245-
module B = Bigarray
246-
type k = K : ('a, 'b) Bigarray.kind * int -> k
245+
module B = Bigarray_compat
246+
type k = K : ('a, 'b) Bigarray_compat.kind * int -> k
247247
let kind_alignments = [
248248
K (B.float32, alignment float);
249249
K (B.float64, alignment double);

tests/test-bigarrays/test_bigarrays.ml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type 'a std_array = 'a array
1010

1111
open OUnit2
1212
open Ctypes
13-
module BA = Bigarray
13+
module BA = Bigarray_compat
1414

1515

1616
let array_of_list2 typ list2 =
@@ -325,34 +325,34 @@ let test_ctypes_array_of_bigarray _ =
325325
*)
326326
let test_fortran_layout_bigarrays _ =
327327
(* array1 *)
328-
let a1c = bigarray_of_array array1 Bigarray.int32
328+
let a1c = bigarray_of_array array1 Bigarray_compat.int32
329329
(CArray.of_list int32_t [10l; 20l; 30l; 40l]) in
330330
let p1 = bigarray_start array1 a1c in
331-
let a1f = fortran_bigarray_of_ptr array1 4 Bigarray.int32 p1 in
331+
let a1f = fortran_bigarray_of_ptr array1 4 Bigarray_compat.int32 p1 in
332332
begin
333-
assert_equal 4 (Bigarray.Array1.dim a1f);
334-
assert_equal Bigarray.int32 (Bigarray.Array1.kind a1f);
335-
assert_equal Bigarray.fortran_layout (Bigarray.Array1.layout a1f);
333+
assert_equal 4 (Bigarray_compat.Array1.dim a1f);
334+
assert_equal Bigarray_compat.int32 (Bigarray_compat.Array1.kind a1f);
335+
assert_equal Bigarray_compat.fortran_layout (Bigarray_compat.Array1.layout a1f);
336336
assert_equal a1f.{1} 10l;
337337
assert_equal a1f.{2} 20l;
338338
assert_equal a1f.{3} 30l;
339339
assert_equal a1f.{4} 40l;
340340
end;
341341

342342
(* array2 *)
343-
let a2c = bigarray_of_array array2 Bigarray.int32
343+
let a2c = bigarray_of_array array2 Bigarray_compat.int32
344344
(CArray.of_list (array 2 int32_t)
345345
[CArray.of_list int32_t [10l; 20l];
346346
CArray.of_list int32_t [30l; 40l];
347347
CArray.of_list int32_t [50l; 60l];
348348
CArray.of_list int32_t [70l; 80l]]) in
349349
let p2 = bigarray_start array2 a2c in
350-
let a2f = fortran_bigarray_of_ptr array2 (4,2) Bigarray.int32 p2 in
350+
let a2f = fortran_bigarray_of_ptr array2 (4,2) Bigarray_compat.int32 p2 in
351351
begin
352-
assert_equal 4 (Bigarray.Array2.dim1 a2f);
353-
assert_equal 2 (Bigarray.Array2.dim2 a2f);
354-
assert_equal Bigarray.int32 (Bigarray.Array2.kind a2f);
355-
assert_equal Bigarray.fortran_layout (Bigarray.Array2.layout a2f);
352+
assert_equal 4 (Bigarray_compat.Array2.dim1 a2f);
353+
assert_equal 2 (Bigarray_compat.Array2.dim2 a2f);
354+
assert_equal Bigarray_compat.int32 (Bigarray_compat.Array2.kind a2f);
355+
assert_equal Bigarray_compat.fortran_layout (Bigarray_compat.Array2.layout a2f);
356356
assert_equal a2f.{1,1} 10l;
357357
assert_equal a2f.{2,1} 20l;
358358
assert_equal a2f.{3,1} 30l;
@@ -365,27 +365,27 @@ let test_fortran_layout_bigarrays _ =
365365
end;
366366

367367
(* genarray *)
368-
let agc = bigarray_of_array genarray Bigarray.int32
368+
let agc = bigarray_of_array genarray Bigarray_compat.int32
369369
(CArray.of_list int32_t
370370
[10l; 20l;
371371
30l; 40l;
372372
50l; 60l;
373373
70l; 80l]) in
374374
let pg = bigarray_start genarray agc in
375-
let agf = fortran_bigarray_of_ptr genarray [|4;2|] Bigarray.int32 pg in
375+
let agf = fortran_bigarray_of_ptr genarray [|4;2|] Bigarray_compat.int32 pg in
376376
begin
377-
assert_equal [|4;2|] (Bigarray.Genarray.dims agf);
378-
assert_equal Bigarray.int32 (Bigarray.Genarray.kind agf);
379-
assert_equal Bigarray.fortran_layout (Bigarray.Genarray.layout agf);
380-
assert_equal (Bigarray.Genarray.get agf [|1;1|]) 10l;
381-
assert_equal (Bigarray.Genarray.get agf [|2;1|]) 20l;
382-
assert_equal (Bigarray.Genarray.get agf [|3;1|]) 30l;
383-
assert_equal (Bigarray.Genarray.get agf [|4;1|]) 40l;
384-
385-
assert_equal (Bigarray.Genarray.get agf [|1;2|]) 50l;
386-
assert_equal (Bigarray.Genarray.get agf [|2;2|]) 60l;
387-
assert_equal (Bigarray.Genarray.get agf [|3;2|]) 70l;
388-
assert_equal (Bigarray.Genarray.get agf [|4;2|]) 80l;
377+
assert_equal [|4;2|] (Bigarray_compat.Genarray.dims agf);
378+
assert_equal Bigarray_compat.int32 (Bigarray_compat.Genarray.kind agf);
379+
assert_equal Bigarray_compat.fortran_layout (Bigarray_compat.Genarray.layout agf);
380+
assert_equal (Bigarray_compat.Genarray.get agf [|1;1|]) 10l;
381+
assert_equal (Bigarray_compat.Genarray.get agf [|2;1|]) 20l;
382+
assert_equal (Bigarray_compat.Genarray.get agf [|3;1|]) 30l;
383+
assert_equal (Bigarray_compat.Genarray.get agf [|4;1|]) 40l;
384+
385+
assert_equal (Bigarray_compat.Genarray.get agf [|1;2|]) 50l;
386+
assert_equal (Bigarray_compat.Genarray.get agf [|2;2|]) 60l;
387+
assert_equal (Bigarray_compat.Genarray.get agf [|3;2|]) 70l;
388+
assert_equal (Bigarray_compat.Genarray.get agf [|4;2|]) 80l;
389389
end
390390

391391

@@ -464,7 +464,7 @@ let test_bigarray_lifetime_with_ctypes_reference _ =
464464
let () =
465465
let pointer =
466466
(* Allocate a bigarray and attach a ctypes pointer *)
467-
let ba = Bigarray.(Array2.create int c_layout) 1024 1024 in
467+
let ba = Bigarray_compat.(Array2.create int c_layout) 1024 1024 in
468468
begin
469469
ba.{0,0} <- 1;
470470
Gc.finalise finalise ba;

tests/test-coercions/test_coercions.ml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let test_pointer_coercions _ =
2525
T complex64;
2626
T (ptr double);
2727
T string;
28-
T (bigarray array1 10 Bigarray.int32);
28+
T (bigarray array1 10 Bigarray_compat.int32);
2929
T (array 5 int32_t);
3030
T (structure "s");
3131
T (union "u");
@@ -184,83 +184,83 @@ let test_unsupported_coercions _ =
184184
type boxed_type = T : 'a typ -> boxed_type
185185
let types = [
186186
T int8_t,
187-
[T uint16_t; T float; T complex64; T (bigarray array1 10 Bigarray.int32);
187+
[T uint16_t; T float; T complex64; T (bigarray array1 10 Bigarray_compat.int32);
188188
T (array 5 int32_t); T (structure "s"); T (union "u");
189189
T (abstract ~name:"a" ~size:12 ~alignment:4)];
190190

191191
T uint16_t,
192192
[T int8_t; T int; T float; T short; T complex64;
193-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
193+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
194194
T (structure "s"); T (union "u");
195195
T (abstract ~name:"a" ~size:12 ~alignment:4)];
196196

197197
T int,
198-
[T uint16_t; T float; T complex64; T (bigarray array1 10 Bigarray.int32);
198+
[T uint16_t; T float; T complex64; T (bigarray array1 10 Bigarray_compat.int32);
199199
T (array 5 int32_t); T (structure "s"); T (union "u");
200200
T (abstract ~name:"a" ~size:12 ~alignment:4)];
201201

202202
T float,
203203
[T int8_t; T uint16_t; T int; T short; T complex64;
204-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
204+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
205205
T (structure "s"); T (union "u");
206206
T (abstract ~name:"a" ~size:12 ~alignment:4)];
207207

208208
T ldouble,
209209
[T int8_t; T uint16_t; T int; T short; T complex64;
210-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
210+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
211211
T (structure "s"); T (union "u");
212212
T (abstract ~name:"a" ~size:12 ~alignment:4)];
213213

214214
T short,
215-
[T uint16_t; T float; T complex64; T (bigarray array1 10 Bigarray.int32);
215+
[T uint16_t; T float; T complex64; T (bigarray array1 10 Bigarray_compat.int32);
216216
T (array 5 int32_t); T (structure "s"); T (union "u");
217217
T (abstract ~name:"a" ~size:12 ~alignment:4)];
218218

219219
T complex64,
220220
[T int8_t; T uint16_t; T int; T float; T short;
221-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
221+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
222222
T (structure "s"); T (union "u");
223223
T (abstract ~name:"a" ~size:12 ~alignment:4)];
224224

225225
T complexld,
226226
[T int8_t; T uint16_t; T int; T short;
227-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
227+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
228228
T (structure "s"); T (union "u");
229229
T (abstract ~name:"a" ~size:12 ~alignment:4)];
230230

231-
T (bigarray array1 10 Bigarray.int32),
231+
T (bigarray array1 10 Bigarray_compat.int32),
232232
[T int8_t; T uint16_t; T int; T float; T short; T complex64;
233-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
233+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
234234
T (structure "s"); T (union "u");
235235
T (abstract ~name:"a" ~size:12 ~alignment:4)];
236236

237237
T (array 5 int32_t),
238238
[T int8_t; T uint16_t; T int; T float; T short; T complex64;
239-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
239+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
240240
T (structure "s"); T (union "u");
241241
T (abstract ~name:"a" ~size:12 ~alignment:4)];
242242

243243
T (structure "s"),
244244
[T int8_t; T uint16_t; T int; T float; T short; T complex64;
245-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
245+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
246246
T (structure "s"); T (union "u");
247247
T (abstract ~name:"a" ~size:12 ~alignment:4)];
248248

249249
T (union "u"),
250250
[T int8_t; T uint16_t; T int; T float; T short; T complex64;
251-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
251+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
252252
T (structure "s"); T (union "u");
253253
T (abstract ~name:"a" ~size:12 ~alignment:4)];
254254

255255
T (abstract ~name:"a" ~size:12 ~alignment:4),
256256
[T int8_t; T uint16_t; T int; T float; T short; T complex64;
257-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
257+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
258258
T (structure "s"); T (union "u");
259259
T (abstract ~name:"a" ~size:12 ~alignment:4)];
260260

261261
T ocaml_string,
262262
[T int8_t; T uint16_t; T int; T float; T short; T complex64;
263-
T (bigarray array1 10 Bigarray.int32); T (array 5 int32_t);
263+
T (bigarray array1 10 Bigarray_compat.int32); T (array 5 int32_t);
264264
T (structure "s"); T (union "u");
265265
T (abstract ~name:"a" ~size:12 ~alignment:4)];
266266
]

tests/test-foreign_values/stubs/functions.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct
2727
(int @-> int @-> returning int))
2828

2929
let string_array = F.(foreign_value "string_array" (array 2 string))
30-
let int_array = F.(foreign_value "int_array" (bigarray array1 5 Bigarray.int32))
30+
let int_array = F.(foreign_value "int_array" (bigarray array1 5 Bigarray_compat.int32))
3131
end
3232

3333

tests/test-foreign_values/test_foreign_values.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ struct
5454

5555
let iarr = !@int_array in
5656
begin
57-
let expected_ints = Bigarray.(Array1.create int32 c_layout 5) in
57+
let expected_ints = Bigarray_compat.(Array1.create int32 c_layout 5) in
5858
for i = 0 to 4 do
59-
Bigarray.Array1.set expected_ints i (Int32.of_int i)
59+
Bigarray_compat.Array1.set expected_ints i (Int32.of_int i)
6060
done;
6161
assert_equal expected_ints iarr
6262
end

tests/test-lwt-jobs/test_lwt_jobs.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let test_sqrt _ =
2525
*)
2626
let test_object_lifetime _ =
2727
let call =
28-
let open Bigarray in
28+
let open Bigarray_compat in
2929
let b = Array1.create int32 c_layout 3 in
3030
begin
3131
b.{0} <- 1l;

tests/test-lwt-preemptive/test_lwt_jobs.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let test_sqrt _ =
2525
*)
2626
let test_object_lifetime _ =
2727
let call =
28-
let open Bigarray in
28+
let open Bigarray_compat in
2929
let b = Array1.create int32 c_layout 3 in
3030
begin
3131
b.{0} <- 1l;

tests/test-passable/test_passable.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,35 +147,35 @@ let test_arrays_are_not_passable _ =
147147
let test_bigarrays_are_not_passable _ =
148148
assert_raises ~msg:"bigarray type rejected as argument"
149149
(Unsupported "Unsupported argument type")
150-
(fun () -> bigarray genarray [|1|] Bigarray.int @-> returning void);
150+
(fun () -> bigarray genarray [|1|] Bigarray_compat.int @-> returning void);
151151

152152
assert_raises ~msg:"bigarray1 type rejected as argument"
153153
(Unsupported "Unsupported argument type")
154-
(fun () -> bigarray array1 1 Bigarray.int @-> returning void);
154+
(fun () -> bigarray array1 1 Bigarray_compat.int @-> returning void);
155155

156156
assert_raises ~msg:"bigarray2 type rejected as argument"
157157
(Unsupported "Unsupported argument type")
158-
(fun () -> bigarray array2 (1, 2) Bigarray.int @-> returning void);
158+
(fun () -> bigarray array2 (1, 2) Bigarray_compat.int @-> returning void);
159159

160160
assert_raises ~msg:"bigarray3 type rejected as argument"
161161
(Unsupported "Unsupported argument type")
162-
(fun () -> bigarray array3 (1, 2, 3) Bigarray.int @-> returning void);
162+
(fun () -> bigarray array3 (1, 2, 3) Bigarray_compat.int @-> returning void);
163163

164164
assert_raises ~msg:"bigarray type rejected as return type"
165165
(Unsupported "Unsupported return type")
166-
(fun () -> void @-> returning (bigarray genarray [|1|] Bigarray.int));
166+
(fun () -> void @-> returning (bigarray genarray [|1|] Bigarray_compat.int));
167167

168168
assert_raises ~msg:"bigarray1 type rejected as return type"
169169
(Unsupported "Unsupported return type")
170-
(fun () -> void @-> returning (bigarray array1 1 Bigarray.int));
170+
(fun () -> void @-> returning (bigarray array1 1 Bigarray_compat.int));
171171

172172
assert_raises ~msg:"bigarray2 type rejected as return type"
173173
(Unsupported "Unsupported return type")
174-
(fun () -> void @-> returning (bigarray array2 (1, 2) Bigarray.int));
174+
(fun () -> void @-> returning (bigarray array2 (1, 2) Bigarray_compat.int));
175175

176176
assert_raises ~msg:"bigarray3 type rejected as return type"
177177
(Unsupported "Unsupported return type")
178-
(fun () -> void @-> returning (bigarray array3 (1, 2, 3) Bigarray.int))
178+
(fun () -> void @-> returning (bigarray array3 (1, 2, 3) Bigarray_compat.int))
179179

180180

181181
(*

tests/test-sizeof/test_sizeof.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ end
171171
*)
172172
let test_sizeof_bigarrays _ =
173173
let module M = struct
174-
module B = Bigarray
175-
type k = K : ('a, 'b) Bigarray.kind * int -> k
174+
module B = Bigarray_compat
175+
type k = K : ('a, 'b) Bigarray_compat.kind * int -> k
176176
let kind_sizes = [
177177
K (B.float32, 4);
178178
K (B.float64, 8);

0 commit comments

Comments
 (0)