Skip to content

Commit f189b2a

Browse files
committed
Update tests
1 parent 65ea32a commit f189b2a

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎tests/unit/out/refcount/enum_underlying_type.rs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ pub const Sized_SIZED_B: Sized = 65535;
2424
pub type Scoped = i8;
2525
pub const Scoped_NEG: Scoped = -2;
2626
pub const Scoped_POS: Scoped = 2;
27+
pub type Empty = bool;
28+
#[derive(Clone, Record, ByteRepr, VaArg, FnPtrArg)]
29+
#[byte_size(1)]
30+
pub struct HoldsEmpty {
31+
#[offset(0)]
32+
pub e: Empty,
33+
}
34+
impl Default for HoldsEmpty {
35+
fn default() -> Self {
36+
HoldsEmpty {
37+
e: <Empty>::default(),
38+
}
39+
}
40+
}
2741
pub fn main() {
2842
__cpp2rust_init_globals();
2943
std::process::exit(main_0());
@@ -55,6 +69,10 @@ fn main_0() -> i32 {
5569
let mut sc: Scoped = Scoped_NEG;
5670
assert!(((sc as i32) == -2_i32));
5771
assert!((((Scoped_POS as i8) as i32) == 2));
72+
let mut he: HoldsEmpty = <HoldsEmpty>::default();
73+
assert!(!(he.e));
74+
let mut ev: Empty = <Empty>::default();
75+
assert!(((ev as i32) == (he.e as i32)));
5876
return 0;
5977
}
6078
pub fn __cpp2rust_init_globals() {}

‎tests/unit/out/unsafe/enum_underlying_type.rs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ pub const Sized_SIZED_B: Sized = 65535;
2424
pub type Scoped = i8;
2525
pub const Scoped_NEG: Scoped = -2;
2626
pub const Scoped_POS: Scoped = 2;
27+
pub type Empty = bool;
28+
#[repr(C)]
29+
#[derive(Copy, Clone, VaArg, FnPtrArg)]
30+
pub struct HoldsEmpty {
31+
pub e: Empty,
32+
}
33+
impl Default for HoldsEmpty {
34+
fn default() -> Self {
35+
HoldsEmpty { e: false }
36+
}
37+
}
2738
pub fn main() {
2839
unsafe {
2940
__cpp2rust_init_globals();
@@ -57,6 +68,10 @@ unsafe fn main_0() -> i32 {
5768
let mut sc: Scoped = Scoped_NEG;
5869
assert!(((sc as i32) == (-2_i32)));
5970
assert!((((Scoped_POS as i8) as i32) == (2)));
71+
let mut he: HoldsEmpty = <HoldsEmpty>::default();
72+
assert!(!(he.e));
73+
let mut ev: Empty = false;
74+
assert!(((ev as i32) == (he.e as i32)));
6075
return 0;
6176
}
6277
pub unsafe fn __cpp2rust_init_globals() {}

0 commit comments

Comments
 (0)