tests: Add tests for cell and refcell.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
|
||||
|
||||
typedef NotReprC_RefCell_i32 Foo;
|
||||
|
||||
typedef struct MyStruct {
|
||||
int32_t number;
|
||||
} MyStruct;
|
||||
|
||||
void root(const Foo *a, const MyStruct *with_cell);
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
|
||||
|
||||
typedef NotReprC_RefCell_i32 Foo;
|
||||
|
||||
typedef struct MyStruct {
|
||||
int32_t number;
|
||||
} MyStruct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Foo *a, const MyStruct *with_cell);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
|
||||
|
||||
typedef NotReprC_RefCell_i32 Foo;
|
||||
|
||||
typedef struct {
|
||||
int32_t number;
|
||||
} MyStruct;
|
||||
|
||||
void root(const Foo *a, const MyStruct *with_cell);
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
|
||||
|
||||
typedef NotReprC_RefCell_i32 Foo;
|
||||
|
||||
typedef struct {
|
||||
int32_t number;
|
||||
} MyStruct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Foo *a, const MyStruct *with_cell);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
template<typename T>
|
||||
struct NotReprC;
|
||||
|
||||
template<typename T>
|
||||
struct RefCell;
|
||||
|
||||
using Foo = NotReprC<RefCell<int32_t>>;
|
||||
|
||||
struct MyStruct {
|
||||
int32_t number;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
void root(const Foo *a, const MyStruct *with_cell);
|
||||
|
||||
} // extern "C"
|
||||
@@ -0,0 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct NotReprC_RefCell_i32;
|
||||
|
||||
typedef struct NotReprC_RefCell_i32 Foo;
|
||||
|
||||
struct MyStruct {
|
||||
int32_t number;
|
||||
};
|
||||
|
||||
void root(const Foo *a, const struct MyStruct *with_cell);
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct NotReprC_RefCell_i32;
|
||||
|
||||
typedef struct NotReprC_RefCell_i32 Foo;
|
||||
|
||||
struct MyStruct {
|
||||
int32_t number;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Foo *a, const struct MyStruct *with_cell);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,11 @@
|
||||
#[repr(C)]
|
||||
pub struct MyStruct {
|
||||
number: std::cell::Cell<i32>,
|
||||
}
|
||||
|
||||
pub struct NotReprC<T> { inner: T }
|
||||
|
||||
pub type Foo = NotReprC<std::cell::RefCell<i32>>;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn root(a: &Foo, with_cell: &MyStruct) {}
|
||||
Reference in New Issue
Block a user