summaryrefslogtreecommitdiff
path: root/tests/new_arrays.c
diff options
context:
space:
mode:
authorDavid Moc <personal@cdatgoose.org>2026-03-08 15:02:30 +0100
committerDavid Moc <personal@cdatgoose.org>2026-03-08 15:02:30 +0100
commitad035ac5d942c6448a6a0464b995c2868a8378db (patch)
tree9c2c779d544a45b4234a6a3c311aa7b612ea975e /tests/new_arrays.c
parent0385817bb1301a778bb33f8405a435293b9f8905 (diff)
Gosh.\nFixed bugs in offsetting. Added syscalls. Cleaned up the previous commenting (used to pass the project thu claude to add comments but LLMs are dumb). Removed the LLM made test runner cuz fuck AI.HEADmaster
Diffstat (limited to 'tests/new_arrays.c')
-rw-r--r--tests/new_arrays.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/new_arrays.c b/tests/new_arrays.c
new file mode 100644
index 0000000..5b7b59b
--- /dev/null
+++ b/tests/new_arrays.c
@@ -0,0 +1,31 @@
+int strlen_p(char *s) {
+ int n = 0;
+ while (s[n] != 0) { n = n + 1; }
+ return n;
+}
+
+int sum(int *arr, int n) {
+ int s = 0;
+ int i = 0;
+ while (i < n) { s += arr[i]; i++; }
+ return s;
+}
+
+int main() {
+ int nums[5] = {10, 20, 30, 40, 50};
+ int total = sum(nums, 5);
+
+ char msg[4] = {'O', 'K', '\n', 0};
+ syscall(1, 1, msg, 3);
+
+ int *p = nums;
+ p += 2;
+ int mid = *p;
+
+ int n = sizeof(nums);
+ int c = sizeof(char);
+ int ip = sizeof(int);
+
+ int score = (total == 150) + (mid == 30) + (n == 20) + (c == 1) + (ip == 4);
+ return score;
+}