Skip to content

Commit

Permalink
Added tests with typedef for array pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai authored and emilio committed May 22, 2019
1 parent fc762a5 commit fe9bea0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
17 changes: 8 additions & 9 deletions tests/expectations/tests/with_array_pointers_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
)]

extern "C" {
pub fn test_fn(
a: f32,
arr: *mut [::std::os::raw::c_int; 20usize],
) -> ::std::os::raw::c_int;
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;
}
pub fn test_fn2(arr: *const [f32; 20usize], b: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
pub type defArr = [::std::os::raw::c_char; 20usize];
pub type foo = ::std::option::Option<unsafe extern "C" fn(a: *mut defArr)>;
extern "C" {
pub fn bar(a: *mut defArr);
}
17 changes: 8 additions & 9 deletions tests/expectations/tests/without_array_pointers_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
)]

extern "C" {
pub fn test_fn(
a: f32,
arr: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
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;
}
pub fn test_fn2(arr: *const f32, b: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
pub type defArr = [::std::os::raw::c_char; 20usize];
pub type foo = ::std::option::Option<unsafe extern "C" fn(a: *mut ::std::os::raw::c_char)>;
extern "C" {
pub fn bar(a: *mut ::std::os::raw::c_char);
}
7 changes: 6 additions & 1 deletion tests/headers/with_array_pointers_arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

int test_fn(float a, int arr[20]);

int test_fn2(const float arr[20], int b);
int test_fn2(const float arr[20], int b);

typedef char defArr[20];
typedef void foo(defArr a);

void bar(defArr a);
7 changes: 6 additions & 1 deletion tests/headers/without_array_pointers_arguments.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

int test_fn(float a, int arr[20]);

int test_fn2(const float arr[20], int b);
int test_fn2(const float arr[20], int b);

typedef char defArr[20];
typedef void foo(defArr a);

void bar(defArr a);

0 comments on commit fe9bea0

Please sign in to comment.