Unified · Split
| @@ -1,4 +1,15 @@ | |||
| 1 | #if defined(_WIN32) | ||
| 2 | /* | ||
| 3 | * strtoll and strtoull require the following define. | ||
| 4 | * Not really needed in our case | ||
| 5 | */ | ||
| 6 | #if !defined(_ISOC99_SOURCE) | ||
| 7 | #define _ISOC99_SOURCE 1 | ||
| 8 | #endif | ||
| 9 | #endif | ||
| 10 | |||
| 1 | #include <stdio.h> | 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> | ||
| 2 | 13 | ||
| 3 | struct big_struct { char a[262144]; }; | 14 | struct big_struct { char a[262144]; }; |
| 4 | 15 | ||
| @@ -88,6 +99,33 @@ void tst_cast(void) · 83 unmodified lines | |||
| 88 | printf ("schar to ushort cast: %x\n", r); | 99 | printf ("schar to ushort cast: %x\n", r); |
| 89 | } | 100 | } |
| 90 | 101 | ||
| 102 | void tst_strtoll_strtoull(void) | ||
| 103 | { | ||
| 104 | /* | ||
| 105 | * It probably makes sense to run this test on all systems, | ||
| 106 | * not just on Windows. | ||
| 107 | */ | ||
| 108 | #if defined(_WIN32) | ||
| 109 | const unsigned int shift = 32; | ||
| 110 | |||
| 111 | { | ||
| 112 | long long x = strtoll("0x100000000", NULL, 0); | ||
| 113 | x = (x >> shift); | ||
| 114 | if (x != 1LL) { | ||
| 115 | printf("Windows: strtoll error\n"); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 119 | { | ||
| 120 | unsigned long long x = strtoll("0x100000000", NULL, 0); | ||
| 121 | x = (x >> shift); | ||
| 122 | if (x != 1) { | ||
| 123 | printf ("Windows: strtoull error\n"); | ||
| 124 | } | ||
| 125 | } | ||
| 126 | #endif | ||
| 127 | } | ||
| 128 | |||
| 91 | int | 129 | int |
| 92 | main (void) | 130 | main (void) |
| 93 | { | 131 | { |
| @@ -105,4 +143,5 @@ main (void) · 11 unmodified lines | |||
| 105 | tst_compare(); | 143 | tst_compare(); |
| 106 | tst_pack(); | 144 | tst_pack(); |
| 107 | tst_cast(); | 145 | tst_cast(); |
| 146 | tst_strtoll_strtoull(); | ||
| 108 | } | 147 | } |