summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElichai Turkel <elichai.turkel@gmail.com>2019-05-20 15:56:36 +0300
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-05-22 13:45:59 +0200
commitfc762a5a5c4123602fe868b1836f09393dac1abc (patch)
tree4b1dccbaabad4a658d580afd6008579e5e5d1399
parent24091a8b7cf0533c2aafdbf8f09a02e8046677b7 (diff)
Added tests for array pointers
-rw-r--r--tests/expectations/tests/with_array_pointers_arguments.rs21
-rw-r--r--tests/expectations/tests/without_array_pointers_arguments.rs21
-rw-r--r--tests/headers/with_array_pointers_arguments.h5
-rw-r--r--tests/headers/without_array_pointers_arguments.h4
4 files changed, 51 insertions, 0 deletions
diff --git a/tests/expectations/tests/with_array_pointers_arguments.rs b/tests/expectations/tests/with_array_pointers_arguments.rs
new file mode 100644
index 00000000..eb3300e2
--- /dev/null
+++ b/tests/expectations/tests/with_array_pointers_arguments.rs
@@ -0,0 +1,21 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(
+ dead_code,
+ non_snake_case,
+ non_camel_case_types,
+ non_upper_case_globals
+)]
+
+extern "C" {
+ pub fn test_fn(
+ a: f32,
+ arr: *mut [::std::os::raw::c_int; 20usize],
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn test_fn2(
+ arr: *const [f32; 20usize],
+ b: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+} \ No newline at end of file
diff --git a/tests/expectations/tests/without_array_pointers_arguments.rs b/tests/expectations/tests/without_array_pointers_arguments.rs
new file mode 100644
index 00000000..a8d9990a
--- /dev/null
+++ b/tests/expectations/tests/without_array_pointers_arguments.rs
@@ -0,0 +1,21 @@
+/* automatically generated by rust-bindgen */
+
+#![allow(
+ dead_code,
+ non_snake_case,
+ non_camel_case_types,
+ non_upper_case_globals
+)]
+
+extern "C" {
+ pub fn test_fn(
+ a: f32,
+ arr: *mut ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn test_fn2(
+ arr: *const f32,
+ b: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+} \ No newline at end of file
diff --git a/tests/headers/with_array_pointers_arguments.h b/tests/headers/with_array_pointers_arguments.h
new file mode 100644
index 00000000..34f669d0
--- /dev/null
+++ b/tests/headers/with_array_pointers_arguments.h
@@ -0,0 +1,5 @@
+// bindgen-flags: --use-array-pointers-in-arguments
+
+int test_fn(float a, int arr[20]);
+
+int test_fn2(const float arr[20], int b); \ No newline at end of file
diff --git a/tests/headers/without_array_pointers_arguments.h b/tests/headers/without_array_pointers_arguments.h
new file mode 100644
index 00000000..9028c43d
--- /dev/null
+++ b/tests/headers/without_array_pointers_arguments.h
@@ -0,0 +1,4 @@
+
+int test_fn(float a, int arr[20]);
+
+int test_fn2(const float arr[20], int b); \ No newline at end of file