tests: Add tests for cell and refcell.

This commit is contained in:
Emilio Cobos Álvarez
2020-03-09 01:27:19 +01:00
parent 249b41ce8a
commit c3442809b9
8 changed files with 141 additions and 0 deletions
+14
View File
@@ -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);
+22
View File
@@ -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
+14
View File
@@ -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);
+22
View File
@@ -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
+22
View File
@@ -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"
+14
View File
@@ -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);
+22
View File
@@ -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
+11
View File
@@ -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) {}