Skip to content

Commit ad22e20

Browse files
committed
Completing.
1 parent d521ddf commit ad22e20

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed

tests/exhaustive32_midpoint.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ template <typename T> char *to_string(T d, char *buffer) {
3131

3232
void strtod_from_string(const char * st, float& d) {
3333
char *pr = (char *)st;
34-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
34+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
3535
d = cygwin_strtod_l(st, &pr);
3636
#elif defined(_WIN32)
3737
static _locale_t c_locale = _create_locale(LC_ALL, "C");
@@ -112,8 +112,8 @@ void allvalues() {
112112
}
113113

114114
int main() {
115-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
116-
std::cout << "Warning: msys/cygwin detected. This particular test is likely to generate false failures due to our reliance on the underlying runtime library." << std::endl;
115+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
116+
std::cout << "Warning: msys/cygwin or solaris detected. This particular test is likely to generate false failures due to our reliance on the underlying runtime library." << std::endl;
117117
#endif
118118
allvalues();
119119
std::cout << std::endl;

tests/powersoffive_hardround.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@
55
#include <sstream>
66
#include <vector>
77

8+
9+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
10+
// Anything at all that is related to cygwin, msys and so forth will
11+
// always use this fallback because we cannot rely on it behaving as normal
12+
// gcc.
13+
#include <locale>
14+
#include <sstream>
15+
// workaround for CYGWIN
16+
double cygwin_strtod_l(const char* start, char** end) {
17+
double d;
18+
std::stringstream ss;
19+
ss.imbue(std::locale::classic());
20+
ss << start;
21+
ss >> d;
22+
size_t nread = ss.tellg();
23+
*end = const_cast<char*>(start) + nread;
24+
return d;
25+
}
26+
#endif
27+
28+
829
std::pair<double, bool> strtod_from_string(const char *st) {
930
double d;
1031
char *pr;
@@ -25,7 +46,7 @@ std::pair<double, bool> strtod_from_string(const char *st) {
2546
std::pair<float, bool> strtof_from_string(char *st) {
2647
float d;
2748
char *pr;
28-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
49+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
2950
d = cygwin_strtod_l(st, &pr);
3051
#elif defined(_WIN32)
3152
static _locale_t c_locale = _create_locale(LC_ALL, "C");

tests/random_string.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <cstdint>
33
#include <random>
44

5-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
5+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
66
// Anything at all that is related to cygwin, msys and so forth will
77
// always use this fallback because we cannot rely on it behaving as normal
88
// gcc.
@@ -126,7 +126,7 @@ std::pair<double, bool> strtod_from_string(char *st) {
126126
std::pair<float, bool> strtof_from_string(char *st) {
127127
float d;
128128
char *pr;
129-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
129+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
130130
d = cygwin_strtod_l(st, &pr);
131131
#elif defined(_WIN32)
132132
static _locale_t c_locale = _create_locale(LC_ALL, "C");
@@ -203,8 +203,8 @@ bool tester(uint64_t seed, size_t volume) {
203203
}
204204

205205
int main() {
206-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
207-
std::cout << "Warning: msys/cygwin detected. This particular test is likely to generate false failures due to our reliance on the underlying runtime library." << std::endl;
206+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
207+
std::cout << "Warning: msys/cygwin or solaris detected. This particular test is likely to generate false failures due to our reliance on the underlying runtime library." << std::endl;
208208
#endif
209209
if (tester(1234344, 100000000)) {
210210
std::cout << "All tests ok." << std::endl;

tests/short_random_string.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <cstdint>
33
#include <random>
44

5-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
5+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
66
// Anything at all that is related to cygwin, msys and so forth will
77
// always use this fallback because we cannot rely on it behaving as normal
88
// gcc.
@@ -122,7 +122,7 @@ std::pair<double, bool> strtod_from_string(char *st) {
122122
std::pair<float, bool> strtof_from_string(char *st) {
123123
float d;
124124
char *pr;
125-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
125+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
126126
d = cygwin_strtod_l(st, &pr);
127127
#elif defined(_WIN32)
128128
static _locale_t c_locale = _create_locale(LC_ALL, "C");
@@ -199,7 +199,7 @@ bool tester(uint64_t seed, size_t volume) {
199199
}
200200

201201
int main() {
202-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
202+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
203203
std::cout << "Warning: msys/cygwin detected. This particular test is likely to generate false failures due to our reliance on the underlying runtime library." << std::endl;
204204
#endif
205205
if (tester(1234344, 100000000)) {

tests/string_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <vector>
44

5-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
5+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
66
// Anything at all that is related to cygwin, msys and so forth will
77
// always use this fallback because we cannot rely on it behaving as normal
88
// gcc.
@@ -85,7 +85,7 @@ void strtod_from_string(const std::string &st, double& d) {
8585
template <>
8686
void strtod_from_string(const std::string &st, float& d) {
8787
char *pr = (char *)st.c_str();
88-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
88+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
8989
d = cygwin_strtod_l(st.c_str(), &pr);
9090
#elif defined(_WIN32)
9191
static _locale_t c_locale = _create_locale(LC_ALL, "C");
@@ -236,7 +236,7 @@ bool partow_test() {
236236

237237

238238
int main() {
239-
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
239+
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun)
240240
std::cout << "Warning: msys/cygwin detected. This particular test is likely to generate false failures due to our reliance on the underlying runtime library." << std::endl;
241241
#endif
242242
std::cout << "32 bits checks" << std::endl;

0 commit comments

Comments
 (0)