mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-08 08:40:08 +08:00
Add tests on Windows for strtoll and strtoull. Tests can probably be used on all systems.
This commit is contained in:
parent
40f01478d8
commit
6219b2de00
@ -1,4 +1,15 @@
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* strtoll and strtoull require the following define.
|
||||
* Not really needed in our case
|
||||
*/
|
||||
#if !defined(_ISOC99_SOURCE)
|
||||
#define _ISOC99_SOURCE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct big_struct { char a[262144]; };
|
||||
|
||||
@ -88,6 +99,33 @@ void tst_cast(void)
|
||||
printf ("schar to ushort cast: %x\n", r);
|
||||
}
|
||||
|
||||
void tst_strtoll_strtoull(void)
|
||||
{
|
||||
/*
|
||||
* It probably makes sense to run this test on all systems,
|
||||
* not just on Windows.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
const unsigned int shift = 32;
|
||||
|
||||
{
|
||||
long long x = strtoll("0x100000000", NULL, 0);
|
||||
x = (x >> shift);
|
||||
if (x != 1LL) {
|
||||
printf("Windows: strtoll error\n");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
unsigned long long x = strtoll("0x100000000", NULL, 0);
|
||||
x = (x >> shift);
|
||||
if (x != 1) {
|
||||
printf ("Windows: strtoull error\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
@ -105,4 +143,5 @@ main (void)
|
||||
tst_compare();
|
||||
tst_pack();
|
||||
tst_cast();
|
||||
tst_strtoll_strtoull();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user