Skip to content

Commit add5b99

Browse files
committed
ctest: add tests for size and alignment of structs, unions, and aliases, and signededness of aliases.
1 parent b94681f commit add5b99

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

ctest-next/tests/input/hierarchy.out.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ static bool ctest_const_ON_val_static = ON;
1111

1212
// Define a function that returns a pointer to the value of the constant to test.
1313
// This will later be called on the Rust side via FFI.
14-
bool *ctest_const__ON(void) {
14+
bool *ctest_const__ON(void)
15+
{
1516
return &ctest_const_ON_val_static;
1617
}
1718

@@ -23,7 +24,8 @@ uint64_t ctest_align_of__in6_addr(void) { return _Alignof(in6_addr); }
2324

2425
// Return `1` if the type is signed, otherwise return `0`.
2526
// Casting -1 to the aliased type if signed evaluates to `-1 < 0`, if unsigned to `MAX_VALUE < 0`
26-
uint32_t ctest_signededness_of__in6_addr(void) {
27-
in6_addr all_ones = (in6_addr) -1;
27+
uint32_t ctest_signededness_of__in6_addr(void)
28+
{
29+
in6_addr all_ones = (in6_addr)-1;
2830
return all_ones < 0;
2931
}

ctest-next/tests/input/simple.out.with-renames.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ static char *ctest_const_A_val_static = A;
1111

1212
// Define a function that returns a pointer to the value of the constant to test.
1313
// This will later be called on the Rust side via FFI.
14-
char *ctest_const_cstr__A(void) {
14+
char *ctest_const_cstr__A(void)
15+
{
1516
return ctest_const_A_val_static;
1617
}
1718

1819
static char *ctest_const_B_val_static = C_B;
1920

2021
// Define a function that returns a pointer to the value of the constant to test.
2122
// This will later be called on the Rust side via FFI.
22-
char *ctest_const_cstr__B(void) {
23+
char *ctest_const_cstr__B(void)
24+
{
2325
return ctest_const_B_val_static;
2426
}
2527

@@ -43,7 +45,8 @@ uint64_t ctest_align_of__Word(void) { return _Alignof(union Word); }
4345

4446
// Return `1` if the type is signed, otherwise return `0`.
4547
// Casting -1 to the aliased type if signed evaluates to `-1 < 0`, if unsigned to `MAX_VALUE < 0`
46-
uint32_t ctest_signededness_of__Byte(void) {
47-
Byte all_ones = (Byte) -1;
48+
uint32_t ctest_signededness_of__Byte(void)
49+
{
50+
Byte all_ones = (Byte)-1;
4851
return all_ones < 0;
4952
}

ctest-next/tests/input/simple.out.with-skips.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ static char *ctest_const_A_val_static = A;
1111

1212
// Define a function that returns a pointer to the value of the constant to test.
1313
// This will later be called on the Rust side via FFI.
14-
char *ctest_const_cstr__A(void) {
14+
char *ctest_const_cstr__A(void)
15+
{
1516
return ctest_const_A_val_static;
1617
}
1718

@@ -35,7 +36,8 @@ uint64_t ctest_align_of__Word(void) { return _Alignof(union Word); }
3536

3637
// Return `1` if the type is signed, otherwise return `0`.
3738
// Casting -1 to the aliased type if signed evaluates to `-1 < 0`, if unsigned to `MAX_VALUE < 0`
38-
uint32_t ctest_signededness_of__Byte(void) {
39-
Byte all_ones = (Byte) -1;
39+
uint32_t ctest_signededness_of__Byte(void)
40+
{
41+
Byte all_ones = (Byte)-1;
4042
return all_ones < 0;
4143
}

0 commit comments

Comments
 (0)