alelievr / libft-unit-test

457 stars 88 forks source link

Bug in ft_atoi unit test #40

Closed 111jsp closed 6 years ago

111jsp commented 6 years ago

Hey!

I have found the bug in ft_atoi unit test: result.log: ft_atoi: [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [KO] [OK] [OK] [KO]: your atoi does not work with over long max value Test code: char n[40] = "99999999999999999999999999"; int i1 = atoi(n); int i2 = ft_atoi(n);

if (i1 == i2)
    exit(TEST_SUCCESS);
exit(TEST_KO);

Diffs: atoi: |-1| ft_atoi: |-469762049|

But 42checker shows that "A -> libft-unit-test (https://github.com/alelievr/libft-unit-test) All Unit Tests passed"

alelievr commented 6 years ago

Hello,

This is not a bug, when this test fails it is marked as KO and not fail. It means that your function works but some tricky test (about behaviour not specified in the atoi's man page) didn't pass so it's okay to have these warnings if you're not trying to reproduce the exact comportement of the OSX's atoi function.

The 42FileChecker only checks for failed tests and ignore KO for this reason so it's normal that it displays "All Unit Tests passed". Btw if you look into the trace, you'll find these warnings.