[Linux-kernel-mentees] [PATCH 12/13] tests: Add test case for assigned enumerator

Jaskaran Singh jaskaransingh7654321 at gmail.com
Sun Mar 8 08:43:55 UTC 2020


Add a test case to verify correct pretty printing of
enumerators that are assigned. The test case should cover
minused assigned enumerators, plussed assigned enumerators
and correct matching of an enum with an assigned enumerator.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
 tests/enum_assign.c     |  6 ++++++
 tests/enum_assign.cocci | 11 +++++++++++
 tests/enum_assign.res   |  7 +++++++
 3 files changed, 24 insertions(+)
 create mode 100644 tests/enum_assign.c
 create mode 100644 tests/enum_assign.cocci
 create mode 100644 tests/enum_assign.res

diff --git a/tests/enum_assign.c b/tests/enum_assign.c
new file mode 100644
index 00000000..9c2d16df
--- /dev/null
+++ b/tests/enum_assign.c
@@ -0,0 +1,6 @@
+enum h {
+	a = 0,
+	c,
+	x,
+	b
+};
diff --git a/tests/enum_assign.cocci b/tests/enum_assign.cocci
new file mode 100644
index 00000000..a1a59ef8
--- /dev/null
+++ b/tests/enum_assign.cocci
@@ -0,0 +1,11 @@
+@@
+@@
+
+enum h {
+  ...,
+- a = 0,
++ q = 0,
+  ...,
+  b,
++ z
+};
diff --git a/tests/enum_assign.res b/tests/enum_assign.res
new file mode 100644
index 00000000..3b204aa0
--- /dev/null
+++ b/tests/enum_assign.res
@@ -0,0 +1,7 @@
+enum h {
+	q = 0,
+	c,
+	x,
+	b,
+	z
+};
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list