here_doc: generate random filenames

This commit is contained in:
Khaïs COLIN 2025-03-10 18:22:22 +01:00
parent 0486368a07
commit 99babbf6d2
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
3 changed files with 69 additions and 4 deletions

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/07 11:43:32 by khais #+# #+# */
/* Updated: 2025/03/10 18:21:43 by khais ### ########.fr */
/* Updated: 2025/03/10 18:23:36 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,27 @@
#include "testutil.h"
#include "libft.h"
#include <unistd.h>
#include "../src/executing/here_doc/here_doc.h"
static void test_here_doc_filename_generation(void)
{
char *filename1;
char *filename2;
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
filename1 = here_doc_random_filename();
filename2 = here_doc_random_filename();
assert(filename1 != NULL);
assert(filename2 != NULL);
ft_dprintf(STDERR_FILENO, "Got filename: [%s]\n", filename1);
ft_dprintf(STDERR_FILENO, "Got filename: [%s]\n", filename2);
assert(ft_strcmp(filename1, filename2) != 0);
free(filename1);
free(filename2);
do_leak_check();
}
int main(void) {
test_here_doc_filename_generation();
return (0);
}