From e6f53e82b0f8ae1cff3749ea3476c2074c325d7b Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 12 Feb 2020 23:14:11 +0100 Subject: Added ctype tests, ignore htnew tests --- test/src/ctype/test_ft_isalnum.c | 15 +++++++++++++++ test/src/ctype/test_ft_isalpha.c | 15 +++++++++++++++ test/src/ctype/test_ft_isascii.c | 15 +++++++++++++++ test/src/ctype/test_ft_isblank.c | 15 +++++++++++++++ test/src/ctype/test_ft_isdigit.c | 15 +++++++++++++++ test/src/ctype/test_ft_isprint.c | 15 +++++++++++++++ test/src/ctype/test_ft_isspace.c | 15 +++++++++++++++ test/src/ctype/test_ft_todigit.c | 20 ++++++++++++++++++++ test/src/ctype/test_ft_tolower.c | 15 +++++++++++++++ test/src/ctype/test_ft_toupper.c | 15 +++++++++++++++ 10 files changed, 155 insertions(+) create mode 100644 test/src/ctype/test_ft_isalnum.c create mode 100644 test/src/ctype/test_ft_isalpha.c create mode 100644 test/src/ctype/test_ft_isascii.c create mode 100644 test/src/ctype/test_ft_isblank.c create mode 100644 test/src/ctype/test_ft_isdigit.c create mode 100644 test/src/ctype/test_ft_isprint.c create mode 100644 test/src/ctype/test_ft_isspace.c create mode 100644 test/src/ctype/test_ft_todigit.c create mode 100644 test/src/ctype/test_ft_tolower.c create mode 100644 test/src/ctype/test_ft_toupper.c (limited to 'test/src/ctype') diff --git a/test/src/ctype/test_ft_isalnum.c b/test/src/ctype/test_ft_isalnum.c new file mode 100644 index 0000000..0019a03 --- /dev/null +++ b/test/src/ctype/test_ft_isalnum.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isalnum); + +TEST_SETUP(ft_isalnum) +{} + +TEST_TEAR_DOWN(ft_isalnum) +{} + +TEST(ft_isalnum, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isalnum(i), !!ft_isalnum(i)); +} diff --git a/test/src/ctype/test_ft_isalpha.c b/test/src/ctype/test_ft_isalpha.c new file mode 100644 index 0000000..9846985 --- /dev/null +++ b/test/src/ctype/test_ft_isalpha.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isalpha); + +TEST_SETUP(ft_isalpha) +{} + +TEST_TEAR_DOWN(ft_isalpha) +{} + +TEST(ft_isalpha, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isalpha(i), !!ft_isalpha(i)); +} diff --git a/test/src/ctype/test_ft_isascii.c b/test/src/ctype/test_ft_isascii.c new file mode 100644 index 0000000..c052571 --- /dev/null +++ b/test/src/ctype/test_ft_isascii.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isascii); + +TEST_SETUP(ft_isascii) +{} + +TEST_TEAR_DOWN(ft_isascii) +{} + +TEST(ft_isascii, base) +{ + for (int i = 0; i < UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isascii(i), !!ft_isascii(i)); +} diff --git a/test/src/ctype/test_ft_isblank.c b/test/src/ctype/test_ft_isblank.c new file mode 100644 index 0000000..3c8460f --- /dev/null +++ b/test/src/ctype/test_ft_isblank.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isblank); + +TEST_SETUP(ft_isblank) +{} + +TEST_TEAR_DOWN(ft_isblank) +{} + +TEST(ft_isblank, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isblank(i), !!ft_isblank(i)); +} diff --git a/test/src/ctype/test_ft_isdigit.c b/test/src/ctype/test_ft_isdigit.c new file mode 100644 index 0000000..74c210b --- /dev/null +++ b/test/src/ctype/test_ft_isdigit.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isdigit); + +TEST_SETUP(ft_isdigit) +{} + +TEST_TEAR_DOWN(ft_isdigit) +{} + +TEST(ft_isdigit, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isdigit(i), !!ft_isdigit(i)); +} diff --git a/test/src/ctype/test_ft_isprint.c b/test/src/ctype/test_ft_isprint.c new file mode 100644 index 0000000..0f15661 --- /dev/null +++ b/test/src/ctype/test_ft_isprint.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isprint); + +TEST_SETUP(ft_isprint) +{} + +TEST_TEAR_DOWN(ft_isprint) +{} + +TEST(ft_isprint, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isprint(i), !!ft_isprint(i)); +} diff --git a/test/src/ctype/test_ft_isspace.c b/test/src/ctype/test_ft_isspace.c new file mode 100644 index 0000000..f94a1ea --- /dev/null +++ b/test/src/ctype/test_ft_isspace.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_isspace); + +TEST_SETUP(ft_isspace) +{} + +TEST_TEAR_DOWN(ft_isspace) +{} + +TEST(ft_isspace, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(!!isspace(i), !!ft_isspace(i)); +} diff --git a/test/src/ctype/test_ft_todigit.c b/test/src/ctype/test_ft_todigit.c new file mode 100644 index 0000000..cd8d9f3 --- /dev/null +++ b/test/src/ctype/test_ft_todigit.c @@ -0,0 +1,20 @@ +#include "libft_test.h" + +TEST_GROUP(ft_todigit); + +TEST_SETUP(ft_todigit) +{} + +TEST_TEAR_DOWN(ft_todigit) +{} + +TEST(ft_todigit, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + { + if (isdigit(i)) + TEST_ASSERT_EQUAL(i - '0', ft_todigit(i)); + else + TEST_ASSERT_EQUAL(-1, ft_todigit(i)); + } +} diff --git a/test/src/ctype/test_ft_tolower.c b/test/src/ctype/test_ft_tolower.c new file mode 100644 index 0000000..9465544 --- /dev/null +++ b/test/src/ctype/test_ft_tolower.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_tolower); + +TEST_SETUP(ft_tolower) +{} + +TEST_TEAR_DOWN(ft_tolower) +{} + +TEST(ft_tolower, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(tolower(i), ft_tolower(i)); +} diff --git a/test/src/ctype/test_ft_toupper.c b/test/src/ctype/test_ft_toupper.c new file mode 100644 index 0000000..b23c08b --- /dev/null +++ b/test/src/ctype/test_ft_toupper.c @@ -0,0 +1,15 @@ +#include "libft_test.h" + +TEST_GROUP(ft_toupper); + +TEST_SETUP(ft_toupper) +{} + +TEST_TEAR_DOWN(ft_toupper) +{} + +TEST(ft_toupper, base) +{ + for (int i = 0; i <= UCHAR_MAX; i++) + TEST_ASSERT_EQUAL(toupper(i), ft_toupper(i)); +} -- cgit