From 3c38595170473aa84e18da0c149392fa402c970d Mon Sep 17 00:00:00 2001
From: Justin <meimar@ualberta.ca>
Date: Fri, 18 Oct 2024 13:16:41 -0600
Subject: [PATCH] sort files in subpackage

---
 dragon_runner/config.py                           |  2 +-
 tests/configs/runtimeConfigLinux.json             |  2 +-
 tests/lib/src/fib.c                               |  4 +++-
 .../RegularPass/valid_tests/017_true_empty.c      |  3 +++
 .../packages/RuntimeCPackage/runtime/002_square.c | 15 +++++++++++++++
 5 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 tests/packages/CPackage/RegularPass/valid_tests/017_true_empty.c
 create mode 100644 tests/packages/RuntimeCPackage/runtime/002_square.c

diff --git a/dragon_runner/config.py b/dragon_runner/config.py
index b5dae7f..e65e3b8 100644
--- a/dragon_runner/config.py
+++ b/dragon_runner/config.py
@@ -48,7 +48,7 @@ def gather_tests(self) -> List[TestFile]:
             test_path = os.path.join(self.path, file)
             if self.is_test(test_path):
                 tests.append(TestFile(test_path))
-        return tests 
+        return sorted(tests, key=lambda x: x.file) 
 
 class Package(Verifiable):
     """
diff --git a/tests/configs/runtimeConfigLinux.json b/tests/configs/runtimeConfigLinux.json
index 4ea79f2..98057f4 100644
--- a/tests/configs/runtimeConfigLinux.json
+++ b/tests/configs/runtimeConfigLinux.json
@@ -31,4 +31,4 @@
     ]
   } 
 }
-  
\ No newline at end of file
+  
diff --git a/tests/lib/src/fib.c b/tests/lib/src/fib.c
index c0c8c49..18241ec 100644
--- a/tests/lib/src/fib.c
+++ b/tests/lib/src/fib.c
@@ -6,4 +6,6 @@ int fib(int n) {
         return 1;
     }
     return fib(n-1) + fib(n-2);
-}
\ No newline at end of file
+}
+
+int square(int n) { return n*n; }
\ No newline at end of file
diff --git a/tests/packages/CPackage/RegularPass/valid_tests/017_true_empty.c b/tests/packages/CPackage/RegularPass/valid_tests/017_true_empty.c
new file mode 100644
index 0000000..e9cdae1
--- /dev/null
+++ b/tests/packages/CPackage/RegularPass/valid_tests/017_true_empty.c
@@ -0,0 +1,3 @@
+int main() {
+    return 0;
+}
\ No newline at end of file
diff --git a/tests/packages/RuntimeCPackage/runtime/002_square.c b/tests/packages/RuntimeCPackage/runtime/002_square.c
new file mode 100644
index 0000000..d6f3579
--- /dev/null
+++ b/tests/packages/RuntimeCPackage/runtime/002_square.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+// Runtime config must supply the definition for fib
+// **at runtime**
+
+int square(int n);
+
+int main() {
+
+    printf("%d\n", square(8));
+    return 0;
+}
+
+//CHECK:64
+//CHECK:
\ No newline at end of file