alelievr / libft-unit-test

455 stars 88 forks source link

There is a mixed up output of standard and written functions #87

Closed EvgeniiBalabanov closed 3 years ago

EvgeniiBalabanov commented 3 years ago
[fail]: your itoa does not work with min int
Test code:
    char *i1 = ft_itoa((-2147483647 -1));

    if (atoi(i1) != (-2147483647 -1))
    {
        exit(TEST_FAILED);
    }
    exit(TEST_SUCCESS);

Diffs:
        itoa: |X2147483648-|
     ft_itoa: |0|

[fail]: your itoa don't set \0 at the end of the string
Test code:

    char *i1 = ft_itoa(-1234);
    if (strcmp(i1, "-1234"))
    {
        exit(TEST_FAILED);
    }
    exit(TEST_SUCCESS);

Diffs:
        itoa: |1234-|
     ft_itoa: |-1234|
EvgeniiBalabanov commented 3 years ago

ft_putchar_fd same

ft_putchar_fd: [OK] [OK] [KO] 
[KO]: your putchar_fd does not work with unicode
Test code:
    char buff[10];
    char buff2[10];
    int c = L'ø';
    int len = 0;

    putwchart(c, &len, buff2);
    buff2[len] = 0;
    fd_to_buffer(2);
    ft_putchar_fd(c, 2);
    write(2, "", 1);
    get_fd_buffer(2, buff, 10);
    if (!strcmp(buff, buff2))
        exit(TEST_SUCCESS);
    exit(TEST_KO);

Diffs:
  putchar_fd: |?|
ft_putchar_fd: |ø|
kiborroq commented 3 years ago

I can't test my libft on windows. Help me please!

alelievr commented 3 years ago

Hello, these issues should be fixed with this commit: https://github.com/alelievr/libft-unit-test/commit/58eb06719f8af1426614602d9b7f6013d264947d Thanks for reporting it :)