This repository has been archived on 2023-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
c_piscine_rush_02/tests/test_ft_utils.c

56 lines
1.6 KiB
C
Raw Permalink Normal View History

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/02 22:12:42 by achubuko #+# #+# */
2023-12-03 19:36:55 +00:00
/* Updated: 2023/12/03 22:45:24 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include "unity.h"
#include "ft_utils.h"
2023-12-02 19:51:56 +00:00
#include "string.h"
void setUp(void)
{
}
void tearDown(void)
{
}
2023-12-03 14:47:05 +00:00
void test_ft_str_is_numeric_num(void)
{
TEST_ASSERT_EQUAL_INT(1, ft_str_is_numeric("42"));
}
void test_ft_str_is_numeric_nonnum(void)
{
TEST_ASSERT_EQUAL_INT(0, ft_str_is_numeric("asd"));
}
void test_ft_str_is_numeric_neg(void)
{
TEST_ASSERT_EQUAL_INT(-1, ft_str_is_numeric("-42"));
}
2023-12-02 19:51:56 +00:00
void test_ft_strlen(void)
{
char *f;
f = "foobar baz\0test";
TEST_ASSERT_EQUAL_INT(strlen(f), ft_strlen(f));
}
int main(void)
{
UNITY_BEGIN();
2023-12-02 19:51:56 +00:00
RUN_TEST(test_ft_strlen);
2023-12-03 14:47:05 +00:00
RUN_TEST(test_ft_str_is_numeric_num);
RUN_TEST(test_ft_str_is_numeric_nonnum);
RUN_TEST(test_ft_str_is_numeric_neg);
return (UNITY_END());
}