diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91adcf0d1..5fd79a8c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -189,7 +189,6 @@ if (MRDOX_BUILD_TESTS)
target_link_libraries(mrdox-test PRIVATE mrdox-api ${llvm_libs})
target_include_directories(mrdox-test PRIVATE ${PROJECT_SOURCE_DIR}/source/tests)
add_test(NAME mrdox-test COMMAND mrdox-test
- "${PROJECT_SOURCE_DIR}/tests/n4944"
"${PROJECT_SOURCE_DIR}/tests/old-tests"
)
source_group(TREE ${PROJECT_SOURCE_DIR} PREFIX "" FILES CMakeLists.txt)
diff --git a/tests/generate.py b/tests/generate.py
new file mode 100644
index 000000000..79d84d862
--- /dev/null
+++ b/tests/generate.py
@@ -0,0 +1,43 @@
+#! python3
+
+import exrex
+import os
+
+def ToplevelFolder():
+ scriptPath = os.path.realpath(__file__)
+ parentDirectory = os.path.dirname(scriptPath)
+ return os.path.join(parentDirectory, "py")
+
+def EnumDeclarationsFolder():
+ return os.path.join(ToplevelFolder(), "dcl.enum")
+
+
+def GenerateEnumDeclarations():
+ #https://eel.is/c++draft/enum
+ enum_base = "(|: short|: unsigned int|: const long|: const volatile long long|: decltype\(0\))"
+ enumerator_initializer = "(| = 0| = true \? 1,2 : 3| = \!\+\[\]\(\)\{\})"
+ enumerators = " (|(A" + enumerator_initializer + "|A" + enumerator_initializer + ", B " + enumerator_initializer + "),?) "
+ regex = "enum (|EnumName|class EnumName|struct EnumName) " + enum_base + " (\{" + enumerators + "\})? ;"
+ generator = exrex.generate(regex)
+ declarations = list(generator)
+ # Unfortunately, the regex produces some invalid declarations. We remove them by hand as of now.
+ for invalidDeclaration in ["enum ;", "enum : short ;", "enum : unsigned int ;",
+ "enum : const long ;", "enum : const volatile long long ;",
+ "enum : decltype(0) ;", "enum EnumName ;"]:
+ try:
+ declarations.remove(invalidDeclaration)
+ except ValueError:
+ print("The invalid declaration \"" + invalidDeclaration + "\" gets no longer generated, so it can be removed from the list of invalid declarations.")
+ return declarations
+
+
+def GenerateIndexedCppFiles(parentDirectory, fileContents):
+ os.makedirs(parentDirectory, exist_ok=True)
+ for index, aDeclaration in enumerate(fileContents):
+ fileName = str(index) + ".cpp"
+ filePath = os.path.join(parentDirectory, fileName)
+ with open(filePath, "w") as f:
+ f.write(aDeclaration)
+
+
+GenerateIndexedCppFiles(EnumDeclarationsFolder(), GenerateEnumDeclarations())
diff --git a/tests/n4944/dcl.enum/1.cpp b/tests/n4944/dcl.enum/1.cpp
deleted file mode 100644
index e7f17836b..000000000
--- a/tests/n4944/dcl.enum/1.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#pragma clang diagnostic ignored "-Wmissing-declarations"
-enum {};
diff --git a/tests/n4944/dcl.enum/1.xml b/tests/n4944/dcl.enum/1.xml
deleted file mode 100644
index 9634807f6..000000000
--- a/tests/n4944/dcl.enum/1.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/tests/n4944/dcl.enum/2.cpp b/tests/n4944/dcl.enum/2.cpp
deleted file mode 100644
index d4c945d4e..000000000
--- a/tests/n4944/dcl.enum/2.cpp
+++ /dev/null
@@ -1 +0,0 @@
-enum struct X;
diff --git a/tests/n4944/dcl.enum/2.xml b/tests/n4944/dcl.enum/2.xml
deleted file mode 100644
index 1307a28c9..000000000
--- a/tests/n4944/dcl.enum/2.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/tests/n4944/dcl.enum/3.cpp b/tests/n4944/dcl.enum/3.cpp
deleted file mode 100644
index afc79c336..000000000
--- a/tests/n4944/dcl.enum/3.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-enum struct X;
-enum struct X {};
-
diff --git a/tests/n4944/dcl.enum/3.xml b/tests/n4944/dcl.enum/3.xml
deleted file mode 100644
index 338dc64b6..000000000
--- a/tests/n4944/dcl.enum/3.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/n4944/dcl.enum/4.cpp b/tests/n4944/dcl.enum/4.cpp
deleted file mode 100644
index e9f82496d..000000000
--- a/tests/n4944/dcl.enum/4.cpp
+++ /dev/null
@@ -1 +0,0 @@
-enum E : char;
diff --git a/tests/n4944/dcl.enum/4.xml b/tests/n4944/dcl.enum/4.xml
deleted file mode 100644
index 368421982..000000000
--- a/tests/n4944/dcl.enum/4.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/tests/n4944/dcl.enum/5.cpp b/tests/n4944/dcl.enum/5.cpp
deleted file mode 100644
index 2cd67cb76..000000000
--- a/tests/n4944/dcl.enum/5.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-enum E : char;
-enum E : char {};
-
diff --git a/tests/n4944/dcl.enum/5.xml b/tests/n4944/dcl.enum/5.xml
deleted file mode 100644
index 8c130aa7b..000000000
--- a/tests/n4944/dcl.enum/5.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/old-tests/mem-fn.xml b/tests/old-tests/mem-fn.xml
index 13f4ead46..b6080d724 100644
--- a/tests/old-tests/mem-fn.xml
+++ b/tests/old-tests/mem-fn.xml
@@ -6,23 +6,19 @@
-
-
-
-
@@ -31,7 +27,6 @@
-
@@ -44,14 +39,12 @@
-
-
@@ -59,7 +52,6 @@
-
@@ -72,35 +64,30 @@
-
-
-
-
-
@@ -113,14 +100,12 @@
-
-
@@ -134,7 +119,6 @@
-
diff --git a/tests/old-tests/noreturn.xml b/tests/old-tests/noreturn.xml
index 39e2ba0c1..34885cef7 100644
--- a/tests/old-tests/noreturn.xml
+++ b/tests/old-tests/noreturn.xml
@@ -7,17 +7,14 @@
-
-
-