summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/expectations/tests/bitfield-enum-basic.rs20
-rw-r--r--tests/headers/bitfield-enum-basic.h15
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/expectations/tests/bitfield-enum-basic.rs b/tests/expectations/tests/bitfield-enum-basic.rs
new file mode 100644
index 00000000..c287d9eb
--- /dev/null
+++ b/tests/expectations/tests/bitfield-enum-basic.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+const Foo_Bar: Foo = Foo(2);
+const Foo_Baz: Foo = Foo(4);
+const Foo_Duplicated: Foo = Foo(4);
+const Foo_Negative: Foo = Foo(-3);
+#[repr(C)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Foo(pub i32);
+const Buz_Bar: Buz = Buz(2);
+const Buz_Baz: Buz = Buz(4);
+const Buz_Duplicated: Buz = Buz(4);
+const Buz_Negative: Buz = Buz(-3);
+#[repr(C)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Buz(pub i8);
diff --git a/tests/headers/bitfield-enum-basic.h b/tests/headers/bitfield-enum-basic.h
new file mode 100644
index 00000000..890735e9
--- /dev/null
+++ b/tests/headers/bitfield-enum-basic.h
@@ -0,0 +1,15 @@
+// bindgen-flags: --bitfield-enum ".*" -- -std=c++11
+
+enum Foo {
+ Bar = 1 << 1,
+ Baz = 1 << 2,
+ Duplicated = 1 << 2,
+ Negative = -3,
+};
+
+enum class Buz : signed char {
+ Bar = 1 << 1,
+ Baz = 1 << 2,
+ Duplicated = 1 << 2,
+ Negative = -3,
+};