It's not always true that -INT_MIN == INT_MAX. For example, in x86
INT_MIN == -2**31 and INT_MAX == 2**31-1. So that assertion is
incorrect.
I'll take a look at compiler provided includes for such values. There
are a few include files that we can get a more complete implementation
by looking at the compiler provided includes.
2009/7/9 Henrique Almeida <hd...@gm...>:
> 2009/7/9 Henrique Almeida <hd...@gm...>:
>> 2009/7/9 John Haitas <jh...@gm...>:
>>> Henrique,
>>>
>>> Thanks for letting me know that. When do you expect to have a sprintf
>>> implementation available? I will be able to use sprintf to test
>>
>> I can add it tomorrow.
>
> You can also use preprocessor tricks to stringify and alter the value
> of limit macros. See __ASSERT_ITOA, for example
>
>>
>>> against constants defined in <limits.h>. The stdlib_test I have
>>> implemented is still very preliminary, meant mainly to test known
>>> cases, I had planned to comment out tests that are known to fail.
>>
>> No need for commenting the tests. It's important that users know
>> which functions are broken.
>>
>>>
>>> Also, do you have support for the %f specifier in the printf()
>>> function? Currently I am typecasting to a long and ignoring anything
>>
>> I wasn't planning to add that one soon, I don't know how hard it is.
>> I can give you a better answer on the weekend. In general, dealing
>> with floating point is hard because it varies with hardware and
>> dealing with precision errors is very difficult.
>>
>>> after the radix (I need to implement the pow() function first anyway).
>>>
>>> Thanks for your hard work and suggestions for how I can improve my
>>> contributions.
>>>
>>> Cheers,
>>> John
>>>
>>> On Thu, Jul 9, 2009 at 6:14 PM, Henrique Almeida<hd...@gm...> wrote:
>>>> Hello,
>>>>
>>>> The stdlib_test.c submitted has too few test coverage. Unit tests
>>>> must have near full test coverage. Please refer to the wiki for the
>>>> rules on how to write unit tests for libposix:
>>>>
>>>> https://sourceforge.net/apps/mediawiki/libposix/index.php?title=How_to_write_tests
>>>>
>>>> The missing coverage includes, non base 10, base 0, base > 10,
>>>> testing for endptr, testing strings with garbage, testing endptr ==
>>>> NULL and testing out or range values (ex: try 256 bit integers). Don't
>>>> worry that the current implementations fail the test. The functions
>>>> may be developed gradually, but not the unit tests. Currently,
>>>> TaskFreak seems to be broken, I'll add that task when it works, but
>>>> start fixing that in the meantime.
>>>>
>>>> Remember to add a copyright line to CMakeLists.txt
>>>>
>>>> And thanks for the commit, off course.
>>>>
>>>> --
>>>> Henrique Dante de Almeida
>>>> hd...@gm...
>>>>
>>>
>>>
>>>
>>> --
>>> John Haitas
>>> jh...@gm...
>>>
>>
>>
>>
>> --
>> Henrique Dante de Almeida
>> hd...@gm...
>>
>
>
>
> --
> Henrique Dante de Almeida
> hd...@gm...
>
--
Henrique Dante de Almeida
hd...@gm...
|