test_stream: make filename bigger, and increase the random alphabet
This commit is contained in:
@@ -14,18 +14,31 @@
|
|||||||
#include <alisp/stream.h>
|
#include <alisp/stream.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
char valid_filename[24];
|
char valid_filename[50];
|
||||||
FILE *valid_fp = NULL;
|
FILE *valid_fp = NULL;
|
||||||
FILE *invalid_fp = NULL;
|
FILE *invalid_fp = NULL;
|
||||||
|
|
||||||
void stream_test_prologue(void)
|
void stream_test_prologue(void)
|
||||||
{
|
{
|
||||||
|
const char filename_prefix[] = "build/stream_test_";
|
||||||
valid_filename[ARRSIZE(valid_filename) - 1] = '\0';
|
valid_filename[ARRSIZE(valid_filename) - 1] = '\0';
|
||||||
memcpy(valid_filename, "build/stream_test_", 18);
|
memcpy(valid_filename, filename_prefix, ARRSIZE(filename_prefix) - 1);
|
||||||
for (u64 i = 0; i < 5; ++i)
|
for (u64 i = ARRSIZE(filename_prefix) - 1; i < ARRSIZE(valid_filename) - 1;
|
||||||
valid_filename[18 + i] = (rand() % 26) + 'a';
|
++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");
|
valid_fp = fopen(valid_filename, "wb");
|
||||||
// This should do a few things for us
|
// This should do a few things for us
|
||||||
// 1) Create a file, or clear the contents of it if it exists already.
|
// 1) Create a file, or clear the contents of it if it exists already.
|
||||||
|
|||||||
Reference in New Issue
Block a user