summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-08 07:35:45 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-11-08 19:48:20 +0100
commit19db528515e5e099cecb3fe7bf89209482046bd6 (patch)
treecde99a29dcb722285d8df7661a222fc863fa308f
parentc47e589435545ecfd4e815bb0de12b7d9292771b (diff)
Moar tests.
-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,
+};