@@ -11,19 +11,19 @@ fn with_simple_enum() {
11
11
#[derive(Copy, Clone)]
12
12
#[repr(u32)]
13
13
#[derive(Debug)]
14
- pub enum Enum_Foo { Bar = 0, Qux = 1, }
14
+ pub enum Foo { Bar = 0, Qux = 1, }
15
15
#[derive(Copy, Clone)]
16
16
#[repr(i32)]
17
17
#[derive(Debug)]
18
- pub enum Enum_Neg { MinusOne = -1, One = 1, }
18
+ pub enum Neg { MinusOne = -1, One = 1, }
19
19
" ) ;
20
20
assert_bind_eq ( default_without_rust_enums ( ) , "headers/enum.h" , "
21
- type Enum_Foo = u32;
22
- const Bar: Enum_Foo = 0;
23
- const Qux: Enum_Foo = 1;
24
- type Enum_Neg = i32;
25
- const MinusOne: Enum_Neg = -1;
26
- const One: Enum_Neg = 1;
21
+ type Foo = u32;
22
+ const Bar: Foo = 0;
23
+ const Qux: Foo = 1;
24
+ type Neg = i32;
25
+ const MinusOne: Neg = -1;
26
+ const One: Neg = 1;
27
27
" ) ;
28
28
}
29
29
@@ -33,42 +33,42 @@ fn with_packed_enums() {
33
33
#[derive(Copy, Clone)]
34
34
#[repr(u8)]
35
35
#[derive(Debug)]
36
- pub enum Enum_Foo { Bar = 0, Qux = 1, }
36
+ pub enum Foo { Bar = 0, Qux = 1, }
37
37
#[derive(Copy, Clone)]
38
38
#[repr(i8)]
39
39
#[derive(Debug)]
40
- pub enum Enum_Neg { MinusOne = -1, One = 1, }
40
+ pub enum Neg { MinusOne = -1, One = 1, }
41
41
#[derive(Copy, Clone)]
42
42
#[repr(u16)]
43
43
#[derive(Debug)]
44
- pub enum Enum_Bigger { Much = 255, Larger = 256, }
44
+ pub enum Bigger { Much = 255, Larger = 256, }
45
45
" ) ;
46
46
assert_bind_eq ( default_without_rust_enums ( ) , "headers/enum_packed.h" , "
47
- type Enum_Foo = u8;
48
- const Bar: Enum_Foo = 0;
49
- const Qux: Enum_Foo = 1;
50
- type Enum_Neg = i8;
51
- const MinusOne: Enum_Neg = -1;
52
- const One: Enum_Neg = 1;
53
- type Enum_Bigger = u16;
54
- const Much: Enum_Bigger = 255;
55
- const Larger: Enum_Bigger = 256;
47
+ type Foo = u8;
48
+ const Bar: Foo = 0;
49
+ const Qux: Foo = 1;
50
+ type Neg = i8;
51
+ const MinusOne: Neg = -1;
52
+ const One: Neg = 1;
53
+ type Bigger = u16;
54
+ const Much: Bigger = 255;
55
+ const Larger: Bigger = 256;
56
56
" ) ;
57
57
}
58
58
59
59
#[ test]
60
60
fn with_duplicate_enum_value ( ) {
61
61
assert_bind_eq ( Default :: default ( ) , "headers/enum_dupe.h" , "
62
- pub const Dupe: Enum_Foo = Enum_Foo ::Bar;
62
+ pub const Dupe: Foo = Foo ::Bar;
63
63
#[derive(Copy, Clone)]
64
64
#[repr(u32)]
65
65
#[derive(Debug)]
66
- pub enum Enum_Foo { Bar = 1, }
66
+ pub enum Foo { Bar = 1, }
67
67
" ) ;
68
68
assert_bind_eq ( default_without_rust_enums ( ) , "headers/enum_dupe.h" , "
69
- type Enum_Foo = u32;
70
- const Bar: Enum_Foo = 1;
71
- const Dupe: Enum_Foo = 1;
69
+ type Foo = u32;
70
+ const Bar: Foo = 1;
71
+ const Dupe: Foo = 1;
72
72
" ) ;
73
73
}
74
74
@@ -78,38 +78,38 @@ fn with_explicitly_typed_cxx_enum() {
78
78
#[derive(Copy, Clone)]
79
79
#[repr(u8)]
80
80
#[derive(Debug)]
81
- pub enum Enum_Foo { Bar = 0, Qux = 1, }
81
+ pub enum Foo { Bar = 0, Qux = 1, }
82
82
#[derive(Copy, Clone)]
83
83
#[repr(i8)]
84
84
#[derive(Debug)]
85
- pub enum Enum_Neg { MinusOne = -1, One = 1, }
85
+ pub enum Neg { MinusOne = -1, One = 1, }
86
86
#[derive(Copy, Clone)]
87
87
#[repr(u16)]
88
88
#[derive(Debug)]
89
- pub enum Enum_Bigger { Much = 255, Larger = 256, }
89
+ pub enum Bigger { Much = 255, Larger = 256, }
90
90
#[derive(Copy, Clone)]
91
91
#[repr(i64)]
92
92
#[derive(Debug)]
93
- pub enum Enum_MuchLong { MuchLow = -4294967296, }
93
+ pub enum MuchLong { MuchLow = -4294967296, }
94
94
#[derive(Copy, Clone)]
95
95
#[repr(u64)]
96
96
#[derive(Debug)]
97
- pub enum Enum_MuchLongLong { MuchHigh = 4294967296, }
97
+ pub enum MuchLongLong { MuchHigh = 4294967296, }
98
98
" ) ;
99
99
assert_bind_eq ( default_without_rust_enums ( ) , "headers/enum_explicit_type.hpp" , "
100
- type Enum_Foo = u8;
101
- const Bar: Enum_Foo = 0;
102
- const Qux: Enum_Foo = 1;
103
- type Enum_Neg = i8;
104
- const MinusOne: Enum_Neg = -1;
105
- const One: Enum_Neg = 1;
106
- type Enum_Bigger = u16;
107
- const Much: Enum_Bigger = 255;
108
- const Larger: Enum_Bigger = 256;
109
- type Enum_MuchLong = i64;
110
- const MuchLow: Enum_MuchLong = -4294967296;
111
- type Enum_MuchLongLong = u64;
112
- const MuchHigh: Enum_MuchLongLong = 4294967296;
100
+ type Foo = u8;
101
+ const Bar: Foo = 0;
102
+ const Qux: Foo = 1;
103
+ type Neg = i8;
104
+ const MinusOne: Neg = -1;
105
+ const One: Neg = 1;
106
+ type Bigger = u16;
107
+ const Much: Bigger = 255;
108
+ const Larger: Bigger = 256;
109
+ type MuchLong = i64;
110
+ const MuchLow: MuchLong = -4294967296;
111
+ type MuchLongLong = u64;
112
+ const MuchHigh: MuchLongLong = 4294967296;
113
113
" ) ;
114
114
}
115
115
@@ -119,23 +119,23 @@ fn with_overflowed_enum_value() {
119
119
#[derive(Copy, Clone)]
120
120
#[repr(u32)]
121
121
#[derive(Debug)]
122
- pub enum Enum_Foo {
122
+ pub enum Foo {
123
123
BAP_ARM = 9698489,
124
124
BAP_X86 = 11960045,
125
125
BAP_X86_64 = 3128633167,
126
126
}
127
127
#[derive(Copy, Clone)]
128
128
#[repr(u16)]
129
129
#[derive(Debug)]
130
- pub enum Enum_Bar { One = 1, Big = 2, }
130
+ pub enum Bar { One = 1, Big = 2, }
131
131
" ) ;
132
132
assert_bind_eq ( default_without_rust_enums ( ) , "headers/overflowed_enum.hpp" , "
133
- type Enum_Foo = u32;
134
- const BAP_ARM: Enum_Foo = 9698489;
135
- const BAP_X86: Enum_Foo = 11960045;
136
- const BAP_X86_64: Enum_Foo = 3128633167;
137
- type Enum_Bar = u16;
138
- const One: Enum_Bar = 1;
139
- const Big: Enum_Bar = 2;
133
+ type Foo = u32;
134
+ const BAP_ARM: Foo = 9698489;
135
+ const BAP_X86: Foo = 11960045;
136
+ const BAP_X86_64: Foo = 3128633167;
137
+ type Bar = u16;
138
+ const One: Bar = 1;
139
+ const Big: Bar = 2;
140
140
" ) ;
141
141
}
0 commit comments