41#define MAX_LOOPS 100000
65#ifndef _RWSTD_NO_WCHAR_T
89#ifdef _RWSTD_REENTRANT
103 const std::basic_string<T> *pshared,
104 std::size_t threadno)
106 typedef std::basic_string<T>
String;
110 const std::size_t inx1 = (
i + threadno) %
nstrings;
111 const std::size_t inx2 = (inx1 + 1) %
nstrings;
114 const String copy (pshared [inx1]);
116 String assigned (pshared [inx2]);
120 const String copy2 (pshared [inx1]);
123 RW_ASSERT (pshared [inx1].length () == copy2.length ());
128 assigned = pshared [inx1];
134 RW_ASSERT (pshared [inx1].length () == copy.length ());
140 RW_ASSERT (pshared [inx1].length () == assigned.length ());
146 assigned = pdata [inx2];
148 RW_ASSERT (pshared [inx2].length () == assigned.length ());
160thread_func (
void *
arg)
165 const std::size_t threadno = std::size_t (pthread->
threadno);
169#ifndef _RWSTD_NO_WCHAR_T
191 "testing std::string with %d thread%{?}s%{;}, "
192 "%d iteration%{?}s%{;} each",
203 "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
208 const std::size_t
size =
209 std::string::traits_type::length (
data [
i]);
212 "shared string modifed from %#s to %{#S}",
216#ifndef _RWSTD_NO_WCHAR_T
219 "testing std::wstring with %d thread%{?}s%{;}, "
220 "%d iteration%{?}s%{;} each",
231 "rw_thread_pool(0, %d, 0, %{#f}, 0) failed",
236 const std::size_t
size =
237 std::wstring::traits_type::length (
wdata [
i]);
240 "shared string modifed from %#ls to %{#lS}",
251int main (
int argc,
char *argv[])
253 return rw_test (argc, argv, __FILE__,
void test_string_cons(const T *const *pdata, const std::basic_string< T > *pshared, std::size_t threadno)
const std::string shared[nstrings]
const wchar_t *const wdata[]
const std::size_t nstrings
const std::wstring wshared[nstrings]
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
_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_assert(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_error(int, const char *, int, const char *,...)
_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_strncmp(const char *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX, int=CMP_NULTERM)