Skip to content

Commit 00b10f9

Browse files
committed
tests: Add tests for cell and refcell.
1 parent 4292cb1 commit 00b10f9

File tree

9 files changed

+141
-0
lines changed

9 files changed

+141
-0
lines changed

tests/expectations/both/cell.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdarg.h>
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
7+
8+
typedef NotReprC_RefCell_i32 Foo;
9+
10+
typedef struct MyStruct {
11+
int32_t number;
12+
} MyStruct;
13+
14+
void root(const Foo *a, const MyStruct *with_cell);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdarg.h>
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
7+
8+
typedef NotReprC_RefCell_i32 Foo;
9+
10+
typedef struct MyStruct {
11+
int32_t number;
12+
} MyStruct;
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif // __cplusplus
17+
18+
void root(const Foo *a, const MyStruct *with_cell);
19+
20+
#ifdef __cplusplus
21+
} // extern "C"
22+
#endif // __cplusplus

tests/expectations/cell.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdarg.h>
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
7+
8+
typedef NotReprC_RefCell_i32 Foo;
9+
10+
typedef struct {
11+
int32_t number;
12+
} MyStruct;
13+
14+
void root(const Foo *a, const MyStruct *with_cell);

tests/expectations/cell.compat.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdarg.h>
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
7+
8+
typedef NotReprC_RefCell_i32 Foo;
9+
10+
typedef struct {
11+
int32_t number;
12+
} MyStruct;
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif // __cplusplus
17+
18+
void root(const Foo *a, const MyStruct *with_cell);
19+
20+
#ifdef __cplusplus
21+
} // extern "C"
22+
#endif // __cplusplus

tests/expectations/cell.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <cstdarg>
2+
#include <cstdint>
3+
#include <cstdlib>
4+
#include <new>
5+
6+
template<typename T>
7+
struct NotReprC;
8+
9+
template<typename T>
10+
struct RefCell;
11+
12+
using Foo = NotReprC<RefCell<int32_t>>;
13+
14+
struct MyStruct {
15+
int32_t number;
16+
};
17+
18+
extern "C" {
19+
20+
void root(const Foo *a, const MyStruct *with_cell);
21+
22+
} // extern "C"

tests/expectations/prefix.o.linux.fritz.box.65483.QSBo1J

Whitespace-only changes.

tests/expectations/tag/cell.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdarg.h>
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
struct NotReprC_RefCell_i32;
7+
8+
typedef struct NotReprC_RefCell_i32 Foo;
9+
10+
struct MyStruct {
11+
int32_t number;
12+
};
13+
14+
void root(const Foo *a, const struct MyStruct *with_cell);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdarg.h>
2+
#include <stdbool.h>
3+
#include <stdint.h>
4+
#include <stdlib.h>
5+
6+
struct NotReprC_RefCell_i32;
7+
8+
typedef struct NotReprC_RefCell_i32 Foo;
9+
10+
struct MyStruct {
11+
int32_t number;
12+
};
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif // __cplusplus
17+
18+
void root(const Foo *a, const struct MyStruct *with_cell);
19+
20+
#ifdef __cplusplus
21+
} // extern "C"
22+
#endif // __cplusplus

tests/rust/cell.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#[repr(C)]
2+
pub struct MyStruct {
3+
number: std::cell::Cell<i32>,
4+
}
5+
6+
pub struct NotReprC<T> { inner: T }
7+
8+
pub type Foo = NotReprC<std::cell::RefCell<i32>>;
9+
10+
#[no_mangle]
11+
pub extern "C" fn root(a: &Foo, with_cell: &MyStruct) {}

0 commit comments

Comments
 (0)