49#define DFLT_LOOPS 10000
87#ifndef _RWSTD_NO_WCHAR_T
107thread_loop_body (std::size_t
i)
114 const std::locale
loc (
data->locale_name_);
119 typedef std::moneypunct<char, false>
Punct;
121 const Punct &mp = std::use_facet<Punct>(
loc);
123 const char dp = mp.decimal_point ();
124 const char ts = mp.thousands_sep ();
125 const std::string grp = mp.grouping ();
126 const std::string
cur = mp.curr_symbol ();
127 const std::string
pos = mp.positive_sign ();
128 const std::string
neg = mp.negative_sign ();
129 const int fd = mp.frac_digits ();
130 const Punct::pattern pfm = mp.pos_format ();
131 const Punct::pattern nfm = mp.neg_format ();
148 typedef std::moneypunct<char, true>
Punct;
150 const Punct &mp = std::use_facet<Punct>(
loc);
152 const char dp = mp.decimal_point ();
153 const char ts = mp.thousands_sep ();
154 const std::string grp = mp.grouping ();
155 const std::string
cur = mp.curr_symbol ();
156 const std::string
pos = mp.positive_sign ();
157 const std::string
neg = mp.negative_sign ();
158 const int fd = mp.frac_digits ();
159 const Punct::pattern pfm = mp.pos_format ();
160 const Punct::pattern nfm = mp.neg_format ();
176#ifndef _RWSTD_NO_WCHAR_T
181 typedef std::moneypunct<wchar_t, false>
Punct;
183 const Punct &mp = std::use_facet<Punct>(
loc);
185 const wchar_t dp = mp.decimal_point ();
186 const wchar_t ts = mp.thousands_sep ();
187 const std::string grp = mp.grouping ();
188 const std::wstring
cur = mp.curr_symbol ();
189 const std::wstring
pos = mp.positive_sign ();
190 const std::wstring
neg = mp.negative_sign ();
191 const int fd = mp.frac_digits ();
192 const Punct::pattern pfm = mp.pos_format ();
193 const Punct::pattern nfm = mp.neg_format ();
210 typedef std::moneypunct<wchar_t, true>
Punct;
212 const Punct &mp = std::use_facet<Punct>(
loc);
214 const wchar_t dp = mp.decimal_point ();
215 const wchar_t ts = mp.thousands_sep ();
216 const std::string grp = mp.grouping ();
217 const std::wstring
cur = mp.curr_symbol ();
218 const std::wstring
pos = mp.positive_sign ();
219 const std::wstring
neg = mp.negative_sign ();
220 const int fd = mp.frac_digits ();
221 const Punct::pattern pfm = mp.pos_format ();
222 const Punct::pattern nfm = mp.neg_format ();
251 thread_loop_body (std::size_t (
i));
286 typedef std::moneypunct<char, false>
Punct;
288 const Punct &mp = std::use_facet<Punct>(
loc);
290 const char dp = mp.decimal_point ();
291 const char ts = mp.thousands_sep ();
292 const std::string grp = mp.grouping ();
293 const std::string
cur = mp.curr_symbol ();
294 const std::string
pos = mp.positive_sign ();
295 const std::string
neg = mp.negative_sign ();
296 const int fd = mp.frac_digits ();
297 const Punct::pattern pfm = mp.pos_format ();
298 const Punct::pattern nfm = mp.neg_format ();
304 std::strcpy (pdata->
grouping_, grp.c_str ());
308 std::memcpy (pdata->
pos_format_, &pfm,
sizeof pfm);
309 std::memcpy (pdata->
neg_format_, &nfm,
sizeof nfm);
313 "std::locale(%#s) threw an exception, skipping",
name);
318 typedef std::moneypunct<char, true>
Punct;
320 const Punct &mp = std::use_facet<Punct>(
loc);
322 const std::string
cur = mp.curr_symbol ();
323 const int fd = mp.frac_digits ();
324 const Punct::pattern pfm = mp.pos_format ();
325 const Punct::pattern nfm = mp.neg_format ();
335 "std::locale(%#s) threw an exception, skipping",
name);
339#ifndef _RWSTD_NO_WCHAR_T
342 typedef std::moneypunct<wchar_t, false>
Punct;
344 const Punct &mp = std::use_facet<Punct>(
loc);
346 const wchar_t dp = mp.decimal_point ();
347 const wchar_t ts = mp.thousands_sep ();
348 const std::wstring
cur = mp.curr_symbol ();
349 const std::wstring
pos = mp.positive_sign ();
350 const std::wstring
neg = mp.negative_sign ();
355 typedef std::wstring::traits_type
Traits;
363 "std::locale(%#s) threw an exception, skipping",
name);
368 typedef std::moneypunct<wchar_t, true>
Punct;
370 const Punct &mp = std::use_facet<Punct>(
loc);
372 const std::wstring
cur = mp.curr_symbol ();
373 const std::wstring
pos = mp.positive_sign ();
374 const std::wstring
neg = mp.negative_sign ();
376 typedef std::wstring::traits_type
Traits;
382 "std::locale(%#s) threw an exception, skipping",
name);
390 if (nlocales == maxinx)
405 rw_fatal (0 < nlocales, 0, __LINE__,
406 "must have at least one valid locale to test");
409 "testing std::moneypunct<charT> with %d thread%{?}s%{;}, "
410 "%d iteration%{?}s%{;} each, in %zu locales { %{ .*A@} }",
413 nlocales,
int (nlocales),
"%#s",
locales);
415 rw_info (0, 0, 0,
"exercising std::moneypunct<char>");
426 "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
429#ifndef _RWSTD_NO_WCHAR_T
431 rw_info (0, 0, 0,
"exercising std::moneypunct<wchar_t>");
443 "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
450 "exercising both std::moneypunct<char> "
451 "and std::moneypunct<wchar_t>");
462 "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
472int main (
int argc,
char *argv[])
474#ifdef _RWSTD_REENTRANT
484 return rw_test (argc, argv, __FILE__,
485 "lib.locale.moneypunct",
struct MoneypunctData punct_data[MAX_THREADS]
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
const struct @19 locales[]
_TEST_EXPORT int rw_test(int argc, char *argv[], const char *filename, const char *clause, const char *comment, int(*testfun)(int, char **), const char *optspec,...)
_TEST_EXPORT int rw_info(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_fatal(int expr, const char *filename, int line, const char *fmtspec,...)
_TEST_EXPORT int rw_error(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_warn(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_opt_setlocales(int, char *[])
_TEST_EXPORT const char *const & rw_opt_locales
_TEST_EXPORT char * rw_locales(int=_UNUSED_CAT, const char *=0, bool=true)
_TEST_EXPORT int rw_thread_pool(rw_thread_t *, _RWSTD_SIZE_T, rw_thread_attr_t *, rw_thread_proc *, void **, _RWSTD_SIZE_T=0)
_TEST_EXPORT int rw_get_cpus()
_TEST_EXPORT int rw_thread_pool_timeout_expired()
_TEST_EXPORT int rw_strncmp(const char *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX, int=CMP_NULTERM)
wchar_t wpositive_sign_[32]
wchar_t wnegative_sign_[32]
wchar_t wcurr_symbol_[32]
char int_curr_symbol_[32]
const char * locale_name_
wchar_t wint_curr_symbol_[32]