From 9452a14567cf558815f120c947866a697ff31ef4 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 6 Feb 2026 04:34:10 +0000 Subject: [PATCH] test_stream: make filename bigger, and increase the random alphabet --- test/test_stream.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/test_stream.c b/test/test_stream.c index b039b70..26113d2 100644 --- a/test/test_stream.c +++ b/test/test_stream.c @@ -14,18 +14,31 @@ #include #include -char valid_filename[24]; +char valid_filename[50]; FILE *valid_fp = NULL; FILE *invalid_fp = NULL; void stream_test_prologue(void) { + const char filename_prefix[] = "build/stream_test_"; valid_filename[ARRSIZE(valid_filename) - 1] = '\0'; - memcpy(valid_filename, "build/stream_test_", 18); - for (u64 i = 0; i < 5; ++i) - valid_filename[18 + i] = (rand() % 26) + 'a'; + memcpy(valid_filename, filename_prefix, ARRSIZE(filename_prefix) - 1); + for (u64 i = ARRSIZE(filename_prefix) - 1; i < ARRSIZE(valid_filename) - 1; + ++i) + { + u8 num = (rand() % 36); + if (num < 26) + { + valid_filename[i] = num + 'a'; + } + else + { + valid_filename[i] = num + '0'; + } + } - TEST_INFO("Creating file named `%s`\n", valid_filename); + TEST_INFO("Creating file named `%.*s`\n", (int)ARRSIZE(valid_filename), + valid_filename); valid_fp = fopen(valid_filename, "wb"); // This should do a few things for us // 1) Create a file, or clear the contents of it if it exists already.