author | Jiri Sasek <Jiri.Sasek@Sun.COM> |
Thu, 12 Jul 2012 19:44:22 -0700 | |
changeset 912 | d98bdeebbbb3 |
parent 402 | 94ae4d75524c |
permissions | -rw-r--r-- |
402
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
1 |
--- stdcxx-4.2.1/tests/localization/22.locale.num.get.cpp 2008-04-24 17:23:10.000000000 -0700 |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
2 |
+++ stdcxx-4.2.1/tests/localization/22.locale.num.get.cpp 2011-03-24 08:39:22.961646495 -0700 |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
3 |
@@ -54,6 +54,10 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
4 |
# define NO_GET_LDBL |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
5 |
#endif // NO_GET_FLOATING |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
6 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
7 |
+#ifndef _STDCXX_SIZEOF_NUM_GET_BUFFER |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
8 |
+#define _STDCXX_SIZEOF_NUM_GET_BUFFER 16384 |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
9 |
+#endif |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
10 |
+ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
11 |
/**************************************************************************/ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
12 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
13 |
#include <cstddef> // for std::size_t, std::ptrdiff_t |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
14 |
@@ -235,6 +239,13 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
15 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
16 |
/**************************************************************************/ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
17 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
18 |
+// if non-zero expected to point to a maximum valid value |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
19 |
+// of type T that's being tested below (used for floating |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
20 |
+// point ranges) |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
21 |
+// on function return, the pointed to value is overwritten |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
22 |
+// with the actual extracted value |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
23 |
+void *pmax = 0; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
24 |
+ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
25 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
26 |
enum IterType { iter_pointer, iter_istreambuf, iter_input }; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
27 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
28 |
@@ -244,7 +255,6 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
29 |
const char *cname, // name of character type |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
30 |
IterType itype, // type of input iterator |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
31 |
const char *iname, // name of input iterator |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
32 |
- void *pmax, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
33 |
nativeT val, // value expected to be extracted |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
34 |
const char *str, // input sequence |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
35 |
int eat_expect = -1, // number of consumed characters |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
36 |
@@ -438,7 +448,6 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
37 |
const char *cname, // name of character type |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
38 |
IterType itype, // iterator type |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
39 |
const char *iname, // name of iterator type |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
40 |
- void *pmax, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
41 |
nativeT val, // value expected to be extracted |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
42 |
const char *str, // input sequence |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
43 |
int eat_expect = -1, // number of consumed characters |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
44 |
@@ -449,15 +458,15 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
45 |
switch (ctype) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
46 |
case narrow_char: |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
47 |
return do_test (lineno, (char*)0, cname, itype, iname, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
48 |
- pmax, val, str, eat_expect, flags, err_expect, grouping); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
49 |
+ val, str, eat_expect, flags, err_expect, grouping); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
50 |
case wide_char: |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
51 |
return do_test (lineno, (wchar_t*)0, cname, itype, iname, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
52 |
- pmax, val, str, eat_expect, flags, err_expect, grouping); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
53 |
+ val, str, eat_expect, flags, err_expect, grouping); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
54 |
case user_char: |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
55 |
break; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
56 |
#if 0 // disabled |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
57 |
return do_test (lineno, (UserChar*)0, cname, itype, iname, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
58 |
- pmax, val, str, eat_expect, flags, err_expect, grouping); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
59 |
+ val, str, eat_expect, flags, err_expect, grouping); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
60 |
#endif // disabled |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
61 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
62 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
63 |
@@ -497,8 +506,7 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
64 |
/*************************************************************************/ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
65 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
66 |
#define TEST do_test |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
67 |
-#define T __LINE__, ctype, cname, itype, iname, 0 |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
68 |
-#define T_MAX __LINE__, ctype, cname, itype, iname, &val |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
69 |
+#define T __LINE__, ctype, cname, itype, iname |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
70 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
71 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
72 |
template <class numT> |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
73 |
@@ -2441,7 +2449,8 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
74 |
cname, iname); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
75 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
76 |
// exercise bahvior on underflow |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
77 |
- float val = 0; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
78 |
+ static float val = 0; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
79 |
+ pmax = &val; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
80 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
81 |
// on underflow, get() follows C99 requirements on strtof() |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
82 |
// i.e., it stores a value in the range [0, +/-FLT_MIN] |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
83 |
@@ -2452,34 +2461,35 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
84 |
// normalized positive number in the return type; whether |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
85 |
// errno acquires the value ERANGE is implementation-defined. |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
86 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
87 |
- TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
88 |
+ TEST (T, (val = FLT_MIN, 0.0f), "1.111111e-9999", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
89 |
rw_assert (!(val < 0.0), 0, __LINE__, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
90 |
"correct sign after positive underflow"); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
91 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
92 |
- TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
93 |
+ TEST (T, (val = 0.0f, -FLT_MIN), "-1.111111e-9999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
94 |
rw_assert (!(val > 0.0), 0, __LINE__, |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
95 |
"correct sign after negative underflow"); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
96 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
97 |
if (1.234567e-39 < FLT_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
98 |
- TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.234567e-39", 12, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
99 |
- TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-39", 13, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
100 |
+ TEST (T, (val = FLT_MIN, 0.0f), "1.234567e-39", 12, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
101 |
+ TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-39", 13, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
102 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
103 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
104 |
if (1.234567e-49 < FLT_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
105 |
- TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.234567e-49", 12, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
106 |
- TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-49", 13, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
107 |
+ TEST (T, (val = FLT_MIN, 0.0f), "1.234567e-49", 12, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
108 |
+ TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-49", 13, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
109 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
110 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
111 |
if (1.234567e-99 < FLT_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
112 |
- TEST (T_MAX, (val = FLT_MIN, 0.0f), "1.234567e-99", 12, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
113 |
- TEST (T_MAX, (val = 0.0f, -FLT_MIN), "-1.234567e-99", 13, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
114 |
+ TEST (T, (val = FLT_MIN, 0.0f), "1.234567e-99", 12, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
115 |
+ TEST (T, (val = 0.0f, -FLT_MIN), "-1.234567e-99", 13, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
116 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
117 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
118 |
// exercise facet's behavior on underflow: |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
119 |
// parsing succeeds (fail is clear), +/-min is stored |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
120 |
- TEST (T_MAX, FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
121 |
- TEST (T_MAX, -FLT_MIN, _RWSTD_STRSTR (-_RWSTD_DBL_MIN), -1, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
122 |
+ TEST (T, FLT_MIN, _RWSTD_STRSTR ( _RWSTD_DBL_MIN), -1, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
123 |
+ TEST (T, -FLT_MIN, _RWSTD_STRSTR (-_RWSTD_DBL_MIN), -1, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
124 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
125 |
+ pmax = 0; // reset before next test |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
126 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
127 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
128 |
rw_info (0, 0, 0, "std::num_get<%s, %s>::get (..., float&) on overflow", |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
129 |
@@ -2610,7 +2620,8 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
130 |
cname, iname); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
131 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
132 |
// exercise bahvior on underflow |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
133 |
- double val = DBL_MIN; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
134 |
+ static double val = DBL_MIN; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
135 |
+ pmax = &val; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
136 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
137 |
// on underflow, get() follows C99 requirements on strtod() |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
138 |
// i.e., it stores a value in the range [0, +/-DBL_MIN] |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
139 |
@@ -2621,24 +2632,25 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
140 |
// normalized positive number in the return type; whether |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
141 |
// errno acquires the value ERANGE is implementation-defined. |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
142 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
143 |
- TEST (T_MAX, (val = DBL_MIN, 0.0), "1.111111e-9999", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
144 |
- TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.111111e-9999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
145 |
+ TEST (T, (val = DBL_MIN, 0.0), "1.111111e-9999", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
146 |
+ TEST (T, (val = 0.0, -DBL_MIN), "-1.111111e-9999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
147 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
148 |
if (1.23456789e-309L < DBL_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
149 |
- TEST (T_MAX, (val = DBL_MIN, 0.0), "1.23456789e-309", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
150 |
- TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-309", 16, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
151 |
+ TEST (T, (val = DBL_MIN, 0.0), "1.23456789e-309", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
152 |
+ TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-309", 16, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
153 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
154 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
155 |
if (1.234567e-409L < DBL_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
156 |
- TEST (T_MAX, (val = DBL_MIN, 0.0), "1.23456789e-409", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
157 |
- TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-409", 16, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
158 |
+ TEST (T, (val = DBL_MIN, 0.0), "1.23456789e-409", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
159 |
+ TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-409", 16, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
160 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
161 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
162 |
if (1.234567e-999L < DBL_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
163 |
- TEST (T_MAX, (val = DBL_MIN, 0.0), "1.23456789e-999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
164 |
- TEST (T_MAX, (val = 0.0, -DBL_MIN), "-1.23456789e-999", 16, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
165 |
+ TEST (T, (val = DBL_MIN, 0.0), "1.23456789e-999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
166 |
+ TEST (T, (val = 0.0, -DBL_MIN), "-1.23456789e-999", 16, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
167 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
168 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
169 |
+ pmax = 0; // reset before next test |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
170 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
171 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
172 |
# ifdef _RWSTD_LDBL_MAX |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
173 |
@@ -2731,7 +2743,8 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
174 |
cname, iname); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
175 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
176 |
// exercise bahvior on underflow |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
177 |
- long double val = LDBL_MIN; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
178 |
+ static long double val = LDBL_MIN; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
179 |
+ pmax = &val; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
180 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
181 |
// on underflow, get() follows C99 requirements on strtold() |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
182 |
// i.e., it stores a value in the range [0, +/-LDBL__MIN] |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
183 |
@@ -2742,22 +2755,23 @@ |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
184 |
// normalized positive number in the return type; whether |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
185 |
// errno acquires the value ERANGE is implementation-defined. |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
186 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
187 |
- TEST (T_MAX, (val = LDBL_MIN, 0.0L), "1.987654321e-99999", 18, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
188 |
- TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-1.987654321e-99999", 19, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
189 |
+ TEST (T, (val = LDBL_MIN, 0.0L), "1.987654321e-99999", 18, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
190 |
+ TEST (T, (val = 0.0L, -LDBL_MIN), "-1.987654321e-99999", 19, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
191 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
192 |
const char fmt[] = "%Lg"; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
193 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
194 |
long double ld = 0.0; |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
195 |
if (1 == std::sscanf ("3.456789e-4932", fmt, &ld) && ld < LDBL_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
196 |
- TEST (T_MAX, (val = LDBL_MIN, 0.0L), "3.456789e-4932", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
197 |
- TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-3.456789e-4932", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
198 |
+ TEST (T, (val = LDBL_MIN, 0.0L), "3.456789e-4932", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
199 |
+ TEST (T, (val = 0.0L, -LDBL_MIN), "-3.456789e-4932", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
200 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
201 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
202 |
if (1 == std::sscanf ("3.456789e-9999", fmt, &ld) && ld < LDBL_MIN) { |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
203 |
- TEST (T_MAX, (val = LDBL_MIN, 0.0L), "3.456789e-9999", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
204 |
- TEST (T_MAX, (val = 0.0L, -LDBL_MIN), "-3.456789e-9999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
205 |
+ TEST (T, (val = LDBL_MIN, 0.0L), "3.456789e-9999", 14, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
206 |
+ TEST (T, (val = 0.0L, -LDBL_MIN), "-3.456789e-9999", 15, 0, Eof); |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
207 |
} |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
208 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
209 |
+ pmax = 0; // reset before next test |
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
210 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
211 |
|
94ae4d75524c
7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
212 |
# ifdef _RWSTD_LDBL_MAX |