Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
22.locale.cons.stdcxx-485.cpp
Go to the documentation of this file.
1
29#include <cassert>
30#include <cstring>
31#include <locale>
32
33#include <rw_locale.h>
34#include <rw_driver.h>
35
36
37static int
38run_test (int, char**)
39{
40 // obtain a NUL-separated list of installed locales
41 const char* const names = rw_locales ();
42
43 if (0 == names || '\0' == *names)
44 return 0;
45
46 // repeatedly create a large set of unique named locale objects
47 for (int j = 0; j != 2; ++j) {
48 std::locale locales [64];
49
50 std::size_t i = 0;
51
52 for (const char *pn = names; *pn; ++i, pn += std::strlen (pn) + 1) {
53 if (i == sizeof locales / sizeof *locales)
54 break;
55
56 locales [i] = std::locale (pn);
57 }
58
59 i = 0;
60
61 for (const char *pn = names; *pn; ++i, pn += std::strlen (pn) + 1) {
62 if (i == sizeof locales / sizeof *locales)
63 break;
64
65 rw_assert (std::has_facet<std::collate<char> >(locales [i]),
66 0, __LINE__,
67 "std::has_facet<std::collate<char> >(locales(#s))",
68 pn);
69 }
70 }
71
72 return 0;
73}
74
75
76int main (int argc, char* argv[])
77{
78 return rw_test (argc, argv, __FILE__,
79 "lib.locale.cons",
80 "STDCXX-485",
82 "",
83 (void*)0);
84}
#define i
Definition 17.names.cpp:126
#define j
Definition 17.names.cpp:127
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
#define main
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_assert(int, const char *, int, const char *,...)
Definition driver.cpp:1630
_TEST_EXPORT char * rw_locales(int=_UNUSED_CAT, const char *=0, bool=true)
Definition locale.cpp:368