tests: add a test_ prefix to all files that contain actual tests

This will make it easier to differentiate with utility files, as the next change
will add sevral
This commit is contained in:
Khaïs COLIN 2025-03-11 16:05:10 +01:00
parent bc5be67bf6
commit f5ae3a5d8d
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
8 changed files with 7 additions and 7 deletions

View file

@ -0,0 +1,67 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* metacharacters.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/06 15:21:00 by kcolin #+# #+# */
/* Updated: 2025/02/11 18:32:01 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include "../src/parser/matchers/metacharacter.h"
#include <assert.h>
#include <stdio.h>
#include <unistd.h>
void test_metacharacters(void)
{
dup2(STDERR_FILENO, STDIN_FILENO);
char c = 'a';
printf("not metachar:");
while (c != 'z')
{
printf("%c", c);
assert(!is_metacharacter(c));
c++;
}
c = 'A';
while (c != 'Z')
{
printf("%c", c);
assert(!is_metacharacter(c));
c++;
}
c = '0';
while (c != '9')
{
printf("%c", c);
assert(!is_metacharacter(c));
c++;
}
char *not_metachars = ";[]{}*+=_-";
int i = 0;
while (not_metachars[i] != '\0')
{
dprintf(STDERR_FILENO, "%c", not_metachars[i]);
assert(!is_metacharacter(not_metachars[i]));
i++;
}
char *metachars = " \t\n|&()<>";
i = 0;
printf("\nmetachar:");
while (metachars[i] != '\0')
{
dprintf(STDERR_FILENO, "%c (%d) ", metachars[i], metachars[i]);
assert(is_metacharacter(metachars[i]));
i++;
}
printf("\n");
}
int main(void)
{
test_metacharacters();
return (0);
}