feat: added tests
This commit is contained in:
parent
a7b7cda496
commit
f3377656e4
6 changed files with 234 additions and 10 deletions
62
tests/char.c
Normal file
62
tests/char.c
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#include "test.h"
|
||||
#include "libft.h"
|
||||
|
||||
TEST(test_isalpha) {
|
||||
ASSERT(ft_isalpha('a'));
|
||||
ASSERT(ft_isalpha('Z'));
|
||||
ASSERT(!ft_isalpha('1'));
|
||||
ASSERT(!ft_isalpha('@'));
|
||||
ASSERT(!ft_isalpha(' '));
|
||||
}
|
||||
|
||||
TEST(test_isdigit) {
|
||||
ASSERT(ft_isdigit('0'));
|
||||
ASSERT(ft_isdigit('9'));
|
||||
ASSERT(!ft_isdigit('a'));
|
||||
ASSERT(!ft_isdigit(' '));
|
||||
ASSERT(!ft_isdigit('#'));
|
||||
}
|
||||
|
||||
TEST(test_islower) {
|
||||
ASSERT(ft_islower('a'));
|
||||
ASSERT(ft_islower('z'));
|
||||
ASSERT(!ft_islower('A'));
|
||||
ASSERT(!ft_islower('0'));
|
||||
ASSERT(!ft_islower(' '));
|
||||
}
|
||||
|
||||
TEST(test_isupper) {
|
||||
ASSERT(ft_isupper('A'));
|
||||
ASSERT(ft_isupper('Z'));
|
||||
ASSERT(!ft_isupper('a'));
|
||||
ASSERT(!ft_isupper('0'));
|
||||
ASSERT(!ft_isupper(' '));
|
||||
}
|
||||
|
||||
TEST(test_tolower) {
|
||||
ASSERT(ft_tolower('A') == 'a');
|
||||
ASSERT(ft_tolower('Z') == 'z');
|
||||
ASSERT(ft_tolower('a') == 'a');
|
||||
ASSERT(ft_tolower('z') == 'z');
|
||||
ASSERT(ft_tolower('1') == '1');
|
||||
ASSERT(ft_tolower(' ') == ' ');
|
||||
}
|
||||
|
||||
TEST(test_toupper) {
|
||||
ASSERT(ft_toupper('a') == 'A');
|
||||
ASSERT(ft_toupper('z') == 'Z');
|
||||
ASSERT(ft_toupper('A') == 'A');
|
||||
ASSERT(ft_toupper('Z') == 'Z');
|
||||
ASSERT(ft_toupper('1') == '1');
|
||||
ASSERT(ft_toupper(' ') == ' ');
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
RUN_TEST(test_isalpha);
|
||||
RUN_TEST(test_isdigit);
|
||||
RUN_TEST(test_islower);
|
||||
RUN_TEST(test_isupper);
|
||||
RUN_TEST(test_tolower);
|
||||
RUN_TEST(test_toupper);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue