From e89305e7337f9ffe8a0e0c227814f27fa86e32ed Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 16 May 2011 12:58:52 +0000 Subject: [PATCH] [STLPORT] Copy stlport from cmake branch 3/3 svn path=/trunk/; revision=51780 --- reactos/lib/3rdparty/stlport/doc/FAQ | 554 ++ .../lib/3rdparty/stlport/doc/README.borland | 154 + .../lib/3rdparty/stlport/doc/README.cygwin | 43 + reactos/lib/3rdparty/stlport/doc/README.dmc | 81 + reactos/lib/3rdparty/stlport/doc/README.evc3 | 157 + reactos/lib/3rdparty/stlport/doc/README.evc4 | 126 + reactos/lib/3rdparty/stlport/doc/README.evc8 | 98 + reactos/lib/3rdparty/stlport/doc/README.evc9 | 95 + reactos/lib/3rdparty/stlport/doc/README.intel | 19 + reactos/lib/3rdparty/stlport/doc/README.mingw | 55 + reactos/lib/3rdparty/stlport/doc/README.msvc | 186 + reactos/lib/3rdparty/stlport/doc/README.utf8 | 51 + reactos/lib/3rdparty/stlport/doc/README.wince | 94 + .../lib/3rdparty/stlport/doc/README.windows | 55 + .../lib/3rdparty/stlport/doc/build_system.txt | 82 + .../stlport/doc/pointer_specialization.txt | 90 + .../stlport/doc/stlport_namespaces.txt | 133 + reactos/lib/3rdparty/stlport/etc/ChangeLog | 3088 ++++++ .../lib/3rdparty/stlport/etc/ChangeLog-4.0 | 668 ++ .../lib/3rdparty/stlport/etc/ChangeLog-5.1 | 8350 +++++++++++++++++ .../lib/3rdparty/stlport/etc/ReleaseNote.txt | 138 + .../3rdparty/stlport/etc/STLport-4.5.1.spec | 96 + .../3rdparty/stlport/etc/STLport-4.5.3.spec | 96 + .../lib/3rdparty/stlport/etc/STLport-4.6.spec | 99 + reactos/lib/3rdparty/stlport/etc/autoexp.dat | 835 ++ reactos/lib/3rdparty/stlport/etc/msvcincl.dat | 309 + .../lib/3rdparty/stlport/etc/std_headers.txt | 34 + .../3rdparty/stlport/etc/std_headers_c.txt | 17 + .../3rdparty/stlport/etc/std_headers_c_h.txt | 13 + .../etc/std_headers_classic_iostreams.txt | 8 + .../stlport/etc/std_headers_cpp_runtime.txt | 3 + .../stlport/etc/std_headers_cpp_runtime_h.txt | 3 + .../stlport/test/compiler/Makefile.inc | 6 + .../lib/3rdparty/stlport/test/compiler/README | 29 + .../test/compiler/StTerm-order/Makefile | 12 + .../test/compiler/StTerm-order/Makefile.inc | 4 + .../test/compiler/StTerm-order/stterm-test.cc | 117 + .../lib/3rdparty/stlport/test/compiler/eh.cc | 60 + .../3rdparty/stlport/test/compiler/gcc.mak | 12 + .../stlport/test/compiler/movable.cpp | 20 + .../stlport/test/compiler/partial_spec.cpp | 34 + .../3rdparty/stlport/test/compiler/ttei1.cpp | 31 + .../3rdparty/stlport/test/compiler/ttei2.cpp | 31 + .../3rdparty/stlport/test/compiler/ttei3.cpp | 43 + .../3rdparty/stlport/test/compiler/ttei4.cpp | 42 + .../3rdparty/stlport/test/compiler/ttei5.cpp | 43 + .../3rdparty/stlport/test/compiler/ttei6.cpp | 30 + .../3rdparty/stlport/test/compiler/ttei7.cpp | 31 + .../lib/3rdparty/stlport/test/eh/LeakCheck.h | 198 + reactos/lib/3rdparty/stlport/test/eh/Prefix.h | 313 + .../lib/3rdparty/stlport/test/eh/SortClass.h | 81 + .../3rdparty/stlport/test/eh/TestClass.cpp | 24 + .../lib/3rdparty/stlport/test/eh/TestClass.h | 161 + reactos/lib/3rdparty/stlport/test/eh/Tests.h | 59 + .../3rdparty/stlport/test/eh/ThrowCompare.h | 46 + reactos/lib/3rdparty/stlport/test/eh/bcb.mak | 78 + reactos/lib/3rdparty/stlport/test/eh/bug.cpp | 39 + .../3rdparty/stlport/test/eh/como-linux.mak | 69 + reactos/lib/3rdparty/stlport/test/eh/como.mak | 67 + reactos/lib/3rdparty/stlport/test/eh/cray.mak | 56 + .../lib/3rdparty/stlport/test/eh/cygwin.mak | 123 + .../lib/3rdparty/stlport/test/eh/deccxx.mak | 73 + .../lib/3rdparty/stlport/test/eh/descrip.mms | 54 + .../lib/3rdparty/stlport/test/eh/djgpp.mak | 121 + reactos/lib/3rdparty/stlport/test/eh/egcs.mak | 75 + reactos/lib/3rdparty/stlport/test/eh/export | 37 + .../lib/3rdparty/stlport/test/eh/gcc-99r1.mak | 109 + .../stlport/test/eh/gcc-amigaos-m68k.mak | 119 + .../stlport/test/eh/gcc-apple-macosx.mak | 122 + .../3rdparty/stlport/test/eh/gcc-freebsd.mak | 123 + .../lib/3rdparty/stlport/test/eh/gcc-hp11.mak | 123 + .../lib/3rdparty/stlport/test/eh/gcc-irix.mak | 122 + .../3rdparty/stlport/test/eh/gcc-linux.mak | 120 + .../3rdparty/stlport/test/eh/gcc-netbsd.mak | 122 + reactos/lib/3rdparty/stlport/test/eh/gcc.mak | 122 + reactos/lib/3rdparty/stlport/test/eh/gcc7.mak | 93 + reactos/lib/3rdparty/stlport/test/eh/hp.mak | 81 + .../lib/3rdparty/stlport/test/eh/hpacc.mak | 119 + .../lib/3rdparty/stlport/test/eh/intel.mak | 69 + .../lib/3rdparty/stlport/test/eh/intel45.mak | 109 + .../lib/3rdparty/stlport/test/eh/intel50.mak | 115 + reactos/lib/3rdparty/stlport/test/eh/kai.mak | 65 + .../lib/3rdparty/stlport/test/eh/locale.cpp | 60 + reactos/lib/3rdparty/stlport/test/eh/main.cpp | 407 + .../lib/3rdparty/stlport/test/eh/mingw32.mak | 111 + .../stlport/test/eh/mwerks_console_OS_X.c | 193 + .../stlport/test/eh/mwerks_debug_prefix.h | 8 + .../test/eh/mwerks_nosgi_debug_prefix.h | 5 + .../stlport/test/eh/mwerks_nosgi_prefix.h | 5 + .../3rdparty/stlport/test/eh/mwerks_prefix.h | 8 + .../lib/3rdparty/stlport/test/eh/nc_alloc.cpp | 328 + .../lib/3rdparty/stlport/test/eh/nc_alloc.h | 184 + .../stlport/test/eh/random_number.cpp | 39 + .../3rdparty/stlport/test/eh/random_number.h | 27 + .../3rdparty/stlport/test/eh/sgi_mipspro.mak | 62 + .../3rdparty/stlport/test/eh/sunpro-64.mak | 69 + .../lib/3rdparty/stlport/test/eh/sunpro.mak | 71 + .../lib/3rdparty/stlport/test/eh/sunpro42.mak | 76 + reactos/lib/3rdparty/stlport/test/eh/test.cpp | 42 + .../3rdparty/stlport/test/eh/test_algo.cpp | 261 + .../stlport/test/eh/test_algobase.cpp | 98 + .../3rdparty/stlport/test/eh/test_assign_op.h | 47 + .../stlport/test/eh/test_bit_vector.cpp | 129 + .../3rdparty/stlport/test/eh/test_bitset.cpp | 39 + .../3rdparty/stlport/test/eh/test_construct.h | 125 + .../3rdparty/stlport/test/eh/test_deque.cpp | 95 + .../stlport/test/eh/test_hash_map.cpp | 131 + .../stlport/test/eh/test_hash_resize.h | 56 + .../stlport/test/eh/test_hash_set.cpp | 127 + .../3rdparty/stlport/test/eh/test_insert.h | 552 ++ .../3rdparty/stlport/test/eh/test_list.cpp | 108 + .../lib/3rdparty/stlport/test/eh/test_map.cpp | 127 + .../3rdparty/stlport/test/eh/test_push_back.h | 50 + .../stlport/test/eh/test_push_front.h | 46 + .../3rdparty/stlport/test/eh/test_rope.cpp | 99 + .../lib/3rdparty/stlport/test/eh/test_set.cpp | 100 + .../3rdparty/stlport/test/eh/test_slist.cpp | 91 + .../3rdparty/stlport/test/eh/test_string.cpp | 79 + .../stlport/test/eh/test_valarray.cpp | 81 + .../3rdparty/stlport/test/eh/test_vector.cpp | 126 + .../3rdparty/stlport/test/unit/_template.cpp | 31 + .../3rdparty/stlport/test/unit/accum_test.cpp | 50 + .../3rdparty/stlport/test/unit/adj_test.cpp | 135 + .../stlport/test/unit/advance_test.cpp | 38 + .../3rdparty/stlport/test/unit/alg_test.cpp | 364 + .../test/unit/algorithm_header_test.cpp | 8 + .../stlport/test/unit/allocator_test.cpp | 168 + .../stlport/test/unit/assert_header_test.c | 8 + .../stlport/test/unit/bcompos_test.cpp | 55 + .../3rdparty/stlport/test/unit/bind_test.cpp | 149 + .../stlport/test/unit/binsert_test.cpp | 54 + .../stlport/test/unit/bitset_header_test.cpp | 8 + .../stlport/test/unit/bitset_test.cpp | 110 + .../stlport/test/unit/bnegate_test.cpp | 48 + .../stlport/test/unit/boost_check.cpp | 49 + .../3rdparty/stlport/test/unit/bound_test.cpp | 80 + .../stlport/test/unit/bsearch_test.cpp | 49 + .../stlport/test/unit/bvector_test.cpp | 71 + .../stlport/test/unit/c_limits_header_test.c | 8 + .../stlport/test/unit/c_locale_header_test.c | 8 + .../stlport/test/unit/cassert_header_test.cpp | 8 + .../stlport/test/unit/cctype_header_test.cpp | 8 + .../stlport/test/unit/cerrno_header_test.cpp | 8 + .../stlport/test/unit/cfloat_header_test.cpp | 8 + .../stlport/test/unit/ciso646_header_test.cpp | 8 + .../stlport/test/unit/climits_header_test.cpp | 8 + .../stlport/test/unit/clocale_header_test.cpp | 8 + .../stlport/test/unit/cmath_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/cmath_test.cpp | 170 + .../stlport/test/unit/codecvt_test.cpp | 654 ++ .../stlport/test/unit/collate_facets_test.cpp | 279 + .../stlport/test/unit/complete_digits.h | 19 + .../stlport/test/unit/complex_header_test.cpp | 8 + .../stlport/test/unit/config_test.cpp | 121 + .../3rdparty/stlport/test/unit/copy_test.cpp | 129 + .../3rdparty/stlport/test/unit/count_test.cpp | 73 + .../stlport/test/unit/cppunit/cppunit_mini.h | 225 + .../stlport/test/unit/cppunit/cppunit_proxy.h | 31 + .../stlport/test/unit/cppunit/cppunit_timer.h | 101 + .../stlport/test/unit/cppunit/file_reporter.h | 145 + .../stlport/test/unit/cppunit/test_main.cpp | 140 + .../stlport/test/unit/csetjmp_header_test.cpp | 8 + .../stlport/test/unit/csignal_header_test.cpp | 8 + .../stlport/test/unit/cstdarg_header_test.cpp | 8 + .../stlport/test/unit/cstddef_header_test.cpp | 8 + .../stlport/test/unit/cstdio_header_test.cpp | 8 + .../stlport/test/unit/cstdlib_header_test.cpp | 13 + .../stlport/test/unit/cstring_header_test.cpp | 8 + .../stlport/test/unit/cstring_test.cpp | 75 + .../stlport/test/unit/ctime_header_test.cpp | 8 + .../stlport/test/unit/ctype_facets_test.cpp | 520 + .../stlport/test/unit/ctype_header_test.c | 8 + .../stlport/test/unit/cwchar_header_test.cpp | 8 + .../stlport/test/unit/cwctype_header_test.cpp | 8 + .../stlport/test/unit/deque_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/deque_test.cpp | 330 + .../stlport/test/unit/divides_test.cpp | 33 + .../stlport/test/unit/epilog_test.cpp | 10 + .../3rdparty/stlport/test/unit/equal_test.cpp | 178 + .../stlport/test/unit/errno_header_test.c | 8 + .../test/unit/exception_header_test.cpp | 8 + .../stlport/test/unit/exception_test.cpp | 193 + .../lib/3rdparty/stlport/test/unit/fadapter.h | 80 + reactos/lib/3rdparty/stlport/test/unit/fib.h | 21 + .../3rdparty/stlport/test/unit/fill_test.cpp | 61 + .../3rdparty/stlport/test/unit/find_test.cpp | 135 + .../stlport/test/unit/finsert_test.cpp | 58 + .../stlport/test/unit/float_header_test.c | 8 + .../stlport/test/unit/foreach_test.cpp | 73 + .../stlport/test/unit/fstream_header_test.cpp | 10 + .../stlport/test/unit/fstream_test.cpp | 915 ++ .../stlport/test/unit/full_streambuf.h | 46 + .../3rdparty/stlport/test/unit/func_test.cpp | 76 + .../test/unit/functional_header_test.cpp | 8 + .../stlport/test/unit/generator_test.cpp | 92 + .../stlport/test/unit/greater_test.cpp | 49 + .../3rdparty/stlport/test/unit/hash_test.cpp | 434 + .../3rdparty/stlport/test/unit/heap_test.cpp | 108 + .../stlport/test/unit/includes_test.cpp | 87 + .../stlport/test/unit/innerprod_test.cpp | 72 + .../stlport/test/unit/inplace_test.cpp | 61 + .../stlport/test/unit/insert_test.cpp | 70 + .../stlport/test/unit/ioiter_test.cpp | 110 + .../stlport/test/unit/iomanip_header_test.cpp | 10 + .../stlport/test/unit/ios_header_test.cpp | 10 + .../stlport/test/unit/iosfwd_header_test.cpp | 10 + .../test/unit/iostream_header_test.cpp | 10 + .../stlport/test/unit/iostream_test.cpp | 116 + reactos/lib/3rdparty/stlport/test/unit/iota.h | 18 + .../3rdparty/stlport/test/unit/iota_test.cpp | 47 + .../stlport/test/unit/iso646_header_test.c | 8 + .../stlport/test/unit/istmit_test.cpp | 159 + .../stlport/test/unit/istream_header_test.cpp | 10 + .../3rdparty/stlport/test/unit/iter_test.cpp | 169 + .../test/unit/iterator_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/less_test.cpp | 50 + .../stlport/test/unit/lexcmp_test.cpp | 48 + .../stlport/test/unit/limits_header_test.cpp | 8 + .../stlport/test/unit/limits_test.cpp | 317 + .../stlport/test/unit/list_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/list_test.cpp | 468 + .../stlport/test/unit/locale_header_test.cpp | 10 + .../stlport/test/unit/locale_test.cpp | 337 + .../3rdparty/stlport/test/unit/locale_test.h | 94 + .../3rdparty/stlport/test/unit/logic_test.cpp | 65 + .../stlport/test/unit/macro_checks.cpp | 115 + .../stlport/test/unit/map_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/map_test.cpp | 454 + .../lib/3rdparty/stlport/test/unit/math_aux.h | 30 + .../stlport/test/unit/math_header_test.c | 8 + .../3rdparty/stlport/test/unit/max_test.cpp | 64 + .../stlport/test/unit/memory_header_test.cpp | 8 + .../stlport/test/unit/memory_test.cpp | 67 + .../3rdparty/stlport/test/unit/merge_test.cpp | 97 + .../test/unit/messages_facets_test.cpp | 85 + .../stlport/test/unit/mfunptr_test.cpp | 230 + .../3rdparty/stlport/test/unit/min_test.cpp | 62 + .../stlport/test/unit/mismatch_test.cpp | 82 + .../stlport/test/unit/modulus_test.cpp | 40 + .../stlport/test/unit/money_facets_test.cpp | 655 ++ .../stlport/test/unit/multiset_test.cpp | 127 + .../test/unit/mvctor_declaration_test.cpp | 369 + .../stlport/test/unit/mvctor_test.cpp | 816 ++ .../3rdparty/stlport/test/unit/mvctor_test.h | 97 + .../stlport/test/unit/mvctor_traits_test.cpp | 460 + .../3rdparty/stlport/test/unit/neq_test.cpp | 54 + .../stlport/test/unit/new_header_test.cpp | 8 + .../stlport/test/unit/nthelm_test.cpp | 84 + .../stlport/test/unit/num_facets_test.cpp | 297 + .../stlport/test/unit/num_put_get_test.cpp | 1266 +++ .../stlport/test/unit/numeric_header_test.cpp | 8 + .../stlport/test/unit/ostmit_test.cpp | 52 + .../stlport/test/unit/ostream_header_test.cpp | 10 + .../3rdparty/stlport/test/unit/pair_test.cpp | 46 + .../stlport/test/unit/partial_test.cpp | 248 + .../stlport/test/unit/partition_test.cpp | 130 + .../3rdparty/stlport/test/unit/perm_test.cpp | 228 + .../stlport/test/unit/plusminus_test.cpp | 52 + .../3rdparty/stlport/test/unit/ptr2_test.cpp | 84 + .../stlport/test/unit/ptrspec_test.cpp | 232 + .../stlport/test/unit/queue_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/queue_test.cpp | 64 + .../stlport/test/unit/rawriter_test.cpp | 66 + .../test/unit/reference_wrapper_test.cpp | 85 + .../stlport/test/unit/resolve_name.cpp | 83 + .../stlport/test/unit/reviter_test.cpp | 72 + .../3rdparty/stlport/test/unit/rm_cp_test.cpp | 245 + .../stlport/test/unit/rndshf_test.cpp | 73 + .../3rdparty/stlport/test/unit/rope_test.cpp | 189 + .../stlport/test/unit/rotate_test.cpp | 133 + .../stlport/test/unit/search_test.cpp | 89 + .../stlport/test/unit/set_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/set_test.cpp | 507 + .../stlport/test/unit/setdiff_test.cpp | 134 + .../stlport/test/unit/setinter_test.cpp | 79 + .../stlport/test/unit/setjmp_header_test.c | 8 + .../stlport/test/unit/setjmp_header_test2.cpp | 15 + .../stlport/test/unit/setunion_test.cpp | 81 + .../stlport/test/unit/shared_ptr_test.cpp | 41 + .../stlport/test/unit/signal_header_test.c | 8 + .../3rdparty/stlport/test/unit/slist_test.cpp | 554 ++ .../3rdparty/stlport/test/unit/sort_test.cpp | 217 + .../stlport/test/unit/sstream_header_test.cpp | 10 + .../stlport/test/unit/sstream_test.cpp | 487 + .../stlport/test/unit/stack_allocator.h | 206 + .../stlport/test/unit/stack_header_test.cpp | 8 + .../3rdparty/stlport/test/unit/stack_test.cpp | 60 + .../stlport/test/unit/stdarg_header_test.c | 8 + .../stlport/test/unit/stddef_header_test.c | 8 + .../test/unit/stdexcept_header_test.cpp | 8 + .../stlport/test/unit/stdio_header_test.c | 8 + .../stlport/test/unit/stdlib_header_test.c | 8 + .../stlport/test/unit/stldbg_include.cpp | 40 + .../test/unit/streambuf_header_test.cpp | 10 + .../stlport/test/unit/string_header_test.c | 8 + .../stlport/test/unit/string_header_test.cpp | 8 + .../stlport/test/unit/string_test.cpp | 1427 +++ .../test/unit/strstream_buffer_read_test.cpp | 35 + .../test/unit/strstream_header_test.cpp | 10 + .../stlport/test/unit/strstream_test.cpp | 49 + .../3rdparty/stlport/test/unit/swap_test.cpp | 165 + .../3rdparty/stlport/test/unit/test_errno.cpp | 56 + .../stlport/test/unit/time_facets_test.cpp | 402 + .../stlport/test/unit/time_header_test.c | 8 + .../3rdparty/stlport/test/unit/times_test.cpp | 34 + .../stlport/test/unit/transform_test.cpp | 80 + .../stlport/test/unit/type_traits_test.cpp | 593 ++ .../test/unit/typeinfo_header_test.cpp | 20 + .../lib/3rdparty/stlport/test/unit/unary.h | 23 + .../3rdparty/stlport/test/unit/unary_test.cpp | 98 + .../stlport/test/unit/uninitialized_test.cpp | 245 + .../stlport/test/unit/unique_test.cpp | 105 + .../stlport/test/unit/unordered_test.cpp | 676 ++ .../stlport/test/unit/utility_header_test.cpp | 8 + .../test/unit/valarray_header_test.cpp | 8 + .../stlport/test/unit/valarray_test.cpp | 121 + .../stlport/test/unit/vector_header_test.cpp | 8 + .../stlport/test/unit/vector_test.cpp | 553 ++ .../stlport/test/unit/wchar_header_test.c | 8 + .../stlport/test/unit/wctype_header_test.c | 8 + 320 files changed, 48753 insertions(+) create mode 100644 reactos/lib/3rdparty/stlport/doc/FAQ create mode 100644 reactos/lib/3rdparty/stlport/doc/README.borland create mode 100644 reactos/lib/3rdparty/stlport/doc/README.cygwin create mode 100644 reactos/lib/3rdparty/stlport/doc/README.dmc create mode 100644 reactos/lib/3rdparty/stlport/doc/README.evc3 create mode 100644 reactos/lib/3rdparty/stlport/doc/README.evc4 create mode 100644 reactos/lib/3rdparty/stlport/doc/README.evc8 create mode 100644 reactos/lib/3rdparty/stlport/doc/README.evc9 create mode 100644 reactos/lib/3rdparty/stlport/doc/README.intel create mode 100644 reactos/lib/3rdparty/stlport/doc/README.mingw create mode 100644 reactos/lib/3rdparty/stlport/doc/README.msvc create mode 100644 reactos/lib/3rdparty/stlport/doc/README.utf8 create mode 100644 reactos/lib/3rdparty/stlport/doc/README.wince create mode 100644 reactos/lib/3rdparty/stlport/doc/README.windows create mode 100644 reactos/lib/3rdparty/stlport/doc/build_system.txt create mode 100644 reactos/lib/3rdparty/stlport/doc/pointer_specialization.txt create mode 100644 reactos/lib/3rdparty/stlport/doc/stlport_namespaces.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/ChangeLog create mode 100644 reactos/lib/3rdparty/stlport/etc/ChangeLog-4.0 create mode 100644 reactos/lib/3rdparty/stlport/etc/ChangeLog-5.1 create mode 100644 reactos/lib/3rdparty/stlport/etc/ReleaseNote.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/STLport-4.5.1.spec create mode 100644 reactos/lib/3rdparty/stlport/etc/STLport-4.5.3.spec create mode 100644 reactos/lib/3rdparty/stlport/etc/STLport-4.6.spec create mode 100644 reactos/lib/3rdparty/stlport/etc/autoexp.dat create mode 100644 reactos/lib/3rdparty/stlport/etc/msvcincl.dat create mode 100644 reactos/lib/3rdparty/stlport/etc/std_headers.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/std_headers_c.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/std_headers_c_h.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/std_headers_classic_iostreams.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime.txt create mode 100644 reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime_h.txt create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/Makefile.inc create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/README create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile.inc create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/stterm-test.cc create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/eh.cc create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/gcc.mak create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/movable.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/partial_spec.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei1.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei2.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei3.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei4.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei5.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei6.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/compiler/ttei7.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/LeakCheck.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/Prefix.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/SortClass.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/TestClass.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/TestClass.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/Tests.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/ThrowCompare.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/bcb.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/bug.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/como-linux.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/como.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/cray.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/cygwin.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/deccxx.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/descrip.mms create mode 100644 reactos/lib/3rdparty/stlport/test/eh/djgpp.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/egcs.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/export create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-99r1.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-amigaos-m68k.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-apple-macosx.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-freebsd.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-hp11.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-irix.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-linux.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc-netbsd.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/gcc7.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/hp.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/hpacc.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/intel.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/intel45.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/intel50.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/kai.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/locale.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/main.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/mingw32.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/mwerks_console_OS_X.c create mode 100644 reactos/lib/3rdparty/stlport/test/eh/mwerks_debug_prefix.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_debug_prefix.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_prefix.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/mwerks_prefix.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/nc_alloc.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/random_number.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/random_number.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/sgi_mipspro.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/sunpro-64.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/sunpro.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/sunpro42.mak create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_algo.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_algobase.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_assign_op.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_bit_vector.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_bitset.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_construct.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_deque.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_hash_map.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_hash_resize.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_hash_set.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_insert.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_list.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_map.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_push_back.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_push_front.h create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_rope.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_set.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_slist.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_string.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_valarray.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/eh/test_vector.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/_template.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/accum_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/adj_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/advance_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/alg_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/algorithm_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/allocator_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/assert_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bcompos_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bind_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/binsert_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bitset_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bitset_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bnegate_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/boost_check.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bound_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bsearch_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/bvector_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/c_limits_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/c_locale_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cassert_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cctype_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cerrno_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cfloat_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ciso646_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/climits_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/clocale_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cmath_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cmath_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/codecvt_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/collate_facets_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/complete_digits.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/complex_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/config_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/copy_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/count_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_mini.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_proxy.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_timer.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cppunit/file_reporter.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cppunit/test_main.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/csetjmp_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/csignal_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cstdarg_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cstddef_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cstdio_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cstdlib_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cstring_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cstring_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ctime_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ctype_facets_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ctype_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cwchar_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/cwctype_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/deque_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/deque_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/divides_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/epilog_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/equal_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/errno_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/exception_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/exception_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/fadapter.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/fib.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/fill_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/find_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/finsert_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/float_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/foreach_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/fstream_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/fstream_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/full_streambuf.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/func_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/functional_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/generator_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/greater_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/hash_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/heap_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/includes_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/innerprod_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/inplace_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/insert_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ioiter_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iomanip_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ios_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iosfwd_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iostream_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iostream_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iota.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iota_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iso646_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/istmit_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/istream_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iter_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/iterator_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/less_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/lexcmp_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/limits_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/limits_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/list_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/list_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/locale_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/locale_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/locale_test.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/logic_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/macro_checks.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/map_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/map_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/math_aux.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/math_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/max_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/memory_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/memory_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/merge_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/messages_facets_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/mfunptr_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/min_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/mismatch_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/modulus_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/money_facets_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/multiset_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/mvctor_declaration_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/mvctor_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/mvctor_test.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/mvctor_traits_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/neq_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/new_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/nthelm_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/num_facets_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/num_put_get_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/numeric_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ostmit_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ostream_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/pair_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/partial_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/partition_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/perm_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/plusminus_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ptr2_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/ptrspec_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/queue_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/queue_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/rawriter_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/reference_wrapper_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/resolve_name.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/reviter_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/rm_cp_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/rndshf_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/rope_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/rotate_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/search_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/set_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/set_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/setdiff_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/setinter_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test2.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/setunion_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/shared_ptr_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/signal_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/slist_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/sort_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/sstream_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/sstream_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stack_allocator.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stack_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stack_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stdarg_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stddef_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stdexcept_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stdio_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stdlib_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/stldbg_include.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/streambuf_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/string_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/string_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/string_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/strstream_buffer_read_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/strstream_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/strstream_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/swap_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/test_errno.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/time_facets_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/time_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/times_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/transform_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/type_traits_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/typeinfo_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/unary.h create mode 100644 reactos/lib/3rdparty/stlport/test/unit/unary_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/uninitialized_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/unique_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/unordered_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/utility_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/valarray_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/valarray_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/vector_header_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/vector_test.cpp create mode 100644 reactos/lib/3rdparty/stlport/test/unit/wchar_header_test.c create mode 100644 reactos/lib/3rdparty/stlport/test/unit/wctype_header_test.c diff --git a/reactos/lib/3rdparty/stlport/doc/FAQ b/reactos/lib/3rdparty/stlport/doc/FAQ new file mode 100644 index 00000000000..2d288a3994b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/FAQ @@ -0,0 +1,554 @@ + Content + +Q1 About STLport and availability + +Q1.0 What is STLport? +Q1.1 What are the benefits from using STLport? +Q1.2 What versions of STLport are available? +Q1.3 Where is the documentation or user guide? +Q1.4 What is the version policy? + +Q2 General + +Q2.0 Do I need a C++ compiler? +Q2.1 Do I need runtime libraries from C++ compiler? +Q2.2 Can I use containers and algorithms from STLport and iostreams from +library that ship with my compiler? +Q2.3 Can I mix STL implementations in my project? +Q2.4 When I switch to STLport in my application, I get errors. Is STLport +so bad? + +Q3 Building + +Q3.0 On my XXXX Linux n.n g++ headers are in /usr/include/g++, but they +are looked for in /usr/include/3.3.1. Is it a STLport bug? +Q3.1 Do I need to build library to use STLport? +Q3.2 During library compilation with MS VC++ 6.0 I see following error report:... +Q3.3 Has anybody succeeded building STLport on OS Y with compiler K n.n? +Q3.4 Does STLport support cross-compilation? + +Q4 Installation + +Q4.1 I tried "make -f gcc.mak install", but it install nothing into +/usr/local/. How I can install headers into /usr/local/include and +libs into /usr/local/lib? + +Q5 Bug report + +Q5.0 I found a bug, how can I report about it? + +Q6 Design + +Q6.0 In STLport, files like locale.h, setjmp.h, stdlib.h, etc., +do nothing except include native headers. Why are these files present in STLport? +Q6.1 Is STLport a replacement for headers and libraries that shipout +with compiler? +Q6.2 My tool detects memory leaks in applications with STLport. Is this leak +from STLport? +Q6.3 When running unit tests, I have errors in LocaleTest test fixture, how bad +is it? +Q6.4 set or multiset iterators are immutable like const_iterators, why ? + + Answers + +======================================================================== + +Q1.0 What is STLport? +A1.0 STLport is an implementation of the C++ Standard Library, as described +in the INTERNATIONAL STANDARD ISO/IEC 14882:1998(E) and latest +ISO/IEC 14882:2003(E). + +======================================================================== + +Q1.1 What are the benefits from using STLport? + +A1.1 + - For multiplatform/multicompilers project a coherent Standard Library +implementation. + - An easy to use STL safe mode detecting bad use of containers and +iterators. + - Some original optimizations: template expression for string +concatenation, short string optimization, move semantic for STL containers +combination like vector of vector, an efficient std::allocator. + +======================================================================== + +Q1.2 What versions of STLport are available? + +A1.2 + +======================================================================== + +Q1.3 Where is the user guide? + +A1.3 There is no real user guide for the moment. You can find some information +in README files in doc folder. As STLport is a C++ Standard library +implementation you might find information you need at the following +locations: + - The ISO/IEC 14882:2003 document you can buy for a very cheap price. + - For STL containers you can use SGI documentation (http://www.sgi.com/tech/stl/). + Beware however, STL described in this document is not identical to the + Standardized version described in ISO/IEC. This documentation can be very + useful for STLport extensions like hash containers (hash_map, hash_set...) + - You can also use the documentation coming with your compiler as most + of the information will also apply to STLport. Take care to description + reported as 'implementation specific'. + +======================================================================== + +Q1.4 What is the version policy? + +A1.4 STLport version information contains three numbers like '5.1.0'. '5' +is the major version number, '1' is the minor and '0' is the patch level. +Policy for this numbers are: + - changes in major version number: radical modification, new era. + - changes in minor version number: significant changes, new features, + changes in interface part; switching to an STLport library with a different + minor version require recompilation of all modules depending on it. + - changes in patch level: bugfixes; we keep in mind binary compatibility, + but really can't strongly guarantee it; switching to an STLport library + with different patch level do not require rebuild of modules---rebuilding and + installing the STLport libraries should work; however, as STLport contains + a lot of template code, you should pay attention to fact that all you modules + was build with SAME STLport headers---otherwise problems possible; + recompilation of one part with only rebuilding STLport might not be enough + to get all the fixes in your application so even in this case rebuilding + your modules is advised. + +======================================================================== + + +Q2.0 Do I need a C++ compiler? + +A2.0 STLport is a C++ library. So the answer is 'yes, you do'. + +======================================================================== + +Q2.1 Do I need runtime libraries from C++ compiler? + +A2.1 In any case, the C++ language support from compiler is required +for STLport (operators new, delete, RTTI, exceptions support). That's why +in most cases you need some runtime libraries from the C++ compiler. + +======================================================================== + +Q2.2 Can I use containers and algorithms from STLport and iostreams from +the library that ships with my compiler? + +A2.2 The short answer is 'No'. + +Indeed co-existence of two implementations possible, but this required +a lot of knowledge as about both implementations, as about compiler and +linkage. This issues should be taken into account both within STL library and +during library usage. In common you can't use both implementation +in the same namespace. So you should separate STL implementations into +different namespaces. But due to absent of compilers that has full-featured +support of Argument Dependent Lookup (ADL) (aka Koenig Lookup), you have no +possibilty to select one or another implementation. + +ADL problem. + +In wrapper mode, all std references are replaced, thanks a simple macro, +by the stlp_std namespace. Everything from the native compiler std namespace +is injected to the stlp_std namespace with many using std::* directives. + +The problem arise when you specialized a standard class for one of your +user types. You do it within the std namespace that, in wrapper mode +becomes the stlp_std namespace. Then this specialization is just invisible +from the native std namespace and won't be used. + +Things are somewhat worse: the problem arises even without any explicit +specializations. It is not a bug, but the fact that old compilers just +did not tried to find functions in the namespaces where arguments' classes +are defined (indeed no compilers with full-featured support of ADL yet). + +Mix implementation via library. + +Let's reduce all the complexity of STLport to some very simple example: + +namespace std { + +class string +{ + public: + class iterator { }; + + iterator begin(); + iterator end(); +}; + +template +void find(I begin, I end, T value); + +} // namespace std + + +namespace stlport { + +using std::string; + +template +void find(I begin, I end, T value); + +void gee() +{ + string s; + find(s.begin(), s.end(), 10); +} + +} // namespace stlport + + +When a compiler supporting ADL finds the call to `find' within gee() function +it should examine both namespace `stlport' and namespace `std' for +the presence of `find'. It is caused by the fact that s.begin() returns +object of type `std::string::iterator' which obviously defined in namespace +`std' and the heart of ADL is finding functions not only within namespaces +where the call is being made but also in the namespaces where the classes +of arguments are defined... + +So, in our example compiler ends with two templates satisfying the call +`find(s.begin(), s.end(), 10)': `std::find' and `stlport::find'. +Since compiler can not choose any one of them it reports ambiguity. + +There is another aspect of mix implementations. +Let's consider following code: + +a.h: + +#include + +class A { + public: + A() {} + + void push( const string s ); + + string _str; +}; + +a.cpp: + +#include "a.h" + +void A::push( const string s ) +{ + _str = s; +} + + +b.cpp: + +#include "a.h" + +string s; +A a; + +void gee() +{ + a.push( s ); +} + +Now build library from a.cpp with string implementation Impl1; +then build application with b.cpp that use string implementation Impl2, +and link with mentioned above library. Compiler will pass. Linker may +pass too. But your application will crash (or randomly crash) either on +call a.push, or on assignment _str = s. This is evident here, but not +evident in real applications. + +The conclusion is: "Using Wrapper mode is very hard and we removed support +for it". + +======================================================================== + +Q2.3 Can I mix STL implementations in my project? + +A2.3 Yes you can but each implementations will rely in its own namespace +with no direct interaction between them. You will first need to correctly +configure STLport thanks to 2 macros in user_config.h file. +- _STLP_DONT_REDEFINE_STD tells STLport not to define the std macro that is +used to replace std reference in your code with STLport namespace. +- _STLP_WHOLE_NATIVE_STD tells STLport to always include native header each +time a Standard header is included in your code. + +Here is a small code sample that do not require any modification in STLport +install: + +#define _STLP_DONT_REDEFINE_STD +#define _STLP_WHOLE_NATIVE_STD + +#include + +void foo() +{ + std::string std_str("std"); + stlport::string stlport_str("stlport"); + stlport_str.append(std_str.begin(), std_str.end()); + // Following is wrong because there is no assignment + // operator for stlport::string on std::string. + //std_str = stlport_str; +} + +Note: You can use 'std' iterators from native implementation in STLport +template methods like in the 'stlport_str.append' method call above because +STLport is adding the necessary code to interpret native iterators like +STLport iterators. You won't be able however to do the opposite as native +implementation do not know anything about STLport iterators. + + +======================================================================== + +Q2.4 When I switch to STLport in my application, I get errors. Is STLport +so bad? + +A2.4 Before you post such message, please, check STLport WHITHOUT YOUR code: + - build STLport library + - build STLport unit tests + - run STLport unit tests +If any of above steps fail, please, make sure that you carefully followed +build instructions (in most cases you definitely should reread +instructions and check that you correctly unpack archive in case you see +'file not found' message). Build instructions you can found in files +INSTALL, doc/README.*, build/README*, build/test/unit/README*. +If you are sure, submit bug report here: +https://sourceforge.net/projects/stlport +Don't forget to describe your operational environment, compiler version and +STLport version. + +======================================================================== + +Q3.0 On my XXXX Linux n.n g++ headers are in /usr/include/g++, but they +are looked for in /usr/include/3.3.1. Is it a STLport bug? + +A3.0 Path to native compiler headers for GCC correspond to default path +after build/install compiler (i.e. paths from compiler origo). +Package maintainers can use any path by own taste---we can't satisfy +variety of distributions/packages. + +So you can: + - fix path in stlport administration config file stlport/stl/config/host.h, + see _STLP_NATIVE_INCLUDE_PATH macro and related. + - create a link to the native compiler headers like expected by STLport + - make request to package maintainer + - build and install compiler + +Note: Starting with version 5.2, STLport uses the include_next preprocessing +command to access native headers so you shouldn't experiment this problem +anymore when this feature is supported by your compiler preprocessor. + +======================================================================== + +Q3.1 Do I need to build a library to use STLport? + +A3.1 You may omit usage (and, thus building) STLport library, but in this +case you can't use iostreams, locale, complex. + +======================================================================== + +Q3.2 During library compilation with MS VC++ 6.0 I see following error report: + +C:\Program Files\Microsoft SDK\Include\.\winbase.h(1123) : error C2733: second C linkage of overloaded function 'InterlockedIncrement' not allowed + C:\Program Files\Microsoft SDK\Include\.\winbase.h(1121) : see declaration of 'InterlockedIncrement' +C:\Program Files\Microsoft SDK\Include\.\winbase.h(1130) : error C2733: second C linkage of overloaded function 'InterlockedDecrement' not allowed + C:\Program Files\Microsoft SDK\Include\.\winbase.h(1128) : see declaration of 'InterlockedDecrement' +C:\Program Files\Microsoft SDK\Include\.\winbase.h(1138) : error C2733: second C linkage of overloaded function 'InterlockedExchange' not allowed + C:\Program Files\Microsoft SDK\Include\.\winbase.h(1135) : see declaration of 'InterlockedExchange' + +A3.2 You have a Platform SDK installed. Uncomment line +#define _STLP_NEW_PLATFORM_SDK 1 +in the file stlport/stl/config/user_config.h. There is no way to detect SDK +presence during preprocessor stage, which is why you have to make this +change manually. + +======================================================================== + +Q3.3 Has anybody succeeded building STLport on OS S with compiler K n.n? + +A3.3 See report about results of regression tests here: build/test/unit/STATUS. + +======================================================================== + +Q3.4 Does STLport support cross-compilation? + +A3.4 In case of GCC, use something like following sequence: + + (./configure --target=${CROSSTARGET}; cd build/lib; \ + export PATH=${BASECROSS}/bin:${PATH}; make -f gcc.mak install-release-shared) + +where CROSSTARGET is GCC's cross prefix (something like 'i586-pc-linux-gnu', +if C++ cross compiler named as 'i586-pc-linux-gnu-c++'), BASECROSS is base of +cross-compiler's location (i.e. ${BASECROSS}/bin in case above is a location +of 'i586-pc-linux-gnu-c++'). + +In case of non-GCC crossecompilers, we need hands-made target system identification. +The sample of such compiler (supported by STLport) is MetroWerks Codewarrior +for Novell Netware (mwccnlm). + +======================================================================== + +Q4.1 I tried "make -f gcc.mak install", but it installs nothing into +/usr/local/. How I can install headers into /usr/local/include and +libs into /usr/local/lib? + +A4.1 Installation in any system-wide place is issue of either 'package builder' +or system administrator. He/she should be familiar with building package +procedure and/or understand where headers and libraries should be situated. +The place choice not issue of STLport. + +You can just use + +(cd ${STLPORT_SRC}/lib; tar cf - . ) | (cd ${TARGET_LIB_DIR}; tar xf - ); \ + (cd ${STLPORT_SRC}; tar cf - stlport) | (cd ${TARGET_INCLUDE_DIR}; tar xf - ) + +Sometimes we will think about 'make install', but not now. + + +======================================================================== + +Q5.0 I found a bug, how I can report about it? + +A5.0 + 0. Ensure that this is really a bug (standard violation, incorrect + behaviour with correct usage). + 1. Ensure that bug is in STLport, not in your code (you can use _STLP_DEBUG + for that, see stlport/stl/config/user_config.h). + 2. Ensure that you correctly built STLport---build and run unit tests + (build/test/unit) first with default settings, then with your settings + (if you changed any). + 3. Write a short test that demonstrates the bug. + 4. Make sure that this test case is really new, i.e. not covered by unit + tests (test/unit/*). + 5. Compare your results with reported runs of unit tests (build/test/unit/STATUS). + 6. Write bug description and test here + + https://sourceforge.net/projects/stlport + + DON'T FORGET TO DESCRIBE: + + - OPERATIONAL ENVIRONMENT + - COMPILER VERSION + - STLPORT VERSION + - RESULT OF UNIT TESTS + + Keep in mind, that your bug MUST be reproduced by other people, so give + enough information (but compactly, give only essential information). + +======================================================================== + +Q6.0 In STLport files like locale.h, setjmp.h, stdlib.h, etc., do +nothing except include native headers. Why are these files present in STLport? + +A6.0 Sometimes native C headers are using C++ ones or are refering +to the std namespace. That's why, if stddef was absent in STLport, then + +#include +#include + +may cause problem in following code, because std redefined in the end of + header, and std may be used in stddef.h: + +__BEGIN_NAMESPACE_STD +.... +__END_NAMESPACE_STD + +where __BEGIN_NAMESPACE_STD is defined as 'namespace std {'. +To avoid this, STLport has stddef.h header and provide correct masquerade +for std. + +======================================================================== + +Q6.1 Is STLport a replacement for headers and libraries that shipout +with compiler? + +A6.1 In general no. In any case C++ language support from compiler is required +for STLport (operators new, delete, RTTI, exceptions support). STLport also +uses 'native' headers and libraries to take interface to system functions and +variables. + +======================================================================== + +Q6.2 My tool detects memory leaks in application with STLport. Is this leak +from STLport? + +A6.2 In most cases these are 'pseudo memory leaks' that some tools +wrongly detect. + +In the default compile of STLport, the node allocator is used to allocate +internal memory. The node allocator works by pre-allocating a large chunk of +memory and handing out small memory blocks. The memory chunk is not freed +during running an application that uses STLport (i.e. it is not returned to +the system, but reused inside application). +See also http://www.sgi.com/tech/stl/alloc.html + +There are tools like BoundsChecker, Purify or Valgrind that check for memory +leaks, for memory that isn't freed when no longer used. These tools may report +false memory leaks when one uses STLport's node allocator. The memory chunk is +normally freed at application end, but the memory checkers usually report memory +leaks before that point. Another memory problem might be reported when you use +shared libraries (e.g. DLL, this problem specific for Windows DLL model) that +uses STLport internally and are statically link to it. If memory is allocated in +a dll and released in an other then the STLport node allocator will keep the +released memory for a future use. If you do not use this memory then your +application global memory consumption will grow until the app crash even if there +is no real memory leak. This is why you should always use a coherent configuration +everything in dll or everything in static lib. + +There are ways to remove the pseudo memory leaks (since the memory is properly +freed at the end of the program, the leaks are just pseudo-ones). You could use +another allocator that is used in STLport. Open the file +"./stlport/stl/config/host.h" and uncomment either one of the following: + + + _STLP_USE_NEWALLOC enables a simple allocator that uses "new/delete" + _STLP_USE_MALLOC enables a simple allocator that uses "malloc/free" + +The new/delete allocator has the advantage of giving an entry point to track +memory starvation, see set_new_handler in your compiler doc or the C++ Standard +for more information. + +Alternatively you can define the following symbol, just uncomment it in +"./stlport/stl/config/host.h". + + _STLP_LEAKS_PEDANTIC + +The symbol forces freeing all memory chunks. Also see the comments around the +symbol in the config file. + +Note that you have to recompile STLport AND your application and all of your +dependent libraries if you make any change to the file! + +There are also some defines that help in debugging memory problems in STLport. +In _STLP_DEBUG mode, just also define the following symbols, either in +"./stlport/stl/config/user_config.h" or in your project settings: + + _STLP_DEBUG_ALLOC + _STLP_DEBUG_UNINITIALIZED + +You don't need to rebuild STLport for these options, but you have to rebuild +your application and all of your dependent libraries if you make any change to +the file. + +======================================================================== + +Q6.3 When running unit tests, I have errors in LocaleTest test fixture, how bad +is it? + +A6.3 Failures in LocaleTest tests do not mean that your platform/compiler is not +fully supported by STLport. Platform independant localization tests are very hard +to write as Standard localization API has not been design to make unit test easy. +In STLport unit tests suite we have hard coded some expected values. Those values +depends on your OS configuration explaining why sometimes the tests are failing. + +======================================================================== + +Q6.4 set or multiset iterators are immutable like const_iterators, why ? + +A6.4 With set or multiset associative containers or even newly introduced +tr1::unordered_set and tr1::unordered_multiset key is confuse with data. It +means that modifying the data is also modifying the key. Modifying the key +might corrupt the container internal data structure so STLport prefer to +make this problem obvious and only return a const access to the key with +immutable iterators. Your solutions are: +- prefer map/multimap and split the key and the data +- use const_cast when you want to change a set/multiset element. + diff --git a/reactos/lib/3rdparty/stlport/doc/README.borland b/reactos/lib/3rdparty/stlport/doc/README.borland new file mode 100644 index 00000000000..340c55ad582 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.borland @@ -0,0 +1,154 @@ + +================================================== +STLport README for Borland C++ compilers. +================================================== + +by: Francois Dumont, dums@stlport.com, last edited 20 May 2006 + +============ +Introduction +============ +This document describes how STLport can be compiled and used with +Borland compilers. + +For any further comments or questions visit STLport mailing lists +http://stlport.sourceforge.net/Maillists.shtml or forums +https://sourceforge.net/forum/?group_id=146814 + +============= +Prerequisites +============= +To build and use STLport you will need following tools and libraries: + - Borland C++ compiler package 5.5.1 or higher version. + + In order to build STLport the Borland compiler and linker have to + be correctly configurated too. That is to say: + + * For the Borland compiler bcc32: + + In Borland's 'bin' directory (same directory as bcc32.exe), create a + bcc32.cfg file containing the compiler option giving it the path to + native Borland headers: + + -I%BORLAND_PATH%\BCC55\include + + * For the resource compiler brcc32: + + Create an environment variable INCLUDE containing path to native Borland + headers and especially the windows.h file + + set INCLUDE=%BORLAND_PATH%\BCC55\include + + * For the Borland linker ilink32: + + You need to give path to both the Borland libs and Borland PSDK libs. + For that you have to create, in the same directory as ilink32.exe, a + configuration file, ilink32.cfg, that contains: + + -L%BORLAND_PATH%\BCC55\lib;%BORLAND_PATH%\BCC55\lib\PSDK + + - A GNU make tool. You can get one from www.mingw.org or www.cygwin.com. + See README.mingw or README.cygwin for additional informations. + +=================== +Configuring STLport +=================== + This is intended to be an optional step, if you want to use default +configuration simply jump to next chapter 'Building STLport'. Open a console +and go to the STLport build/lib folder. Run + + configure --help + + This command will present you the different available build options. Just follow +the instructions to set STLport configuration according your needs. For example, +to set the typical configuration for most Borland compilers, run + + configure -c bcc + +================ +Building STLport +================ + This is a step by step description of the actions to take in order to build +and install the STLport libraries: + +1. Open a console, you can use a Msys, Cygwin or Windows console. + +2. Go to the STLport build/lib folder: + cd C:\STLport\build\lib + +3. Run the following command: + make -fbcc.mak install + + Where 'make' is the GNU make utility you have installed. The name of +GNU make utility may differ, such as 'mingw32-make'. -f is a make option +telling it which makefile to use. You have of course to choose the +appropriate makefile for your compiler, 'bcc.mak' in our case. + + Once the command returns you will have all the necessary import libraries +in STLport's 'lib' folder and DLLs in STLport's 'bin' folder. For a +description of the generated libraries check the FAQ file in the 'doc' folder. +For a quick start guide to the STLport make system, see the README file in the +'build/lib' folder. + +=============== +Testing STLport +=============== +You can use the unit tests to verify STLport behaves correctly. Change into +STLport's 'build/test/unit' folder and type: + + make -fbcc.mak install + +This will build and install the unit tests with STLport dynamic libraries. +Once the unit tests are built you just need to run them. They can be found +in STLport's bin, bin-g or bin-stlg folders. To rebuild the unit tests +with STLport static libraries, type: + + make -fbcc.mak clean + make -fbcc.mak install-static + +============= +Using STLport +============= +Adjust your include and link paths in Borland IDE or in the command line config +files. In the include files add the path to STLport's 'stlport' folder. Make sure +it is the first directory listed there. Add STLport's 'lib' folder for the library +files (order of paths doesn't matter here). + +Now you should be ready to use STLport. + +============ +Known limitations +============ + +1. If you extend a locale facet based on a Standard facet definition you will +have to grant your own facet id defition. Ex extracted from +test/unit/fstream_test.cpp: + +#include + +using namespace std; + +struct my_state { + char dummy; +}; + +struct my_traits : public char_traits { + typedef my_state state_type; + typedef fpos pos_type; +}; + +class my_codecvt : public codecvt +{}; + +// Mandatory locale facet id definition: +template <> +locale::id codecvt::id; + +2. If you get a linker memory error, e.g. LME351, it probably means that full +source debugging is enabled and Borland's .TDS file has exceeded the memory +capacity of Borland's linker (ilink32.exe). To resolve this error, check +Borland's website for the latest patch for ilink32.exe. In the alternative, +disable full source debugging in build\Makefiles\gmake\bcc.mak by deleting +the -v option in the OPT settings. + +3. For "'uname' is not recognized . . .", see "Configuring STLport" above. diff --git a/reactos/lib/3rdparty/stlport/doc/README.cygwin b/reactos/lib/3rdparty/stlport/doc/README.cygwin new file mode 100644 index 00000000000..f417b9fcab1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.cygwin @@ -0,0 +1,43 @@ +The cygwin platform is used to build STLport with different compilers. + +- gcc (native compiler): + + Makefile : gcc.mak + + Notes: + + 1. Static builds (archive) + + If you use the static version of the STLport libraries you have + to define the _STLP_USE_STATIC_LIB macro in order to have your + executable linked correctly. + + 2. Link + + Under this platform STLport is complete replacement for libstdc++. + It means that when you were linking with libstdc++ (-lstdc++) you only + have to replace it with STLport (-lstlport.5.2 for instance). However + default gcc behavior is to automatically link libstdc++ and a number of + other system libs. To avoid this behavior you have to use the -nodefaultlibs + compiler option and explicitely give all libraries by yourself. See build of + unit tests to see what library you might need, here is the list when this + note was written: + + without -mnocygwin option: + + -lstlportg.5.2 -lgcc -lm -lc -lpthread -lkernel32 + + with -mno-cygwin option: + + -lstlportg.5.2 -lgcc -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname + -lcoldname -lkernel32 + + 3. No cygwin + + To build STLport libraries that do not depend on cygwin1.dll + making them freely redistributable pass the following option to + the configure script: + + ./configure --with-extra-cflags=-mno-cygwin --with-extra-cxxflags=-mno-cygwin + +- Borland C++ compiler diff --git a/reactos/lib/3rdparty/stlport/doc/README.dmc b/reactos/lib/3rdparty/stlport/doc/README.dmc new file mode 100644 index 00000000000..ce6062fc003 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.dmc @@ -0,0 +1,81 @@ +================================================== +STLport README for Digital Mars C++ compilers. +================================================== + +Build of STLport with Digital Mars C++ compiler is very similar +to the one for Microsoft Visual Studio compiler (see README.msvc). + +Below are some additional hints. [DMC users are encouraged to +contribute additional information.] + +============= +Prerequisites +============= + + - Digital Mars C++ 8.49 or above + + - A GNU environment with make tool. Prefer MinGW/MSys to Cygwin because the + latter contains a link command that is also the name of the Digital Mars linker + and you might experiment collision between both commands. + See README.mingw for additional information. + +=================== +Installing STLport +=================== + + - STLport directory can be almost anywhere EXCEPT native dm\include directory. + +=================== +Configuring STLport +=================== + + - In a console window go to the STLport build\lib folder. Run + + configure -c dmc + +================ +Building STLport +================ + + - To build STLport libraries: + + cd [STLport dir]\build\lib + [mingw32-make] -f dmc.mak install + + - To build STLport (dynamic) unit tests: + + cd [STLport dir]\build\test\unit + [mingw32-make] -f dmc.mak install + +============ +Known issues +============ + +1. typeinfo.h + + DMC forces inclusion of typeinfo.h header at the begining of any +translation unit. This breaks the STLport include schema, especially +when building the library. As a workaround STLport typeinfo.h simply +include native DMC header not performing any internal STLport work as +importing things to STLport namespace. As a result typeinfo.h should +never be reference in user code, as it is neither a C nor a C++ header +this is not considered as a major limitation. The C++ Standard header +is typeinfo. + +2. link.exe and lib.exe + + STLport makefiles for DMC use dm_link and dm_lib instead of link and lib to +avoid conflicts with other vendors' linkers and archivers. To build STLport +with DMC, please copy or rename the following files: + + copy dm\bin\link.exe dm\bin\dm_link.exe + copy dm\bin\lib.exe dm\bin\dm_lib.exe + +3. Free online version. + + If DMC's free online version reports compiler or linker errors, the +solution may be in a free online CD update. Download and unzip all free +CD patches for versions 8.30 and above, in consecutive order, overwriting +previous files. Then install free online version 8.49 or above, overwriting +previous files. + diff --git a/reactos/lib/3rdparty/stlport/doc/README.evc3 b/reactos/lib/3rdparty/stlport/doc/README.evc3 new file mode 100644 index 00000000000..7aa46ba491b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.evc3 @@ -0,0 +1,157 @@ + +======================================== +STLport README for eMbedded Visual C++ 3 +======================================== + +by: Michael Fink, vividos@users.sourceforge.net, last edited 2005-11-15 + +============ +Introduction +============ +This document describes how STLport can be compiled and used with Microsoft +eMbedded Visual C++ 3. + +For any further comments or questsion visit STLport mailing lists +http://stlport.sourceforge.net/Maillists.shtml or forums +https://sourceforge.net/forum/?group_id=146814 + + +============= +Prerequisites +============= +To build and use STLport you will need following tools and libraries: + - eMbedded Visual C++ 3.0 + - latest CVS version of STLport, use info from page + 'http://stlport.sourceforge.net/CVS.shtml' to get it. + Note that you may have to get a different branch, please check out the + STLport forum "Announcements" which sourcecode is being worked on. + +================ +Building STLport +================ +Note: if you don't plan to use the iostreams part of STLport (via the define +_STLP_NO_IOSTREAMS), you don't have to build the library. You can skip straight +to the "Using STLport" section. + +If you want to compile for the Pocket PC 2002 SDK (which in most cases you want) +be sure to set the PLATFORM environment variable to "Pocket PC 2002", e.g. with +this command: + + set PLATFORM=Pocket PC 2002 + +Open a command line prompt and execute the batch file that sets up compiling +for ARM or x86 processors. These files usually are in a folder like +'C:\Program Files\Windows CE eMbedded Tools\EVC\WCE300\BIN\' and are called +WCEARM.bat and WCEx86.bat. Check if the environment variables are set up +properly after that call. You can also adjust the batch files to have the +PLATFORM variable set automatically. + +Go into STLport's 'build\lib' folder and type: + + configure.bat -c evc3 + +The makefiles are configured with the given settings. Call configure.bat with +the --help option to see all options. The program automatically tells you which +command line to use. If you want to install the libraries, add the "install" +target as follows: + + nmake /fmsvc.mak install + +All libraries (debug, stldebug, release) are now built, static and shared +ones. Import libraries (.lib files) are put in the 'lib\evc3-arm' folder, DLLs +are put in the 'bin\evc3-arm' folder. If you use another target platform, the +name of the folder is changed accordingly, e.g. evc3-x86 for emulator files. + +Once STLport is built you can decrease the size of the STLport folder by +removing intermediate build files. This is done with the following command: + + nmake /fmsvc.mak clobber + +Note: MIPS platform is also available for build, but it may not compile or work + properly. Use with caution! + +=============== +Testing STLport +=============== +You can use the unit tests to verify STLport behaves correctly. Change into +STLports 'build\test\unit' folder and type: + + nmake /fmsvc.mak install + +If you want to build the unit tests for the emulator, you have to reconfigure +STLport with the configure.bat, as described above. + +Once the unit tests are built, upload the binary (found in the 'bin\evc3-arm' +folder) to your device or emulator and start it (the test runs for about 30 +seconds, depending on the speed of the device). The file 'stlp_test.txt' is +created in the root folder of the device, which contains the unit test +results. It should report no errors. + +============= +Using STLport +============= +Adjust your include and link paths in eVC3 in 'Tools -> Options -> Directories' +and add the paths for all platforms and CPUs on which you want to use STLport. +In the include files add the path to STLport's 'stlport' folder. Make sure it +is the first directory listed there. Add STLport's 'lib\evc3-arm' or +'lib\evc3-x86' (depending on what target you use) folder for the library files +(order of paths doesn't matter here). + +There are some preprocessor defines that control usage of the STLport in evc3 +projects: + +Define the symbol _STLP_USE_STATIC_LIB when you want to statically link against +STLport. The linker will remove unused classes and methods then, saving some +space in the executable. + +If you don't want to use the iostreams part of the library, you can specify the +define _STLP_NO_IOSTREAMS. In this mode there is no need to link against the +library. + +STLport uses automatic linking to find the proper .lib file. If you want to see +what import library STLport is going to use, define _STLP_VERBOSE_AUTO_LINK. +When not using automatic linking (by specifying _STLP_DONT_USE_AUTO_LINK), you +have to specify the proper .lib file in the Project Settings, on the "link" tab. +The .lib names have the following syntax: + + stlport(d|stld)[_static]..lib + +Examples: + + stlport_static.5.0.lib - static release version, Version 5.0.0 + stlportd_50.lib - dll debug version, Version 5.0.0 + +Note that usage of the _STLP_DEBUG mode is currently not recommended for +eMbedded Visual C++ builds using the ARM compiler, due to a compiler bug. + +When using STLport together with MFC, be sure to include the MFC headers first, +then include STLport headers, e.g. in your Stdafx.h. This way STLport correctly +recognizes MFC usage. You also can define the macro _STLP_USE_MFC, either in +your project settings or in stlport/stl/config/user_config.h. + +Now you should be ready to use STLport. + +============ +Known issues +============ + - Unit Tests in _STLP_DEBUG mode (target 'stldbg-shared') fails in + __stl_debug_engine::_M_detach() for several tests due to unknown reasons. + A compiler bug in the ARM compiler is suspected. + There is currently no workaround for this bug. It is recommended to not use + _STLP_DEBUG mode. + + - Resource compiler issue: + + The resource compiler is not a C++ compiler, it is a compiler that translates + resource files, i.e. files that describe dialogs, strings, version information + and other parts of the GUI on MS Windows systems. + + The problem is that it includes files from the C/C++ include path, and + STLport uses mechanisms the resource compiler can't handle, e.g. using macro + names longer than 31 characters. + + The workaround is to guard all affected headers (stdio.h, string.h, stdarg.h, + stdlib.h, ctype.h) against this. The resource compiler is detected by the + macro RC_INVOKED. + + - See also README.evc4 issues. diff --git a/reactos/lib/3rdparty/stlport/doc/README.evc4 b/reactos/lib/3rdparty/stlport/doc/README.evc4 new file mode 100644 index 00000000000..6f5038f4038 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.evc4 @@ -0,0 +1,126 @@ + +======================================== +STLport README for eMbedded Visual C++ 4 +======================================== + +by: Zdenek Nemec, zero@mapfactor.com, last edited 2005-10-17 + +============ +Introduction +============ +This document should provide step-by-step guidance for installing, testing and using the STLport library under Windows CE .NET 4.x +(aka Windows Mobile 2003 aka Pocket PC 2003). +For any further comments or questions visit the STLport mailing lists +http://stlport.sourceforge.net/Maillists.shtml or forums +https://sourceforge.net/forum/?group_id=146814 + +============= +Prerequisites +============= +To build and use the STLport you will need following tools and libraries: + - eMbedded Visual C++ 4.0 SP4 + - an SDK for your target platform with RTTI support + +================ +Building STLport +================ +First, make sure that RTTI is available. Not all SDKs that come with eVC4 also include +the necessary libs, but there is a patch for the PPC2003 SDK, available at +http://support.microsoft.com/default.aspx?scid=kb;[LN];830482. + +Second, open command line and set proper system variables. +This can be done by using batch files under your 'eMbedded Visual C++' directory(use either WCEemulator.BAT if you want to build STLport for the emulator or WCEARMV4.BAT if you intend to aim an ARM device). +NOTE: If you are using Microsoft's batch files to set system variables check if both WCEROOT and SDKROOT vars are set to correct locations. example: +WCEROOT=C:\Program Files\Microsoft eMbedded C++ 4.0 +SDKROOT=C:\Program Files\Windows CE Tools + +Third, when you are 100percent sure you've set correctly systems variables go to the STLport/build/lib dir and run the configure.bat with +proper -c option (ie. "-c evc4"), +then invoke following command: 'nmake /fmsvc.mak install' to build the library. + +If anything goes wrong check if you met all prerequisities and if you set system vars accordingly to the makfile you are using. +At the end of build process you should have some libs installed in STLport/lib/evc4-arm or STLport/lib/evc4-x86 and dynamic libs in STLport/bin directory. + +You might want to repeat all those steps if you would like to have +e.g. both ARM and x86 emulator binaries, just don't forget to do +'nmake /fmsvc.mak clobber' before new build. + +Note: MIPS platform is also available for build, but it may not compile or work properly. Use with caution! + +=============== +Testing STLport +=============== +When you successfuly build STLport libs, you should go to STLport/test/unit directory build and run the STLP test suite. +Use 'nmake /fmsvc.mak' and keep in mind that you still have to have proper system variables set! +Once test build has finished upload and run stlp_unit_test.exe to your emulator or device. +Wait for a while (aprox. 2mins) until all tests are done. +You should see two files next to your binary now. +Check stlp_test.txt for any errors. If all tests passed you are ready to deploy STLport. +If some test fails don't worry and check the STLport forum if it's already reported bug or you have found a new one. + +============= +Using STLport +============= +Setting up the IDE: +Before you start using STLport you have to set proper include and libraries search paths. +Go to 'Tools'>'Options' menu in your eVC 4.0 and then to 'Directories' tab. +For every platform you want to use STLport add STLport/stlport directory to the FIRST place in 'Include Files' +and STLport/lib directory in 'Library files' section. + +Setting up projects: +When using STLport together with MFC, you have to define _STLP_USE_MFC to properly include and use STLport. + +By default, exception support is not activated. You can detect this via _CPPUNWIND and activate this via /GX. +Without exception support, e.g. std::bad_alloc is not available, causing compile errors for some code. + +Also, there is only one runtime available but the IDE doesn't add the corresponding switch to the command line. +The right switch (selecting a dynamically linked runtime) is IMHO /MD or /MDd. This then also switches STLport to dynamic linking. +Alternatively, you can #define _DLL for your project, which achieves the same but, again IMHO, is a less clean solution. + +============ +Known issues +============ +- The compilers that come with eVC4 are almost bug-to-bug compatible with +the one from VC6, so most workarounds for that compiler apply here, too. + +- There is a bug in the MIPS compiler that comes with eVC4 which only surfaces +under certain conditions: + * in release mode with global optimizations on (#pragma optimize("g", on)) + * a baseclass has (at least) two pointer members + * a derived class adds no data members + * the derived class' cctor defers to the basclass' compiler-generated cctor + * it is passed as template parameter to a function +The smallest testcase I could come up with is this: + struct base { + void* ptr1; + void* ptr2; + }; + struct derived: public base { + derived() {} + derived(const derived& __x): base(__x) {} + }; + + template void function( SomeType st1, SomeType st2) {} + + struct test { + derived tmp; + ~test() { function(tmp, tmp); } + }; + test test; +..which causes an internal compiler error. Removing the base::ptr1, adding data +to derived, making function() a normal function, or turning off optimization +(#pragma optimize("g", off)) all causes the code to compile. This bug affects +iterators of deque and vector. + +- Because of interdependancy between STLport and native Standard library headers +STLport headers should always be included first in your translation unit (.cpp +file). That is to say that: + +//Wrong headers order: +#include +#include + +// Correct headers order +#include +#include + diff --git a/reactos/lib/3rdparty/stlport/doc/README.evc8 b/reactos/lib/3rdparty/stlport/doc/README.evc8 new file mode 100644 index 00000000000..fad3a38c696 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.evc8 @@ -0,0 +1,98 @@ +setup VC8 for CE: +------------------ + +- VC8 doesn't have any setup batchfiles that prepare the environment for compiling +with CE. You can take those from eVC4 and adapt them or write your own. This snippet +should get you going: + + rem you need to adapt at least these three + set OSVERSION=WCE500 + set PLATFORM=MY_OWN_PLATFORM + set TARGETCPU=MIPSII + + rem the compiler is always cl.exe, different compilers are in different paths + set CC=cl.exe + rem obviously, these need to be adjusted to where you installed VS2005 and the SDKs + set VSINSTALLDIR=C:\Programme\Microsoft Visual Studio 8 + set SDKROOT=C:\Programme\Windows CE Tools + + set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_mips;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH% + set PLATFORMROOT=%SDKROOT%\%OSVERSION%\%PLATFORM% + + rem add libs and includes from the SDK + set INCLUDE=%PLATFORMROOT%\include\%TARGETCPU%;%PLATFORMROOT%\MFC\include;%PLATFORMROOT%\ATL\include + set LIB=%PLATFORMROOT%\lib\%TARGETCPU%;%PLATFORMROOT%\MFC\lib\%TARGETCPU%;%PLATFORMROOT%\ATL\lib\%TARGETCPU% + + rem add libs that came with VC8 + rem Note: there are more libs and includes under ce\atlmfc, not sure if these are needed. + set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU% + + +- The snippet below can be used to build STLport for Pocket PC 2003 (using the + Pocket PC 2003 SDK shipped with Visual Studio 2005, this is the SDK used when + compiling programs from within the IDE): + + set OSVERSION=WCE420 + set PLATFORM=POCKET PC 2003 + set TARGETCPU=ARMV4 + + rem the compiler is always cl.exe, different compilers are in different paths + set CC=cl.exe + + rem obviously, these need to be adjusted to where you installed VS2005 + set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8 + set SDKROOT=%VSINSTALLDIR%\SmartDevices\SDK + + set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_arm;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH% + set PLATFORMROOT=%SDKROOT%\PocketPC2003 + + rem add libs and includes from the SDK + set INCLUDE=%PLATFORMROOT%\include + set LIB=%PLATFORMROOT%\lib\%TARGETCPU% + + rem add libs that came with VC8 + set INCLUDE=%INCLUDE%;%VSINSTALLDIR%\VC\ce\atlmfc\include + set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU%;%VSINSTALLDIR%\VC\ce\atlmfc\lib\%TARGETCPU% + + +You should now be able to run cl.exe for the target you expected. + +- The cross compilers of VC8 are the same version as for the native target, i.e. MSC14. + +- The cross compiler for MIPS has the same bug as mentioned in doc/README.evc4 and +the same workaround applies. However, using 'whole program optimization', it results +in an error in the link phase. + +- In order for STLport to recognize which target you are compiling for, you need to have +some macros defined, e.g. for the target architecture. The compilers do that partially on +their own, but not sufficiently. Therefore, STLport requires these defines: + + -- These are generally set for CE: + _UNICODE;UNICODE;_WIN32;WIN32;UNDER_CE;WINCE; + -- This one uses an environment variable to set the CE version: + _WIN32_WCE=$(CEVER); + -- These are used to help STLport recognise the target architecture: + $(ARCHFAM);$(_ARCHFAM_);$(INSTRUCTIONSET) + Note that the instructionset is not strictly needed for x86 but definitely for ARM. It + doesn't hurt for x86 though, so I'd always set these in any new project. + -- For release builds: + NDEBUG; + -- For debug builds: + DEBUG;_DEBUG; + -- For debug builds with additional STLport diagnostics: + DEBUG;_DEBUG;_STLP_DEBUG; + -- For MFC applications: + _AFXDLL; + +- Further settings: + Code generation: Multithreaded [Debug] DLL + Language: enable RTTI + Optimization: maximise speed and enable whole program optimization for release builds + +- Linker settings: + Ignore specific libraries: libc.lib;libcd.lib + Commandline: /SUBSYSTEM:WINDOWSCE + Optimisation: /LTCG for release builds + +- Resource compiler: + Define: UNDER_CE;WINCE;_WIN32_WCE=$(CEVER) diff --git a/reactos/lib/3rdparty/stlport/doc/README.evc9 b/reactos/lib/3rdparty/stlport/doc/README.evc9 new file mode 100644 index 00000000000..bb6dcc01e7d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.evc9 @@ -0,0 +1,95 @@ +setup VC9 for CE: +------------------ + +- VC9 doesn't have any setup batchfiles that prepare the environment for compiling +with CE. You can take those from eVC4 and adapt them or write your own. This snippet +should get you going: + + rem you need to adapt at least these three + set OSVERSION=WCE500 + set PLATFORM=MY_OWN_PLATFORM + set TARGETCPU=MIPSII + + rem the compiler is always cl.exe, different compilers are in different paths + set CC=cl.exe + rem obviously, these need to be adjusted to where you installed VS2008 and the SDKs + set VSINSTALLDIR=C:\Programme\Microsoft Visual Studio 9.0 + set SDKROOT=C:\Programme\Windows CE Tools + + set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_mips;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH% + set PLATFORMROOT=%SDKROOT%\%OSVERSION%\%PLATFORM% + + rem add libs and includes from the SDK + set INCLUDE=%PLATFORMROOT%\include\%TARGETCPU%;%PLATFORMROOT%\MFC\include;%PLATFORMROOT%\ATL\include + set LIB=%PLATFORMROOT%\lib\%TARGETCPU%;%PLATFORMROOT%\MFC\lib\%TARGETCPU%;%PLATFORMROOT%\ATL\lib\%TARGETCPU% + + rem add libs that came with VC9 + rem Note: there are more libs and includes under ce\atlmfc, you need to add these + rem instead of the ones in the SDK if you want to use the newer version of ATL/MFC. + set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU% + + +- The snippet below can be used to build STLport for Pocket PC 2003 (using the + Pocket PC 2003 SDK shipped with Visual Studio 2008, this is the SDK used when + compiling programs from within the IDE): + + set OSVERSION=WCE420 + set PLATFORM=POCKET PC 2003 + set TARGETCPU=ARMV4 + + rem the compiler is always cl.exe, different compilers are in different paths + set CC=cl.exe + + rem obviously, these need to be adjusted to where you installed VS2008 + set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0 + set SDKROOT=%VSINSTALLDIR%\SmartDevices\SDK + + set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_arm;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH% + set PLATFORMROOT=%SDKROOT%\PocketPC2003 + + rem add libs and includes from the SDK + set INCLUDE=%PLATFORMROOT%\include + set LIB=%PLATFORMROOT%\lib\%TARGETCPU% + + rem add libs that came with VC9 + set INCLUDE=%INCLUDE%;%VSINSTALLDIR%\VC\ce\atlmfc\include + set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU%;%VSINSTALLDIR%\VC\ce\atlmfc\lib\%TARGETCPU% + + +You should now be able to run cl.exe for the target you expected. + +- The cross compilers of VC9 are the same version as for the native target, i.e. MSC15. + +- In order for STLport to recognize which target you are compiling for, you need to have +some macros defined, e.g. for the target architecture. The compilers do that partially on +their own, but not sufficiently. Therefore, STLport requires these defines: + + -- These are generally set for CE: + _UNICODE;UNICODE;_WIN32;WIN32;UNDER_CE;WINCE; + -- This one uses an environment variable to set the CE version: + _WIN32_WCE=$(CEVER); + -- These are used to help STLport recognise the target architecture: + $(ARCHFAM);$(_ARCHFAM_);$(INSTRUCTIONSET) + Note that the instructionset is not strictly needed for x86 but definitely for ARM. It + doesn't hurt for x86 though, so I'd always set these in any new project. + -- For release builds: + NDEBUG; + -- For debug builds: + DEBUG;_DEBUG; + -- For debug builds with additional STLport diagnostics: + DEBUG;_DEBUG;_STLP_DEBUG; + -- For MFC applications: + _AFXDLL; + +- Further settings: + Code generation: Multithreaded [Debug] DLL + Language: enable RTTI + Optimization: maximise speed and enable whole program optimization for release builds + +- Linker settings: + Ignore specific libraries: libc.lib;libcd.lib + Commandline: /SUBSYSTEM:WINDOWSCE + Optimisation: /LTCG for release builds + +- Resource compiler: + Define: UNDER_CE;WINCE;_WIN32_WCE=$(CEVER) diff --git a/reactos/lib/3rdparty/stlport/doc/README.intel b/reactos/lib/3rdparty/stlport/doc/README.intel new file mode 100644 index 00000000000..a9d0c278f7c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.intel @@ -0,0 +1,19 @@ +Build of STLport with Intel C++ compiler for Windows is identical +to the one for Microsoft Visual Studio compiler (see README.msvc). + +Known issues: + +1. If you have bind your Intel C++ compiler to the Visual Studio 6 +install and build your application without the -Qvc6 option you might +experiement linking issue concerning 'std::unexpected' missing symbol. +The reason of this problem is that without -Qvc6, ICL adds necessary +code to invoke std::unexpected function when a raised exception is +different to the one specified in a function prototype. As VC6 library +do not contain this symbol ICL cannot find it anywhere. + + As a workaround, STLport has its own std::unexpected implementation +that you will find in src/dll_main.cpp. ICL is looking for a static +symbol so if you use STLport static lib ICL will use its std::unexpected +implementation but if you use STLport dynamic lib then ICL won't find +it. You only need then to copy/paste the STLport implementation somewhere +in your implementation and ICL will be happy. diff --git a/reactos/lib/3rdparty/stlport/doc/README.mingw b/reactos/lib/3rdparty/stlport/doc/README.mingw new file mode 100644 index 00000000000..6d72b0d4a9a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.mingw @@ -0,0 +1,55 @@ + The MinGW GNU make command can be used to build STLport with different +compilers + +- gcc (native compiler): + + Makefile : gcc.mak + + Notes: + + 1. Static library (archive) + + If you use the static version of the STLport libraries + you have to define the _STLP_USE_STATIC_LIB macro in order + to have your executable linked correctly. + + 2. Shell + + You will need MSys in order to build STLport. + + Be carefull about what make command you are using. STLport comes with a + GNU make build system design for unix like platforms, make files have not + been adapted for the Windows platform. So you have to use the make command + coming with the MinGW package 'mingw32-make' and not the one coming with MSys + that is a portage of the GNU make for Windows. + + 3. Threading configuration + + STLport libraries are built per default in order to be used in a + multithreaded environment. Under MinGW it means that we use the '-mthread' + compiler option. Don't forget to add it to your compiler command line too + if you want to use STLport libraries. You can also ask for not thread + safe libraries using the --no-thread configure script option. + + 4. Linking + + In this environment STLport is almost complete replacement for libstdc++. + It means that when you were linking with libstdc++ (-lstdc++) you only have + to replace it with STLport (-lstlport.5.2 for instance) and with libsupc++ + containing language compiler support (lsupc++). However default gcc + behavior is to automatically link libstdc++ and a number of other system libs. + To avoid this behavior you have to use the -nodefaultlibs compiler option and + explicitely give all libraries by yourself. See build of unit tests to see what + library you might need, here is the list when this note was written: + + -lstlportg.5.2 -lsupc++ -lgcc_s -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname + -lcoldname -lkernel32 + +- Borland C++ compiler: + + Makefile : bcc.mak + +- Digital Mars C++ compiler: + + Makefile : dmc.mak + diff --git a/reactos/lib/3rdparty/stlport/doc/README.msvc b/reactos/lib/3rdparty/stlport/doc/README.msvc new file mode 100644 index 00000000000..1cc80e1d1f6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.msvc @@ -0,0 +1,186 @@ + +================================================== +STLport README for Microsoft Visual C++ compilers. +================================================== + +by: Francois Dumont, dums@stlport.com, last edited 08/02/2005 + +============ +Introduction +============ +This document describes how STLport can be compiled and used with Microsoft +Visual C++ 6 SP5. It can also be used for the MSVC++ family. + +For any further comments or questsion visit STLport mailing lists +http://stlport.sourceforge.net/Maillists.shtml or forums +https://sourceforge.net/forum/?group_id=146814 + +============= +Prerequisites +============= +To build and use STLport you will need following tools and libraries: + - Microsoft Visual C++ 6.0 with at least Service Pack 5 or any higher + version. + +=================== +Configuring STLport +=================== +In a console window go to the STLport build/lib folder. Run + + configure --help + +This command will present you the different available build options. Just follow +the instructions to set STLport configuration according your needs. The only +mandatory configuration is to declare what is the compiler you are going to +use, for MSVC 6 it is: + + configure -c msvc6 + +================ +Building STLport +================ +This is a step by step description of the actions to take in order to have +the STLport library built: + +1. Open a console window. You can get it executing cmd or command depending +on your Windows OS. + +2. Go to MSVC++ Bin directory with a default MSVC6 install it is + cd "C:\Program Files\Microsoft Visual Studio\VC98\Bin" + +3. Run the vcvars32.bat script. This sets the environment variables required +to have the MSVC++ compiler run during the build process. The most important +one is the PATH variable so that you can call the cl.exe command which is the +MSVC++ command line compiler. [You may omit this step, if you chose 'Install paths +to access command-line tools' during Microsoft Visual Studio installation procedure.] + +4. Go to the STLport build/lib folder: + cd C:\STLport\build\lib + +5. Run the following command: + nmake /fmsvc.mak install + + nmake is the make utility from Microsoft. /f is an nmake option +telling it which make file script to use. You have of course to grant the +closer make file to your effective compiler, msvc.mak in our case. + + Once the command returns, you will have all the necessary libraries within +the STLport lib folder. For a description of the generated libraries check the README +file within the src folder. + +=============== +Testing STLport +=============== +You can use the unit tests to verify STLport behaves correctly. Change into +STLports 'build/test/unit' folder and type: + + nmake /fmsvc.mak install + +Once the unit test is built you just need to run it. They can be found +within the STLport bin folder. + +============= +Using STLport +============= +Adjust your include and link paths in MSVC IDE (in 'Tools -> Options -> Directories' +for MSVC6 IDE). In the include files add the path to STLport's 'stlport' folder. +Make sure it is the first directory listed there. Add STLport's 'lib' folder for +the library files (order of paths doesn't matter here). + +There are some preprocessor defines that control usage of the STLport in msvc +projects: + +If you don't want to use the iostreams part of the library, you can specify the +define _STLP_NO_IOSTREAMS. In this mode there is no need to link against the +library. + +STLport uses automatic linking to find the proper .lib file. If you want to see +what import library STLport is going to use, define _STLP_VERBOSE_AUTO_LINK. +When not using automatic linking (by specifying _STLP_DONT_USE_AUTO_LINK), you +have to specify the proper .lib file in the Project Settings, on the "link" tab. +The .lib names have the following syntax: + + stlport[d|stld][_x,_static,_statix]..lib + + d : debug build + stld: debug build with _STLP_DEBUG (STL safe) mode + _x: Build of STLport as a dll but statically link to the native runtime. + _static : build of a static library + _statix : build of a static library link dynamically to the native runtime. + +Examples: + + stlport_static.5.0.lib - static release version, Version 5.0.0 + stlportd.5.0.lib - dll debug version, Version 5.0.0 + +When using STLport together with MFC, be sure to include the MFC headers first, +then include STLport headers, e.g. in your Stdafx.h. This way STLport correctly +recognizes MFC usage. You also can define the macro _STLP_USE_MFC, either in +your project settings or in stlport/stl/config/user_config.h. + +In order to enhance debugging with STLport you can optionally add the content of +the etc/autoexp.dat file in the autoexp.dat file coming with your Visual Studio +install. + +Now you should be ready to use STLport. + +============ +Known issues +============ + +1. InterlockedIncrement + + If you experiment trouble with the InterlockedIncrement Win32 API function +like the following message: + +C:\Program Files\Microsoft SDK\Include\.\winbase.h(1392) : error C2733: second C +linkage of overloaded function 'InterlockedIncrement' not allowed +C:\Program Files\Microsoft SDK\Include\.\winbase.h(1390) : see declaration of +'InterlockedIncrement' + + It means that you are using the new Microsoft platform SDK. There is no +way to known it from STLport code so you have to signal it in the +stlport/stl/config/user_config.h file (uncomment _STLP_NEW_PLATFORM_SDK in this file). + +2. Native C/C++ library headers location + + If you experiment trouble with location of ctime and other Standard headers +while building or using STLport you might be using the compiler coming with a +platform SDK. If so please uncomment _STLP_USING_PLATFORM_SDK_COMPILER in +stlport/stl/config/user_config.h. If it still do not find native headers you will +perhaps need to change native headers relative path used by STLport. In this case use +_STLP_NATIVE_INCLUDE_PATH and associated macro in stlport/stl/config/host.h. + +4. C symbols in std namespace + +The compiler of MSVC++ 6 has a bug when dealing with symbols existant in both +the global namespace and symbols imported by a using-directive or a +using-declaration - it will report an ambiguous call to an overloaded +function (error C2668). Example: + +void function(); +namespace ns { + void function(); + // or: + // using ::function; +} + +using ns::function; +// or: +// using namespace ns; + +void call() { + function(); +} + +Since we anticipate that using-declarations or even using-directives are common +use, STLport by default doesn't import or wrap functions that exist in both the +global namespace and namespace std, in particular those are functions with C +origin like fopen() or abs(). Also, it defines additional overloads for +functions like abs() (overloaded for int, long, float, double, long double) in +the global namespace. + +In order to make STLport include them in the std namespace, you can define the +_STLP_DO_IMPORT_CSTD_FUNCTIONS macro. Doing so, you will have to explicitely +scope all your functions calls like std::abs() though - otherwise you only get +the global abs(int) from the C library. diff --git a/reactos/lib/3rdparty/stlport/doc/README.utf8 b/reactos/lib/3rdparty/stlport/doc/README.utf8 new file mode 100644 index 00000000000..8ae3e77bd4f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.utf8 @@ -0,0 +1,51 @@ + Here is a description of how you can use STLport to read/write utf8 files. +utf8 is a way of encoding wide characters. As so, management of encoding in +the C++ Standard library is handle by the codecvt locale facet which is part +of the ctype category. However utf8 only describe how encoding must be +performed, it cannot be used to classify characters so it is not enough info +to know how to generate the whole ctype category facets of a locale +instance. + +In C++ it means that the following code will throw an exception to +signal that creation failed: + +#include +// Will throw a std::runtime_error exception. +std::locale loc(".utf8"); + +For the same reason building a locale with the ctype facets based on +UTF8 is also wrong: + +// Will throw a std::runtime_error exception: +std::locale loc(locale::classic(), ".utf8", std::locale::ctype); + +The only solution to get a locale instance that will handle utf8 encoding +is to specifically signal that the codecvt facet should be based on utf8 +encoding: + +// Will succeed if there is necessary platform support. +locale loc(locale::classic(), new codecvt_byname(".utf8")); + + Once you have obtain a locale instance you can inject it in a file stream to +read/write utf8 files: + +std::fstream fstr("file.utf8"); +fstr.imbue(loc); + +You can also access the facet directly to perform utf8 encoding/decoding operations: + +typedef std::codecvt codecvt_t; +const codecvt_t& encoding = use_facet(loc); + +Notes: + +1. The dot ('.') is mandatory in front of utf8. This is a POSIX convention, locale +names have the following format: +language[_country[.encoding]] + +Ex: 'fr_FR' + 'french' + 'ru_RU.koi8r' + +2. utf8 encoding is only supported for the moment under Windows. The less common +utf7 encoding is also supported. diff --git a/reactos/lib/3rdparty/stlport/doc/README.wince b/reactos/lib/3rdparty/stlport/doc/README.wince new file mode 100644 index 00000000000..9feb5a9ed5d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.wince @@ -0,0 +1,94 @@ +Programming under MS Windows CE with STLport +============================================= + +This is supposed to give an overview for programming on MS Windows CE, with and +partially without STLport, what tools are available and what common pitfalls +exist. Note that for every supported compiler there is another readme file which +explains the specifics of that compiler. + + + +Available compilers: +--------------------- + +- Embedded Visual C++ 3 (eVC3): this IDE/compiler is for the CE3 target platforms. +The included compiler is MSC12, the same as for VC6, so many workarounds for its +'features' apply here, too. STLport works out of the box with this. + +- Embedded Visual C++ 4 (eVC4): basically the same as eVC3, but it can compile for +CE4.x and 5. Note that currently (2007-03-06) I haven't tested this with CE5, +because you can use a better compiler using VC8/VS2005. This compiler can be +downloaded for free from the MS website, including a product activation key. +STLport works out of the box with this. + +- Visual C++ 8 (VC8) aka Visual Studio 2005 (VS2005): with this version (and +partially already version 7) the embedded and desktop IDEs have been merged again, +so it supports compiling for MS Windows CE, versions 5 and later. Note that the +freely downloadable express edition does not(!) allow compiling for CE. This IDE +uses MSC14 as compiler. STLport works out of the box with CE5. + +- Platform Builders (PB): this tool is used to create a CE image. You can select the +modules (e.g. Explorer, but also C++ RTTI) you include in the image. These IDEs use +several different compilers (MSC12-14). STLport hasn't been tested with this +IDE, AFAIK. + +- There used to be an addon for VC6(?) that allowed compiling for CE. This plugin +has been superceeded by eVC3/4 and support for it has been removed from STLport in +version 5. + +- Others: some vendors (e.g. Intel) provide compilers that are able to generate +CE executables. I'm not aware of an attempt to compile STLport with them. + + + +Environment specialties: +------------------------- + +- In order to develop for a platform, the first thing you need is a so-called SDK. +This package includes headers and libraries that (more or less) resemble the APIs +available on the device. The IDEs come with a basic selection of SDKs, but in +general you need to retrieve an according SDK from the vendor. If you are the +vendor, you can generate an SDK for a platform with Platform Builder. + +- The provided API is typically a subset of the 'normal' win32 API. Often, some +features are simply not supported, like security descriptors when opening files. +Also, these APIs are only supported for wchar_t strings, e.g. only CreateFileW() +and not CreateFileA(). + +- CE doesn't have a current directory, hence no relative paths to that dir. You can +have relative parts in global paths though. + +- CE doesn't have environment variables, thus STLport can't support e.g. +setenv/getenv. It also doesn't attempt to provide workarounds. + +- Since many features are optional (see the description of Platform Builder), it +is possible that you don't have e.g. a console that std::cout could write to. The +same applies to exceptions (see e.g. the add-on lib for RTTI for eVC4). Other +features might go amiss, too. This makes it hard for STLport to adapt to, in +particular because this information is not available outside PB, a header might +declare a function that in fact is not present. Keep this in mind when you get +linker errors. + +- The supplied C++ standard library is extremely cut down, e.g. iostreams and +locales are missing completely. + +- The supplied standard C API is at best rudimentary. Functions like e.g. time() or +clock() are declared but not defined. STLport doesn't include any workarounds for +these missing functions at present. + +- All compilers are cross-compilers, i.e. you run them on a win32 host and they +produce executable code for the target platform. The same applies to the debugger, +which is connected via serial, USB or ethernet. Alternatively, there are emulators +that run on the host machine and simulate the target platform. + +- The entrypoint for executables is generally WinMain. Normally, you would have +switched to a normal main() using /SUBSYSTEM:CONSOLE on the linker commandline. +The linkers for at least CE4 and 5 don't understand this switch, they claim it +conflicts with CE targets. Instead, set the entrypoint directly to +mainACRTStartup. + +- The name of a DLL loaded via an import library can't be longer than 32 chars. If +this is not the case, the application will behave as if the DLL was not present or +couldn't be loaded for whatever other reason. This limitation applies to at least +CE 4 and 5. + diff --git a/reactos/lib/3rdparty/stlport/doc/README.windows b/reactos/lib/3rdparty/stlport/doc/README.windows new file mode 100644 index 00000000000..7389ff90ff7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/README.windows @@ -0,0 +1,55 @@ +Note for Windows users: + + It is highly recommended to declare the Windows OS version you are +targetting when building the library as well as when using it. You can do so +thanks to the well known Microsoft macros WINVER, _WIN32_WINDOWS or +_WIN32_WINNT, see your platform SDK documentation for a description +of those macros and how to use them. To define it when building the +library, use the configure script --extra-cxxflag option. Here is the +configuration to build STLport using Visual Studio 2005 and targetting +Windows XP: + +configure -c msvc8 --extra-cxxflag "/D_WIN32_WINNT=0x0501" + + If you do not declare it at build time STLport will adapt to the PSDK in +use, windows.h gives a default value to WINVER. However, when using the +library, windows.h is not necessarily included, at least not by STLport +internally, so none of the macros are defined which will result in an +inconsistency in the build process which most of time will generate undefined +behavior at runtime. + + Here is the main reason for following this advise, the Windows 95 +compatibility issue: + + Because of a modification in the behavior of the Win32 API functions +InterlockedIncrement and InterlockedDecrement after Windows 95, STLport +libraries built for Windows 95 cannot be used to generate an application +built for Windows XP for instance. So, if you build STLport with a Windows +95 PSDK, STLport will be ready for Windows 95. If you then use it without +defining _WIN32_WINDOWS to signal Windows 95 compatibility, STLport will +consider that it can use latest Windows OS features like the new +InterlockedIncrement and InterlockedDecrement functions which change the +memory footprint of some internal STLport objects making it incompatible +with the libraries built for Windows 95. + + Normally, doing so wouldn't generate any compilation or link error, you +would only experiment undefined behavior at runtime. In order to make this +problem more obvious STLport forces a link time error in debug mode (_DEBUG +macro defined). + +Unresolved symbol will be: + - 'building_for_at_least_windows98_but_library_built_for_windows95' + if you are trying to use STLport libraries built for Windows 98 or later + to generate an application targetting the Windows 95 platform. + - 'building_for_windows95_but_library_built_for_at_least_windows98' + if you are trying to use STLport libraries built for Windows 95 to generate + an appliation targetting the + + Windows XP platform for instance. + + Of course, targetting the latest Windows OS versions will give you the best +performance from STLport. This is why when none of the platform macros are +defined STLport consider that there is no minimum OS requirement and will +use the latest API functions. There is only one exception to this behavior, +the SwitchToThread function that is used only if you define _WIN32_WINNT to a +value higher or equal to 0X0400. diff --git a/reactos/lib/3rdparty/stlport/doc/build_system.txt b/reactos/lib/3rdparty/stlport/doc/build_system.txt new file mode 100644 index 00000000000..8d39b0dbe0c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/build_system.txt @@ -0,0 +1,82 @@ +The STLport build system +======================== + +This is a basic overview of the STLport build system. At the moment, I'm only familiar +with the working of the nmake variant, i.e. for MSVC, eVC and ICC/win32, other variants +may differ. + +Overview: +---------- + + +There are three basic classes to consider while building: +1. The used make tool (currently that is make (GNU make) an nmake (Microsoft)). +2. The used compiler +3. The target type, either application or library + +Other than that, there are three different settings corresponding to the three different +STLport modes, 'release', 'debug' and 'STLdebug' and each one has two modes for either +static or dynamic linking. + +The whole build system lies under the build/ dir of the source tree. There, it first +branches to Makefiles/ (which contains the base of the build system) and to lib/ (which +contains files to build the STLport library) and test/ (which contains files to build +tests) (TODO: what is the misc/ folder for?). + +Under Makefiles/, you see the initially mentioned branching according to the build tool. +Here is also where the configure.bat file puts the generated config.mak file. (TODO: +what are the other files in that folder?) + +nmake: +------- + +Under nmake/, you then find the common support files for the different compilers and +files that define generic rules. Here, it then splits into app/ and lib/, which are +structured similar to each other and to the common nmake/ dir. In each dir you have +files for the different compilers that are used to make application specific or library +specific settings. + +The branching in the three STLport modes and the static/dynamic linking is not visible +in the file structure but only in the used nmake variables. + +In order to make clear which file includes which other file, here an example when +compiling the STLport library for eVC4. The call issued is 'nmake /f evc4.mak' in the +build/lib folder. From there, the following include tree is created: + +build/lib/evc.mak + build/Makefiles/config.mak ; generated by configure.bat + build/Makefiles/nmake/top.mak + build/Makefiles/config.mak + build/Makefiles/nmake/sysid.mak + build/Makefiles/nmake/sys.mak + build/Makefiles/nmake/evc4.mak ; evc4 from config + build/Makefiles/nmake/evc-common.mak + build/Makefiles/nmake/targetdirs.mak + build/Makefiles/nmake/extern.mak + build/Makefiles/nmake/targets.mak + build/Makefiles/nmake/rules-o.mak + build/Makefiles/nmake/clean.mak + build/Makefiles/nmake/lib/top.mak ; would be app/top.mak when building an application + build/Makefiles/nmake/lib/macro.mak + build/Makefiles/nmake/lib/evc4.mak ; evc4 from config + build/Makefiles/nmake/lib/evc-common.mak + build/Makefiles/nmake/lib/rules-so.mak + build/Makefiles/nmake/lib/rules-a.mak + build/Makefiles/nmake/lib/rules-install-so.mak + build/Makefiles/nmake/lib/rules-install-a.mak + build/Makefiles/nmake/lib/clean.mak + +TODO: build/Makefiles/config.mak is included both by build/lib/evc.mak and by +build/Makefiles/nmake/top.mak. + +Known issues: +-------------- + +- nmake: MSC doesn't support generating dependency information for makefiles. So, unless +you modify the direct source file for an object file, no recompilation is triggered! You +need to either delete all object files that need to be recompiled or 'make clean' + +- There are targets to only install e.g. the shared STLdebug version but there is no +such thing for making clean. This would be useful in the context of above issue for +making a selective clean only. + diff --git a/reactos/lib/3rdparty/stlport/doc/pointer_specialization.txt b/reactos/lib/3rdparty/stlport/doc/pointer_specialization.txt new file mode 100644 index 00000000000..570c5060c50 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/pointer_specialization.txt @@ -0,0 +1,90 @@ +******************************************************************** +* This document describe the STLport container pointer * +* specialization feature. * +******************************************************************** + + What is it for: + + The major problem of template code is the potentialy huge binary + size that can result from the compilation. Each template type + instanciation is a new type from the compiler point of view even if + the generated binaries are identicals. To avoid this binary duplication + STLport grant the partial pointer specialization for 4 containers: + - vector + - deque + - list + - slist + + How does it work: + + The pointer specialization consists in using a void* container + instanciation for any container of pointers, including pointers + to cv qualified types. So the container pointer specializations + are only bridges that forward all the method calls to the + underlying void* container instanciation. The bridge job is to + cast the pointer type to and from the void* type. + + Why only those 4 containers: + + Some of you might wonder why none of the associative containers + or hash containers has been specialized. Lets take the set container + as an example. Its declaration is + + template , + class _Alloc = allocator<_Tp> > + class set; + + In a first thought you can imagine a partial specialization like + the following: + + template + class set<_Tp*, _Compare, _Alloc> + + What would be the underlying container for such a partial + specialization? The _Alloc type is supposed to have a rebind member + method so you can easily find the _VoidAlloc type. The _Compare type, + on the other hand, do not have this kind of Standard requirements. + So you need to wrap the _Compare type within a _WrapCompare type + that will take care of all the cast work. The underlying container + type will be: + + set, _VoidAlloc> + + The problem of such a type is that it is still dependent on the + original _Tp type for the _WrapCompare instanciation. So each set + instanciation will have a distinct underlying void* container and + we fall back on a binary duplication trouble. + + On a second thought a possible solution is to limit the partial + specialization like that: + + template + class set<_Tp*, less<_Tp*>, _Alloc> + + We only specialized the set container if the comparison functor + is the Standard less struct. The underlying container would be: + + set, _VoidAlloc> + + It looks fine but it is wrong. Actually a STL user is free to + specialized the less struct for any pointer type even the basic one. + In such a situation the client would think that the set is ordered + according its own functor but will finally have a set ordered according + the less functor. The less specialization issue also show that + the underlying cannot be a + + set, _VoidAlloc> + + but will have to be a + + set, _VoidAlloc> + + where __less would be equivalent to the standard less functor but + would not be specializable because unreachable from the client code. + + There is of course a solution for this specialization issue. We + need to be able to detect the less specialization. The partial set + specialization would have to be used only if the less functor is + the default STLport implementation based on the strict ordering operator. + No doubt that a solution to this problem will be soon found. diff --git a/reactos/lib/3rdparty/stlport/doc/stlport_namespaces.txt b/reactos/lib/3rdparty/stlport/doc/stlport_namespaces.txt new file mode 100644 index 00000000000..d243b035b2c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/doc/stlport_namespaces.txt @@ -0,0 +1,133 @@ +This document present the STLport namespace schema and give additionnal +information about how STLport replace the native C++ Standard library +coming with your compiler. + +1. What is the STLport namespace ? + + As STLport is a C++ Standard library implementation the STLport namespace +is 'std'. In normal use this is all you need to know and you can stop reading +here. + +2. How does STLport replace native C++ Standard library ? + + STLport defines a macro 'std' that replaces all references of std in the +user code by a different name. This technique has has some drawback but also +advantages. The drawback is that you cannot declared Standard component like +that: + + +//foo.h +namespace std +{ + template + class allocator; +} + +void f1(const std::allocator&); + + +//foo.cpp +#include "foo.h" +#include + +void f1(const std::allocator& alloc) +{ + //implementation +} + +//bar.cpp +#include "foo.h" +#include + +int main(int, char**) +{ + std::allocator alloc; + f1(alloc); +} + + If you build this code you will surely have a compilation error as f1 is declared +as taking a std::allocator parameter but you are calling it using an STLport allocator +instance that is not in the std namespace. The good news is that this drawback is easy +to detect as it will generate compilation error or at least link time error. The only +workaround is to include an arbitrary Standard header before the allocator declaration. +Good candidates for that are or as they are small headers. Including +those headers will replace std with the STLport namespace. + + The advantage of this macro replacement is that we can customize the STLport namespace +depending on the compilation options. For instance the STLport safe mode you can use by +defining _STLP_DEBUG is not binary compatible with a normal debug build. To ensure that +no one will ever build code without _STLP_DEBUG and link with STLport library built with +this option the namespace is different so that it will generate link time error rather +than random crashes during application execution. + +3. Why not having use namespace injection ? + + An other way to replace native Standard C++ library implementation would have been to +use namespace injection: + +namespace std +{ + using namespace stlport; +} + + This solution has a first major drawback which is that STLport would be much more sensible +to native headers. If you include a C++ native headers that indirectly define for instance +the vector class it is going to conflict with the STLport vector definition. + + Moreover this solution just does not work for a very simple reason. The C++ Standard +allows users to specialized some of the Standard algorithms. This specialization has to +be done in the same namespace as the main template declaration: + +//In an STLport header: +namespace stlport +{ + template + struct less + { + bool operator () (const _Tp& x, const _Tp& y) const; + }; +} + +//User code: + +struct MyStruct; + +namespace std +{ + template <> + struct less + { + }; +} + +As you can see the specialization is not in the STLport less namespace and it +won't be used in associative containers for instance. + +4. What is the STLport specific namespace ? + + The official STLport namespace is: stlport. Once again this is not the real namespace +where all the Standard stuff are. As the real STLport namespace change depending on compilation +options you cannot use it directly. So stlport is an alias of the real STLport namespace. + +5. What are the other STLport namespaces ? + + Those names are given for information purpose and should never be used in any user code. The +default STLport namespace is: stlp_std. Here is the list of the customized namespaces: + + - stlpd_std : when _STLP_DEBUG is defined + - stlpx_std : when you use STLport as a shared library linked to the static version of the native + runtime or when you build the static STLport library linked with the dynamic version. This option + is only supported by a limited number of compilers. + - stlpmtx_std : when building STLport as not thread safe. + + You can also have combination of those extension like stlpdxmtx_std or stlpdmtx_std... + + There is also an other STLport namespace for STLport internal functions or struct/class: priv. + +namespace stlport +{ + namespace priv + { + } +} + diff --git a/reactos/lib/3rdparty/stlport/etc/ChangeLog b/reactos/lib/3rdparty/stlport/etc/ChangeLog new file mode 100644 index 00000000000..09aa16d1fa3 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/ChangeLog @@ -0,0 +1,3088 @@ +2008-12-10 Petr Ovtchenkov + + * Repository: STLport release 5.2.1 + +2008-12-03 Petr Ovtchenkov + + * build: HP-UX/ia64 with aC++ compiler; verified on HP-UX 11.23 + and 11.31 with aC++ A.06.17; [4 of 436 tests, 4 ignored (2 explicit), + and 4 of 360 tests, 2 ignored]; submitted by Boris Gubenko. + +2008-11-27 Petr Ovtchenkov + + * build: EVC9 (Visual Studio 2008) by Johan Andersson. + +2008-11-19 Petr Ovtchenkov + + * Repository: STLport release 5.2.0 + +2008-08-26 Petr Ovtchenkov + + * Repository: branch for STLport 5.2, r3618 + +2008-07-21 Petr Ovtchenkov + + * stlport/type_traits: decay, conditional, ebable_if added. + +2008-07-18 Francois Dumont + + * configure.bat: Specifying the compiler is now mandatory and + must be first. + +2008-07-17 Francois Dumont + + * stlport/stdlib.h, cstdlib: Fix errno workaround for gcc MinGW. + Latest gcc version (4.3.0) includes stdlib.h in cstdlib using + include_next so skipping workaround in STLport stdlib.h. So errno.h + must also be included from cstdlib. + +2008-07-17 Petr Ovtchenkov + + src/details/fstream_unistd.cpp: fix bug #2001222, opening with + ios_base::app should rewind write pointer to the end of the file; + fix treatment of ios_base::ate (it should rewind pointer + to the end of the file once) and ios_base::app (offset will be set + to the end of the file prior to each write); references --- + http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2691.pdf + 27.8.1.4; http://www.opengroup.org/onlinepubs/7990989775/xsh/fopen.html; + http://www.opengroup.org/onlinepubs/7990989775/xsh/open.html + + test/unit/fstream_test.cpp: add sample with fopen as reference point. + +2008-07-14 Francois Dumont + + * build/Makefiles/gmake: Build system updated for gcc under Cygwin, + MinGW. Under Cygwin, with or without -mno-cygwin option, STLport + is now a full replacement for libstdc++, building an application + with it do not require -lsupc++ anymore as it is completely + integrated in STLport. Under MinGW it didn't work resulting in a + crash when starting an application using STLport so -lsupc++ is + necessary both when linking STLport _and_ when linking the + application using it. + +2008-07-10 Francois Dumont + + * src/num_put_float.cpp: Use an union based technique to find out + the sign of floating point values. It will maybe replace use of + platform specific functions in a future version. + + * src/stdio_streambuf.cpp, test/unit/iostream_test.cpp: Change + behavior of stdio_istreambuf implementation that now always return 0 on + showmanyc call. Returning -1 means that reading attempt will + necessarily fail which is not the case, 0 is prefered as it means that + we don't know. It is also similar to other std implementations like + libstdc++. + +2008-07-02 Francois Dumont + + * configure.bat: After a very interesting debate the consesus + is to put configure scripts in root folder. + + * stlport/stl/_string_sum_methods.h: Bug report #2003308, + compilation error with _STLP_USE_TEMPLATE_EXPRESSION. + Regression due to remove of POD type support in basic_string + implementation. + +2008-06-26 Francois Dumont + + * stlport/stl/_fstream.c: Consider read file failure in + _M_underflow_aux method to avoid infinite looping on some + platforms. Thanks Pawel Sikora. + +2008-06-26 Petr Ovtchenkov + + * build/Makefiles/gmake/unix/rules-install-so.mak: do + install-headers tags when make install or install-release-shared. + +2008-06-24 Francois Dumont + + * build/Makefiles/gmake: Cygwin/MinGW upgrade, now build + without referencing libstdc++. + + * stlport/stl/_threads.h: Move definition of __stl_atomic_t next + to definition of atomic operations to guaranty coherency. + +2008-06-18 Francois Dumont + + * build: configure.bat moved to build folder. lib/Makefile, + test/unit/Makefile removed from SVN, now generated by configure + scripts. Under GNU make use include rather than link to + reference the right make file, link seems not supported by + Cygwin/MinGW make. Remove default value of STLPORT_DIR, + already set in internal make files and moreover the absolute + path generated in the script leads to trouble under Cygwin/MinGW. + + * src/num_get_float.cpp: Use an union to generate double value + from 64 bits int to avoid gcc type-punned pointer warning. + +2008-06-16 Petr Ovtchenkov + + * build/test/unit/gcc.mak: pass runtime pathes as absolute; + removed LDSEARCH macro, use LDFLAGS instead; + + * Makefile: clean in test/unit too. + +2008-06-13 Francois Dumont + + * stlport/stl/_iterator_base.h: Add a funny feature, when + using both STLport and native STLs it was not possible + to use std iterators in STLport containers because of the + missing iterator category that is defined in std:: and + not in stlport::. So now STLport map std iterator categories + in stlport ones. Now it is possible to write something like + that: + std::string stdstr("std"); + stlport::string stlportstr("stlport and "); + stlportstr.append(stdstr.begin(), stdstr.end()); + However the other side is not supported except when STLport + iterators are simply pointers. + +2008-06-05 Francois Dumont + + * src/num_get_float.cpp: Remove useless skip of white + space at begining of buffer in _Stl_string_to_double function. + __read_float, the function that generate that buffer do not + put white space at the first place. + + * stlport/stl/_new.h, _range_errors.c: Remove unused + _STLP_RTTI_BUG macro. Moreover __stl_new was not correctly + implemented with this macro, there was no check for failed + allocation. + + * test/unit/limits_test.cpp: Remove code supposed to hide + numeric_limits::max value to MSVC 8 compiler, this code was + introducing a test regression. If it is producing a warning + a #pragma warning should be use to hide it. + + * test/unit/num_put_get_test.cpp: Add test showing problem + with code that used to be in limits test. Those tests will be + activated for 5.3 to check that there is really nothing wrong + with it. + +2008-06-07 Petr Ovtchenkov + + * configure: don't duplicate options in config.mak, that + has default values in makefiles. + +2008-06-06 Petr Ovtchenkov + + * configure: put it on common place for ./configure; + + * build/Makefiles/gmake/targetdirs.mak: use $(DESTDIR) + as in common practice (change root of installation, but + don't change run paths); + + * build: by default use make for gcc; + + * Makefile: top makefile for common project task; + + * build/Makefiles/gmake/depend.mak: fix options for ctags + and etags; + + * configure, build/Makefiles/gmake/top.mak: take into account + extra flags for linker. + +2008-06-05 Francois Dumont + + * stlport/stl/_function_adaptors.h: Fix instantiation of + unary_function and binary_function as base type of _Mem_fun0_ref, + _Mem_fun1_ref, _Const_mem_fun0_ref, _Const_mem_fun1_ref, + _Void_mem_fun0_ref, _Void_mem_fun1_ref, _Void_const_mem_fun0_ref, + _Void_const_mem_fun1_ref. Those classes are use as a workaround for + compiler missing class partial template specialization or that don't + support return of void. Instantiation is now done without reference + qualifier as specified by the Standard and as done in the + implementation used when workaround is not necessary. + +2008-06-03 Francois Dumont + + * src/ios.cpp, stlport/stl/_complex.c, _ios.c, _ios.h, _ios_base.h, + _istream.c, _num_get.c, _num_put.c: Remove invalid cached facet + pointers in ios_base class. This class can be used in a char or + wchar_t instantiation context making cast to ctype or + ctype invalid resulting in an application crashed. The + only safe access to facet instances from a ios_base instance is through + the use_facet(getloc()) function. Only _M_cached_ctype has been + kept in basic_ios class even if small bench hasn't show real + enhancement compared to using use_facet. + + * stlport/stl/_time_facets.c: In addition to above modifications + time_get implementation has been simplified as localized info are + now stored as wchar_t for wide char instantiation. We do not need + to use ctype.widen method anymore. + + * test/unit/time_facets_test.cpp: Add test for time_get wchar_t + instantiation. + + * test/unit/cppunit/cppunit_mini.h: Fix report of ignored/explicit + tests. + +2008-05-27 Francois Dumont + + * stlport/stl/_alloc.h: Code simplification, clean up null + pointer checks as allocators should never return it but rather + throw a bad_alloc exception. + +2008-05-27 Francois Dumont + + * test/unit/cppunit/cppunit_mini.h, file_reporter.h: Fix + counting of failed test, won't report more failures than tests + anymore. Now also report explicit tests. + +2008-05-15 Francois Dumont + + * src/allocators.cpp, locale_catalog.cpp, num_put_float.cpp: + Use static method returning static instance to mutex rather than + direct access to a static mutex instance to control initialization + order of static variables thanks Peter Hrenka report. + +2008-04-26 Francois Dumont + + * stlport/stl/_function.h, type_traits.h: Adoption of Defect Report 109 + Missing binders for non-const sequence elements. + + * test/unit/bind_test.cpp: Test for DR above. + +2008-05-11 Petr Ovtchenkov + + * stlport/stl/_string.c: from formal (ISO/IEC 14882:2003) point of view + string s; string::size_type p = s.find( "", 0, 0 ); should return 0 in p, + i.e. position out-of-bound of string; people near Standard commete has + opinion that Standard correct in this point and not require clarification + (opposite to my opinion); even if it looks like bogus behavior for me, + it fixed to conform standard; see bugreport #1872656; + + * test/unit/string_test.cpp: test for issue above. + +2008-05-10 Petr Ovtchenkov + + * stlport/stl/_istream.c, stlport/stl/_ostream.h: ISO/IEC 14882:2003 + (and 1998 too) assume change as get as put positions with + seekg and seekp (27.6.1.3, par 38; 27.6.2.4 par 2), but this + contradict to common practice and proposed draft N2588 + (27.6.1.3, par 41; 27.6.2.5, par 4); now STLport implement + (i.e. change present behavior) the draft's point of view; + this reflect patch #1650657 by Jan Echternach; + + * test/unit/sstream_test.cpp: test for issue above. + +2008-04-26 Francois Dumont + + * Patches #1940126, #1941267, #1941814 from Johan Andersson for evc8 + Pocket PC support and build of tests without warnings. + +2008-04-24 Francois Dumont + + * Patch 1937823 from Johan Andersson to add Microsoft Visual + Studio 2008 support. + + * stlport/stl/_algobase.h: Patch 1935497 from Andrey Semashev to + apply a common optimization in STLport algos for random access + iterators to fill and fill_n algos. + +2008-04-23 Petr Ovtchenkov + + * src/num_put.cpp: remove ambiguity of char to int conversion + (comparison with integers, check for negative value); remove + ambiguity with postfix increment in index in conditional + expression. + +2008-04-22 Petr Ovtchenkov + + * build/Makefiles/gmake/gcc.mak, build/lib/configure: take + into account CFLAGS, EXTRA_CFLAGS, because of C compiler in use too. + +2008-04-17 Francois Dumont + + * stlport/stl/_string.h: Remove support for non POD type in basic_string + implementation. + +2008-04-08 Petr Ovtchenkov + + * build/Makefiles/gmake/lib/gcc.mak: try to create $(PRE_OUTPUT_DIR) before + run lipo; impact only MacOS; + + * build/Makefiles/gmake/sysid.mak: uname -m on MacOS return + power-macintosh, but identify architechture as ppc. + +2008-03-28 Francois Dumont + + * stlport/assert.h: Bug #1894882: Apply a technique similar to the + one used in errno.h to detect when assert has been defined before + including assert.h. + +2008-03-21 Francois Dumont + + * Patch 1876529 from Johan Andersson to add support for VS 2005 + bundled Pocket PC 2003 SDK. + +2008-03-18 Petr Ovtchenkov + + * stlport/stl/_string.c: derived from patch #1914475, wrong + replace for selfreferencing string; thanks Farid Zaripov; + + * test/unit/string_test.cpp: test for problem above. + +2008-03-17 Francois Dumont + + * stlport/stl/_stdexcept_base.h, _stdexcept_base.c, + type_manips.h, src/num_put_float.cpp, + test/unit/num_put_get_test.cpp: Borland patch from Eric Sanford. + No need for a __Named_exception workaround anymore. Force + floating point control word when testing special floating point + operations. Change implementation _Copyable and add a workaround + to correctly render long double max value that is consider as + equal to double max value. + +2008-03-10 Francois Dumont + + * build/Makefiles: Normalization of --with-static-rtl and + --with-dynamic-rtl extended to configure script for Borland + and DMC compilers. + +2008-03-08 Francois Dumont + + * test/unit/cppunit/cppunit_mini.h: New mini cppunit framework + feature, the explicit tests that have to be explicitly tested + thanks to the -t option to run. + + * test/unit/unordered_test.cpp: benchmark1 and benchmark2 tests + are now explicit. + + * stlport/stl/_stdexcept_base.h, _stdexcept_base.c: + __Named_exception that contains dynamically allocated memory + require a copy constructor and assignment operator. Thanks bug + report #1908626 from Ilya Dogadaev. + + * build/Makefiles: Normalized some configure options: + --without-thread, --without-rtti, --with-lib-motif. + +2008-03-06 Francois Dumont + + * Fix rtti management: + - no rtti support do not imply no type_info struct definition. + - #error message in typeinfo to signal missing rtti support + has been removed. + - locale implementation do not use typeid anymore to enhance + runtime_error message thrown by combine message when we cannot + find the combined facet. It was introducing an annoying dependency + making use of the lib without rtti support impossible. + +2008-03-05 Francois Dumont + + * stlport/stl/_range_errors.h: Signal function responsible + for throwing excepions as not returning to the DMC compiler. + +2008-03-03 Francois Dumont + + * build/Makefiles/gmake: Eric Sanford patch to make generation + of debug symbols optional when using Borland compiler to build + unit tests. + + * stlport/stl/config: Normalization of verbose mode used to get + feedback about build context when using STLport. + _STLP_VERBOSE_AUTO_LINK has been renamed in _STLP_VERBOSE and + report additional information like rtti, exception support, + mono/multi threaded, static/dynamic library. + + * stlport/stl/_check_config.h: Unused, removed. + + * stlport/typeinfo: Report use of this header when there is no + RTTI support, only when we can detect it of course. + +2008-02-29 Francois Dumont + + * build/Makefiles/gmake: Several modif for Digital Mars support. + + * stlport/stl/_function_base.h: Hide protected constructor not + supported by Borland compiler. + + * stlport/stl/config/_bc.h: Now detect Rtti support. + +2008-02-28 Petr Ovtchenkov + + * build/Makefiles/gmake/gcc.mak: use more convenient option + -dumpversion to detect compiler's revision; check that + -fuse-cxa-atexit really required; remove -fident option; + + * build/Makefiles/gmake/targetdirs.mak: take into account DESTDIR; + + * build/lib/configure: write DESTDIR as prefix for installation pathes; + + * stlport/type_traits: type traits, close to JTC1/SC22/WG21 + C++ 0x working draft + [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2521.pdf] + +2008-02-26 Francois Dumont + + * Rationalization in detection of real localization implementation. + _STLP_REAL_LOCALE_IMPLEMENTED removed, the whole detection mecanism + is now in c_locale.h/c_locale.c and is based on API specific macros. + For the moment real localization is used for windows platforms + (_STLP_WIN32 except Windows CE) and when Glibc 2.2 or newer with + GNU extensions (_GNU_SOURCE) is detected. + +2008-02-25 Francois Dumont + + * stlport/stl/type_traits.h: Generalize technique used by Borland + compiler to detect pointer types const or volatile qualified and + avoid trivial copy in this case. + + * Eric Sanford patch for Borland compiler for Linux. + +2008-02-22 Francois Dumont + + * stlport/stl/c_locale.h, src/c_locale.h, + c_locale_win32/c_locale_win32.c, c_wlocale_win32.c: Major code + simplification. Definition of _Locale_UPPER, _Locale_LOWER, etc... + used to be platform dependant requiring a lot of macro checks and + additionnaly exposing STLport to wrong definitions. When for + instance _Locale_PRINT was defined as + _Locale_UPPER|_Locale_LOWER|..., marking a character as printable + was also making it a upper and lower character! + In fact those masks have to be platform specific only when + STLport directly expose platform masks which is only the case when + using GlibC. So now those mask are hard coded in STLport using + values defined in the C++ Standard 22.2.1. Under Windows the + localisation implementation has been adapted to map Win32 mask values + to the STLport ones. A number of now useless workaround has been + removed. + + * src/c_locale_dummy/c_locale_dummy.c, ctype.cpp, + test/unit/ctype_facets_test.cpp: Removed the hard coded table of + character types that was duplicating the one in src/ctype.cpp. Now + a table is build during library initialisation using C functions + isspace, isalpha... Doing so and adding a test in + LocaleTest::ctype_by_name will show if STLport and the C runtime + agree on character classification. + +2008-02-20 Francois Dumont + + * src/allocators.cpp: Change management of _S_heap_size, now bit + translation is done on the value used to increment it rather than + when using _S_heap_size. Thanks to this modif, when _S_heap_size is only a 32 + bits value it won't roll before 16Go has been allocated. Thanks to + an additional unsigned cast the effect won't be notice before 32 Go + are allocated. + +2008-02-19 Francois Dumont + + * src/c_locale_dummy/c_locale_dummy.c: Fix implementation of + _WLocale_toupper/_WLocale_tolower, call to respectively + towupper/towlower was inverted. + + * src/allocators.cpp: __stlp_chunk_malloc/__stlp_chunck_free + renamed respectively in __stlp_new_chunk/__stlp_delete_chunck as + those functions behavior are closer to the new operator behavior + rather than to malloc. __stlp_new_chunk implementation fixed, it + was using _STLP_CHECK_NULL_ALLOC reserved to check allocations + performed through new operator. Fix code to correctly take into account + bad_alloc exceptions. + +2008-02-18 Francois Dumont + + * stlport/stl/_algobase.h: Removed namespace specification on + swap invocation in iter_swap implemenation because it was breaking + template function resolution for gcc. Whether this is a gcc bug + or simply correct Standard C++ is not clear yet so namespace has + been removed independant of compiler in use. + + * stlport/stl/_alloc.h, _new.h, src/locale.cpp, locale_impl.cp: + Generalize use of _STLP_THROW_BAD_ALLOC macro to throw the + bad_alloc exception. Definition of this macro is now in _new.h + header. + + * stlport/stl/_valarray.h: Use __stl_new rather than malloc to get + exception management without additional code. It also gives users + a Standard way to detect memory starvation through the new handler. + +2008-02-16 Francois Dumont + + * Removed anachronous and unmaintained raw SGI allocator mode. + +2008-02-15 Francois Dumont + + * src/details/fstream_win32io.cpp: Fix wrong use of Win32 API. + SetFilePointer do not take SEEK_CUR macro but FILE_CURRENT. + + * src/allocators.cpp, stlport/stl/_alloc.h, _alloc_old.h, + _construct.h, _new.h, _pthread_alloc.h, _rope.h, config/_evc.h, + features.h: Code cleanup; __THROW_BAD_ALLOC normalized in + _STLP_THROW_BAD_ALLOC; _STLP_NEW, _STLP_PLACEMENT_NEW and + _STLP_BROKEN_BAD_ALLOC_CLASS macros removed. + +2008-02-14 Francois Dumont + + * src/c_locale_glibc/c_locale_glibc2.c: Manualy handle the "C" locale + to guaranty consistency with the default "C" facet implementations in + the lib. + + * * test/unit/time_facets_test.cpp, num_facets_test.cpp, + monetary_facets_test.cpp, ctype_facets_test.cpp: Enhance tests by using + a third way of generating locale instance from names. + +2008-02-13 Francois Dumont + + * src/fstream_impl.h, details/fstream_win32io.cpp, + fstream_unitstd.cpp, fstream_stdio.cpp, stdio_streambuf.cpp: __stdin_size + function revomed making fstream_impl.h useless. + +2008-02-12 Francois Dumont + + * stlport/stl/type_manips.h, type_traits.h: Borland patch from Eric + Sanford to fix regressions introduced with recent modifications of + some helper struct used to detect potential optimizations. + + * config/_bc.h, features.h: New configuration, Borland do not support + following syntax: + typename std::iterator_traits<>::value_type. It breaks on association + of typename keyword with namespace specification. As Borland do not + require typename keyword in this case it is now possible avoid it + thanks to the _STLP_NO_TYPENAME_BEFORE_NAMESPACE macro. + + * stlport/stl/_limits.c: Borland, like gcc 4, prefer additional brackets + in initialization of struct associated to computation of numeric limits + values. + +2008-02-01 Francois Dumont + + * General code review to look for Standard or internal functions + called with namespace scope in order to avoid ambiguous calls + when compiler implement Argument Dependant Lookup. See ListTest::adl + test case to see what it means. + + * stlport/stl/config/features.h: _STLP_PRIV now contains full + namespace path starting at global namespace that is to say + ::stlport::priv:: when private namespace is in use and ::stlport:: + when it is not. Idem for _STLP_TR1 that now contains ::stlport::tr1::. + + * stlport/stl/debug/_string.h: Call to std::distance removed to avoid + reading input iterators before reading their contents. Now all + basic_string::assign methods invalidate all iterators like other + containers. + + * stlport/stl/_iterator_base.h: Remove implementation of __value_type + __distance_type and __iterator_category when compiler support partial + template specialization. In this case we directly use iterator_traits, + we do not need those functions. Removed special __distance implementations + use in an anachronous implementation of distance taking an initial value + to start counting. Now this function use __distance functions already + used by the std::distance function. The MSVC _Distance function is also + considered as anachronous. + +2008-01-31 Francois Dumont + + * stlport/stl/_string.h, test/unit/string_test.cpp: Add swap + implementation when there is no support for template function + partial ordering. + +2008-01-30 Francois Dumont + + * src/fstream_impl.h, details/fstream_stdio.cpp, fstream_unistd.cpp, + fstream_win32io.cpp, stdio_streambuf.h, stdio_streambuf.cpp: Hide + __is_regular_file only used in fsteam implementation specific files. + Rename __file_size in __stdin_size as this function is only used + to get stdin FILE* size. Under Win32 this function now always returns + 0 as it looks like Windows do not consider FILE* as allowing + position operations. Move platform specific code from stdio_streambuf + implementation to associated fstream_*.cpp file. + +2008-01-29 Petr Ovtchenkov + + * build/test/unit/gcc.mak: option for run-time path to libstlport + on HP-UX; + + * build/Makefiles/gmake/hp-ux/targetsys.mak: HP-UX IA64 use so + as shared object extention, while PA-RISC use sl; + + * build/Makefiles/gmake/gcc.mak: use -fno-reorder-blocks for PA-RISC; + + * src/cxa.c: use cxa_atexit fix similar to trick on Solaris and FreeBSD; + + * src/num_get_float.cpp: stdint.h on HP-UX; + + * stlport/wctype.h, stlport/stl/_cwctype.h: HP-UX has problems with + wchars; changes suggested by KBac. + +2008-01-28 Francois Dumont + + * stlport/stl/config/_cygwin.h: Cygwin do not define _STLP_USE_GLIBC + anymore, platform API is closer to a Standard C lib than to the Gnu + lib C. + +2008-01-26 Francois Dumont + + * src/fstream_stdio.cpp, fstream_win32io.cpp, fstream_unistd.cpp: + Removed unused uint64.h include and definition of ULL macro. + + * src/uin64.h: Removed, _compound_int class defined in it is simply + not used anymore. + + * src/_stdio_file.h: Major cleanup, only _FILE_fd is still in use. + + * src/locale.cpp, locale_impl.cpp, build/lib/Makefile.inc: Restore + independency between those 2 translation units, code duplication is + very limited. This is a 1st step to make build of STLport easier by + having all sources in src folder buildable. + + * src/locale_impl.h, locale_impl.cpp: _copy_Locale_impl removed, + only use to create initial global locale that can simply reference + classic locale incrementing its reference counter by one. + + * stlport/stl/_locale.h: Fix locale implementation when MSVC6 workaround + is used. The base class _NoMem_loc do not have to have a virtual + destructor, it only need a protected one. Moreover fix constructor + taking an other locale instance and a facet instance, _M_impl was + not released before being assigned resulting in a memory leak. + + * src/fstream_stdio.cpp, fstream_unistd.cpp, fstream_win32io.cpp: + Moved to details sub-folder. Now building STLport means build all + .cpp, .c and optionnaly .rc files from src folder. + +2008-01-22 Petr Ovtchenkov + + * build/test/unit/gcc.mak: check confguration and set + ALL_TAGS before inclusion top.mak, to correctly set + targets for 'all'. + +2008-01-21 Francois Dumont + + * build/test/unit/icl.mak: Add /fp:strict option to build unit tests + as we need strict floating point number operations respect to have + numeric limits to work correctly. + + * stlport/stl/config/_intel.h: Looks like ICL since version 9 support + static constant correctly. + + * stlport/stl/config/features.h, src/c_locale_win32/c_locale_win32.c: + New macro _STLP_MARK_PARAMETER_AS_UNUSED to offer a compiler specific + way of marking parameters as unused. Default behavior is to cast the + parameter to void*. + + * src/c_locale_win32/c_wlocale_win32.c: Fix _WLocale_strxfrm function + implementation thanks Kai Khcyt. Despite taking a pointer to wchar_t* + LCMapStringW writes bytes to it. + + * build/Makefiles/gmake/bcc.mak, lib/bcc.mak, app/bcc.mak, stlport/cerrno, + errno.h, stl/type_manips.h, type_traits.h: Borland patch from Eric + Sanford to build Borland libs with GNU make build system. + +2008-01-18 Francois Dumont + + * test/unit/locale_test.cpp, ctype_facets_test.cpp, + money_facets_test.cpp, num_facets_test.cpp, time_facets_test.cpp: + test_supported_locale function do not have to be template, might + avoid ICL wring code generation. + + * stlport/stl/_function_base.h: Based on an idea from Herb Sutter in + his excellent book "Exceptional C++ Style", derived class destructor + should be protected non virtual or public virtual. unary_function + and binary_function struct are intended to be derived but they + are not polymorphic so destructor should be protected non virtual. + According the book it is even not breaking library Standard conformity + in doing so. What is sure is that it will help users detect bad + code. + +2008-01-17 Francois Dumont + + * stlport/stl/debug/_list.h: Remove use of std::distance in STL + safe mode, it is invalid for pure input iterators. Now assign + invalidate all iterators which make the code simpler. + + * Remove the difficult to implement and maintain _AreSameUnCVTypes, + doing so has a number of impact on the lib: + - Remove usage of it in debug/_string.h and debug/_deque.h, we + rather use function specialization to detect self reference. In string + implementation it is almost impossible to detect self referencing in + insert and assign method even with use of _AreSameUnCVTypes, so + we systematically creation an intermediate string instance. + - Creation of _AreCopyable helper class to detect when it is safe + to do a memcpy or memmove between 2 types. This class returns false + when any type is volatile qualified or when trying to copy to a const + qualified type. + - Creation of _AreSameTypes only really implemented thanks to partial + template specialization, only used in _IsOkToSwap struct. + + * test/unit/copy_test.cpp: Add test showing bug 1806558. + +2008-01-17 Petr Ovtchenkov + + * build/lib/configure: Don't override COMPILER_NAME, if already + defined; + + * stlport/stl/config/_prolog.h: remove suspicious comments. + +2008-01-15 Petr Ovtchenkov + + * stlport/stl/config/_hpux.h: define _POSIX_C_SOURCE 199506; + suggested by KBac, patch #1869229. + +2008-01-14 Francois Dumont + + * stlport/stl/_string.h, _string.c: Restore code to support non-POD + types in basic_string implementation as specified in basic_string + comments. + + * stlport/stl/_limits.c: Use double numeric limits for long double + when sizeof(double) == sizeof(long double). + + * stlport/stl/debug/_debug.h, _deque.h, _list.h, _vector.h: Prefer to + use overloading of member method to activate additional check of + 23.1.1 table 67 Standard conformity rather than using metaprogrammng + technique. + +2008-01-12 Petr Ovtchenkov + + * build/Makefiles/gmake/lib/gcc.mak: gcc 3.3 has useful + libsupc++, but some builds not; prefer normal situation, + not marginal; see record 2007-10-10; + + * build/Makefiles/gmake/gcc.mak: fix reference to _FORCE_CXX macro; + + * build/Makefiles/gmake/CC.mak: ditto; + + * build/Makefiles/gmake/aCC.mak: ditto; + + * build/lib/configure: keep compiler and default compiler --- gcc + is most common defualt and plans to switch to default makefile. + +2008-01-11 Francois Dumont + + * stlport/stl/_limits.c: Adapt long double numeric limits for + Intel C++ compiler 9 for Windows. + + * test/unit/cppunit/test_main.cpp: Add command usage output when + option is not recognise. + + * build/lib/configure: Remove specification of COMPILER_NAME default + value gcc. COMPILER_NAME is already set in all root make scripts like + gcc.mak, aCC.mak, dmc.mak ... Doing so forces users to specify their + compiler family using configure script which is redundant. + +2008-01-10 Francois Dumont + + * stlport/stl/_prolog.h: Remove code duplication by including + _cprolog.h. + + * stlport/errno.h, cerrno: Move import of errno from errno.h to + cerrno. + + * src/ctype.cpp, facets_byname.cpp, time_facets.cpp, + test/unit/codecvt_test.cpp: Several small modifications to make + Intel C++ compiler happier. Mostly avoid warnings and use + unary_function to avoid some typedef. + +2008-01-09 Francois Dumont + + * stlport/stl/_uninitialized.h: Fix implementation of + __uninitialized_copy_copy in order to make the function exception + safe. Detected thanks to the EH test suite. + +2008-01-08 Francois Dumont + + * stlport/stl/_ios_base.h: _S_was_synced renamed in _S_is_synced + because it reflects what the sync state is and not what it was. + + * src/iostream.cpp: Use auto_ptr to avoid use of the catch(...) + blocks. Changed management of the _STLP_REDIRECT_STDSTREAMS macro. + cout, cerr and clog streams are not ofstream anymore but classic + ostream instances, only streambuf is a filebuf when the macro is + defined. Improve _S_initialize robustness to exceptions, now + exceptions like bad_alloc are not silently eaten. _S_initialize + guaranty that on exception, Standard streams will be valid, it do + not offer however strong guaranty, global state might still have + been modified. Idem for sync_with_stdio. Moreover this method is + now Standard compliant, it returns the new sync state and not the + old one. + +2008-01-07 Francois Dumont + + * src/c_locale_dummy/c_locale_dummy.c: Upgrade to take into account + recent localization Api modifications. + +2008-01-04 Francois Dumont + + * src/fstream_win32.cpp: Change detection of regular file, only reject + handlers identified as folders. + + * stlport/stl/_codecvt.h: Add assertion to check buffer ranges pass to + the codecvt facet. + + * src/fstream.cpp, stlport/stl/_fstream.c: Complete bug #1854345 fix, + get buffer was not reset at the right place. + + * stlport/stl/_fstream.h, _fstream.c: Several modifications in the + seekoff method: + - Remove limitation of positioning to binary file stream, setting + position in a text file stream is not a problem. + - Fix mbstate_t instance returned in the file_pos instance when + getting position in a file stream with variable encoding. + - Move all the sanity check code to the debug mode. + +2008-01-02 Francois Dumont + + * test/unit/fstream_test.cpp: Change FstreamTest::seek test to reveal + bug #1854345. + + * src/fstream.cpp: #1854345 bug fixed. + +2008-01-01 Francois Dumont + + * stlport/stl/_time_facets.h, _time_facets.c, src/time_facet.cpp, + c_locale_glibc/c_locale_glibc2.c: Restore GlibC++ support after + 2007-12-27 modifications. + +2007-12-29 Francois Dumont + + * Borland patch from Eric Sanford mainly to enable move constructor. + + * stlport/stl/_string_base.h, _string.h, _string.c, + _string_sum_methods.h: Attempt to make string implementation more + clear: _M_allocated renamed in _M_start_of_storage, + _M_Buffers._M_dynamic_buffer renamed in _M_Buffers._M_end_of_storage, + _M_end_block renamed in _M_end_of_storage too. To respect current + naming convention _capacity has been renamed in _M_capacity and + _rest in _M_rest. + + * stlport/stl/_string_workaround.h: Updated to take into account recent + modification in string data model. + + * etc/autoexp.dat: Updated to take into account string data model + modifications, new model is really simpler to map to. + +2007-12-27 Francois Dumont + + * src/c_locale.h, c_locale_dummy/c_locale_dummy.c, + c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c, + c_locale_win32/c_locale_win32.c, facets_byname.cpp, time_facets.cpp, + stlport/stl/_codecvt.h, _ctype.h, _numpunct.h, _time_facets.c, + _time_facets.h: Major internal localization API modification. Add + several _WLocale_* functions to allow native support of access to + wide char representation of localization information. The time facet + support has been the most impacted. GlibC based implementation + still have to be updated. + +2007-12-23 Francois Dumont + + * build/Makefiles/nmake/evc8.mak, targets.mak, src/_stdio_file.h, + fstream_win32io.cpp, iostream.cpp, locale_catalog.cpp: Patch from + Johan Anderson for Evc 3/4/8 to: + - fix the opening console issue on this platform. + - add EVC8 SH4 support. + + * test/unit: Add CPPUNIT_FAIL macro to force failure without + using a constant conditional expression. Many tests updated to + use this new macro. + + * stlport/stl/config/_evc.h, debug/_debug.h, _debug.c: Patch + from Michael Fink to allow _STLP_DEBUG mode when using WCE ARM + platform. + +2007-12-20 Francois Dumont + + * stlport/stl/_monetary.c: Remove test of existing space at end of + stream when last pattern field is none because on ouput stream + space are only added optionaly. Small code duplication removed. + + * build/lib/configure.bat, evc.mak, msvc.mak, test/unit/evc.mak, + msvc.mak: Config file moved to Makefiles/nmake folder. Add + --without-stlport option to build unit tests without STLport. + + * test/unit/money_facets_test.cpp: Add validation that moneypunct + "C" facet is identical to the one contained in locale::classic(). + + * src/c_locale_dummy/c_locale_dummy.c, + c_locale_win32/c_locale_win32.c, facets_byname.cpp: Fix to have + moneypunct by name facet build from "C" similar to locale::classic() + one. Now default format in _Init_monetary_formats is the C++ default + one. + +2007-12-20 Petr Ovtchenkov + + * test/unit/fstream_test.cpp: test for seek, inspired by Soren + (stsoe, #1854345); report not confirmed. + +2007-12-17 Francois Dumont + + * stlport/stl/_limits.c: Add brackets on union initialization for gcc + starting with version 4. + +2007-12-17 Petr Ovtchenkov + + * stlport/stl/config/_linux.h: if not explicitly specified another, + use threads. + +2007-12-14 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Fix implementation of + _Locale_mbtowc and _Locale_wctomb functions. Reveal limitation of + the MultiByteToWideChar function that cannot be used to implement + more complicated encodings that have a real shift state like the + JIS one. Add support for UTF7 and UTF8 encodings. + + * test/unit/codecvt_test.cpp: New test case to check support for + 2 encodings, the Windows specific code page 936 and the UTF8 one. + Those tests are coming from chinese test samples proposed by Victor + Xie. + +2007-12-14 Petr Ovtchenkov + + * stlport/stl/_string_base.h, stlport/stl/_string.h, stlport/stl/_string.c: + experimental string buffer---start of buffer in _M_allocated._M_data now, + end of buffer either end of local short buffer, or stored in pointer + within local short buffer; this potentially reduce amount of pointer + arithmetic; prefer Traits::assign to uninitialized fill, it more + optimized for POD types, such as chars [experimental too]. + +2007-12-13 Francois Dumont + + * src/c_locale.h, c_locale_dummy/c_locale_dummy.c, + c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c, + c_locale_win32/c_locale_win32.c: Remove unused _Locale_wctob and + _Locale_btowc localization API functions. + +2007-12-13 Petr Ovtchenkov + + * build/test/unit/gcc.mak, test/unit/...: allow build unit tests + with libstdc++, without STLport; useful for reference and comparison. + +2007-12-12 Petr Ovtchenkov + + * build/Makefiles/gmake/unix/rules-install-so.mak, build/lib/gcc.mak: + install-headers usable; it use user-defined macro HEADERS_BASE + [catalog and all files, keeping directory structure] and HEADERS + [for single files]; target catalog is INSTALL_HDR_DIR, by default + it is ${BASE_INSTALL_DIR}/include. + +2007-12-07 Petr Ovtchenkov + + * stlport/stl/_uninitialized.h: comment unused parameter; + + * stlport/stl/_limits.c: 64-bits systems may has [and really has] + size of long double 16, not 12; but IEEE 854 still in force, and + only 10 bytes of long double taken into account. This should fix + limits on 64-bits systems. Thanks joebishop + [aka Denis Cheremisov] for granted access to 64-bit linux. + +2007-12-05 Francois Dumont + + * src/c_locale_glibc/c_locale_glibc2.c: Fix a one byte memory overrun + when passing a very locale name. + + * src/c_locale_win32/c_locale_win32.c: Simplified Win32 localization + code. Remove useless calls to strcpy. Remove useless call to the + __Extract_locale_name once in the _Locale_*_create functions as + name has already been extracted at this moment. + +2007-12-05 Francois Dumont + + * src/c_locale_glibc/c_locale_glibc2.c: Removed many checks useless + as the C functions are called in a well defined and safe context. Also + remove useless strcpy calls when it is safe to return the internal + string. + +2007-12-04 Francois Dumont + + * Add the _Locale_codecvt localization data structure for 2 purposes: + - in the win32 implementation it simplify _Locale_ctype data structure. + - in the glibc implementation it helps making clear that this + implementation do not support the codecvt facet for the moment. + +2007-12-03 Francois Dumont + + * src/fstream_win32io.cpp: Fix management of Ctrl-Z when reading + text file stream thanks Hector Chu patch. + +2007-11-30 Francois Dumont + + * src/acquire_release.h, facets_byname.cpp, locale.cpp, + locale_impl.cpp, locale_impl.h, messages.cpp, time_facets.cpp: + Localization code modification, now locale instances will adopt + a normalized name rather than the name used to create them. This + way identical locale instances will compare equals even if created + from name aliases like 'french' and 'fr_FR'. Moreover default + locale built from an empty string won't have an empty name. + + * test/unit/locale_test.cpp, ctype_facets_test.cpp, + money_facets_test.cpp, num_facets_test.cpp, time_facets_test.cpp: + Enhance localization tests, add test of default locale when possible. + Add test for the locale instances built from a mix of the + locale::classic instance and a named category. + +2007-11-27 Francois Dumont + + * stlport/stl/_ios_base.h, _ios.c: Add qualification on the cached + ctype and numpunct facets, we can keep them as const pointers. + Moreover, prefer to use the use_facet function rather than _M_get_facet + to access those instances to avoid direct reference to the facet::id + static instance. + + * Some evolution in the localization code: + - Hide _Locale_name_hint in internal implementation, facets *_byname + constructor are now respecting the C++ Standard signature. + - numpunct facet: Remove unused _M_grouping field, move hard coded + values of the "C" facet in the sources. Only the numpunct_byname + keeps internal wstring representation of true and false names. + - time facets: Use the non template time_base class for initialization + of the _Time_Info instance, it is more coherent with other facets + implementations. Many functions like __acquire_time and __release_time + are now hidden in the library. + +2007-11-26 Francois Dumont + + * stlport/stl/char_traits.h, _stdexcept_base.c: Borland patch + from Eric Sanford, add a missing header and change + __Named_exception implementation because of a Borland compiler + bug. + + * src/c_locale_win32/c_locale_win32.c: Add LANG_INVARIANT + definition when SDK are missing it. + +2007-11-24 Francois Dumont + + * stlport/stl/_monetary.h: Add missing explicit keyword on + money_get and money_put constructors. + + * stlport/stl/_numpunct.h: Removed friend relation between + numpunct and num_get, looks like it is useless with current + implementation. + + * stlport/stl/config/stl_mycomp.h, features.h, _watcom.h, _sunprocc.h, + _mwerks.h, _msvc.h, _ibm.h, _dec_vms.h, _dec.h, _as400.h: Removed + _STLP_NO_FRIEND_TEMPLATES, _STLP_FRIEND_TEMPLATES macros unused + since fix above regarding numpunct/num_get friend relation. + + * test/unit/collate_facets_test.cpp: Fix "C" facet by name test, + Standard do not define any special behavior for the "C" transform + method so transformed result should simply follow the normal transform + behavior. + + * src/locale_impl.cpp: Removed useless holes in locale facets table. + Now the table contains 26 non null entries rather than 38 entries with + some begin null. + +2007-11-23 Francois Dumont + + * src/locale.cpp, locale_impl.h, locale_impl.cpp: Some small + modifications to limit necessary friend class _Locale_impl + declaration in several facet classes. Moreover, num_get, num_put, + money_get, money_put facets that do not depend on any name are + not allocated anymore in the functions responsible for generating + facets for a given category. + + * stlport/stl/_codecvt.h, _collate.h, _ctype.h, _messages_facets.h, + _monetary.h, _num_get.h, _num_put.h, _numpunct.h, _time_facets.h: + Removed many useless friend class _Locale_impl declarations. + +2007-11-23 Petr Ovtchenkov + + * build/lib/configure: make configuration suitable for installation + procedure and package building. + +2007-11-22 Francois Dumont + + * src/c_locale_dummy/c_locale_dummy.c: Now implements the "C" locale + to respect the C++ Standard. + + * test/unit/collate_facets_test.cpp: Fix test checking that collate + facet build from the "C" name behave like the one coming from the + locale::classic() locale. + + * src/c_locale.h, locale.cpp, c_locale_glibc/c_locale_glibc.c, + c_locale_glic2.c, c_locale_win32/c_locale_win32.c, locale.cpp: Removed + _Locale_compose_name from the STLport internal localization API. + Composition of locale names will now be the responsibility of STLport + itself and not of the platform localization implementations one. + +2007-11-20 Francois Dumont + + * stlport/stl/_iterator_base.h, _ptrs_specialize.h: Avoid inclusion + of _ptrs_specialize.h while still in stlport namespace scope thanks + Christof Meerwald report. + +2007-11-17 Francois Dumont + + * _STLP_STATIC_MEMBER_DECLSPEC workaround removed. Thanks to + _GetFacetId other workaround it should now be useless. There + are still some tests to confirm especially testing the + gcc visibility feature. + +2007-11-16 Francois Dumont + + * stlport/stl/_fstream.c: Fix implementation of + basic_filebuf<_CharT, _Traits>::_M_underflow_aux() to take + into consideration already read external buffer even if + reading from file failed. Thanks Hector Chu report and patch. + + * test/unit/codecvt_test.cpp: New test for problem above, + CodecvtTest::imbue_while_reading thanks Hector Chu. + + * test/unit/fstream_test.cpp: Remove useless + FstreamTest::special_encoding test replaced by new test in + CodecvtTest. Fix FstreamTest::custom_facet test that is now using + a specialization of codecvt rather than a class inheriting from + codecvt. + +2007-11-14 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Fix to support creation + of locale facet from the 'C' name. + + * test/unit/collate_facets_test.cpp, locale_test.cpp, + money_facets_test.cpp, num_facets_test.cpp, time_facets_test.cpp: + Add test to check build from names "" or "C", on platform without + real localization support, "" should result in "C". Also check + for some facets that the one build from "C" name is similar to + the one taken from locale::classic() locale. + +2007-11-12 Petr Ovtchenkov + + * test/unit/fstream_test.cpp: testcase for bug #1830513; + __read_unbuffered wrongly process valid streamsize 0; + [was derived from original report of Anton Samokhvalov and Oleg Obolenskiy] + + * stlport/stl/_istream.c: fix for bug #1830513 above; + check boundary condition in the beginning of loop. + +2007-11-09 Francois Dumont + + * build/Makefiles/gmake: Add missing cygming folder comming + from task branch, required for Cygwin/MinGW builds. + + * stlport/stl/_bvector.h, _deque.h, _hashtable.h, _list.h, + _rope.h, _slist.h, _string_base.h, _tree.h, _vector.h: Removed + useless instantiation of _Alloc_traits to define nested + allocator_type in several containers. STLport users will simply + have to correctly instantiate containers when they specify + the allocator to use. + +2007-10-30 Francois Dumont + + * etc/autoexp.dat: New file containing description of STLport + data structures in the Visual Studio C++ debugger language. + +2007-10-21 Francois Dumont + + * Merged with STLPORT_5_1 up to revision 3229. + +2007-10-20 Francois Dumont + + * _STLP_NO_MBSTATE_T removed, STLport cannot really live without + any mbstate_t definition. Moreover we were already defining our own + definition when _STLP_NO_MBSTATE_T is defined, we now simply generalize + this behavior. So definition of _STLP_NO_MBSTATE_T has been replaced + with _STLP_NO_NATIVE_MBSTATE_T. + +2007-10-14 Francois Dumont + + * src/bitset.cpp: Add const qualifier on static arrays used in + bitset implementation. Thanks a Andrey Semachev remark. + +2007-10-12 Francois Dumont + + * stlport/stl/_hash_map.h, _hash_set.h, _unordered_set.h, + _unordered_map.h: Because of the hashtable data model, number + of bucket should not be to high compare to the number of + elements. For this reason, default constructor of all hash + containers is now passing 0 as the initial size rather than 100. + + * stlport/stl/_hashtable.h, _hashtable.c: For the same reason exposed + above, the hashtable number of buckets is decrease when removing + elements from the container. All is done in the newly introduce + _M_reduce method that should be called each time elements are + removed. + + * test/unit/unordered_test.cpp: Two new test in UnorderedTest test + fixture, benchmark1 and benchmark2. Those tests are rather, as indicated + by their name, bench to compare performance of hashed containers. + It can be used with the -m unit test console option that display + timing of tests. For instance, thanks to the reduction policy exposed + above, benchmark1 is running 20 times faster while benchmark2 is + almost identical. + + * stlport/stl/_hashtable.h: Container might now be rehash when user + modified max load factor in order to respect + load_factor() <= max_load_factor() rule. hashtable::resize fixed, + according SGI doc it should behave as Standard unordered_*::rehash that + is to say it gives number of buckets and not number of elements. + + * stlport/stl/_hashtable.c: Fix Code warrior workaround that was only + showing a limited number of prime numbers. + +2007-10-10 Petr Ovtchenkov + + * build/Makefiles: merge r2883:3223 from tasks/STLport-Makefiles; + revision of build system, from 'complement' project, adopted for + STLport requirements; support build of static lib and build unit + tests with this lib; gmake-specific files moved into gmake catalog; + top.mak (gmake-specific) moved into gmake catalog; add include + option for boost's headers, if STLP_BUILD_BOOST_PATH defined; + config.mak has make-dependent features, so it moved to gmake or + nmake catalog; settings from gmake/windows/sysid.mak should + be present in common gmake/sysid.mak file; gcc 3.3 has bad or + absent libsupc++, at least in debian; don't use -lstlport, when + build it; removed windows platform support that used to represent + the environment given by the cmd shell with MinGW additional commands + i.e. MinGW require not only gmake, but other POSIX file utils too; + install target by default install to /usr/local/lib on POSIX-like + platforms; added distclean target; added install-headers target; + + * build/test/unit: top.mak (gmake-specific) moved into gmake catalog; + + * build/test/unit/gcc.mak: see just build stlport libs, not + installation path [default install path is /usr/local/lib on POSIX-like + platforms]. + +2007-10-07 Francois Dumont + + * 5.1.4 released, trunk merged with STLPORT_5_1 branch up to + revision 3221. + +2007-10-04 Francois Dumont + + * stlport/stl/_codecvt.h, _fstream.c, src/codecvt.cpp: Fix non + Standard conformity in codecvt::length and associated + codecvt::do_length methods. Those methods was taking const reference + to mbstate_t but the Standard specify that it must be a simple + reference. + + * src/facets_byname.cpp: Add a real implementation of + codecvt::do_length based on the + _Locale_mbtowc locale API function. + + * test/unit/codecvt_test.cpp: Add a test for codecvt::length. + + * test/unit/fstream_test.cpp: Add a test that indirectly test + codecvt facet and integration of it in the basic_filebuf + implementation. + +2007-10-02 Francois Dumont + + * test/unit/deque_test.cpp, hash_test.cpp, list_test.cpp, map_test.cpp, + set_test.cpp, slist_test.cpp, unordered_test.cpp, vector_test.cpp: + Allow test on incomplete types even when pointer specialization is + activated as long as partial template specialization is supported. + + * stlport/stl/_fstream.c, src/facets_byname.cpp, + test/unit/codecvt_test.cpp: + Fixed codecvt_byname::do_in and do_out + methods. They now both correctly take into account to_end pointer. + Thanks Vistor (finalvistory) report on sourceforge Developer forum. + +2007-09-28 Francois Dumont + + * src/num_put_float.cpp: Modification in _Stl_ecvtR and _Stl_fcvtR + long double overloads, if value can be converted to double without + precision loss we can rely on the double overload. Moreover _Stl_fcvtR + has been fixed. + + * stlport/stl/pointer/_tools.h: Use class partial specialization to + enhance usability of the container pointer specialization feature. + Thanks to it, container can be instanciated with incomplete types. + Modification based on bug report 1799048 from Andrey Semashev. + + * trunk merged with STLPORT_5_1 up to revision 3211. + +2007-09-27 Francois Dumont + + * src: Modification in the internal localization API. + _Locale_errno removed, now an int pointer is passed to all + _Locale_*_create and all _Locale_extract_*_name functions so + that they can return an error code. This method avoid multithreaded + issues. + + * src/locale_catalog.cpp: Modification in __acquire_category + function. If create_obj return null, the null pointer is not + stored anymore in cached as creation failure reason might be + temporary like in case of memory starvation. + + * stlport/stl/_locale.h: Error reporting enhancement. In combine + method we use a typeid call to report the unknown facet type. In other + situation we report both the facet category being built and the name + used to build it. + + * test/unit/locale_test.cpp, collate_facets_test.cpp, + messages_facet_test.cpp, money_facets_test.cpp, num_facets_test.cpp, + time_facets_test.cpp: Add checks for construction of facets from + very long facet name. + +2007-09-27 Petr Ovtchenkov + + * test/unit/find_test.cpp: array initialization missed. + +2007-09-19 Francois Dumont + + * trunk merged with STLPORT_5_1 up to revision 3193. + +2007-09-11 Petr Ovtchenkov + + * stlport/stl/_algobase.c: keep check for symmetry in + lexicographical compare---algorithm assume symmetry comparator; + remove check for symmetrical comparator in search and find, + due to double checks not better then single (the same check + done in algorithm, and algorithm not require symmetrical + comparator); + + * stlport/stl/debug/_hashtable.h: idem; + + * stlport/stl/debug/_tree.h: idem; + + * stlport/stl/debug/_debug.h: __symetrical_strict_weak_call + and __symetrical_equal_call not used anyware. + +2007-09-10 Francois Dumont + + * stlport/stl/_algo.c: Add check for symetrical functor + in max_element and min_element algo. + + * stlport/stl/_algobase.c: Restore symetrical functor checks. + Sometimes simply because the algo was already considering the + functor as symetrical as in lexicographical_compare. Sometimes + using specific helpers functions (see below). + + * stlport/stl/debug/_debug.h: Add __symetrical_strict_weak_call + and __symetrical_equal_call helper functions to check for + symetric functors only when invocating the symetrical functor + is valid that is to say when both parameters are of the same + type. + + * stlport/stl/debug/_hashtable.h: Make use of + __symetrical_equal_call to check that equivalence functor used + in hashtable instanciation is correctly implemented. + + * stlport/stl/debug/_tree.h: Make use of + __symetrical_strict_weak_call to check that functor predicate + use in tree instanciation is correctly implemented. + +2007-09-10 Petr Ovtchenkov + + * stlport/stl/_string.c: fix bugs in string rfind, find_last_of, + find_last_not_of [bug #1788700, position 0 was wrongly excluded]; + + * test/unit/string_test.cpp: test for problems above. Thanks + to Bred Bored for bug report and initial test. + +2007-09-09 Petr Ovtchenkov + + * test/unit/rope_test.cpp, stlport/stl/_rope.h: test for + bug #1788615 [bug during copy of rope's iterator] and fix; + suggested by John Maddock. + +2007-09-07 Petr Ovtchenkov + + * test/unit/alg_test.cpp: add #include , required for + comparator symmetry test; + + * test/unit/string_test.cpp: test for bug in find_last_of, + bug #1788700, submitted by Bred Bored. + +2007-09-05 Petr Ovtchenkov + + * stlport/stl/_algobase.c: symmetry not required for + comparator in case of two different sequences comparison or + searching; symmetrical comparator just may not exist; + + * stlport/stl/debug/_hashtable.h: symmetry not required for + comparator in hashtable in case of containers extention; + symmetrical comparator just may not exist; + + * test/unit/alg_test.cpp: test for problem above, thanks + Oleg Obolenskiy. + +2007-09-03 Petr Ovtchenkov + + * src/dll_main.cpp, stlport/stl/debug/_debug.c: removed + macro _STLP_STATIC_TEMPLATE_DATA, __PUT_STATIC_DATA_MEMBERS_HERE, + _STLP_NO_STATIC_TEMPLATE_DATA; only few old compilers + require this and are good enough to work with STL; + + * test/eh/test_rope.cpp, stlport/stl/_num_get.c: idem; + + * stlport/stl/_time_facets.c, stlport/stl/_codecvt.h: idem; + + * stlport/stl/_monetary.c, stlport/stl/_num_put.c: idem; + + * stlport/stl/_rope.c, stlport/stl/_rope.h: idem; + + * stlport/stl/config/user_config.h: idem; + + * stlport/stl/config/stl_mycomp.h: idem; + + * stlport/stl/config/_gcc.h: idem; + + * stlport/stl/_threads.c: idem. + +2007-09-02 Francois Dumont + + * stlport/stl/_algobase.c: Small optimization, add an + intermediate __eq function to detect when both iterator types + are identicals. Thanks Jim Xochellis idear. + + * stlport/stl/_threads.h, _threads.c: Fully apply modification + of _S_nsec_sleep implementation for Win32 platforms contained + in bug report 1720635 from Taras Overchuck. It is an optimization + of the spin lock mutex specifically targetting the multiprocessor + platforms. + +2007-08-29 Francois Dumont + + * stlport/stl/_algobase.c, _string.c: Some modification in + __find_first_of_aux2 implementation to reduce number of iterator + dereferencements. + +2007-08-26 Francois Dumont + + * stlport/stl/config/user_config.h, host.h: Moved administrative + _STLP_USE_UNIX_IO, _STLP_USE_STDIO_IO, _STLP_USE_WIN32_IO + macros to host.h. + + * Merged with STLPORT_5_1 branch up to revision 3151. + +2007-08-23 Petr Ovtchenkov + + * stlport/stl/debug/_vector.h: only random access iterators + allow operations 'less-then' and distance; for bidirectional + iterators removed usage of 'less-then', and for others + [like forward and input iterators] removed as usage of 'less-then' + as distance; thanks Oleg Obolenskiy for bug report; + + * test/unit/ioiter_test.cpp: test for problem above. + +2007-08-18 Francois Dumont + + * stlport/stl/config/host.h: Removed _STLP_NO_CYGWIN macro + unused since we are using include_next. + +2007-08-16 Francois Dumont + + * stlport/stl/config/_gcc.h: Avoid conflict in link model, gcc + visibility for many platforms or dllimport/dllexport for + Cygwin/MinGW. + + * build/Makefiles/gmake/gcc.mak: Looks like Cygwin/MinGW won't + support visibility for the moment. + +2007-08-15 Petr Ovtchenkov + + * stlport/stl/char_traits.h, src/fstream_unistd.cpp: use 64-bits + file operations calls, if available on system; streamoff is + always off64_t, if _LARGEFILE_SOURCE or _LARGEFILE64_SOURCE + defined, i.e. if 64-bits file operations present; + + * src/fstream_stdio.cpp, src/stdio_streambuf.cpp: ditto; + + * stlport/stl/config/user_config.h: add _STLP_USE_DEFAULT_FILE_OFFSET, + force use off_t for streamoff and appropriate file operations calls; + note, that this may lead to problems, for example if _FILE_OFFSET_BITS + defined as 64 somewhere in user's code; + + * test/unit/fstream_test.cpp: test 64 bits type for filesize and + file offset. + +2007-08-13 Francois Dumont + + * test/unit/memory_test.cpp: MSVC6 do not support this test, + ignored. + + * stlport/stl/_string.h: Internal _String_reserve_t moved to + private namespace. + + * stlport/stl/_algobase.c, _string.c, char_traits.h: Adoption of + the find_first_of trick below in string::find_first_of, find_last_of, + find_first_not_of and find_last_not_of. + +2007-08-12 Francois Dumont + + * stlport/stl/_algo.h, _algobase.h, _algobase.c: find_first_of + algorithm enhancement based on the Jim Xochellis analysis that you + can find here: + http://www.codeproject.com/vcpp/stl/find_first_of.asp. + + * test/unit/alg_test.cpp: Add several tests to challenge the above + enhancement. + +2007-08-08 Francois Dumont + + * stlport/stl/config/feature.h: Removed useless workaround, there + is no more platform using Win32 threading API and missing bool + type. + + * src/num_put_float.cpp, num_get_float.cpp: Fixes for DMC, DMC has + real long double so it now uses ieee854_long_double Glibc type. DMC + do not use anymore the sprintf workaround to write floating point + numbers. + + * stlport/stl/_auto_ptr.h, test/unit/memory_test.cpp: Fix auto_ptr + implementation, removed a useless const_cast and change a reinterpret_cast + in static_cast. Add support for instanciation with the volatile qualifier. + Thanks Ulrich Eckhardt report. + +2007-08-03 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Fix some static buffer size + to always have a free place for the trailing zero. + + * test/unit/locale_test.cpp: Add a test when passing a very long name + as the LC_CTYPE facet name to the locale constructor. + + * src/system_api.h, system_api.c, build/lib/Makefile.inc, + src/num_put_float.cpp: Removed system_api workaround to access + isinfinite, isnan, isinf C functions used with gcc under Hp unix. + Now __format_nan_or_inf has an implementation entirely based on + numeric_limits values that avoids access to platform functions. + +2007-07-30 Francois Dumont + + * stlport/stl/_facets_fwd.h, _num_put.h, _num_get.h, _monetary.h, + _time_facets.h, _locale.h: Fix _GetFacetId workaround for compilers + like gcc since 3.4 that consider only the context at point on template + definition and not at the point of instantiation when resolving + _GetFacetId calls in has_facet or use_facets template functions. + +2007-07-20 Francois Dumont + + * stlport/stl/_mbstate_t.h: We have to define mbstate_t ourself + on platforms having mbstate_t in cwchar when we want to only use + C headers. + +2007-07-22 Petr Ovtchenkov + + * src/fstream_unistd.cpp: force use lseek64/mmap64 for HP-UX, + if _LARGEFILE64_SOURCE defined; thanks for Michael Klein. + +2007-07-20 Francois Dumont + + * stlport/stl/config/_gcc.h, stl_mycomp.h: Removed unused + _STLP_WEAK_ATTRIBUTE macro. + + * stlport/stl/config/_msvc.h, _intel.h, _gcc.h, features.h: Some + cleanup concerning _STLP_STATIC_TEMPLATE_DATA macro. + +2007-07-18 Francois Dumont + + * stlport/stl/_num_put.h: Removed __string_to_float declarations only + used in a num_get context. + + * src/num_get_float.cpp: + - Import Glibc ieee854_long_double union for compilers having a real + long double type but no runtime support to correctly generate it. This + union is used by gcc under Cygwin and MinGW and by Borland compiler. + - _Stl_string_to_long_double removed, it was so similar to + _Stl_string_to_double that everything is done with this function now. + - Removed check on exponent value while parsing it from buffer, check is + only done when combining this value with the digits read. + + * src/num_get_float.cpp: + - Generalize synchronization code arround the ecvt/fcvt functions when + the platform do not grant reentrant functions. + - In __format_float_scientific, removed useless rz temporary variable, removed + limitation in the number of appended trailing zeros. + - In __format_float_fixed, removed limitation of number of trailing zeros + added after decimal point, it is only limited by precision. + - __format_float: Code to detect infinity or NaN has been moved before call + to platform specific ecvt/fcvt functions. Thanks to this modification, this + function is not template anymore. + - Add _Stl_ecvt/_Stl_fcvt emulation functions when platform do not grant + the necessary ecvt/fcvt functions for long double. Emulation is based on + sprintf function using 'L' modifier. + - In __write_floatT function, fix size of static buffer used by _Stl_ecvt/fcvt + functions. Fix number of digits in calls to _Stl_fcvt/ecvt in both modes, + fixed or scientific. + + * test/unit/num_put_get_test.cpp: Add some tests, somes with a really high + precision that show problem with static buffer size. + +2007-07-17 Petr Ovtchenkov + + * stlport/stl/_algo.c, stlport/stl/_algobase.c: search, the __tmp and + __p1 iterators always point at the same position, hence one of them + is redundant; + + * stlport/stl/_algobase.c: in the main-loop of search there are two + successive while-loops doing exactly the same thing; one of them is + redundant and, since it is inside the main-loop, it slows down + the algorithm significantly; + + * stlport/stl/_algo.c, stlport/stl/_algobase.c: in the search the main-loop + condition "while (__first1 != __last1)" is always true and consequently + redundant; this is because the initial adn in-loop conditions virtually + act as guards and will never let the main-loop condition to fail; since + this condition is evaluated in every main-loop iteration, its removal + will also improve the performance of the algorithm; thanks for + Jim Xochellis for this suggestions. + +2007-07-15 Petr Ovtchenkov + + * src/strstream.cpp: "get end" pointer should be initialized + to the "begin of get + N" in obsolete strstream; bug #1536503, + thanks for Jean-Eric Cuendet; + + * test/unit/strstream_buffer_read_test.cpp, build/test/unit/Makefile.inc: + test for bug above; [submitted by Jean-Eric Cuendet]. + +2007-07-05 Francois Dumont + + * build/Makefiles/nmake/vc8.mak: Removed _CRT_SECURE_NO_DEPRECATE + when building STLport. Not secured version of functions _ecvt and + _fcvt functions used for floating point numbers output are not + reentrant. + +2007-07-04 Petr Ovtchenkov + + * src/num_get_float.cpp: reorder code, one condition go away. + +2007-07-03 Francois Dumont + + * src/num_put_float.cpp: _Stl_ecvtR, _Stl_fcvtR, _Stl_qecvtR, + _Stl_qfcvtR functions, pass buffer size as a parameter when the + platform functions need it rather than duplicating the size + definition. This modification has been applied to the DECC platforms + and when the GLibC is in use. + Removed useless islong __format_float_scientific parameter. Removed + useless x __format_float_fixed parameter, islong parameter + replaced with direct specification of the maxfsig value. + In __format_float function, first attempt in detection of NaN or + infinity is done thanks to the std::numeric_limits and compiler + support, _Stl_is_nan_or_inf do not correctly handled long double + values. long double values larger than max double values were always + displayed as Inf. + + * src/num_get_float.cpp: Removed useless null buffer checks in + _Stl_atod functions, we know how this function is called. Replaced + some hard coded constant with numeric_limits values. Add check that + there is less than 64 digits before hiding hidden bits in vv.i64, for + long double it was generating wrong long double value. + + * test/unit/num_put_get_test.cpp: Add numerous tests to check both + long double input and output. + +2007-06-29 Petr Ovtchenkov + + * stlport/memory: more forward declarations; fix typo; + + * stlport/functional: more tricks to compile with boost + and tr1; + + * test/unit/boost_check.cpp: problems trace; set 1 in + appropriate places to check presence of problem, but only + use one case at a time. + +2007-06-28 Francois Dumont + + * src/locale.cpp, locale_impl.h, stlport/stl/_locale.h, + config/features.h: Runtime check system do not fully use the + MSVC6 workaround anymore, it only use the locale workaround, + not the basic_string one. + + * src/string.cpp: Fix wrong explicit instanciation. + + * test/unit/cppunit/cppunit_mini.h, file_reporter.h: Fix + computation of test failure when both CPPUNIT_CHECK and + CPPUNIT_ASSERT are used. + +2007-06-28 Petr Ovtchenkov + + * stlport/stl/boost_type_traits.h: reread boost/config.h + to force usage of stlport in boost and force read essential + macros from boost/config/suffix.hpp; this is because boost + included within stlport from one side, and stlport included + within boost from another side; this make sense with + _STLP_USE_BOOST_SUPPORT defined in user_config.h; + checked for boost 1.34; + + * test/unit/boost_check.cpp, build/test/unit/Makefile.inc: + test for problem above; this simulate problem when boost's + header was included before any stlport's one; + + * stlport/stl/config/features.h: remove definition of + BOOST_STDLIB_CONFIG, due to it unconditionally defined + in boost. + + * stlport/memory: forward declarations for boost required, + by the same reasons as described above. + +2007-06-24 Petr Ovtchenkov + + * stlport/stl/_function.h, stlport/functional: fix import + of boost::shared_ptr---moved from _function.h to functional; + import mem_fn, bind, bad_function_call, function, swap from + boost to std::tr1. + +2007-06-23 Francois Dumont + + * stlport/stl/_string.h, _string_workaround.h: Some fix for gcc + that is now expose to the VC6 workaround because of the runtime + check mechanism under MinGW. + +2007-06-21 Francois Dumont + + * test/unit/cstring_test.cpp, limits_test.cpp: Small modif to avoid + MSVC compiler warning in release build. + + * stlport/stl/_cwchar.h: Replace a _STLP_MSVC check with a _STLP_MSVC_LIB + check as WCHAR_MIN and WCHAR_MAX macros definition depends on library + and not on compiler. + +2007-06-20 Petr Ovtchenkov + + * stlport/memory: import shared_ptr from boost to std::tr1 namespace, + if no _STLP_NO_EXTENSIONS and present _STLP_USE_BOOST_SUPPORT; + see ISO/IEC DTR 19768, + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf + + * test/unit/shared_ptr_test.cpp: test for shared_ptr. + +2007-06-19 Francois Dumont + + * stlport/stl/debug/_debug.h, _debug.c: Replace __in_range with + stlp_in_range, __in_range is a macro in the Windows Vista PSDK. + + * src/locale.cpp, stlport_prefix.h, warning_disable.h, + stlport/stl/_locale.h, _string.h, config/features.h: Fix some + regression introduce with the improvment of the runtime compatibility + check mecanism. + + * src/c_locale_glibc/c_locale_glibc2.c: Fix implementation of + _Locale_strcmp and _Locale_strwcmp functions. + + * stlport/stl/_limits.c: Change technique used to generate NaN or + infinity floating point numbers. No more reinterpret_cast of a buffer, + we now use an union based technique. gcc prefer this cleaner method + especially in release mode. + + * test/unit/limits_test.cpp: Small test modification as gcc was still + performing some weird optimization in release mode resulting in + unexpected behavior. + +2007-06-19 Petr Ovtchenkov + + * stlport/stl/_function.h: import reference_wrapper from boost to + std::tr1 namespace, if no _STLP_NO_EXTENSIONS and present + _STLP_USE_BOOST_SUPPORT; see ISO/IEC DTR 19768, + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf + + * test/unit/reference_wrapper_test.cpp: test for reference_wrapper. + +2007-06-15 Petr Ovtchenkov + + * build/test/unit/Makefile.inc: macro_checks.cpp instead of cwchar.cpp. + +2007-06-14 Francois Dumont + + * src/dll_main.cpp, locale.cpp, locale_impl.h, locale_impl.cpp, + stlport/stl/_locale.h, _rope.h, config/_windows.h, features.h: + Enhance the runtime compatibility mecanism used to detect build + inconsistency under Windows. We now use the locale class with the + VC6 workaround coming with it to force a call to the compatibility + check function. Inconsistency detection is activated if _DEBUG + or _STLP_DEBUG is defined. If an inconsistency is detected it is + reported by the linker thanks to an unresolved symbol + building_for_up_to_windows95_but_library_built_for_at_least_windows98 + or + building_for_at_least_windows98_but_library_built_for_up_to_windows95 + that are self describing. + + * test/unit/cwchar.cpp: Renamed in macro_checks.cpp, add many tests for + all C Standard macros like CHAR_MIN, CHAR_MAX, INT_MIN, INT_MAX... + + * stlport/stl/_cwchar.h: Add MSVC compilers before Visual Studio 2005 + as not defining WCHAR_MAX correctly. + +2007-06-11 Francois Dumont + + * src/lock_free_list.h: Fix check of _WIN32_WINNT rather than _WIN32_WINDOWS. + + * stlport/stl/_threads.c: In the Win32 implementation, add a call to + the SwitchToThread function to potentially avoid a costly call to + Sleep(1) that can take more time than expected. If SwitchToThread fail + we call Sleep(1) again. Based on Taras Overchuk bug report 1720635. + +2007-06-11 Petr Ovtchenkov + + * src/fstream.cpp: integration file; code clean, three implementations + sublimated, unix-emulation approach removed; this is reorganization + changeset, functionality was not changed; + + * src/fstream_win32io.cpp: win32io-based implementation of _Filebuf_base, + i.e. based on Windows calls CreateFile/CloseHandle/ReadFile/WriteFile + + CreateFileMapping, MapViewOfFile; + + * src/fstream_unistd.cpp: unistdio-based implementation of _Filebuf_base, + based on unistd open/close/read/write + mmap; + + * src/fstream_stdio.cpp: stdio-based implementation of _Filebuf_base, + based on stdio fopen/flose/fread/fwrite; + + * stlport/stl/_fstream.h: detect of _Filebuf_base implementation moved + into stlport/stl/config files; + + * stlport/stl/config/*.h: iostreams underline technique depends upon + OE or user's preferences; + + * stlport/stl/config/features.h: some system-specific macro moved to + system- or compiler-specific files; + + * stlport/stl/_rope.h: rewritten suspicion code, functionality not changed. + +2007-06-08 Francois Dumont + + * stlport/stl/_complex.h: Clean unused _STLP_NO_COMPLEX_SPECIALIZATIONS + macro and code coming with it. + + * build/lib/configure, configure.bat: Removed --windows95 option, it is + useless now that STLport includes windows.h when building the libraries. + + * build/Makefiles/gmake/bcc.mak, dmc.mak, gcc.mak, nmake/vc-common.mak: + Removed references to Windows 95 build, if STLport users want to target + a specific Windows OS they will only have to use --extra-cxxflags to + give WINVER, _WIN32_WINDOWS or _WIN32_WINNT values. + +2007-06-05 Francois Dumont + + * stlport/stl/config/features.h: Removed unused _STLP_LDOUBLE_* macros giving + real long double size. + + * stlport/stl/_limits.h, _limits.c: Major code upgrade, now computation + of infinity and NaN is done thanks to some code extracted from the boost + library (www.boost.org). This code is more portable as it adapts to compiler + representation of float, double and long double and do not require many + compiler macro checks. Additionaly STLport numeric_limits now handle real + denorm_min values. + + * test/unit/limit_test.cpp: Add many test on dernomalized float and + some other values of numeric_limits. + + * stlport/stl/config/_cray.h, _gcc.h, _msvc.h, stl_mycomp.h: Removed + _STLP_NO_IEC559_SUPPORT macro, meaning was not clear and impact was + localized to the _limits.h file so use of a global macro was rather + useless. + +2007-05-29 Francois Dumont + + * stlport/stl/_num_get_.c: Small refactoring, all num_get::do_get for + float, double and long double are now calling the same __do_get_float + function. Moreover, when __read_float failed, __sring_to_float is not + called anymore. + +2007-05-28 Francois Dumont + + * test/unit/limits_test.cpp: Add test checking that numeric_limits + min is really min and max really max. + + * src/allocators.cpp, locales.cpp, stlport/stl/_threads.h, + config/_windows.h: Fix detection of Windows OS having limited + implementation of Interlocked[Increment,Decrement] Win32 API + functions. _STLP_WIN95 macro has been rename _STLP_WIN95_LIKE + as it do not only signal Windows 95 build context but also former + OS versions. + +2007-05-22 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: gcc MinGW has no thread + locale storage intrisinc support so for this compiler, locale + creation failure will always be reported with runtime_error + exception. + + * stlport/stl/config/_msvc.h: Configuration fix, check that _STLP_MSVC + is defined before activating MSVC6 workaround + (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro). + +2007-05-21 Francois Dumont + + * src/c_locale.h, locale.cpp, locale_impl.cpp, + c_locale_dummy/c_locale_dummy.c, c_locale_win32/c_locale_win32.c, + c_locale_glic/c_locale_glibc.c, c_locale_glibc2.c: Add a _Locale_errno + function to the small localization framework in order to report more + accurate locale creation failure. For the moment there are 3 possible + failure reasons, no more memory, unsupported locale, no platform support. + In case of memory starvation, we throw a bad_alloc exception. + +2007-05-19 Francois Dumont + + * stlport/stl/_valarray.h, _valarray.c: Add many assertion checks to + track potential undefined behaviors mostly regarding invalid argument + size. + +2007-05-17 Francois Dumont + + * stlport/stl/_prolog.h: Hide _debug.h when including C standard + headers. Some platforms (Win32) include C headers in an 'extern "C"' + scope that do not accept templates exposed in _debug.h. + +2007-05-16 Francois Dumont + + * stlport/stl/config/_auto_link.h, build/Makefiles/gmake/cygming/lib.mak, + build/Makefiles/nmake/lib/macro.mak: Removed version information + from static libs name for consistency among all supported compilers/ + platform. + +2007-05-15 Francois Dumont + + * stlport/stl/_range_errors.c, _stdexcept_base.c: New files + containing codes that used to be duplicated in dll_main.cpp. + + * src/dll_main.cpp: Include _range_errors.c and _stdexcept_base.c + when necessary. + + * stlport/stl/_stdexcept_base.h, _stdexcept_base.c: __Names_exception + do not truncate anymore exception message when longer than internal + static buffer, a dynamic buffer is allocated through malloc in this + case. I haven't use __iostring class in this case as it would + have introduce a cyclic dependency between classes. + +2007-05-11 Francois Dumont + + * src/c_locale.h, c_locale_glibc/c_locale_glibc2.c: Some fixes to + avoid gcc warnings when compiled with -Wall -Wmissing_prototypes. + + * stlport/stl/_num_put.c: Fix a cast to avoid a signed/unsigned + comparison warning. + + * c_locale_glibc/c_locale_glibc2.c: Use __locale_t __names field + rather than __locales to access to category names. Thanks to this + modification we do not need the Glib internal locale_data struct + definition anymore. + + * test/unit/fstream_test.cpp: Port the FstreamTest::null_stream for + unixes platforms that use /dev/null, the test is not ignored anymore. + + * src/fstream.cpp: Under Windows, check that the file we are + opening is a real file before trying to truncate it or move to + the end. Allow use of special file like "NUL" with C++ fstream. + +2007-05-10 Francois Dumont + + * src/stdio_streambuf.cpp: Add checks of error codes returned + by ftell and fseek functions in stdio_istreambuf::showmanyc + Windows CE special implementation. + + * test/unit/fstream_test.cpp: Add new test case to check file streams + built from platform dependent null pipe (NUL under Windows, /dev/null + under unixes). Ignored for the moment. + +2007-05-04 Francois Dumont + + * src/locale.cpp, allocators.cpp, stlport/stl/_threads.h, + config/_windows.h: Change macro checks to detect Windows 95 platform. + Windows 95 and NT4 has both WINVER == 0x0400 but only Windows 95 has + limitation impacting STLport code. Distinction between both platforms + is done thanks to the _WIN32_WINNT macro only defined for NT4. New + _STLP_WIN95 macro signals Windows 95 platform, it replaces + _STLP_WIN32_VERSION. Thanks Jan Echternach patch 1707963. + + * src/c_locale_win32/c_locale_win32.c: Remove all code concerning the + messages facet, Windows platform do not support it. + + * src/fstream.cpp: Fix use of fseek in _Filebuf_base::_M_seek in + _STLP_USE_STDIO_IO mode. fseek do not return the position in file + but a boolean value indicating if call has succeeded or not, and + call to ftell to get file position. Thanks Marco Jez bug report + 1704843. I have also integrated a number of small fixes to use + _STLP_USE_STDIO_IO mode under MSVC or GCC MinGW, it shouldn't be + really nececarry but it costs nothing and help testing this mode. + +2007-05-03 Francois Dumont + + * stlport/stl/_numpunct.h, _time_facets.h, _ctype.h, _monetary.h, + _messages_facets.h: Remove friend _Locale_extract_hint function + declaration replace by the more simple friend class + _Locale_impl expression. + + * src/locale_impl.cpp: Change implementation of + _Locale_impl::insert_*_facets methods. Now only facets used internally + for iostreams implementation are considered as mandatory when + instanciating a locale from a name. Other facets like collate or + messages won't generate a runtime_error exception if the platform is + not able to grant an implementation. This will make STLport more + flexible in regards of platform possibilities. + + * stlport/stl/_messages_facets.h, src/facets_byname.cpp, messages.cpp: + Simplification of the messages facet implementation. _Messages class + has no virtual method anymore, _Messages_Impl has been removed. Now + messages class implementation is a dummy implementation that do not + allow access to platform messages, real messages implementation is + available thanks to the messages_byname class. + + * stlport/stl/_time_facets.h: _Locale_time instance is not kept + anymore in the facet implementation, it is only used on construction + to initiliaze _Time_Info struct instance. + +2007-05-02 Francois Dumont + + * test/unit/codecvt_test.cpp: Fixed comparison with char_traits::eof + to use eq_int_type in order to be compatible with platform having + a default unsigned char built-in type. Thanks Marco Jez report. + +2007-04-19 Francois Dumont + + * stlport/stl/_valarray.h: Integrate C++ Standard defect 253 + signaling that slice_array, gslice_array, mask_array and + indirect_array copy constructor cannot be private. + + * test/unit/valarray_test.cpp: Add compilation test to check that + valarray operator[] taking a slice, gslice, valarray and + valarray can be called. + +2007-04-16 Francois Dumont + + * src/locale.cpp: Simplified locale::_M_throw_runtime_error + implementation using std::string rather than C string functions. + Also change exception message generation to make failure reason + more obvious. + + * src/facets_byname.cpp: As, according Standard, *_byname facet + constructor should behave as locale constructor taking a name + STLport now throws a runtime_error instance when building + a facet from a null name. + + * src/messages.cpp: Now contains all classes implementation involved + in messages facet support. + + * stlport/stl/_messages_facets.h, src/messages_facets.h, messages.cpp: + Simplification of the messages facet implementation. Major modification + is that the C messages facet has now only one representation which is + the one given by the _Message class. There used to be an other one + based on _Messages_impl class using __acquire_messages("C"). + + * src/messages_facets.h: Internal classes _Messages and _Messages_impl + are not exported anymore. + + * test/unit/locale_test.cpp: Facet tests has been moved to facet + category test files. + + * test/unit/collate_facets_test.cpp, ctype_facets_test.cpp, + messages_facets_test.cpp, money_facets_test.cpp, num_facets_test.cpp, + time_facets_test.cpp, build/test/unit/Makefile.inc: New test cases for + each facet category. + + * stlport/stl/config/features.h: Define _STLP_NO_TYPEINFO when _STLP_NO_RTTI + is defined. + +2007-04-15 Francois Dumont + + * src/dll_main.cpp: Removed useless _Atomic_swap_struct export + that has already been removed from _threads.h and that was generating + compilation error with MSVC 2005. + +2007-04-10 Francois Dumont + + * stlport/stl/pointers/_deque.h, _list.h, _set.h, _slist.h: + Eric Sanford DMC patch to allow pointer specialization feature. + + * test/unit/map_test.cpp, set_test.cpp, slist_test.cpp, + unordered_test.cpp: Remove DMC check hiding pointer specialization + tests. + + * build/Makefiles/gmake/dmc.mak, app/dmc.mak: Additional fixes from + Eric Sanford. + +2007-04-09 Francois Dumont + + * stlport/stl/_pair.h, _vector.h, config/_bc.h: Borland patch + from Eric Sanford, remove move semantic for free compiler. + + * test/unit/mvctor_test.h: Eric Sanford patch to restore 2 tests + that has been lost in a previous test modification, + movable_declaration_assoc and movable_declaration_hash. + + * test/unit/mvctor_traits_test.cpp: Add some _STLP_NO_MOVE_SEMANTIC + checks when using __move_traits. + +2007-04-05 Francois Dumont + + * stlport/stl/config/_gcc.h: Removed undef of _STLP_NEW_PLATFORM_SDK, + under MinGW, MinGW can use a new SDK and not the one coming with + MinGW. + + * Merged with STLPORT_5_1 branch up to revision 2994. + +2007-04-05 Petr Ovtchenkov + + * src/ctype.cpp: move declaration from loop; + + * stlport/stl/debug/_debug.c: stl/_cstdlib.h already included; + + * stlport/stl/_cprolog.h: prolog for C headers can't include + files with C++ constructions; + + * stlport/*.h: C headers use prolog that don't include C++ + constructions; + + * test/unit/stldbg_include.cpp, build/test/unit/Makefile.inc: + test for problem with inclusion C++ constructions from + C header. + +2007-04-04 Francois Dumont + + * build/lib/configure.bat: Change advise command to build + STLport after configuration, it is now 'clean all' rather + than default build command. + +2007-03-22 Francois Dumont + + * src/c_locale_dummy/c_locale_dummy.c: Fixed dummy definition + for a number of localization functions that are now type safe. + +2007-03-20 Francois Dumont + + * stlport/stl/_prolog.h, config/features.h, debug/_debug.h: + Normalize the way STLport debug mode macros are defined. All + debug macro definition are now coming from _debug.h and not + anymore partially from features.h. _debug.h is now included from + _prolog.h after all configuration has been completed. + + * stlport/stl/_alloc.h, _iterator_base.h, _valarray.h: Removed + _debug.h references now fully integrated in STLport configuration + phase. + + * stlport/stl/config/_windows.h: Add some Windows macro before + inclusion of windows.h when building library to limit Windows + pollution (NOMINMAX, STRICT). Moreover add definition of + _STLP_OUTERMOST_HEADER_ID macro before windows.h inclusion to + avoid indirect include of STLport stuff throught C Standard headers + included in windows.h as at this moment STLport is not yet completely + configured. + + * stlport/stl/config/_evc.h: Removed unjustified macro definition to + limit inclusion from windows.h, it is a user decision not an STLport one. + + * build/Makefiles/nmake/vc8.mak: Fix definition of DEFS in this file + to keep current DEFS value that might exist if configure --extra-cxxflag + option has been used. + + * src/allocators.cpp: Add _STLP_NEW_PLATFORM_SDK macro check to + perform necessary const_cast in _STLP_ATOMIC_ADD macro definition. + +2007-03-17 Francois Dumont + + * build/Makefiles/gmake/bcc.mak, dmc.mak, gcc.mak, nmake/vc-common.mak: + Add WINVER definition when building libraries to signal required OS + compatibility, per default it is Windows 98 and later ones. + + * build/lib/configure, configure.bat: Add new configuration option + --windows95 to signal that we want Windows 95 compatibility. + + * stlport/stl/_threads.h, config/_windows.h, src/allocators.cpp: + Move _STLP_ATOMIC_ADD macro definition in source files where it is + used. + + * stlport/stl/config/_windows.h: + - When building the libraries we always include windows.h, when using + the library we always use own function declaration to avoid windows.h + inclusion. + - InterlockedExchangeAdd is not declared anymore. + - InterlockedExchangePointer is only used when detecting 64 bits + platform thanks to the _WIN64 macro, otherwise InterlockedExchange + is used. + +2007-03-15 Francois Dumont + + * build/Makefiles/nmake/vc8.mak: Default MSVC 2005 build is now done + without safe string functions for performance reasons. + + * stlport/stl/_locale.h, _alloc.h, _rope.h: Moved + _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME invocation where problem + might happen which is in the rope implementation for current use. A future + use will need to guess where this function has to be invoked. + + * stlport/stl/config/feature.h: Fixed _STLP_USE_NO_IOSTREAMS check to undef + _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME macro. + + * stlport/stl/config/_windows.h: For performance reason + _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME system is only used in debug + mode (detected thanks to _DEBUG macro). + +2007-03-13 Francois Dumont + + * Merged with STLPORT_5_1 branch revision 2963. + + * src/locale_catalog.cpp: Use C cast for C struct like _Locale_ctype, + it makes Borland compiler happier. + + * stlport/stl/_string.h: Made inheritance relation between basic_string + and _String_base class public for DMC. + + * src/dll_main.cpp, stlport/stl/config/features.h, + stlport/stl/_locale.h, _alloc.h: Add a new mecanism to detect library + build/use inconsisteny at link time. + _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME macro contains a + function name declared in features.h and defined in dll_main.cpp. + This function name depends on the build context. If, when using the + library, this macro contains an other function name because of a + different configuration context an unresolved symbol will appear at + link time showing the missing function symbol. Function name should + be chosen carefully to make problem as explicit as possible. For the + moment function is called in arbitrary places, in std::use_facet + function and std::allocator constructor. + + * stlport/stl/config/_windows.h: Use + _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME macro to detect + inconsistency when building STLport for Windows 95 and using it + in Windows XP or opposite. Depending on targetted platform, + _Refcount_Base has a different sizeof which lead to undefined + behavior at runtime if we do not use this trick. + +2007-03-13 Petr Ovtchenkov + + * test/unit/string_test.cpp: add test for trivial compare with plain + char array; + + * test/unit/exception_test.cpp: add test for what(). + +2007-03-10 Francois Dumont + + * stlport/stl/config/_windows.h: Major modification, when building + STLport libs windows.h or afx.h, when _STLP_USE_MFC is defined, is + systematically included in order to detect the SDK version used to + the libraries. _windows.h is now the only place is the library where + windows.h is included. + + * src/dll_main.cpp, fstream.cpp, lock_free_slist.h, + c_locale_win32/c_locale_win32.c: Removed references to windows.h now + included from _windows.h. + + * stlport/stl/_istream.c: Add parenthesis on a use_facet call to make + VC6 happy when building the library. + + * test/unit: Disable tests checking instanciation and use of + containers with an incomplete type when pointer specialization is + enable. + + * stlport/stl/config/user_config.h: Add comment about limitation + of pointer specialization. + + * stlport/stl/_string.h, _string_workaround.h: Now that _STLP_DEBUG + mode do not use inheritance anymore, use private rather than + protected members in basic_string implementation. Only exception + is when using VC6 workaround, this is what _STLP_PRIVATE macro is + for. + + * src/allocators.cpp, stlport/stl/config/features.h: Removed + unjustified _STLP_PRIVATE macro. + +2007-03-09 Petr Ovtchenkov + + * stlport/stl/config/_msvc.h: use MS's safe string functions only + if _CRT_SECURE_NO_DEPRECATE not defined (see bug #1674974). + Thanks Bronek Kozicki. + +2007-03-08 Petr Ovtchenkov + + * src/num_get_float.cpp: experimental support of correct input + of long doubles on Linuxes. + + * test/unit/num_put_get_test.cpp: test for correct input of float, + double and long double, including values out of type range. + + * stlport/stl/config/_linux.h: mark that Alpha, PowerPC, + 32-bit SPARC, 32-bit MIPS, ARM, SH4 has no long double. + +2007-03-05 Francois Dumont + + * Synchronization with STLPORT_5_1 branch revision 2945. + +2007-02-19 Francois Dumont + + * stlport/stl: swap workaround review, now when swap implementation + detect that a STLport class is being swapped it calls the + _M_swap_workaround member method. We do not use the swap method + anymore because the way the workaround is implemented would have + forces us to add a swap method to queue, priority_queue and stack + containers that do not have a swap method according the C++ Standard. + +2007-02-15 Francois Dumont + + * Synchronization with STLPORT_5_1 branch up to revision 2918. + +2007-02-13 Francois Dumont + + * stlport/stl/config/features.h, _msvc.h, stl_mycomp.h: Removed + _STLP_USING_NAMESPACE_BUG macro config. STLport private namespace + is now always nested in stlport one. Makes namespace management + easier. + + * stlport/stl/_algobase.h: Restore workaround for compilers + not supporting template function partial ordering feature, was + resulting in regression for a number of compilers, VC6, Borlands. + A template class like _SwapImplemented do not have to be specialized + to be useful, this class is used to detect types having a swap + method. Detection is based on the class being flagged as STLport + class thanks to the __stlport_class inheritance. + + * test/unit/swap_test.cpp: Add macro checks to ignore test for + compilers we know not being able to support it. + +2007-02-12 Francois Dumont + + * stlport/stl/config/features.h: Add necessary macro to work + with tr1 namespace of the C++ technical report. + + * stlport/stl/_unordered_set.h, _unordered_map.h: Put unordered + containers in tr1 namespace. + + * test/unit/unordered_test.cpp, mvctor_test.cpp, + mvctor_declaration_test.cpp: Add necessary using directive + to access tr1 namespace. + +2007-02-12 Petr Ovtchenkov + + * Repository: revert back r2908; + + * test/unit/swap_test.cpp: test that swap( a, b ) has specialization + a.swap( b ), when required; + + * stlport/stl/_algobase.h: _SwapImplemented useless, because it never + specialized elsewhere---remove swap specialization here, use instead + swap specialization from _relops_cont.h, when required. + +2007-02-07 Francois Dumont + + * locale_impl.cpp, monetary.cpp, num_get.cpp, num_put.cpp, + time_facets.cpp: Moved all _GetFacetId implementations in + the same translation unit as the one where id are initialized. + +2007-02-05 Francois Dumont + + * stlport/stl/_alloc.h, allocators.cpp: Moved _ALIGN and + _ALIGN_SHIFT constant definition in source file where it is used + _MAX_BYTES is used in deque implementation. Moreover those + constant value now depends on sizeof(void*) to avoid preprocessor + check like _WIN64. + + * stlport/stl/_vector.h, _vector.c: Moved __type_traits + instanciations in methods that need it in order to be able to + access nested types like iterator even if type used to instanciate + the vector is not yet completely defined. + + * stlport/stl/_deque.h, _deque.c: Removed useless __type_traits + instanciations. For the same reason than above, __buffer_size + constant has been replaced by a function computing deque buffer + size at runtime. + + * stlport/stl/_hashtable.h, _hashtable.c: For the same reason than + above, hashtable do not contains anymore an instance of the _ExK type + which is used to extract the key part from a value instance. This + instance was not returned in any method of the hashtable type. An + unused constructor taking an instance of this type has been removed. + + * test/unit/vector_test.cpp, deque_test.cpp, list_test.cpp, + slist_test.cpp, map_test.cpp, set_test.cpp, hash_test.cpp, + unordered_test.cpp: Add compilation tests to check that the container + iterator nested type is accessible even if type used to instanciate + the container is not yet completely defined. + +2007-02-02 Francois Dumont + + * src/c_locale.h: Add type information for the following functions + of the localization support API: + - _Locale_*_create + - _Locale_*_destroy + - _Locale_*_name + Also add some variable name to make associated documentation more + explicit. + + * src/c_locale_win32/c_locale_win32.c, + src/c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c: Adapted to + conform to new localization API functions prototypes. Adaptation + in glibc before 2.2 has been updated but compilation hasn't been + completed because of the lack of the glibc required version. + + * src/locale_catalog.cpp: Now wrapper functions are used to + offer a homogeneous prototype to type safe localization API + functions. + +2007-02-02 Petr Ovtchenkov + + * test/unit/hash_test.cpp: add test for hash_multimap, equivalent + keys problem on some data sets [this is regression test, suggested + by tef for 5.0.2, bug report #1606308]. + +2007-01-29 Petr Ovtchenkov + + * stlport/stl/debug/_deque.h: typename required. + + * test/unit/sstream_test.cpp: test for seekp added. + +2007-01-28 Francois Dumont + + * build/Makefiles/gmake: Borland patch from Eric Sanford to install + .tds file for Borland debugger. + + * trunk synchronized with STLPORT_5_1 branch up to revision 2895. + + * stlport/stl/_threads.h: Changed way of including headers for + _STLP_UITHREADS platform. We now include internal STLport headers + rather than Standard ones. It was especially important for Sun + Studio compiler that natively include Standard headers only once. + +2007-01-25 Petr Ovtchenkov + + * src/facets_byname.cpp: we search within scope, specified by mask, + so _Locale_wchar_ctype return can't be beyond of this mask. + + * src/c_locale_glibc/c_locale_glibc2.c: _Locale_wchar_ctype + implemented. + + * test/unit/locale_test.cpp: test for ctype facet for wchar_t added. + +2007-01-23 Francois Dumont + + * stlport/stl/_locale.h: Introduction of the _GetFacetId function + to isolate access to facet id instance in one place. It guaranty that + the facet id instances initialized in _Stl_loc_assign_ids function + are the same as the ones used by streams to format output. Many compilers + have problem with template class static variable and duplicate them + arround the different shared library depending on STLport. + + * stlport/stl/_monetary.h, _num_get.h, _num_put.h, _time_facets.h: + Add _GetFacetId overloads for money_get, money_put, num_get, num_put, + time_get, time_put facets that are exposed as template facets. Other + facets are fully specialized template classes whose id should be + correctly handle by compilers like for any static variable in a non + template class. + + * src/monetary.cpp, num_get.cpp, num_put.cpp, time_facets.cpp: Add + _GetFacetId implementation. + + * stlport/stl/_collate.h: Use _GetFacetId in __locale_do_operator_call + implementation, not required but more consistent. + + * stlport/stl/_monetary.c, _num_put.c, _num_get.c, _time_facets.c, + src/locale_impl.cpp: Removed now useless gcc Cygwin or MinGW and + Borland workarounds. + + * test/unit/locale_test.cpp: Removed facet_id test case, facet id + indexes are STLport internal stuff that shouldn't be part of a unit + test. Wrong facet id management will be shown by other tests. Moreover + this test was failing for compilers duplicating template class + static instances. + +2007-01-20 Francois Dumont + + * stlport/stl/_cmath.h, _cstdlib.h, config/_watcom.h: Small + evolution for Open Watcom support. + + * Synchronization of trunk from STLPORT_5_1 branch from revision + 2750 to revision 2871. + + * stlport/stl/config/features.h, _gcc.h, _intel.h, _msvc.h, _sgi.h: + Major exception policy modification, _STLP_NOTHROW default value + is now throw() when exception support is activated. Compilers not + supporting is should define this macro as empty. Configuration files + of compilers already managing this feature have been updated. + +2007-01-19 Petr Ovtchenkov + + * stlport/stl/config/host.h: define one of __SunOS_5_x macro + for gcc (during installation?) on Solaris; note, that Solaris + system may has patch with MATH_F and MATH_L functions. + + * stlport/stl/config/_solaris.h: reminder for __SunOS_5_x + macro definition for gcc; turn on/off MATH_F/MATH_L functions + present: see beacon that depends upon Solaris version and patch present, + as defined by SunPro compilers or in host.h. Thanks to Graham Reed. + + * stlport/stl/config/_sunprocc.h: if use new-c-headers, SunPro + include iso/stdlib_iso.h instead of stdlib.h; note, that this exclude + usage of long double, long long, etc. functions, even when ones present + in OS. Thanks to Graham Reed. Bugreport 1630943. + +2007-01-18 Francois Dumont + + * stlport/stl/_num_put.c: Add cast to avoid gcc warning. + + * stlport/stl/_pair.h, _construct.h: Add _STLP_NO_MOVE_SEMANTIC + before inclusion of _move_construct_fwk.h. + + * stlport/stl/_istream.c: Removed useless cast to num_get facet. + + * src/system_api.c: Move macro check to at least include math.h + in order to avoid an empty translation unit which can generate + compilation warning. + +2007-01-17 Petr Ovtchenkov + + * stlport/stl/_cmath.h: move hypot in global namespace for SunSoft; + suggested by Graham Reed. + +2007-01-15 Francois Dumont + + * test/unit/locale_test.cpp: Upgrade Russian currency abbreviation + 'RUR' to 'RUB'. Thanks Tiziano Muller, bug report 1634886. + + * test/unit/cstring_test.cpp: Fix test to avoid some gcc warnings. + + * stlport/stl/config/_gcc.h: Add _STLP_NOTHROW definition for + this compiler for C++ Standard compliancy. It might also help the + compiler not to emit false warning about potential use of + uninitialized variable (-Wall mode). + + * build/lib/Makefile.inc, src/system_api.h, system_api.c: New source + file used for platform exposing some features only to C compiler. for + the moment used under Hp Unix for GNU compiler access to platform + isfinite, isnan and isinf functions. + + * src/num_put_float.cpp: Replace a lot of unofficial Hp Unix specific + code to access functions isfinite, isinf or isnan. Replaced by + system_api.h. + + * build/Makefiles/gmake/hp-ux/sys.mak: Looks like install command + on this platform is rather exotic, use cp instead. + +2007-01-14 Francois Dumont + + * stlport/stl/config/_system.h: Add __SUNPRO_C macro check to + detect Sun Pro C compiler. Thanks Graham Reed bug report 1630916. + + * stlport/stl/_cstdlib.h: Add __SUNPRO_CC macro check before + defining abs(long) and div(long, long) as Sun pro already + defined them. Thanks Graham Reed bug report 1630972. + +2007-01-07 Francois Dumont + + * stlport/stl: Add _STLP_NO_MOVE_SEMANTIC macro checks to + completely hide move semantic framework when not necessary. + +2007-01-05 Francois Dumont + + * test/unit/bitset_test.cpp: Check _STLP_NON_TYPE_TMPL_PARAM_BUG + macro before doing tests that depends on it. + + * stlport/stl/_list.h: Add assertion to signal potential stack + overflow in recurssive calls to list::insert and list::splice thanks + Aleksey Sanin idear. + + * build/Makefiles/gmake/lib/gcc.mak: Removed obsolete -C ld option + on Hp Unix platform. + + * stlport/stl/_mbstate_t.h: Attempt to fix STLport config for compilers + coming with a native lib defining mbstate_t only for C++ compilers. + For those compilers native mbstate_t definition won't be used for + the moment, STLport simply grant a dummy definition in C. Test + under Hp Unix has shown that it works. + +2006-12-29 Francois Dumont + + * src/iostream.cpp, stlport/stdio.h, stl/_cstdio.h: Eric Sanford + patch to move a Borland workaround from cstdio to stdio.h. + + * stlport/stl/debug: Generalize _STLP_NO_MOVE_SEMANTIC check + to hide move constructors like already done in non debug + implementation. + + * stlport/stl/config/_msvc.h: Restore move semantic for MSVC6. AFAIR + only MSVC .Net 2002 had problem with it. + + * test/unit/strstream_test.cpp: Made the tests for _STLP_LONG_LONG + a little bit more portable. + +2006-12-20 Francois Dumont + + * test/unit/strstream_test.cpp: New test case for sourceforge + bug report 1615554. Not confirm for the moment. + + * test/unit/math_aux.h, mvctor_test.h, string_test.cpp: Fixes + to correctly take into account _STLP_USE_NAMESPACES. + +2006-12-19 Francois Dumont + + * test/unit/bvector_test.cpp: Fix macro check for namespace + support. + + * test/unit/num_put_get_test.cpp: disable warning about float + overflow for MSVC. + +2006-12-17 Francois Dumont + + * test/unit: One more cleanup for compilers not supporting the + namespace feature. This time we avoid namespace specification when + doing template specialisation of Standard functor like less or + allocator. + +2006-12-15 Francois Dumont + + * stlport/stl/config/_dm.h, test/unit/map_test.cpp: Eric Sanford + patch for DMC. + +2006-12-13 Francois Dumont + + * test/unit/test_main.cpp: Clean up use of namespace feature. + + * test/unit: Clean up use of std namespace or ignore tests if + necessary. + +2006-12-13 Petr Ovtchenkov + + * stlport, src: Orphan code removed [Symantec without maintainance a long time; + gcc prior 2.95 and 2.96 can't work with current code in any case; + NetWare unsupported too] + +2006-12-13 Francois Dumont + + * stlport/stl/config/feature.h: Fix and generalize the mutable + workaround for compilers missing this feature. Replace + _STLP_ASSIGN_MUTABLE with _STLP_MUTABLE macro that is more flexible + as not limited to assignment. + + * stlport/stl/_istreambuf_iterator.h, _stream_iterator.h, _string_sum.h: + Use _STLP_MUTABLE rather than manually handle _STLP_NEED_MUTABLE macro. + + * stlport/stl/_sstream.h: Removed useless mutable qualifier for + basic_stringbuf _M_str member. + + * test/unit/bind_test.cpp: Use STLport mutable workaround. + + * src/message_facets.h, facets_byname.cpp: Limit use of the mutable + qualified to one member in _Message_Impl class and use _STLP_MUTABLE + in class implementation. + +2006-12-11 Francois Dumont + + * test/unit/mvctor_test.cpp: Split in 2 other translation unit + mvctor_declaration_test.cpp and mvctor_traits_test.cpp without + impacting number of test case. It helps DMC to perform a correct + link. + + * stlport/stl/type_manips.h: Check _STLP_DONT_USE_PRIV_NAMESPACE before + importing __true_type and __false_type in private namespace. + + * stlport/stl/config/_dec.h, _apcc.h: Removed references to unused + _STLP_HAS_NO_NEW_IOSTREAMS macro. + +2006-12-11 Petr Ovtchenkov + + * src/fstream.cpp, stlport/stl/_fstream.h: non-template friend function + of template class isn't good idea. Fixed. + +2006-12-09 Francois Dumont + + * stlport/stl/_range_errors.h: To complete 2006-12-04 modification + fix inclusion to access to string definition. In normal mode we include + stlport/stl/_string.h rather than string header. There is a special case + however if cumulating _STLP_NO_IOSTREAMS, _STLP_DONT_REDEFINE_STD and + _STLP_WHOLE_NATIVE_STD then functions defined in _range_errors.h will + throw exception from std namespace rather than from stlport. + + * stlport/stl/config/user_config.h: Documented above modification. + + * stlport/stl/config/features.h: Modify _STLP_VENDOR_STD definition. This + internal macro do not have to use __std_alias, within STLport code std is + not a macro and can be used as the vendor namespace. + +2006-12-07 Francois Dumont + + * stlport/stl/_algobase.c, config/features.h: Removed unused + _STLP_MPW_EXTRA_CONST macro. + + * stlport/stl/config/_watcom.h, _dm.h, feature.h: Add new + _STLP_NO_CONST_IN_PAIR macro config to avoid instanciation of + pair with a const qualified type. _STLP_CONST is defined based + on _STLP_NO_CONST_IN_PAIR. + + * stlport/stl/_map.h, _hash_map.h, _unordered_map.h: Add use of + _STLP_CONST. + + * stlport/stl/_num_put.c: Introduce __do_put_bool function containing + all codes to render bool values. We do not use anymore + __copy_integer_and_fill function that was difficult to instanciate for + Open Watcom compiler. Moreover this function was not really adapted for + being use in this context, code duplication is very limitated and + absolute number of lines of code hasn't been modified. + + * stlport/stl/_fstream.h, src/fstream.cpp: Removed useless declaration + of template specialization for _Noconv_input _Noconv_output and _Underflow. + _Underflow template specialization now use a function __Underflow_doit + to avoid the complex syntax of the implementation of a member method of + a template class specialization in fstream.cpp. + + * src/message_facets.h: Add missing allocator parameter in hash_map + instanciation, required for compiler lacking default template parameters + support. + + * src/num_get_float.cpp: Add unsigned 64 bits support for Open Watcom. + + * stlport/stl/_cmath.h, _cstdlib.h: Signal that Open Watcom has already + all math functions C++ overloads in global namespace. + + * Cleanup of all workarounds for MSVC before version 6. + + * build/Makefiles/gmake/gcc.mak: Hide -fvisibility option for windows as + in this context we are not able to correctly detect gcc version in use. + + * stlport/stl/_fstream.h: Reorder member variables in _Filebuf_base + to avoid gcc warning. + +2006-12-06 Francois Dumont + + * STLport 5.1.0 released based on STLPORT_5_1 branch revision 2750. + + * Merge STLPORT_5_1 branch from revision 2711 to 2749. + + * stlport/stl/config/_hpux.h: Specify that Hp Unix is a unix platform + _STLP_UNIX. This platform was already recognise as a unix platform + but it is more clear to put it in Hp Unix configuration file. + + * src/num_put_float.cpp: Limit Hp Unix workaround to access isfinite + isnan and some other system functions to the gcc compiler, aCC has + natively access to it. Tests done by Boris Gubenko. + +2006-12-04 Francois Dumont + + * stlport/fstream, iomanip, ios, iosfwd, iostream, istream, locale, + ostream, sstream, streambuf, strstream: Allow use of iostream headers + even when _STLP_NO_IOSTREAMS is defined if using _STLP_WHOLE_NATIVE_STD. + +2006-12-02 Francois Dumont + + * stlport/stl/_string.c: Use find_end algo rather than internal + __find_end function, find_end contains workaround for limited + compilers. + + * stlport/stl/_algo.c: Avoid a useless default value for last + parameter of __stable_partition_aux_aux function. + + * src/num_put.cpp: In __insert_grouping_aux, use template parameter + Str to get iterator definition rather than getting definition from + basic_string. + + * stlport/stl/_num_get.c, _num_put.c: Complete basic_string + definition for compiler not supporting default template parameters. + + * stlport/cmath, cstdio, typeinfo: Modified to be reentrant once. + + * stlport/stl/_alloc.h, _bvector.h, _construct.h, _deque.h, + _hash_map.h, _hash_set.h, _hashtable.h, _list.h, _map.h, _pair.h, + _queue.h, _rope.h, _set.h, _slist.h, _stack.h, _string.h, + _string_base.h, _string_workaround.h, _tree.h, _unordered_map.h, + _unordered_set.h, _vector.h: Now _STLP_NO_MOVE_SEMANTIC hide all + calls to _AsMoveSource function. + +2006-11-30 Francois Dumont + + * test/unit/stack_allocator.h: Fixed StackAllocator implementation + for Borland and DMC that required a workaround. + + * stlport/stl/config/_gcc.h: Starting with gcc 4, use visibility + feature. + + * build/Makefiles/gmake/gcc.mak: Starting with gcc 4, add + -fvisibility=hidden compilation option. + +2006-11-28 Francois Dumont + + * stlport/stl/_alloc.h: Avoid explicit instanciation of template + function _AsMoveSource. Replace internal allocator::allocate function + with _M_allocate to avoid use of overloading. + + * stlport/utility: Fix header reentrancy. + + * stlport/stl/_ptrs_specialize.h: Fixed instanciation of + __type_traits_aux. + +2006-11-25 Francois Dumont + + * stlport/climits, iosfwd, mem.h, string.h, typeinfo.h, wchar.h, + stl/char_traits: + Eric Sanford patch to complete use of include_next with Borland + compilers. + + * stlport/using/cstring: Fix macro check for Borland compiler. + + * test/unit/locale_test.cpp: Add test for Borland _fpclass. + + * src/num_put_float.cpp: Fix potential error in _Stl_is_neg_nan + for Borland compiler after 0x581. + +2006-11-24 Francois Dumont + + * Eric Sanford patch for DMC compiler, allow access to associative + containers extension. + + * stlport/typeinfo.h, exception: Workaround for DMC that force + inclusion of typeinfo.h at the begining of all translation units. + +2006-11-23 Francois Dumont + + * test/unit/cstring_test.cpp: New test case to check import of all + C functions from string.h in STLport namespace. + + * stlport/using/cstring: Fix import of strcmp and strcpy for Borland. + +2006-11-20 Francois Dumont + + * stlport/iosfwd, stl/type_manips.h, config/_bc.h, pointers/_tools.h: + Patch from Eric Sanford to remove useless Borland workaround for + pointer specialisation and use include_next feature for versions after + 0x580. + +2006-11-20 Petr Ovtchenkov + + * src/monetary.cpp: template header not allowed in member definition + of explicitly specialized class + +2006-11-19 Francois Dumont + + * stlport/stl/_ios_base.h: Replace wrong external utility inclusion + with internal _pair.h header. + +2006-11-17 Francois Dumont + + * stlport/stl/config/features.h: Modification of the static constant + workaround implementation to use something similar to the boost + workaround. _STLP_STATIC_CONST_INIT_BUG macro change definition of + newly introduce _STLP_STATIC_CONSTANT macro which use an enum or a + real static const variable. Moreover the new + _STLP_NO_STATIC_CONST_DEFINITION will hide static constant definition + when defined. + + * src/ctype.cpp, ios.cpp, locale.cpp: Add check for + _STLP_NO_STATIC_CONST_DEFITION. + + * src/monetary.cpp: Add intl static constant definitions. + + * stlport/stl/_ctype.h, _ios_base.h, _limits.h, _monetary.h: Use + _STLP_STATIC_CONSTANT. + + * stlport/stl/_limits.h: Limits a workaround for long long and unsigned + long long types that used to be applied for gcc after 2.96 up to version + 3.0. + + * stlport/stl/_limits.c: Clean all static constant values duplicated from + _limits.h that was not used in this file. Add static constant definition + necessary for long long and unsigned long long types for gcc between 2.96 + and 3.0 (see above). + + * stlport/stl/debug/_string.h: Removed npos static constant definition + that is only necessary in stlport/stl/_string.c. + + * stlport/stl/config/_msvc.h: Use real static constant starting with + VS .Net 2003 (_MSC_VER >= 1310). + + * test/unit/limits_test.cpp: Modified test to reveal potentially missing + static constant definitions. + +2006-11-13 Francois Dumont + + * stlport/stl/config/stl_confix.h: Add some STLport config options based + on EDG version information using boost common_edg.hpp content. + + * stlport/stl/: Patch from Eric Sanford for Borland compiler. Allow + associative container extension (member methods) and use of pointer + specialization. + +2006-11-07 Francois Dumont + + * stlport/stl/config/_hpacc.h, stl_confix.h: Thanks to additional info + from Boris Gubenko STLport now check __EDG_VERSION__ to detect EDG based + compilers. It use this macro to activate include_next feature. Moreover + a workaround has been added for aCC6 that was not defining __EDG_VERSION__ + as expected. _hpacc.h has also been cleaned of obsolete config. + +2006-11-07 Francois Dumont + + * stlport: All C++ Standard headers are now using the same schema. If + included from outside (_STLP_OUTERMOST_HEADER_ID not defined) it first + included internal header (in stl folder) and then, if _STLP_WHOLE_NATIVE + is defined, include the equivalent native Standard header. If included + from inside, simply forward to native header include. This schema has + several advantages: + - Less dependancy on native library headers interdependancy. + - Less code included as STLport code is only exposed if headers are + included from the outside. + - Restore _STLP_WHOLE_NATIVE_STD configuration (tested with gcc, msvc, bcc) + The condition for this schema to work is that STLport never include Standard + headers internaly when it wants to access some STLport code. + + * stlport/stl/_iomanip.h: New file containing all STLport code that used + to be in stlport/iomanip. + + * stlport/stl/_complex.h, _rope.h, _stream_iterator.h, _string_fwd.h: Use + stl/_iomanip.h rather than iomanip. + + * stlport/stl/_rope.c: Use stl/_ostream.h and stl/_istream.h rather than + iostream. + + * stlport/stl/config/_kai.h, _msvc.h, feature.h: _STLP_MINIMUM_IMPORT_STD + macro removed, it was only used in vector header to avoid include of + native vector header even when _STLP_IMPORT_VENDOR_STD was defined. MSVC6 + used to define it but removing it hasn't make compilation failed when + importing all native std stuff. Looks like it was a workaround necessary + when STLport was not as clean as it is now or for the former wrapper mode + that has been removed. + + * stlport/stl/config/features.h: Add a #error to signal that + _STLP_WHOLE_NATIVE_STD and _STLP_NO_OWN_NAMESPACE are incompatible + options. + + * stlport/stl/config/stl_confix.h + +2006-11-05 Francois Dumont + + * stlport/stl/_sstream.h, _sstream.c: Add 2 helper functions _S_start and + _S_finish to hide complexity of code required to have read access to the + aggregated string instance internal buffer. Those 2 functions help keeping + basic_stringbuf implementation simple without requiring a friend + declaration in basic_string class and use of inheritance in _STLP_DEBUG + mode between the debug string and the non debug one. + + * stlport/stl/_string.h, debug/_string.h, _string_sum_methods.h: Removed + friend declaration and inheritance (see above). This also avoids to restore + some workarounds that used to be necessary when _STLP_DEBUG mode was using + inheritance in all the debug containers. + +2006-11-04 Francois Dumont + + * src/num_put_float.cpp: According C Standard number of digits in the + exponent part of scientific output should be at least 2, C99 even says + that we shouldn't add zeros if there are more than 3 significant digits. + + * test/unit/complete_digits.h: Modified according to above rules. + +2006-11-02 Francois Dumont + + * Repository: Merged STLPORT_5_1_RC3 tag changes up to r2771 into the trunk. + Now trunk is really in sync with STLPORT_5_1 branch. + + * etc/ChangeLog: Now contains only trunk modif, 5.1 changes are in + ChangeLog-5.1. + +2006-11-02 Petr Ovtchenkov + + * Repository: merged from 5.1 branch. + +2006-11-01 Francois Dumont + + * stlport/stl/_stdexcept_base.h: Patch from Uli to simplify + __Named_Exception implementation. + +2006-10-31 Francois Dumont + + * build/test/unit/Makefile.inc: Restore STLport version information that + had mysteriously disappeared in a previous modification. + + * stlport/stl/_num_put.c: Disable warning for MSVC that signal problem in + cast from pointer to unsigned long. + + * src/num_put_float.cpp: Fix buffer overflow introduce by a previous + modification. Now STLport appends '0' so that floating point scientific + output has a constant size. MAXESIZ renamed in MAXEDIGITS to make macro + signification more obvious. + + * test/unit/complete_digits.h: New file containing the function giving + platform dependant number of digits in STLport scientific output of + floating point types. + + * test/unit/num_put_get_test.cpp, locale_test.cpp: Adapt tests to latest + STLport modifications. + +2006-10-30 Francois Dumont + + * stlport/stl/_stlport_version.h: Upgrade STLport version information + to reflect built libraries. + +2006-10-24 Petr Ovtchenkov + + * stlport/stl/config/host.h, _linux.h: force usage malloc_alloc as default + allocator on systems with glibc 2.3.x and later due to better performance. + + * stlport/stl/_alloc.h: remove _STLP_MALLOC_USABLE_SIZE dependant + code---not really used. + + * stlport/stl/_alloc.c: remove recalculation of __n [Francois was right]; + remove _STLP_MALLOC_USABLE_SIZE dependant code---not really used. + + * src/allocators.cpp: remove additional __malloc_alloc_impl class---not + required; add mutex lock for custom __malloc_alloc oom handler change/use + [in multi-threaded environment]. + +2006-10-16 Petr Ovtchenkov + + * stlport/stl/c_locale.h, _mbstate_t.h, src/c_locale.h, c_locale.c: + merge changes from STLPORT_5_1 branch, see 2006-10-12 [Francois Dumont]; + may be problems on Solaris, and FreeBSD---more check required. + +2006-10-13 Petr Ovtchenkov + + * Repository: merge changes [not all] 2006-10-12 from STLPORT_5_1 branch + +2006-10-12 Petr Ovtchenkov + + * Repository: merge changes from STLPORT_5_1 branch (records + from 2006-10-06 to 2006-10-04). + + * stlport/stl/_alloc.c: Hmm, looks like deallocation size in + 2006-10-06 is wrong. + + * stlport/stl/_num_put.c: print pointer as in fix width form, and + with base 0x, independent, zero pointer or not. + + * test/unit/num_put_get_test.cpp: test for issue above. + + * test/unit/string_test.cpp: test for overloaded operators + and temporary string; inspired by problems with some compilers. + + * stlport/stl/_mbstate_t.h: revert back changes from STLPORT_5_1 branch; + mbstate_t couple with wchar closely, and sometimes has compex and implicit + dependance; include wchar.h first required! + +2006-09-12 Petr Ovtchenkov + + * test/unit/string_test.cpp: add test for bug report #1541499, + problem not detected; looks like gcc 4.1.1 can compile te_tmp test + correctly [sum operations under class derived from string, with + _STLP_USE_TEMPLATE_EXPRESSION]. + +2006-09-08 Petr Ovtchenkov + + * stlport/stl/_sstream.h, _sstream.c: remove double buffering + on write only underlying string as buffer. Use knowlege about + string implementation, this should improve performance, and, + at least simplify code and avoid logic that already present in + string implementation. + + * stlport/stl/_string_base.h: basic_streambuf is friend, to access + to internal function (access to storage pointers). + + * stlport/stl/debug/_string.h, _string_sum_methods.h: change usage + of 'non-debug string', from 'use of' relation to 'inherit' releation. + Useful for access basic_streambuf to string storage in _STLP_DEBUG + mode too. + + * test/unit/sstream_test.cpp: test for tellp call; change test + with inited ostringstream in accordance with another Standard + treatment. + + * stlport/stl/_streambuf.h: remove ancient code, that can't + work with present code in any case. + + * src/c_locale.c: ditto + + * build/lib/Makefile.inc: bump minor version (5.2.0) + +2006-07-27 Francois Dumont + + * stlport: Adopt include_next GNU extension for the following reasons: + - Standard headers do not have to be categorised anymore to be + included, we could have a wrong include order if headers are not + correctly categorized. + - Package builder can use any folder structure they want for gcc, + STLport won't have to be customized anymore. + - Make STLport usable with other library that also use the shadow + header trick to modify native headers content. + + * stlport/stl/config/_gcc.h: Add definition of _STLP_HAS_INCLUDE_NEXT + macro to signal that this compiler preprocessor support include_next. + Removed all definition of native headers path that are now useless. + +2006-03-27 Petr Ovtchenkov + + * src/num_put_float.cpp: use buffers that at least longer + than maximal double [or long double] exponent, so avoid + potential vulnerabilities; this allow to read really long + fix-float numbers [with lost of significant digits, of course]. + + * test/unit/floatio_test.cpp: add test for issue above + +2006-03-23 Petr Ovtchenkov + + * src/cxa.c: remove wrong exclusion of lock for Solaris. diff --git a/reactos/lib/3rdparty/stlport/etc/ChangeLog-4.0 b/reactos/lib/3rdparty/stlport/etc/ChangeLog-4.0 new file mode 100644 index 00000000000..ef02dbfa522 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/ChangeLog-4.0 @@ -0,0 +1,668 @@ +The following fix was made in 4.0 since 4.0 Release Candidate : + + * _threads.h/_config.h : for all platforms, static mutexes made non-indirect + + * _iterator_base.h : made possible to choose between iterator_traits approach + and old-style iterator queries like iterator_category(), value_type(), etc. + (Thanks to John R. Bandela for pointing this out) + * _config.h, stl_user_config.h : introduced __STL_OLD_HP_ITERATOR_QUERIES switch to + allow old-style and new-style iterator queries (for all compilers). + iterator_traits<> made always defined. + + * _ptr_specialize.h - specializations of type_traits<> for compilers w/o partial spec + moved into separate file. Added iterator_traits<> specializations for pointer types + for __STL_NO_OLD_HP_ITERATOR_QUERIES case. Macro __STL_POINTERS_SPECIALIZE is now available + to specialize both type_traits and iterator_traits for a pointer to user-defined + type (latter for standard-style iterator queries mode only) + + * vc5.mak : __STL_NO_FORCE_INSTANTIATE flag restored + + * _site_config.h : if __STL_NO_NEW_IOSTREAMS or __STL_NO_IOSTREAMS specified, + SGI iostreams are being turned off. __STL_NO_SGI_IOSTREAMS moved into stl_user_config.h + (Thanks to Sathish T C for the report) + + * stl_watcom.h : _REENTRANT is being set if _MT is set (thanks to Ricardo E. Gayoso for the input) + +The following fix was made in 4.0 Release Candidate : + * _threads.h, _alloc.c : fixed use of _STL_mutex_base instead of _STL_STATIC_MUTEX macro + +The following changes were made in 4.0 Release Candidate since 4.0 beta 8: + + * fstream.cpp : WIN32 fstreambuf::open flag mapping fixed + (thanks to Alberto Barbati for the reports) + + * ctype.cpp : fixed classic table regarding ios_base::print/ios_base::space + conflict (thanks to Alberto Barbati for the report) + + * cmath : added same workaround for SUN's math exception/std::exception name clash + as was there in math.h before + + * _streambuf.c : added "typename" to out-of-line functions (thanks to Michael Tsirkin for the report) + + * README fixed to be consistent about SGI iostreams setting (thanks to Ed Brey for the report) + + * _bitset.h : fixed SUN CC 4.2 crash with -g option (thanks to Alex Vanic for the report), + fixed bug in bitset<>::reference base bitset typedef + + * _threads.h/.c - fixed issue with inconsistent system's macro for initialization + and warning about partially bracketed initializer + + * debug/_vector.h : fixed _Vector_nonconst_traits specialization for bit_vector + (thanks for Dave Abrahams for the fix & reminder) + + * config/msvc.h - addidional level 4 warnings suppressed (thanks to Ed Brey for the report) + * _ios.h : fixed DLL export decl for MSVC (thanks to Alberto Barbati for the report) + + * stdio_streambuf.cpp : compatibility fix for glibc 2.2 (thanks to Bill Shanahan for the patch) + * _iterator_base.h : added iterator specialization; + _stream_iterator.h : ostream_iterator changed to inherit from iterator<> + (thanks to Raphael Bossek for the report) + + * INSTALL : added some exaples and fixed typos (thanks to Beman Dawes for the report) + + * _site_config.h : more consistency checks for MT (thanks to John Maddock for the input) + + * _messages_facets.h : added DLL export decls (thanks to John Maddock for the report) + + * complex_io_w.cpp : fixed specialization syntax for aCC (thanks to Paul E. Blanchard for the report) + + * complex_exp.cpp : fixed pow() bug for negative arguments (thanks to Anton Sergeev for the report) + * _fstream.h/_streambuf.h : MRC/MPW workarounds (thanks for Tsutomu Yoshida for the report) + + * using/fstream.h : added missing end-of-line (thanks to Jean-Francois Panisset for the report) + + * : workaround for VC++ 6.0 defining type_info in gobal namespace (thanks to Bosko Ivanisevic for pointing that out) + + * _threads.h/_threads.c/pthread_alloc : improved pthreads portability (thatnks to Michael Tsirkin for the patch) + + * _debug.h/_debug.c : __STL_ASSERT/__STL_VERBOSE_ASSERT/__STL_VERBOSE_RETUN macros guarded to be overridable by user (thanks to Tony Gould for the input) + + * _valarray.h : added assert to operator= + + * config/vc_select_lib.h : added _AFXDLL recognition (thanks to Andrew Phipps for input) + + * _rope.h : added default constructors to please gcc-2.7.2 + + * _set.h/_hash_set.h : pointer and reference typedefs fixed (thanks to Anton Sergeev for the report) + + * stl/_config.h : stl_user config.h included prior to other parts of configuration + (thanks to Frank Samuel for the report) + +The following changes were made in 4.0 beta 8 since 4.0 beta 7: + + * Merged changes for 06/08 SGI library snapshot; mostly in locale + + * Merged series of fixes/workarounds by Tsutomu Yoshida (thanks!): + * _rope.c - fixed memory leak bug; + * _debug.c/_debug.h - added extra zero-initialization for more robustness; + * _list.h - MPW - specific fixes; + * _hashtable.h - fixed debug renaming clash for __STL_USE_ABBREVS + * EH workarounds to make Apple compilers behave + + * _fstream.c : fixed tellg() bug in text mode + + * : added sig_atomic_t import + + * series of fixes for HP aCC 1.23 ( thanks to Michael Tsirkin for the patch ): + _bvector.h : all relops are specialized; + stl_hpacc.h - fixed config; + hpacc.mak : added makefiles for HP aCC in src and test + debug/_iterator.h, debug/_vector.h - removed future errors due to baseclass member use + + * : added import of system() call (thanks to Petr Ovchenkov for the report) + + * _REENTRANT is now set by default to be on for all SGI iostreams compilations. + Same is being enforced if SGI iostreams are used. + + * _pair.h : added workaround for make_pair in case of char literals + (extension, only works with partial function order) + + * config/stl_gcc.h - fixed configuration problem for "g++-3" directory used in Cygnus and Mingw + distributions for gcc-2.95.2, while all other platforms use "g++". Added recognition section. + Thanks to Dave Abrahams for the report. + + * config/stl_mlc.h : added support for MLC compiler (thanks to Anton Sergeev for the patch) + + * : auto_ptr simplified (thanks to Kon Tantos for problem report) + + * num_get.cpp : included to get external symbols right. + + * stl_ibm.h : __STL_NO_TYPEINFO added for OS/2 (thanks to Willie Arbuckle for the report) + + * stl_bc.h : fixed enforcement of static library until dynamic made to work (thanks to J. Lambert for the report) + * src/stlport.rc : improved version definition to work with mingw32, changed to + + * src/mingw32.mak : Made use of stlport.rc for DLL build (thanks to Danny Smith for the suggestion) + * debug/_vector.h : name clash removed for _Base (thanks to Will Fike for the report) + + * _monetary.h - added "static const bool intl" member to meneypunct<> templates + (thanks to Anton Sergeev for the report) + + * _bitset.h : added forward friend decraration for reference (thanks to Anton Sergeev for the report) + + * _tree.h : made _Rb_tree_base_iterator::_M_node initialized in default constructor (thanks to Dean Sturtevant for the report) + + * _set.h : reinterpret_cast<> changed to C-style cast (thanks to Dave Abrahams for the suggestion) + + * Use of raw SGI allocators (like __node_alloc) as an allocator parameter deprecated, + available only with __STL_USE_RAW_SGI_ALLOCATORS macro. May be removed later. + __allocator still available unless __STL_NO_EXTENSIONS is specified + + * _limits.h/_limits.c - alignment fix for Solaris; + * Modified __format_float* routines to take long double as parameter; + (thatnks to Anthony Williams for the patch) + + * debug/_iterator.h - wrappers for noncompliant compilers moved under + #ifdef __SGI_STL_NO_ARROW_OPERATOR (thanks to Dave Abrahams for the input) + + * _numeric_facets.h - num_put<> , num_get<> virtual members made outline to work + aroung gcc-2.95 bug. + + * : undefined obsolete C macros : getchar/putchar & the like. + + * ctype.cpp : fixed bug with ctype::is (const char*, const char*, mask) + + * ctype.cpp : fixed is(print) for certain platforms where print is a separate flag + + * ftstream.cpp : fixed corner case bug for Win32 text output (thanks for Dirk Schreib for the report) + + * _streambuf.h, _fstream.h, stdio_strembuf.h : fixed overflow/pbackfail() virtuals definition; + * _bitset.h : _M_copy_from_string fixed for non-member-template case (thanks to Alex Vanic for the report) + + * gcc-glibc.mak, common_macros.mak : GLIBC compilation fixes (thanks to Thomas Witt for the report) + * WCHAR_MIN, WCHAR_MAX definitions moved from to + + * char_traits::to_char_type : parameter changed to int + + * included in (for size_t) + + * _codecvt<>::do_length: fixed first parameter to be const mbstate_t &; + virtual fns moved into .cpp, to work aroung gcc bugs + + * _complex.h : fixed complex<>::operator= and constructors signature to take const T& + + * _istream.c : fixed formatted input involving binary '0' + + * locale_impl.cpp : insertion of time_put fixed + +The following changes were made in 4.0 beta 7 since 4.0 beta 6: + + * Merged series of fixes/workarounds by Tsutomu Yoshida (thanks!): + * cmath, _complex.h, stl_apple.h, _deque.h - MPW/MRC specific workarounds + * _bitset.h - removed the obsolete _WordT template parameters. + * _ctype.h, _codecvt.h, _collate.h, _istream.h, _messages_facets.h, _monetary.c + _monetary.h, _numeric_facets.h, _time_facets.h - added workaround for locale's nested class. + * _ostream.c_ostream.h - added proposed modification against the circular inclusion problem. + * test/eh/test_deque.cpp - removed the obsolete template argument + + * _bitset.h - removed obsolete adaptor (thanks to Alex Vanic for the report) + + * _[io]stream.h - removed extra DLL specs (thanks to Danny Smith for the report) + + * stl_msvc.h - fixed bug caused static lib to always be selected + + * gcc.mak - fixed AR definition for static link + + * Added workaround for static locale::id member in DLL for mingw32 (thanks for Danny Smith for the report) + + * _string_io.h : added _widen() to get getline() compile with wchar (somewhat missing in b6 , thanks to Mikhail Leonov for reminder) + + * threads.h - fixed guards for DreamSega WinCE (thanks to Ben Nason for the report) + + * fstream.cpp : fixed truncation for WIN32 (thanks to Bruce Alderson for the report) + + * _istream.c/_M_ignore_unbuffered() - fixed count bug + + * _istream.c/ readsome() : fixed extra failbit setting on eof + + * __get_integer - enhanced using a table; input value made unchanged in case of error. + + * __get_base_or_zero - more code factored out + + * stl_wince.h : fixed assert() definition for Win CE (thanks to Andrew Waters for the report) + + * vc_select_lib.h " fixed __declspec selection for Win CE (thanks to Andrew Waters for the report) + + * _rope.c - fixed bug in _S_destr_concat_char_iter (thanks to E.Musser for the fix) + + * debug/_vector.h - fixed DLL export for vector + + * _vector.h, _deque.h, _bvector.h - obsolete guards around at() methods removed ; + * type_traits.h - WinCE compatibility fixes for -> operator definition ; + * _vector.h, _deque,h - removed extra casts (thanks to Andrew Waters for the report) + + * _algobase.h - optimized lexicografical_compare() overload for char* + +The following changes were made in 4.0 beta 6 since 4.0 beta 5: + + * Merged changes from SGI STL snapshots 04/03, 04/14, 04/18. + + * Iostreams ported to Apple MPW/MRC (thanks to Tsutomu Yoshida for the contribution) + + * Iostreams ported to OSF1/Tru64 (thanks to Marc W. Mengel for the contribution) + + * Iostreams ported to FreeBSD ( Thanks to Sms for the contribution) + + * : extra template parameter removed + + * locale::id, locale::facet : reverted to nested classes as standard prescribes + + * _string_io.h : added _widen() to get getline() compile with wchar (thanks to Mikhail Leonov for the patch) + + * collate_byname[_w].cpp : fixes for VC++ 5.0 build w/__STL_DEBUG (thanks to Petr Ovchenkov for the patch) + + * : __STL_COMPLEX_NAMESPACE defined before inclusion of impl. header + (thanks to Matthew Kelly for the patch) + + * makefiles in "src" : improved to get each compiler to put object files in separate directory : + ./obj/$(COMP)/Debug, etc. COMP is given some default value for each compiler, but may be also overridden. + + * "src" subdirectory : added stlport_prefix.h file for precompiled header support; + VC++ makefiles make use of them + + * stl/_iterator_base.h : provided __STL_NONTEMPL_BASE_MATCH_BUG + workaround for new form of distance(). + + * : added cast to WCHAR_MAX definition (thanks for Dave Abrahams for the report). + + * stl_user_config.h, stl/_config.h - setting splitted and organized more properly. + + * time_facets.cpp - extra instantiations removed (thanks to Matti Rintala for the report). + + * stdio_streambuf.h : added explicit qualifications of C lib functions for gcc-2.91 + + * SGI code used for compatibility w/older versions are guarded with #ifndef __STL_NO_ANACHRONISMS + + * SGI extensions are guarded with #ifndef __STL_NO_EXTENSIONS + + * SGI/HP anachronisms are guarded with #ifndef __STL_NO_ANACHRONISMS + + * : .h file included if __STL_NO_NEW_NEW header is set + (thanks to Willie Arbuckle for the report) + + * Suppresed spurious BC55 warnings about iterators + + * complex_io.h - fixed operators declarations for MetroWerks + + * debug/_slist.h - cleaned up use of stl_debug_do obsolete macro (thanks to Matti Rintala) + + * debug/_iterator.h, debug/_vector.h - fixed relaxed iterator constructors (thanks to Dave Abrahams for the patch) + + * stl/_complex.h - fixes for gcc-2.95 on IRIX (thanks to Marc W. Mengel) + + * debug/_iterator.h : fixed relaxed const/non-const iterator construction for debug mode + (thanks to Dave Abrahams for the patch) + + * collate : added workaround for SUNpro linker (thanks to Petr Ovchenkov for the fix) + + * _ios.h, _streambuf.h - added obsolete stuff required by the standard + + * _config.h/stdexcept - introduced __STL_NOTHROW_INHERITED to be used when we actually need + exception specification due to inheritance (thanks to Joe for the report) + + * _locale.h:104 : fixed ummaned parameters + + * _tempbuf.h - fixed absent inclusion of _tempbuf.c + + * : relaxed rules for importing vendor symbols + + * _deque.h - added != operator + + * _streambuf.h - fixed snextc() bug for wchar_t + + * , _numeric_facets.h - circular dependency resolved + + * stl/_iosfwd.h - added include guard + + * basic_[io]stream::sentry made inner class again (as per standard) + for non-DLL compilations. + + * vector is used in locale implementation to reduce code bloat, + vector exported from DLL + + * : exported more stuff + + * stl_intel.h : ICL config merged into stl_msvc.h + + * gcc.mak - fixed for shared target + +The following changes were made in 4.0 beta 5 since 4.0 beta 4: + + * _hastable.c:263 : removed inneeded cast (thanks to Will Fike for the report) + + * debug/_string.h : added conversion to non-SGI string (thanks to Todd Richmond for the report) + + * _complex.h : fixed DLL declarations for i/o operators + + * _ostream.h : fixed sentry behavoiur and DLL specs. + + * _istream.h : fixed DLL specs, optimized some try/catch blocks + + * _vector.h : fixed vector::insert body definition for __STL_INLINE_MEMBER_TEMPLATES + + * : more compilers listed as having full exception header + + * debug/_debug.h : added namespace to __STL_ASSERT for EH test which uses this internal macro. + + * resource info fixed (thanks to Michael Entin for the report) + + * debug/_string.h : fixed _M_start resolution bug (thanks to Rob for the report ) + + * : added import of new_handler stuff from vendor namespace (thanks to Niran Bala for the report). + + * src/c_locale_glibc - missed directory contents restored (thanks to Todd Rider for the report) + + * mwerks_prj - project updated for new file set, target names for x86 changed to conform to common schema + + * _ostream.c/_istream.c : fixed lookup for _S_eof symbol (thanks to Anton Sergeev for the report) + + * _ios.h - fixed VC++ DLL warning for specializations + + * stl_ibm.h - disabled "long long" due to incomplete support on MVS by request (thanks to Tinny Ng) + + * char_traits.h - worked around weird gcc internal bug (__sz identifier changed to _Sz) + +The following changes were made in 4.0 beta 4 since 4.0 beta 3: + + * "src" directory : source divided into smaller parts to be more manageable and to + get more cache locality + + * throw specifications removed (macros made void) - thanks to Dave Abrahams for the suggestion + + * stl/_list.c - fixed reverse() "inline", + _deque.h - fixed cast bug for xlC (thanks to Alex Vanic for the reports) + + * stl/_strstream.h - fixed DLL specs (thanks to Parcival Willems for the report) + + * stl/_string.h, debug/_string.h - fixed conversion from native string with __STL_DEBUG + (thanks to Todd Richmond for the report). + + * stl/_istream.h - fixed clash of "__N" symbol with ctype.h macro for some compilers + (thanks to Kees de Bruin for the report) + + * Configuration fixed for Borland C++ 5.02 compiler [ deque still does not work with it ] + + * gcc-2.7.2 configuration fixed + + * SGI iostreams now work for Borland 5.5 with static lib , some problems with + locale initialization when DLL is used. + + * __get_c_string exported in DLL (thanks to Ed Ball for the report). + + * ENDIAN fixes for CodeWarrior/DEC (thanks to Kevin Wooten for bringing this up) + + * wrap_std/h/strstream.h - added missing wrapper (Thanks to Laurent for the report) + + * stl_hpacc.h - fixed #endif bug, + _limits.h/.c - fixed array initialization, + _string_io.h, _locale.h - fixed circular dependancy, + _set.[hc], _hashtable.c, _set.h - added __REINTERPRET_CAST need by some compilers; + _i[o]stream.c, _rope.[hc] - lookup fixed for dependant symbols + (thanks to Alain Miniussi for the reports) + +After-release minor bugfixes for beta3: + + * stl/_list.c - fixed reverse() [ new SGI code, merged unported first ] + Thanks for everybody who reported it. + + * stl/_bvector.h : fixed ambiguity problem with relational iterators + for __STL_NO_BOOL case (thanks to Alex Vanic for the report). + + * stl/_alloc.c, stl/_threads.c - fixed static member definitions for compilers + that lack automatic static data members (gcc-2.7). Thanks to Huang-Ming Huang + for the report. + + * standard wide streams initialization bug on Win32 fixed (thanks to Harold Putman for the + report) + +The following changes were made in 4.0 beta 3 since 4.0 beta 2: + + * Merged SGI changes from 02/18 snapshot. + + * Ming32W (gcc Win32 port using MS runtime lib) is now fully supported. + + * .dll build schema improved, now builds with mingw32 and Borland C++ + (Borland has some problem with numeric i/o) + + * VC++ version bugfixes in // + (thanks to Todd Richmond for the report) + + * _bvector.h - relational operators defined only for "bit_vector", + not for "vector" specializations (thanks to Edward Ball for the report) + + * src/locale_impl.h - fixed multiple defined symbol problem with gcc + (Thanks to Matti Rintala for the report) + + * config/stl_ibm.h - __STL_NO_TYPEINFO added (thanks for Tinny Ng). + + * : _stl_string_io.h/c introduced to fight inter-dependencies + + * _bvector.h - added fix for -tempinc compilation on AIX (thanks to Alex Vanic for the patch) + + * fstream.cpp - _M_write bug for Win32 text mode fixed (thanks to Mike Pyle) + + * _string.h : debug version included prior to _string.c; + + * debug/_debug.h/.c, debug/_deque.h, debug/_string.h - fixed debug mode bugs; + Apple compilers config fixes / iostream wrapping fixes / EH test fixes, + (thanks to Tsutomu Youshida for the patch) + + * csetjmp/setjmp.h - guards added against VC++ #defines (thanks to Gavin Wood) + + * stl/_iosfwd.h : __STL_DEFAULT_CONSTRUCTED used instead of __STL_NULL_CHAR_INIT + (thanks to Alex Vanic for the report) + + * __stl_get_c_string() - made extern non-template for SGI iostreams mode. + + * __cdecl calling convention fixes - now works for debug & non-debug code. + + * _limits.h/.c : static data moved from inline functions into a class. + + * stlport_msvc.rc resource file added for DLL's (thanks to Michael Entin) + + * stlport/config/stl_wince.h : added abort()/assert() definitions + (thanks to Gavin Wood for the report) + + * Initial iostreams port for xlC (thanks to Alexander Vanic for the patch). + + * config files - made safe for C compilers + + * src/c_locale_stub.c - made structure for full platform-dependent + locales other than "C". Glibc implementation merged. + +The following changes were made in 4.0 release candidate 2 since 4.0 release candidate 1: + + * Solid approach to __STL_DEFAULT_CONSTRUCTOR_BUG problem implemented, + rope.h typo fixed (thanks to Alex Vanic for the report) + + * getline and stream operators moved from _istream.c to _string.c + where they belong (thanks for Petr Ovchenkov) + + * fixed to import nothrow and nothrow_t + + * Borland C++ 5.5 (free compiler) supported (iostreams won't compile yet). + + * SUN CC 6.0 EA - new features unabled (most announced features still don't work though) + + * HP ACC configuration updated, some fixes for new aCC beta(thanks to Alain Miniussi). + + * Windows CE compatibility fixed (thanks to Gavin Wood for the report) + + * fixed for non-SGI case, ios.cpp bug in __STL_NO_EXCEPTIONS + mode fixed, debug iterators fix (thanks to Todd Richmond). + + * VC++ 5.0 and 4.2 compatibility fixed (thanks to Ilya for the report) + + * __cdecl calling convention explicitly specified for VC++ & static/global functions. + + * vc_common.mk : debug type changed to CV (thanks to Mike Pyle for the solution) + + * fstream.cpp : Win32 text mode : bugs fixed, SGI code used. + fixed _M_open() creation flags for Win32 (thanks to Mike Pyle for the report) + + * "install" target added for VC++ to install .dll's into Win system directory. + + * __STL_USE_STATIC_LIB switch added to add flexibility to VC++ linking. + + * __stl_debug_message for WIN32/Unicode/MFC improved + (thanks to Edward Ball, Chvetsov for the reports) + + * MVS fix for auto_ptr<> (thanks to Tinny Ng) + + * debug/_tree.h, debug/_vector.h "typename" fixes, thanks to Matti Rintala. + + * c_locale.h : fix for Solaris 2.5.x (thanks to B. K. Oxley) + + * _bvector.h : Watcom compatibility fixed (thanks to Ricardo E. Gayoso for the report) + + * __STL_DONT_REDEFINE_STD flag behaviour fixed + +The following changes were made in 4.0 release candidate 1 since 3.2.2 Beta 4 : + + * Merged changes made to SGI standard library snapshot on 01/28. + + * Fixed bug with istream reading numbers in hex mode (thanks to Dave Abrahams + for the patch). + + * Debug mode redesigned (again) - no extra namespaces is being used + Finally, it works for MSVC and all other platforms. + + * __SGI_STL_OWN_IOSTREAMS made to be the default mode except few platforms + not provided with makefiles to build STLport yet. + + * Changed strategy on redefinig std:: namespace. + prolog/epilog technology used to get clean namespace wrapping. + It also allows for managing stack of pragmas + (see stlport/stl/config/_prolog.h,_epilog.h) to get rid of warnings. + Note : default namespace changed to _STL:: to satisfy implementation + constraints and to allow for more compact symbols. + "stlport::" namespace is still defined for backwards compatibility. + + * iostreams library now compiles on HP with aCC (thanks to Steven Serocki for the patch). + + * Configuration for SUN Workshop 6.0 EA provided. + + * For VC++, corresponding [selected by /MT(d) or /MD(d) switch] + STLport iostreams library is being linked automatically - all you + need is to put library in lib search path or specify additional library path. + + * Ability to turn on all warnings in your own code if you're using + a compiler with appropriate support (e.g. MSVC6). + + * Small fixes posted to the forum integrated: + + * config/stl_wince.h : added __STL_HAS_NO_NEW_C_HEADERS switch + * wrap_std/strsream : fixed preprocessor bug, strstream.h included + when not using new-style headers + * other fixes + +The following changes were made in 3.2.2 beta 4 since 3.2.2 Beta 3: + + * Merged changes made to SGI standard library snapshot on 01/10. + + * Major restructuring of header files - for maintainability and + 8.3 filesystems benefit. + + * Major debug mode improvements - new debug mode now works with + VC++, gcc, intel, SUNpro, MetroWerks. + + * Regression test suite changed to new-style headers - thanks to + Dima Pasechnik for the initial port. + + * fixes for Watcom + + * many miscellanous fixes. + +The following changes were made in 3.2.2 beta 3 since 3.2.2 Beta 2: + + * Merged changes made to SGI standard library snapshot in December. + + * std:: is not used for STLport namespace even with SGI iostreams, + to avoid possible clashes and facilitate 3rd-party library use. + Same macro redefinition technique for stlport:: used to keep clients + code with literal std:: happy as in native iostreams mode. + + * C library headers wrapping changed to allow multiple inclusion tricks + (needed by gcc-2.95 mostly) + + * gcc-2.95 and CodeWarrior configurations updated. + + * HP aCC fixes applied. + + * Visual C++ - added static library targets, build refined. + Fixed memory-mapping bugs. + + * auto_ptr updated, now it passes polymorphic tests with VC++. + + * Many small bugfixes. + +The following changes were made in 3.2.2 beta 2 since 3.2.2 Beta 1: + + * Fixed SUN CC deque<> problem with -g + + * Added configuration and makefiles for DEC VMS, Borland and Win32 gcc. + + * Merged changes made to November SGI standard library snapshot. + + * config changes - "configure" made obsolete and moved into "stlport/config/new_compiler". + + * __STL_TYPENAME_ON_RETURN_TYPE handling changed. + + * Miscellanous fixes. + +The following changes were made in 3.2.2 Beta 1 since 3.2.1 release: + + * SGI iostreams adopted. To use SGI iostreams, user have to set + __SGI_STL_OWN_IOSTREAMS flag and to build the library in "src" + directory to link with. Please read INSTALL file for detailed + instructions. + Default setting is NOT to use SGI iostreams (wrappers used as before). + + * Debug mode completely redesigned - debug mode containers are + implemented in terms of wrappers around non-debug ones. + That provides for more clean and efficient implementation and + binary compatibility between debug and non-debug versions. + + * Additional configurations added for platforms : + - gcc-2.95 + - SUNpro CC 5.0 in "compatibility" mode + "configure" made obsolete. + + * Bugfixes reported by users since 3.2.1 release merged + +The following changes were made in 3.2.1 since 3.2 release: + + * Now, by default, STLPort renames std:: namespace for user + if __STL_USE_OWN_NAMESPACE is used. To make it possible, many new + wrapper headers introduced. Internally, STLport uses stlport:: namespace, + so no link- or run- time clashes are possible, and you don't have to rebuild + the runtime lib (which you don't want to). + This feature makes STLport usable out-of-the box, without any modifications + for client code, with any compiler. + + * Code bloat reduction : hashtable uses vector internally. + + * Vector : efficiency/code bloat reduction fixes. + + * Visual C++ : DLL export is supported for allocators and strings. To use it, + please define __STL_USE_DECLSPEC in all modules and __STL_DESIGNATED_DLL + for the DLL which is supposed to instantiate STLport exports (at least one + source of this DLL must include . + + * Visual C++ : for MT synchronization, is not included anymore. + + * For Sunpro C++ 5.0 : all headers are linked into stlport/SC5, so only + one include path is needed. Note that SC5.0 has problems with relative + search path. It is easy to work around : in your makefiles, instead of + "STL_INCL=../.." , write "STL_INCL=${PWD}/../..". + + * Configuration files provided for compilers : + KAI C++ + DEC C++ (6.x, 5.x) + Borland 5.02 is back on the road (finally !) + + * Windows CE config provided for Visual C++. + + * __STL_NO_IOSTREAMS switch introduced for embedded platforms. + + * Lots of minor config fixes and improvements for various platforms. diff --git a/reactos/lib/3rdparty/stlport/etc/ChangeLog-5.1 b/reactos/lib/3rdparty/stlport/etc/ChangeLog-5.1 new file mode 100644 index 00000000000..73b561383e4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/ChangeLog-5.1 @@ -0,0 +1,8350 @@ +2007-10-21 Francois Dumont + + * src/allocators.cpp: Add missing const_cast in lock free + allocator implementation when _STLP_LEAKS_PEDANTIC is defined. + Thanks trungantran on forum. + +2007-10-07 Francois Dumont + + * STLport 5.1.4 released based on revision 3219. STLport-5.1.4 + tag created. + + * stlport/stl/_stlport_version.h, build/lib/Makefile.inc: Patch + version bump to 5 to prepare next potential patch release. + +2007-10-05 Francois Dumont + + * stlport/stl/debug/_iterator.h, _string.h, src/string.cpp: + Removed useless and even invalid workaround used when + _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND is defined. There is now + only one construct check class __construct_checker, + __msvc6_construct_checker has been removed. + +2007-09-28 Petr Ovtchenkov + + * Platform tested: gcc 4.1.2 20060928 (prerelease) + (Ubuntu 4.1.1-13ubuntu5), i686 GNU/Linux, glibc 2.4; + + * release-shared: fail on list_test.cpp:392 + [CPPUNIT_ASSERT(lint1.size() == 20)], suspected compiler's bug; + 1 fail from 395 tests; + + * stldbg-shared: passed 395 tests; + + * Platform tested: gcc 4.1.2, i686 GNU/Linux, glibc 2.4; + + * release-shared: fail on list_test.cpp:392 + [CPPUNIT_ASSERT(lint1.size() == 20)], suspected compiler's bug; + 1 fail from 395 tests; + + * stldbg-shared: passed 395 tests; + + * Platform tested: gcc 4.2.1, i686 GNU/Linux, glibc 2.4; + + * release-shared: passed 395 tests; + + * stldbg-shared: passed 395 tests; + + * Platform tested: gcc 4.1.1, i686 athlon-4 i386 GNU/Linux, + glibc 2.3.6; + + * release-shared: passed 395 tests; + + * stldbg-shared: passed 395 tests; + + * src/c_locale_glibc/c_locale_glibc2.c: this is a C, so + decl allowd only on top of block; + + * Platform tested: gcc 2.95.4 (debian), i686 GNU/Linux, + glibc 2.3.2; + + * release-shared: build success, as library as unit tests, + but run unit tests fail---stalling on spinlock during library + load; looks like problem with correct initialization of + statics; + + * stldbg-shared: fail build library, stlport/stl/debug/_hashtable.h:49: + declaration of `operator ==' as non-function + +2007-09-27 Francois Dumont + + * src/facets_byname.cpp: In collate::do_transform, consider + low == high as a special case, returns empty string in this + case. + +2007-09-27 Petr Ovtchenkov + + * test/unit/find_test.cpp: array initialization missed. + +2007-09-17 Francois Dumont + + * stlport/stl/_num_get.h: Add _STLP_DECLSPEC specification to + several functions that might be access by external code when + num_get facet is instantiated with something else than the + Standard required instantiation. + +2007-09-11 Francois Dumont + + * src/c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c: Fix + _Locale_strxfrm and _Locale_wcxfrm implementation to take + into account strings that are not zero terminated. + + * test/unit/locale_test.cpp: Add check that collate.tranform + method build a key only for chars in the range pass to method. + +2007-09-10 Francois Dumont + + * src/facets_byname.cpp: John Maddock bug report 1788618 fix. + Moreover remove use of an intermediate buffer to get result + of _Locale_strxfrm. + + * test/unit/locale_test.cpp: Add tests for collate::transform + facet method. + + * src/c_locale_win32/c_locale_win32.c: Small modification, + _Locale_strxfrm is supposed to return the number of chars + required to store the generated sorted key without the trailing + zero. + + * src/c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c: Fix + implementation of _Locale_strxfrm, it should never return -1. + +2007-09-10 Petr Ovtchenkov + + * stlport/stl/_string.c: fix bugs in string rfind, find_last_of, + find_last_not_of [bug #1788700, position 0 was wrongly excluded]; + + * test/unit/string_test.cpp: test for problems above. Thanks + to Bred Bored for bug report and initial test. + + * unit tests: Linux 2.6.16.26 (athlon-4), gcc 4.1.1, glibc 2.3.6 + "OK 395 tests" for release-shared and stldbg-shared targets. + +2007-09-09 Petr Ovtchenkov + + * test/unit/rope_test.cpp, stlport/stl/_rope.h: test for + bug #1788615 [bug during copy of rope's iterator] and fix; + suggested by John Maddock. + + * stlport/stl/_algobase.c: symmetry not required for + comparator in case of two different sequences comparison or + searching; symmetrical comparator just may not exist; + + * stlport/stl/debug/_hashtable.h: symmetry not required for + comparator in hashtable in case of containers extention; + symmetrical comparator just may not exist; + + * test/unit/alg_test.cpp: test for problem above, thanks + Oleg Obolenskiy. + +2007-09-06 Francois Dumont + + * test/unit/strstream_buffer_read_test.cpp: Remove useless + strdup call that was moreover introducing a memory leak. + +2007-09-04 Francois Dumont + + * src/allocators.cpp: Fix implementation of _S_chunk_dealloc when + lock free implementation is not in use. Thanks bug report 1787636 + from Sergej Zagursky. + +2007-08-31 Francois Dumont + + * stlport/stl/_cstdio.h, _ctime.h: Add missing macro definition + test before using _WIN32_WCE thanks bug report 1784174. + + * stlport/stl/_bitset.h: Change macro tests in order to check + macro definition before using it thanks bug report 1785679. + + * test/unit/bitset_test.cpp: Bitset::iostream new test to check + correct input/output of bitset class. + + * build/Makefiles/gmake/gcc.mak: Add -Wundef gcc option when building + with gcc under Cygwin MinGW, it is an interesting option to detect + macro check errors. + +2007-08-26 Francois Dumont + + * stlport/stl/config/user_config.h, host.h: Moved the administrative + _STLP_USE_DEFAULT_FILE_OFFSET macro from user_config.h to host.h. + + * stlport/stl/config/_gcc.h: Under MinGW we now use C symbols in + global namespace. Tests with 4.2.1 gcc version shows that C symbols + are not necessarily put in std namespace. + +2007-08-23 Francois Dumont + + * stlport/stl/_complex.h: As in _iosfwd.h, removed useless + _STLP_CLASS_DECLSPEC attribute on complex class declaration. + +2007-08-23 Petr Ovtchenkov + + * stlport/stl/debug/_vector.h: only random access iterators + allow operations 'less-than' and distance; for bidirectional + iterators removed usage of 'less-than', and for others + [like forward and input iterators] removed as usage of 'less-than' + as distance; thanks Oleg Obolenskiy for bug report; + + * test/unit/ioiter_test.cpp: test for problem above. + +2007-08-18 Francois Dumont + + * stlport/stl/_iosfwd.h: Removed useless _STLP_CLASS_DECLSPEC attribute + on class declaration. Latest gcc versions are reporting a warning about + it. + +2007-08-16 Francois Dumont + + * src/dll_main.cpp: Removed useless _Atomic_swap_struct explicit + instantiation, moreover, MSVC 2005 do not support it. + +2007-08-15 Petr Ovtchenkov + + * Repository: bump lib version to 5.1.4; + + * stlport/stl/char_traits.h, src/fstream.cpp: use 64-bits + file operations calls, if available on system; streamoff is + always off64_t, if _LARGEFILE_SOURCE or _LARGEFILE64_SOURCE + defined, i.e. if 64-bits file operations present; + + * stlport/stl/config/user_config.h: add _STLP_USE_DEFAULT_FILE_OFFSET, + force use off_t for streamoff and appropriate file operations calls; + note, that this may lead to problems, for example if _FILE_OFFSET_BITS + defined as 64 somewhere in user's code; + + * test/unit/fstream_test.cpp: test 64 bits type for filesize and + file offset. + +2007-07-22 Petr Ovtchenkov + + * src/fstream.cpp: force use lseek64/mmap64 for HP-UX, if _LARGEFILE64_SOURCE + defined; thanks for Michael Klein. + +2007-07-17 Petr Ovtchenkov + + * stlport/stl/_algo.c, stlport/stl/_algobase.c: search, the __tmp and + __p1 iterators always point at the same position, hence one of them + is redundant; + + * stlport/stl/_algobase.c: in the main-loop of search there are two + successive while-loops doing exactly the same thing; one of them is + redundant and, since it is inside the main-loop, it slows down + the algorithm significantly; + + * stlport/stl/_algo.c, stlport/stl/_algobase.c: in the search the main-loop + condition "while (__first1 != __last1)" is always true and consequently + redundant; this is because the initial adn in-loop conditions virtually + act as guards and will never let the main-loop condition to fail; since + this condition is evaluated in every main-loop iteration, its removal + will also improve the performance of the algorithm; thanks for + Jim Xochellis for this suggestions. + +2007-07-15 Petr Ovtchenkov + + * src/strstream.cpp: "get end" pointer should be initialized + to the "begin of get + N" in obsolete strstream; bug #1536503, + thanks for Jean-Eric Cuendet; + + * test/unit/strstream_buffer_read_test.cpp, build/test/unit/Makefile.inc: + test for bug above; [submitted by Jean-Eric Cuendet]. + +2007-04-02 Francois Dumont + + * 5.1.3 released based on revision 2983. STLport-5.1.3 tag created. + +2007-03-30 Francois Dumont + + * build/lib/configure.bat: Restore TARGET_PROC_SUBTYPE definition + to distinguish between ARM architectures. + +2007-03-22 Francois Dumont + + * stlport/stl/config/_msvc.h, _deque.h, _bvector.h: Portage from + Ulrich Echkardt to EVC 8. + + * doc/README.evc8, README.wince: New documentations about Windows + CE and EVC 8 from Ulrich Echkardt. + + * doc/evc_workaround.txt, doc/README.evc3, First file merged to the + second one. + + * stlport/stl/_stlport_version.h: Bump patch level to 3. + +2007-03-07 Francois Dumont + + * src/dll_main.cpp, stlport/stl/_stdexcept_base.h: Change strncpy_s + invocation to pass _TRUNCATE parameter rather than number of chars + to put in destination string. Default strncpy_s behavior is not to + truncate string if necessary but to report the issue throught a handler + which lead to an application crash if no handler has been set. Thanks + Bronek Kozicki bug report 1674974. + + * stlport/stl/type_traits.h: Add a default constructor declaration + in _TpWithState class to make gcc happy when class is instanciated + with a class with no default constructor. + + * stlport/stl/config/_windows.h: Change definition of + _STLP_WIN32_VERSION macro. We do not report definition inconsistency + between WINVER and _WIN32_VERSION anymore, WINVER is prefered. + +2007-03-01 Francois Dumont + + * test/unit/bitset_test.cpp: Add test for the to_string member + method. + + * stlport/stl/config/_msvc.h, test/unit/locale_test.cpp: Change + MSVC6 configuration that now defines _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS. + Even if MSVC6 supports explicit specification of function template + parameters it do not support the explicit specification for + template methods, unit tests are showing this problem. + + * stlport/stl/type_traits.h, _alloc.h: Small change in stateless + class detection feature. Introduce _IsStateless helper struct for + this purpose even if it can only be used with pure class type and + not with build-in types or enum or union. It avoids MSVC8 warnings. + +2007-02-25 Francois Dumont + + * 5.1.2 released based on revision 2937, tag STLport-5.1.2 created. + + * stlport/stl/config/_prolog.h, build/Makefiles/gmake/bcc.mak, + Patch from Eric Sanford to remove empty base class optimization + for Borland compilers. + + * test/unit/vector_test.cpp: Enable VectorTest::ebo test for Borland + compilers. + +2007-02-22 Francois Dumont + + * stlport/stl/_alloc.h: Add a workaround for compilers with buggy + empty base class optimization which is used in _STLP_alloc_proxy + class. + + * test/unit/vector_test.cpp: New test case VectorTest::ebo to show + problem above. + +2007-02-21 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Fixed __ConvertDate and + __ConvertTime to avoid potential infinite loop (bug report + 1663604) + +2007-02-16 Francois Dumont + + * STLport 5.1.1 released based on revision 2919. STLport-5.1.1 + tag created. + +2007-02-14 Francois Dumont + + * stlport/stl/config/_intel.h: Configuration fix, Intel compiler + before 8.1 have problem with template method specialization. Thanks + Dragan Tubic. + +2007-02-09 Francois Dumont + + * test/unit/locale_test.cpp: Enhance LocaleTest::collate_facet + test case to reveal a bug in glibc localization portage. + + * src/c_locale_glibc/c_locale_glibc2.c: Fixed _Locale_strcmp + and _Locale_strcmp and _Locale_strwcmp implementation to take + into account buffer size, comparison used to always been done on the + whole input strings up to the termination character. + + * stlport/stl/type_manips.h, test/unit/mvctor_test.cpp, + type_traits_test.cpp: Remove relation between STLport __true_type and + __false_type and homonyms ones in libstd++. Add workaround in the 2 + test suite requiring use of those types. + +2007-02-08 Francois Dumont + + * stlport/stl/_threads.h, src/locale.cpp: Add missing parenthesis + in some macro checks thanks Jan Echternash bug report 1653966. + + * test/unit/locale_test.cpp: Made LocaleTest::collate_facet test + really meaningful even if it requires french locale support for + part of it. + +2007-02-01 Petr Ovtchenkov + + * stlport/stl/config/_solaris.h: __LONG_MAX__ defined on + 64-bits SPARCs. Thanks Aleksey Sanin. + + * stlport/stl/_sparc_atomic.h, stlport/stl/_threads.h: + fixes for modern SPARCs. Thanks Aleksey Sanin. + +2007-01-28 Francois Dumont + + * stlport/stl/debug/_deque.h: Fix iterator invalidation in erase + of an iterator range thanks to Steve Lobasso indirect report (bug + 1645657). + + * test/unit/deque_test.cpp: New test case for deque erase methods. + +2007-01-19 Francois Dumont + + * stlport/stl/_locale.h, src/locale.cpp: Add throw() specification + on locale default constructor. Add const qualifier on locale::combine + method. Fixed combine implementation to correctly combine + *this with other locale instance. + + * src/locale_impl.h: Removed _get_Locale_impl and + _copy_Nameless_Locale_impl already defined in stlport/stl/_locale.h. + + * src/locale_impl.cpp: In _Locale_impl::insert add check that we + are working on 2 different facet instances before substitution. + + * test/unit/locale_test.cpp: Add test case for locale::combine + method. + +2007-01-12 Francois Dumont + + * c_locale.h, c_locale_dummy.c, c_locale_glibc.c, c_locale_glibc2.c, + c_locale_win32.c: Creation of 2 new functions in the localization + framework _Locale_init and _Locale_final to allow localization + implementations to initialize and release any necessary resources. + + * src/iostream.cpp: Call _Locale_init during io streams initialization + and _Locale_final at end. + + * c_locale_win32/c_locale_win32.c: Add synchronization for locale + lcid look up from name required in multithreaded environment. Two + threads instanciating two facet instances from a given name might + have collide resulting in an undefined behavior. Critical section + used for synchronization is initialized in _Locale_init and freed + in _Locale_final. + + * c_locale_win32/c_locale_win32.c: Add several fields in + _Locale_time struct to avoid use of static buffers in some locale + support functions like _Locale_d_t_fmt _Locale_long_d_t_fmt... + Moreover time format cannot be truncated anymore. + +2007-01-08 Francois Dumont + + * stlport/stl/_deque.c: Patch from Kevin Lin to fix iterator + returned by insert at position method. + + * test/unit/deque_test.cpp: Add test case for the deque::insert + methods. + +2006-12-06 Francois Dumont + + * STLport 5.1.0 released based on STLPORT_5_1 branch revision 2750. + +2006-11-27 Francois Dumont + + * stlport/stl/config/_windows.h: Patch from Michael Fink to check + inclusion of winbase.h and windows.h. + +2006-11-24 Francois Dumont + + * stlport/stl/_fstream.h, src/fstream.cpp, iostream.cpp: Restore + computation of the system dependant page size that was hardcoded + to 4096. Initialisation code has been moved to a static method + called just after Standard iostream initialisation. This code used + to be in the _Filebuf_base constructor that might have been called + simultaneously by several threads. + +2006-11-17 Francois Dumont + + * stlport/stl/config/_macosx.h: Add endianess configuration. + +2006-11-16 Francois Dumont + + * test/unit/resolve_name.cpp: Clean most of MSVC6 workaround, only + one has been kept to have the test pass. + +2006-11-13 Francois Dumont + + * stlport/stl/_cwchar.h: Patch from Michael Fink to fix EVC3 + missing mbstate_t definition. + +2006-11-07 Francois Dumont + + * stlport/stl/_threads.h: Removed _Atomic_swap_struct export + that should be useless as completely inlined. Moreover it was + generating a compilation error using MSVC 2005 under Windows + 64 bits. + +2006-10-26 Francois Dumont + + * test/unit/codecvt_test.cpp: Removed try/catch blocks not + supported by platform missing exception support and moreover + useless as we know the code called in the try and this code + do not throw (thanks Michael Fink report). + + * build/Makefiles/nmake/targetdirs.mak, lib/clean.mak, app/clean.mak: + Complete clobber and distclean rules to really clean all generated + stuffs. + + * build/Makefiles/nmake/top.mak: Patch from Gary Bartlett to make nmake + 'all' rule the default rule. + +2006-10-25 Francois Dumont + + * src/dll_main.cpp: Fix syntax error '>>' rather than '> >' in + a _STLP_alloc_proxy explicit instanciation. + + * stlport/stl/_unordered_set.h: Fix template method for the + associative container extension, use _KT type rather than key_type. + +2006-10-20 Francois Dumont + + * stlport/stl/config: Removed some used macros + _STLP_AUTOMATIC_TYPE_TRAITS + _STLP_UNINITIALIZABLE_PRIVATE + _STLP_STATIC_ARRAY_BUG + _STLP_FULL_ADL_IMPLEMENTED + + * test/unit/codecvt_test.cpp: Ignore test when + _STLP_NO_MEMBER_TEMPLATES defined. + +2006-10-20 Petr Ovtchenkov + + * stlport/stl/_cwchar.h: fix HP-UX problem with WCHAR_MIN, WCHAR_MAX + [Boris Gubenko]. + +2006-10-19 Petr Ovtchenkov + + * test/unit/sstream_test.cpp: check bugreport #1580020, not confirmed; + [bug in gcc 4.1.2-svn, compiler under development]. + +2006-10-17 Francois Dumont + + * stlport/stl/_cwchar.h: Restore code to define potentially missing + WCHAR_MIN, WCHAR_MAX macros. It used to be in _mbstate_t.h but was + missing some native includes to work, in _cwchar.h everything should + be fine. + + * test/unit/codecvt_test.cpp: Fix C cast that was losing const + qualifier. + + * stlport/stl/_mbstate_t.h: Avoid definition of _STLP_NO_MBSTATE_T when + using own mbstate_t definition in _STLP_USE_NO_IOSTREAMS mode. This macro + is not supported anymore and should be fixed or removed in future version. + Own mbstate_t will be defined even in no iostreams mode. + + * stlport/stl/config/_evc.h: Now that mbstate_t situation is clear EVC3 + defines _STLP_NO_NATIVE_MBSTATE_T rather than directly defining it in + the config file. + + * test/unit: Several fixes to build with _STLP_NO_EXTENSIONS and + _STLP_NO_ANACHRONISMS. + +2006-10-16 Petr Ovtchenkov + + * stlport/stl/_mbstate_t.h: this header may be included from system + stddef.h, without wchar.h---defines of wchar limits isn't good place + here [WCHAR_MAX, etc.]. + + * test/unit/cwchar.cpp: correct test to hilight problem above. + +2006-10-14 Petr Ovtchenkov + + * test/unit/cwchar.cpp, build/test/unit/Makefile.inc: test a few macros + related to wchar. Inspired by problems in STLPORT_5_1 and boost::regex. + +2006-10-12 Francois Dumont + + * stlport/stl/_numpunct.h, src/numpunct.cpp: numpunct facet _M_truename + _M_falsename and _M_grouping are not static anymore. This seems useless + and moreover was introducing static initialisation order and threading + issues. + + * stlport/stl/c_locale.h, _mbstate_t.h, src/c_locale.h, c_locale.c: + New mbstate_t policy. When no mbstate_t in native library STLport defines + one for its own need in localisation support. This mbstate_t is simply + an int defined in global namespace and imported to STLport namespace. + Internal localisation framework is nt anymore in STLport namespace but + in the global one as it is normaly a C framework. + + * stlport/stl/config/_bc.h: Defines _STLP_NO_NATIVE_MBSTATE_T rather + than internal _STLP_USE_OWN_MBSTATE_T macro. + + * stlport/stl/config/_evc.h: Add comment for EVC3 users, this platform + should define _STLP_NO_NATIVE_MBSTATE_T, but I have not the platform + to check... + + * build/Makefiles/gmake/bcc.mak: Do not force anymore built of C sources + as C++. + + * test/unit/string_test.cpp, istmit_test.cpp: Fixed macro checks to make + tests buildable even when _STLP_NO_IOSTREAMS is defined. + +2006-10-09 Francois Dumont + + * test/unit/codecvt_test.cpp: Fix use of mbstate_t to make it more + portable. + +2006-10-06 Francois Dumont + + * stlport/stl/_alloc.h, _alloc.c: Fixed __debug_alloc implementation + to avoid unjustified assertion about wrong size of buffer to + deallocate, thanks David Deakins and verntx on sourceforge. + + * test/unit/vector_test.cpp: Add test for bug above. + + * stlport/wchar.h, stl/_cwchar.h, _istream.h, _limits.h, _locale.h, + _threads.h, char_traits.h, type_traits.h, _mbstate_t.h: Fix regression + introduce by inclusion of mbstate_t.h in wchar.h. Now _mbstate_t.h is + only included at end of wchar.h and _cwchar.h. All places where _mbstate_t.h + was used are now including _cwchar.h. + +2006-10-05 Francois Dumont + + * build/Makefiles/gmake/bcc.mak: Use -P compiler to force build of C + translation as C++ because of the mbstate_t problem. + + * build/Makefiles/gmake/lib/bcc.mak, rules-a.mak: Fix Borland tlib call + syntax thanks mbkenny. + + * stlport/stl/wchar.h: Add include of internal _mbstate_t.h file to + know STLport status regarding mbstate_t configuration. + + * stlport/stl/c_locale.h: When building platform localisation support + as C++ struct declaration are done in STLport namespace. + + * src/c_locale.h: Removed _mbstate_t.h include that is now included + from wchar.h or _cwchar.h depending on C or C++ build. Removed #error + done too early (see next comment). + + * src/c_locale.c: Add #error statement when building STLport on a platform + having real localisation support but no native mbstate_t definition. In this + case c_locale.c must be built as a C++ translation unit. + + * src/c_locale_win32/c_locale_win32.c: Add Borland workaround to avoid + compilation error now that it is build as a C++ translation unit. + + * stlport/stl/_mbstate_t.h: Now that this file is not included from outside + world we can include internal _cwchar.h rather than cwchar. Removed + a wint_t workaround already existing in _cwchar.h. Removed Borland workaround + that was defining mbstate_t when using this file in a C context, it was + moreover different than the definition in C++ ! Add a pure C declaration of + mbstate_t when in C. + +2006-10-04 Francois Dumont + + * src/c_locale.h: Add #error to signal issue when building c_locale.c + as a C source when STLport uses its own mbstate_t definition. + + * src/num_put_float.cpp: Modification in Cygwin native lib headers + revealed that we were missing ieeefp.h include. + + * src/dll_main.cpp, stlport/stl/_threads.h: Fix export of + _Atomic_swap_struct for compilers supporting export of templates. + + * stlport/stl/config/_hpacc.h: Some cleanup (unknown _STLP_NO_KOENIG_LOOKUP + macro) and formating fixes. + + * stlport/stl/_bvector.h: Use _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS + rather than reproducing the workaround hidden by this macro. + + * test/unit/vector_test.cpp: Add test case to check iterators comparisons. + +2006-09-26 Francois Dumont + + * src/allocators.cpp: Reorder code blocks to fix build when using + _STLP_LEAKS_PEDANTIC. + + * stlport/stl/_num_put.c: Restore __len >= 2 check in + __copy_integer_and_fill function. It has been removed on the + 2006-07-11, at this time STLport always add the base information + even for 0 value. This modification has been rollback but not this + check. + + * test/unit/num_put_get_test.cpp: Add check for above fix. + +2006-09-26 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Add check of code page when + specified in locale name. + + * src/c_locale_win32/c_locale_win32.c: Add checks in __ConvertDate + and _Locale_t_fmt to avoid potential buffer overflow. + + * src/c_locale_win32/c_locale_win32.c: Create __GetLocaleInfoUsingACP + function that merge a call to GetLocaleInfoA and a call to + __ConvertFromACP in one call, the latter function has been removed. + + * src/c_locale.h: Restore _STLP_BEGIN_NAMESPACE when STLport use + its own mbstate_t definition which is only available in STLport + namespace. Fix Borland regression. + + * stlport/stl/_mbstate_t.h: Replace stl/_cwchar.h include with + a cwchar one as this file is included from the outside world when + building STLport lib. + +2006-09-25 Francois Dumont + + * test/unit/codecvt_test.cpp: New test case for the codecvt + facet. + + * test/unit/unordered_test.cpp: size_t replace by int to avoid + 64bits issue warning. + +2006-09-21 Francois Dumont + + * stlport/stl/c_locale.h: Patch from Boris Gubenko to avoid + direct inclusion of internal header from this header that is + access from the outside world when building STLport lib. + +2006-09-20 Francois Dumont + + * test/unit/allocator_test.cpp: Add new test case for allocation of + empty buffer. + + * test/unit/fstream_test.cpp: Use a variable to always point to the same + test file and adopt a 'Standard' file name 'test_file.txt'. + + * stlport/stl/_hash_fun.h: Rollback 2006-08-26 Petr modification that + was introducing a regression with MSVC compilers. + + * stlport/stl/_fstream.c: First attempt to fix seekoff basic_filebuf + implementation when dealing with a codecvt facet having variable + encoding. This fix is surely not complete, discussion with Uli is not + over. + +2006-09-13 Francois Dumont + + * stlport/stl/_exception.h: Made a previously general Windows 64 bits + workaround specific to the cross compiler coming with PSDK. Thanks + Igor Pavlov. + +2006-09-11 Francois Dumont + + * stlport/stl/_num_put.c: Modification in __do_put_integer to avoid + a Hp aCC workaround. + +2006-09-11 Petr Ovtchenkov + + * stlport/stl/_algo.c: search_n with predicate fail in case + when subsequence size is 1; thanks Timmie Smith. + + * test/unit/alg_test.cpp: test for problem. + +2006-09-08 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Modification in __GetLCIDFromName + to support the Chinese_Taiwan locale. Add of a __GetLCID call when first + call to it using non NLS mapping fails. + + * src/c_locale_win32/c_locale_win32.c: Change __ParseLocaleString + implementation to correctly handle locale with a name having '.' in + the language or country part like in 'Chinese_Hong Kong S.A.R..950'. + +2006-09-05 Francois Dumont + + * build/lib/configure.bat: Fixed comment for --rtl-dynamic and + --rtl-static options, impact on macros to uncomment in hosts.h + config file was inversed. Thanks Igor Pavlov. + + * build/lib/configure.bat, doc/FAQ, doc/README.msvc, + stlport/stl/config/user_config.h, _hpacc.h: Replaced references to + _site_config.h by hosts.h. Thanks Igor Pavlov. + +2006-08-30 Francois Dumont + + * stlport/stl/_cmath.h, _cstdlib.h: Patch from Boris Gubenko, Hp aCC + native Standard lib already define math functions in global namespace. + + * stlport/stl/_num_put.c: Patch from Boris Gubenko, Hp aCC before version + 60000 do not consider 'const ptrdiff_t' as const enough to be used in a + static buffer declaration. + +2006-08-26 Petr Ovtchenkov + + * stlport/stl/_hashtable.c: allow smaller bucket counts for + hashtable. Thanks Herbert Duerr. + + * stlport/stl/_hash_fun.h: use primary types for hasher, not + typedefs. + + * stlport/stl/type_manips.h: workaround for __true_type/__false_type + for various versions gcc (oh, yes, gcc, it's real pain to detect + real version of libstdc++) + +2006-08-10 Petr Ovtchenkov + + * stlport/stdlib.h: include errno.h for aCC, in case of -mt option in force. + This solve errno problem on HP-UX. Thanks Boris Gubenko. + +2006-08-09 Francois Dumont + + * stlport/stl/config/_msvc.h: Add _STLP_NORETURN_FUNCTION for MSVC + compilers. + + * stlport: Move place of _STLP_FUNCTION_THROWS in function declaration to + make msvc compiler happier, gcc do not care about position of this + attribute. + + * stlport/stl/_ioserr.h: Fixed specification of STLport configuration file + in #error statement. + +2006-08-04 Francois Dumont + + * stlport: Create _STLP_FUNCTION_THROWS depending on _STLP_NORETURN_FUNCTION + and also taking into account exception handling configuration. + + * test/unit/alg_test.cpp, istmit_test.cpp: Fixes to make test buildable with + native compiler Standard library. + +2006-08-03 Francois Dumont + + * build/Makefiles/nmake/evc8.mak: Patch from Ulrich Echkardt to activate + whole program optimization. + +2006-07-31 Francois Dumont + + * Patch from Michael Fink to fix EVC emulator build. + +2006-07-26 Francois Dumont + + * src/fstream.cpp: Fixed MMAP_CHUNK definition, an offset type is signed. + + * Creation of the 5.1.0 RC2 package. + + * Creation of STLPORT_5_1_RC2 tag + +2006-07-25 Francois Dumont + + * stlport/stl/config/_system.h, _windows.h: Fixed MinGW config that also + need _windows.h. + + * stlport/stl/config/_mingw.h: Removed, conflict with platform system + header. + +2006-07-22 Francois Dumont + + * stlport/stl/config: Add _STLP_PLATFORM and _STLP_COMPILER repectively + containing STLport detected platform and compiler names. Some names + are surely not accurate and will be fixed but introducing those macros, + especially _STLP_COMPILER, help to report detection issue. + + * stlport/stl/config/_system.h: Change macro checks in order to guaranty + that only one platform and only one compiler configuration file will be + included. + + * stlport/stl/config/_cygwin.h, _mingw.h: Added + + * stlport/stl/config/features.h: Removed _STLP_NO_MEMBER_TEMPLATE_CLASSES + check when _STLP_USE_TEMPLATE_EXPRESSION is activated. + + * stlport/stl/config/_gcc.h, features.h: Add _STLP_NORETURN_FUNCTION + to signal function not returning, under gcc we use __attribute__((noreturn)). + + * src/locale_impl.h, stlport/stl/_ios_base.h, _locale.h, _range_errors.h, + _rope.h, _string_base.h, _vector.h, debug/_debug.h: Add + _STLP_NORETURN_FUNCTION to function that encapsulate raising of exceptions. + This help to limit warnings about uninitialized variable before use under + gcc. + +2006-07-18 Francois Dumont + + * test/unit/unordered_test.cpp: Change Key data type from size_t + to the more portable int. Fix what seems to be a bad code generation + of gcc under Linux 64 bits resulting in a test failure. + +2006-07-17 Francois Dumont + + * test/unit/alg_test.cpp: New test for find_first_of algo. + + * stlport/stl/config/user_config.h, features.h: string template + expressions is not a transparent feature, some compilers (VC6) + are experimenting ICE with it or some other (gcc) do not accept + it when extending string class (see mystring in + test/unit/string_test.cpp). So default STLport configuration will + be without string template expression, _STLP_DONT_USE_TEMPLATE_EXPRESSION + has been replaced by _STLP_USE_TEMPLATE_EXPRESSION. + +2006-07-16 Francois Dumont + + * test/unit/mvctor_test.cpp: Patch from Michael Fink to avoid a EVC + ARM crash. + +2006-07-13 Francois Dumont + + * stlport/stl/_num_put.c: Rollback modif above, according C printf doc + 0 value shouldn't show their base. + + * stlport/stl/type_traits.h: Avoid instanciation of _IsCVConvertible if + not dealing with pointers. Systematical instanciation was giving + compilation error as soon as type had a special memory alignment, such + types cannot be pass by value in function calls. Thanks andy2222 from + sourceforge. + + * build/Makefiles/nmake/evc3.mak, evc4.mak, evc8.mak: Patch from Ulrich + Eckhardt to remove commctrl.lib dependency, for the moment evc3 and evc4 + only contains a note about this potentially useless dependency. + + * stlport/stl/debug/_string.h: Add missing copy methods in the debug + string implementation thanks Patrick Bennett report. + + * test/unit/string_test.cpp: New copy test case for string::copy. + + * stlport/stl/_algo.h: Add missing _STLP_PRIV namespace scope in calls + to __find_first_of thanks Patrick Bennett report. + +2006-07-11 Francois Dumont + + * stlport/stl/debug/_deque.h, _list.h, _slist.h, _string.h, _vector.h: + Extend use of _Non_Dbg_iter function in all template methods dealing + with iterator range. + + * _num_put.c: Fix to show base in octal or hexadecimal mode even for + 0 value. + + * stlport/stl/_istream.c: Avoid modification of value to extract in + formatted input of short and int when value would overflow. + + * test/unit/num_put_get_test.cpp: Add some tests for above fixes. + + * test/unit/iostream_test.cpp: New tests for general stream + manipulations. + + * stlport/stl/_istream.h: Fix ws iostream function, it do not set failbit + anymore when stream is in eof state. + + * build/lib/msvc.mak: Generation of config.mak is not mandatory anymore + as Intel compiler do not need it for the moment. Only a COMPILER_NAME + is mandatory which is given by icl.mak for Intel compilers and by + config.mak for Microsoft ones. + +2006-07-10 Francois Dumont + + * stlport/stl/debug/_iterator.h: Creation of _Non_Dbg_iter function + returning native iterator of special debug iterator with + compilers supporting partial template function ordering. Fix + a MSVC .Net 2003 issue that seems to be related to a too important + template depth. + + * stlport/stl/debug/_deque.h, _list.h, _slist.h, _string.h, _vector.h: + Use new _Non_Dbg_iter function in constructors from iterator + range. + +2006-07-07 Petr Ovtchenkov + + * build/lib/configure: rollback changes 4 Jul 2006 19:42:55, + it's definitely wrong (phrase with quotes ['] requires double + quotes ["]). + +2006-07-06 Francois Dumont + + * stlport/stl/_num_put.c: Small refactoring with introduction + of the __do_put_integer function for integer types output. Moreover + static buffer size used for formating is now based on output + type sizeof. + + * stlport/stl/_ostream.c: Add some assertion before cast to check that + no significant digit is lost. Add cast to long in int and short output + in order to make type of expression more explicit and correct. This + fix the bug report from Geoffrey Bache on sourceforge about output of + -1 ont value on 64bits linux. + + * test/unit/floatio_test.cpp: Removed, all code moved to NumPutGetTest + test fixture. + + * test/unit/num_put_get_test.cpp: New, contains all tests regarding + input/output of numeric values (locale independant). + + * test/unit/locale_test.cpp: locale independant tests of numeric input/ + output moved to NumPutGetTest test fixture. + +2006-07-04 Francois Dumont + + * stlport/stl/_rope.h, _rope.c: Patch from Peter Hercek to fix a + missing null termination in rope constructor from a character + and a buffer overrun. + + * stlport/stl/_rope.h: Removed special _S_rounded_up implementation + for other types than char and wchar_t. rope implementation is + expecting this method to always return a size > to the given size in + order to store the terminating null character. + + * stlport/stl/_rope.c: Fix reference counter management to avoid memory + leak in _S_destr_concat_char_iter. + +2006-06-30 Francois Dumont + + * src/num_put.cpp, num_put_float.cpp: Patch from Glen Summers + to fix float output using locale with grouping and float value + has no decimal. + + * test/unit/locale_test.cpp: Add some tests showing above bug. + +2006-06-29 Francois Dumont + + * stlport/stl/_algo.h, _algo.c, _algobase.h, _algobase.c, + _hashtable.c: Patch from Andriy Syrovenko to fix implementation + of __equal_range, __lower_bound, __upper_bound when dealing with + a key whom type is different from the value_type of the iterator. + + * test/unit/equal_test.cpp: Add some tests to show above bug. + +2006-06-28 Francois Dumont + + * stlport/stl/_string_sum_methods.h, debug/_string_sum_methods.h: + Small refactoring and simplification of code to avoid a parameter + with default value. This fixing an ICE using MSVC6. + + * test/unit/string_test.cpp: Ignore the newly introduce te_tmp + test using MSVC6. + +2006-06-27 Petr Ovtchenkov + + * stlport/stl/_list.h: fix bug in list.swap, thanks Viktor Govako. + + * test/unit/list_test.cpp: test for bug above. + +2006-06-27 Francois Dumont + + * build/lib/configure: Add --with-lib_motif option to grant STLport + users the possibility of tweaking the generated libraries name. + + * build/Makefiles/gmake/unix/lib.mak: Add code to take into account + configured lib motif in generated library name. + + * build/Makefiles/gmake/netware/lib.mak: Looks like it needs same + defines as the ones in cygming/lib.mak so we simply include this + file. + + * stlport/stl/config/_evc.h: Patch from Michael Fink to fix a + compilation error. + + * test/unit/cppunit/cppunit_mini.h: Patch from Michael Fink to + avoid unused parameter warning. + +2006-06-23 Francois Dumont + + * stlport/stl/_pair.h, _bvector.h, config/_evc.h: Patch from + Ulrich Eckhardt to extend an evc4 MIPS workaround for eVC8 + and to generalize little endian configuration. + + * DMC patch from Eric Sanford. Define _STLP_NO_FUNTION_TMPL_PARTIAL_ORDER + so that many ignored unit test could be now passed. Also specify + Intel 386 instruction set during compilation to limit link errors. + +2006-06-22 Francois Dumont + + * stlport/stl/_algobase.c: Removed check of equivalent predicate + commutativity in find algorithm. In this case, equivalence relation + might have been implemented using a member operator == which is + not commutative thanks Grisha Spivak report. Other checks that are + using an explicit predicate parameter has been kept even if it forces + STLport users to implement commutative functor. + + * test/unit/find_test.cpp: Add test to show above issue. + + * stlport/stl/_hashtable.c: Removed equivalent predicate checks + that are useless as in _STLP_DEBUG mode the debug wrapping add this + check in the functor used to instanciate the non debug hashtable + implementation. + +2006-06-19 Francois Dumont + + * STLport 5.1.0 candidate released. STLPORT_5_1 branch created in + CVS. Version tagged STLPORT_5_1_RC1. + +2006-06-17 Francois Dumont + + * test/unit/type_traits_test.cpp, uninitialized_test.cpp: Add + explicit public inheritance relation to avoid an ICL warning. + + * stlport/stl/config/features.h: Add definition of + _STLP_DEBUG_LEVEL to _STLP_STLPORT_DBG_LEVEL when _STLP_DEBUG + is defined but _STLP_DEBUG_LEVEL hasn't been set. + (thanks an ICL warning report) + + * stlport/stl/config/_intel.h: Remove undef of + _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT, even if the linker complains + about not finding unexpected_exception it looks like it finally do + not use it. + + * test/unit/cppunit/test_main.cpp: Filter definition of + unexpected_exception when building unit test with static STLport + lib. + +2006-06-15 Francois Dumont + + * stlport/stl/config/features.h: Several macro renamed: + - _STLP_LONG_DOUBLE -> _STLP_LONGEST_FLOAT_TYPE + - __DFL_TMPL_PARAM -> _STLP_DFL_TMPL_PARAM + - __DFL_TYPE_PARAM -> _STLP_DFL_TYPE_PARAM + - __DFL_NON_TYPE_PARAM -> _STLP_DFL_NON_TYPE_PARAM + __DFL_TYPE_ARG removed. + + * stlport/stl: Add char_traits template parameter in all + istreambuf_iterator and ostreambuf_iterator instanciation where it + was missing as some compiler might not have supported it. + + * stlport/stl/_time_facets.h, src/locale_impl.cpp: Finaly adopt a + specific gcc workaround for definition of _Locale_time_extract_hint + as friend of time_get_byname facet. Gcc 2.95 prefers to see a template + method otherwise it emits a warning, we want to avoid STLport users + to have to disable this warning. Other compilers will use a simple + function which seems to be more portable. + + * stlport/stl/_vector.h, _pair.h: Patch from Eric Sanford for a + really weird Borland compiler workaround that consists in adding + a _Ret typedef in __move_traits or __type_traits traits struct + that do not normally contain it. + + * stlport/stl/config/_bc.h: Borland free compiler do not support + STLport container extension of template methods. + +2006-06-14 Francois Dumont + + * test/unit: Patch from Ulrich Eckhardt to fix storage of string + literals to const char* rather than simple char*. + + * build/Makefiles/nmake: Ulrich Eckhardt patch: + - /MACHINE:IX86 is obsolete and only supported for backward + compatibility as alias for X86. Replaced all cases of IX86 + with X86. + - /NODEFAULTLIB:OLDNAMES.lib seems to also be universal so I + moved it to the base, too. + - In order to use main() as entry point under CE, use linker + option /ENTRY:mainACRTStartup. This was already done for + evc3,4,8 but I moved it to app/evc-common.mak and documented + it. + + * stlport/stl/_cmath.h, config/_evc.h: Uli patch to activate long + double support for EVC and use _hypot to implement STLport + overload. + + * src/complex.cpp: Remove internal __stlp_hypot that is not necessary + anymore now that STLport always define a hypot function (thanks Uli + remark). + + * stlport/stl/config: Ulrich Eckhardt VC8/CE patch: + - Adapt the code to construct the paths to the native includes + so that it matches the changed structure. This is currently + only for ARM and might need more work for other targets (x86 + works though). + - Make a distinction between the desktop and CE variants concerning + the exception support functions. These now use the same compiler + versions so that can't be used anymore. + - MS' safe string functions are not available under CE - I think, + need to take a closer look at Platform Builder. + + * stlport/stl: Ulrich Eckhardt to adapt STLport to VC8/CE limited + native C library. + +2006-06-13 Francois Dumont + + * stlport/stl/pointers/_tools.h: Add partial specialization for + _IteWrapper helper struct so that when type to store and stored + type are identical input iterators are not wrapped. Otherwise input + iterators are wrapped to perform necessary casts between pointer type + and void*. + + * stlport/stl/_cmath.h: Fixed macros definition used to define all + math functions for compilers supporting long double but not having + float nor long double C math functions. Thanks Ulrich Eckhardt report. + +2006-06-12 Francois Dumont + + * test/unit/set_test.cpp, map_test.cpp: Replace size_t with the + more portable int type when possible. + + * stlport/stl/pointers/_tools.h: Check that type to store is a + pointer type before modifying predicate type for set container. + Wrapping less functor in all cases was making move semantic tests + to fail as predicate is not then detected as being the STLport + less predicate. + + * stlport/stl: DMC patch from Eric Sanford. DMC do not like __ss + variable that is a reserved keyword. + +2006-06-11 Francois Dumont + + * build/Makefiles/nmake: Patch from Ulrich Eckhardt to use + main rather than WinMain for EVC platform. + + * build/test/unit/gcc.mak: Removed redondant macro definition + _STLP_USE_STATIC_LIB under cygwin/mingw as those definition + are part of base make files. + + * stlport/stl/type_manips.h, _hashtable.h: Eric Sanford workaround + for Borland. + +2006-06-09 Francois Dumont + + * test/unit/cppunit: Patch from Ulrich Eckhardt to + - Removed a few superfluous semicolons. + - Made some constructors explicit. + - Documented the meaning of FileReporter::_myStream. + - Reformatted some things to not exceed 100 chars per + line or use several expressions/statements in one line. + + * build/Makefiles/nmake: Patch from Ulrich Eckhardt to + - adds support for x86 (running on e.g. a PC, so-called CEPC). + - adds support for MIPS or more specifically MIPSII, other MIPS + subtypes can easily be added. + - removes a line "DEFS_COMMON = /D%TARGETCPU%" from the config.mak + file generated for MIPS, the same functionality was moved to the + CPU-specific setups where it is done for other CPUs. + - adds an additional compiler flag so that diagnostics better + match what the VC8 IDE expects. + + * stlport/stl: Patch from Ulrich Eckhardt to + - removes several unnecessary semicolons (typically, when + inlining functions like "void foo() {};" where it in fact doesn't + hurt (due to something I consider an oversight in the standard) + but also doesn't make sense. + - fixes inconsistent indentation in three cases, one with the + preprocessor and two with memberfunction bodies. + + * stlport/stl/pointers/_tools.h: Add missing template method + in _CastTraits helper struct used on compiler with no partial + template specialization support. + +2006-06-08 Francois Dumont + + * stlport/stl/pointers/_tools.h, _set.h: Fix problems reported by + gcc that seems to do more check that MSVC on explicit + instanciation of templates. Especially fixed problem introduce + by STLport extension of set template methods. + + * build/Makefiles/gmake/aCC.mak, lib/aCC.mak: Patch from Boris + Gubenko for Hp aCC build. + +2006-06-07 Francois Dumont + + * stlport/stl/pointers: Restore pointer specialization feature. + Major modifications are: + + - vector specialization is done using a qualified void pointer + in order to keep optimization oportunities when working on + pointers. Using a strict void* was forcing wrapping of iterators + in template method making _BothPtrTypes struct helper failing to + detect both pointer types. + + - Fixed set specialization thanks to explicit instanciation added + in ptrspec_test.cpp. + + - Refactoring of algorithm to find storage type from value type. + +2006-06-02 Francois Dumont + + * build/Makefiles/nmake: Patch from Ulrich Eckhardt for + cleanup. Some script refactoring, wrong OPT_STLDBG_STATIC references + replaced by OPT_STATIC_STLDBG. + + * src: Patch from Ulrich Eckhardt to cleanup locale implementation + and fix time facet creation when using dummy locale implementation. + + * stlport/stl/config/_evc.h: Patch from Ulrich Eckhardt to fix + endianess definition. + + * stlport/stl/debug/_hashtable.h: Create a _DbgEqual functor to + check correct equivalent predicate implementation. Add also + missing hash_func and key_eq methods in this mode. + + * stlport/stl/debug/_tree.h: Small refactoring in _DbgCompare + functor. + + * stlport/stl/type_traits.h, boost_type_traits.h: Restore boost + support. + +2006-06-01 Francois Dumont + + * stlport/stl/_tree.h, _set.h, _map.h, debug/_tree.h: Removed + erase template method extension, might conflict with erase + overload taking an iterator. User workaround will be to use + erase(find(key)). + + * stlport/stl/_hashtable.h, _map.h, _set.h, _unordered_set.h, + _unordered_map.h, debug/_hastable.h: Add template methods extension. + + * stlport/stl/config/features.h: Add management of containers template + method extension. + + * stlport/stl/config/_apple.h, _symantec.h: Config update based on + config that used to be in _tree.h and _hashtable.h to remove + container template methods extensions. + +2006-05-31 Francois Dumont + + * stlport/stl/config/_evc.h: Patch from Michael Fink to add ptrdiff_t + definition and forbid use of _STLP_DEBUG mode for evc 3/4 on ARM. + + * build: Ulrich Eckhardt patch for Microsoft Visual Studio 2005 for + Embedded C++ portage. + +2006-05-30 Francois Dumont + + * stlport/stl/type_traits.h: Rename _Is_Integer<_Tp>::_Integral and + _Is_Rational<_Tp>::_Rational in respectively _IsIntegral<_Tp>::_Ret + and _IsRational<_Tp>::_Ret for naming convention coherency. + + * stlport/stl/type_traits.h: Add _TrivialNativeTypeCopy helper to + handle a number of oportunities to use memcpy/memmove in + uninitialized_* or copy algorithms that was not cover by simply + checking type_traits has_trivial* features. + + * stlport/stl/type_traits.h, boost_type_traits.h: Refactor _BothPtrType + implementation, only one version is necessary as it uses _IsPtr that + has a variable implementation depending on config. + + * stlport/stl/_vector.h: Add _DefaultZeroValue specialization for + vector container so that a vector of vector is simply initialized + using a memset to set everything to 0. + + * test/unit/vector_test.cpp: Add check that previous optimization + works as expected. + + * stlport/typeinfo.h: Borland patch from Eric Sanford. + + * DMC patch from Eric Sanford + + * stlport/stl/debug/_tree.h: Patch from Ulrich Eckhardt to add missing + count template method. + + * src/dll_main.cpp: Patch from Ulrich Eckhardt to fix strncpy + usage. + +2006-05-23 Francois Dumont + + * stlport/stl/_deque.h, _deque.c: Change implementation to use + _TrivialInit new feature. + + * stlport/stl/boost_type_traits.h: Add _TrivialInit implementation + using boost type traits. + +2006-05-22 Francois Dumont + + * stlport/stl/type_traits.h: Add _TrivialInit helper struct to + report if a type is trivial to initialize or not that is to say + if the type has a trivial default constructor. Handle native types + exception that are consider as having a trivial default constructor + but that required a 0 initialization on explicit constructor + call. + + * stlport/stl/_uninitialize.h: Add a helper function + __uninitialize_init that result in a no-op if _TrivialInit returns + __true_type. + + * stlport/stl/_vector.h: Modification of vector constructor to + destect when it is called without an explicit default value so + that we can call __uninitialized_init. + + * test/unit/uninitialized_test.cpp: Add test to check correct + detection of useless initialization. + +2006-05-19 Francois Dumont + + * test/unit/uninitialized_test.cpp: Patch from Ulrich Eckhardt + to replace vector instance in uninitialized_copy_test by static + array so that we are always working on pointers iterator. + + * stlport/stl/_string_operators.h: Patch from Ulrich Eckhardt to + add missing != operators when using string template expression. + + * stlport/stl/ctype.h, config/_evc.h, _msvc.h, _windows.h, + features.h: Patch from Michael Fink for evc3/4 platform. + + * test/unit/mvctor_test.cpp: Add of a specific Borland test case + to report what seems to be a compiler bug but that is only + revealed when using STLport. + + * stlport/stl/_tree.h, _set.h, _map.h, debug/_tree.h, + pointer/_set.h: Generalized already existing extension of template + find method on associative containers to all look up methods: + count, erase, lower_bound, upper_bound, equal_range. + + * test/unit/set_test.cpp: Add test case for set template methods + extension. + + * stlport/stl/_tree.c, debug/_tree.h: Removed debug check from + non debug implementation, now debug check is injected in tree + implementation from the tree debug implementation thanks to + a wrapping of the predicate. + +2006-05-18 Francois Dumont + + * stlport/stl/c_locale.h: Fix declaration of _Locale_name_hint + struct so that compilers do not think that this struct is in + the STLport namespace because of friend declaration. + +2006-05-17 Francois Dumont + + * stlport/stl/_abbrevs.h: Update list of abbreviations. + + * stlport/stl/_hashtable.c: Removed _Node macro and fixed + macros defined when _STLP_NESTED_TYPE_PARAM_BUG is defined. + +2006-05-16 Francois Dumont + + * test/unit/type_traits_test.cpp: Add test case to check + _TrivialUCopy helper metaprogramming class behavior. + + * stlport/stl/_vector.h, _vector.c: Replaced _TrivialAss by + _TrivialCopy and _TrivialUCpy by _TrivialUCopy for coherency + with type_traits.h names. + + * test/unit/type_traits_test.cpp: Add small test for correct + impact of trivial_destructor meta info in vector implementation. + + * build/lib/configure.bat: Add comment to explain weird TARGETCPU + check. + +2006-05-15 Francois Dumont + + * stlport/stl/_hashtable.h, _list.h, _deque.h, _slist.h, + _string.h, _vector.h, _move_construct_fwk.h, _rope.h: + Fix impact of _STLP_NO_MOVE_SEMANTIC macro on library. Now, + if defined, no move will ever happen. + + * stlport/stl/_uninitialized.h: Simplified __uninitialized_copy_fill + prototype, only one type of iterator is allowed. It also fix + implementation as this one was not taking into account both + iterator value_type to consider if the operation was trivial + or not. + + * stlport/stl/_uninitialized.h: Major code review. Remove use of + _OKToMemcpy, remove dependency on std::copy of std::fill, all + implementation is now similar to the one of std::copy algorithms + except that uninitialized algo are using + __type_traits::has_trivial_copy_constructor meta information and + copy __type_traits::has_trivial_assign_operator. + + * test/unit/deque_test.cpp, vector_test.cpp: New test case for + over optimization problem. + + * test/unit/map_test.cpp, locale_test.cpp, list_test.cpp, slist_test.cpp, + unordered_test.cpp, fstream_test.cpp, stack_allocator.h: Fixed + implementation to build with _STLP_NO_MEMBER_TEMPLATES. + + * stlport/stl/debug/_vector.h, _list.h: Add non template assign + methods used when _STLP_NO_MEMBER_TEMPLATES is defined. + + * stlport/stl/_slist.c: Fixed sort _Slist_sort implementation, now + call _Slist_merge template function rather than slist::merge method + as this method do not take any predicate when _STLP_NO_MEMBER_TEMPLATES + is defined. + + * build/test/unit/Makefile.inc, test/unit/uninitialized_test.cpp: + New test for uninitialized_copy algo. + + * stlport/stl/type_traits.h: OKToMemCpy rename in _TrivialCopy for + coherency with _TrivialUCopy. Moreover, thanks to refactoring in + uninitialized_* algorithms, _TrivialUCopy now only takes into account + __type_traits::has_trivial_copy_constructor meta information and + not has_trivial_assign_operator. + + * stlport/stl/boost_type_traits.h: Fixed to reflect STLport + __type_traits modifications. + + * stlport/stl/_uninitialized.h: Major code review proposed by + Ulrich Eckhardt + + * stlport/stl/_algobase.h, _deque.h, _deque.c, _vector.h, _vector.c, + _rope.h, _rope.c, _string.h, _string.c: Impact of previous point. + +2006-05-05 Francois Dumont + + * test/unit/iter_test.cpp: Removed unreachable code. + + * Introduction of a new configuration macro _STLP_MSVC_LIB + + This macro is set to _MSC_VER value but can be overloaded to + an other value. First intension was to make STLport more flexible + for Intel C++ compiler. This compiler comes without any native + lib and you have to bind it to a MSVC install, Intel compiler + generate MSVC compatible code so that MSVC linker can correctly + generate final exe or dll. To mimic MSVC compiler ICL also defines + _MSC_VER. The problem is that definition of this macro is based + on a compiler option and do not necessarily reflect the MSVC lib + version ICL is binded to. Fortunately the compiler options + responsible of _MSC_VER definition (/Qvc6, /Qvc7...) is also + responsible of name mangling so asking for a MSVC compiler + compatibility different than the library ICL is binded to is + not easy. But _STLP_MSVC_LIB has been kept as it makes STLport + configuration more clean. Now MSVC compiler version is given + by _STLP_MSVC macro and library version by _STLP_MSVC_LIB. + All occurences of _MSC_VER in STLport code has been replaced + by those macros. + + * _STLP_USE_SECURIZED_BUF_FUNCTIONS replaced by the more + intuitive _STLP_USE_SAFE_STRING_FUNCTIONS. + + * stlport/stl/config/_msvc.h: Major refactoring to isolate + MSVC compiler config and MSVC native library config. + +2006-05-04 Francois Dumont + + * build/lib/configure.bat: And information to the --lib-motif + option as advised by Ulrich Eckhardt. Add option parameter and + relation with _STLP_LIB_NAME_MOTIF. + + * src/messsage_facets.h: Removed implementation of private copy + constructor and assignment operator. + + * src/c_locale_win32/c_locale_win32.c: Made + _Locale_extract_category_name locale function static. + + * src/vc_warning_disable.h renamed in warning_disable.h as it is + used by other compilers too (ICL) + + * build/lib/msvc.mak, evc.mak: Removed forced inclusion of + vc_warning_disable.h file. Now this file is included from + stlport_prefix.h. + + * build/test/unit/msvc.mak, evc.mak: Replace vc_warning_disable.h + reference by warning_disable.h. + + * src/stlport_prefix.h: Add inclusion of warning_disable.h. + +2006-05-01 Francois Dumont + + * test/unit/vector_test.cpp, deque_test.cpp, string_test.cpp: + Removed unreachable code, reported by ICL 9.0. + + * test/unit/mvctor_test.cpp: Removed variable declaration hiding + previous one + made local functions static. + + * stlport/stl/config/_msvc.h: Only use abbreviate symbols for + MSVC compiler and not for all compilers defining _MSC_VER. Also + removed some ICL specific configuration. + + * src/lock_free_slist.h: Removed 'no return statement' warning + for ICL too. + + * src/message_facets.h: Made _Message_impl copy constructor and + assignment operator private to avoid warning as _M_cat member + data has private copy constructor and assignment operator too. + + * stlport/stl/_cstdlib.h: Made additional definition of + div(long, long) based on native library (_MSC_VER) rather than on + compiler used (_STLP_MSVC). + + * stlport/stl/config/_intel.h: Fix Intel C++ 9.0 compiler + configuration with and without /Qvc6 option. + + * src/dll_main.cpp: Add std::unexpected implementation that ICL + need but that is not part of MSVC6 native lib library. + + * test/unit/test_main.cpp: Add std::unexpected implementation that + ICL need but that is not part of MSVC6 native lib library. + +2006-04-30 Francois Dumont + + * stlport/stl/_alloc.h: Moved __type_traits specialization for + std::allocator class before use in _STLP_alloc_proxy + instanciation. + + * test/unit/istmit_test.cpp: Fixed macro checks to correctly + report ignored test. + +2006-04-27 Francois Dumont + + * test/unit/full_streambuf.h, deque_test.cpp, vector_test.cpp: + Add STLPORT macro check when checking _STLP_USE_EXCEPTION macro. + + * test/unit/string_test.cpp: Fix some macro checks to correctly + report ignored tests. + + * test/unit/mvctor_test.cpp: Fix tests to build it with native + MSVC 2005 Standard library. Looks like this implementation do + not follow atmortized constant time vector::push_back complexity. + + * stlport/stl/config/_msvc.h: Clearly report status regarding build + of STLport using the MSVC /clr option. + + * stlport/stl/_threads.h: Remove MSVC .Net 2002 annoying warning. + +2006-04-26 Francois Dumont + + * src/ctype.cpp: Fix ctype::scan_is and scan_not method behavior as + required by C++ Standard 22.2.1.1.2. + + * test/unit/locale_test.cpp: Fix ctype facet test according + modifications above. + +2006-04-25 Francois Dumont + + * stlport/stl/_istream.c: Small refactoring to avoid a uninitialized + warning for __do_handle_exceptions local variable. + + * stlport/stl/_deque.h: Ditto with __cur_node variable in + _M_range_initialize method. + + * stlport/stl/_deque.c: Ditto with __cur in _M_fill_initialize. + + * stlport/stl/config/_auto_link.h: Removed auto link feature when + building a C translation unit thanks Michael Fink. + + * src/time_facets.cpp: Add missing calling convention on + __write_formatted_time internal function. + +2006-04-24 Francois Dumont + + * test/unit/cppunit/cppunit_mini.h: Limit scope of try/catch block to + the test case call so that CppUnit function methods are correctly + called. + + * test/unit/type_traits_test.cpp: Fix use of + CPPUNIT_IGNORE/CPPUNIT_STOP_IGNORE macros so that ignored tests are + correctly reported as ignored. + +2006-04-20 Francois Dumont + + * stlport/stl/config/_solaris.h: Replace C++ style comment + in C style. + + * stlport/stl/_cmath.h: Add macro definition for environment + having long double but no float neither long double math functions + This is a Solaris configuration. + + * src/acquire_release.h, c_locale.h, locale.cpp, + locale_catalog.cpp, locale_impl.cpp, locale_impl.h, + message_facets.h, facets_byname.cpp: Add a locale hint feature + to improve locale construction from name. This is used by + Win32 locale implementation that broadcast the locale lcid + thanks to this hint. With this modification, LocaleTest fixture + runs 5 times faster. + + * stlport/stl/_collate.h, _ctype.h, _monetary.h, _numpunct.h, + _time_facets.h: Add _Locale_extract_hint function as friend + to some locale facet in order to access locale implementation + specific structure and potentially extract the hint. + + * stlport/stl/_codecvt.h, _collate.h, _ctype.h, _messages_facets.h, + _monetary.h, _numpunct.h, _time_facets.h: Add _Locale_name_hint pointer + parameter to facet by name constructor. + + * build/Makefiles/nmake/lib/clean.mak, rules-so.mak, rules-install-so.mak: + Based on Dr Dobb's Richard Grimes article, change management of + manifest file for STLport shared library. According this article + .manifest file is not taken into account for a library, only .exe one is. + Solution is to integrate .manifest file into the .dll as an unmanaged + ressource with id 2. We now do so thanks to the mt manifest tool. + + * stlport/stl/_pair.h: Remove __move_traits partial specialization for + Borland free compiler, it was introducing weird compilation error. + + * stlport/stl/_move_construct_fwk.h: Add a helper struct for __move_traits + feature. + + * build/test/unit/msvc.mak: Prepare makefile to easily build unit tests + without STLport. + +2006-04-15 Francois Dumont + + * stlport/stl/config/host.h, compat.h, debug/_debug.c: Removed + _STLP_NO_DEBUG_EXCEPTIONS configuration macro that is similar + to the new _STLP_DEBUG_MODE_THROWS except that new thrown macro + is catchable (std::runtime_error exception) and contained message + is more explicit. + + * stlport/stl/debug/_tree.h: Add find template method STLport + extension to the debug version of binary tree thanks Mike Flamming. + +2006-04-11 Francois Dumont + + * src/complex_io_w.cpp: Removed, content moved to src/complex_io.cpp + to avoid build of an empty translation unit that can generate linker + warning (noticed with MSVC 2005 express) + + * build/lib/Makefile.inc: Updated before of above modification. + + * test/unit: Ignore many tests rather than hide it depending on + build configuration. + + * test/unit/cppunit/file_reporter.h: Restored output existing before + introduction of monitoring feature. + +2006-04-10 Francois Dumont + + * test/unit/cppunit/cppunit_timer.h, test_main.cpp, file_reporter.h: + Add -m option to activate monitoring of unit tests. This option add + timing for each test and a global timing information. Timer class has + been created for Win32 API. + + * stlport/stl/_bitset.h: Hide STLport bitset extensions _Find_first + and _Find_next. + + * test/unit/bitset_test.cpp: Adapt tests to previous modification. + + * stlport/stl/_string.h: Replace memory include with stl/_alloc.h + to limit header dependencies. Also add include of stl/_uninitialized.h. + + * test/unit/fstream_test.cpp: Add missing memory include. + + * test/unit/locale_test.cpp: Ditto. + + * stlport/stl/_queue.h, _string.h, _rope.h, debug/_tree.h: Replace + stl/_function.h include with the smaller _function_base.h include. + +2006-04-07 Francois Dumont + + * stlport/stl/_new.h: Fixed management of _STLP_NO_BAD_ALLOC + and _STLP_NEW_DONT_THROW_BAD_ALLOC macros. + + * stlport/stl/config/_dm.h: Change DMC configuration, use STLport + own namespace rather than std so that STLport can check config. + + * stlport/typeinfo.h: Fix DMC configuration now that it uses own + STLport namespace. + +2006-04-05 Francois Dumont + + * stlport/stl/_tree.h, _list.h: Fixed swap implementation to + correctly swap allocators instance. Moreover list swap implementation + was wrong since list splice has been modified to correctly handled + allocators with state. + + * test/unit/slist_test.cpp, list_test.cpp, set_test.cpp: Add tests for + above fix. + + * stlport/stl/_deque.h: Fix swap method as deque has 2 allocator + instances, this should perhaps be modified one day to only keep 1... + + * stlport/stl/_rope.h: Fix swap method and removed assertion for + equivalent allocator instances even if there are still other assertions + in the implementation. + + * stlport/stl/_function_base.h: Add swap method for less functor if + partial template workaround is activated. This is for surprising + compilers supporting partial template specialization but no template + function partial ordering. + + * stlport/stl/_algobase.h: Add Borland workaround for swap function + thanks Eric Sanford. + + * test/unit/type_traits_test.cpp: Borland workaround for is_convertible + function thanks Eric Sanford. + + * stlport/stl/config/_bc.h: Borland compilers do not support template + function partial ordering thanks Eric Sanford. + + * test/unit/stack_allocator.h: Add Borland workaround to correctly + call StackAllocator::swap method when swaping STL containers in + allocator_with_state tests. + + * test/unit/config_test.cpp: New test + ConfigTest::template_function_partial_ordering. + + * test/unit/slist_test.cpp, list_test.cpp, set_test.cpp: Add swap tests + with empty containers. + + * src/vc_warning_disable.h: Remove deprecated comments. + + * stlport/stl/_pair.h: Removed Borland checks thanks Eric Sanford. + + * Patch from Michael Fink to remove Windows CE support that is + no more supported by Microsoft. + + * stlport/stl/config/_native_headers.h: New, contains all macros + relative to native headers access that used to be in features.h. + + * stlport/stl/config/_evc.h, _como.h: Add include of _native_headers.h + as those compilers need to include native headers for correct + configuration. + + * stlport/stl/config/features.h: Use _native_headers.h. + + * test/unit/locale_test.cpp: Made LocaleTest::facet_id test STLport + specific rather than Borland specific. Moreover, without STLport, test + is ignored rather than hidden. + + * stlport/stl/_num_put.h, _num_put.c: Removed useless export of + num_put, num_put not required by + the Standard. + + * stlport/stl/_num_get.h, _num_get.c: Ditto for + num_get, num_get + + * stlport/stl/_moneytary.h, _moneytary.c: Ditto for + money_get, money_get, + money_put, money_put + + * stlport/stl/_time_facets.h, _time_facets.c: Ditto for + time_get, time_get, + time_put, time_put + + * src/locale_impl.cpp: Removed id initialization of useless facets + no more exported. + + * stlport/new, stl/_new.h: Moved all STLport code in _new.h and + modified new header so that it forwards include to native new + when include comes from inside STLport. + + * cppunit/file_reporter.h, cppunit_mini.h: Change support of + CPPUNIT_CHECK macro, only report error once for all failures + in a single test case. + +2006-03-28 Francois Dumont + + * stlport/stl/_prolog.h: Fix macro check before inclusion of + features.h. + + * stlport/stl/char_traits.h: Fixed include of cstddef, in STLport + code, Standard headers should never be included directly, their + stlport/stl/_xxx.h counterpart should be used. + + * stlport/stl/type_traits.h, type_manip.h: Patch from Eric Sanford + for Borland compiler to fix _OKToMemCpy feature. + + * stlport/stl/_alloc.h: Replace swap function for _STLP_alloc_proxy + by a member method, it is more portable. + + * stlport/stl/_bvector.h, _deque.h, _list.h, _slist.h, _string_base.h + _tree.h: Replaced called to std::swap for _STLP_alloc_proxy instances + by calls to member swap method. + + * test/unit/hash_test.cpp: Ignore test rather than hide it. + + * test/unit/map_test.cpp: Fixed StackAllocator instanciation. + + * test/unit/stack_allocator.h: Add std::swap overload for + StackAllocator>. + + * test/unit/string_test.cpp: Ignore tests rather than hide it. + + * test/unit/unordered_test.cpp: Ditto. + +2006-03-27 Francois Dumont + + * stlport/stl/_stdexcept_base.h: New internal header with + __Named_exception implementation, improve segregation between + and Standard headers. + + * test/unit/locale_test.cpp: Add missing header include. + + * stlport/stl/_function_base.h, _function.h: Move as many functor as + possible from _function_base.h to _function.h to improve + segregation between and Standard headers. + + * test/unit: Add many missing references to header. + + * test/unit: Made unit tests available for build without STLport, this + will be a good way to compare Standard library implementations. + + * stlport/stl/_string_base.h: Remove additional space for terminating + null character, it was actually already reserved in the return + expression. + + * stlport/stl/_string.h: Restored basic_string capacity implementation + that do not depend on use of the short string optimization or not. It + might be hiding a real issue somewhere else in code even if unit tests + are not showing any problem. + + * stlport/stl/_alloc.h: Add swap overload for _STLP_alloc_proxy class + in order to correctly call swap on the maybe rebound allocator as user + that implement an allocator with a state might have implement a + special swap function for it to correctly handle STL containers swap + operation. + +2006-03-24 Francois Dumont + + * build/lib/configure.bat: Removed script for defining INCLUDE + environment variable for Borland ressource compiler as it depends + on where STLport is install. + + * build/lib/bcc.mak: Add check for INCLUDE environment variable + definition. + + * test/unit/string_test.cpp: Change basic_string::reserve test to + check length_error exception rather than bad_alloc. + +2006-03-22 Petr Ovtchenkov + + * stlport/stl/_string.c: a bit code clean + + * stlport/stl/_string_base.h: max_size should keep space for + allocation of terminating null. + +2006-03-19 Francois Dumont + + * stlport/stl/_alloc.h, _function_base.h, type_manips.h, + type_traits.h, test/unit/type_traits_test.cpp: Patch for + Eric Sanford for __bool2type Borland use. + + * build/Makefiles/gmake/lib/clean.mak: Patch from Eric Sanford + to fix files generated by dbg-shared and stldbg-shared rules. + + * build/Makefiles/gmake/lib/bcc.mak: Patch from Eric Sanford to + increase Borland page size to 64. + +2006-03-16 Francois Dumont + + * stlport/stl/config/_evc.h, _msvc.h: Add some condition for + definition of _STLP_MSVC macro which should only be defined for + real Microsoft compilers and not for compiler emulating it. + + * src/allocators.cpp: Use _STLP_STATIC_MUTEX macro in place + of _STLP_mutex_base for mutex definition in per_thread_allocator + implementation. + + * stlport/stl/_pthread_alloc.h: Modified deallocate methods of + pthread_allocator and per_thread_allocator implementation to accept + null pointers. + +2006-03-15 Francois Dumont + + * stlport/stl/_string_base.h, _string.c: Force call to + _M_allocate_block even in short string optim mode in order + to detect lenght error. Based basic_string max size implementation + on allocator max_size. + +2006-03-15 Petr Ovtchenkov + + * stlport/stl/config/_system.h, _msvc.h, _evc.h: move _STLP_MSVC + definition in proper place. + +2006-03-14 Francois Dumont + + * src/allocators.cpp: Fixed thread safety issue in + per_thread_allocator implementation thanks a very old William + Power report. + + * test/unit/allocator_test.cpp: Attempt to write a test case for + previous bug but not yet complete as I need a better debugging + environment than gdb under cygwin... + + * stlport/stl/config/_system.h: Patch from Michael Fink to add + missing _STLP_MSVC define for evc++ compilers. + +2006-03-13 Francois Dumont + + * stlport/stl/_alloc.h, src/allocators.cpp: Hide declaration of + malloc based allocator handler in library. Also limit scope of + declspec to expose static members rather than the whole class. + + * stlport/stl/_cstdlib.h: For Borland compiler add include of + native process.h header, for reason see comment next to include + in file. + + * stlport/stl/_alloc.h: Add a new STLport extension to the + std::allocator class: allocate(size_type, size_type&). This new + overload of allocate returns in an output parameter, the real + size of the allocated buffer that can be larger than the requested + one. _STLP_alloc_proxy expose this new overload only for the + STLport allocator and not for user defined allocators. + + * stlport/stl/_vector.h, _vector.c, _string.h, _string.c: Use of the + allocate overload extension method to set end of storage reference + to the real memory block end rather than to the requested one. + + * stlport/stl/_alloc.c: Adapt __debug_alloc::allocate method in order + to return the real allocated memory block. Also add check on computed + __real_n to allocate as it might roll on size_t and hide a case that + should result in a bad_alloc exception. + + * stlport/stl/_threads.h, src/allocators.cpp: Add WINVER macro + check in addition to _WIN32_VERSION, according PSDK documentation + WINVER is more generaly used accross different Windows platforms. + + * test/unit/string_test.cpp: Add constructor test case to correctly + handle build of a string with string::max_size elements which should + result in a bad_alloc exception. Idem for reserve method. + + * stlport/stl/_alloc.h, src/allocators.cpp: Add check of malloc + result in __malloc_alloc implementation to throw an exception when + result is NULL. + + * src/locale_impl.cpp: Patch from Eric Sanford for Borland BDS 2006 + support. Mostly fix locale facet index issues. + +2006-02-28 Petr Ovtchenkov + + * stlport/stl/_string.h: capacity may return wrong value in case + of no _STLP_USE_SHORT_STRING_OPTIM in use; thanks Rusty Koonce + for report. + + * test/unit/string_test.cpp: test for capacity issue. + + * src/cxa.c: don't use cxa workaround for FreeBSD 6.0---it fine; + this is rollback of changes 2006-01-24 [bad compiler was in use]. + +2006-02-15 Petr Ovtchenkov + + * stlport/stl/_string.h: _STLP_FORCE_STRING_TERMINATION mode become + default and only mode due to performance issue. + + * stlport/stl/config/user_config.h: ditto. + + * stlport/stl/config/features.h: ditto. + +2006-02-14 Francois Dumont + + * stlport/stl/_hashtable.h, _hashtable.c: Add check in _STLP_DEBUG + that equivalent key have same hash code. Fix _M_rehash method + implementation that used to change elements order thanks Big Muscle + effort to report this issue. + + * build/lib/configure: Fix reference to STLport configuration file + in --no-cygwin option description. + +2006-02-13 Francois Dumont + + * stlport: Patch from Eric Sanford to remove many now useless + Borland workaround. + + * src/fstream.cpp: ditto + + * stlport/stl/_monetary.h, _cwchar.h, _algobase.h: ditto + +2006-02-10 Francois Dumont + + * stlport/stl/_iosfwd.h, _locale.h: Removed type attributes on type + declaration, only useful on type definition. + + * src/message_facets.h: Removed unused parameter in _Catalog_nl_catd_map + erase method to avoid warning. + + * src/num_put_float.cpp: Use more macro technique to avoid unused parameters + in *_cvt functions. + + * test/unit/cppunit/cppunit_mini.h: Comment unused parameter. + + * test/unit/cppunit/file_reporter.h: Add base class initialization + in FileReporter copy constructor definition. + +2006-02-10 Petr Ovtchenkov + + * src/num_put_float.cpp: remove usage of static buffers + [potential vulnerabilities]; directly use __iostring instead. + + * test/unit/floatio_test.cpp: test for fixed float output; + cases when fixed float fail on Linux and Solaris, related + with fcvt_r and fconvert calls respectivly commented. + + * build/Makefiles/gmake/gcc.mak: workaround for bug in make 3.79.1 + on Solaris [not pass -D_STLP_DEBUG to CPPFLAGS]. + + * stlport/stl/_string.h: rollback 2006-01-25. + +2006-02-08 Francois Dumont + + * build/Makefiles: Removed all references to BUILD=r in parameters + to ressource compiler in release as there is no more 'r' appended + to the library name in this mode. + + * src/stlport.rc: Fix support for Borland and add check for BUILD + definition before injecting it in original library file name. + + * doc/README.borland: Update doc to signal new prerequisite for + Borland ressource compiler. + + * test/unit/unordered_test.cpp: Add test for unordered_multiset + equal_range method. + + * test/unit/partial_test.cpp: Add test for strict weak ordering + predicate good behavior check. + +2006-02-07 Francois Dumont + + * src/allocators.cpp: New simplification for _Node_Alloc_Lock, + it do not have to be a template class anymore. + + * stlport/stl/debug/_debug.c: Implement + __stl_debug_engine<_Dummy>::_Message even when specifying + _STLP_DEBUG_MESSAGE in order to have explicit instanciation correctly + generated. + + * stlport/stl/_heap.c, _tree.c, _list.c, _slist.c: Add strict + weak ordering checks. + + * stlport/stl/_debug.h, _debug.c: Add new error type: bad equivalent + functor that has to be used in hash container implementation or in + algorithm like find. Check for this functor is: + if (pred(a, b)) assert(pred(b, a) + + * stlport/stl/_hashtable.c: Add equivalent functor checks. + + * stlport/stl/_debug.h, _debug.c: Check _STLP_DEBUG_MODE_THROW in + __debug_engine::_Message method. Now thrown exception will contain + description of the assertion rather than a generic message. + + * build/Makefiles/gmake/bcc.mak: Fix Borland ressource compiler name, + brcc32 not brc32. + + * stlport/stl/_range_errors.h, src/dll_main.cpp: Add + __stl_throw_runtime_error function used to throw exception in + _STLP_DEBUG_MODE_THROW. + +2006-02-06 Francois Dumont + + * build/Makefiles/nmake: Fixed regression generated by a side + effect of Uli patch below. + +2006-02-02 Francois Dumont + + * stlport/config/_stl_evc.h, stl/_config.h: Patch from Ulrich + Eckhardt to signal endianess detection problem and set EVC + endianess for MIPS SDK. + + * src/allocators.cpp: Clean up _Node_Alloc_Lock definition, only + specialization are now available for thread safe and not thread + safe builds. Make easier definition of internal static mutex. + + * stlport/float.h: Patch from Eric Sanford for Borland NaN management + + * stlport/cfloat: Include STLport float.h rather than native one in + order to use potential internal workaround. + + * stlport/stl/config/_ibm.h: Replace all C++ comment by C comments. + + * stlport/errno.h: For Borland, when building for a single threaded + contex, errno is not a macro and is defined in std namespace so using + have to get the symbol in this namespace. + +2006-01-31 Francois Dumont + + * src/allocators.cpp: Reinforce move of allocators implementation + + * stlport/stl/_alloc.h: Removed include of internal _thread.h no + more necessary now that allocator implementation is in allocators.cpp. + + * stlport/stl/_pthread_alloc.h: Removed pthread.h include. + + * stlport/stl/_rope.h: Adopt classic macro check before inclusion + of _threads.h. + + * build/Makefiles/gmake/gcc.mak: Add -fno-inline option for debug + builds. + + * stlport/stl/_threads.h: Remove lock free singly linked list, avoid + include of windows.h when using Win32 API lock free slist + implementation. + + * src/lock_free_slist.h: New place for the lock free singly linked + list implementation. + + * test/unit/mvctor_test.cpp, type_traits_test.cpp: Small workaround + for gcc 4.0.1 build, looks like there is a conflict between glibc++ + __true_type and STLport one. + +2006-01-30 Francois Dumont + + * Patch from Ulrich Eckhardt for EVC4 ICE + some documentation + updates and fixes. + +2006-01-29 Francois Dumont + + * stlport/stl/_hashtable.h, _limits.h: Add missing calling + convention to static methods thanks Petr Supina + +2006-01-28 Francois Dumont + + * stlport/stl/debug/_iterator.h: Fix Hp Acc configuration thanks + Boris Gubenko. + +2006-01-27 Francois Dumont + + * stlport/stl/_alloc.h, _old_alloc.h, _pthread_alloc.h, + test/unit/rope_test.cpp: Fixed reference to _STLP_NO_IOSTREAMS, + replaced by _STLP_USE_NO_IOSTREAMS. + + * stlport/stl/_alloc.h: Move _MAX_BYTES definition out of + _STLP_USE_NO_IOSTREAMS check scope as it is also used in deque + implementation. + + * stlport/stl/_algo.c, debug/_debug.h, _debug.c: Add check for + bad predicate in safe STL mode (_STLP_DEBUG). + + * test/unit/sort_test.cpp: Add test for correct invalid strict weak + ordering predicate detection. Active only when STL safe mode throws + exception rather than terminating application. + + * test/unit/sort_test.cpp: Add a check that stable_sort is really + stable. + +2006-01-26 Francois Dumont + + * stlport/stl/_alloc.h, _alloc.c, _pthread_alloc.h: Many code moved + to allocators.cpp. + + * stlport/stl/_pthread_alloc.c: Removed, content moved to + allocators.cpp. + + * src/allocators.cpp: New, contains STLport node and per thread + allocator implementation. + + * src/dll_main.cpp: Remove references to former __node_alloc + class. + + * build/lib/Makefile.inc: Add allocators.cpp translation unit. + + * stlport/stl/_alloc_old.h: Modified based on allocator classes new + interface. + + * stlport/stl/config/feature.h: Default allocator in _STLP_NO_IOSTREAMS + mode is now the new/delete allocator, user can still use malloc/free + one using config swtich in host.h. + + * stlport/stl/config/_gcc.h: Cygwin/MinGW can now use default node + allocator implementation without memory leak. + +2006-01-25 Francois Dumont + + * test/unit/stream_test.cpp: Add check for ptrdiff_t output + in streams operator when 64 bits portability issue detection + feature is activated with MSVC compilers. + +2006-01-25 Eric Sanford <...@comp...> + + * stlport/stl/_exception.h: Delete obsolete workaround for + legacy Borland compilers. + + * stlport/stl/_string.h: Use an other implementation for the + const_reference operator[](size_type _n) const + + * stlport/stl/config/_bc.h: Restore unexpected exception handler + (static and dynamic) and uncaught_exception handler (static only) + + * build/Makefiles/gmake/lib/bcc.mak: Typo fix in linker flags. + +2006-01-24 Petr Ovtchenkov + + * test/unit/bind_test.cpp: add test for member function + binding that show workaround for const function call. + + * src/cxa.c: __cxa_finalize and __cxa_atexit present in libc + in FreeBSD 5.3, but again absent in 6.0 + + * build/Makefiles/gmake/app/gcc.mak, + build/Makefiles/gmake/lib/gcc.mak: detect whether gcc + was builded with --disable-shared and use correct libgcc. + + * build/lib/configure: add --use-static-gcc option to show + that STLport should use static language support libraries from + gcc if it was build with --enable-shared. + +2006-01-23 Francois Dumont + + * build/Makefiles/gmake/app/clean.mak: Fix distclean rule for + windows thanks Eric Sanford. + + * stlport/stl/_cstddef.h, _cstdlib.h: When no new header support, + include STLport C header rather than native one to use errno + workaround. + + * stlport/stddef.h: DMC also define errno in native stddef.h file. + +2006-01-22 Francois Dumont + + * src/locale_impl.cpp, stlport/stl/_codecvt.h, _monetary.c, + _num_get.c, _num_put.c, _time_facets.c: Borland workaround for + locale facet id instanciation that were duplicated. Now static + instances are no more defined from .c files but only from the + .cpp and only for facets that are implemented by STLport. Users + implementing facet inheriting from the STLport one will have to + defined the static instance themself in their translation units. + + * stlport/stl/type_manips.h: Fixed _UnCVType wrong implementation + reported by Digital Mars compiler. + + * stlport/stl/boost_type_traits.h: Fixed _OKMemCpy implementation + remove_pointer call was wrong. + + * src/dll_main.cpp: Hide force_link definition to MSVC compilers, + was useless and producing a warning. + + * build/Makefiles/gmake/cygming/rules-so.mak: Workaround for DMC + linker weird behavior. Linker create the dll file even if link + fail which confuse make dependency feature. As lib file is not + generated, dll now depends on lib that depends on build files. + + * stlport/stl/config/_warning_off.h: Disabled this used in initialization + list warning, used in rope implementation. + + * build/lib/configure: Fix --with-boost interpretation. + + * build/Makefiles/gmake/dmc.mak: Use dm_link command for linker rather + than link that is rather the MSVC like wrapper. + + * build/Makefiles/gmake/cygming/targetsys.mak: Ditto for dm_lib rather + than lib command. + + * build/Makefiles/gmake/app/rules.mak: Use same linker command invocation + for DMC and Borland. + + * doc/README.borland: Documentation update about limitation on locale + facets id instanciation. + + * stlport/stdlib.h: DMC, like Borland and EVC, defines errno macro + in stdlib.h + + * stlport/stl/config/user_config.h, features.h: Inverse + _STLP_FORCE_STRING_TERMINATION macro switch in + _STLP_DONT_FORCE_STRING_TERMINATION. This is less dangerous for + existing code. + + * stlport/stl/_string.h: When _STLP_FORCE_STRING_TERMINATION + is defined operator[] implementation is simpler. + + * stlport/stl/debug/_string.h: Based implementation of [] + operator on the non STL safe internal instance, avoid duplication + of check for access to the element of index size(). + + * test/unit/fstream_test.cpp: Add custom facet id definition for + Borland. + + * test/unit/hash_test.cpp: Now Borland support correctly hash container + implementation. + + * test/unit/rope_test.cpp: Fixed test implementation to build in + _STLP_NO_IOSTREAMS mode. + +2006-01-18 Francois Dumont + + * stlport/stl/_ostream.h, _ostream.c: Use size_t rather than + unsigned int for MSVC compilers after VC6 in IO output operator + to avoid 64 bits warning when trying to display a size_t type. + + * test/unit/sstream_test.cpp: Add test that reveal the 64 bits + warning. + + * test/unit/string_test.cpp: Fixed unused variable warning. + +2006-01-17 Petr Ovtchenkov + + * src/c_locale_glibc/c_locale_glibc2.c: really implemented + getting default locale categories from environment; replace + a few strcpy by strncpy to protect from possible buffer overflow + attack. + + * stlport/new.h, stlport/stl/_typeinfo.h: few workarounds for ICC 9 + [suggested by Lim Hwan Cheol]. + +2006-01-14 Eric Sanford <...@comp...> + + * build/test/eh/bcc.mak: Copied from build/test/unit/bcc.mak. + + * stlport/stl/_rope.c: Restore Borland support for _Rope_rotate. + + * stlport/stl/_rope.h: Fix Borland 5.5.1 internal compiler errors + in _M_path_end and _M_tmp_buf structs. Restore Borland support for + _Rope_rotate. + + * test/eh/test_rope.cpp: Restore Borland exception test for rope. + + * test/unit/rope_test.cpp: Restore Borland unit test for rope. + +2006-01-13 Petr Ovtchenkov + + * stlport/stl/_string.h, stlport/stl/debug/_string.h: + const operator [n] should return CharT() in case of + n == size(), ISO/IEC 14882:2003(E), 21.3.4; thanks Russ Miller. + + * test/unit/string_test.cpp: test for fixed bug above. + + * build/lib/configure: change --use-boost= onto --with-boost= + +2006-01-13 Francois Dumont + + * test/unit/type_traits_test.cpp: Add boost specialization for + any_pod_type in order to reproduce STLport behavior when using + boost type traits. + + * src/dll_main.cpp: Remove now invalid template explicit + instanciation of _Bs_G that is no more a template. + + * stlport/stl/config/_detect_dll_or_lib.h: When no iostreams mode, + consider that we are in a static lib mode. + + * stlport/stl/_limits.c, _hashtable.c: Add _STLP_CALL specification + to _LimG and _Stl_prime methods implementation. + + * stlport/stl/_limits.c: Put _Stl_prime methods implementation in + a _STLP_EXPOSE_GLOBALS_IMPLEMENTATION macro check block. Those + methods are supposed to come from libs when using iostreams. + + * stlport/stl/_num_put.h, _num_get.h, _time_facets.h, _ios.h, + _ios_base.h: Cleanup Borland workaround now useless. + + * stlport/stl/boost_type_traits.h: Fixed _OKToMemCpy implementation + using boost type traits to be closer to the STLport behavior. + + * build/lib/configure.bat: Fixed reference to STLport user + configuration file. + + * build/lib/configure: Add --use-boost option to inject boost + path during build process. + +2006-01-12 Petr Ovtchenkov + + * stlport/stl/_rope.h, stlport/stl/_rope.c: pass CharConsumer + via reference, to take into account CharConsumer modifications. + This has relation to find(char) in rope. Thanks Cristian Vlasceanu. + + * test/unit/rope_test.cpp: test for fixed bug above. + +2006-01-11 Francois Dumont + + * src/bitset.cpp: Add stlport_prefix.h include. + + * stlport/stl/_bitset.h: Add an inline implementation for _S_count + and _S_first_one static methods for _STLP_NO_IOSTREAMS mode. Should + be slower than version coming with library but avoid link trouble. + +2006-01-11 Petr Ovtchenkov + + * stlport/stl/_bitset.h, stlport/stl/_bitset.c, src/bitset.cpp: + make helper structure _Bs_G non-template [it used only as instance + with unused bool argument only], and put static tables into library + to avoid possible static instances duplication. + + * build/lib/Makefile.inc: idem. + +2006-01-10 Francois Dumont + + * stlport/stl/type_traits.h, config/_msvc.h, _mwerks.h: Integrate + intrinsic type traits support for Visual 2005 and Metrowerk. Code + based on boost library information and not tested for Metrowerk. + + * test/unit/bind_test.cpp: Fix BindTest::bind2nd3 test case, had + never been used. + + * stlport/stl/boost_type_traits.h: Change boost type traits wrapping + implementation to use meta programming operation on types rather + than on numerical constant, MSVC6 prefer it. + + * build/test/unit/msvc.mak: Systematically add /Zm800 for MSVC + compilers, useful in a number of case and transparent in others. + + * test/unit/type_traits_test.cpp: Add is_POD test case. Add dummy + constructors, assignment operator and destructor to any_type struct + to make the tests pass even with compilers having intrinsic type + traits support. + +2006-01-09 Francois Dumont + + * stlport/stl/debug: Fix move constructor to keep the container + move constructor complete. When STLport user do no require no + extension or Standard debug safe mode, iterators are also move + with the container contents. + + * stlport/stl/_list.h, _slist.h, _tree.h: Made iterator struct + constructor from base class pointer explicit to forbid expression + like: list.begin() == 0. + + * stlport/stl/pointers/_slist.h, _list.h, _set.h: Fix implementation + that was using former implicit contructor from pointer to base class. + + * src/c_locale_win32/c_locale_win32.c: Fix implementation for + compilers coming with a native lib implementing secure C functions + like strncpy_s. + + * src/iostream.cpp: Hide I/O streams declaration when defining + them when compiler has no support for removing I/O streams + from static global variable initialization segment. Avoid the + stdio_istreambuf using directive when we do not use STLport + private namespace. + + * stlport/stl/_rope.h, _rope.c: Use internal, not _STLP_NO_EXTENSIONS + dependant functions for implementation. + + * stlport/rope, hash_map, hash_set: Add _STLP_NO_EXTENSIONS check + that generate a #error if defined as those headers are STLport + extensions. + + * stlport/_uninitialized.h: Add __uninitialized_copy_n no dependant + against _STLP_NO_EXTENSIONS for rope implementation. + + * test/unit: Made tests ok to build even when _STLP_NO_EXTENSIONS or + _STLP_NO_ANACHONISM or _STLP_NO_CUSTOM_IO is defined. + + * stlport/stl/_num_put.h, _num_get.h: Fix definition scope of + _STLP_MOVE_TO_STD_NAMESPACE that was wrong when _STLP_NO_CUSTOM_IO + is defined. + + * stlport/stl/boost_type_traits.h: Fixed _IsRef implementation based + on boost type traits feature. + + * build/nmake/extern.mak, lib/msvc.mak, test/unit/msvc.mak, + test/eh/msvc.mak: Moved injection of boost include path for all targets + in extern.mak. Also removed a useless double quote as make variable already + contains it. + + * stlport/stl/config/_bc.h, test/unit/floatio_test.cpp, cmath_test.cpp, + limit_test.cpp: Borland patch from Eric Sanford. + + * test/unit/string_test.cpp: Add template_wexpression test to check + wstring template expression. + +2006-01-05 Francois Dumont + + * stlport/stl/_stdexcept.h: Fix __Named_exception destructor + implementation when _STLP_NO_IOSTREAMS is defined or when + securized C function strcpy_s exists. + + * stlport/stl/pointers/_set.h: Fixed implementation as _Identity + is now in private namespace and const_reverse_* functions must + return const_reverse_* iterators and not simply reverse_*. + + * test/unit/bcompos_test.cpp, bind_test.cpp: Made the tests usable + when _STLP_NO_EXTENSIONS is defined. + + * build/lib/configure.bat: Fix name of msvc8 compiler. + + * test/unit/mfunptr_test.cpp: Ignore find test when no class + partial template specialization rather than commenting it. + + * test/unit/type_traits_test.cpp: Ditto for reference_type test. + + * build/Makefiles/nmake/top.mak: Fixed install-shared definition. + + * build/Makefiles/gmake/gcc.mak: Add _STLP_USE_STATIC_LIB when + building and using STLport static lib under MinGW/Cygwin. + +2006-01-04 Francois Dumont + + * src/acquire_release.h: New file, expose __acquire_* + functions used in different translation unit. + + * src/num_put.h: Removed, content moved to num_put.cpp that + was the only translation unit using exposed functions. + + * src/*: Build with Intel C++ 9 compiler reveal that many + static specification was missing. + + * src/ctype.cpp: Filter out _WCharIndexT specialization for + Intel compiler that consider wchar_t as unsigned, fixed a + warning. + + * _STLP_STATIC_ASSERT is now called without trailing ';' that + is already in the macro definition. + + * src/*: Removed reference to _SgI namespace replaced by the + STLport private namespace. + + * src/iostream.cpp: Add iostream include to expose cout, cin, cerr + definition to declaration. + +2006-01-03 Francois Dumont + + * stlport/stl/config/_gcc.h: Force use of new/delete based + allocator under Cygwin/MinGW, default node allocator has + problem because __node_allocator static datas are sometimes + duplicated in a dll context. + +2006-01-01 Francois Dumont + + * build/Makefiles/gmake/lib/gcc.mak, stlport/stl/config/_gcc.h: + Change way of building dll with Cygwin/MinGW. No more export of + all symbols, we use dllexport specification, makes import lib + really shorter and dll too. Moreover use of the + enable-auto-image-base linker option to make load of dll faster. + + * stlport/stl/_time_facets.c, _num_put.c, _num_get.c, _monetary.c, + debug/_debug.c: Adapt existing Cygwin/MinGW workaround for new + way of generating dlls. + +2005-12-31 Francois Dumont + + * doc: Add Borland doc and update cygwin, mingw and msvc. + + * build/lib/README.options: Removed, replaced by configrure + script. + + * build/test/eh/bcc.mak: Added to build EH tests for Borland. + +2005-12-29 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Hide _Locale_mbtowc and + _Locale_wctomb when no wchar_t support is detected thanks Eric + Sanford. + + * src/c_locale_win32/c_locale_win32.c: Add mapping from Borland + facet macros to STLport associated string representation array index + thanks Eric Sanford. + + * stlport/stl/config/_evc.h: Patch from Michael Fink to generalized + use of OutputDebugString for Windows CE when we need to trace + information. + + * build/Makefiles/gmake/bcc.mak, lib/bcc.mak, app/bcc.mak: Fix + definition of START_OBJ thanks armpit33 + + * build/Makefiles/*: Generalize use of install-shared rather than + list of all shared rules, idem for install-static. + +2005-12-27 Francois Dumont + + * stlport/stl/_string_io.c: Generalized use of _STLP_STATIC_ASSERT + macro rather that hand writen static assertion. + + * stlport/stl/_fstream.c, _istream.c, src/fstream.cpp, strstream.cpp: + Add some cast to avoid Borland suspicious pointer arithmetic warnings + thanks Eric Sanford. + + * stlport/stl/_limits.c: Fix Borland definition of NaNs and infinity + for long double thanks Eric Sanford. + + * stlport/stl/config/_system.h, _gcc.h: Fix config for Windows, MinGW + and Cygwin platforms. + + * stlport/stl/config/_windows.h: Can now be included by a pure C + compiler. + + * stlport/stl/config/_warning_off.h: Removed suspicious pointer + arithmetic warning for Borland thanks Eric Sanford. + + * stlport/stl/_construct.h: Removed now useless Borland workaround. + + * src/stdio_streambuf.cpp: Ditto. + + * stlport/stl/_alloc.h: Now allocator is tagged as an STLport class + even without partial template specialization support. This is + necessary because type_traits is specialized for allocator, + allocator and allocator when partial template + specialization is not available. + + * test/unit/bitset_test.cpp: Add tests for the STLport + bitset::_Find_first extension. + +2005-12-27 Petr Ovtchenkov + + * src/initial_mak: obsolete makes removed (sync with STLPORT_5_0 + branch). + +2005-12-24 Petr Ovtchenkov + + * stlport/stl/config/_gcc.h: gcc, builded by Apple is differ + in behavior from original; in particular, in path to includes; + + * build/Makefiles/gmake/app/gcc.mak: fix gcc options on MacOS X; + STLport is free from libstdc++ on MacOS now; + + * build/Makefiles/gmake/gcc.mak: fix gcc options on MacOS X; gcc, + builded by Apple is differ in behavior from original; + detect this; + + * build/Makefiles/gmake/lib/gcc.mak: fix gcc on MacOS X; + differentiate gcc from Apple and original; + STLport is free from libstdc++ on MacOS X now; + + * build/Makefiles/gmake/darwin/rules-so.mak: use + gcc instead of c++ for linkage, if only C sources present. + + * build/lib/gcc.mak, build/test/unit/gcc.mak: remove duplication + of stlport includes. + +2005-12-22 Petr Ovtchenkov + + * stlport/stl/config/_windows.h: all system specific configuration + in one place [moved from stlport/stl/_windows.h] + + * stlport/stl/_windows.h: deleted; all system specific configuration + in one place [moved to stlport/stl/config/_windows.h] + + * stlport/stl/debug/_debug.c, stlport/stl/_threads.h: + _windows.h included via _prolog.h [i.e. via stl/config/_system.h], + see changes above. + + * stlport/stl/config/_sunprocc.h: remove include of _solaris.h---it + already included from _system.h + + * stlport/stl/config/_kai.h: remove include of os configuration files, + it should be included from _system.h + + * stlport/stl/config/_intel.h: fix path after config headers + reorganization. + + * stlport/stl/config/_evc.h: idem + + * stlport/stl/_exception.h: idem + + * stlport/stl/config/_prolog.h: idem + + * test/unit/fstream_header_test.cpp: idem + + * test/unit/iomanip_header_test.cpp: idem + + * test/unit/ios_header_test.cpp: idem + + * test/unit/iostream_header_test.cpp: idem + + * test/unit/istream_header_test.cpp: ditto + + * test/unit/locale_header_test.cpp: idem + + * test/unit/ostream_header_test.cpp: idem + + * test/unit/sstream_header_test.cpp: idem + + * test/unit/strstream_header_test.cpp: idem + +2005-12-21 Francois Dumont + + * stlport/stl/debug/_debug.h, _debug.c, _string_sum_methods.h: + Removed some unused parameters reported by Borland compiler. + + * stlport/stl/config/_warnings_off.h: Disable unused parameters + warning for Borland compiler. + + * build/Makefiles/gmake/targetdirs.mak: Change config in order to + have each generated application in a different bin folder. + + * stlport/stl/_threads.h: Used _STLP_STATIC_ASSERT macro for a + static assertion. + +2005-12-19 Petr Ovtchenkov + + * build/Makefiles/gmake/lib/gcc.mak: move LDSEARCH flags after + possible -nostdlib + + * build/lib/gcc.mak: don't add include path, it already included. + + * src/c_locale.h: include stlport_prefix.h to add STLport's + definitions that used below. + + * stlport/stl_user_config.h, stlport/stl/_config.h: moved + to stlport/stl/config catalog and renamed. + + * stlport/stl/_config_compat.h, stlport/stl/_site_config.h: ditto. + + * stlport/config: headers moved to stlport/stl/config catalog, + renamed and reorganized. + + * stlport/stl/_prolog.h, stlport/stl/_epilog.h, src/stlport_prefix.h: + reflect changes in configuration files. + +2005-12-17 Francois Dumont + + * stlport/stl/_config.h: Removed ';' in _STLP_STATIC_ASSERT + definition. + + * stlport/stl/_cwctype.h: Fix native namespace of wide char functions + for MinGW runtime <= 3.0. Also fix a typo for FreeBDS. + + * src/stdio_streambuf.cpp: Add missing 'defined' when checking + __OS400__ macro existance. + + * test/unit/resolve_name.cpp, set_test.cpp: Removed useless ';' + reported by remarks from Intel C++ compiler. + +2005-12-16 Francois Dumont + + * stlport/stl/_rope.h: Moved overload of __identity_element for + _Rope_Concat_fn in STLport private namespace where orginal function + declaration is. Also moved _Rope_Concat_fn at the same time, much more + many elements of _rope.h should be moved to this namespace... + + * stlport/stl/_monetary.c: Change implementation of __money_do_put for + Borland compiler, looks like this compiler do not like ternary operator. + + * src/c_locale_win32/c_locale_win32.c: Replace check of category in + __Extract_locale_name from > LC_ALL by != LC_ALL, there is no reason + for LC_ALL to be upper or lower to all other categories. + + * build/Makefiles/gmake/cygming/rules-so.mak: Segregate different + compilers linker calls and add reference to START_OBJ in Borland + linker invocation. + + * build/Makefiles/gmake/lib/rules-a.mak, cygming/targetsys.mak: Borland + archiver add option is now '+', before being invocated archive is always + deleted to avoid warnings because the Borland archiver do not have a + real add or replace module option. + + * stlport/stl/type_traits.h: Fix for compiler simulating partial + template specialization (VC6) + + * test/eh/test_rope.cpp: Removed rope test for Borland. + + * test/unit/exception_test.cpp: Commented tests are now ignored. + + * test/unit/locale_test.cpp, string_test.cpp: No more ignored test + for Borland. + +2005-12-14 Petr Ovtchenkov + + * build/Makefiles/gmake/sysid.mak: parse two-token target + system identification string along with three-token one + [useful when vendor is omitted]; thanks Jonathan Sprinkle. + + * stlport/cwctype, stlport/stl/_cwctype.h: wctype_t and + others are in global namespace on FreeBSD. + + * build/Makefiles/gmake/app/gcc.mak, lib/gcc.mak: use build + with -nostdlib on Solaris. + + * src/cxa.c: fix for Solaris + + * stlport/config/stl_solaris.h, stlport/stl/_cmath.h: + hmm, strange... sometimes MATH_L and MATH_F present on Solaris, + sometimes not... + +2005-12-14 Francois Dumont + + * test/unit/cppunit/cppunit_mini.h, file_reporter.h: Add ignore + test feature, now tests should be ignored rather than commented. + 2 new macros for that CPPUNIT_IGNORE to add in tests declaration, + all test following this macro won't be run; CPPUNIT_STOP_IGNORE + optional macro to stop ignoring tests. + + * test/unit/fstream_test.cpp: Ignore custom_facet test when not + supported rather than comment it. + + * test/unit/hash_test.cpp: Ignore hmap1 test for Borland and Digital + Mars compilers, looks like rope class is too complicated for those + compilers. + + * test/unit/locale_test.cpp: Ignore locale_by_name test for compiler + without exceptions support. Ignore money facet tests for Borland. + + * test/unit/mvctor_test.cpp, rope_test.cpp: Some tests ignored + depending on various configuration settings. + + * test/unit/type_traits.cpp: Add test for _IsSTLportClass metaprogramming + tool. Ignored for Borland. + + * test/unit/unordered_test.cpp: Fix test for Digital Mars, unordered + containers value_type are not necessarily with an immutable key, it is + more portable to use value type rather than redefining it in the test. + + * test/unit/string_test.cpp: Removed Windows CE macro check replaced + by WaitForMultipleObjects returned code check, more portable and + maintenable. Ignore a test for Digital Mars compiler. + + * stlport/stl/type_manips.h, type_traits.h: Simplified metaprograming + tools implementation; now avoid compilation constant replaced by + type, Borland compiler has problem with constants. + + * stlport/config/stl_bc.h: Made supported compiler check more accurate + free compiler is 5.5.1 so it is the oldest supported version. Borland + compiler do not support IEC559 specifications. + + * build/Makefiles/gmake/bcc.mak: Put startup .obj to link with in + START_OBJ rather than LDLIBS, thanks Eric Sanford. + + * src/c_locale_win32/c_locale_win32.c: Temporarily removed category + check in __Extract_locale_name function for Borland, looks like LC_ALL + or LC_MAX has not the right value. + +2005-12-13 Francois Dumont + + * src/cxa.c: Add include of stlport_prefix.h first, this file + should be always included first in STLport translation units, + it prepares some compilers config and define important for Wins + __BUILDING_STLPORT macro. + +2005-12-13 Petr Ovtchenkov + + * build/Makefiles/gmake/targetdirs.mak: built-in + test in /bin/sh on Solaris has no -e, use external instead. + +2005-12-11 Francois Dumont + + * build/Makefiles/gmake/bcc.mak : Add -w-eff to disable 'useless' + code warning, we had to chose between this warning and the 'used + parameter' one. + + * build/Makefiles/gmake/targetdirs.mak: Removed comment about folder + creation action under windows platform. The action is identical to + the one used in the nmake build system and no one complains about it + so current situation is not so bad. Only users of Windows before Windows + 98 should eperiment troubles, this is a known limitation. + + * build/Makefiles/gmake/dmc.mak, cygming/rules-so.mak: Change config, + now we directly invoke the linker, we do not use a compiler call for it. + + * build/Makefiles/gmake/app/bcc.mak: Fix linker option in order to generate + a windows executable and not a dll, thanks Eric Sanford. + + * build/Makefiles/gmake/app/rules-install.mak: Add install dir dependency + rather than doing a folder existence check in rules actions. + + * build/Makefiles/gmake/app/rules.mak: Restore slash rotation for Borland + linker invocation and fix static rules dependencies to guaranty folder + creations. + + * build/Makefiles/gmake/lib/bcc.mak: Add missing archiver page size parameters. + + * build/test/unit/bcc.mak: Add _STLP_DEBUG_UNINITIALIZED for static + debug rules. + + * build/Makefiles/gmake/lib/rules-a.mak: Segregate each archiver invocation. + +2005-12-09 Francois Dumont + + * build/lib/configure.bat: Add Borland compiler to compilers + able to mix a dll build with a static native runtime. + + * build/Makefiles/gmake/bcc.mak, dmc.mak: Complete libs to link + depending on STLport configuration. + + * build/Makefiles/gmake/targetdirs.mak: roll back modif from Petr + 2005-12-08 + + * build/Makefiles/gmake/targets.mak: ditto + + * build/Makefiles/gmake/cygming/lib.mak: Fix for static libs build + with compiler different than gcc. + + * build/Makefiles/gmake/cygming/targetsys.mak: Add missing info for + static libs build with Borland and Digital Mars compilers. + + * build/Makefiles/gmake/lib/rules-a.mak: Fix static builds commands + to use info of above point. + + * build/Makefiles/gmake/lib/rules-install-a.mak: Add install rule + for windows and missing catalog in dependency tree. + + * build/Makefiles/gmake/windows/rules-install-so.mak: Add missing + catalog dependency. + +2005-12-09 Petr Ovtchenkov + + * build/lib/Makefile.inc: add cxa.c into compilation; this + is useful for FreeBSD 4.11 C++ ABI workaround. + + * src/cxa.c: use _cxa_atexit and related functions on + FreeBSD 4.11 [workaround for missed C++ ABI functions]. + +2005-12-08 Francois Dumont + + * stlport/stl/_auto_ptr.h: Add missing Standard throw() specification + on all auto_ptr members. + + * stlport/config/stl_mycomp.h: Removed recently introduce macro + _STLP_DFLT_PARAM_INSTANCIATION_BUG, already existing _STLP_DONT_SUP_DFLT_PARAM + is enough for the moment. + + * stlport/stl/_stream_iterator.h: Small implementation change to make + Digital Mars compiler happy. + + * stlport/stl/_unordered_map.h: Digital Mars compiler do not like + immutable keys in associative containers. + +2005-12-08 Petr Ovtchenkov + + * stlport/ctype.h: forward-declaration for _exception struct + for WinCE/eVC3; prevents warning message + ../include/stdlib.h(817) : warning C4115: + '_exception' : named type definition in parentheses + [Michael Fink's suggestion] + + * stlport/float.h, stlport/limits.h, stlport/setjmp.h: idem. + + * stlport/stdarg.h, stlport/string.h, stlport/stdio.h: idem. + + * build/Makefiles/gmake/gcc.mak: check configuration macro + WITHOUT_STLPORT [useful for tests]; force usage of stlport + headers first otherwise. + + * build/Makefiles/gmake/targetdirs.mak: fix catalogs creation + procedure [loop through catalogs required]; comment problematic + code when we have no good tools. + + * build/Makefiles/gmake/lib/gcc.mak: fix typo [FreeBSD]; fix + set of libraries when link for FreeBSD; fix typo in macro name + [FreeBSD again]. + + * build/Makefiles/gmake/app/gcc.mak: fix set of libraries when + link for FreeBSD; insert stlport lib in STDLIB set [when STLPORT + in force], to avoid set one in application's makefile. + + * build/test/unit/gcc.mak: explicit refrence to libstlport in + this makefile not required more [see message above]. + + * build/Makefiles/gmake/lib/gcc.mak: remove names inherited from + Complement project. + + * build/Makefiles/gmake/*/rules-install-so.mak: installation + catalog was missed in dependency tree; ident string removed + to simplify merge/diff + + * Build: building library and unit tests with cross [gcc 3.4.5] + on Linux for FreeBSD 5.3 (except cwctype_test). + + * build/Makefiles/gmake/targets.mak: rotate slashes for BCC. + + * build/Makefiles/gmake/app/macro.mak: remove name contruction + for program; rotate slashes for wins. + + * build/Makefiles/gmake/app/rules-install.mak: remove name + contruction for program. + + * build/Makefiles/gmake/app/rules.mak: remove name contruction + for program; objects for static and for dynamic are the same. + +2005-12-04 Francois Dumont + + * src/num_put_float.cpp: Filter inclusion of stdint.h, required for + Digital Mars compiler, forbidden for Sun platform. + + * stlport/stl/_cwctype.h: wide types and function are in global + namespace. + + * build/test/unit/gcc.mak: Modify cygwin/mingw config now that + default settings for those platform is shared library. + + * build/Makefiles/gmake: Add support of static targets, used + especially for Borland C++ Compiler and Digital Mars Compiler. + + * build/Makefiles/gmake/app/gcc.mak: Fix typo in FreeBSD + configuration. + +2005-12-02 Francois Dumont + + * stlport/config/stl_msvc.h: Fixed configuration detection when building + STLport dll based on a static native runtime. + + * stlport/stl/_locale.h: Fix warning convertion from size_t to + __stl_atomic_t that can be of lower size. + + * stlport/config/stl_gcc.h, doc/README.mingw, README.cygwin: Made dll + default settings under cygwin/mingw. + +2005-12-01 Francois Dumont + + * stlport/stl/_mbstate_t.h: Add workaround for alpha bad WCHAR_MIN and + WCHAR_MAX definition. + + * stlport/config/stl_gcc.h: Configure STLport for alpha platform as not + supporting iec559 specification as quiet nan is not correct. If someone + find the right value then this config will have to be rollbacked. + + * build/Makefiles/gmake/gcc.mak: Restored Sun OS support that use the + -pthreads option and not -pthread + + * build/Makefiles/nmake/lib/macro.mak: Fixed library name generation + when using cross runtime version thanks Alexey Ivanov report. + +2005-11-29 Francois Dumont + + * stlport/stl_user_config.h: Add _STLP_LIB_NAME_MOTIF macro to give + users a point of customization of the automatic linking feature. + + * build/Makefiles/nmake/lib/macro.mak, gmake/cygming/lib.mak: Use + STLP_BUILD_LIB_MOTIF in library name generation algorithm. Also take + into account cross builds in library name generation. + + * build/lib/configure.bat: Add --lib-motif option to give users a + way to customize the generated library names. + + * test/eh: Generalized use of msvc.mak rather than all the nmake-vc??.mak + files. Idem for evc.mak instead of nmake-evc?.mak and icl.mak instead of + nmake-icl.mak. + + * stlport/stl/_exception.h: Change _msvc_warnings_off.h include in + _warnings_off.h as this file now also turn off Borland warnings. + + * stlport/config/_detect_dll_or_lib.h: Mutualization of code used to + detect current STLport type of build or usage (dll or static lib). + + * stlport/config/stl_msvc.h, stl_bc.h, stl_dmc.h: Integration of + _detect_dll_or_lib.h + + * stlport/config/_auto_link.h: Change auto link algo when we detect + cross STLport usage that is to say use of STLport as a dll link with + static native runtime or opposite. + +2005-11-29 Petr Ovtchenkov + + * src/cxa.c: mutex should be recursive-safe, due to __cxa_finalize + may be called recursive. + +2005-11-28 Francois Dumont + + * stlport/stl/_threads.h: Simplified expression used to instanciate + _Atomic_swap_struct, gcc 2.95 had trouble with the one line expression. + + * src/dll_main.cpp: Fix instanciation of _Swap_lock_struct that has been + changed and renamed in _Atomic_swap_struct. + + * test/unit/map_test.cpp, set_test.cpp: Simplified call to map constructor + taking a functor and allocator instance, split it in a creation of a les + instance then passed to the constructor; gcc 2.95 had trouble with previous + version. + + * stlport/stl/_cmath.h, _cstdlib.h: Now those files includes each other to + make sure that all abs overloads are defined when it is imported in STLport + namespace. gcc 2.95 is very strict on this point and only consider the abs + overloads existing at the first import calls, all overloads added after that + are discarded silently. + + * stlport/stl/_cmath.h: Removed unjustified abs function overloads done + directly in STLport namespace for gcc 2.95 and before. Those overloads + clashed on a Linux with gcc 2.95 from the sourceforge compiler farm. + + * build/Makefiles/gmake/gcc.mak: Generalized definition of _REENTRANT under + Linux to make detection of a multithreaded build from STLport code easier. + Problem meet on an alpha linux platform from the sourceforge compiler farm. + + * stlport/stl/_locale.h: Removed _M_delete locale::facet member variable, + useless if facet instance reference counter is right. + + * src/locale_impl.cpp, message.cpp: Change classic facets initialization code + to simply set initial counter to 1 rather than incrementing it after construction. + + * test/unit/evc.mak fix path to config file in existance check. + + * stlport/stl/_move_construct_fwk.h, type_manips.h: Add workaround to use + move constructor with Borland compiler. + +2005-11-28 Petr Ovtchenkov + + * build/Makefiles/gmake/targetdirs.mak: change names of .o output dirs + to make bcc happy (bug with passing name that contain '-' from + compiler to linker). Replacement: 'shared' -> 'so', 'static' -> 'ar', + '-' -> '_' (i.e. obj/gcc/shared-stlg -> obj/gcc/so_stlg, a bit shorter) + [Suggested by Francois Dumont]. + +2005-11-27 Petr Ovtchenkov + + * build/Makefiles/gmake/targets.mak, app/rules.mak, linux/rules-so.mak: + use gcc instead of c++ as linker if there are no C++ objects. + + * src/cxa.c, build/misc/cxa_atexit/Makefile.inc, build/misc/cxa_atexit/gcc.mak: + workaround for bugged __cxa_finalize; use builded libcxa.so in LD_PRELOAD or + /etc/ld.so.preload in Linux system with bugged glibc. See also + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24189 + +2005-11-27 Francois Dumont + + * stlport/stl/type_manips.h: Add import of __true_type and + __false_type in STLport private namespace as the using namespace + directive do not seems to be enough for latest gcc version. + + * src/time_facets.cpp: Fix buffer size decrementation in __write_formatted_time + function thanks Petr Ovtchenkov + +2005-11-26 Francois Dumont + + * stlport/stl/_complex.h: Move implementation of generic abs, arg and polar + after definition of double overload used in implementation. Thanks Kees de + Bruin + + * stlport/stl/_threads.h, _alloc.h, _alloc.c: Fix lock free node allocator + implementation thanks Weis. + + * stlport/stl/wrappers: Removed, no more maintained and complicated to fix + with the debug and pointer specialization implementations. + + * test/unit/stack_allocator.h: Creation of an allocator using a stack buffer. + This allocator specificity is to not be stateless and not default constructible. + + * test/unit/list_test.cpp, stlport/stl/_list.h, _list.c: Add of a test with the + StackAllocator. Fix list implementation to correctly handle allocator state + in the methods moving elements from a list instance to an other. + + * stlport/stl/_carray.h: Creation of a new internal struct _CArray that mimic a C + array with the additionnal feature of being able to be instanciated with a type + without default constructor. + + * stlport/stl/debug/_list.h: Adapt iterator invalidation according allocators + compare result. + + * test/unit/slist_test.cpp, stlport/stl/_slist.h, _slist.c: idem list. + + * stlport/stl/_slist.h: Modification of the splice_after methods signature. Users + now have to pass the source slist instance, this is mandatory in order to compare + the 2 slists allocator instance before moving an element from a slist instance to + an other. + + * stlport/stl/_string_base.h: Fix _M_swap implementation for basic_string instanciation + with allocator having a state. + + * stlport/stl/_list.c, _slist.c: sort methods now throw an overflow exception when lists + are too long to be sorted with the current algorithm. This is preferable to a buffer + overrun. + + * stlport/stl/_alogobase.c: Small equal_range optimization, upper_bound is not called + anymore when lower_bound returned value is already not equivalent to the search value. + + * build/Makefiles/gmake: Add build system for Digital Mars and Borland C++ compilers + + * build/lib/configure.bat: Add following options + --use-boost + --not-thread-safe + --no-rtti + see script for explanation. --mingw removed, detected with --compiler option, if + gcc, dmc or bcc then we are using MinGW tools. + + * build/lib/configure: Add --not-thread-safe option + + * build/Makefiles: Add build options to generate not thread safe libs and no rtti libs, + all compilers option has not been updated. + + * stlport/c*: Modification of C++ headers wrapping C ones. All code moved to internal + headers in stlport/stl folder. Internal headers are only included if include comes from + user code otherwise only native header is included. Limit dependency between STLport + headers relations and native library once. Reported by problem building with Borland + compiler. + + * test/unit/cppunit/cppunit_mini.h: Replace cstring include with string.h to avoid + references to std namespace in headers, should be more portable. Add typedef Base + definition in CPPUNIT_TEST_SUITE macro, used in calls to base class methods, help + Borland. + + * Generalize use of secure string functions (strcpy_s for instance) for MSVC compilers + supporting it and tagging former versions like deprecated. The pragma warning that used + to disable this warning has been removed. + + * stlport/BC50: Removed, no necassry anymore for supported Borland compiler versions. + + * stlport/stl/debug: Implementation modification, now debug wrapper agregate a non debug + instance rather than inheriting from it. Makes debug implementation clearer as we are now + forced to implement the complete containers interfaces. + + * stlport/stl/pointers: Fix implementation in order to support Standard compilers + not accepting cast from function pointer to void*. + + * *: Reinforce use of STLport private namespace (stlp_priv or stlport::priv) for all + internals algorithms. + +2005-11-21 Francois Dumont + + * Fix classic locale facet initial reference counter thanks + Cabal + +2005-11-20 Petr Ovtchenkov + + * src/num_put.h: check that incoming string has enough + digits for fractional part processing. This check includes + check for empty incoming string. (Thanks Leonardo [leoapsilva] + for the bug report). + + * stlport/stl/_monetary.c: fix processing the case when + number of digits in value less then number of digits in fraction. + + * src/facets_byname.cpp: international currency symbol should + be the first (not depends upon where currency symbol situated in + the national format). + + * test/unit/locale_test.cpp: tests for reproducing this problems. + +2005-11-20 Gail Baker + + * build/Makefiles/gmake/CC.mak: Updated compiler option + to compile larger inline functions inline. + + * build/Makefiles/gmake/lib/CC.mak: Changed how the header + file linking is done to only do it once instead of with + every compile. + + * build/lib/README: include instructions for SunPro compiler. + + * build/test/unit/CC.mak: allow the STLP_DEBUG version to compile. + +2005-11-19 Petr Ovtchenkov + + * stlport/stdlib.h: replace C++ comments by C, to satisfy -ansi + option of compiler. + +2005-11-18 Francois Dumont + + * build/Makefiles/nmake/lib/rules-install-so.mak, + app/rules-install-so.mak: Add copy of manifest file when exist + rather than when compiler is Visual Studio 2005. + + * src/stdio_streambuf.cpp: Removed warning for EVC 3 and 4 thanks + Michael Fink patch. + + * stlport/stl/math.h, stdlib.h: Fix EVC3 warning thanks Michael Fink + patch. + + * doc/README.evc3: doc update from Michael Fink. + + * stlport/*, stlport/*, tests/*: Clean up of trailing blank charaters + in all source files. + +2005-11-17 Gail Baker + + * build/Makefiles/gmake/CC.mak, depend.mak, app/CC.mak, lib/CC.mak: + support of SunPro 5.7 compiler. + + * build/lib/CC.mak: ditto + + * stlport/stl/_rope.c: Removed extra semi-colons. + + * stlport/stl/_rope.h: Sunpro compiler had a problem with + the __ROPE_DEPTH_SIZE macro doing an addition. Changed to + a fixed value instead. + + * stlport/cstdlib: Updated to allow the compiler to find abs and div + + * stlport/config/stl_sunpro.h: Disabled _STLP_LINK_TIME_INSTANTIATION + since this nolonger works with current files. The issue here is that + a number of defines that are required in the C versions of the files + use defines that are undefed at the end of the include. So, when + the compiler finally compiles the C version at link time the defines + are lost and the files don't compile. Also added a minor change + to allow files that are compiled with cc to include stl_sunpro.h + without bailing out. + + * stlport/stl/_bvector.h: Added stl/_range_errors.h required by + an exception that can be called. + + * stlport/stl/_cmath.h: Changed to pull all math functions from std + namespace for SunPro compiles only. + + * test/unit/fstream_test.cpp: Added SunPro compile to the list + of compilers that don't use the DO_CUSTOM_FACET_TEST. + + * test/unit/string_test.cpp: Added Sun UI Threads to the list + of supported thread types in the test. + + * test/unit/valarray_test.cpp: The compiler was having trouble + finding abs(). Added a "using std::abs" for the SunPro compiler + which solved the problem. + + * test/unit/cppunit/cppunit_mini.h: Added additional using statements + for the str* commands. + + * test/unit/cppunit/test_main.cpp: Added "using namespace std;" + for the SunPro compiler. + + * build/test/unit/CC.mak: support of SunPro 5.7 compiler + +2005-11-17 Francois Dumont + + * stlport/stl/_messages_facets.h, src/messages.cpp: Move message facet + constructor private to guaranty that it is only called from the _Locale_impl + class for classic locale facets creation. Change constructor implementation + as now passed _Message instance is dynamically instanciated so needs to be + destroy on facet destruction; moreover the facet is also dynamically allocated + and has to be destroyed when reference counter reach 0. + + * src/locale_impl.cpp: Removed call to now useless free_classic_locale function. + Change make_classic_locale implementation, now classic locale facets are + allocated on the heap and have to be destroyed like any ordinary facets + when reference counter reach 0. + +2005-11-15 Petr Ovtchenkov + + * stlport/stl/_tree.h: check iterator returned from lower_bound + in equal_range_unique for end, to avoid increment [useful when + key not available]. + + * test/unit/map_test.cpp: test for problem above. + +2005-11-09 Francois Dumont + + * build/test/eh/gcc.mak: Fix build system for Cygwin/MinGW systems that + was broken since library naming convention modification. + +2005-11-07 Michael Fink + + * build/lib/configure.bat: Fixed configuring for Visual Studio .NET 2003. + Fixed jump target names for Win9x OSes: they must be 8 characters or + shorter. + +2005-11-07 Michael Fink + + * build/Makefiles/nmake/evc3.mak, build/Makefiles/nmake/evc4.mak, + build/lib/configure.bat, stlport/config/stl_evc.h: Added check if + using x86 emulator configuration; using of proper include paths in + case. + + * doc/README.evc4: Documentation update + +2005-11-01 Petr Ovtchenkov + + * Repository: STLport 5.0, tag STLPORT_5_0_RELEASE + + * Repository: merge HEAD and STLPORT_5_0 branch. + + * build/Makefiles/gmake/app/rules-install.mak: install-shared rule + added (patch by Michael Fink). + + * build/Makefiles/gmake/lib/rules-install-a.mak: install-static rule + added (patch by Michael Fink). + +2005-10-12 Francois Dumont + + * stlport/stl/_threads.h, _threads.c: Fix regression for some platforms + introduce by modification of _Atomic_swap_ptr implementation thanks + Albrecht Fritzche. + +2005-10-09 Petr Ovtchenkov + + * repository: RC6, tag STLPORT_5_0_RC6 + +2005-10-09 Francois Dumont + + * stlport/config/stl_gcc.h: DEC alpha has not *l math functions + +2005-10-08 Francois Dumont + + * stlport/stl/_config.h: Add endianess specification for DEC alpha thanks + sourceforge compiler farm. + + * stlport/config/stl_intel.h: Remove reference to _STLP_GLOBAL_NEW_HANDLER + in this file as this macro depends on native Standard library which is + the back end MSVC compiler one so macro set in stl_msvc.h. + +2005-10-07 Francois Dumont + + * build/Makefiles/gmake/darwin/sys.mak, freebsd/sys.mak: Fix EXT_TEST + definition to test rather than /usr/bin/test thanks sourceforge + compiler farm. + +2005-10-05 Francois Dumont + + * build/Makefiles/nmake/vc-common.mak: Remove /Fd option for the icl + compiler that do not know it. + +2005-10-04 Francois Dumont + + * stlport/stl/debug/_list.h: Fix resize method implementation in safe + STL mode thanks Ethan Fenn report. + + * test/unit/list_test.cpp: Add test case for list::resize method. + + * build/Makefiles/nmake/lib/rules-install-a.mak, app/rules-install-a.mak: + Install .pdb files only if exist, Intel C++ compiler do not generate them + when building static libraries. Thanks Albrecht Fritzsche + + * stlport/stl/_ostream.h, _ostream.c: Move _M_init function implementation + from .c to .h as .c is not included when _STLP_NO_CUSTOM_IO is defined + but _M_init might not be exported if compiler fully inline it. + +2005-10-03 Francois Dumont + + * stlport/stl/_tree.h: Fix _S_value method definition that returns + a value_type& rather than the reference typedef as reference might be, + depending on the traits used to instanciate _Rb_tree, equivalent to + a const_reference. + +2005-09-30 Francois Dumont + + * INSTALL, README, doc/FAQ, doc/README.msvc: Documentation updates. + + * doc/stlport_namespaces.txt: Small doc about STLport namespaces and how + STLport replace native Standard library. + +2005-09-26 Francois Dumont + + * build/*: Finished _STLP_LEAKS_PEDANTIC clean up from all make files. + +2005-09-25 Francois Dumont + + * build/test/unit/gcc.mak: Remove _STLP_LEAKS_PEDANTIC option when building + unit tests as this option is not defined when building the libs. + +2005-09-22 Petr Ovtchenkov + + * build/Makefiles/gmake/sysid.mak: add underscore in architecture recognition, + to parse targets like x86_64-unknown-linux-gnu. + +2005-09-21 Francois Dumont + + * src/locale.cpp, facets_byname.cpp: Use of _STLP_ATOMIC_INCREMENT rather than + a lock on a mutex when the macro is available. + +2005-09-21 Petr Ovtchenkov + + * src/locale_impl.cpp: some internal functions used before declared. + Thanks Thomas Kho for report. + +2005-09-20 Francois Dumont + + * stlport/stl/_string.h, _string_workaround.h: code refactoring, substr method + now use string constructor taking same parameters rather than the range + constructor, thanks Felix Wyss report. Also add missing allocator parameter + for non stateless allocators. + + * build/Makefiles/gmake: Restore resource build for Cygwin and MinGW, add + it for Windows. + + * build/lib/configure.bat: Add --extra-cxxflag to inject additional compilation + option in the nmake build system. + +2005-09-20 Petr Ovtchenkov + + * test/unit/ptrspec_test.cpp: gcc 2.95 fail to roll out template instantiation + for pointers to member function, skip this test for gcc 2.95. + + * build/Makefiles/gmake/gcc.mak: gcc 2.95 has no -fuse-cxa-atexit option. + + * build/lib/gcc.mak: don't use LEAK_PEDANTIC with gcc 2.95 [but this not help, + segfault at program termination still happens]. + + * stlport/config/stl_gcc.h: gcc 2.95 has problem with llabs, so force to use + _STLP_NO_VENDOR_STDLIB_L; 2.95 fails to initialize builtin types. + + * stlport/stl/_cmath.h: workaround for gcc 2.95---it has problem with 'using' + directive [problem with 'abs' with float types as argument]. + + * stlport/stl/type_traits.h: workaround for gcc 2.95 [parentheses around + template argument]. Thanks Thomas Kho. + + * test/unit/fstream_test.cpp: custom facet test compilation fail for gcc 2.95 + + * build/Makefiles/gmake/icc.mak, build/test/unit/icc.mak: support icc 9.0, + thanks John Fisher-Ogden and Thomas Kho. + + * src/c_locale_glibc/c_locale_glibc2.c: use newlocale/freelocale for + glibc 2.3.x, and __newlocale/__freelocale for glibc 2.2.x. Thanks Gail Baker. + +2005-09-19 Francois Dumont + + * build/Makefiles/nmake/clean.mak, lib/clean.mak, app/clean.mak: Add check + for file or folder existance before calling del or rd to avoid error + messages that give a bad feed back to STLport users. + + * build/Makefiles/gmake: Add support to use the GNU make tool in a Windows + cmd console. For the moment it is used to build STLport using a simple + MinGW distrib. + + * stlport/stl/type_traits.h: Simplified code removing the _IsConvertibleIfNot + that has never proved of being useful, it only introduces problem with some + limited compilers. + + * stlport/stl/_string_workaround.h, _string.h, debug/_string.h: Fix string + range constructor bug in the VC6 specific workaround implementation that was + resulting in a memory leak. Thanks Felix Wyss report. + +2005-09-18 Petr Ovtchenkov + + * stlport/stl/_hash_fun.h: add hash function for void *. + + * src/facets_byname.cpp, src/message_facets.h: introduce map between + nl_catd type [that is void * on Linux] and messages_base::catalog + [that is int by Standard]; this should remove problems on platforms + where sizeof(int) < sizeof(void *). + +2005-09-16 Francois Dumont + + * stlport/cwchar: Add MinGW 3.8 runtime wide-char to multi-byte functions + import within STLport namespace thanks Rene Riviera. + +2005-09-14 Francois Dumont + + * stlport/config/stl_gcc.h: Mingw support string wide functions thanks + Rene Riviera report. + +2005-09-13 Petr Ovtchenkov + + * stlport/stl/_thread.h: fix return type specification + [volatile void * -> void *]. + +2005-09-12 Francois Dumont + + * stlport/stl/_thread.h: Fix _Atomic_swap_ptr implementation in single + threaded mode and when there is no pointer atomic swap operation. + + * stlport/stl/_site_config.h: Add _STLP_NO_CYGWIN macro to signal use + of the -mno-cygwin cygwin option. + + * build/lib/configure: Remove automatic generation of stlport/script_config.h. + +2005-09-11 Petr Ovtchenkov + + * build/Makefiles/gmake/sysid.mak: provide identification hosted platform. + + * build/Makefiles/gmake/targetdirs.mak: CygWin/MinGW has no /usr/bin/test, + but built-in test support -e; see record 2005-09-04. + + * build/Makefiles/top.mak: separate hosted platform and target platform + file extentions, tools, utilites. + + * build/Makefiles/gmake/?/sys.mak, build/Makefiles/gmake/?/targetsys.mak: + ditto. + +2005-09-09 Francois Dumont + + * src/c_locale_win32.c: Fix _Locale_wchar_[tolower,toupper] implementation + which was wrong when wint_t was not the same typedef as wchar_t. + + * build/lib/configure: Removed obsolete configure options --with-msvc and + --with-mssdk. And --no-cygwin option to make build of STLport using -mno-cygwin + option easier. + + * stlport/script_config.h: New header used to put additionnal macros defined + by the configure script. + + * stlport/stl/_config.h: Add script_config.h include. + + * stlport/config/stl_gcc.h: Use of the new _STLP_NO_CYGWIN macro to set + the right _STLP_NATIVE_INCLUDE_PATH macro value. + + * build/Makefiles/gmake/gcc.mak: Change CC and CXX assignment from := to + ?= to take into account an already existing definition. + +2005-09-07 Francois Dumont + + * build/Makefiles/gmake: Adopt a more traditionnal unixes naming + convention for cygwin and mingw. + + * build/Makefiles/nmake: Attempt to make STLport library names more + coherent between unixes and windows systems. Now windows use the 5.0 + extension like under unixes even if under unixes the file extension + is before the 5.0 and under windows it will be after. The other + difference is that the debug suffix is 'g' when using gcc and 'd' for + the other compilers. This modification comes from a work to improve + STLport integration within boost build system, bjam. + + * stlport/config/stl_msvc.h: Modify MSVC auto link feature to reflect + above modifications. + +2005-09-06 Francois Dumont + + * stlport/config/stl_gcc.h: Fix cygwin config that do have native + mbstate_t definition. + +2005-09-05 Petr Ovtchenkov + + * repository: RC5, tag STLPORT_5_0_RC5 + +2005-09-04 Petr Ovtchenkov + + * build/Makefiles/gmake/targetdirs.mak: in sh's built-in 'test' no -e + option on Solaris, use external 'test' instead. + + * build/test/unit/gcc.mak: Fix LDSEARCH recursive problem; fix + options for ld search path for some platforms. + + * stlport/cstdlib, stlport/stl/_cmath.h: fix usage of native + ?f and ?l math functions on Solaris; hypot for long double should't + loose precision, if no native C function present. + +2005-09-02 Francois Dumont + + * stlport/config/stl_msvc.h, stl/_move_construct_fwk.h: Add the + _STLP_NO_MOVE_SEMANTIC configuration macro to remove move semantic + support for MSVC .Net 2002 that seems to be unable to support it. + Maybe we should rather remove this compiler version support... + + * test/unit/mvctor_test.cpp: Add _STLP_NO_MOVE_SEMANTIC check. + +2005-08-31 Francois Dumont + + * build/Makefiles/nmake: Enhance nmake build system to correctly take + into account the .manifest files generated by VS 2005 Beta. + +2005-08-29 Petr Ovtchenkov + + * CVS repository: CVS repository master copied from cvs.stlport.com to SourceForge. + All history preserved! + +2005-08-27 Francois Dumont + + * stlport/stl/_hashtable.h: Fix move feature integration for the hash_multimap + container. + + * stlport/stl/_deque.h: Fix _Deque_base move constructor implementation. + + * test/unit/mvctor_test.cpp: Change move constructor tests to use dynamically + allocated string rather than static ones. + + * build/test/unit/nmake-vc6.mak: Increase compiler maximum heap size to allow + compilation with stldbg rules. + + * build/test/unit/nmake-evc4.mak: Fix macro typo OPT_STLDBG_STATIC -> + OPT_STATIC_STLDBG + + * build/Makefiles/gmake/gcc.mak: Filter out the newly added -fuse-cxa-atexit + compilation option for Cygwin and Mingw, the granted libc is not compatible + with it. + +2005-08-26 Petr Ovtchenkov + + * stlport/config/stl_solaris.h: C++ comments replaced by C ones, + this file may be included by C sources. Thanks Matti Rintala. + +2005-08-25 Francois Dumont + + * stlport/stl/_config.h, _epilog.h: Move of stlport namespace alias + definition from _epilog.h to _config.h to avoid redefinition as _epilog.h + is reentrant. This is a workaround for a HPUX aCC compiler bug reported + by Baker. + +2005-08-25 Petr Ovtchenkov + + * build/Makefiles/gmake/gcc.mak: usage of -fuse-cxa-atexit strongly + required for correct order of static objects dtors calls. This is + used in deinitialization of locale-related objects. Thanks Matti Rintala. + + * stlport/stl/_config.h: use different namespaces for mulithreaded + and non-multithreaded builds to avoid usage of non-multithreaded + application with multithreaded libstlport and vice versa; + [combination non-mt & mt lead to crash due to different instances + and sizes of allocators for non-mt and mt cases]. + +2005-08-23 Francois Dumont + + * stlport/stl/_config_compat.h: Add check of _STLP_NO_OWN_IOSTREAMS + macro to make remove of its support more explicit thanks to a #error + directive. + + * stlport/stl/_tree.h, _hashtable.h: Now reference and pointer types + are taken from the _Traits template parameter used to instanciate + the class. Doing so now set::reference and hash_set::reference are + const_reference which is coherent with respective iterators that are + immutable. Moreover it fixes a VC6 bug in reverse_iterator implementation + that was trying to transform a const reference to a simple reference + thanks Russell Miller report. + + * test/unit/set_test.cpp: New test case for set reverse_iterator. + +2005-08-23 Petr Ovtchenkov + + * stlport/config/stl_gcc.h: seems HP-UX has no *f variants of math + functions [ceilf, fabsf, etc.] + +2005-08-21 Francois Dumont + + * stlport/stl/_string.h, _rope.h: Removed __move_traits specialization + for string wstring crope and wrope. There is no reason to believe that + its move construtor will be complete as an STLport user has the right + to specialized the std::allocator<> with char or wchar_t. + + * stlport/stl/_function_base.h, _alloc.h: Generalized use of the + __stlport_class struct rather than introducing a new helper type + (__stlport_less or __stlport_alloc) when we need to recognize STLport + implementation from a user one. + +2005-08-20 Francois Dumont + + * stlport/stl/_list.h, _slist.h: Fix move constructor implementation + thanks Henrik Goldman (www.x-formation.com) report. + + * stlport/stl/_alloc.h: Fix type_traits specialization for allocator + type. Now specialization is only apply for the default STLport allocator + implementation and not for potential user specialization. + + * stlport/stl/_deque.h, _hashtable.h, _string.h, _tree.h, _vector.h: + Simplification of the move framework application especially in the + definition of the containers __move_traits specialization. Many + _AsMoveSource call replaced by explicit call to the move constructor + when we are sure that there is one. + + * test/unit/mvctor_test.cpp: Add many tests to check move contructor + implementations. + + * stlport/stl/_function_base.h: Add type_traits specialization for the + less functor to help the move framework when dealing with associative + containers. + + * test/unit/mvctor_test.cpp: Add a new test case checking correct move + semantic support for all STL containers. + + * stlport/stl/_rope.h: Add move semantic support to the rope class. + +2005-08-19 Petr Ovtchenkov + + * build/Makefiles/gmake/gcc.mak: fix extraction of gcc version. + Thanks Thomas Kho. + +2005-08-18 Francois Dumont + + * stlport/stl/_deque.c: Fix _M_erase range for movable types method + implementation, same bug as below in vector. + + * test/unit/mvctor.cpp: Improve test case on vector to reveal bug + below and add same tests for deque which is the other container that + use the move contructor feature. + +2005-08-18 Petr Ovtchenkov + + * INSTALL: add some words about multithread options and libraries. + + * stlport/stl/_fstream.c: some code clean to reduce bogus compiler + warnings with -Wall. + + * stlport/config/stl_gcc.h: seems HP-UX has no llabs and lldiv. + +2005-08-17 Francois Dumont + + * stlport/stl/_vector.h: Fix _M_erase range for movable types + implementation thanks Sergej Zagursky. + + * build/Makefiles/nmake/vc8.mak: removed /RTC1 compiler option, the platform + SDK compiler do not support it. STLport users will just have to activate it + by themself if they want to. + + * stlport/stl/_complex.h: Fix some floating point literals thanks + Ulrich Eckhardt report. + + * stlport/stl/_time_facets.c: Complete integration of the '#' MS extension + in the date/time format string, reported thanks to the recent locale time_get + new test case. + +2005-08-14 Francois Dumont + + * stlport/config/stl_msvc.h: Fix platform SDK compiler config, even latest + version that announce to be similar to .Net 2005 beta do not throw bad_alloc + from the new operator. + + * stlport/cstdio, cstdlib: Replaced some _WIN64 checks by a + _STLP_USING_PLATFORM_SDK_COMPILER check. + + * test/unit/cmath_test.cpp: Complete test filtering for Microsoft platform SDK + compiler. + +2005-08-14 Petr Ovtchenkov + + * test/unit/locale_test.cpp: tests for time_get facet. + + * stlport/stl/_time_facets.c: fix processing of %p format + [12:00 PM ~ 12:00, 12:00 AM ~ 00:00]. + + * src/time_facets.cpp: substitute expanded equivalent format strings + instead of %T, %R, %r. + + * stlport/pthread.h: Fix C++ comment in a potentially C header. Thanks Ali + +2005-08-11 Francois Dumont + + * stlport/stl_user_config.h: Add _STLP_USING_PLATFORM_SDK_COMPILER so that + STLport user can signal they are using platform SDK compiler. + + * stlport/config/stl_msvc.h: Add use of _STLP_USING_PLATFORM_SDK_COMPILER. + + * test/unit/cmath_test.cpp, valarray_test.cpp: Removed tanh calls when using + AMD 64 platform SDK compiler, looks like they miss something... + +2005-08-09 Francois Dumont + + * src/fstream.cpp: Final fix of basic_filebuf::open method. Now when open + from a Win32 handle the file will be considered as in binary access with no + append action. + +2005-08-08 Francois Dumont + + * src/fstream.cpp: Fix annoying 64 warning and basic_filebuf::open method + from a low level file descriptor or from an HANDLE (not yet complete). + Thanks Yves Maliet report. + +2005-08-07 Francois Dumont + + * test/unit/inner_product.cpp: Fix 64 bits portability warning. + + * test/unit/cmath_test.cpp: Removed modf tests for Windows 64 platform + as the SDK is missing the underlying modff implementation. + + * stlport/cstdlib: Add a div function definition which is missing in the + Windows 64 SDK. + + * stlport/cstdio: Add vsnprintf definition which is missing in Windows + 64 SDK. + + * stlport/exception: Add flexibility for definition of vendor terminate + and uncaught_exception function namespace. Can now be defined independantly + of the unexpected_exception namespace. + + * src/dll_main.cpp: Removed explicit turn off of optimization for Microsoft + compilers after .Net 2003. There were no comment to explain why optimizations + were turned off so I guess it was a compiler bug. .Net 2003 being a major + new version I hope this bug has vanish with this version. + + * src/fstream.cpp: Removed static assertion for windows file handle to be 32 + bits. Under Windows 64, even if the API is still 32 bits handles are still + defined as void*. We will see when code will run under a real Windows 64 platform + if it is a problem. + + * stlport/config/stl_msvc.h: Add configuration for Windows 64 Platform SDK. + Expecially add automatic link to bufferoverflowU.lib to avoid modification + of STLport build system and STLport users projects. + +2005-08-06 Petr Ovtchenkov + + * src/c_locale_glibc/c_locale_glibc2.c: add explicit type conversion + to avoid warnings on 64-bits platforms; thanks Thomas Kho and + Karol Szkudlarek for report. + +2005-08-05 Francois Dumont + + * stlport/stl/_valarray.h: Add missing _debug.h header inclusion for + _STLP_ASSERT macro definition. + + * stlport/stl/debug/_hashtable.h: Fix typo in hashtable move constructor. + Thanks arabesc report. + +2005-08-05 Petr Ovtchenkov + + * doc/FAQ: some words about cross-compilation. + +2005-08-04 Francois Dumont + + * stlport/stl/_hashtable.c: Fix erase(range) implementation thanks + arabesc. + + * test/unit/hash_test.cpp: Add new test for previous fix. + +2005-08-04 Petr Ovtchenkov + + * stlport/csetjmp: sometimes, if native setjmp.h was included first, + the setjmp functions situated in global namespace, not in vendor's + std. This may confuse following csetjmp. + + * test/unit/setjmp_header_test2.cpp: test for this. + + * build/test/unit/Makefile.inc: ditto. + +2005-08-03 Francois Dumont + + * INSTALL document updated to signal no longer support of the + 'wrapper' mode. + +2005-08-02 Petr Ovtchenkov + + * stlport/stl_user_config.h, stlport/stl/_site_config.h: + fix some obsolete comments. + +2005-07-31 Petr Ovtchenkov + + * test/unit/math_aux.h, cmath_test.cpp: are_equals moved into + math_aux.h to reuse in other tests. + + * test/unit/sstream_test.cpp: check input to float, inspired by + Jeff Williams. + +2005-07-27 Francois Dumont + + * stlport/iomanip, stl/_algo.h: Removed some persistent occurences + of __in and __out keywords reserved by Microsoft. + + * stlport/stl/_pthread_alloc.c: Fix annoying warning reported by gcc. + + * stlport/config/stl_msvc.h: Fix _STLP_VENDOR_UNEXPECTED_STD macro + definition to empty rather than '1'. Could have produce a compilation + error with compilers like Intel C++ used with the VC6 native Standard + library. + + * stlport/queue, stl/_ctraits_fns.h, _hashtable.h, _numeric.h, _string.h + _tree.h: Fix macro guards used to avoid inclusion of _function.h or + _function_base.h or functional thanks Dinesh Monga report. + +2005-07-26 Petr Ovtchenkov + + * doc/FAQ: description of pseudo-leaks, thanks Michael Fink. + + * STLport (repository): STLport 5.0 RC4 + +2005-07-25 Francois Dumont + + * stlport/config/stl_evc.h: Move _DEBUG definition fix up before + stl_msvc.h inclusion to have correct library link automatically. + Thanks Michael Fink. + +2005-07-24 Francois Dumont + + * stlport/stl/_string.c, _rope.c: Add instanciation of npos for all + compilers thanks Simon. + + * test/unit/string_test.cpp: Add creation of a reference to string::npos + to force compiler to generate memory for it. Used to reveal a link error. + + * test/unit/cppunit/cppunit_mini.h: Removed redondant semi column in + CPPUNIT_TEST_SUITE_REGISTRATION macro definition. + + * stlport/config/stl_msvc.h, stl_intel.h: Concidering that compilers + emulating MSVC compilers use the same native Standard Library headers + macros _STLP_NEW_PLATFORM_SDK and _STLP_NO_VENDOR_STDLIB_L has been moved + outside the _STLP_MSVC scope. _STLP_GLOBAL_NEW_HANDLER is now defined + only for Intel compiler versions before 9.0. + + * stlport/cstdlib, stl/_cmath.h: Because of the previous remark about + emulators of MSVC using MSVC headers, macro checks for global definition + of C math functions has been changed from _STLP_MSVC to _MSC_VER. + +2005-07-23 Michael Fink + + * test/unit/locale_test.cpp: Added creating locale pointer in + test_supported_locale() when no exception handling is available. + + * src/stlport.rc: Added version info defines when not available through + windows.h. Happens on evc3 MIPS and evc3 SH3. + +2005-07-23 Francois Dumont + + * stlport/stl/_string_sum.h: Fix missing return statement in a compare + method. + +2005-07-22 Francois Dumont + + * stlport/stl/_algo.c: Fix search_n implementation for random access + iterator thanks Jim Xochellis + + * test/unit/algo_test.cpp: Add test case for the previous bug thanks + Michael Fink. + + * src/num_get_float.cpp: Fix gcc Mingwin and Cygwin special version with + building with -O2 option. + + * build/Makefiles/gmake/gcc.mak: Add -D_REENTRANT definition for cygwin and + -mthreads for mingwin platform to make STLport thread safe like under the + other supported platforms. + +2005-06-30 Petr Ovtchenkov + + * stlport/wchar.h, src/c_locale.c, stlport/stl/_threads.h: fix Netware + wcs... functions. + +2005-06-30 Francois Dumont + + * stlport/stl/_rope.h, _rope.c: Duplicate basic_string::npos definition code + in rope implementation to use a "Standard" static const npos definition when + possible depending on the compiler features. Thanks caldwed report. + +2005-06-30 Michael Fink + + * stlport/cstdlib, stdlib.h: Fixed issue with including stdlib.h after + setjmp.h; fix from 2005-06-23 wasn't solving the problem. + +2005-06-28 Francois Dumont + + * stlport/stl/_hash_func.h: For MSVC .Net compiler we grant the hash + specialization rather than the hash one to avoid 64 bits + warnings when instanciating a hashed container with the size_t key. + + * stlport/stl/_istream_iterator.h: Modify istream_iterator implementation + to avoid the default read from the istream even if the istream_iterator + instance is not used. + + * test/unit/istmit_test.cpp: Add many tests for the copy_n/istream_iterator + combination. Those tests are no active for the moment as they are failing, + will be fixed after 5.0 release. + + * build/test/unit/nmake-vc-common.mak: Tests are no more built with the + _STLP_NO_CUSTOM_IO option, see reason below. + + * test/unit/fstream_test.cpp: Add custom_facet test to check that STLport + support instanciation of basic_fstream with something else that the std::char_traits + For the moment the test fail when we try to use the stream for I/O operations + should be fixed after 5.0 release. + +2005-06-27 Francois Dumont + + * src/locale_impl.cpp: Fix locale implementation to avoid to call facet + destructor when user explicitely required not to do so. + + * stlport/stl/_fstream.c: Fix _M_setup_codecvt method implementation to avoid + a bad_cast exception on basic_filebuf construction. At this point the locale + used to instanciate it is the classic locale that might not have the necessary + codecvt facet. The user is then force to call imbue after basic_filebuf + construction otherwise I/O operations will fail. When imbue is invoked, if + the locale still do not have the necesary facet, the stream is put in the fail + state. Thanks Alexander Pototskiy + +2005-06-26 Francois Dumont + + * stlport/stl/_config_compat.h: Add _STLP_OWN_IOSTREAMS macro for backward + compatibility with library checking it. + +2005-06-23 Francois Dumont + + * src/complex.cpp, complex_trig.cpp, complex_exp.cpp: Removed code + duplication between float, double and long double version thanks to + some template functions. Thanks an Ulrich Eckhardt idear. + + * stlport/cstdlib, stl/stdlib.h: Michael Fink patch to avoid setjmp.h + inclusion problem as stdlib.h contains a setjmp macro definition. + + * test/eh/main.cpp: Redirection of std::cout and std::cerr for WinCE + thanks Michael Fink + + * stlport/config/stl_evc.h: Restore long double support for WinCE, there + is just no *l math functions. Only define _STLP_NATIVE_INCLUDE_PATH + if not already defined, giving the user a chance to override the defaults + for yet unknown SDKs. Thanks Michael Fink and Ulrich Eckhardt. + + * build/Makefiles/nmake/evc3.mak, evc4.mak: removed unneeded set of CC + for SHx; already done by setup batch. Thanks Michael Fink. + +2005-06-21 Francois Dumont + + * stlport/stl/_ios.h, _ios_base.h, _num_get.c, _num_put.c, _complex.c, + _istream.c, _time_facets.c: Fix cast expression for the cached facets, + C casts replaced by static_cast and const added when missing. + Thanks Oliver Stoeneberg report. + + * test/unit/unary.h: Replaced old STLport with new style ones. Get sqrt + function in global namespace rather than forcing use of the one in std + namespace, avoids ambiguity with VC6. + + * test/unit/resolve_name.cpp: Add _STLP_DO_IMPORT_CSTD_FUNCTIONS definition + at the top of it to force import of C symbols in std even for limited + compilers like VC6. + + * stlport/stl/_valarray.h: Add global namespace scope to C function calls + to avoid VC6 ambiguity problem. + +2005-06-20 Francois Dumont + + * stlport/config/stl_gcc.h: Fix gcc 3.4.4 detection under cygwin thanks + Ulrich Eckhardt report. + + * stlport/stl/c_locale.h: Fix _Locale_mask_t definition for Mingwin. + + * src/c_locale_win32/c_locale_win32.c: Add static assertion to check + _Locale_mask_t size. + + * src/complex_exp.cpp: Replaced complex log10 function static variables + with global constant, avoid multithreaded init problem. Thanks Ulrich + Eckhardt report. + +2005-06-17 Francois Dumont + + * stlport/stl/_alloc.h: Add initialization of the memory buffer in + allocator::allocate function and reset in allocator::deallocate to + the _STLP_SHRED_BYTE motif when _STLP_DEBUG_UNINITIALIZED is defined + to help track missing initialization issue. + + * src/dll_main.cpp: Removed now useless _Node_alloc_helper class. + + * stlport/stl/_alloc.c: Add complete cleanup of the __node_alloc static + datas in the _S_chunk_dealloc method, this is important if the clean up + occur before STLport shared lib is unloaded. + + * stlport/stl/_alloc.c: Add a static instance of __node_alloc_cleaner in the + _S_alloc_call method and change init number of allocation to 1 to force + release of memory pool only on shared library unload. + +2005-06-11 Francois Dumont + + * stlport/cstdlib, stl/_cmath.h: Add _STLP_NO_CSTD_FUNCTION_IMPORTS macro + check before import of global C functions in STLport namespace. Required + for VC6 compiler to avoid ambiguity issue. + + * src/complex.cpp, complex_epx.cpp, complex_trig.cpp: Scope math function + call with the global namespace to avoid VC6 ambiguity issue. It is safe + for the other compilers as STLport do define those function in global + namespace. + +2005-06-10 Francois Dumont + + * stlport/stl/c_locale.h: Fix Cygwin configuration, separate alpha mask + from lower and upper one to avoid all lower character to also be upper + and opposite. + + * src/ctype.cpp: Add static assertion to detect platform where + alpha = lower | upper which is wrong for STLport use. + +2005-06-10 Francois Dumont + + * stlport/stl/_hashtable.c: Fix max_load_factor management, Standard says + that load_factor <= max_load_factor and not <; the function detecting need + for rehash used to launch one even if the number of bucket do not change which + was counter performant. Fix the _M_insert_noresize method that was breaking + element order inserting elements in the middle of 2 equal elements. + Thanks Dieter Freismuth report. + + * stlport/config/stl_gcc.h: Fix relative include path for latest gcc cygwin + package. + +2005-06-10 Petr Ovtchenkov + + * build/Makefiles/gmake/mwccnlm.mak: fix compiler version collection. + + * build/Makefiles/gmake/netware/extern.mak: fix useful paths. + + * src/c_locale.c: put here wrappers for some wfuncs, due to bogus + system libs in Netware. + + * stlport/cwchar: use STLport's wchar.h to take wchar_t/wint_t for + Netware. + + * stlport/wchar.h: use correct C declaration of some wfuncs, thanks + again to ugly Netware libs. + + * stlport/ciso646, stlport/iso646.h, stlport/wctype.h: headers absent + for Novell Netware. + + * stlport/cwctype: Metrowerks define __MSL__, but we don't use MSL libs + if we have STLport for Netware. + + * stlport/cstdlib: div function from Novell Netware clib and libc lead to + system crash. + +2005-06-08 Francois Dumont + + * build/test/unit: Removed references to the now useless CPPUNIT_MINI + macro. + + * test/unit/type_traits_test.cpp: Add new test case for trivial destructor + detection. + + * stlport/stl/_fstream.h: Add missing basic_fstream construction from a + Win32 file handle, was already done for basic_ifstream and basic_ofstream, + thanks Alex Cosealin report. + +2005-06-07 Francois Dumont + + * build/test/unit/Makefile.inc: Fix syntax error at last line. + +2005-06-06 Petr Ovtchenkov + + * build/lib/configure: add config options for Metrowerks compiler for + Novell NetWare platform [references to root of MW headers/libs and to Novell's + SDK headers/libs]. + + * build/Makefiles/gmake/mwccnlm.mak: fixes for Metrowerk/NetWare. + + * build/Makefiles/gmake/app/mwccnlm.mak: idem. + + * build/Makefiles/gmake/netware/extern.mak: idem. + + * build/lib/mwccnlm.mak: idem. + + * build/test/unit/mwccnlm.mak: idem. + +2005-06-03 Francois Dumont + + * test/unit/locale_test.cpp: Remove the very platform dependent LColl + class that was listing supported locales. STLport already do so and + report it using a runtime_error exception when not supported. When + compiler do not support exception only the C locale is checked. + + * build/Makefiles/nmake: Patches from Michael Fink to + - check platform before linking to crtrtti.lib + - check right configuration when using a nmake-evc?.mak file + - update STATUS file. + +2005-06-02 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Add workaround for a Windows PSDK bug + concerning currency international symbol, the separation character is missing. + + * src/locale_impl.h, locale_impl.cpp: Fix implementation to make classic locale + implementation a normal instance that is released when the counter reach 0, the + only difference is that no delete is performed on this instance. Idem for classic + locale implementation facets. + + * stlport/cwctype: And _GLIBCPP_USE_WCHAR_T check when using GLibC as in this + case wide char functions are not imported in std and must be imported from the + global namespace. + +2005-06-01 Francois Dumont + + * src/locale_impl.h, locale_impl.cpp: Change classic locale initialization + implementation for limited compiler like MSVC6. + +2005-06-01 Petr Ovtchenkov + + * stlport/stl/c_locale.h: check gcc on MacOS X. Patch by Zdenek Nemec + + * build/Makefiles/nmake/evc3.mak, evc4.mak, targets.mak: + support SH3/SH4 platform. Patch by Michael Fink. + + * build/Makefiles/nmake/app/evc3.mak, evc4.mak: ditto. + + * build/Makefiles/nmake/lib/evc3.mak, evc4.mak: ditto. + + * build/lib/configure.bat, src/stlport.rc: ditto. + +2005-05-30 Francois Dumont + + * src/locale_impl.h, locale_impl.cpp, stlport/stl/_locale.h: An other pass + throught the classic locale initialization. Now all needed static variables + are in _Locale_impl::make_classic_locale method. Removed useless _Stl_aligned_buffer + union use in this locale initialization. Removed now useless _Locale_impl::free_classic_locale + method. + +2005-05-30 Petr Ovtchenkov + + * stlport/stl/_windows.h: worry about Windows CE when check Interlocked + API for MIPS. Patch by Michael Fink. + + * build/lib/configure.bat: remove the -p option by autodetecting platform. + Patch by Michael Fink. + + * build/Makefiles/nmake/evc3.mak, evc4.mak: corrects the evc4 makefiles + to always use the /GF switch [string pooling]. Patch by Michael Fink. + + * doc/README.evc3, doc/README.evc4: reflect changes above. + Patch by Michael Fink. + + * stlport/errno.h, stlport/time.h: when building for evc, including + errno.h and time.h often outputs the message in the #pragma statement + that including this file won't include the native one, since there is no + native include file. Now the text is only output when not building the library + and when the file is included directly, not via another STLport header file. + [Patch by Michael Fink.] + +2005-05-29 Francois Dumont + + * test/unit/locale_test.cpp: Add opendir returned value when listing + installed locale under linux. + + * build/Makefiles/gmake: Patch from Zdenek Nemec for Mac OS X support. + +2005-05-27 Francois Dumont + + * src/locale_impl.cpp: Add an initialization segment specification to make + global static variable ios_base::Init instance initialization prioritized + compare to STLport static global variable. iostreams like cout can be used + in global static variable initialization. + +2005-05-26 Francois Dumont + + * build/Makefiles/nmake/evc4.mak: Patch from Ulrich Eckhardt to use CC + environment variable defined by WCE*.bat script rather than redefining + it. + + * src/locale.cpp, locale_impl.cpp, locale_catalog.cpp: New pass to move + static global variable in function to make initialization order clear. + +2005-05-25 Francois Dumont + + * stlport/ciso646: Creation of this missing C++ standard header STLport + wrapper. + + * stlport/stl/_istream.h, _num_get.c, _algo.c, _monetary.c, _time_facets.h, + _time_facets.c: Replaced occurences of __in and __out reserved by Microsoft. + +2005-05-24 Francois Dumont + + * stlport/headers: Patch from Michael Fink to avoid inclusion of headers + not available under evc3. + + * test/unit/*_header_test.cpp: Fix tests for no iostreams mode. + + * src/locale_impl.cpp, locale_impl.cpp: Modify implementation to force + correct initialization order of static instances. + + * stlport/strstream: Add _ioserr.h file to avoid inclusion in no iostreams + mode. + +2005-05-23 Petr Ovtchenkov + + * stlport/stl/_config.h: detect endianness for Intel's 64bit Pentium and + Itanium processors. Thanks Albrecht Fritzsche for contribution. + +2005-05-20 Francois Dumont + + * build/test/eh: Patch from Michael Fink to add EVC4 support for this test + suite. + + * src/fstream.cpp: Use of Wlodek Szafran implementation for the _Filebuf_base::_M_read + method which is more performant than the previous one. + + * test/unit/fstream_test.cpp: Add of a test for the special Win32 file format. + + * test/unit: Add of many test to check Standard C/C++ headers independancy + and correct C header implementation. + +2005-05-18 Francois Dumont + + * src/fstream.cpp: Fix buffer overflow in _Filebuf_base::_M_read method + for the Win32 platform implementation thanks Wlodek Szafran report. + + * src/c_locale_dummy/c_locale_dummy.c: Patch from Michael Fink for wrong C + prototype. + +2005-05-17 Petr Ovtchenkov + + * test/unit/locale_test.cpp: some fixes in moneypunct test, related + to international currency format; some problems still remains, due to + unclear specifications---if international currency 3-chars abbreviation + used in suffix form, additional space will be appended + ['1 234.56 RUR ']. This is due to intl_fmp.curr_symbol() == "RUR ", + and the last is conform to OpenGroup spec. + +2005-05-16 Petr Ovtchenkov + + * src/c_locale_stub.cpp: "stub" implemntation moved into + c_locale_dummy/c_locale_dummy.c, this file removed + + * src/c_locale.c: include c_locale_dummy/c_locale_dummy.c, in case of + no real locale implementation. + + * src/c_locale_dummy/c_locale_dummy.c: This is a "stub" implementation + of the "c_locale.h" interface, intended for operating systems where + we have not yet written a real implementation. A C++ library using + this stub implementation is still standard-conforming, since + the C++ standard does not require that any locales other + than "C" be supported. + + * build/lib/Makefile.inc: src/c_locale_stub.cpp removed. + + * src/facets_by_name.cpp: add comments in the _Init_monetary_formats. + + * src/c_locale_glibc/c_locale_glibc2.c: annotate some monetary-related + functions. + +2005-05-14 Petr Ovtchenkov + + * build/Makefiles/gmake/aCC.mak: HP's aCC compiler and HP-UX os support. + This isn't really checked and should be fixed on real system. + + * build/Makefiles/gmake/app/aCC.mak, gmake/lib/aCC.mak: ditto. + + * build/Makefiles/gmake/hp-ux/extern.mak, lib.mak: ditto. + + * build/Makefiles/gmake/hp-ux/rules-install-so.mak, rules-so.mak: ditto. + + * build/Makefiles/gmake/hp-ux/gmake/hp-ux/sys.mak: ditto. + + * build/lib/aCC.mak: ditto. + + * build/test/unit/aCC.mak: ditto. + + * build/test/unit/gcc.mak: remove dbg-shared tag from default build; + if you need unit tests with debug info and without _STLP_DEBUG, make this + tag explicitly. + +2005-05-14 Francois Dumont + + * stlport/stl/_config.h, _config_compat_post.h, _cwchar.h, _epilog.h: + Patch from Albrecht Fritzsche to remove C++ comment from files accessible + by a pure C compiler. + + * stlport/stl/c_locale.h: idem. + + * src/c_locale.h, c_locale_glibc/c_locale_glibc2.h: idem. + + * src/gcc_localeinfo.h, c_locale_win32/c_locale_win32.c: idem. + + * build/Makefiles/gmake/gcc.mak: Add the -ansi option to the C compiler + command to know if any regression occur concerning use of C++ comment + in C files. + +2005-05-13 Francois Dumont + + * src/c_locale_win32/c_locale_win32.c: Improve the locale name recognition + system to be more unix compliant. Now you can pass locale name like + lang_country[.codepage] with lang being one of the ISO 639 values and + country one of the ISO 3166 ones. + + * test/unit/locale_test.cpp: Add a test case for the ctype facet. + + * test/unit/locale_test.cpp: Now list all the installed locales under + Win32 to test more locale than the simple french one. + + * stlport/config/stl_msvc.h: Removed _WINDLL macro check when trying + to guess what type of library (dynamic/static) the STLport user want + to link with. _WINDLL is defined when generating a dll but it do not + imply anything on the user wish. + + * src/ctype.cpp: Improve the ctype::scan_is method, you can now scan + for a character conforming to several ctype_base::mask and not only to one. + + * src/ctype.cpp: Idem previous for ctype::scan_not which returns the first + character that do not conform to any of the passed mask. + + * test/eh: Restore exception handling test suite. Removed some equality + tests that is no more valid for hash containers, this kind of test + is better in the unit tests. Add makefiles for MSVC compilers. + + * stlport/stl/_tree.c: Fix _M_insert method that was leaking in case of + exception thrown by the comparison operator, reported by eh tests. + +2005-05-09 Francois Dumont + + * stlport/stl/_ctype.h, src/ctype.cpp: Reenforce data encapsulation of the + ctype template specialization class. class static arrays + _S_upper, _S_lower, _S_classic_table removed from the definition and hiden + in the .cpp file. + + * src/dll_main.cpp: Change _STLP_UNIX macro check in _STLP_PTHREADS check + as per thread allocator is only supported if the Posix pthread API is used, + thanks a Albrecht Fritzsche remarked. + +2005-05-07 Francois Dumont + + * stlport/config/stl_gcc.h: Patch from John Smith for Mac OS X support. + + * test/unit/locale_test.cpp: Idem previous. + + * build/Makefiles/gmake/cygming/lib.mak, sys.mak: Import lib extension + change from .lib to .dll.a for Mingw like under Cygwin. ld linker + looks for .dll.a before .lib, avoid conflict with Cygwin lib. + +2005-05-07 Petr Ovtchenkov + + * stlport/errno.h: use C++ 'using' construction only for C++. Thanks Gary. + + * build/Makefiles/gmake/lib/gcc.mak: option for libname for Darwin. + + * build/Makefiles/gmake/app/mwccnlm.mak: build for Novell NetWare 5 + with MetroWerks 7 and 8 compilers. + + * build/Makefiles/gmake/lib/mwccnlm.mak: ditto + + * build/lib/mwccnlm.mak: ditto + + * build/Makefiles/gmake/mwccnlm.mak: ditto + + * build/Makefiles/gmake/netware/extern.mak: ditto + + * build/Makefiles/gmake/netware/lib.mak, sys.mak: ditto + + * src/_stdio_file.h, num_get_float.cpp, num_put_float.cpp: ditto + + * stlport/cstdio, cwchar, cwctype, stdio.h, wchar.h: ditto + + * stlport/config/stl_mwerks.h: ditto + + * stlport/stl/_config.h, _fstream.h, _hashtable.c, _sstream.c: ditto + + * stlport/stl/_threads.h, c_locale.h, char_traits.h: ditto + + * build/Makefiles/gmake/sysid.mak: treat mwccnlm as cross-compiler, + set correct TARGET_OS and OS-related macros. + + * stlport/stl/_valarray.h: remove exhaustive this->. + +2005-05-04 Francois Dumont + + * stlport/config/stl_msvc.h: Change configuration for MSVC .Net 2003 and + 2005 that seems to have a bug in the namespace management. + + * stlport/stdlib.h: Add errno.h inclusion from this file for gcc mingw + as this compiler version do define errno macro in stdlib.h as MSVC do. + +2005-05-03 Francois Dumont + + * stlport/stl_user_config.h, stl/_site_config.h, config/stl_gcc.h, _prolog.h, + _epilog.h: Use strict Ansi C comments (/**/) for headers accessible thought + the STLport C headers. + + * stlport/C headers: Cleaned from C++ style comments. + +2005-05-02 Francois Dumont + + * build/Makefiles/nmake/vc-common.mak: Restore of LDFLAGS_A_REL introduce + the 2004-10-30 and lost the 2005-04-16, it avoids warning due to use + of the whole program optimization with VC.Net 2003 and 2005. + + * stlport/stl/_string_io.c: Modification of the basic_string i/o operators + in the way it deals with the size_type and streamsize difference; it is + equivalent with the former one but do not generate warning with gcc + (mingwin). + + * stlport/stddef.h, stdlib.h, errno.h: Fix issue under MSVC compilers where + native stdlib.h and stddef.h are defining errno macro without including + errno.h forbiding STLport to do so. Now errno.h will report this problem with + an explicit #error. + + * test/unit/test_errno.cpp: Improvement of the test to reveal the previous + issue. + +2005-05-02 Petr Ovtchenkov + + * makesystem (repository): restore experimental support of MetroWerks + compiler for NetWare, with help of GNU make and Cygwin environment. + +2005-04-29 Francois Dumont + + * stlport/stl/_time_facets.c: gcc warnings reveal that we were missing some + ctype::widen method call to compare things like month or day names. + Also simplified implementation of the __match and __get_formatted_time that + do not really need all the template parameters passed to it. + + * stlport/stl/_num_put.c: Add a cast to make call to the function min more + clear, it will perhaps help EVC++ builds correctly. + + * src/strstream.cpp, stlport/stl/_sstream.c: Removed static assertion + replaced by modified implementation that takes into account the difference + between size_t and streamsize. + +2005-04-28 Francois Dumont + + * test/unit/limits_test.cpp: Improve integral types limit test for type + of unknown sign. In this case we check the min value of this integral type, + if 0 the type is unsigned. Moreover we check, except for the bool type, + the sign of -1 cast to the integral type, bool is a special type that + generate warning when built from -1 (MSVC). + + * src/ctype.cpp: Creation of a small helper structure to check the validity + of a wchar_t value used as an index. This helper struct takes into account + the compiler representation of the wchar_t type, is it a sign type or not. + This helper avoids warning when wchar_t is unsigned. + + * src/num_get.cpp: Removed unused _Initialize_get_digit function and + associated narrow_digits and narrow_xdigits arrays. + +2005-04-28 Petr Ovtchenkov + + * stlport/stl/_sstream.h, _num_put.c: __in replaced by __imode, __out + by __omode or __oi due to MS privatize __in and __out. Thanks Michael Fink. + +2005-04-27 Francois Dumont + + * src/fstream.cpp: Fix Win32-64 file stream implementation. _M_read and + _M_write can now correctly handle respectively read and write of really + big buffers ( > 2Go) + + * using/iosfwd.h, stlport/strstream.h, stl/_rope.h, _rope.c, _complex.h: Removed + references to the _STLP_USE_NEW_IOSTREAMS macro, STLport only support "new" + iostreams. + + * test/unit/max_test.cpp, min_test.cpp: Add tests to check that min and + max are not defined as macros. + + * test/fstream_test.cpp: Add check in creation of test_file.txt + as following tests depends on its content. + + * src/strstream.cpp, stdio_streambuf.cpp: Fix potential issue because of + the difference between streamsize and size_t of ptrdiff_t. + Add static assertion to clearly specify how streamsize must be to have + a correct behavior. + + * stlport/stl/_num_put.c, _num_get.c, _fstream.c, _moneraty.c: ditto. + + * src/ctype.cpp: Restore check on wchar_t positivity as according + 2005-02-22 Petr Ovtchenkov reports wchar_t can be signed. + +2005-04-26 Francois Dumont + + * src/num_get_float.cpp: Fix mingwin support for 64bits integer type + thanks Wlodek Szafran + +2005-04-25 Francois Dumont + + * stlport/stl/_time_facets.c: Fix __pos type in __match function and removed + unused __max_pos definition and initialisation. + + * src/c_locale_win32/c_locale_win32.c: Add some cast to remove warnings. + + * stlport/stl/_moneraty.c: Fix __witdh definition to use streamsize rather + than size_t to avoid warnings. + +2005-04-25 Petr Ovtchenkov + + * build/test/gcc.mak: workaround for [bug?] gmake, that sometimes lose + increment of target-specific macro and, may be, under condition. + Thanks Jeff Williams. + + * build/Makefiles/gmake/icc.mak: add icc 8.1 compiler-specific libs + + * build/Makefiles/gmake/icc.mak: detect icc version; add includes + from compiler to include path + + * test/unit/cppunit/test_main.cpp, cppunit_mini.h: add option -x, run all + except specified CLASS::TEST. + +2005-04-23 Francois Dumont + + * stlport/stl/_ioerr.h: #error message modification thanks Michael Fink. + +2005-04-22 Francois Dumont + + * stlport/stl/_istream.c: Fix _M_read_buffered function implementation, + there used to be a wrong implicit conversion from streamsize to ptrdiff_t, + which fail when sizeof(streamsize) > sizeof(ptrdiff_t). + See 2005-04-21 Petr report. + + * test/unit/: Replaced all _STLP_NO_IOSTREAMS occurences with the STLport + internal equivalent _STLP_USE_NO_IOSTREAMS. The first one is defined + by the client while the second depends on the first and on the compiler + abilities, makes the unit tests more portable. + + * stlport/stl/_cmath.h: Fix for Intel C++ compiler that also have all + C math functions in global namespace. + +2005-04-21 Francois Dumont + + * stlport/stl/_hashtable.h: Extend the hashtable template methods extension + to the method computing the bucket from the key thanks Dominik Siatkowski. + + * stlport/stl/_threads.h: Disable 64 bits portability warning for + MSVC compilers. MSVC do not see that the called function comes from + a macro that is different under Win32 and Win64. + +2005-04-21 Petr Ovtchenkov + + * test/unit/sstream_test.cpp, fstream_test.cpp: integral type for + ptrdiff_t shorter than for streamsize; this cause problem on + Win32 platform, that support files larger than 4GB. + Thanks Timothy Tenebekov for report. + +2005-04-20 Francois Dumont + + * stlport/stl/debug/_debug.c: Small Borland compiler fix to avoid call to + vsnprintf before version 0x550 thanks esanfo. + + * src/dll_main.cpp: Fix bug reported by Intel C++ (icl) compiler. + +2005-04-20 Petr Ovtchenkov + + * src/num_get_float.c: use uint64_t for 64-bit, but unsigned long long + for constants. This fix problem on linux x86_64 [amd64]. + +2005-04-16 Francois Dumont + + * test/unit/cppunit/test_main.cpp: Patch from Michael Fink to improve + the macro filter for including windows.h (UNDER_CE rather than WIN32). + + * build/test/unit/STATUS: Update from Michael Fink and myself. + + * build/Makefiles/nmake: Apply Michael Fink patch to generate .pdb file + even in release mode and to install them in bin and lib folders next to + the .dll and .lib files. + + * stlport/stl/_algobase.c: Add missing const in return type of the const + version of find specialized for const char*. + +2005-04-16 Petr Ovtchenkov + + * stlport/stl/_algobase.c: memchr return NULL if value not found, + while find() [specialization for char *] should return last + [see record 2005-02-27 below]. Thanks Joshua Berne for report. + + * test/unit/find_test.cpp: if char not found, char specialization of + find() should return last, not NULL. + +2005-04-14 Petr Ovtchenkov + + * stlport/stl/_list.h, _slist.h: add this-> resolution to get_allocator + [required in the member templates to resolve possible ambiguity] + +2005-04-13 Francois Dumont + + * stlport/stl/_list.h, _slist.h: Add missing get_allocator() call when + building temporary list or slist instances in insert methods. + +2005-04-12 Petr Ovtchenkov + + * stlport/errno.h: solution 2005-04-12 not useful. Simplified schema, + semantically equivalent to Francois', but without extra function definition + [see records 2005-03-31 and 2005-04-01] + +2005-04-12 Petr Ovtchenkov + + * stlport/errno.h: check if we undefine previously defined errno + +2005-04-11 Petr Ovtchenkov + + * stlport/errno.h: save original errno definition + +2005-04-10 Petr Ovtchenkov + + * STLport (repository): STLport 5.0 RC3 + +2005-04-08 Francois Dumont + + * test/unit/locale_test.cpp: Add __FreeBSD__ macro check for the workaround + announced as Free BSD specific by the comment next to it. + + * stlport/stl/_config.h: Add undef of _STLP_USE_DYNAMIC_LIB when in + NO_IOSTREAMS mode, this macro was generating buggy code in this case + for some commpilers (gcc mingwin). + +2005-04-07 Francois Dumont + + * build/lib/nmake-vc-common.mak: Removed useless add of STLport/lib to + library paths when building STLport lib. + + * build/Makefiles/nmake/*: Removed useless specification of the MSVC default + install directory, all the job is done by the vcvcars32.bat script that sets + the LIB env variable to the real MSVC install directory. + + * test/unit/unordered_test.cpp, locale_test.cpp: Removed gcc mingw warnings. + + * build/Makefiles/nmake/icl.mak, app/icl.mak, lib/icl.mak: Removed the + whole program optimization option, looks like it is confusing icl. + + * stlport/stl/debug/*.h: Removed useless _Get_base non-const overload. + In addition to being useless Intel compiler emit compilation error about it. + +2005-04-06 Petr Ovtchenkov + + * test/unit/cppunit/test_main.cpp: windows.h required here + [see 2005-04-04; patch by Michael Fink]. + + * stlport/stl/_istream.h: __is replaced by __istr, due + to MS privatize __is. + + * stlport/stl/_num_get.h: __in replaced by __ii, due to MS + privatize __in too. + + * stlport/stl/_config.h: Visual C++ 8 uses _M_AMD64 to identify + EM64T and AMD64 platforms [thanks Mike Roberts]. + +2005-04-05 Francois Dumont + + * stlport/config/stl_evc.h: apply patch from Michael Fink to add support for + various EVC SDK. + + * stlport/stl/_cmath.h: An other adaptation to the Intel C++ compiler. + + * build/lib/nmake-vc-common.mak, test/unit/nmake-vc-common.mak: Removed check + of STLP_BUILD_FORCE_[STATIC,DYNAMIC]_RUNTIME environment variables, + moved in a common build system file. + + * build/Makefiles/nmake/vc-common.mak: Add checks of + STLP_BUILD_FORCE_[STATIC,DYNAMIC]_RUNTIME variables. + + * build/lib/configure.bat: Add a clean option to remove the hidden + Makefiles/config.mak file. + + * stlport/stdexcept: Disable 'non dll-interface class used as base' warning + when building STLport dll linked with the static runtime. + +2005-04-04 Francois Dumont + + * test/unit/mfunptr_test.cpp: Add necessary macro checks for a test + that require partial template specialization compiler support. + +2005-04-04 Petr Ovtchenkov + + * errno.h, time.h, test_errno.cpp: evc3 and evc4 has no errno.h + and time.h headers [patch by Michael Fink]. + + * stl_evc.h, _windows.h, test_main.cpp: workaround to not include + in STLport headers (it is still needed for building + the lib and the unit tests, but that should be no problem). + Occurences of GetCurrentProcess() used in _STLP_ABORT were replaced + with the result of the inline function, which returns a pseudo- + HANDLE value. [patch by Michael Fink] + + * cwchar, wchar.h, stl/_cwchar.h: fix access to mbstate and wint_t + for FreeBSD. + + * build/Makefiles/gmake/sysid.mak, app/gcc.mak, lib/gcc.mak: + FreeBSD before 5.3 require linkage with libc_r, while 5.3 and + later use libpthread. + + * test/unit/locale_test.cpp: add std:: namespace qualifier for + gcc 3.3.2 and/or FreeBSD. + + * libstlport, test/unit: library build and most tests pass for + FreeBSD 5.3 and FreeBSD 4.10. + +2005-04-02 Francois Dumont + + * stlport/cstdlib: Fix missing div taking long definition for VC71. + +2005-04-01 Francois Dumont + + * stlport/errno.h: Add comments to explain the file code. + + * stlport/stl/_string_io.h: Yet an other fix to the i/o basic_string + operators that was not right under cygwin/mingwin. + + * build/Makefiles/gmake/gcc.mak: Merge the 2 distinct cygmin blocks + in one and add -Wall and -Wsign-promo warnings. + +2005-04-01 Petr Ovtchenkov + + * test/unit/test_errno.cpp: fix test, errno may be non-zero without + any error, but it reflect error code after some function fail. + This not the same. + + * test/unit/mfunptr_test.cpp: add step-by-step test how compiler + recognize bind of member function for find_if. Not all compilers may + understand this. Thanks Markus for test idea. + +2005-03-31 Francois Dumont + + * stlport/errno.h: Fixed for MSVC compilers, should still be fine for + others. + + * test/unit/test_errno.cpp: Modified to be a real unit test. Also test + errno assignment. + +2005-03-30 Francois Dumont + + * stlport/stl/_fstream.c: Try to fix ambiguous type deduction in a max + call under WinCE. + + * stlport/stl/_cmath.h: Fix missing non Standard hypot function under + WinCE thanks Michael Fink. + + * stlport/stl/_cmath.h: Attempt to fix the WinCE math function support + where neither *f nor *l functions are present even if the compiler + support the long double type. + +2005-03-30 Petr Ovtchenkov + + * stlport/assert.h, float.h, iso646.h, limits.h, errno.h: + added in accordance with Standard D.5 [compatibility with standard + C library] to prevent wrong std interpretation in ill-formed native + headers [definition of namespace std in C headers]. + + * test/unit/test_errno.cpp: check correct processing of errno.h + header. + + * build/test/eh: build eh tests again. + + * test/eh/LeakCheck.h, TestClass.cpp, TestClass.h: fix and clear. + + * test/eh/test_hash_map.cpp, test_hash_set.cpp: hash_set/hash_map + has no == operator [no container equality]; this fix is quick-and-dirty + +2005-03-29 Petr Ovtchenkov + + * build/Makefiles/gmake/app/rules.mak, freebsd/rules-so.mak, + linux/rules-so.mak, openbsd/rules-so.mak, sunos/rules-so.mak: + fix link sequence---the end objects should be really last, i.e. after libs. + This affected by linkage without libstdc++. + + * stlport/stl/_cwchar.h, stlport/wchar.h: workarounds for FreeBSD. + + * due to change in link sequence most tests [including exceptions] pass + for uClibc. + + * stlport/mmemory.h: garbage, removed. + + * stlport/export: ditto. + +2005-03-28 Francois Dumont + + * stlport/stl/_istream.h, _ostream.h: Fix assignment operators prototypes + for the sentry struct. Thanks -Weffc++ feature of gcc. + + * build/Makefiles/gmake/cygmin/rules-install-so.mak: Add missing folder + creation in the install process thanks Charlemagne report. + + * build/Makefiles/nmake/icl.mak: Fix Intel compiler build system under + Windows. + +2005-03-28 Petr Ovtchenkov + + * src/num_put_float.cpp: in FreeBSD no *cvt* functions now, use sprintf; + + * stlport/config/stl_gcc.h: in FreeBSD no math *l functions and llabs. + + * test/unit/string_test.cpp: more test with assignment. + +2005-03-25 Petr Ovtchenkov + + * stlport/stddef.h: fix typo in header id---this mistake prevent + inclusion _epilog.h. + + * test/unit/epilog_test.cpp: regression test for bug above. + + * stlport/cstdio: fix header id to avoid possible errors. + +2005-03-24 Petr Ovtchenkov + + * build/Makefiles/gmake/lib/gcc.mak, build/Makefiles/gmake/app/gcc.mak: + code reorganization to simplify platform configuration with or without + -nostdlib [avoid link with libstdc++ or libestdc++]; now link without + libstdc++/libestdc++ supported on Linux and OpenBSD. + + * build/Makefiles/gmake/openbsd/rules-so.mak: idem. + + * build/Makefiles/gmake/freebsd/rules-so.mak: idem. + + * src/num_put_float.cpp: clean float convertions for OpenBSD and FreeBSD; + OpenBSD and FreeBSD use STLport code instead of sprintf now. + + * stlport/stl/_cwchar.h: allow masquarade to use mbstate_t from native + cwchar header on OpenBSD. + + * stlport/config/slt_gcc.h: llabs and *l math functions absent in OpenBSD; + define __unix, that missed in OpenBSD. + +2005-03-23 Petr Ovtchenkov + + * build/Makefiles/gmake/app/gcc.mak, build/Makefiles/gmake/lib/gcc.mak: + incorporate gcc language support library into libstlport.so + [add ~100k to library], but libsupc++ don't required more in link stage + for applications and libraries that use stlport, as in case with + libstdc++. + +2005-03-22 Francois Dumont + + * stlport/stl/_string_io.c: Fix basic_string stream output operator + implementation for cygwin. + + * stlport/stl/_cmath.h: Add fixes for cygwin support that handle long double + but do not have *l maths function per default. + + * src/complex_exp.cpp: Fix call to logl, replaced by call to log. + + * src/complex_trig.cpp: Fix mingw support by checking M_LN2l existence + before using it. + + * test/unit/copy_test.cpp: Change test cases to avoid use of iostreams. + + * test/unit/string_test.cpp: Add a small check to test use of istream width + in the input operator. + + * stlport/cstdlib, stlport/config/stl_msvc.h, stl_gcc.h: Creation of the + _STLP_NO_VENDOR_STDLIB_L macro to report support of the llabs and lldiv + function. + +2005-03-21 Petr Ovtchenkov + + * stlport/stl/_cmath.h: removed logf, expf, sinf, cosf; option + -fno-builtin passed to gcc compiler solve the problem with uClibc; + this imply same option in building uClibc, as it is in normal uClibc build. + This is partial rollback of changes 2005-03-16. + + * build/lib/configure, build/Makefiles/gmake/gcc.mak: add ability to pass + extra flags to C++ compiler + +2005-03-18 Francois Dumont + + * test/unit: Modified some test in order to check the _STLP_NO_IOSTREAMS + mode. This new mode of tests reveals the following bugs: + + * stlport/stl/_rope.c: Add check of _STLP_USE_NO_IOSTREAMS macro before + include of iostream header. + + * src/dll_main.cpp, stlport/stl/_string_fwd.h: Removed implementation + of __get_c_string, moved to _string.h header, once string has been defined, + as an inline function. + +2005-03-18 Petr Ovtchenkov + + * src/complex_trig.cpp: avoid call log functions during static + initialization, if possible. + +2005-03-17 Francois Dumont + + * stlport/stl/_string_io.h: Fix implementation that used to think that + size_t and streamsize was simply aliases. Thanks Jay Amin report. + + * stlport/config/_prolog.h: Add comment about the reason of alignment + specification when using MSVC compilers. Fix alignment for Win64 platform. + + * stlport/stl/_alloc.h: Fix _ALIGN enum definition for _Win64 platform. + + * src/string_w.cpp: Fix wrong class export under debug mode thanks + Charlemagne report. + + * build/Makefiles/nmake: Preparation of the build system for icl (Intel cl + compiler (mimic cl compiler from Microsoft). + +2005-03-16 Petr Ovtchenkov + + * stlport/stl/_cmath.h: added logf, expf, sinf, cosf---this fix + uClibc 0.9.27/gcc problem. Fix one macro for declaration math + functions in case of absent *f functions. + +2005-03-16 Francois Dumont + + * stlport/config/*: Clean native header include path macro definition. + Removed many useless definition simply recreating the default behavior. + Removed the unreferenced _STLP_NATIVE_OLD_STREAMS_INCLUDE_PATH macro. + + * stlport/stl/_site_config.h: Update relative path headers macros + documentation to reflect more accurately default behavior and add + the unreference _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH macro. + +2005-03-15 Francois Dumont + + * stlport/stl/_fstream.h: Fix _Noconv_input helper class default implementation. + Returns traits::eof() rather than 0. + +2005-03-15 Petr Ovtchenkov + + * src/complex.cpp, complex_exp.cpp, complex_io.cpp, complex_trig.cpp: + use achievements in _cmath.h---use overloaded funcs; mascarade from + complex_impl.h not required more. + + * src/complex_impl.h: deleted. + + * test/unit/cmath_test.cpp: check nested sqrt(sqrt)---possible problem with macro + +2005-03-14 Francois Dumont + + * stlport/config/stl_msvc.h: _STLP_SAME_FUNCTION_NAME_RESOLUTION_BUG notion + removed, impossible to reproduce, maybe fixed by the #pragma intrinsic/function + directives. + + * stlport/stl/_cmath.h, cstdlib: Fix .Net 2003 and .Net 2005 beta support. + + * stlport/stl/_cmath.h: Removed _STLP_SAME_FUNCTION_NAME_RESOLUTION_BUG notion, + no more _STLP_DO_* macros. + + * test/unit/valarray_test.cpp: New tests to check right compilation of + transcendentals valarray functions. + + * stlport/stl/_valarray.h: Replaced all the _STLP_DO_* macros by real + function calls. + + * src/fstream.cpp: Add INVALID_SET_FILE_POINTER definition when missing for + Win32 IO implementation thanks Michael Fink report. Add compilation check + of right STLport file descriptor definition. + +2005-03-12 Francois Dumont + + * stlport/stl/_tree.h: Fix equal_range_unique bug thanks Gunter. + + * test/unit/map_test.cpp: Add of the test to reproduce the bug + above. + +2005-03-11 Petr Ovtchenkov + + * build/test/unit/gcc.mak: don't write runtime path to libstlport + in case of crosscompilation. + + * stlport/stl/_cmath.h: exclude *f and *l variants of math functions + if ones absent in system; add missed hypot function; few workarounds + for uClibc and for VC. + + * src/complex.cpp, complex_exp.cpp, complex_trig.cpp: workaround + for systems without *f and *l variants of math functions. + + * test/unit/resolve_name.cpp: exclude test line that confuse VC. + + * stlport/cstdlib: div isn't intrinsic for VC. + + * stlport/config/stl_gcc.h: don't use *f and *l math functions in + case of uClibc. + +2005-03-09 Petr Ovtchenkov + + * doc/FAQ: FAQ was established. + +2005-03-07 Francois Dumont + + * stlport/stl/_bitset.h, _bitset.c: Avoid include of istream when + NO_IOSTREAMS mode thanks Bruno report. + + * stlport/stl/char_traits.h: Modification of the streamoff and streamsize + definition to take into account the 64 bits file access support. + + * test/unit/fstream.cpp: New test for big files ( > 2Go) unactivated by + default. + +2005-03-06 Petr Ovtchenkov + + * stlport/cstdlib, stlport/cmath, stlport/stl/_cmath.h: define + overloaded functions in the scope of global namespace and then import + all in stlp_std with 'using' directive. This is better than + solution from 2005-03-04 below. + + * stlport/cmath: include cstdlib, due to declarations of abs + with integer types required in overload and when 'using'. + + * src/complex.cpp, src/complex_exp.cpp, src/complex_trig.cpp: replace + macros that possibly will be removed. + +2005-03-05 Francois Dumont + + * stlport/stl/_construct.h: Simplification of the _Copy_Construct + function, now only takes a single template parameter and only call + the strict copy constructor. Creation of the _Param_Construct function + that replace the former _Copy_Construct implementation. + + * cstdlib: Fix abs definition for MSVC compilers. + + * test/unit: Fixing 64 bits warnings in many tests. + + * src/c_locale_win32/c_locale_win32.c: Fixing 64 bits warnings. + + * src/fstream.cpp: Creation of the INVALID_STLP_FD constant to represent + a portable invalid file descriptor. + + * stlport/stl/_streambuf.c: Explicit instanciation of basic_streambuf + for wchar_t removed, already exists in _streambuf.h thanks + Charlemagne report. + + * stlport/stl/char_traits.h: Setup modification, Windows platform now + use ptrdiff_t to define streamoff, make the code more portable. + +2005-03-04 Petr Ovtchenkov + + * stlport/stl/_cmath.h: removed recursive include of cmath header + + * src/complex_impl.h: include cmath instead of stl/_cmath.h + + * stlport/stl/_complex.h: idem. + + * stlport/stl/_valarray.h: idem. + + * test/unit/unary.h: workaround for namespace resolution. + + * test/unit/resolve_name.cpp: test to show problem with namespace resolution. + + * stlport/cmath, stlport/stl/_cmath.h: standard require overloaded math + functions for double and float arguments. Import with 'using' directive + can't provide such overload. Removed import with 'using', used direct + inline wrappers in namespace stlp_std instead. Cleaning code. + + * stlport/cstdlib: complement to cmath---the same as above for abs. + + * stlport/stl/_config.h: uClibc declare pthread_spin... but ones absent + in the library indeed. + +2005-03-02 Petr Ovtchenkov + + * build/Makefiles/top.mak: move .PHONY target to the bottom, it work here + as expected + + * build/Makefiles/gmake/depend.mak, targetdirs.mak: reduce amount of dummy + targets; fix creation of directories for install. + + * build/Makefiles/gmake/linux/rules-install-so.mak: ditto. + + * stlport/stl/_config.h, stlport/config/stl_gcc.h: support of gcc/linux/uClibc + + * src/_stdio_file.h, num_put_float.cpp, stdio_streambuf.cpp: uClibc support + + * stlport/cwchar: ditto. + +2005-03-01 Francois Dumont + + * stlport/stl/_threads.h, _windows.h, _rope.c: Fix of a 64 bits portage issue + in the rope implementation under Win64 thanks Patrick Bergeron report. + +2005-02-28 Francois Dumont + + * stlport/stl/_hashtable.c: hashtable::erase fix thanks Patrick Bergeron. + +2005-02-27 Francois Dumont + + * stlport/stl/_algobase.h, _algobase.c: Fix find algo overload for + char* and const char*. Now the overload is on the __find underlying + function. + + * test/unit/alg_test.cpp: Add a test case for the search_n algo. + + * stlport/stl/_algo.c: Integration of the search_n algo implementation + for the random access iterator from Jim Xochellis. + +2005-02-25 Francois Dumont + + * stlport/stl/_slist.h: Fix _M_splice_after method. + + * stlport/stl/debug/_slist.h: Add of many missing checks for the special + slist before_begin iterator which returns true to the _Dereferenceable + function call but is not dereferenceable in reality. Passing this + iterator to method like erase or insert was invalid but was not detected + by the _Dereferenceable function. + + * test/unit/slist_test.cpp: Add checks for insert, insert_after, splice + splice_after methods. + + * Patch from Ulrich Eckhardt: + - Fix macro _MSC_VER macro checks, VC6 should be found using _MSC_VER < 1300 + check rather than _MSC_VER == 1200 to take into account compilers like + EVC4 that is a VC6 based compiler with _MSC_VER == 1202. + +2005-02-25 Petr Ovtchenkov + + * stlport/stl/_algobase.h: wrong parameters order in call to memchr, + thanks Patrick Bergeron. + +2005-02-24 Francois Dumont + + * stlport/stl/char_traits.h: Patch from Ulrich Eckhardt fixing a wrong + _STLP_CALL specification on member operators and some cosmetic changes. + +2005-02-22 Petr Ovtchenkov + + * test/unit/limits_test.cpp: wchar_t is treated as signed, except when it + equiv to unsigned short on Wins systems. + + * Repository: STLport 5.0 RC2 + +2005-02-20 Francois Dumont + + * Add many private definition of copy constructor and assignment operators + to avoid very anoying warnings under some compilers (MSVC 7.0 7.1). + + * build/Makefiles/gmake/cygmin/sys.mak, test/unit/string_test.cpp: + Mingw fixes thanks Shura Zam. + +2005-02-19 Francois Dumont + + * stlport/stdexcept: Removal of a MSVC 7.0 and 7.1 workaround. Those compilers + have a bug resulting in the generation of very long compiler message as + soon as a simple compiler warning or error occur. Those messages are + template instanciation context of previous disabled warning. Warning message + are correctly disable but template instanciation context is kept until + an enable warning or an error happen. There is nothing to do against that + at STLport level except fixing or disabling warnings for unit tests build. + + * build/Makefiles/nmake/vc70.mak: Add missing file. + +2005-02-18 Francois Dumont + + * stlport/stl/_hashtable.h, _unordered_set.h, _unordered_map.h: Code review + based on the 12 April 2004 Technical Report document. Add missing hash policy + and bucket_size methods. Fix of the rehash method behavior. erase method + bug fix. + +2005-02-14 Francois Dumont + + * stlport/string, /stl/_string.h: Modification of the include schema. + _string_io.h no more included from _string.h to avoid circular headers + dependencies as basic_string class is used in iostream implementation. + This headers is now included from the Standard string header. Useless + cctype include removed from _string.h. _string_hash.h also moved from + _string.h to string for consistency. + + * stlport/stl/_complex.c: Add of the _string_io.h header include that + was missing after string include schema modification. + + * stlport/stl/_string_base.h, _string.h: basic_string move traits STLport + struct definition do not depends anymore on the _String_base struct to + make definition more clear. + +2005-02-08 Francois Dumont + + * stlport/stl/_config.h: Fix endianness for AMD 64 thanks Karol + Szkudlarek. + +2005-02-07 Boris Fomitchev + + * stlport/stl/_config_compat_post.h, stlport/stl/_relops_hash_cont.h + stlport/stl/_list.h, stlport/stl/_slist.h, stlport/stl/_map.h, + stlport/stl/_set.h: 4.6 compatibility fix + +2005-02-04 Francois Dumont + + * stlport/stl/_alloc.c: Fix of the _S_refill method in the lock free + implementation thanks Felix Wyss. + + * stlport/stl/_hashtable.h: _M_get_elem_ite set as static when possible + to fix a MSVC6 problem thanks Michael Fink report. + + * stlport/new, config/stl_evc.h: EVC patch for MFC support from Michael Fink. + + * build/Makefiles/nmake/evc3.mak, evc4.mak: Warning level raised to 4 + by Michael Fink. + + * doc/README.evc3, README.evc4 doc update from Michael Fink. + + * src/vc_warning_disable.h: Add warning 4201 and 4214 disabling for EVC. + +2005-01-31 Francois Dumont + + * Mac OS X portage thanks Zdenek Nemec. + + * stlport/stl/_hashtable.c: Fix of the _M_copy_from method thanks Jay. + + * stlport/stl/_vector.c: Fix of the _M_insert_fill_aux method thanks + Mike Roberts report. + + * test/unit/unordered_test.cpp: Add of a test for the hashtable fix above. + + * src/vc_warning_disable.h: Add of the missing 4503 warning disable for MSVC6. + + * test/unit/nmake-vc-common.mak: Add of the _STLP_DEBUG_UNINITIALIZED macro + definition for the debug and stldebug rules. + +2005-01-28 Francois Dumont + + * Application of a patch from Michael Fink for EVC MIPS. + +2005-01-27 Francois Dumont + + * stlport/deque, list, map, set, slist, stack, valarray: _STLP_WHOLE_VENDOR_STD + replaced by the official _STLP_IMPORT_VENDOR_STD macro. + + * stlport/stl/_algobase.h: Add find algo overload for char* and const char* + forwarding the call to the memchr C function thanks Jim Xochellis report. + + * test/unit/find_test.cpp: Add check for the new find overload. + + * test/unit/cmath_test.cpp: Fix of the atan and atan2 tests to avoid precision + problems. + + * test/unit/ptrspec_test.cpp: Add check for containers of function pointers and + member function pointers. + + * test/unit/set_test.cpp: Add check for equal_range method when the search value + is not in the set. + + * stlport/stl/_tree.h: Fix equal_range implementation thanks Grisha Spivak report. + + * stlport/stl/_vector.h, _vector.c: Fix of the movable types implementation thanks + Mike Roberts report. + + * test/unit/mvctor_test.cpp: Add of a test case for vector class. + +2005-01-25 Francois Dumont + + * stlport/stl_user_config.h: Pointer specialization feature is now off + by default as it do not handle pointer to function and pointer to member + methods correctly yet. Feature documentation has been updated to report + this limitation. + + * src/ctype.h: removal of the '>= 0' check for wchar_t variables reported + as a always true condition by gcc. + + * stlport/stl/_hashtable.c: Removal of an unused variable in hashtable::resize + method thanks Jeff Grills report. + + * stlport/stl/_algo.c: Fix of the search_n algo thanks Jim Xochellis report. + +2005-01-24 Francois Dumont + + * Some more warning fixes. Mostly add of missing char_traits::to_char_type calls. + +2005-01-22 Francois Dumont + + * stlport/stl/_string_workaround.h, debug/_string_workaround.h: Fix of the + call broadcast to the base class. Non debug workaround always call non debug + base class methods, debug workaround always calls debug base class methods. + + * Many fixes to avoid warnings using MSVC in level 4 warnings: + - while (true) replaced by for(;;) which do not produce the conditional + expression is constant warning + - removal of unused parameters + - modification of some template function signature to keep the character type + information and avoid the wchar_t to char type warning which was surely an + important warning for the wide streams support. + + * stlport/stl/_monetary.c: removal of the call to the ctype::widen method + on the result of the moneypunct<_CharT, false>::decimal_point call as this + method is already supposed to return a wide character. + +2005-01-19 Francois Dumont + + * src/msvc_warning_disablers.h: unused file, removed. + + * test/unit/logic_test.cpp: Fix of the tests to avoid warning regarding int + to bool cast. + + * stlport/stl/pointers/_deque.h, _list.h: Fix of the exported class under MSVC + compiler thanks Timothy Tenebekov report. + + * build/test/unit/nmake-vc-common.mak, nmake-vc6.mak, nmake-vc70.mak: Modification + of the make files to avoid useless inclusion of vc_warning_disable.h file for + MSVC.Net 2003 and MSVC 8 compilers. + + * src/locale_impl.h: Export of the locale facets container for MSVC compilers. + + * src/vc_warning_disable.h: Modification to limit the number of disables depending + on the compiler. + +2005-01-18 Francois Dumont + + * stlport/stl/_algo.c: Modification of the stable_partition implementation + to limit the size of the allocated temporary buffer of the begin and end + of the range are already at the right place thanks a Stephen Howe idear. + + * build/test/unit/nmake-vc-common.mak, nmake-evc-common.mak: Removal of the + _STLP_USE_AUTO_LINK macro which is now the default. + +2005-01-14 Francois Dumont + + * stlport/stl/_windows.h, char_traits.h, src/c_locale_win32/c_locale_win32.c: + Patch from Patrick Bergeron to support 64 bits compilation under Windows using + VC8. + + * stlport/stl/boost_type_traits.h: boost support check and fixing. + +2005-01-13 Francois Dumont + + * stlport/stl/_algobase.h: Improvment of the iter_swap algo to use the swap + method when possible thanks David Abrahams and Aleksey Gurtovoy great book + introduction. + + * stlport/stl/_alloc.h: Deactivation of the lock free allocator implementation + not mature enough to be release yet. + + * stlport/stl/_uninitialized.h: Fix of non Standard algo signature: + - uninitialized_fill_n + + * stlport/stl/_iterator_base.h: Fix of non Standard algo signature: + - distance + + * stlport/stl/_algobase.h: Fix of non Standard algo signature: + - fill_n + + * stlport/stl/_algo.h: Fix of non Standard algo signature: + - rotate + - generate_n + + * stlport/stl/_string.h, debug/_string.h: Fix of the non Standard basic_string + default constructor. + + * stlport/stl/_algobase.h, _function.h, _iterator_base.h, _move_construct_fwk.h, + _ptr_specialize.h, char_traits.h, debug/_debug.h: Fix of the macro name check + before including type_traits.h. + +2005-01-08 Francois Dumont + + * stlport/stl/_codecvt.h: Add of a missing export declaration for the wchar_t + specialization of the codecvt_byname class. + + * src/stlport.rc: improvement of the information included in the ressource file. + Especially add of the compiler options. + + * stlport/stl/_stlport_version.h: Creation of a special file containing all the + version informations; very useful to avoid problem with the ressource compiler. + + * stlport/stl/_config.h: Removal of the unused _STLP_USING_VENDOR_STD macro. + Inclusion of the _stlport_version.h file. Update of the comment explaining why + _STLP_USE_DECLSPEC is undefined when user do not use iostreams. + + * build/Makefiles/nmake/vc-common.mak, evc-common.mak, gmake/gcc.mak: Improvement + of the ressource compiler options. + +2005-01-06 Francois Dumont + + * stlport/config/stl_msvc.h: Move the _STLP_DONT_RETURN_VOID configuration + macro to the specific MSVC6 compiler as it is the only one that has ever + reveal this bug. + +2005-01-05 Francois Dumont + + * stlport/stl/_string_sum_methods.h: Fixes reported by gcc. + +2005-01-04 Francois Dumont + + * doc/README.evc3: patched by Michael Fink + + * build/lib/configure.bat: warning fix thanks Michael Fink. + + * build/test/unit/nmake-src-prefix.mak: fixed thanks Michael Fink. + +2005-01-02 Francois Dumont + + * stlport/stl/_string_sum.h, _string_operators.h: Fix of an assignment bug + in the append method taking a C string wrapper. Modification of the __bstr_sum + get_allocator method to avoid a useless allocation. + + * build/lib/nmake-src-prefix.mak: Add of missing rules for .c and .rc file type. + +2004-12-29 Francois Dumont + + * stlport/stl/_hashtable.c: Fix missing allocator argument in new slist + construction and bad number of buckets thanks See Wong report. + + * test/unit/unordered_test.cpp: Add of a test to report the previous + problem. + + * build/Makefiles/nmake/vc-common.mak, evc-common.mak: Generalization of the + /DMACRO compiler command rather than /D "MACRO". + + * test/unit/string_test.cpp: Creation of a new test case for string template + expression. + + * stlport/stl/_string_sum.h, _string_sum_methods.h: Fixing of many bugs in the + string template expressions implementation. + + * stlport/stl/_tree.c: Add of a comment in the _M_increment method explaining + a surprising checks thanks Ulrich Eckhardt. + +2004-12-24 Petr Ovtchenkov + + * build/Makefiles: makesystem moved here from src/Makefiles + + * build/lib: makefiles moved here from src catalog. + + * build/test/unit: makefiles moved here from test/unit catalog. + + * INSTALL: updated. + + * README: updated. + +2004-12-23 Francois Dumont + + * stlport/stl/_vector.h, _vector.c: Fix of the code for movable types + in call to push_back or insert of a value in case of auto referencing + thanks Benjamin Redelings. + + * stlport/stl/_hashtable.c: Fix of the _M_copy method thanks Timothy + Tenebekov. + +2004-12-22 Francois Dumont + + * stlport/stl/debug/_string.h: Fix of missing scopes thanks arabesc and + Benjamin Redelings + + *stlport/config/stl_gcc.h: include schema fix for gcc >= 4.0.0 thanks + Oliver Stoeneberg + +2004-12-21 Francois Dumont + + * stlport/stl/_hashtable.c: Fix copy method thanks KL report. + + * stlport/stl/_vector.h, _deque.h: Fix implementation for vector of + movable objects when calling erase of a null range thanks to arabesc report. + + * stlport/stl/_string.h, _string_workaround.h, debug/_string.h, + debug/_string_workaround.h: Implementation of the MSVC6 template method bug + workaround exclusively for MSVC6 and not anymore for all compilers. + +2004-12-21 Petr Ovtchenkov + + * src: untested (lost support) .mak and installation files moved into + initial_mak catalog. + + * explore, src: explore catalog moved into src catalog. Makefiles from + explore catalog become main makesystem of STLport. + +2004-12-20 Francois Dumont + + * stlport/stl/_hashtable.h: Fix of the const begin and end methods of the + new implementation thanks Timothy Tenebekov report. + +2004-12-17 Francois Dumont + + * stlport/cmath, cstdlib, stl/_cmath.h, config/stl_msvc.h: Configuration + fixes for .Net 2002. + +2004-12-17 Boris Fomitchev + + * char_traits.h: fixed _STLP_NO_WCHAR_T case + + * src/common_macros.mak: deleted locale.cpp + +2004-12-17 Francois Dumont + + * src/explore/Makefiles/nmake/app/rules-install-a.mak, rules-install-so.mak + lib/rules-install-so.mak: Creation of the install-shared and install-static + from Michael Fink. + +2004-12-16 Francois Dumont + + * stlport/stl/debug/_debug.h, _debug.c: Creation of functions to change iterators + list owner. + + * stlport/stl/debug/_list.h, _slist.h: Modification of the iterator owners in the + splice, splice_after and merge method which do not invalidate iterators but only + move them from a [s]list to an other. + + * stlport/stl/_relops_hash_cont.h: removal of the == operator on hashed containers + This operator is just impossible, or at least very complicated, to implement + for this container which do not require any ordering operation on the type used + to instanciate the container. + + * test/unit/hash_test.cpp: Addition of a commented test showing why the == operator + is invalid on hashed constainers. + + * stlport/stl/_hashtable.h: Modification of the hashtable implementation based + on a slist and a vector. Compared to the previous one the advantages are: + - lighter hashtable::iterator + - iterator increment operation do no require call to the hash function. + - no more special implementation for the debug mode, once validated debug/_hashtable.h + will be removed. + The drawback is a small overhead on the insert/erase methods. + + * stlport/unordered_set, unordered_map: Introduction of the almost Standard hash containers. + The major difference with hash_set or hash_map containers from SGI is the load factor + that gives the user the ability to change the container ratio of the number of elements per + bucket. + +2004-12-13 Francois Dumont + + * stlport/stdio.h: patch from Michael Fink to avoid warning on the EVC platform. + + * doc/evc_workaround.txt: Documentation file from Ulrich Eckhardt about the EVC + workaround to avoid annoying warnings. + + * stlport/typeinfo: Patch from Ulrich Eckhardt to fix missing type_info struct + under MSVC6 and EVC and also identation. + +2004-12-10 Francois Dumont + + * stlport/stl/_collate.h, _locale.h: fix of the __locale_do_operator_call internal + function to make traits and allocator also template parameters. + + * stlport/stl/_locale.h, _collate.h, stlport/config/stl_msvc.h, src/locale.cpp, + src/locale_impl.h: restoration of the MSVC6 workaround for the locale class to + correctly handle the member template methods. + +2004-12-09 Francois Dumont + + * stlport/stl/_messages_facets.h: fixed messages_base::catalog from long typedef + to int thanks Ulrich Eckhardt report. + + * stlport/stl_user_config.h, config/stl_msvc.h: addition of the _STLP_VERBOSE_AUTO_LINK + config macro to make the automatic linking feature more verbose thanks Ulrich Eckhardt + patch. + + * stlport/exception: Add check of the _STLP_HAS_SPECIFIC_PROLOG_EPILOG macro before + including _msvc_warning_off.h to avoid bad resulting warning status when the _epilog.h + header is not included thanks Gail (baker88) report. + + * stlport/cassert, cerrno, csignal, ctype.h, cwctype, stdarg.h, stdlib.h, string.h, + config/stl_evc.h: Patch from Michael Fink to fix compilation problem using ressource + compiler for evc3 and evc4 and problems with cerrno and cassert inclusions reported + by Ulrich Eckhardt. + +2004-12-01 Petr Ovtchenkov + + * stlport/stdexcept: removes some warnings regarding the exception class being derived + from a non-dll interface class on evc4. Michael Fink contribution. + + * stlport/stl/_cmath.h: push/pop warning level for VCs. Michael Fink contribution. + + * src/_stdio_file.h: Evc4 uses an ugly hack to implement file IO using a FILECE structure + representing the internal FILE structure. For evc3 Michael Fink implemented a much simpler + way that also works for evc4. + + * stlport/config/stl_evc.h, stl_msvc.h, stlcomp.h: separate config stuff for stl_evc.h + and stl_msvc.h. Now all Windows CE specific defines are in stl_evc.h only. + Michael Fink contribution. + + * stlport/stl/_codecvt.h, _ctype.h, _messages_facets.h, _monetary.h: add friend class + _Locale_impl. + + * stlport/stl/_num_get.h, _num_put.h, _numpunct.h, _time_facets.h: ditto. + +2004-11-30 Petr Ovtchenkov + + * src/explore/configure.bat: added quotes. Thanks Ulrich Eckhardt and Michael Fink. + + * stlport/stl/_locale.h, src/locale_impl.h, src/locale_impl.cpp: added _STLP_DECLSPEC + and _STLP_CALL for some functions. Thanks Ulrich Eckhardt. + + * stlport/stl/_collate.h, _numpunct.h, _monetary.h, _codecvt.h, _time_facets.h: + _Locale_imp made friend without relation to _STLP_LEAKS_PEDANTIC. Thanks Ulrich Eckhardt. + + * stlport/stl/_locale.h: remove body of protected constructor to avoid warnings. + Thanks Kidman and Ulrich Eckhardt. + + * src/locale_impl.cpp: use simple resize of facets_vec; reserve space for facets_vec to be + sure that allocation don't throw exception during vector resize in insert_*_facets functions. + Thanks Ulrich Eckhardt. + +2004-11-29 Petr Ovtchenkov + + * stlport/stl/_cmath.h: patch from Michael Fink applied. + + * stlport/stl/_locale.h: remove enclose class spec to avoid VC confuse. + Thanks Ulrich Eckhardt. + + * src/locale_impl.cpp, src/locale_impl.h: remove bogus _STLP_CALL decls. + Thanks Ulrich Eckhardt. + +2004-11-27 Petr Ovtchenkov + + * stlport/stl/_threads.h: direct access to _M_ref_count isn't MT-safe; + counter value returned by _M_incr and _M_decr methods only. + + * stlport/stl/_rope.h, stlport/stl/_rope.c: adaptation to changes above; + removed __GC macro dependent code, that was never defined in present + sources. + + * src/locale.cpp, locale_impl.cpp, locale_impl.h: general revision of locale + implementation; code clean, corrected, concepts fixed, errors fixed, + new bugs added. + + * src/ctype.cpp, facets_byname.cpp, locale_catalog.cpp, messages.cpp, monetary.cpp: + ditto. + + * stlport/stl/_codecvt.h, _collate.h, _ctype.h, _locale.h, _messages_facets.h: + ditto. + + * _monetary.h, _num_get.h, _num_put.h, _numpunct.h, _time_facets.h: ditto. + + * src/locale_nonclassic.h: removed due to code revision. + + * src/explore/Makefile.inc: locale.cpp is directly included into locale_impl.cpp. + + * src/explore/gcc.mak, test/unit/gcc.mak: use _STLP_LEAKS_PEDANTIC before release + by default. + +2004-11-24 Francois Dumont + + * stlport/stl/_cmath.h: Fix of the abs definition for the EVC platform + thanks Michael Fink. + + * stlport/stl/_cmath.h: Fix of the Internal Compiler Error from MSVC6 + when defining math functions in the STLport namespace thanks Ulrich + Eckhardt and I. + + * stlport/stl/debug: Creation of a debug iterator traits used to make + an additional test when checking iterator deferencing status, on slist + before_begin iterators are not dereferenceable but were not detected + as so. + + * stlport/math.h, stdexcept: patches from Michael Fink to avoid warning + on the EVC platform. + +2004-11-22 Francois Dumont + + * src/explore/Makefiles/nmake/evc3.mak, evc4.mak: removal of the useless + /DPLATFORM macro definition thanks Ulrich Eckhardt report and Michael Fink + patch. + + * stlport/cstdlib: extension of the div overload for long input up to MSVC7.1 + thanks Michael Fink report. + + * test/unit/string_test.cpp: patch from Michael Fink for EVC which has limited + support of the WaitForMultipleObjects API function. + + * stlport/cstdlib, cwchar, using/cstring: patch from Michael Fink to remove + imports of missing native C functions. + +2004-11-16 Francois Dumont + + * src/explore/configure.bat: Add of the --rtl-static and --rtl-dynamic + configuration options to force use of static or dynamic C runtime thanks + Michael Fink. + + * stlport/config/stl_msvc.h: undef of the _STLP_USING_CROSS_NATIVE_RUNTIME_LIB + for the evc platform that only have the static C runtime version thanks + Michael Fink. + + * stlport/config/stl_bc.h, stl_dmc.h, stl_solaris.h: Removal of all references + to the deprecated _STLP_NO_OWN_IOSTREAMS and _STLP_NO_NEW_IOSTREAMS macros. + + * stlport/cmath, stl/_cmath.h: Modification of the import of the pow function + for MSVC6 that has a bugged overload thanks Michael Fink report. + +2004-11-09 Francois Dumont + + * test/unit/config_test.cpp: Creation of a test case to check correct + platform/compiler configuration. + + * stlport/config/stl_msvc.h: Definition of the _STLP_HAS_NATIVE_FLOAT_ABS + now start with MSVC6. + + * stlport/cstdlib, stl/_cmath.h: Addition of some missing math function + overloads for MSVC6. + +2004-11-05 Francois Dumont + + * stlport/config/stl_msvc.h: Definition of the _STLP_HAS_NATIVE_FLOAT_ABS + starting with MSVC .Net 2002 thanks Kevin Bluck report. + + * test/unit/cmath_test.cpp: Creation of a test case to check correct import + and extensions of C functions. + +2004-11-04 Petr Ovtchenkov + + * src/explore/Makefiles: added templates CC.mak for SunPro's CC compilers; + ones should be checked and fixed with real compiler. + +2004-11-04 Francois Dumont + + * stlport/stl/_function.h, _queue.h, _stack.h, _map.h, _iterator.h: + restoration of the Standard names of the protected datas. + + * stlport/stl/_alloc.h, _alloc.c: implementation of a lock free version + of the default STLport node_allocator. Supported by the Win32 platform + for the moment. + + * src/ios.cpp, locale.cpp, locale_impl.cpp: use of atomic operations + under Win32 platform rather than using synchronisation primitives. + + * stlport/stl/_tree.h, _map.h, _set.h: creation of the erase_unique and + equal_range_unique methods to use the unicity information of the map and + set containers in binary tree searches. + + * stlport/stl/_string.h: Add _STLP_USE_NO_IOSTREAMS check beforing deciding + not to include _string.c thanks KL + +2004-11-02 Francois Dumont + + * stlport/stl/pointers/_deque.h: Fix for the problem of the deque + instanciation thanks Alex Cosealin report + + * test/unit/ptrspec_test.cpp: Add of a test for the previous problem. + +2004-10-31 Francois Dumont + + * stlport/stl/_rope.h: Fix of the apply_to_pieces qualification thanks Leeya. + + * test/unit/rope_test.cpp: New test case for the previous fix. + +2004-10-30 Francois Dumont + + * src/explore/Makefiles/nmake/vc-common.mak: introductions of the LDFLAGS_A_REL + macro to fix config problem under VC71 and VC8 beta. + +2004-10-29 Petr Ovtchenkov + + * src/explore/Makefiles/gmake/app/gcc.mak: use -fPIC for gcc 2.95.x when build + application---this is a workaround for bug with running code in static constructors. + + * stlport/config/stl_gcc.h, stlport/stl/_config.h: force usage of mutex instead + of spinlock for gcc 2.95.x, due to problems with initialization of statics. + Initialization of mutex has variant with structure filling, while for spinlock + initialization function call required. + + * test/unit/locale_test.cpp: avoid static object for gcc 2.95.x, due to problems + with initialization of statics. + +2004-10-27 Francois Dumont + + * stlport/stl/_config.h, _fstream.h, _ios.h, _istream.h, _monetary.h, _num_get.h, + _num_put.h, _ostream.h, _sstream.h, _streambuf.h, _string.h, _time_facets.h: + Restoration of the _STLP_NO_CUSTOM_IO feature removed after cleanup reported + in 2004-09-28 post from Petr. + + * stlport/stl/stl_user_config.h, _config.h, stl_msvc.h: reactivation of the + auto link feature for MSVC but only if activated by the client. Moreover the + new implementation of this feature is more maintenable, stl_msvc.h won't have + to be edited at each STLport release. + + * test/unit/nmake-vc-common.mak, nmake-evc-common.mak: Adoption of the auto link + process. + +2004-10-25 Francois Dumont + + * stlport/stl/_config.h: Introduction of the _STLP_DONT_USE_EXCEPTIONS which + means that the client do not want to use the C++ exception feature. It is + different from the _STLP_NO_EXCEPTIONS which means that the compiler do not + support exceptions at all. The distinction is important for some macros definition. + + * test/unit: Modification of the _STLP_NO_EXCEPTIONS test to the more general + _STLP_USE_EXCEPTION macro. + + * stlport/stl/_ios_base.h, src/ios.cpp: rollback of the modifications of the + 2004-10-24. + + * stlport/config/stl_msvc.h, stl_gcc.h: Those 2 compilers have a exception + support switch, when exceptions are unactivated they now define + _STLP_DONT_USE_EXCEPTIONS rather than _STLP_NO_EXCEPTIONS. + +2004-10-25 Petr Ovtchenkov + + * stlport/stl/_sstream.c: cur direction missed in seekoff. Thanks David Obermann. + + * sstream_test.cpp: test for problem above. + +2004-10-24 Francois Dumont + + * stlport/stl/_ios_base.h, src/ios.cpp: definition of the ios_base::failure + nested class only when exception support is activated. + + * stlport/stl/_deque.h, _deque.c: Modification of the deque implementation + to use the internal move framework. + + * test/unit/mvctor_test.cpp: New test case for the use of the move + framework within the deque container. + +2004-10-21 Francois Dumont + + * stlport/stl/_iostring_stream.h: Simplification of the __stl_alloc_rebind + overload to make it less ambiguous for the compilers using it. + +2004-10-18 Francois Dumont + + * stlport/stl/_vector.h, _vector.c: Add of checks to know if a reference + is in *this before making a systematical copy of it. + +2004-10-18 Petr Ovtchenkov + + * stlport/stl/type_manips.h: replace template <> by macro. + + * stlport/stl/debug/_debug.h, _debug.c: __check_if_not_owner should return true + in case of incompatible types and do check different from __check_if_owner; + added message for check __check_if_not_owner. + + * test/unit/mvctor_test.cpp, test/unit/ptrspec_test.cpp: fix tests to satisfy + changes related to 23.1.1 Table 67 in stlport/stl/debug/_vector.h, _deque.h---see + record 2004-10-14 below. + +2004-10-14 Francois Dumont + + * stlport/stl/debug/_iterator.h: Move of some _DBG_iter_base and _DBG_iter + methods implementation outside struct definition to fix call on incomplete + type compile error generated by the call to the _Incrementable or _Dereferenceable + functions passing *this as input parameter thanks Alexey Sarytchev + + * test/unit/sstream_test.cpp, fstream_test.cpp: Fix of the tests on streambuf + throwing exception for platform with no exception support. + + * stl/_string.h: Add of the missing compare methods on the basic_string + implementation used by compilers supporting template methods thanks Patrick + Bennett report. + + * stlport/stl/debug/_vector.h, _deque.h: Add check on the insert range method, + the inserted can not be pointing to the this instance where the insertion occur. + +2004-10-13 Petr Ovtchenkov + + * src/explore/Makefiles/gmake: a bit correction of compiled and installed names + of executables on *nix systems, see record 2004-09-29 by Francois. + +2004-10-12 Francois Dumont + + * stlport/stl/_config.h: typo fix thanks KL + + * stlport/stl/_move_construct_fwk.h, _set.h, _map.h, _hash_set.h, _hash_map.h: + Extra semicolons removal thanks Wlodek Szafran reports. + +2004-10-11 Petr Ovtchenkov + + * stlport/stl/_rope.h: add typename. + +2004-10-08 Francois Dumont + + * stlport/stl/_deque.h, _hashtable.h, _tree.h, _bvector.h: Specialization of the + __type_traits struct for the iterator types. + + * stlport/stl/_uninitialized.h, _vector.h: Relax of the rules to perform some + optimizations, no more POD check, rather use of the trivial copy constructor, + trivial assignment operator informations. + + * stlport/stl/_config.h, _epilog.h: Adoption of stlport as the official STLport + namespace when users cannot use the std namespace. + +2004-10-07 Francois Dumont + + * stlport/stl/_list.h: Specialization of the __type_traits struct for list iterators. + Move of the == and != operators from the base iterator class to the iterator class + to make iterator of different list instanciation not comparable anymore. + + * stlport/stl/_slist.h: ditto. + +2004-10-06 Francois Dumont + + * stlport/stl/_rope.h, _rope.c: Code review, use of general STLport tools rather + than specific rope ones. Use of compile time checks rather than runtime. + + * stlport/stl/_bvector.h: fix to make the vector specialization movable + thanks a Kelly Thompson report. + +2004-10-05 Francois Dumont + + * src/explore/Makefiles/nmake: Application of a patch from Michael Fink to simplify + the evc make system. + + * doc/README.evc4: New version from Zdenek Nemec. + +2004-10-04 Francois Dumont + + * test/unit/type_traits_test.cpp: A new test case to check behavior of + the numerous helper functions from type_traits.h and type_manips.h. + + * stlport/stl/type_traits.h: Fix of some bugs and addition of the __type_traits + specializations of const, volatile and const volatile native types. + + * stlport/stl/type_manips.h: Modification of the __bool2type default value + so that it consider any value as true and only the 0 value false. + + * stlport/config/stl_msvc.h, stlport/stl/_config.h: Modification of the STLport + std equivalent namespace to be sure that the user rebuild correctly the STLport + library when he forces the use of the dynamic or static library. + + * src/explore/Makefiles/nmake/lib/vc-common.mak, app/vc-common.mak: Creation + of the STLP_BUILD_FORCE_STATIC_RUNTIME that forces use of the static version + of the native runtime. + + * test/unit: fix of some tests that failed to compile using the + _STLP_NO_ANACHRONISMS macro. + +2004-09-30 Petr Ovtchenkov + + * test/regression: catalog removed---it obsolete and unsupported; use + test/unit tests instead; all tests from test/regression was moved in test/unit, + sometimes in redesigned form. + +2004-09-29 Francois Dumont + + * stlport/stl/_string_io.c: Removal of the native library specific calls of + use_facet, only the STLport standard one is used. + + * stlport/stl/_alloc.h, _alloc.c, src/dll_main.cpp: Implementation of a clean + process for the node_alloc allocator. This clean is active only when + _STLP_LEAKS_PEDANTIC is defined and you are using STLport as a dynamic + library under Win32. + + * src/explore: Updates of several makefiles to conform to the new library + and binary naming convention. + + * src/c_locale_win32/c_locale_win32.c: fix of the message facet name management + that was generating a memory leak. + +2004-09-29 Petr Ovtchenkov + + * stlport/stl/char_traits.h: WinCE seems don't declare off_t; thanks Michael Fink. + +2004-09-28 Petr Ovtchenkov + + * Repository: iostreams and string wrapper mode removed, due to ones has + a lot of restrictions in usage and frequently lead to hard recognized problems. + Tonns of *_STREAMS macro replaced by _STLP_USE_NO_IOSTREAMS or _STLP_NO_IOSTREAMS + as configuration macro; *NATIVE_STRING macro removed by the same reasons. + +2004-09-27 Petr Ovtchenkov + + * test/unit/gcc.mak: fix stlport library name for STLP_DEBUG mode for Solaris, + thanks for separate namespaces in normal and STLP_DEBUG mode, see record + 2004-09-10 below. + +2004-09-24 Francois Dumont + + * stlport/config/stl_gcc.h: Fix of the relative include path used to access the + native gcc headers. Before version 3.4.0 the 0 patch level was not part of the + include path. + + * stlport/stl/type_traits.h, _vector.h, _algobase.h, _construct.h: Removal + of the __action_on_move type traits replaced by a generalization of the + already existing __move_traits. + + * test/unit/mvctor_test.cpp: New test case for the __move_traits feature. + +2004-09-24 Petr Ovtchenkov + + * src/explore/Makefiles/gmake/sunos: 'explore' makesystem adopted to work + under Solaris with GNU make. + + * test/unit/gcc.mak: ditto. + + * src/explore/Makefiles/gmake/app/gcc.mak: ditto. + + * src/explore/Makefiles/gmake/lib/gcc.mak: ditto. + + * stlport/cmath: fix some math calls for Solaris. + + * test/unit/list_test.cpp: add illustration for list iterator/reverse_iterator questions. + + * src/explore/Makefiles/gmake/unix/lib.mak: moved from linux/lib.mak, as + common rules for all *nixes. + + * src/explore/Makefiles/gmake/linux/lib.mak: use common for all *nixes rules + in unix/lib.mak. + + * src/explore/Makefiles/gmake/freebsd/lib.mak: ditto. + + * src/explore/Makefiles/gmake/openbsd/lib.mak: ditto. + + * src/explore/Makefiles/gmake/sunos/lib.mak: ditto. + + * src/explore/Makefiles/gmake/unix/lib.mak, test/unit/gcc.mak: changed library name; + libraries now named as libstlport, libstlportg, libstlportstlg for optimized, with + debug symbols, and with debug symbols and _STLP_DEBUG mode libraries respectivly. + +2004-09-21 Francois Dumont + + * stlport/stl/debug: Modification of the __check_range class in the more general + __check_construct. Now it also checks for null pointers in the string interface. + + * src/explore: Adoption of the new library naming convention for all Microsoft + compilers thanks Michael Fink + +2004-09-20 Francois Dumont + + * src/explore/Makefiles/gmake/cygwin, mingw: Build configuration files merges + within a single build system: cygming. Future portage of STLport for compilers + using the GNU tools will be available from both systems. Removal of the vc6 build + under cygwin, for mono-platform compilers we support only one build system. + + * stlport/stl/_vector.h: Modification of the destructor implementation to destroyed + object instances in a reverse order taking advantage of the way elements are + normaly added to this container. + +2004-09-16 Francois Dumont + + * test/unit/cppunit/cppunit_mini.h, cppunit_proxy.h: Adaptation of the CPPUNIT + framework to take care of the exception as failures thanks Zdenek Nemec + + * stlport/config/stl_msvc.h, stl_bc.h, stl_mwerks.h, stlport/stl_user_config.h: + Removal of the non intuitive and difficult to maintain automatic linking feature. + + * Fixing of the locale implementation mecanism. Classic locale implementation is + also managed by a reference counter to be sure when it is possible to release + the associated ressources. Fix of a missing locale impl ref counter decrement + in the template locale constructor taking a facet, it was a possible source of + memory leak . Addition of a static object within locale_impl.cpp in + _STLP_LEAKS_PEDANTIC mode to decrement the global locale impl ref counter when + STLport library is unloaded. Addition of all the missing classic locale facets + destructor in free_classic_locale. + + * src/locale_catalog.cpp: The locale by name constructor checks the "C" name + to simply copy (increment the ref counter) the classic locale implementation + rather than instanciating a new one. + +2004-09-15 Francois Dumont + + * stlport/stl/_list.c: Modification of the _S_sort implementation, the __carry + list instance is created using the __that allocator instance copy to be more + allocator friendly. + +2004-09-11 Francois Dumont + + * stlport/config/stl_intel.h: Configuration update for Win32 Intel 8.0 + compiler thanks Charlemagne. + +2004-09-10 Francois Dumont + + * stlport/stl/_config.h: The new official namespace is now stlp_std. _STL is + just an alias. STLPORT macro still contains the STLport std namespace equivalent. + Moreover in _STLP_DEBUG mode, which is not binary compatible with the release + or debug mode, the namespace is stlpd_std to generate link error rather + than runtime crash. + +2004-09-09 Francois Dumont + + * stlport/stl/_config.h: _STLP_DONT_USE_NESTED_TCLASS_THROUGHT_TPARAM + renamed to the more intuitive _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE. + + * stlport/stl/_config.h: Introduction of a new namespace stlp_private + defined in the global namespace. Everything that is STLport implementation + details should be in this namespace to avoid polution of the std namespace. + + * stlport/stl/_iterator_base.h: Modification of the macro used to create + iterator traits for all tree and hashtable based containers to move it in + the stlp_private namespace rather than defining it as nested struct, limits + the symbol size. + +2004-09-08 Francois Dumont + + * test/unit/fstream_test.cpp: restauration of the test added by Petr + the 2004-09-03, it is finaly a different test from the one in sstream_test.cpp. + Some more checks have also been integrated. + + * stlport/stl/_ostream.c: New fix of the _M_unbuffured_copy method that was + still bugged in case of a throwing output streambuf, detected thanks to the + test case. + +2004-09-07 Francois Dumont + + * stlport/config/stl_msvc.h: Add defines of the _STLP_USE_STATIC_LIB + or _STLP_USE_DYNAMIC_LIB depending on the current kind of build. + + * stlport/stl/_streambuf.h, _streambug.c: Fix an unresolved symbol + problem for MSVC6 (and before?) when STLport is used as a static library. + +2004-09-06 Francois Dumont + + * test/unit/nmake-evc-common.mak: Use of the dynamic runtime for the + *-shared rules rather than the previous static thanks Michael Fink. + + * test/unit/nmake-evc*.mak: end of build code factorisation, use of + nmake-evc-common.mak within all makefiles thanks Michael Fink. + + * test/unit/locale_test.cpp: Application of a patch from Michael Fink + to check the "C" locale on all platforms. Fix of the money_get_put test + case for the "C" locale. + + * test/unit/allocator_test.cpp: new test case for std::allocator checks. + +2004-09-05 Francois Dumont + + * stlport/stl/_string_hash.h: Performance improvement, multiplication + replaced by shift operations thanks Greg S. + + * stlport/config/stl_wince_4.h: removed, never used, stl_evc.h has been + prefered. + + * test/unit/string_test.cpp: addition of a new test short_string_optim_bug + to check for a compiler bugs making the short string optim invalid thanks + Michael Fink. + + * stlport/config/stl_evc.h: Deactivation of the short string optimization + because of a compiler bug thanks Michael Fink. + + * src/explore: factorisation of the evc build makefiles thanks Michael Fink. + + * src/explore/Makefiles/nmake/lib/clean.mak, macro.mak: Addition of some + file clean up for the clobber rule thanks Michael Fink. + +2004-09-03 Francois Dumont + + * test/unit/fstream_test.cpp, sstream_test.cpp: Move of the test for the + infinite loop from FstreamTest test case to SstreamTest, addition of some + checks. + + * test/unit/full_streambuf.h: streambuf implementation simulating full + output. + + * stlport/exception: restauration of some modification removed after the + rollback of the 2004-09-01. + + * stlport/config/stl_gcc.h: homogeneification of the coding standard used + within STLport, 2 spaces indentations even for preprocessor directives. + Doing so, discovered a weird configuration for Mac OS platform (__APPLE__) + concerning the _STLP_NATIVE_INCLUDE_PATH macro definition, fixed. + + * stlport/stl/config/stl_*.mak: removal of all references to the + _STLP_REDEFINED_STD macro as it is now the default and only way STLport + use to replace native Standard library. + + * test/unit/nmake-vc-common.mak: add inclusion of the vc_warning_disable.h + file to avoid warnings during build process thanks Michael Fink. + +2004-09-03 Petr Ovtchenkov + + * stlport/stl/_ostream.c: removed infinite loop in case when outgoing stream + can't accept more chars. Thanks Daniel White, Ulrich Eckhardt, Francois Dumont. + + * test/unit/fstream_test.cpp: test for problem above. Thanks Ulrich Eckhardt. + +2004-09-02 Francois Dumont + + * stlport/exception, stlport/stl/_site_config.h, test/unit/exception_test.cpp: + Creation of the _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT macro to signal support of + the unexpected exception mecanism. Related type/function are only brought to the + STLport namespace if correctly supported, exception_test.cpp check that. + + * New modification of the _Rb_tree and _Hashtable associated iterator structs. + Removal of the container_type pass through the iterator traits; iterator traits + is the type that will make each derived container iterator type real different + type making them uncomparable. + + * stlport/ctype.h: rollback of the above rollback ;-) only of course for the + Win CE code fix that was part of the previous commitment. + +2004-09-01 Petr Ovtchenkov + + * Rollback include schema: code is broken. + +2004-08-31 Francois Dumont + + * _STLP_INCOMPLETE_EXCEPTION_HEADER replace by the more intuitive + _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT macro. + + * Modification of the include schema of all public headers in stlport folder + that need to be reentrant. Now those files are fully guarded and the specific + STLport code is only included once at the end of the inclusion, the reentrancy + only concern inclusion of the native headers. + +2004-08-30 Francois Dumont + + * stlport/stl/_deque.c: Fix of a pseudo 'uninitialized variable used' thanks + Oliver Stoeneberg. + +2004-08-27 Francois Dumont + + * .Net 2002 (VC70) portage. + +2004-08-27 Petr Ovtchenkov + + * src/explore/Makefiles/gmake/gcc.mak, app/gcc.mak, lib/gcc.mak: buggy C++ + language support in libsupc++ in gcc before 3.3 not allow to use it; + link with libstdc++ instead. + + * stlport/config/stl_icc.h: fix features for icc 7.1; fix features for Linux + platforms. + +2004-08-24 Francois Dumont + + * stlport/config/stl_gcc.h, stl_msvc.h: fixing of configuration concerning + uncaught_exception and exception handling in general thanks John Roberts. + + * stlport/stl/_tree.h, _tree.c: Modification of the _Rb_tree_iterator struct + to be able to distiguish iterator types from different tree based containers + Removal of the == and != member operators of the _Rb_tree_base_iterator struct + replaced by global operators taking _Rb_tree_iterator as parameters and checking + that the iterators are of the same container type thanks Haroon Nassiry report. + + * stlport/stl/_map.h, _set.h: Modification of the iterator traits used to + instanciate the _Rb_tree class. + + * stlport/stl/_hashtable.h, _hashtable.c, _hash_set.h, _hash_map.h: Similar + modifications to the previous one in order to make for instance the iterator + from hash_map and hash_multimap not comparable anymore. + + * stlport/config/stl_wince.h, stlport/ctype.h: Move of the isspace C function + Windows CE specific code from the config file to the ctype.h file. This fix + will also apply to Embedded C++ .Net thanks Dirk report. + +2004-08-23 Petr Ovtchenkov + + * test/unit/cppunit/cppunit_proxy.h, test/init/gcc.mak: CPPUNIT_MINI removed. + + * src/num_get_float.cpp: suggestion to fix problem with float input for gcc 3.4.x + with optimization flag. + + * test/unit/floatio_test.cpp: test for infinity and near + + * src/explore/Makefiles/gmake/gcc.mak, app/gcc.mak, lib/gcc.mak: fix detection of + gcc version; gcc before 3.x had libgcc.a that contains some language support, + so link with it in case when we avoid link with libstd++. This has relation only + for linux systems. + +2004-08-19 Petr Ovtchenkov + + * src/explore/configure.bat: setting up compiling STLport under Windows. + Contribution by Michael Fink. + +2004-08-13 Francois Dumont + + * test/unit/gcc.mak: Addition of the _STLP_NO_CUSTOM_IO define to make test + build faster. + + * stlport/stl/_limits.h, _limits.c: Modification of the _LimG class definition. + Removal of the static variables, replaced by static method having the same role + but more portable. Fix link problem with MSVC compilers family when using STLport + static library. + + * stlport/stl/_bitset.h, _bitset.c: Ditto for the _Bs_G class. + + * stlport/stl/_hashtable.h, _hashtable.c: Ditto for the _Stl_prime class. + + * src/dll_main.cpp: thanks to the previous modification, removal of the + concerned code within force_link. + +2004-08-13 Petr Ovtchenkov + + * test/unit/cppunit/cppunit_mini.h, file_reporter.h, test_main.cpp: + add function to print mess; remove def of CPPUNIT_MINI, not required; add const + qualifiers. + + * test/unit/locale_test.cpp: print checked locale name; restore table with format + symbols--partially rollback changes 2004-07-29; add test for possible locale + init/deinit problem---I don't see problem. Test inspired by Alex Kosilin. + +2004-08-11 Francois Dumont + + * src/explore/Makefiles/nmake: extension of the new build system for VC.Net + 2005 (VC8). + + * src/explore/Makefiles/nmake/app: restauration of the default behavior shared + rules generates executable using the STLport dynamic library and static rules + use the static libraries. + + * stlport/stl/_string.h: Add check of _STLP_NO_IOSTREAMS to force inclusion of + _string.c in this case. + + * stlport/stl/_string.c: removal of the _STLP_LINK_TIME_INSTANTIATION macro check + before inclusion as the check is already done to include _string.c from _string.h. + + * stlport/stl/_istream.h _istream.c: removal of the _M_put_num function definition + from the .h and removal of all the inline implementation of the >> operators. + _M_put_num is now hidden in the .c to avoid to have to deal with export of this + symbol. Fix errors while using the _STLP_NO_CUSTOM_IO macro. + + * stlport/stl/_ostream.h _ostream.c, src/ostream.cpp: ditto but for the _M_get_num + function. + + * stlport/stl/_istream.h _istream.c: _M_init_skip and _M_init_noskip are now inline + functions defined within the .h to fix link errors when using the _STLP_NO_CUSTOM_IO + macro. + +2004-08-10 Francois Dumont + + * stlport/stl/_string.h: add check of the _STLP_EXPOSE_STREAM_IMPLEMENTATION + macro to include the _string.c file. Improve compile time when _STLP_NO_CUSTOM_IO + is defined. + + * stlport/stl/_string.h, stlport/stl/debug/_string.h, _string_mem_t.h: restoration + of the template method specialization for backward compatibility between compilers + implementating template method and the most recent one. It is considered as an + STLport extension. + +2004-08-09 Petr Ovtchenkov + + * test/compiler: tests to check whether compiler understand or not some + language construction. It is NOT tests for language support libraries, + only tests for compiler. The main purposes of this tests is to help + for developers to find correct workarounds, if compiler don't understand + some language constructions. + +2004-08-09 Francois Dumont + + * stlport/stl/_limits.h, stlport/config/stl_mycomp.h: introduction of a new macro + configuration to signal no support of the IEC 559 specification for floating point + numbers. + + * stlport/config/stl_msvc.h: fix of the config to signal no IEC 559 support before + Visual C++ .Net even if the infinity value is fine. + + * test/unit/limits_test.cpp: New test case to check the right numeric_limits class + configuration. Do not check the signaling_NaN yet... + + * stlport/config/stl_msvc.h: Visual .Net Beta 2005 portage. + + * stlport/stl/_ios.h: Move of the basic_ios::narrow and widen member method + specialization before the explicit instanciation of the basic_ios class for + the char type. + + * stlport/stl/_construct.h, _num_put.c: fix of some unused parameter warning + thanks Oliver Stoeneberg report. + +2004-08-05 Francois Dumont + + * Fixes of the internal move framework for compilers not supporting partial + template specialization. The problem was detected thanks to the boost regression + test suite. + +2004-08-04 Francois Dumont + + * stlport/stl/debug/_list.h, _slist.h: small review of the stlport debug code. + Removal of any Standard reference in the slist class debug implementation. Removal + of some unjustified iterator invalidation. + + * stlport/stl/_locale.h, _collate.h, src/locale.cpp, locale_catalog.cpp, locale_impl.cpp: + Split of the locale class implementation into _LocaleBase base class with no member + template methods which is exported and the locale class which is not exported. This + is a workaround for the MSVC6 compiler. + +2004-08-03 Francois Dumont + + * stlport/stl/_iterator.h: Fix of the back_insert_iterator, front_insert_iterator + and insert_iterator to make them assignable like specify in the Standard requirements + of the output iterators. + + * test/unit/insert_test.cpp, finsert_test.cpp, binsert_test.cpp: Addition of tests for + the assignment operators on the output iterators. + +2004-08-02 Francois Dumont + + * stlport/stl/_string.h, _string.c, debug/_string.h: split of the basic_string + implementation into a class with no member templates and one with the member + templates. Only the one with no member templates is exported. This is a MSVC6 + bug workaround as this compiler try to look for the class method symbols within + the dynamic library even if this symbol is the one of template method which is + not exported. That also make the basic_string implementation more clean so it + has been adopted for all compilers. + +2004-07-29 Francois Dumont + + * test/unit/locale_test.cpp: Fix bad macro _STLP_NO_EXCEPTIONS spelling + and add of a check for real locale implementation. Patch done by + Michael Fink. + + * stlport/stl/debug/_debug.h, _debug.c, _iterator.h: Modification of the + __check_same_owner_or_null function name to the more intuitive + __check_same_or_null_owner thanks a Aleksey Sanin remark. + +2004-07-26 Petr Ovtchenkov + + * src/explore/Makefiles/gmake/lib/gcc.mak: avoid linkage with libstd++ + for gcc compilers. + + * src/explore/Makefiles/gmake/linux/rules-so.mak: ditto + + * src/explore/Makefiles/gmake/lib/rules-a.mak: ditto + + * src/explore/Makefiles/gmake/app/top.mak: ditto + +2004-07-21 Francois Dumont + + * stlport/config/stl_gcc.h: Fix of a gcc 3.3.0 test that did not handle + the gcc 2.95.x correctly thanks Jordan Breeding. + + * src/common_rules.mak: Addition of the stlport/stl/pointers folder within + the folder to be install. Add of a call to ranlib under linux mandatory under + Mac OS X and without impact under the other Unixes systems. + +2004-07-17 Francois Dumont + + * Application of a Mac OSX patch from John Daniel (www.etresoft.com) + +2004-07-15 Francois Dumont + + * stlport/stl/_epilog.h: systematical use of the redefined std namespace + rather than using the namespace inclusion schema. + + * test/unit/set_test.cpp: addition of a test case to show the problem of + the namespace injection schema. + +2004-07-13 Francois Dumont + + * stlport/numeric: removal of the _function.h header include. + + * test/unit/divide_test.cpp: add the missing functionnal header + inclusion. + + * doc/README.msvc: new doc specific to the MSVC++ family compiler. + +2004-07-12 Petr Ovtchenkov + + * test/unit/fstream_test.cpp: tests for unformatted extraction bug. + + * stlport/stl/_istream.c: _M_read_unbuffered should leave delimiter + in the stream in case of unformatted input. Thanks Joerg Becker. + +2004-07-09 Francois Dumont + + * src/sgi_mipspro.mak: add the -LANG:libc_in_namespace_std:OFF + thanks Jack Perdue. + +2004-07-08 Francois Dumont + + * doc/README.evc3: additionnal doc thanks Michael Fink + +2004-07-08 Petr Ovtchenkov + + * test/unit/sstream_test.cpp: added two test for unformatted extraction + and newline character. Inspired by Joerg Becker. + +2004-07-07 Francois Dumont + + * stlport/stl/_hashtable.h, stlport/stl/_hashtable.c, + stlport/stl/_hash_set.h, stlport/stl/_hash_map.h: generalization + of the iterator traits adopted on the tree class. Now iterator and + const_iterator on hash_set and hash_multiset are different types + even if iterator is still immutable. + + * stlport/stl/_deque.h, stlport/stl/_list.h, stlport/stl/_slist.h: + Modification of the iterator classes to only use the template + parameter _Traits rather than using an external type traits. It is + the way hash containers and sorted containers have their iterator + struct working. + + * stlport/stl/_iterator_base.h: Addition of the immutable traits + struct _Const_Const_traits and _Nonconst_Const_traits for + implementation of the set, multiset, hash_set, hash_multiset + iterators. + + * stlport/stl/c_locale.h, stlport/stl/debug/_debug.h: removal of + unjustified _config.h inclusions + + * stlport/stl/_iterator_base.h: inclusion of type_traits.h only + for compilers that need it. + + * stlport/stl/_algobase.h, stlport/stl/debug/_debug.h: add inclusion + of type_traits.h. + + * stlport/stl/_algo.h, stlport/stl/_algo.c: move of the _tempbuf.h + inclusion from the .h to the .c that is the only one that need it. + + * stlport/stl/_config.h: addition of the boost support section. + +2004-07-07 Petr Ovtchenkov + + * stlport/stl/_monetary.c: iterator __str_first out of range, + i.e. outside __str_last in 'mismatch' call in __get_string, if + size of interval [__first, __last) is larger than size of interval + [__str_first, __str_last). + + * test/unit/fstream_test.cpp: test for correct report by tellg added. + +2004-07-05 Francois Dumont + + * stlport/stl/_map.h: internal type _Rep_type set as public for use + in the __move_traits specialization thanks Oliver Stoeneberg. + + * stlport/stl/_set.h: specialization of the __move_traits to make the + set and multiset movable thanks Oliver Stoeneberg. + + * stlport/stl/_function_base.h, stlport/stl/_heaps.h: removal of the + unjustified _config.h inclusion that should only be included from the + _prolog.h header. + +2004-07-05 Petr Ovtchenkov + + * src/facets_byname.cpp: avoid pass address to member of derived class into + base class via constructor. + + * src/facets_byname.cpp: remove first member---EOF---of _M_byname_table---one + not required and lead to wrong reference; this a fix for test in + locale_test.cpp. + + * src/ctype.cpp: ditto. + + * src/c_locale_win32/c_locale_win32.c: ditto. + + * stlport/stl/_ctype.h: ditto. + +2004-07-02 Petr Ovtchenkov + + * src/c_locale_glibc/c_locale_glibc2.c: message catalog functions dealing + with message catalog descriptor; but this descriptor not necessary to be + int; Linux use here void *, i.e. pointer to mmap segment. + + * stlport/stl/_messages_facets.h: ditto. + + * src/messages.cpp: ditto. + + * src/message_facets.h: ditto. + + * src/facets_byname.cpp: ditto. + + * src/c_locale_stub.cpp: ditto. + + * src/c_locale.h: ditto. + + * src/c_locale_glibc/c_locale_glibc2.c: fix _Locale_extract_*_name + functions. + +2004-07-01 Francois Dumont + + * src/explore/Makefiles/nmake/lib/vc-common.mak: creation of the + STLP_BUILD_FORCE_DYNAMIC_RUNTIME option to create STLport statix + versions more easily. + +2004-06-30 Francois Dumont + + * stlport/stl/_function.h: Use a call_traits to avoid the reference + to reference problem in struct like binder1st or binder2nd. + +2004-06-26 Francois Dumont + + * src/explore/: portage of the explore build system for the + MSVC .Net 2003 compiler. + +2004-06-24 Francois Dumont + + * stlport/stl/_site_config.h: Addition of an entry for the per thread + allocator configuration. + + * stlport/stl/_config.h: Avoid use of the import/export technique + when not using own iostreams. This way you can use the STLport debug + mode without building the libraries. + +2004-06-23 Francois Dumont + + * extension of the cygwin link problem workaround for mingw32. + + * src/locale_catalog.cpp: Move of the _STLP_lock object instance + declaration to limit the critical section and improve performace. + + * stlport/stl/_pthread_alloc.h: fix of the pthread_allocator and + per_thread_allocator allocate method to check for the required + number of element before multiplication with the size of the objects + to instanciate. + +2004-06-22 Francois Dumont + + * src/locale_catalog.cpp: fix of the locale facets registration system. + The hash container use string as key rather than char const* so that + a copy of the facet name is stored rather than a copy of the string + pointer that might be freed. We also extract the complete facet name + before storing it to avoid store of facet aliases that cannot be retrieved + at release. + +2004-06-21 Francois Dumont + + * Restauration of the cygwin support (using gcc 3.3.1). Extension of the + explore build system, workaround of a link problem when using shared + libraries. + +2004-06-13 Petr Ovtchenkov + + * src/c_locale_glibc/c_locale_glibc2.c: locale_data for glibc 2.3 is differ + from one for glibc 2.2. + +2004-06-11 Francois Dumont + + * test/unit: Modification of some tests to make the assertion + clearer. Mainly add of check of the streams state before check + of the stream content. + + * test/unit/locale_test.cpp: fix of the thousands separator which is + 0xa0 under Win32 and not a simple ' ' for the french locale. + +2004-06-07 Francois Dumont + + * stlport/stl/_algo.c: rollback of the sort algo implementation + to the 4.5.3 version. + +2004-06-03 Francois Dumont + + * stlport/stl/pointers/README, doc/pointer_specialization.txt: move and + rename of the doc about pointer partial template specialization feature. + + * doc/README.ecv4: Creation of a documentation about the install and use + of STLport within Embedded Visual C++ 4 thanks Zdenek Nemec. + + * doc/README.ecv3: Creation of a documentation about the process installment + with the Embedded Visual C++ 3 thanks Michael Fink. + + * stlport/stl/_slist.h: fix of an invalid reference to a _M_node member data + on a _Slist_node_base struct (thanks gcc 3.4.0). + + * stlport/stl/_string.c, stlport/stl/_string.h: fix of missing scopes to + access the base template class _String_base _DEFAULT_SIZE enum member. + (thanks gcc 3.4.0) + + * stlport/stl/_string_base.h: fix of the anonymous union used as a parameter + of the template function swap. (thanks gcc 3.4.0) + + * stlport/stl/_ostream.h: fixes of the missing scopes to access the basefield enum + within the base template class basic_ios from the basic_ostream. (thanks gcc 3.4.0) + + * stlport/stl/_debug.c: clean up of a no more use template function. + (thanks gcc 3.4.0) + + * stlport/stl/_rope.h: fix of the missing scope to access base template class + data member. (thanks gcc 3.4.0) + +2004-06-02 Petr Ovtchenkov + + * src/num_put_float.cpp: some fixes for systems that use snprintf for + output, i.e. for FreeBSD and OpenBSD + + * test/unit/floatio_test.cpp: less precise request, this should work + with static buffer for systems that use snprintf + + * stlport/stl/_config.h: detect MT for OpenBSD + + * stlport/stl/_threads.h: use original spinlock for OpenBSD + +2004-05-28 Francois Dumont + + * stlport/config/stl_gcc.h: fix for the gcc3.4.0 compiler. Modification + of the include path macro to generate 3.4.0 rather than 3.4 . Need + template keyword to reveal use of a nested template class. + + * stlport/stl/_config.h: creation of the _STLP_LONG_DOUBLE macro that + extend to long double on compiler supporting it and double on the other + as a workaround. + + * stlport/stl/_num_put.h, stlport/stl/_num_put.c, src/num_put_float.cpp: + Addition of functions to get the digits from a long double for the monetary + facet. + + * stlport/stl/_monetary.h, stlport/stl/_monetary.c, src/monetary.cpp: + Implementation of the missing money_put::put method taking a long double. + Fixing of the grouping application. + + * test/unit/Makefile.inc, test/unit/locale_test.cpp: Creation of a unit test + for the locale support. At creation it tests the num_put, num_get, money_put, + money_get facets. + + * src/facets_byname.cpp: fix of the monetary format determination from + the locale platform API informations. + +2004-05-28 Petr Ovtchenkov + + * src/explore/Makefiles/gmake/sysid.mak: correctly detect Mingw + + * src/explore/Makefiles/gmake/mingw: compilation under Mingw + +2004-05-27 Petr Ovtchenkov + + * Makefiles/gmake/linux/extern.mak: fix lib catalog name in case of cross-compilation + + * Makefiles/gmake/freebsd/extern.mak: ditto + + * Makefiles/gmake/openbsd/extern.mak: ditto + +2004-05-26 Petr Ovtchenkov + + * Repository: STLport 5.0 RC1 + +2004-05-24 Francois Dumont + + * stlport/stl/_iostream_string.h: + Fix of the iostring_allocator rebind embedded struct and implementation + of the missing __stl_alloc_rebind and __stl_alloc_create useful for compiler + not supporting or buggy on the member template feature (VC6 for instance). + +2004-05-22 Francois Dumont + + * src/num_put_float.cpp, stlport/stl/_num_put.h, stlport/stl/_num_put.c: + Correction of the locale grouping schema application in case of the scientific + output when there is no decimal point. + +2004-05-19 Petr Ovtchenkov + + * stlport/stl/_tree.h, stlport/stl/debug/_tree.h: fix template parameters, see rec + 2004-05-14 below. + +2004-05-16 Petr Ovtchenkov + + * Repository: STLport 5.0 branch + +2004-05-14 Francois Dumont + + * stlport/stl/_tree.h, stlport/stl/_tree.c, stlport/stl/_set.h, stlport/stl/_map.h: + Modification of the _Rb_tree implementation to restore the non mutability of the set + iterators but to keep distinct type between it and the const_iterator. + +2004-05-13 Francois Dumont + + * stlport/config/stl_evc.h, test/unit/nmake-evc3.mak: Portage to the WinCE 3 platform. + Thanks Michael Fink. + +2004-05-13 Francois Dumont + + * stlport/stl/_set.h: Addition of the const/non-const methods for many methods now that + iterator are not const_iterator anymore. Correction of the multiset interface to be + homogeneous with the set interface. + +2004-05-09 Francois Dumont + + * stlport/stl/char_traits.h: Addition of the specific wchar_t static methods similar + to the one of the char specialization calling the wide functions. + +2004-05-08 Petr Ovtchenkov + + * stlport/stl/_set.h: fix definition of const/non-const for find and *_bound + methods. Thanks KL for report. + +2004-05-07 Petr Ovtchenkov + + * stlport/stl/_set.h: fix definition of const/non-const iterators. + Thanks Ilya Chvetsov for report. + + * test/unit/set_test.cpp: test that detect bug above. + +2004-04-27 Francois Dumont + + * stlport/stl/_complex.h: removal of a macro guard on the template != operator. + + * test/unit/complex_test.cpp: creation of a test case for the complex class. + +2004-04-26 Francois Dumont + + * stlport/stl/_fstream.h, src/fstream.cpp: extension of the fstream interface to accept Win32 + HANDLE on construction and in the open method. + +2004-04-26 Petr Ovtchenkov + + * stlport/stl/_istream.h: don't change value while input error happens. + Thanks Nix. + + * test/unit/sstream_test.cpp, test/unit/fstream_test.cpp: added test for error + flags and unchanged value when input error occur. + +2004-04-23 Petr Ovtchenkov + + * stlport/stl/_rope.h: allow search of rope, like done in string + +2004-04-21 Francois Dumont + + * stlport/stl/pointers/README: Creation of a documentation on the new + pointer partial specialization feature. + +2004-04-20 Francois Dumont + + * stlport/stl/_pair.h: modification of the make_pair signature. After the latest + Standard revision it takes params per value and not reference to const. + +2004-04-20 Petr Ovtchenkov + + * stlport/stl/pointers/_list.h: 'clear' method was forgot. + + * test/unit/list_test.cpp: check presence of 'clear' + +2004-04-15 Petr Ovtchenkov + + * test/unit/partial_test.cpp: wrong comparison during test + + * test/unit/sort_test.cpp: ditto + + * test/unit/rm_cp_test.cpp: #ifndef not required---should work + + * test/unit/unique_test.cpp: ditto + +2004-04-14 Petr Ovtchenkov + + * stlport/typeinfo, stlport/config/stl_wince_4.h, stlport/stl/debug/_debug.c: adaptation for Win CE .NET; + Thanks Zdenek Nemec. + + * stlport/stl/_algobase.h: calculate difference once + + * stlport/stl/pointers/_vector.h: missed returns. Thanks KL. + + * stlport/stl/pointers/_list.h: idem. + + * stlport/stl/pointers/_deque.h: idem. + + * stlport/stl/pointers/_slist.h: idem. + + * stlport/stl/_vector.c, stlport/stl/_vector.h: big enough functions moved to non-inline section + + * stlport/stl/_iterator.h: use reference instead of pointer for stored container + +2004-04-06 Petr Ovtchenkov + + * stlport/stl/_prolog.h: when we in _STLP_REDEFINE_STD mode, we really + need to #undef std, see mistake 2004-02-19 below. + + * stlport/config/stl_msvc.h: partially undo workaround 2004-03-30, + not required; problem was solved by #undef std in _prolog.h + + * stlport/stl/_abbrevs.h: add new abbrevs---VC6 has problems in debug mode + +2004-04-03 Petr Ovtchenkov + + * stlport/stl_user_config.h: expose _STLP_DONT_FORCE_MSVC_LIB_NAME for + configuration. + + * stlport/config/stl_msvc.h: incorporate content of stl_select_lib.h and + vc_select_lib.h; a bit cleaned. + + * stlport/config/stl_select_lib.h: removed. + + * stlport/config/vc_select_lib.h: removed. + +2004-04-02 Petr Ovtchenkov + + * src/time_facets.cpp: add #include for sprintf; remove + c_copy_string function. + + * stlport/stl/_time_facets.h: fix for _STLP_LEAKS_PEDANTIC. + +2004-04-01 Petr Ovtchenkov + + * stlport/stl/_string.h: reorder of in-class template and + quazi-specialization function make VC happy, ref. 2004-03-29 + + * stlport/stl/debug/_string.h: fix insert and replace for + iterators that refer to same string in _STLP_DEBUG mode. + +2004-03-31 Petr Ovtchenkov + + * src/explore/nmake-evc4-arm.mak, src/explore/nmake-evc4-x86.mak, etc.: + rules for eVC4 compilers---ARM and ix86 target architectures. + Contribution by Zdenek Nemec. + +2004-03-30 Petr Ovtchenkov + + * stlport/stl/_algo.c: workaround for VC compilers---ones pass reference + to parent object directly, pay no regard for temporary object + + * stlport/new, stlport/stl/_new.h, stlport/typeinfo, stlport/config/stl_msvc.h: + workaround for VC6's problem with 'using' directive, while import native + bad_alloc and some other classes into STLport's namespace + + * stlport/stl/_streambuf.h: export template class, to make VCs to be happy. + + * stlport/stl/_valarray.h: use , not + + * src/explore/Makefiles/nmake/lib/macro.mak, test/unit/nmake-vc6.mak: + fix static library names + +2004-03-29 Petr Ovtchenkov + + * stlport/stl/_set.h: fix problems with erase functions. + + * stlport/stl/_string.h: VC compiler expect only one variant---template + or not---of replace function with four iterators in parameters. + + * test/unit/nmake-src-prefix.mak: really know what do with sources + in cppunit. + +2004-03-25 Petr Ovtchenkov + + * stlport/stl/_string_base.h: enlarge default string static buffer size + + * stlport/stl/debug/_string.h: avoid attempt to invalidate iterators beyond + string size range. + + * stlport/config/stl_gcc.h: instantiation scheme that idefault used---witout + --repo option---in gcc 3 made void of sense explicit instantiation within + library---nothing except increased library size. + Define _STLP_NO_FORCE_INSTANTIATE is default now for gcc 3.x. + + * stlport/stl/_streambuf.h: remove specialization of + basic_streambuf >---reference to FILE struct here + isn't required and really not used anyware. Functionality of standard io + streams, including synchronization with C std io streams provided in + src/stdio_streambuf.cpp + + * stlport/stl/_iosfwd.h: same. + + * src/fstream_impl.h, src/iostream.cpp, src/stdio_streambuf.cpp: same. + + * src/streambuf.cpp: removed. + + * stlport/stl/_stdio_file.h: moved... + * src/_stdio_file.h: ...here + + * stlport/stdio_streambuf: moved... + * src/_stdio_file.h: ...here + + * src/explore/Makefile.inc: remove streambuf.cpp + +2004-03-24 Petr Ovtchenkov + + * c_locale_glibc2.c: real locale implementation for glibc 2.3.x. + +2004-03-15 Petr Ovtchenkov + + * test/unit: unit test suite intended for test/regression replacement. + Zdenek Nemec contribution. + +2004-03-01 Francois Dumont + + * _hash_fun.h: Correction of the hash struct specialization for the _STLP_LONG_LONG + type. Thanks Vianney Lecroard + + * type_traits.h: Integration of the boost (www.boost.org) type traits within STLport. + +2004-02-21 Francois Dumont + + * _tree.h: Modification of the base class implementtion to avoid the systematical + dynamic allocation of a node as the root note of the RB tree. + + * Addition of many missing macro guards in the stlport public headers to avoid to break + the stlport prolog/epilog include framework. + +2004-02-19 Petr Ovtchenkov + + * _slist.h, debug/_slist.h,, dll_main.cpp: remove excess slist redefinitions + + * debug/_slist.h: comment explicit usage of namespace with functions---under + some conditions this hangs gcc compilers. + + * _config.h, _cwchar.h, _epilog.h, _iterator_base.h, debug/_debug.c: multiple import + of _STL namespace into std, as multiple import VENDOR_CSTD namespace into _STL + namespace lead to crash of gcc compilers. Import of _STL namespace into std + namespace done once in the _config.h, not in _epilog.h. + + * _prolog.h: undef std not required in all cases; instead this is useful only + for redefinition of std namespace, and should be done in the _config.h. + + * _epilog.h: include of _config.h has no sense here. + + * _threads.h: wrong import of _STL namespace into global namespace + +2004-02-18 Francois Dumont + + * _list.h: Modification of the base list class based on the slist implementation. + The list do not allocate a node systematically anymore even for the empty list. + +2004-02-14 Petr Ovtchenkov + + * debug/_relops_cont.h, debug/_string.h: fix typos in template specializations. + +2004-02-12 Petr Ovtchenkov + + * explore/icc.mak: experimental make system support Intel's icc compiler + on Linux. + +2004-02-05 Petr Ovtchenkov + + * iostream.cpp, _ios_base.h, iostream, locale_impl.h, locale_impl.cpp: + revise standard iostream and locale initialization, remove worrits about + order of static objects initialization as soon as possible; all real + initialization situated in the locale_impl.cpp; locale initialization + moved to _Locale_impl constructor---locale will be correctly initialized + either via direct locale usage, or during standard iostream initialization, + as ios_base member. This changes may lead to problems with Digital Mars + and Borland compilers---should be checked and fixed. + +2004-02-03 Francois Dumont + + * integration of a portage to the Windows CE .NET (eMebedded Visual + C++ 4) compiler thanks Zdenek Nemek + +2004-02-02 Petr Ovtchenkov + + * _iostream_string.h: avoid usage of iostring in the _STLP_DEBUG mode, + due to iostring::iterator not convertable into string::iterator in this + mode. + +2004-01-29 Petr Ovtchenkov + + * _string.c: avoid 'insert( iterator, const_iterator, const_iterator )' + instantiation in the 'replace'---VC6 has problem here. + +2004-01-29 Francois Dumont + + * facets_byname.cpp: correction of the typeid use thanks to Ulrich Eckhardt. + + * _iostream_string.h: creation and integration of a special string used within + the iostream implementation to display floating point numbers. It mixes a static + buffer with a dynamic one to improve performance. + +2004-01-22 Francois Dumont + + * _new.h: check of the _STLP_USE_EXCEPTIONS before correction of the new + operator behavior and bad_alloc exception definition. + + * _ios_base.h: removal of the _M_get_facet function not fully implemented + and unused thanks Ulrich Eckhardt. + + * _algo.h: correction of the __less_2 helper struct to remove + copy thanks Sergey Volk + +2004-01-19 Petr Ovtchenkov + + * _debug.c: avoid recursive locks in __owner_list's mutex---equivalent + code use underlie iterators, not debug wrapper iterators. By the way this + approach faster---no excessive checks; solved by Boris Fomitchev. + + * _thread.h, _debug.h: recursive-safe mutex structure removed---not + required more; see reason just above. + +2004-01-09 Francois Dumont + + * type_manip.h: Correction of the _IsSame struct to have both partial template + specialization version and the other behaving similarly. + +2004-01-07 Francois Dumont + + * _deque.c: Mysterious copies of instance to store in the containers + has been removed. + +2004-01-05 Francois Dumont + + * _list.h, _slist.h: Implementation of the pointer specialization for list + and slist. + +2003-12-31 Petr Ovtchenkov + + * _vector.h, _vector.c, _hashtable.h: remove excess vector redefinitions + + * debug/_vector.h: pointer specialization for vector not derived + from _Vector_base, so we should avoid references on _Vector_base + class members in debug wrapper. + +2003-12-22 Francois Dumont + + * _string.h: use _STLP_FORCE_STRING_TERMINATION flag to enforce + null-termination of data associated with string. + +2003-12-20 Francois Dumont + + * _vector.h: Implementation of the pointer specialization for vector to + avoid code bloat. + +2003-11-29 Francois Dumont + + * _string.h: Implementation of the short string optimization. + basic_string have now a short static buffer to avoid call + to the allocator when the string is short. + +2003-11-29 Petr Ovtchenkov + + * cwchar, _config.h, _cwchar.h, _stdio_file.h, c_locale.h: + support for OpenBSD, gcc 3.3.1 + + * src/explore/Makefiles/gmake/...: support for OpenBSD, gcc 3.3.1 + +2003-11-17 Francois Dumont + + * _alloc.h: Move of the definition of _Alloc_Traits before inclusion + of _pthread_alloc.h; thanks Diego Klabjan + +2003-11-16 Petr Ovtchenkov + + * _algobase.h, _algo.c: iter_swap and __insertion_sort don't + properly deduce value type of iterator, instead uses dereference's + return type; this occur when dereference return some proxy object, + convertible into value type. + Thanks Przemek Kuczmierczyk for report, test + and solution. + + * iterswp0.cpp, iterswp1.cpp, iterswp.cpp, stl_test.cpp, + stl_test.h, Makefile.inc (test/regression): move iterswp0_test, + iterswp1_test into iterswp.cpp, add new tests for properly deduce + value type of iterator, when dereference return some proxy object. + +2003-11-15 Francois Dumont + + * _string.h: implementation of the expression template for string + addition with other string or C string or char. + + * _ostream.h: adoption of the classic (even if not clear in + the standard) ouput for short and int negative values in hexa + or octo bases that is display according its size for the compiler. + thanks Tanaka. + +2003-11-14 Petr Ovtchenkov + + * src/c_locale.c, src/c_locale_glibc/c_locale_glibc2.c: step to + real locales support with glibc >= 2.2.x + + * src/c_locale_glibc/c_locale_glibc.c: bit fixes for locales + support with glibc < 1.90, and, possible, 1.90 <= glibc < 2.1; + we can't support this old code, so file + src/c_locale_glibc/c_locale_glibc.c is obsolete, and will be + removed. + + * src/explore, test/regression/explore: exprimental make system. + +2003-11-13 Petr Ovtchenkov + + * STLport (repository): current development moved to CVS HEAD stream. + + * STLport (repository): current development stream marked as STLport 5.0. + +2003-11-02 Francois Dumont + + * _limits.c: Correction of the quiet and signaling NaN that was inverted + for several platform; thanks Alexey Sarytchev. + +2003-11-01 Francois Dumont + + * _string.c: judicious correction for string::find_first_not_of to + improve performance; thanks Stephen Cleary. + + * _bitset.h: integration of a workaround for up to MSVC6 compilers + for the bitset input and output operators; thanks Jesse Booher. + + * _ostream.h, _istream.h: fix of a non-standard behavior of the seekp + and seekg calls and conformance to the latest 2003 standard; thanks Tanaka. + +2003-10-26 Francois Dumont + + * _monetary.c: fix an other memory overrun on monetary display; + thanks Tanaka. + +2003-10-26 Petr Ovtchenkov + + * ioiter.cpp, gcc.mak, stl_test.h, stl_test.cpp, stl_test.exp + (test/regression): tests for postfix increment operator and + indirection of istreambuf_iterator. + +2003-10-25 Petr Ovtchenkov + + * _istreambuf_iterator.h: fix postfix increment operator + of istreambuf_iterator to provide conformance with + ISO/IEC 14882:1998(E), 24.1.1, p.511, i.e. + *r++ equivalent to { T tmp = *r; ++r; return tmp; }. + Thanks Tanaka for the report. + +2003-10-23 Francois Dumont + + * debug/: modification of the invalidation of iterators to avoid + invalidation of the end iterator for the associative containers, + hashed containers and list on calls to clear/assign/assignment + operator. (thanks Alexey Sarytchev) + + * _rope.h: Correction of the rope::iterator and rope::const_iterator + copy constructor and assignment operator (thanks Bradley Grainger) + +2003-10-16 Francois Dumont + + * _alloc.h: Add of the throw() specification on allocator comparision. + + * _iterator.h: Correction of the operator++(int) signature to conform + to the standard. + + * _ctype.h: tolower and toupper for wchar_t types. + + * _valarray.h: gslice_array::operator = (const value_type&) not + const anymore + + * _valarray.h: slice_array idem + + * _valarray.h: valarray operator [](const gslice&) former version + was taking a copy of gslice + + * _codecvt.h: correction of the default codecvt class definition and + correction of the out method + + (all thanks Richard Peng) + +2003-10-16 Francois Dumont + + * debug/: add of the iterator range check on all container constructors. + + * _string.h: correction of a bug on string auto referencing throught + some method like insert and replace. (thanks Tanaka) + + * _valarray.h: correction of the missing slice_array copy constructor + and assignment operator in the private section (thanks Tanaka) + +2003-10-11 Petr Ovtchenkov + + * _sstream.c: [io]?stringstream must do equivalent of seek at end, + after opened with ios_base::ate; this behaviour useful only when buffer + initialized by string; thanks Tanaka for the report. + +2003-10-06 Francois Dumont + + * _istreambuf_iterator.h, _ostreambuf_iterator.h: correction + of the missing iterator base class (Thanks Tanaka) + +2003-10-05 Francois Dumont + + * _string.h: correction of the replace implementation badling form + for self referencing + + * _string.h, _string.c: Modification of the _M_copy method + to _M_move as basic_string do not correctly handled self referecing; + thanks Tanaka + +2003-09-25 Francois Dumont + + * como 4.3.0 on linux support (thanks Synge Todo and Karel Gardas) + + * Quazy-leak patch: make memory detection tools happier, + option _STLP_LEAKS_PEDANTIC in _site_config.h. (thanks Petr Ovtchenkov) + +2003-09-19 Francois Dumont + + * Support of the Linux Intel C++ support (thanks Blaine Kubesh) + + * FreeBSD support update (thanks Guy Middleton). + + ---- + + * codecvt.cpp: charcode correction in the do_in method (thanks J Hamilton report) + + ---- + + * _valarray.h: Correction of the missing explicit keyword in front of one of the valarray constructors + (thanks Stephen Clamage) + + ---- +2003-08-10 Francois Dumont + + * stdexcept: Correction of the mysterious 50 messages from VC7.Net (thanks Krish S) + + ---- + + * _vector.h: implementation of the max_size method based on the allocator::max_size method + (thanks Gennaro Prota from the boost forum). + + ---- + + * _vector.c: add of the standard length_error exception to the reserve method (thanks Steven Youngs). + + ---- + + * _alloc.h: add of a check of the number of element require to allocator::allocate to avoid a possible + size_type overflow (thanks Steven Youngs). + + ---- + + * _istream.h: move of the ws implementation within the header to avoid undefined symbol + under NO_CUSTOM_IO mode (thanks Ulrich Eckhardt) + + ---- + + * ctype.cpp : charcode correction (thanks Markus Stier reports and Alberto Barbati correction) + + ---- + + * _function.h : all function can now be used in a non-const world (thanks Alexey Kirjushkin) + + ---- + + * move constructor framework integration (thanks Francois Dumont) + + ---- + + * containers interface correction for standard compliance when using explicit + intanciation of not default constructible type. (thanks Alexei Agafonov report) + + ---- + + * iostream.cpp, locale_impl.cpp : static initialization made robust for case of + dynamic loader circular dependancies (Thanks Alexey Sarytchev for the report) + + ---- + + * _function.h : integration of a new workaround for mem_fun_* family + for compiler having return void bug (Thanks Pavel Kuznetsov). + + * stl_solaris.h : v8plus compilation fix (Thanks Mukesh Kapoor) + + * num_put_float.cpp : FreeBSD fix + + * _construct.h : fixed case for compilers with default integer + constructor bug + + --- + + * fstream.cpp : text file stream position bug correction (thanks Christopher Kohlert) + + --- + + * _num_put.c : Correction of the display of the min 64 bits signed integer values + like numeric_limits<__int64>::min() on WIN32 for instance (thanks Anders Dalvander) + + --- + * _num_put.c : Add of the '+' sign when requested for the unsigned integer display + (thanks Francois Dumont) + + --- + + * debug : many missing iterator invalidation corrected (thanks Detlev V.Davidson and Francois Dumont) + + --- + + * _new.h : introduction of a new config compiler switch for those which do define + bad_alloc but that do not throw it! (thanks ?) + --- + * _new.h : class nothrow_t changed to struct nothrow_t (Thanks Francois Dumont) + --- + * _bvector.h : Addition of the |= and &= operator on the _Bit_reference struct (thanks Ed Rice) + --- + * Performance bug in type_traits.h fixed (Thanks Francois Dumont) + --- + * Added Linux spin lock code () + --- + * Added GCC-3.x configurations + + * Fixed HP aCC support + + * Added OpenWatcom support + + * version numbers bumped + + * iostreams ported to EMX (gcc on OS/2) (Thanks Martin Schaffoener) + + * iostreams ported to CRAY Unicos C90, T90, and J90 (Thanks Geir Johansen) + + * stl_sunpro.h : fixed mbstate definition for SUN 4.2 (thanks lengzq) + + * complex.cpp, _complex.h : template<> used for specializations + + * _num_put.c : unused locale variable removed (thanks Petr Ovtchenkov) + + * _algo.h : __reverse beautified (thanks Kabanov) + + * dll_main.cpp : force_link() forced to be linked in + + * stl_msvc.h : config changes for .NET + + * _auto_ptr.h : "struct" changed to "class" + + * _istream.c : M_read_unbuffered fixed (thanks Stefan Schwarzer ) + + * stl_gcc.h : added missing inclusion for SCO platform (thanks Emmanuel Soden) + + * _tree.c : optimized insert_unique (thanks Timothy) + + * _algo.c : relaxed type requirements for lower_bound, upper_bound, binary_search + + * _algo.h : adjacent_find() expressed with compare-function flavour + + * cpp_runtime/typeinfo : made adjustments for .NET (Thanks Daniel) + + * cstd/cassert : guard removed (thanks Evan Cheng) + +The following changes were made in 4.5.3 since 4.5.1 release: + + * iostreams ported to Windows CE (thanks Andrew Waters) + + * iostreams ported to AmigaOS (thanks Steven Solie) + + * iostreams ported to NCR 3.x (thanks Emmanuel Soden) + + * _hash_map::operator[] : enhanced to avoid calling default object constructor + (Thanks Yuri Taranenko for the report) + + * Identifier "__value" changed everywhere to "__val" to avoid clashes with Microsoft's "managed C++" keyword (thanks Crow for the report) + + * Most containers : swap() fixed to swap non-stateless allocators correctly (thanks Scott Meyers) + + * _sstream : fix to account for ios_base::app flag properly + + * type_traits.h : _IsOKToMemCpy() fixed to only allow memcpy() for same type arguments (thanks Ed Brey for the report) + + * stl/_num_put.c, stl/_list.c : workarounds for Debian gcc (thanks Levente Farkas) + + * : fixed MS workaround (thanks Wil Evers, Andrew Ushakov) + + * _pthread_alloc.h : added per_thread_allocator class; returns memory to the same thread it's been allocated in. + + * _iterator_old.h : restored ->() operator for MSVC (thanks Daniel Anderson) + + * a bunch of MPW fixes (thanks Tsutomu Yoshida) + + * _config_compat.h : fixed compatibility definition for _STLP_NO_EXCEPTIONS (thanks Nicolas) + + * _fstream.c : fixed bug in _M_seek_init (thanks Pavel Kuznetsov) + + * _rope.h : rope<>::swap() methods fixed for non-partial ordering case (thanks Eric Musser) + + * comlex_trig.cpp : fixed bug on SGI (thanks Mortis) + + * A bunch of fixes for HP aCC compilation with -AA option (thanks John Bossom) + + * *.c files : added conditional inclusion of corresponding *.h file to fix xlC issues with -tempinc option (thanks Alla Bogolyubov for the report) + + * _auto_ptr.h : "struct" changed to "class" (thanks Alex Pinsker for the report) + + * _config.h/stl_user_config.h : handling of macro _STLP_WHOLE_VENDOR_STD rectified + + * _num_put.c : do_put(const void*) changed to output pointers in hex format (thanks Alex Rosenberg) + + * test/eh/test_algobase.cpp : fixed alignment to work on 64-bit architectures + +The following changes were made in 4.5.1 beta 1 since 4.5 release: + + * _config.h, _epilog.h : new namespace inclusion schema implemented for own iostreams mode + (no std:: redefinition; _STL:: namespace imported into std::, instead of std:: imported to _STL. + C library header files wrappers become obsolete if this mode is used and no own namespace is selected. + They will be moved out to distinct directory in the next release, and default is going to be no own namespace + with own iostreams.) + For some compilers (VC6), this only works with _STLP_NO_OWN_NAMESPACE and _STLP_OWN_IOSTREAMS settings. + + * iostreams ported to SCO OpenServer (thanks Emmanuel Soden) + + * sparc_atomic.s : added "stbar" to fix multiprocessor crashes on SPARC + + * dll_main.cpp : forced link of Bs_G static data members (thanks Sandy Martel). Function wrapped in STLport namespace. + + * _alloc.c : fixed _STLP_CHUNK_MALLOC for debug malloc configuration (thanks Markus Sch pflin) + + * _config_compat.h : fixed compatibility section for _STLP_NO_OWN_IOSTREAMS + + * fstram.cpp , vc6.unicode.mak : fixed bug in wide streams handling for VC6 (thanks Jim Dolter) + + * etc/*.txt : files list broken up into several categories for future reorganization + + * stl_msvc.h : fixed library selection for .NET (Thanks Franz Zetting) + + * _ftsream.h, iostream.cpp : fixed compilation for _STLP_NO_EXTENSIONS case (thanks Ben Dorman for the report) + + * char_traits.h : fpos<> operators == made members (thanks Thomas Witt) + + * _threads.h : added using directive for Solaris x86 compile (thanks Mukesh Kapoor) + + * _threads.h : fixed InterlockedXXX definitions for VC++ 6.0 SP5 (thanks AndreasM) + + * gcc-install-apple-macosx.mak : INSTALL_STEP set to install_unix (Thanks Tron Thomas) + + * common.mak : default install directory for Unix set to /usr/local + + * _string.h : _M_null expressed via _STLP_DEFAULT_CONSTRUCTED (Thanks Anthony) + + * _site_config.h : made sure _STLP_NO_THREADS are set if _NOTHREADS is on (Thanks Jeppe Madsen) + + * _config.h : _STLP_WIN32THREADS is set (bugfix) ( thanks to Andreas Malzahn ) + + * _num_put.c, common_rules.mak : patches by Levente Farkas + + * etc/STLport-4.5.1.spec : spec file to build STLport-4.5.1 RPM added (thanks Levente Farkas) + + * _auto_ptr.h , _debug.c, _debug.h : debug check for auto_ptr pointer added (thanks Gerd Hoeren for the idea) + + * debug/_vector.h : invalidation for erase() corrected not to invalidate current iterator (Thanks ALberto Barbati) + + * stl_bc.h : restored automatic library link directive for cases when STLport is not a native library + + + * _auto_ptr.h : template constructor conversion bug fixed (thanks mbergal) + + * MIngw32 patches integrated (thanks Wu Yongwei) + + * src/complex_impl.h : case for DEC CXX changed to general, instead of extension functions for float and long double, to get it compliled with CC 6.1 (thanks Tony McConnell) + + * dll_main.cpp : added __malloc_alloc instantiation (thanks Michael Ehrig) + + * _debug.c : fixed race condition in _M_detach (thanks Achim Stremplat) + + * test/*/hpacc.mak : fixed flags and libs (thanks Michael Ehrig) + + * typeinfo : added fix for MS VC ::bad_cast confusion (thanks Alberto Barbati) + + * debug/_vector.h : removed extra guard for MSCV around member template constructor (thanks Alberto Barbati) + + * _fstream.h : added extension basic_fstream<> constructors taking protection parameter (thanks Mukesh Kapoor for the idea) + + * stl_sunpro.h : added additional C include directory choice for Solaris 6&7 (thanks John E. Bossom) + + * _vector.c : added _vector.h inclusion for _STLP_LINK_TIME_INSTANTIATION case (thanks Alex Vanic) + + + * _num_put.c : fixed overflow case with grouping (thanks Will Evers) + + * _istreambuf_iterator.h : fixed distance_type return type (thanks Anthony Williams) + + * debug/_vector.h : debug version of push_back() added (thanks) + + * Iostreams ported to LynxOS 3.0 (thanks Dmitry Azovtsev) + + * wrappers/*.h : added inclusions of the master header to fix xlC 3.x compile (Thanks Dmitry Azovtsev) + + * Changes for BCB6 integration (thanks Nathan York) + + * Removed all dead code blocks marked by #if OBSOLETE and #if 0 + + * Updates build spec file for Linux rpm (thanks Levene Farkas, Harold van Oostrom) + + * complex_trig.cpp : limits changed to be static, for performance optimization (thanks Sergei Nikolaev) + + * _algo.c : eliminated default-constructed iterators, to lift unnecessary restriction (thanks Tonci Tomic ) + + * _vector.h : fixed bug in assign() : copy used instead of __copy_aux (Thanks Tim Finer) + + * stl_sunpro.h : restored _STLP_HAS_NO_NEW_C_HEADERS switch for SUN CC 4.2 + + * : __stl_new definition put into the namespace (thanks Satoshi Nakamura) + + * bcb*.mak : fixed md command and DYN_LINK (thanks Kirby Zhou) + + * stl_user_config.h : added _STLP_USE_CUSTOM_CHAR_TYPES_IO switch to optimize iostreams for default case + + * debug/_vector.h : fixed debug check bug (thanks Gerd Hoeren) + + * _alloc.h : allocator::construct uses std::_Construct (thanks Gert Grossmann) + + * stl/_alloc_old.h : restored (thanks Gert Grossmann) + + * stl/_threads.h : fixed _STLP_ATOMIC_xxx macros for DEC (thanks Gert Grossman) + + * src/_locale_impl.cpp : added missing guards for codecvt<> in _STLP_NO_MBSTATE_T case + + +The following changes were made in 4.5 release since 4.5 beta 8 : + + * _threads.h, debug/_debug.h etc : STLport iostreams library made binary compatible with user code compiler w/o multithreaded switch, for some platforms + + * config/stl_msvc.h, : corrected _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS for VC++ 6.0 SP5 + (Thanks Alberto Barbati) + + * src/vc6.mak : RC macro definition restored (Thanks Graham) + + * stl/_cmath.h, : parts of code moved to as uses it (Thanks Synge Todo) + + * stl/_tree.c : fixed insert_unique() with a hint bug (Thanks Serge Pashkov) + + * src/gcc-*.mak : removed -nostdinc++ option + + * stl_solaris.h : definition of _STLP_SUNPRO_EXCLUDE made dependant on _XOPEN macro instead of SUN CC macros (Thanks ecohen for the report) + + * fstream.cpp : mmap_chunk made to be 1M instead of 16M as was originally intended (thanks Alexey Starikovskiy) + * stl_sunpro.h : _STLP_LIMITED_DEFAULT_TEMPLATES not defined for compat mode anymore ( thanks Michael Kopp) + * dll_main.cpp : added instantiation for _Swap_lock_struct<> (thanks simonb) + + * _ostream.c : fixed formatting bug for width()==1 + + * config/_epilog.h : added option pop section for Borland. + + * stl/_threads.h : fixed InterlockedXXX declarations for MS .NET (thanks Piers Haken) + + * vc7.mak makefile added for MS VC++ 7.0 (.NET) + + * fixed _STLP_ITERATOR_CATEGORY, etc. for Mwerks CodeWarrior 5.0 + + * stl/_num_put.c : fixed operator<<(void*) to use _STLP_LONG_LONG where available. + + * _STLP_WHOLE_VENDOR_STD option is back supported (Thanks anton ephanov for the input) + + * _cmath.h : added guard to mask additional overloads (thanks Tim Smith) + + * stl_solaris.h : mbstate_t stuff defined here, old-style C headers used (Thanks Mukesh Kapoor) + + * type_traits.h : __default_constructed() inlined (Thanks Matt Davies) + + * new.h : fix for gcc-3.0 to look in backward directory (Thanks Ken) + + * stlport/using/h/streambuf.h added (Thanks Gennadiy) + + * A bunch of changes for Borland static and DLL compile (Thanks Nathan York) + + * stl/_algo.c : fixed find_end() bug (Thanks Alberto Barbati) + + * stl/_queue.h : priority_queue<>::_comp renamed to "comp" as standard states (thanks Todd Greer) + + * _limits.c : added correct data member representations for AS400 and Alpha machines (thanks Holger Stash) + + * _vector.h : added check to avoid calling allocator<>::deallocate(0) (thanks Stephen Cleary) + + * config/_prolog.h, config/_epilog.h : added push/pop pack(8) pragmas for MSVC (thanks Todd Greer, Alberto Barbati) + + * gcc.mak's : default spelling for "-pthreads" option changed to "-pthread" as more platforms use that. + + +The following changes were made in 4.5 beta 8 since 4.5 beta 7 : + + * stl/_fstream.c : _M_underflow bug fix for custom codecvt facets (thanks Alberto Barbati) + + * bcc55.mak : c_locale.c added to the link command (thanks Steve Loves) + + * _iterator_base.h & many other places : iterator tags are being accepted by const reference + instead of value, to fix segmentation faults experienced on certain platforms with beta7. + That also should improve efficiency on same platforms (apparently, empty unreferenced + objects with no constructors/destructors were copied on the stack when passed by value). + Accompanied change eliminates hardcoded deference hack used in previous beta. + Thanks everybody who reported this. + + * stl_user_config.h : added _STLP_GCC_USES_GNU_LD switch. This is for those platforms + where native linker does not let gcc to implement automatic instantiation of static + template data members (Tru64, AIX, HP-UX). + It is being put in this file as there is no automatic way to check if we are using GNU ld or not. + + * _range_erors.h : depandancy on and removed for own iostreams mode + (thanks Doug Gilbert) + + * debug/_list.h : "typename" added in new methods (thanks Doug Gilbert) + + * _config.h, src/common_macros.mak : beta version number bumped + + * src/ftream.cpp, c_locale_win32.c : fixes for UNICODE compilation (thanks Valo) + + * stl_gcc.h, etc : changes for GCC support on Tru64 (thanks Tobias Ernst) + + * _alloc.c : for MS VC, malloc_dbg only used when _STLP_DEBUG_ALLOC is set, not for all debug configs + (Thanks Anton Ephanov) + + * test/eh/gcc.mak : directories stuff fixed (Thanks Brodie) + + * stl/_complex.h : fixed declarations for long double specializations (Thanks Tsutomu Yoshida) + + * locale_byname.cpp, etc. : fixes for Apple compilers by Tsutomu Yoshida. + + * _ios_base.h : __evenk id changed not to clash with MS VC++ 7 (thanks Paul Ghezzi) + + * _fstream.c : added basic_filebuf constructor workaround for compiler which do not initialize builtins + to zero when default constructed (thanks Alberto Barbati) + + * _locale.h : relaxed guerd around templated locale constructor (thanks Alberto Barbati) + + * stl_mwerks.h : changes to accomodate CodeWarrior 6.2 (thanks cprosser) + + * stl/_cmath.h : extracted from for better decoupling + + * stl/_std_prolog.h, stl/_std_epilog.h : hooks for future alternative namespace inclusion style. + + * config/stl_gcc.h : gcc-3.0 now supported + + * src/gcc-beos.h : only static library is being built (dynamic stil don't work) (thanks John Maddock) + + * using/iostream : included using/istream and using/ostream + + * dll_main.cpp : force_link() fix to prevent numeric_limits static members and + _M_increment/decrement from _tree.c from being optimized out by VC++ + (thanks Sofus Mortensen, Alberto Barbati ) + + * _alloc.c : added CHECK_NULL_ALLOC for _STLP_CHUNK_ALLOC with malloc, to throw exception if malloc returns 0 (thanks ghunt) + + * stl_bc.h, : fixed Borland C++ import of unexpected handler stuff + + * stl_ibm.h, etc. : fixes for IBM VisualAge 5.02 to compile + + * type_traits.h : bool2type<> changed to be parameterized on int, to work around SUN CC bugs (probably others, too) + +The following changes were made in 4.5 beta 7 since 4.1 beta 6 : + + * sparc_atomic.s : file missing from the distribution restored + + * etc/ subdirectory created; miscellanous files moved there + + * STLport ported to BeOs, complete with iostreams (thanks John Maddock) + + * Macro _STLP_NO_SGI_IOSTREAMS renamed to _STLP_NO_OWN_IOSTREAMS, old references to SGI removed; + + * "prepare" target added to all makefiles in src/; should be run before using STLport; + on most platforms it's empty, on some of them it creates necessary symbolic links, etc. + + * stl/_deque.h : deque<>::erase bug (introduced in 4.1b4) fixed (thanks to BruceFlorman) + : default parameter in constructor bug fixed (Thanks to Alex Vanic) + + * stl_msvc.h : explicit template function agruments enabled for VC++; + + * stl_wince.h : added inclusion + + * stl/_limits.h : numeric_limits::digits changed from 0 to 1 (Thanks Mukesh Kapoor) + + * stl/_function_base.h : added __identity_element() (extension name), _numeric.h : this one used instead of identity_element() (Thanks Hafeez) + + * stl_msvc.h : explicit template function agruments enabled for VC++; + + use_facet<> now fully conforms to the standard with VC++. (Thanks Jeff Kohn for the input) + + * fstream.cpp : LARGE_INTEGER used to work around Intel shift instruction bug (thanks Thomas Meischner) + * fstream.cpp : ULL macro fixed for Win32 + * fstream.cpp : Added test for for INVALID_HANDLE_VALUE and NULL base and _M_view_id, + for _M_close on Win32 (Thanks Stephen Baker) + * fstream.cpp : Fixed corner case with mmap() on EOF (Thanks Jens Maurer) + + * _istream.c : fixed _M_read_buffered sssso that it does not skip delimiters (Thanks Gerd Hoeren) + + * stl/_string.h : operator __std_string() uses constructor with a size to correctly initialize string containing null chars (Thanks Armin) + + * iomanip : added operator for setfill object and istream (was ostream only) (Thanks Mukesh Kapoor) + + * stl/_locale.h , stl_intel.h : fixes for Intel 5.0 compiler (Thanks Anton and Marcello Pietrobon) + + * stl_solaris.h : added _STLP_NO_NATIVE_WIDE_FUNCTIONS + + * New makefiles added for Intel C++ 5.0 and VC++ 6.0 in src/, test/eh, test/regression (Thanks to Marcello Pietrobon) + + * _STLP_NO_LONG_DOUBLE case handled for STLport iostreams as well (thanks John Daniel) + + * SUN CC compiler template cache is being properly cleaned up (Thanks Whitney Kew) + + * dll_main.cpp : added extern "C" around DllMain() (Thanks Danny Smith) + + * type_traits.h : added bool parameter to shut up warnings on some compilers (Thanks glassman) + + * stl/_rope.h/.c, src/mrcpp.mak, src/mrc.mak, stl/_tree.h : MPW & MRC fixes by Tsutomu Yoshida + + * stl_gcc.h : added path for et al for gcc-2.95.3 on FreeBSD (Thanks to + + * _tree.h /_tree.c : pointers used as return values instead of iterators for implementation + functions, for efficiency. + + * _algo.h/.c : added leading underscrore to some symbols (Thanks to Ed James-Beckerman for the report) + + * dll_main.cpp : fixed nothrow object initialization (Thanks to Dan Ingold) + + * beta suffix in common_macros.mak updated (thanks to Whitney Kew) + + * c_locale_win32.c : incomple fix for locale completed (thanks to Alberto Barbati) + + * c_locale.h : _Locale_ALPHA definition for VC++ and mingw32 fixed (thanks Danny Smith) + + * _threads.h : fixed _DECTHREADS block to work on both DEC and HP + + * _hash_set.h : fixed typo in MSVC++ bug workaround ( Thanks to Jon_Hanson for the report) + + * stlport/strstream.h : fixed inclusion for MSVC 6 (Thanks Joachim Achtzehnter) + + * _config.h : _STLP_RETHROW changed to avoid warnings with NO_EXCEPTIONS (thanks Richmond) + + * _hashtable.c : prime list definition made consistent (thanks Rainer Schnitker) + + * stl_hpacc.h : _STLP_FORCE_ALLOCATORS workaround used for Version 3.15 also (thanks Rainer Schnitker) + + * stl/_string_io.c : fixed using directive in operator >>() (thanks Rainer Schnitker) + + * debug/_deque.h : a check in erase() fixed (thanks Andreas Malzahn) + + * debug/_list.h : added remove() to do iterator invalidation; range erase() fixed to do invalidation + + * stl_watcom.h : added switches; disabled own iosterams by default; + enabled ->() operator for iterators (thanks Steven Green) + + * : added throw spec for what(); stl_sgi.h : made _STLP_NO_EXCEPTIONS depend on __EXCEPTIONS macro (Thanks Anton Ephanov) + + * _string_io.c : operator << : fixed width() interpretation bug + + * stl_hpacc.h/cmath : fixed HP aCC settings for -AA option (thanks Doug Gilbert) + + + +The following changes were made in 4.1 beta 6 since 4.1 beta 5 : + + * _istream.h, _ostream.h, _ios.h, _fstream.h : guard macros fixed to not clash with .h files in "stlport" directory + Also all uses of those macros fixed. (thanks to Gerd Hoeren for the report) + + * _debug.c/_debug.h : fixed swap() for rb_tree and list (thanks to Gerd Hoeren for the report) + swap() changed not to invalidate any iterators, as prescribed by the standard + + * forced _REENTRANT to be defined when compiling with STLport iostreams and _STLP_DEBUG + (without _STLP_DEBUG it seems to be binary compatible even without that) + + * facets_byname.cpp source introduced to replace all xx_byname.cpp files; + restored separate facets .cpp complilation (they used to be included in locale_impl.cpp) + + * introduced _STLP_USE_PERTHREAD_ALLOC to optionally use per-thread allocator + (_Pthread_alloc from _pthread_alloc.h) as the deafult node allocator. Only works with pthreads for now. + + * Switches _STLP_DONT_REDEFINE_STD and _STLP_WHOLE_VENOR_STD are back (thanks to Anton Ephanov for the report) + + * _vector.h : fixed bug in template version of insert (Thanks to Yotam Medini for the report) + + * monetary.cpp : unneded hack for cygwin removed (thanks to Dean Sturtevant) + + * : fixed _STLP_OUTERMOST_HEADER_ID macro + + * cin/cout/cerr redefined if no namespaces and SGI iostreams are used, for all compilers, just in case. + * _sparc_atomic.h : fixed and improved atomic ops for gcc + + * test/regression : non-backward-compatible old-style __STL_xx macros use changed to _STLP_xx + + * config/st_gcc.h : disabled non-standard "extern" use for non-DLL templates + + * mingw32 - used 'windows.h replacement' section in _threads.h (thanks to Danny Smith) + + * locale Win32 bug fixed (thanks to Alberto Balbarti) + + * mingw32 : _STLP_CONST_INIT_BUG defined for dll (thanks to Danny Smith) + + * "make clean" glitches fixed (thanks to Whitney Kew for the report) + + * _fstream.c : fixed codecvt bug for variable width encoding + + * _STLP_ABORT macro introduced to avoid clashes with third-party sw redefining abort() (thanks to Jerry) + + * c_locale_win32 : fixed parse bug in __ParseLocaleString (thanks to Danny Smith) + + * extra declspecs removed from templates to fix VC++ 7.0 ; only concrete classes have specifiers (thanks to Holger Stasch for the report) + + * stl_msvc.h, _hashtable.h/.c : fixes for IA64 compilation (thanks to Rainer Schnitker ) + + * fixed bugs in "make install" on Unix (thanks to Carlos Paniago) + + * dll_main.cpp : DisableThreadLibraryCalls used for optimization (thanks to Alberto Barbati) + + * dll_main.cpp : a dummy function added to force guts for static VC++ link (thanks to Alberto Barbati) + + * gcc-linux.mak : flags fixed (thanks to Levente Farkas ) + + * stl_msvc.h, stl_intel.h : fixed __ICL version test (thanks to Serge Pashkov) + + * versioning schema changed on Windows to have .dll extension (thanks everybody for the feedback) + + * NetBSD makefiles fixed + + * A bunch of fixes by Tsutomu Yoshida : MPW fixes plus : + * stl/_config.h : I believe the definition for _STLP_STD under debug/non-debug configurations swapped. + + * typeinfo.h : added check for _STLP_NO_NEW_HEADER for using declaration. + Otherwise three classes will not be included in the namespace std when #include . + + * _istream.c : use of bind2nd (which required _function.h inclusion) changed to use alternate functor (thanks to Sergei Nikolaev) + + * stl_msvc.h : removed erroneous _STLP_USE_TEMPLATE_EXPORT setting which caused major code bloat for native streams builds on VC++ (Thanks to Johannes Brunen for the report) + + * _string_io.c : fixed Intel C++ compilation bug in native streams mode + + * fstream.cpp : added write-sharing for fstream file handle (Thanks to Leland Best) + + * stl_gcc.h : disabled wide function imports for linux (some xx_POSIX macro should be really used; disabled for all linuxes for now). Thanks everybody for the reports. + + * KAI C++ 4.0 is now supported on SUN + + * MAC OS X compilation fixed (thanks Patrick Luby for the patch) + + * HP aCC fixes by Michael Tsirkin + + * "INF/NAN" string representation for uppercase changed to "Inf/NaN" to behave like printf() on most systems. + + * debug/_iterator.c : fixed SUN 6.0 compiler internal error + + * typeinfo.h : global scope used to import bad_cast, etc. (thanks to Val Melamed) + + * debug/_list.h : missing template versions of remove_if(), merge() added. Missing regular sort() added. + (Thanks to dgehri) + + * debug/_slist.h : missing sort() (template and regular) interface added + + * _istream.h : eliminated warning about comparison with unsigned (Thanks to Gerd Hoeren for the report) + + * template constructors for containers changed to be one version with default allocator agrument, where possible. + + * remaining _STL_ prefixes changed to _STLP_ + + * Solaris 7 compilation fixed + + * fstream.cpp : seek() allowed to seek past the end of the stream (Thanks to Phillip Toland for the input) +The following changes were made in 4.1 beta 5 since 4.1 beta 4 : + + * All internal macros changed to have prefix _STLP_ instead of __STL or __STLPORT or __SGI_STL. + That is to allow seamless wrapping on platforms that use SGI STL as native STL/iostreams. + For backward compatibility, most of user-settable __STL_xxx macros are accepted. + + * Versioning of shared libraries made UNIX-compliant + + + * Some temporary lifetime problems in SGI iostreams which may introduce memory corruption, fixed. + + * : fixed memory leak bug due to unclever macro expansion in __stl_new (thanks to Joachim Achtzehnter) + + * stl/_tree.h : fixed several bugs in new code for corner cases in insert_equal()/insert_unique() with a hint + (thanks to Micheal Tsirkin for the report and patch) + + * _vector.h:284 : __copy call fixed to be __copy_aux (thanks to Alex Vanic) + + * _config.h : fixed static build bug due to __STL_EXPOSE_GLOBALS_IMPLEMENTATION typo (thanks to Serge Pashkov) + + * fstream.cpp: __pioinfo definition for mingw32 fixed (Thanks to Danny Smith) + + * *.SUNWCCh files changed to regular files; moved to "stlport" directory + + * pthread_alloc : split into / + + * lightweight atomic ops used on SPARC v8plus and v9 (gcc and SUN CC) + + * Mac OS X support introduced (thanks to Patrick Luby) + + * SGI iostreams ported to DJGPP (thanks to Tanes Sriviroolchai) + + * SGI iostreams ported to NetBSD (thanks to Michael Rauch) + + * FreeBSD build fixed, now builds for wchar_t too + + * DEC CXX build fixed; restricted to dynamic lib only + + * SGI MIPSpro build fixed; GNU make has to be used + + * Set of HP fixes by Michael Tsirkin + + * Set of Watcom fixes by Ricardo Gayozo + + * Bunch of Apple MRC/MPW fixes by Tsutomu Yoshida integrated + + * Bunch of iostream fixes for Cygwin, Borland and Intel 4.5, by Serge Pashkov + + * debug/_list.h : added checking versions of pop_back/pop_front (thanks to Per Liboriussen) + + * src/c_locale_win32.c : fix for VC5sp3 (thanks to Petr Ovtchenkov), fix for day of week order (thanks to Danny Smith), + fix for null-termination in my_ltoa (thanks to Serge Pashkov) + + * Some warnings in debug mode fixed (thanks to Marco) + + * type_traits.h : IsP functions return types changed to be more portable (thanks to Serge Pashkov for the suggestion), + __cdecl added for Win (thanks to Todd Wilson) + + * debug/_tree.h : added owner check for erase() (thanks to Alberto Barbati) + + * stl/_ostream.h : << operator specializations added for compilers w/o partial ordering + (thanks to Alberto Barbati for pointing this out). + + * "make install" on UNIX : fixed the target not to remove lib directory; + default installdir restored to be /usr/local (thanks to Jeff de Vries for the input) + + * _construct.h : extra cast for __STL_SHRED_BYTE removed (thanks to khesin) + + * _relops.h header obsoleted; some extra includes removed + + * __STL_STATIC_CONST_INIT_BUG use normalized; now it's used for all compilers not able + to treat const members as coplile-time constants; enum used for them (e.g VC++). + Thanks to Dean Sturtevant and Gavin Collins for the ideas. + + * stlport/cmath : fixed SUN CC 5.0 compatibility mode bug (thanks to ade for the report) + + * debug/_hashtable.h : fixed equal_range() bug (thanks to decraft for the report) + + * streambuf.cpp/_streambuf.h : fixes xsgetn() bug (thanks to Vadim Egorov) + + * istreambuf_iterator<> : nonconforming behaviour fixed (thanks to Tom Widmer) + + * _num_put.c : fixed corner case for 0x8000000 output. + + * num_get<> : extra get() and do_get() members for "int" and "short" removed; istream operators changed accordingly + + * _itreambuf_iterator.h/_ostreambuf_iterator.h introduced to decouple those from num_get/num_put + + * gcc makefiles in src : "-fno-implement-inlines" removed + + * Added workaround for gcc's limits.h and SUN Ultra with -mcpu=ultrasparc in 32-bit mode. + + * ios_base:: type for constants made "int" for all compilers, as it more efficient and perfectly compliant. + + * debug/_hashtable.h : fixed typo in swap() ( thanks to Gerd Hoeren for the report) + + * debug/_string.h : +() operators defined unconditionally ( thanks to Gerd Hoeren for the report) + + * _istream.c : removed dependancy on _function.h (thanks to Kenny Simpson for the report) + + * _limits.c : fixed little-endian representation of infinity & NaN (thanks to Rene van Oostrum) + + * _stdio_file.h : fixed postdecr macro for 64-bit Solaris (thanks to Jim Cole) + + +The following changes were made in 4.1 beta 4 since 4.1 beta 3 : + + * Simulation of class partial specialization (thanks to Mat Marcus and Jesse Jones of Adobe) + used to provide following enhancements : + + - type_traits are automatically specialized for all pointer types for all compilers, + which makes them able to utilize type_traits-based optimizations when dealing with pointer types, + automatically. + + - all functions specialized for pointers and optimized via __type_traits + ( like copy()/copy_backward(), _uninitialized_xx) now enjoy this optimization for all compilers! + + - generic __value_type()/__difference_type()/__iterator_category() are written so user does not have + to supply any of its own even when partial specialization is not available. + (Note : gcc-2.7 and VC++ 5.x, 6.x have bugs which prevents them from using this enhancement, still) + + * : by default, non-standard iterator query names like + value_type()/difference_type()/iterator_category() are not used + + * : major revision: + - algorithms without explicit Compare() function expressed via the one that has it where possible. + This considerably reduces header size and reduces code bloat for programs which use both flavours of + those algorithms. + - some function bodies moved between .c and .h + - all functions used internally moved out to _algobase.h, so no other header includes <_algo.h> anymore + - find() specialized for random access iterators regardless of partial spec. + + * Dynamic libraries (.DLL and .so) : name versioning used to prevent clashes between STLport versions + + * src/ : code regrouped between .cpp files to provide for less executable size with dumb linkers; + + * locale subsystem initialization : startup changed to use statically allocated structures as much as possible; + + * : basic stuff moved to _function_base.h ; + other STL headers now include _function_base.h instead + + * _threads.h : MT support for OS/2 added (only tested with VAC++) + + * _stdio_file.h : added support for Solaris in ELF64 mode (thanks to Holger Stasch) + + * stl/_hashtable.h : [] operator for hash_map optimized to take no more than find() when element is present + (Thanks to Thomas Witt et al.) + + * _ostream.h : fix for default unsigned char (thanks to Holger Stasch) + + * all __STL_ABBREVS abbreviations moved aside in _abbrevs.h header. + + * Fujitsu C++ Compiler support added (thanks to Holger Stasch) + + * Initial SGI iostreams port to OS/390 introduced (thanks to Holger Stasch). + + * More on SGI iostreams port to xlC 5.0 (thanks to Holger Stasch). + + * Fixes for SGI MIPSpro compilers (Thanks to Ralph) + + * Fixes for HP aCC compiler (Thanks to Michael Tsirkin) + + * stlport/SC5 directory : removed C library .h files to fix circular inclusion problem with WS6.0 + C programs. + + * hash_map::swap() in debug mode fixed (thanks to Anton) + + * __STL_COMPILE_INSTANTIATE hack for DEC removed (thanks to Ralph) + + * __STL_INLINE_STRING_LITERAL_BUG defined for HP aCC ( thanks to Jason Taylor) + + * _bitset.h - member workaround operators made const (thanks to dzwick) + + * _bitset.h/.c, hashtable.h -- small bugfixes (thanks to Levente Farkas) + + * - now includes exception.h if only that is available. + + * vector::assign() inplemented for vector::iterator when member templates are not available (Thanks to dzwick) + + * fstream.cpp : __pioinfo used for MinGW32 (thanks to Danny Smith) + +The following changes were made in 4.1 beta 3 since 4.1 beta 2 : + + * list<>::clear() : protected access bug fixed + + * __STL_MUTEX_INITIALIZER set back to PTHREAD_MUTEX_INITIALIZER for pthreads case, + as some platforms (eg AIX) do not treat zero-initialized mutex as valid one (thanks to Alex Vanic, Jack Andrews for help) + + * stl/_limits.c : fixed typo preventing numeric limits constants to be defined for __STL_LITTLE_ENDIAN, + constants initialization fixed (thanks to Ingo Donasch) + + * real implementation of locales for Win32 contributed by Anton Lapach (thanks !) merged in. + + * stl_user_config.h, _config.h : changed default to not define relops:: operators + in __STL_NO_NAMESPACES mode. + + * _numeric_facets.c/num_put.cpp : printing of integer do not use sprintf() anymore + + * "install" target implemented for UNIX & VC++ Makefiles. It now installs headers and libraries. + + * "src" : files merged to get less compilation time and less space overhead for imperfect compilers + + * "debug" flavour of STLport excluded from default build and auto-select ; + please use __STL_USE_DEBUG_LIB and build debug STLport lib explicitly with "make debug_dynamic" + if you really need it). "all" now builds 2 kinds : "release" and "STLdebug", for static and dynamic builds. + + * stlport_prefix.h : WIN32_LEAN_AND_MEAN set for Win32 build of STLport library, for speed. + + * FreeBSD compile fixed; makefiles added. + + * All "__init" changed to "_Init" to fix clashes with DEC conventions (thanks to Holger Stasch) + + * _range_errors.h -- fixed to always set __STL_EXTERN_RANGE_ERRORS for SGI iostreams (thanks to Serge Pashkov) + + * *gcc* mak : some files renamed to gcc-platform mak + + * "extern template" extension used for gcc & standard i/o classes, to reduce code bloat in application's .o + + * "extern template" extension used for VC++ & standard i/o classes (was for DLL only) + + * _iterator.h : added template(and non-template) assignment operator for reverse_iterator<> (thanks to psw). Obsolete HP-style code moved to _iterator_old.h + + * _alloc.h : obsolete code for raw SGI allocators support moved to separate header, for compile-time improvement + + * More iostreams code conditionally moved out for clients who only use standard i/o and can set __STL_NO_CUSTOM_IO flag + + * , : initialization of locale subsystem made independent of standard streams. + sync_with_stdio call before iostream initialization now works. + + * , : added initialization code for locale , same as in + (thanks to George Trojan for the report) + + * fstream.cpp : fixed resource leak in case memory map fails on Win32 (thanks to Mark Laffoon) + + * , : added additonal overload signatures required by chapter 26.5 of ANSI (thanks to Levente Farkas for + the suggestion), plus "long long" flavour where applicable. + + * __STL_LONG_LONG generalized to support __int64 on Win32 (thanks to Adam Gates for the suggestion) + + * _fstream.h : added constructor from file descriptor, as extension (thanks to eric_a_benson) + + * _fstream.h : added basic_filebuf<>::fd() file descriptor accessor, as extension (thanks to George Trojan) + + * stl_sunpro.h : strstream masked for CC 4.2 to avoid virtual table clash (thanks to Ken) + + * stl_msvc.h : member templates allowed for VC5, it's capable of hadling most of them (same restrictions as VC6 -- inline). + + * debug/_debug.c : slightly changed format of debug message to please VC++ IDE (thanks for Bruce Dawson for the suggestion) + + * src/sgi_mipspro.mak added, for SGI MIPSPro compilation + + * merged series of HP/SUN minor fixes by Petr Ovtchenkov + + * merged series of Intel 4.5 fixes by Serge + + * vc_common.mak : -Yd dropped, as obsolete (thanks to psw) + + * _range_errors.h:95 : unused argument removed (thanks to George Trojan) + + * _string_io.h : refined _WRTLING workaround for Watcom (thanks to Serge Pashkov) + + * _threads.h : fixed SGI threads dafines for gcc on IRIX (thanks to Brett Denner for the report) + + * , : mutually-exclusive machanism added to allow including both in same unit. + + * Inclusion of SGI iostreams headers put to some order; _streambuf_iterator.h file introduced to resolve circular dependancies + +The following changes were made in 4.1 beta 2 since 4.1 beta 1 : + + * _algobase.h : fixed __STL_DECLARE_COPY_TRIVIAL definition + (thanks to Charles Burfoot for the report) + + * _algobase.h : added copy_backward specializations for builtin types for compilers w/o partial spec. + + * _char_traits.h : fixed zero-length check for copy (thanks to Michael Tsirkin) + + * msvc_warnings_off.h : fixed "and" typo + (thanks to Charles Burfoot for the report) + + * num_put_float.cpp : fixed rounding for "g" format (thanks to Bernd Mohr for the report) + + * Initial port of iostreams to xlC 5.0 added (thanks to Jack Andrews) + + * stl_sunpro.h : a fix for Forte config (Thanks to Alex Vanic for the report) + + * old_hp/iterator.h : fixed iterator_category()/etc. import + + * _threads.h : __stl_atomic_t used instead of "unsigned long" (thanks to Alex Vanic for the report) + * using/iomanip : old-streams path used for native iomanip.h (thanks to Michael Tsirkin for the report). + + * _bitset.h , _bitset.c : direct STL_THROW replaced with __stl_throw_xxx calls (thanks to Michael Tsirkin for the report) + + * range_errors.h/cpp : added functions to support throwing of overflow_error and invalid_argument + + * _threads.h : enganced HP-specific guards for HP-UX 11 (thanks to Matthew Collins for the report) + + * _string.h : compare() bugfix (thanks to Anton Sergeev) + + * moneypunct_byname_w.cpp : rolled back wrong bugfix (thanks to Ken) + + * _vector.h, _deque.h, _list.h : nonstandard versions of push_back()/push_front() + moved under __STL_NO_ANACHRONISMS guard (thanks to Ed Brey) + + * _tree.c, _list.c, _slist.c, _debug.c : compile-time improvements + + * _tree.h/c, _list.h/c, _slist.h/c, _vector.h/c, _string.h/c : using directive for data members + changed to explicit "this->". + + * _complex.h : signatures of some methods changed to take value_type instead of const value_type&, + for better conformance (thanks to Petr Ovtchenkov) + + * Bunch of fixes to compile with gcc on HP-UX 10, 11 (thanks to Petr Ovtchenkov) + + * Code duplication for __STL_INLINE_MEMBER_TEMPLATES removed -- corresponding methods are always inlined + + * stl_sunpro.h : fix for "-compat" mode (thanks to Vijay Ramachandran) + + * pthread.h : new wrapper added + + * Added custom prolog/epilog for HP aCC to select kthreads on HP-UX 11 (Thanks to Michael Tsirkin) + + * : fixed throw specification for bad_alloc (has to be inherited) + + * Macro __STL_NATIVE_CPP_RUNTIME_INCLUDE_PATH introduced to specify separate path for , , . + (thanks to Bryan Byrnes) + + * : moved from stlport/stl to stlport directory, for SGI compatibility + +The following changes were made in 4.1 beta 1 since 4.0 : + + * Sun Forte 6.0 C++ configuration provided (thanks to Alexander Vanic for the input) + + * _threads.h/_config.h : added efficient support for atomic operations for + DEC CXX and Watcom (thanks to Ricardo Gayoso for the input). + Macros __STL_ATOMIC_xxx introduced to facilitate this. + + * _tree.h : optimizations to lower number of comparisons (thanks to Craig Powers for the patch) + + * _tree.h, _hashtable.h and clients : added templated find() as an extension (thanks to Michael Tsirkin for the suggestion) + + * _tree.h : changed some inlining for performance optimization + + * __node_alloc:: allocate broken into two functions for better inlining + + * _threads.h : added PTHREAD_MUTEX_INITIALIZER guard for HP workaround + + * stl_bc.h : option set to control alignment and virtual table behaviour to be consistent; + library name adjusted to stlport_bcc55_xxx + + * _algobase.h, _uninitialized.h, char_traits.h -- optimized out empty memcpy() calls + (thanks to Michael Tsirkin for the report). + + * _iterator.h : fixed reverse_iterator::operator+(int, reverse_iterator) resolution + (thanks to Anton Sergeev for the input) + + * _bitset.h : bitset<>::test bugfix (thanks to Anton Sergeev for the patch) + + * complex_trig.cpp : use of __STL_NO_LONG_DOUBLE made consistent, fixes for Borland on Linux + (thanks to John Wiegley for the input) + + * moneypunct_byname_w.cpp : bugfixes for string copying (thanks to Anton Sergeev for the input) + + * Watcom-specific fixes (thanks to Ricardo Gayoso for the input) + + * src/common_macros.mak : some intermediate targets added (thanks to Jeremy for the suggestion) + + * _debug.c : fixes for Win CE (thanks to John Hynes for the patch) + + * Intel CC 4.0-specific fixes (thanks to Sean Cavanaugh for the input) + + * _list.c : workaround for Watcom C++ (thanks to Mike Steed for the report) + + * __STL_NO_NATIVE_WIDE_STREAMS definition fixed (thanks to Glen Summers for the patch) + + * cast macros fixed to be more robust (thanks to Geoff Oakham for the report) + + * "strstream.h" native inclusion for VC 6.0 fixed (thanks to Sathish T C for the report) + + * debug/_string.h : improvement to string with __STL_DEBUG w/o member templates + (thanks to Paul Furnanz for the report) + + * debug/_string.h : fixed internal compiler error for VC++ 5.x (thanks to chvetsov for the report) + + * cstdio, stl/_streambuf.h : fixes to allow gcc compilation with -ansi flag + + * workaround for cin/cout renaming on HPUX11 for -D_REENTRANT (thankf to Jeff Sparkes for the report) + + * cin/cout/cerr/clog renaming in STLport for CC 4.0 and SGI iostreams, + to avoid symbol clashes with native ones (thanks to Dirk Schreib for the report) + + * type_info scope fixes for VC++ 6.0 (thanks to Sathish T C for the report) + + * typeinfo.h using fixes (thanks to Glen Summers for the input) + + * stlcomp.h : fixes to allow compilation of .c modules with VAC++, Sun CC, DEC CC, Watcom CC + (thanks to Dmitry A.Steklenev, Jonathan Richardson for the report) + + * debug/_tree.h : fixed insert_unique() bug (thanks to Ben Liblit for the report) + + * regression/gcc.mak made non-dependant on "." in the path + (thanks to Thomas Matelich for the report) + + * hmset1.cpp fixed to compile under OS390 ( thanks to Andrey Khovanskiy for the report) + diff --git a/reactos/lib/3rdparty/stlport/etc/ReleaseNote.txt b/reactos/lib/3rdparty/stlport/etc/ReleaseNote.txt new file mode 100644 index 00000000000..4840db0ec7a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/ReleaseNote.txt @@ -0,0 +1,138 @@ +5.2: + +- Major modifications: + + * Use of #include_next to access native platform/compiler headers when the + preprocessor support it. Enhance STLport portability as native header path do + not have to be adapted each time the header structure is modified. + + * Yet a modification of the include schema in all C++ Standard headers. Now + _STLP_WHOLE_NATIVE_STD mode works as expected, used in conjonction with + _STLP_DONT_REDEFINE_STD it is possible to use STLport in stlport namespace at + the same time as using native library in std namespace. + + * Use of the gcc visibility feature for gcc versions after 4.0. + + * For builds under Windows, STLport now adapt to the PSDK used to build it. It + should be the same as the one used when building an application using the + STLport libs. A compatibility detection mecanism has been implemented in order + to report not homogeneous build environment with a link error rather than undefined + runtime error. + +- Enhancements: + + * Use of malloc based allocator on system having GlibC 2.3 and later, keep + node allocator for others. + + * Delay instanciation of type traits type in vector and deque implementation to + be able to use some of the nested types like iterator even if type used to + instanciate the container is not completely defined. + + * Container pointer specialization feature now works even with incomplete types + thanks to use of partial template specialization. + +5.1: + +- Major modifications + + * Folder architecture: All configuration files are now in stlport/stl/config folder. + stlport/stl_user_config.h renamed and moved as stlport/stl/config/user_config.h. + stlport/stl/_site_config.h renamed and moved as stlport/stl/config/hosts.h. + STLport configuration now also try to seperate platform configuration from compiler + one. + + * Allocators implementation is in src folder to enhance encapsulation. Default + allocator when using STLport without building it (_STLP_NO_IOSTREAMS) is the simple + new/delete based allocator, node allocator is the default when building the lib. + + * Access to native headers has been modified to make STLport less dependant on + native headers internal includes, should improve portability. + + * Segregation of headers has been improved. You might have to add now missing + functional or algorithm Standard headers include in your code. + +- Enhancements + + * Support enhancements: + - Borland compilers starting with the free one (5.5.1) + - HP aC++/ANSI C B3910B A.06.06 + - Visual Studio 2005 for Windows CE + - Use of intrinsic type traits support of Visual Studio 2005 + + * Improved meta programming techniques especially in uninitialized_* algorithms. + If you need a vector of null pointer prefer to write 'vector v(10)' rather + than 'vector v(10, (void*)0)'. + + * Fully functional pointer specialization feature (_STLP_USE_PTR_SPECIALIZATIONS). + + * Extension of template search methods in associative and hashed container has + been completed. + + * STL safe mode: Now detect badly implemented strict weak ordering functors, assert + if a < b && b < a. Same for equivalent functor used in hash container implementation, + assert if a <=> b but !(b <=> a). + + * Improved locale creation delay on Windows platform. + + * STL containers implementation now correctly handle allocators with state. This kind + of allocator has to overload swap method if any specific action has to be made when + swaping 2 instances. + + * STLport is ready for safe string functions *_s (_STLP_USE_SAFE_STRING_FUNCTIONS) + + * Many bug fixes, see etc/ChangeLog-5.1. + +5.0: + +- Major modifications + + * No more wrapper mode: you can use STLport iostreams or no iostreams + at all. + + * _STLP_NO_CUSTOM_IO now also hide basic_string implementation + + * internal namespace schema has been modified, see doc folder for additionnal + informations. + +- Enhancements + + * Support of many modern C++ compilers and platforms + - gcc 3.4.0 and later + - MSVC .Net 2002, 2003 and MSVC 2005 Beta + - Windows CE + see build/test/unit/STATUS for a complete list of tested platforms/compilers + + * Move semantic: vector or deque of any other STL containers are using + move semantic when resized or modified rather than copy. + + * New checks in safe STL mode like null pointer or check of iterator range + pass to container constructors. + + * Expression template for string concatenation operations (available + throught the _STLP_USE_TEMPLATE_EXPRESSION config option) + + * Implementation of the short string optimization trick, basic_string have + a small static buffer in this case. + + * STL containers vector, deque, list and slist pointer specialization to + limit code bloats (see _STLP_USE_PTR_SPECIALIZATIONS on config file) + + * Use of boost type_traits rather than internal equivalent when requested + (see _STLP_USE_BOOST_SUPPORT in config file) + + * set/multiset, or map/multimap iterators cannot be compared anymore. + + * unordered_set, unordered_multiset, unordered_map, unordered_multimap hash + containers implementation specified in the TR1 document. + + * Thanks to the _STLP_LEAKS_PEDANTIC config option you can ask STLport to + clean its memory pool before being unloaded, useful to only detect real + memory leak problems. + + * Creation of configuration scripts to make STLport configuration easier. + + * Improvment of some algorithm like search_n or stable_sort. + + * Ported to 64 bits platforms. + + * Large file ( > 4 Go) stream support on Win32 platform. diff --git a/reactos/lib/3rdparty/stlport/etc/STLport-4.5.1.spec b/reactos/lib/3rdparty/stlport/etc/STLport-4.5.1.spec new file mode 100644 index 00000000000..17607f5fa38 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/STLport-4.5.1.spec @@ -0,0 +1,96 @@ +%define MAKEFILE gcc-linux.mak + +Summary: Complete C++ standard library +Name: STLport +Version: 4.5.1 +Release: 1 +Copyright: free (see license), see /usr/share/doc/%{name}-%{version}/license.html +URL: http://www.stlport.org/ +Packager: Levente Farkas +Group: System Environment/Languages +Icon: stlport_powered_white.gif +Source0: http://www.stlport.org/archive/%{name}-%{version}.tar.gz +Patch0: STLport-rename.patch +#Patch1: STLport-rules.patch +#Patch2: STLport-install-dir.patch +Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) + +%description +STLport is a multiplatform STL implementation based on SGI STL. +This package contains the runtime library for STLport. + +%package -n STLport-devel +Summary: Complete C++ standard library header files and libraries +Group: Development/Libraries +Requires: STLport = %{version} + +%description -n STLport-devel +STLport is a multiplatform STL implementation based on SGI STL. Complete +C++ standard library, including and SGI STL iostreams. If you +would like to use your code with STLport add +"-nostdinc++ -I/usr/include/stlport" when compile and -lstlport_gcc when +link (eg: gcc -nostdinc++ -I/usr/include/stlport x.cc -lstlport_gcc). + +%prep +%setup +%patch0 -p1 +#%patch1 -p1 +#%patch2 -p1 + +%build +cd src +make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr clean all + +%install +rm -rf $RPM_BUILD_ROOT +cd src +make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr install +cd $RPM_BUILD_ROOT/usr/include/stlport +ln -s . ext + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%post -n STLport-devel +/sbin/ldconfig + +%postun -n STLport-devel +/sbin/ldconfig + +%files +%defattr(-,root,root) +%doc doc/license.html +/usr/lib/libstlport_gcc.so +#/usr/lib/libstlport_gcc.so.%{version} +/usr/lib/libstlport_gcc.so.4.5 + +%files -n STLport-devel +%defattr(-,root,root) +%doc INSTALL README doc etc test +/usr/lib/libstlport_gcc*.a +/usr/lib/libstlport_gcc_*debug.so* +/usr/include/* + +%changelog +* Mon Dec 10 2001 Levente Farkas +- upgrade to 4.5.1 + +* Fri Nov 16 2001 Levente Farkas +- merge with Harold's changes + +* Thu Nov 15 2001 +- rebuild for RedHat 7.2, spec file fixes. + +* Tue Oct 2 2001 Levente Farkas +- upgrade to 4.5 + +* Thu Oct 26 2000 Levente Farkas +- upgrade to 4.1-b3 + +* Thu Jul 17 2000 Levente Farkas +- initial release use STLport-4.0 + diff --git a/reactos/lib/3rdparty/stlport/etc/STLport-4.5.3.spec b/reactos/lib/3rdparty/stlport/etc/STLport-4.5.3.spec new file mode 100644 index 00000000000..92e8cb7c096 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/STLport-4.5.3.spec @@ -0,0 +1,96 @@ +%define MAKEFILE gcc-linux.mak + +Summary: Complete C++ standard library +Name: STLport +Version: 4.5.3 +Release: 1 +Copyright: free (see license), see /usr/share/doc/%{name}-%{version}/license.html +URL: http://www.stlport.org/ +Packager: Levente Farkas +Group: System Environment/Languages +Icon: stlport_powered_white.gif +Source0: http://www.stlport.org/archive/%{name}-%{version}.tar.gz +#Patch0: STLport-rename.patch +#Patch1: STLport-rules.patch +#Patch2: STLport-install-dir.patch +Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) + +%description +STLport is a multiplatform STL implementation based on SGI STL. +This package contains the runtime library for STLport. + +%package -n STLport-devel +Summary: Complete C++ standard library header files and libraries +Group: Development/Libraries +Requires: STLport = %{version} + +%description -n STLport-devel +STLport is a multiplatform STL implementation based on SGI STL. Complete +C++ standard library, including and SGI STL iostreams. If you +would like to use your code with STLport add +"-nostdinc++ -I/usr/include/stlport" when compile and -lstlport_gcc when +link (eg: gcc -nostdinc++ -I/usr/include/stlport x.cc -lstlport_gcc). + +%prep +%setup +%patch0 -p1 +#%patch1 -p1 +#%patch2 -p1 + +%build +cd src +make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr clean all + +%install +rm -rf $RPM_BUILD_ROOT +cd src +make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr install +cd $RPM_BUILD_ROOT/usr/include/stlport +ln -s . ext + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%post -n STLport-devel +/sbin/ldconfig + +%postun -n STLport-devel +/sbin/ldconfig + +%files +%defattr(-,root,root) +%doc doc/license.html +/usr/lib/libstlport_gcc.so +#/usr/lib/libstlport_gcc.so.%{version} +/usr/lib/libstlport_gcc.so.4.5 + +%files -n STLport-devel +%defattr(-,root,root) +%doc INSTALL README doc etc test +/usr/lib/libstlport_gcc*.a +/usr/lib/libstlport_gcc_*debug.so* +/usr/include/* + +%changelog +* Mon Dec 10 2001 Levente Farkas +- upgrade to 4.5.1 + +* Fri Nov 16 2001 Levente Farkas +- merge with Harold's changes + +* Thu Nov 15 2001 +- rebuild for RedHat 7.2, spec file fixes. + +* Tue Oct 2 2001 Levente Farkas +- upgrade to 4.5 + +* Thu Oct 26 2000 Levente Farkas +- upgrade to 4.1-b3 + +* Thu Jul 17 2000 Levente Farkas +- initial release use STLport-4.0 + diff --git a/reactos/lib/3rdparty/stlport/etc/STLport-4.6.spec b/reactos/lib/3rdparty/stlport/etc/STLport-4.6.spec new file mode 100644 index 00000000000..b37d7821845 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/STLport-4.6.spec @@ -0,0 +1,99 @@ +%define MAKEFILE gcc-linux.mak + +Summary: Complete C++ standard library +Name: STLport +Version: 4.6 +Release: 1 +Copyright: free (see license), see /usr/share/doc/%{name}-%{version}/license.html +URL: http://www.stlport.org/ +Packager: Levente Farkas +Group: System Environment/Languages +Icon: stlport_powered_white.gif +Source0: http://www.stlport.org/archive/%{name}-%{version}.tar.gz +#Patch0: STLport-rename.patch +#Patch1: STLport-rules.patch +#Patch2: STLport-install-dir.patch +Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) + +%description +STLport is a multiplatform STL implementation based on SGI STL. +This package contains the runtime library for STLport. + +%package -n STLport-devel +Summary: Complete C++ standard library header files and libraries +Group: Development/Libraries +Requires: STLport = %{version} + +%description -n STLport-devel +STLport is a multiplatform STL implementation based on SGI STL. Complete +C++ standard library, including and SGI STL iostreams. If you +would like to use your code with STLport add +"-nostdinc++ -I/usr/include/stlport" when compile and -lstlport_gcc when +link (eg: gcc -nostdinc++ -I/usr/include/stlport x.cc -lstlport_gcc). + +%prep +%setup +%patch0 -p1 +#%patch1 -p1 +#%patch2 -p1 + +%build +cd src +make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr clean all + +%install +rm -rf $RPM_BUILD_ROOT +cd src +make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr install +cd $RPM_BUILD_ROOT/usr/include/stlport +ln -s . ext + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%post -n STLport-devel +/sbin/ldconfig + +%postun -n STLport-devel +/sbin/ldconfig + +%files +%defattr(-,root,root) +%doc doc/license.html +/usr/lib/libstlport_gcc.so +#/usr/lib/libstlport_gcc.so.%{version} +/usr/lib/libstlport_gcc.so.4.6 + +%files -n STLport-devel +%defattr(-,root,root) +%doc INSTALL README doc etc test +/usr/lib/libstlport_gcc*.a +/usr/lib/libstlport_gcc_*debug.so* +/usr/include/* + +%changelog +* Fri Oct 31 2003 +- upgrade to 4.6 + +* Mon Dec 10 2001 Levente Farkas +- upgrade to 4.5.1 + +* Fri Nov 16 2001 Levente Farkas +- merge with Harold's changes + +* Thu Nov 15 2001 +- rebuild for RedHat 7.2, spec file fixes. + +* Tue Oct 2 2001 Levente Farkas +- upgrade to 4.5 + +* Thu Oct 26 2000 Levente Farkas +- upgrade to 4.1-b3 + +* Thu Jul 17 2000 Levente Farkas +- initial release use STLport-4.0 + diff --git a/reactos/lib/3rdparty/stlport/etc/autoexp.dat b/reactos/lib/3rdparty/stlport/etc/autoexp.dat new file mode 100644 index 00000000000..c2efe6fc450 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/autoexp.dat @@ -0,0 +1,835 @@ +;------------------------------------------------------------------------------ +; This is the description of STLport data structures in Visual Studio debugger +; language. Those descriptions has been tested with Visual C++ 2005 Express +; Edition, you are welcome to report successful usage with any other Visual +; Studio version. +; Those descriptions has been tested with STLport 5.2.0. +; How to use: Copy/Paste this file content in the autoexp.dat file you will find +; in your Visual Studio install, for instance +; C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger, in the +; [Visualizer] section. +; TODO: Enhance debug iterator visualization to report end iterators. +; TODO: Add visualization for rope. +; TODO: Fix bitset visualization. +;------------------------------------------------------------------------------ +;------------------------------------------------------------------------------ +; stlport::basic_string +;------------------------------------------------------------------------------ +stlp_std::basic_string|stlpx_std::basic_string|stlpmtx_std::basic_string|stlpxmtx_std::basic_string|stlpd_std::priv::_NonDbg_str|stlpdx_std::priv::_NonDbg_str|stlpdmtx_std::priv::_NonDbg_str|stlpdxmtx_std::priv::_NonDbg_str{ + preview + ( + [$c._M_start_of_storage._M_data, s] + ) + + stringview + ( + [$c._M_start_of_storage._M_data, s] + ) + + children + ( + #( + [raw view]: [$c,!], + buffer: [(unsigned int)$c._M_start_of_storage._M_data, x], + length: $c._M_finish - $c._M_start_of_storage._M_data, + capacity: #if($c._M_start_of_storage._M_data == $c._M_buffers._M_static_buf) + ( + $c._DEFAULT_SIZE + ) + #else + ( + $c._M_buffers._M_end_of_storage - $c._M_start_of_storage._M_data + ), + #array + ( + expr: $c._M_start_of_storage._M_data[$i], + size: $c._M_finish - $c._M_start_of_storage._M_data + ) + ) + ) +} + +stlp_std::basic_string|stlp_std::basic_string|stlpx_std::basic_string|stlpx_std::basic_string|stlpmtx_std::basic_string|stlpmtx_std::basic_string|stlpxmtx_std::basic_string|stlpxmtx_std::basic_string|stlpd_std::priv::_NonDbg_str|stlpd_std::priv::_NonDbg_str|stlpdx_std::priv::_NonDbg_str|stlpdx_std::priv::_NonDbg_str|stlpdmtx_std::priv::_NonDbg_str|stlpdmtx_std::priv::_NonDbg_str|stlpdxmtx_std::priv::_NonDbg_str|stlpdxmtx_std::priv::_NonDbg_str{ + preview + ( + [$c._M_start_of_storage._M_data, su] + ) + + stringview + ( + [$c._M_start_of_storage._M_data, su] + ) + + children + ( + #( + [raw view]: [$c,!], + buffer: [(unsigned int)$c._M_start_of_storage._M_data, x], + length: $c._M_finish - $c._M_start_of_storage._M_data, + capacity: #if($c._M_start_of_storage._M_data == $c._M_buffers._M_static_buf) + ( + $c._DEFAULT_SIZE + ) + #else + ( + $c._M_buffers._M_end_of_storage - $c._M_start_of_storage._M_data + ), + #array + ( + expr: $c._M_start_of_storage._M_data[$i], + size: $c._M_finish - $c._M_start_of_storage._M_data + ) + ) + ) +} + +stlpd_std::basic_string<*>|stlpdx_std::basic_string<*>|stlpdmtx_std::basic_string<*>|stlpdxmtx_std::basic_string<*>{ + preview + ( + $c._M_non_dbg_impl + ) + + stringview + ( + $c._M_non_dbg_impl + ) + + children + ( + #( + [raw view]: [$c,!], + string: $c._M_non_dbg_impl + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::vector +;------------------------------------------------------------------------------ +stlp_std::vector|stlpx_std::vector|stlpmtx_std::vector|stlpxmtx_std::vector|stlpd_std::priv::_NonDbg_vector|stlpdx_std::priv::_NonDbg_vector|stlpdmtx_std::priv::_NonDbg_vector|stlpdxmtx_std::priv::_NonDbg_vector{ + preview + ( + #( + "[", + ($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset, + "](", + #array + ( + expr : ($c._M_start._M_p[$i / (sizeof(unsigned int) * 8)] >> ($i % (sizeof(unsigned int) * 8))), + size : (($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset) + ) : (bool)($e & 1), + ")" + ) + ) + children + ( + #( + [raw view]: [$c,!], + buffer : [(unsigned int)$c._M_start._M_p, x], + size : (($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset), + #array + ( + expr : ($c._M_start._M_p[$i / (sizeof(unsigned int) * 8)] >> ($i % (sizeof(unsigned int) * 8))), + size : (($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset) + ) : (bool)($e & 1) + ) + ) +} + +stlp_std::priv::_Bit_iter<*>|stlpx_std::priv::_Bit_iter<*>|stlpmtx_std::priv::_Bit_iter<*>|stlpxmtx_std::priv::_Bit_iter<*>|stlpd_std::priv::_Bit_iter<*>|stlpdx_std::priv::_Bit_iter<*>|stlpdmtx_std::priv::::_Bit_iter<*>|stlpdxmtx_std::priv::_Bit_iter<*>{ + preview + ( + #( + (bool) (((*$c._M_p) >> $c._M_offset) & 1) + ) + ) + children + ( + #( + [raw view]: [$c,!], + value : (bool) (((*$c._M_p) >> $c._M_offset) & 1) + ) + ) +} + +stlp_std::vector<*>|stlpx_std::vector<*>|stlpmtx_std::vector<*>|stlpxmtx_std::vector<*>|stlpd_std::priv::_NonDbg_vector<*>|stlpdx_std::priv::_NonDbg_vector<*>|stlpdmtx_std::priv::_NonDbg_vector<*>|stlpdxmtx_std::priv::_NonDbg_vector<*>{ + preview + ( + #( + "[", + $c._M_finish - $c._M_start, + "/", + $c._M_end_of_storage._M_data - $c._M_start, + "](", + #array + ( + expr : ($c._M_start)[$i], + size : $c._M_finish - $c._M_start + ), + ")" + ) + ) + children + ( + #( + [raw view]: [$c,!], + size : $c._M_finish - $c._M_start, + capacity : $c._M_end_of_storage._M_data - $c._M_start, + #array + ( + expr : ($c._M_start)[$i], + size : $c._M_finish - $c._M_start + ) + ) + ) +} + +stlpd_std::vector<*>|stlpdx_std::vector<*>|stlpdmtx_std::vector<*>|stlpdxmtx_std::vector<*>{ + preview + ( + $c._M_non_dbg_impl + ) + children + ( + #( + [raw view] : [$c,!], + vector : $c._M_non_dbg_impl + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::deque +;------------------------------------------------------------------------------ +stlp_std::deque<*,*>|stlpx_std::deque<*,*>|stlpmtx_std::deque<*,*>|stlpxmtx_std::deque<*,*>|stlpd_std::priv::_NonDbg_deque<*,*>|stlpdx_std::priv::_NonDbg_deque<*,*>|stlpdmtx_std::priv::_NonDbg_deque<*,*>|stlpdxmtx_std::priv::_NonDbg_deque<*,*>{ + preview + ( + #if (((unsigned int)($c._M_start._M_cur + 1) - ((unsigned int)$c._M_start._M_cur)) < _MAX_BYTES) + ( + #( + "[", + (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur), + "/", + ($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1)) - 1, + "](", + #array + ( + expr : *(*($c._M_start._M_node + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) / (_MAX_BYTES / sizeof($T1)))) + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) % (_MAX_BYTES / sizeof($T1)))), + size : (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur) + ), + ")" + ) + ) + #else + ( + #( + "[", + $c._M_finish._M_node - $c._M_start._M_node, + "/", + $c._M_finish._M_node - $c._M_start._M_node, + "](", + #array + ( + expr : **($c._M_start._M_node + $i), + size : $c._M_finish._M_node - $c._M_start._M_node + ), + ")" + ) + ) + ) + children + ( + #if (((unsigned int)($c._M_start._M_cur + 1) - ((unsigned int)$c._M_start._M_cur)) < _MAX_BYTES) + ( + #( + [raw view]: [$c,!], + size : (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur), + capacity : ($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1)) - 1, + front free space : $c._M_start._M_cur - $c._M_start._M_first, + back free space : $c._M_finish._M_last - $c._M_finish._M_cur - 1, + #array + ( + expr : *(*($c._M_start._M_node + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) / (_MAX_BYTES / sizeof($T1)))) + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) % (_MAX_BYTES / sizeof($T1)))), + size : (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur) + ) + ) + ) + #else + ( + #( + [raw view] : [$c,!], + size : $c._M_finish._M_node - $c._M_start._M_node, + capacity : $c._M_finish._M_node - $c._M_start._M_node, + front free space : $c._M_start._M_cur - $c._M_start._M_first, + back free space : $c._M_finish._M_last - $c._M_finish._M_cur - 1, + #array + ( + expr : **($c._M_start._M_node + $i), + size : $c._M_finish._M_node - $c._M_start._M_node + ) + ) + ) + ) +} + +stlp_std::priv::_Deque_iterator<*>|stlpx_std::priv::_Deque_iterator<*>|stlpmtx_std::priv::_Deque_iterator<*>|stlpxmtx_std::priv::_Deque_iterator<*>|stlpd_std::priv::_Deque_iterator<*>|stlpdx_std::priv::_Deque_iterator<*>|stlpdmtx_std::priv::_Deque_iterator<*>|stlpdxmtx_std::priv::_Deque_iterator<*>{ + preview + ( + *($c._M_cur) + ) + children + ( + #( + [raw view] : [$c, !], + ptr : [(unsigned int)($c._M_cur), x], + value : *($c._M_cur) + ) + ) +} + +stlpd_std::deque<*>|stlpdx_std::deque<*>|stlpdmtx_std::deque<*>|stlpdxmtx_std::deque<*>{ + preview + ( + $c._M_non_dbg_impl + ) + children + ( + #( + [raw view] : [$c,!], + deque : $c._M_non_dbg_impl + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::list +;------------------------------------------------------------------------------ +stlp_std::list<*,*>|stlpx_std::list<*,*>|stlpmtx_std::list<*,*>|stlpxmtx_std::list<*,*>|stlpd_std::priv::_NonDbg_list<*,*>|stlpdx_std::priv::_NonDbg_list<*,*>|stlpdmtx_std::priv::_NonDbg_list<*,*>|stlpdxmtx_std::priv::_NonDbg_list<*,*>{ + preview + ( + #( + "(", + #list + ( + head : $c._M_node._M_data._M_next, + skip : &($c._M_node._M_data), + next : _M_next, + ): #( *($T1*)(&($e) + 1)), + ")" + ) + ) + children + ( + #( + [raw view]: [$c,!], + #list + ( + head : $c._M_node._M_data._M_next, + skip : &($c._M_node._M_data), + next : _M_next, + ): #( *($T1*)(&($e) + 1)) + ) + ) +} + +stlp_std::priv::_List_iterator<*,*>|stlpx_std::priv::_List_iterator<*,*>|stlpmtx_std::priv::_List_iterator<*,*>|stlpxmtx_std::priv::_List_iterator<*,*>|stlpd_std::priv::_List_iterator<*,*>|stlpdx_std::priv::_List_iterator<*,*>|stlpdmtx_std::priv::_List_iterator<*,*>|stlpdxmtx_std::priv::_List_iterator<*,*>{ + preview + ( + #(*($T1 *)($c._M_node + 1)) + ) + children + ( + #( + [raw view] : [$c, !], + ptr : [(unsigned int)($c._M_node + 1), x], + value : *($T1 *)($c._M_node + 1) + ) + ) +} + +stlpd_std::list<*,*>|stlpdx_std::list<*,*>|stlpdmtx_std::list<*,*>|stlpdxmtx_std::list<*,*>{ + preview + ( + $c._M_non_dbg_impl + ) + children + ( + #( + [raw view] : [$c,!], + list : $c._M_non_dbg_impl + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::slist +;------------------------------------------------------------------------------ +stlp_std::slist<*,*>|stlpx_std::slist<*,*>|stlpmtx_std::slist<*,*>|stlpxmtx_std::slist<*,*>|stlpd_std::priv::_NonDbg_slist<*,*>|stlpdx_std::priv::_NonDbg_slist<*,*>|stlpdmtx_std::priv::_NonDbg_slist<*,*>|stlpdxmtx_std::priv::_NonDbg_slist<*,*>{ + preview + ( + #( + "(", + #list + ( + head : $c._M_head._M_data._M_next, + skip : &($c._M_head._M_data), + next : _M_next, + ): #( *($T1*)(&($e) + 1)), + ")" + ) + ) + children + ( + #( + [raw view]: [$c,!], + #list + ( + head : $c._M_head._M_data._M_next, + skip : &($c._M_head._M_data), + next : _M_next, + ): #( *($T1*)(&($e) + 1)) + ) + ) +} + +stlp_std::priv::_Slist_iterator<*,*>|stlpx_std::priv::_Slist_iterator<*,*>|stlpmtx_std::priv::_Slist_iterator<*,*>|stlpxmtx_std::priv::_Slist_iterator<*,*>|stlpd_std::priv::_Slist_iterator<*,*>|stlpdx_std::priv::_Slist_iterator<*,*>|stlpdmtx_std::priv::_Slist_iterator<*,*>|stlpdxmtx_std::priv::_Slist_iterator<*,*>{ + preview + ( + #(*($T1 *)($c._M_node + 1)) + ) + children + ( + #( + [raw view] : [$c,!], + ptr : [(unsigned int)($c._M_node + 1), x], + value : *($T1 *)($c._M_node + 1) + ) + ) +} + +stlpd_std::slist<*,*>|stlpdx_std::slist<*,*>|stlpdmtx_std::slist<*,*>|stlpdxmtx_std::slist<*,*>{ + preview + ( + $c._M_non_dbg_impl + ) + children + ( + #( + [raw view] : [$c,!], + [slist] : $c._M_non_dbg_impl + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::pair +;------------------------------------------------------------------------------ +stlp_std::pair<*,*>|stlpx_std::pair<*,*>|stlpmtx_std::pair<*,*>|stlpxmtx_std::pair<*,*>|stlpd_std::pair<*,*>|stlpdx_std::pair<*,*>|stlpdmtx_std::pair<*,*>|stlpdxmtx_std::pair<*,*>{ + preview + ( + #( + "(", + $c.first, + ", ", + $c.second, + ")" + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::map, stlport::multimap, stlport::set, stlport::multiset +;------------------------------------------------------------------------------ +stlp_std::map<*>|stlpx_std::map<*>|stlpmtx_std::map<*>|stlpxmtx_std::map<*>|stlp_std::multimap<*>|stlpx_std::multimap<*>|stlpmtx_std::multimap<*>|stlpxmtx_std::multimap<*>|stlp_std::set<*>|stlpx_std::set<*>|stlpmtx_std::set<*>|stlpxmtx_std::set<*>|stlp_std::multiset<*>|stlpx_std::multiset<*>|stlpmtx_std::multiset<*>|stlpxmtx_std::multiset<*>{ + preview + ( + #( + "[", + $c._M_t._M_node_count, + "](", + $c._M_t, + ")" + ) + ) + children + ( + #( + [raw view]: [$c,!], + size: [$c._M_t._M_node_count], + tree: $c._M_t + ) + ) +} + +stlpd_std::map<*>|stlpdx_std::map<*>|stlpdmtx_std::map<*>|stlpdxmtx_std::map<*>|stlpd_std::multimap<*>|stlpdx_std::multimap<*>|stlpdmtx_std::multimap<*>|stlpdxmtx_std::multimap<*>|stlpd_std::set<*>|stlpdx_std::set<*>|stlpdmtx_std::set<*>|stlpdxmtx_std::set<*>|stlpd_std::multiset<*>|stlpdx_std::multiset<*>|stlpdmtx_std::multiset<*>|stlpdxmtx_std::multiset<*>{ + preview + ( + #( + "[", + $c._M_t._M_non_dbg_impl._M_node_count, + "](", + $c._M_t._M_non_dbg_impl, + ")" + ) + ) + children + ( + #( + [raw view]: [$c,!], + size: $c._M_t._M_non_dbg_impl._M_node_count, + tree: $c._M_t._M_non_dbg_impl + ) + ) +} + +stlp_std::priv::_Rb_tree<*,*,*,*,*>|stlpx_std::priv::_Rb_tree<*,*,*,*,*>|stlpmtx_std::priv::_Rb_tree<*,*,*,*,*>|stlpxmtx_std::priv::_Rb_tree<*,*,*,*,*>|stlpd_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>|stlpdx_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>|stlpdmtx_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>|stlpdxmtx_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>{ + preview + ( + #tree + ( + head : $c._M_header._M_data._M_parent, + skip : &($c._M_header._M_data), + size : $c._M_node_count, + left : _M_left, + right : _M_right + ): #(*($T3 *)(&($e) + 1)) + ) + children + ( + #( + [raw view]: [$c,!], + #tree + ( + head : $c._M_header._M_data._M_parent, + skip : &($c._M_header._M_data), + size : $c._M_node_count, + left : _M_left, + right : _M_right + ) : #(*($T3 *)(&($e) + 1)) + ) + ) +} + +stlp_std::priv::_Rb_tree_iterator<*,*>|stlpx_std::priv::_Rb_tree_iterator<*,*>|stlpmtx_std::priv::_Rb_tree_iterator<*,*>|stlpxmtx_std::priv::_Rb_tree_iterator<*,*>|stlpd_std::priv::_Rb_tree_iterator<*,*>|stlpdx_std::priv::_Rb_tree_iterator<*,*>|stlpdmtx_std::priv::_Rb_tree_iterator<*,*>|stlpdxmtx_std::priv::_Rb_tree_iterator<*,*>{ + preview + ( + [*($T1*)($c._M_node + 1)] + ) + children + ( + #( + [raw view]: [$c,!], + value: [*($T1*)($c._M_node + 1)], + ptr: [(unsigned int)($c._M_node + 1), x] + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::hash_map, stlport::hash_multimap, stlport::hash_set, stlport::hash_multiset +; stlport::unordered_map, stlport::unordered_multimap, stlport::unordered_set, stlport::unordered_multiset +;------------------------------------------------------------------------------ +stlp_std::hash_map<*>|stlpx_std::hash_map<*>|stlpmtx_std::hash_map<*>|stlpxmtx_std::hash_map<*>|stlp_std::hash_multimap<*>|stlpx_std::hash_multimap<*>|stlpmtx_std::hash_multimap<*>|stlpxmtx_std::hash_multimap<*>|stlp_std::hash_set<*>|stlpx_std::hash_set<*>|stlpmtx_std::hash_set<*>|stlpxmtx_std::hash_set<*>|stlp_std::hash_multiset<*>|stlpx_std::hash_multiset<*>|stlpmtx_std::hash_multiset<*>|stlpxmtx_std::hash_multiset<*>|stlp_std::tr1::unordered_map<*>|stlpx_std::tr1::unordered_map<*>|stlpmtx_std::tr1::unordered_map<*>|stlpxmtx_std::tr1::unordered_map<*>|stlp_std::tr1::unordered_multimap<*>|stlpx_std::tr1::unordered_multimap<*>|stlpmtx_std::tr1::unordered_multimap<*>|stlpxmtx_std::tr1::unordered_multimap<*>|stlp_std::tr1::unordered_set<*>|stlpx_std::tr1::unordered_set<*>|stlpmtx_std::tr1::unordered_set<*>|stlpxmtx_std::tr1::unordered_set<*>|stlp_std::tr1::unordered_multiset<*>|stlpx_std::tr1::unordered_multiset<*>|stlpmtx_std::tr1::unordered_multiset<*>|stlpxmtx_std::tr1::unordered_multiset<*>{ + preview + ( + #( + "[", + $c._M_ht._M_num_elements, + "]", + $c._M_ht + ) + ) + children + ( + #( + [raw view]: [$c,!], + hashtable: $c._M_ht + ) + ) +} + +stlpd_std::hash_map<*>|stlpdx_std::hash_map<*>|stlpdmtx_std::hash_map<*>|stlpdxmtx_std::hash_map<*>|stlpd_std::hash_multimap<*>|stlpdx_std::hash_multimap<*>|stlpdmtx_std::hash_multimap<*>|stlpdxmtx_std::hash_multimap<*>|stlpd_std::hash_set<*>|stlpdx_std::hash_set<*>|stlpdmtx_std::hash_set<*>|stlpdxmtx_std::hash_set<*>|stlpd_std::hash_multiset<*>|stlpdx_std::hash_multiset<*>|stlpdmtx_std::hash_multiset<*>|stlpdxmtx_std::hash_multiset<*>|stlpd_std::tr1::unordered_map<*>|stlpdx_std::tr1::unordered_map<*>|stlpdmtx_std::tr1::unordered_map<*>|stlpdxmtx_std::tr1::unordered_map<*>|stlpd_std::tr1::unordered_multimap<*>|stlpdx_std::tr1::unordered_multimap<*>|stlpdmtx_std::tr1::unordered_multimap<*>|stlpdxmtx_std::tr1::unordered_multimap<*>|stlpd_std::tr1::unordered_set<*>|stlpdx_std::tr1::unordered_set<*>|stlpdmtx_std::tr1::unordered_set<*>|stlpdxmtx_std::tr1::unordered_set<*>|stlpd_std::tr1::unordered_multiset<*>|stlpdx_std::tr1::unordered_multiset<*>|stlpdmtx_std::tr1::unordered_multiset<*>|stlpdxmtx_std::tr1::unordered_multiset<*>{ + preview + ( + #( + "[", + $c._M_ht._M_non_dbg_impl._M_num_elements, + "]", + $c._M_ht._M_non_dbg_impl + ) + ) + children + ( + #( + [raw view]: [$c,!], + hashtable: $c._M_ht._M_non_dbg_impl + ) + ) +} + +stlp_std::hashtable<*,*>|stlpx_std::hashtable<*,*>|stlpmtx_std::hashtable<*,*>|stlpxmtx_std::hashtable<*,*>|stlpd_std::priv::_NonDbg_hashtable<*,*>|stlpdx_std::priv::_NonDbg_hashtable<*,*>|stlpdmtx_std::priv::_NonDbg_hashtable<*,*>|stlpdxmtx_std::priv::_NonDbg_hashtable<*,*>{ + preview + ( + $c._M_elems + ) + children + ( + #( + [raw view]: [$c,!], + size : $c._M_num_elements, + load factor : (float)$c._M_num_elements / ($c._M_buckets._M_finish - $c._M_buckets._M_start), + max load factor: $c._M_max_load_factor, + buckets : $c._M_buckets, + elements : $c._M_elems + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::queue, stlport::priority_queue, stlport::stack +;------------------------------------------------------------------------------ +stlp_std::queue<*>|stlpx_std::queue<*>|stlpmtx_std::queue<*>|stlpxmtx_std::queue<*>|stlpd_std::queue<*>|stlpdx_std::queue<*>|stlpdmtx_std::queue<*>|stlpdxmtx_std::queue<*>|stlp_std::priority_queue<*>|stlpx_std::priority_queue<*>|stlpmtx_std::priority_queue<*>|stlpxmtx_std::priority_queue<*>|stlpd_std::priority_queue<*>|stlpdx_std::priority_queue<*>|stlpdmtx_std::priority_queue<*>|stlpdxmtx_std::priority_queue<*>|stlp_std::stack<*>|stlpx_std::stack<*>|stlpmtx_std::stack<*>|stlpxmtx_std::stack<*>|stlpd_std::stack<*>|stlpdx_std::stack<*>|stlpdmtx_std::stack<*>|stlpdxmtx_std::stack<*>{ + preview + ( + $c.c + ) + children + ( + #( + [raw view] : [$c,!], + container : $c.c + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport debug iterator +;------------------------------------------------------------------------------ +stlp_std::priv::_DBG_iter<*>|stlpx_std::priv::_DBG_iter<*>|stlpmtx_std::priv::_DBG_iter<*>|stlpxmtx_std::priv::_DBG_iter<*>|stlpd_std::priv::_DBG_iter<*>|stlpdx_std::priv::_DBG_iter<*>|stlpdmtx_std::priv::_DBG_iter<*>|stlpdxmtx_std::priv::_DBG_iter<*>{ + preview + ( + #if($c._M_owner != 0) + ( + $c._M_iterator + ) + #else + ( + "undefined" + ) + ) + children + ( + #( + #if($c._M_owner != 0) + ( + #( + [raw view] : [$c,!], + [iterator] : $c._M_iterator, + [valid] : [true] + ) + ) + #else + ( + #( + [raw view] : [$c,!], + [valid] : [false] + ) + ) + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::bitset +; TODO: Fix it, it doesn't work as expected even when adding an enum to the bitset +; class to get access to the bitset static size rather than using $T1. +;------------------------------------------------------------------------------ +stdp_std::bitset<*,*>|stdpx_std::bitset<*,*>|stdpmtx_std::bitset<*,*>|stdpxmtx_std::bitset<*,*>|stdpd_std::bitset<*>|stdpdx_std::bitset<*>|stdpdmtx_std::bitset<*>|stdpdxmtx_std::bitset<*>{ + preview + ( + #( + "[", + $T1, + "](", + #array + ( + expr : ($c._M_w[$i / (sizeof(unsigned long) * 8)] >> ($i % (sizeof(unsigned long) * 8))), + size : $T1 + ) : [($e & 1),d], + ")" + ) + ) + children + ( + #array + ( + expr : ($c._M_w[$i / (sizeof(unsigned long) * 8)] >> ($i % (sizeof(unsigned long) * 8))), + size : $T1 + ) : (bool)($e & 1) + ) +} + +stdp_std::bitset<*>::reference|stdpx_std::bitset<*>::reference|stdpmtx_std::bitset<*>::reference|stdpxmtx_std::bitset<*>::reference|stdpd_std::bitset<*>::reference|stdpdx_std::bitset<*>::reference|stdpdmtx_std::bitset<*>::reference|stdpdxmtx_std::bitset<*>{ + preview + ( + #( + "bitset[", $c._M_bpos, "] = ", + (bool)(*($c._M_wp) >> $c._M_bpos) & 1) + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::auto_ptr +;------------------------------------------------------------------------------ +stlp_std::auto_ptr<*>|stlpx_std::auto_ptr<*>|stlpmtx_std::auto_ptr<*>|stlpxmtx_std::auto_ptr<*>|stlpd_std::auto_ptr<*>|stlpdx_std::auto_ptr<*>|stlpdmtx_std::auto_ptr<*>|stlpdxmtx_std::auto_ptr<*>{ + preview + ( + #if(($c._M_p) != 0) + ( + [*($T1 *)$c._M_p] + ) + #else + ( + "null" + ) + ) + children + ( + #if(($c._M_p) != 0) + ( + #( + [raw view]: [$c,!], + ptr: [(unsigned int)$c._M_p, x], + value: [*($T1 *)$c._M_p] + ) + ) + #else + ( + #( + [raw view]: [$c,!] + ) + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::complex +;------------------------------------------------------------------------------ +stlp_std::complex<*>|stlpx_std::complex<*>|stlpmtx_std::complex<*>|stlpxmtx_std::complex<*>|stlpd_std::complex<*>|stlpdx_std::complex<*>|stlpdmtx_std::complex<*>|stlpdxmtx_std::complex<*>{ + children + ( + #( + real: $e._M_re, + imaginary: $e._M_im + ) + ) + preview + ( + #if($e._M_im != 0) + ( + #if ($e._M_re != 0) + ( ; Real and Imaginary components + #if ($e._M_im >= 0) + ( + #($e._M_re,"+i*", $e._M_im) + ) + #else + ( + #($e._M_re,"-i*", -$e._M_im) + ) + ) + #else + ( ; Purely imaginary + #if ($e._M_im >= 0.0) + ( + #("i*", $e._M_im) + ) + #else + ( + #("-i*", -$e._M_im) + ) + ) + ) + #else + ( ; Purely real + $e._M_re + ) + ) +} + +;------------------------------------------------------------------------------ +; stlport::valarray +;------------------------------------------------------------------------------ + +stlp_std::valarray<*>|stlpx_std::valarray<*>|stlpmtx_std::valarray<*>|stlpxmtx_std::valarray<*>|stlpd_std::valarray<*>|stlpdx_std::valarray<*>|stlpdmtx_std::valarray<*>|stlpdxmtx_std::valarray<*>{ + preview + ( + #( + "[", + $c._M_size , + "](", + #array + ( + expr : ($c._M_first)[$i], + size : $c._M_size + ), + ")" + ) + ) + + children + ( + #array + ( + expr : ($c._M_first)[$i], + size : $c._M_size + ) + ) +} + +stlp_std::slice|stlpx_std::slice|stlpmtx_std::slice|stlpxmtx_std::slice|stlpd_std::slice|stlpdx_std::slice|stlpdmtx_std::slice|stlpdxmtx_std::slice{ + preview + ( + #( + "start = ", + $c._M_start, + ", size = ", + $c._M_length, + ", stride = ", + $c._M_stride + ) + ) + children + ( + #( + [raw view] : [$c,!], + start : $c._M_start, + size : $c._M_length, + stride : $c._M_stride + ) + ) +} + +stlp_std::gslice|stlpx_std::gslice|stlpmtx_std::gslice|stlpxmtx_std::gslice|stlpd_std::gslice|stlpdx_std::gslice|stlpdmtx_std::gslice|stlpdxmtx_std::gslice{ + preview + ( + #( + "start = ", + $c._M_start, + ", sizes = ", + $c._M_lengths, + ", strides = ", + $c._M_strides + ) + ) + children + ( + #( + [raw view] : [$c,!], + start : $c._M_start, + sizes : $c._M_lengths, + strides : $c._M_strides + ) + ) +} \ No newline at end of file diff --git a/reactos/lib/3rdparty/stlport/etc/msvcincl.dat b/reactos/lib/3rdparty/stlport/etc/msvcincl.dat new file mode 100644 index 00000000000..afd7ba24c59 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/msvcincl.dat @@ -0,0 +1,309 @@ +algo.h +algobase.h +algorith.h +algorithm +alloc.h +bitset +bitset.h +bvector.h +cassert +cassert.h +cctype +cctype.h +cerrno +cerrno.h +cfloat +cfloat.h +char_traits.h +climits +climits.h +clocale +clocale.h +cmath +cmath.h +complex +complex.h +concept_checks.h +configure +configure.in +csetjmp +csetjmp.h +csignal +csignal.h +cstdarg +cstdarg.h +cstddef +cstddef.h +cstdio +cstdio.h +cstdlib +cstdlib.h +cstring +cstring.h +ctime +ctime.h +ctype.h +cwchar +cwchar.h +cwctype +cwctype.h +c_locale.h +defalloc.h +deque +deque.h +exceptio.h +exception +exception.h +export +fstream +fstream.h +function.h +functional +hashtable.h +hash_map +hash_map.h +hash_set +hash_set.h +heap.h +iomanip +iomanip.h +ios +ios.h +iosfwd +iosfwd.h +iostream +iostream.h +istream +istream.h +iterator +iterator.h +limits +limits.h +list +list.h +locale +locale.h +map +map.h +math.h +mem.h +memory +memory.h +mmemory.h +msl_string.h +multimap.h +multiset.h +new +new.h +numeric +numeric.h +numeric.h +ostream +ostream.h +pair.h +pthread.h +pthread_alloc +pthread_alloc.h +queue +queue.h +rope +rope.h +set +set.h +setjmp.h +signal.h +slist +slist.h +sstream +sstream.h +stack +stack.h +stdarg.h +stddef.h +stddef.h +stdexcep.h +stdexcept +stdio.h +stdio_streambuf +stdlib.h +stdlib.h +stlcomp.h +stlconf.h.in +stl_apcc.h +stl_apple.bak.h +stl_apple.h +stl_as400.h +stl_bc.h +stl_como.h +stl_confix.h +stl_dec.h +stl_dec_vms.h +stl_fujitsu.h +stl_gcc.h +stl_hpacc.h +stl_ibm.h +stl_intel.h +stl_kai.h +stl_mlc.h +stl_msvc.h +stl_mwerks.h +stl_mycomp.h +stl_sco.h +stl_select_lib.h +stl_sgi.h +stl_solaris.h +stl_sunpro.h +stl_symantec.h +stl_tmpl.h +stl_user_config.h +stl_watcom.h +stl_wince.h +streambu.h +streambuf +streambuf.h +string +string.h +strstrea.h +strstream +strstream.h +tempbuf.h +time.h +tree.h +typeinfo +typeinfo.h +type_traits.h +utility +utility.h +valarray +valarray.h +vc_select_lib.h +vector +vector.h +wchar.h +wctype.h +_abbrevs.h +_algo.c +_algo.h +_algobase.c +_algobase.h +_alloc.c +_alloc.h +_alloc_old.h +_auto_ptr.h +_bitset.c +_bitset.h +_bvector.h +_check_config.h +_codecvt.h +_collate.h +_complex.c +_complex.h +_config.h +_config_compat.h +_config_compat_post.h +_construct.h +_ctraits_fns.h +_ctype.h +_cwchar.h +_debug.c +_debug.h +_deque.c +_deque.h +_epilog.h +_epilog.h +_exception.h +_fstream.c +_fstream.h +_function.h +_function_base.h +_hashtable.c +_hashtable.h +_hash_fun.h +_hash_map.h +_hash_set.h +_heap.c +_heap.h +_ios.c +_ios.h +_iosfwd.h +_ios_base.h +_istream.c +_istream.h +_istreambuf_iterator.h +_iterator.h +_iterator.h +_iterator_base.h +_iterator_old.h +_limits.c +_limits.h +_list.c +_list.h +_list.h +_locale.h +_map.h +_messages_facets.h +_mmap.h +_monetary.c +_monetary.h +_msvc_warnings_off.h +_null_stream.h +_numeric.c +_numeric.h +_numpunct.h +_num_get.c +_num_get.h +_num_put.c +_num_put.h +_ostream.c +_ostream.h +_ostreambuf_iterator.h +_pair.h +_prolog.h +_pthread_alloc.h +_ptrs_specialize.h +_queue.h +_range_errors.h +_raw_storage_iter.h +_relops.h +_relops_cont.h +_relops_template.h +_rope.c +_rope.h +_set.h +_set_operators.h +_site_config.h +_slist.c +_slist.h +_slist_base.c +_slist_base.h +_sparc_atomic.h +_sstream.c +_sstream.h +_stack.h +_stdio_file.h +_stdio_file.h.new +_streambuf.c +_streambuf.h +_streambuf_iterator.h +_stream_iterator.h +_string.c +_string.h +_string_fwd.c +_string_fwd.h +_string_hash.h +_string_io.c +_string_io.h +_strstream.h +_tempbuf.c +_tempbuf.h +_threads.c +_threads.h +_time_facets.c +_time_facets.h +_tree.c +_tree.h +_uninitialized.h +_valarray.c +_valarray.h +_vector.c +_vector.h diff --git a/reactos/lib/3rdparty/stlport/etc/std_headers.txt b/reactos/lib/3rdparty/stlport/etc/std_headers.txt new file mode 100644 index 00000000000..321e8ffef16 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/std_headers.txt @@ -0,0 +1,34 @@ +algorithm +bitset +complex +deque +fstream +functional +hash_map +hash_set +iomanip +ios +iosfwd +iostream +istream +iterator +limits +list +locale +map +memory +numeric +ostream +pthread_alloc +queue +set +slist +sstream +stack +stdexcept +streambuf +string +strstream +utility +valarray +vector diff --git a/reactos/lib/3rdparty/stlport/etc/std_headers_c.txt b/reactos/lib/3rdparty/stlport/etc/std_headers_c.txt new file mode 100644 index 00000000000..3753b7d9c70 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/std_headers_c.txt @@ -0,0 +1,17 @@ +cassert +cctype +cerrno +cfloat +climits +clocale +cmath +csetjmp +csignal +cstdarg +cstddef +cstdio +cstdlib +cstring +ctime +cwchar +cwctype diff --git a/reactos/lib/3rdparty/stlport/etc/std_headers_c_h.txt b/reactos/lib/3rdparty/stlport/etc/std_headers_c_h.txt new file mode 100644 index 00000000000..dc78cd76b82 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/std_headers_c_h.txt @@ -0,0 +1,13 @@ +ctype.h +locale.h +math.h +setjmp.h +signal.h +stdarg.h +stddef.h +stdio.h +stdlib.h +string.h +time.h +wchar.h +wctype.h diff --git a/reactos/lib/3rdparty/stlport/etc/std_headers_classic_iostreams.txt b/reactos/lib/3rdparty/stlport/etc/std_headers_classic_iostreams.txt new file mode 100644 index 00000000000..cb035dd1bd2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/std_headers_classic_iostreams.txt @@ -0,0 +1,8 @@ +fstream.h +iomanip.h +ios.h +iostream.h +istream.h +ostream.h +streambuf.h +strstream.h diff --git a/reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime.txt b/reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime.txt new file mode 100644 index 00000000000..90f93bbe8cb --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime.txt @@ -0,0 +1,3 @@ +exception +new +typeinfo diff --git a/reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime_h.txt b/reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime_h.txt new file mode 100644 index 00000000000..6c1fb1d91d1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/etc/std_headers_cpp_runtime_h.txt @@ -0,0 +1,3 @@ +exception.h +new.h +typeinfo.h diff --git a/reactos/lib/3rdparty/stlport/test/compiler/Makefile.inc b/reactos/lib/3rdparty/stlport/test/compiler/Makefile.inc new file mode 100644 index 00000000000..a092d8785c8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/Makefile.inc @@ -0,0 +1,6 @@ +# -*- makefile -*- Time-stamp: <04/10/17 21:16:38 ptr> + +PRGNAME = compiler_test +SRC_CPP = ttei1.cpp ttei2.cpp ttei3.cpp ttei4.cpp ttei5.cpp ttei6.cpp ttei7.cpp \ + partial_spec.cpp movable.cpp +SRC_CC = eh.cc diff --git a/reactos/lib/3rdparty/stlport/test/compiler/README b/reactos/lib/3rdparty/stlport/test/compiler/README new file mode 100644 index 00000000000..bb25a896204 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/README @@ -0,0 +1,29 @@ +1. About this tests + +This is tests to check whether compiler understand or not some language +construction. It is NOT tests for language support libraries, only tests for +compiler! + +The main purposes of this tests is to help for developers to find correct +workarounds, if compiler don't understand some (correct) language constructions. + +-------------------------------------------------------- + +2. Compilation + +Compilation with GNU Make utility and gcc compiler: + +make -f gcc.mak -k + + + +-------------------------------------------------------- + +Notes about tests. + +ttei1.cpp, ttei2.cpp, ttei3.cpp, ttei4.cpp, ttei5.cpp: + +tests for template-in-the-template explicit specialization. +Indeed ttei3.cpp, ttei4.cpp, ttei5.cpp suggest syntax not approved by standard +(14.7.3, paragraphs 16--18), but ttei3.cpp, ttei4.cpp accepted (recheck!) by VC6, +while ttei5.cpp accepted by gcc before 3.4.0. diff --git a/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile b/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile new file mode 100644 index 00000000000..71979e7beb0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile @@ -0,0 +1,12 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../../build +COMPILER_NAME := gcc + +# WITHOUT_STLPORT = 1 +# STLPORT_DIR := ../../.. +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +#CXXFLAGS += -fuse-cxa-atexit +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} diff --git a/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile.inc b/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile.inc new file mode 100644 index 00000000000..d7ac0394142 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/Makefile.inc @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = stterm-test +SRC_CC = stterm-test.cc diff --git a/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/stterm-test.cc b/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/stterm-test.cc new file mode 100644 index 00000000000..ae825ae0a35 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/StTerm-order/stterm-test.cc @@ -0,0 +1,117 @@ +/* + * The conversation with Matti Rintala on STLport forum 2005-08-24: + * + * Do you mean ISO/IEC 14882 3.6.3 [basic.start.term]? + * + * Yes. "Destructors (12.4) for initialized objects of static storage duration + * (declared at block scope or at namespace scope) are called as a result + * of returning from main and as a result of calling exit (18.3). These objects + * are destroyed in the reverse order of the completion of their constructor + * or of the completion of their dynamic initialization." + * + * I found a confirmation on the web that gcc may not strictly conform + * to this behaviour in certains cases unless -fuse-cxa-atexit is used. + * + * Test below give (without -fuse-cxa-atexit) + +Init::Init() +Init::use_it +It ctor done <-- 0 +Init::use_it done +Init ctor done <-- 1 +Init2 ctor done <-- 2 +It dtor done <-- 0 +Init2 dtor done <-- 2 +Init dtor done <-- 1 + + + * but should: + +Init::Init() +Init::use_it +It ctor done <-- 0 +Init::use_it done +Init ctor done <-- 1 +Init2 ctor done <-- 2 +Init2 dtor done <-- 2 +Init dtor done <-- 1 +It dtor done <-- 0 + + + */ +#include + +using namespace std; + +class Init +{ + public: + Init(); + ~Init(); + + static void use_it(); +}; + +class Init2 +{ + public: + Init2(); + ~Init2(); + +}; + +static Init init; +static Init2 init2; + +class It +{ + public: + It(); + ~It(); +}; + +Init::Init() +{ + printf( "Init::Init()\n" ); + use_it(); + printf( "Init ctor done\n" ); +} + +Init::~Init() +{ + printf( "Init dtor done\n" ); +} + +void Init::use_it() +{ + printf( "Init::use_it\n" ); + + static It it; + + printf( "Init::use_it done\n" ); +} + +Init2::Init2() +{ + printf( "Init2 ctor done\n" ); +} + +Init2::~Init2() +{ + printf( "Init2 dtor done\n" ); +} + +It::It() +{ + printf( "It ctor done\n" ); +} + +It::~It() +{ + printf( "It dtor done\n" ); +} + +int main() +{ + return 0; +} diff --git a/reactos/lib/3rdparty/stlport/test/compiler/eh.cc b/reactos/lib/3rdparty/stlport/test/compiler/eh.cc new file mode 100644 index 00000000000..e0b31f41b8c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/eh.cc @@ -0,0 +1,60 @@ +#include /* required, to expose allocator */ +#include +#include + +using namespace std; + +struct BigStruct +{ + char _data[4096]; +}; + +void bad_alloc_test() +{ + typedef allocator BigStructAllocType; + BigStructAllocType bigStructAlloc; + + try { + //Lets try to allocate almost 4096 Go (on most of the platforms) of memory: + BigStructAllocType::pointer pbigStruct = bigStructAlloc.allocate(1024 * 1024 * 1024); + + // CPPUNIT_ASSERT( pbigStruct != 0 && "Allocation failed but no exception thrown" ); + } + catch (bad_alloc const&) { + printf( "Ok\n" ); + } + catch (...) { + //We shouldn't be there: + // CPPUNIT_ASSERT( false && "Not bad_alloc exception thrown." ); + } +} + +void bad_alloc_test1() +{ + try { + allocator all; + BigStruct *bs = all.allocate(1024*1024*1024); + + // throw bad_alloc(); + } + catch ( bad_alloc const & ) { + printf( "I am here\n" ); + } + catch ( ... ) { + } +} + +int main() +{ + bad_alloc_test(); +#if 0 + try { + throw bad_alloc(); + } + catch ( bad_alloc& ) { + } + catch ( ... ) { + } +#endif + return 0; +} diff --git a/reactos/lib/3rdparty/stlport/test/compiler/gcc.mak b/reactos/lib/3rdparty/stlport/test/compiler/gcc.mak new file mode 100644 index 00000000000..311eded362b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/gcc.mak @@ -0,0 +1,12 @@ +# -*- Makefile -*- Time-stamp: <04/03/14 23:50:57 ptr> + +SRCROOT := ../../build +COMPILER_NAME := gcc + +ALL_TAGS := compile-only +STLPORT_DIR := ../.. +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +compile-only: $(OUTPUT_DIRS) $(OBJ) + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/movable.cpp b/reactos/lib/3rdparty/stlport/test/compiler/movable.cpp new file mode 100644 index 00000000000..04590b98fe9 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/movable.cpp @@ -0,0 +1,20 @@ +#include +#include +#include + +using namespace std; + +struct S : + public string +{ +}; + +void test() +{ + list l; + l.push_back( S() ); + + vector v; + v.push_back( S() ); +} + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/partial_spec.cpp b/reactos/lib/3rdparty/stlport/test/compiler/partial_spec.cpp new file mode 100644 index 00000000000..a572cd6145c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/partial_spec.cpp @@ -0,0 +1,34 @@ +/* + * It is known that this code not compiled by following compilers: + * + * MSVC 6 + * + * It is known that this code compiled by following compilers: + * + * MSVC 8 + * gcc 4.1.1 + */ + +/* + * This code represent what STLport waits from a compiler which support + * the partial template function ordering (!_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) + */ + +template +struct template_struct {}; + +template +int func(T1 p1); + +template +int func(template_struct); + + +int foo() +{ + int tmp1 = 0; + template_struct tmp2; + func(tmp1); + func(tmp2); + return 0; +} diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei1.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei1.cpp new file mode 100644 index 00000000000..7430d96b106 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei1.cpp @@ -0,0 +1,31 @@ +/* + * It is known that this code not compiled by following compilers: + * gcc 2.95.3 + * MSVC 6 + * + * It is known that this code compiled by following compilers: + * gcc 3.3.3 + * gcc 3.4.1 + * MSVC 8 Beta + */ + +struct A +{ + private: + struct B + { + template + static void f( T& ) {} + + template + struct C + { + template + static void f( T& ) {} + }; + }; +}; + +template <> template +void A::B::C::f( T& ) {} + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei2.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei2.cpp new file mode 100644 index 00000000000..68f8a185ee7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei2.cpp @@ -0,0 +1,31 @@ +/* + * It is known that this code not compiled by following compilers: + * + * It is known that this code compiled by following compilers: + * gcc 2.95.3 + * gcc 3.3.3 + * gcc 3.4.1 + * MSVC 6 + * MSVC 8 + */ + +struct A +{ + private: + struct B + { + template + static void f( T& ) {} + + template + struct C + { + }; + }; +}; + +template <> +struct A::B::C +{ +}; + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei3.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei3.cpp new file mode 100644 index 00000000000..a7cdca2e85a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei3.cpp @@ -0,0 +1,43 @@ +/* + * It is known that this code not compiled by following compilers: + * gcc 2.95.3 + * gcc 3.3.3 + * gcc 3.4.1 + * gcc 4.1.1 + * + * It is known that this code compiled by following compilers: + * + * MSVC 6 + * MSVC 8 Beta + */ + +/* + * Indeed this code is wrong: explicit template specialization + * have to appear out-of-class. + * + */ + +struct A +{ + private: + struct B + { + template + static void f( T& ) {} + + template + struct C + { + template + static void f( T& ) {} + }; + + template <> + struct C + { + template + static void f( T& ) {} + }; + }; +}; + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei4.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei4.cpp new file mode 100644 index 00000000000..7c56e0fbc47 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei4.cpp @@ -0,0 +1,42 @@ +/* + * It is known that this code not compiled by following compilers: + * gcc 2.95.3 + * gcc 3.3.3 + * gcc 3.4.1 + * gcc 4.1.1 + * + * It is known that this code compiled by following compilers: + * + * MSVC 6 + * MSVC 8 Beta + */ + +/* + * Indeed this code is wrong: 1. explicit template specialization + * have to appear out-of-class; 2. specialized struct C have to + * have function f. + * + */ + +struct A +{ + private: + struct B + { + template + static void f( T& ) {} + + template + struct C + { + template + static void f( T& ) {} + }; + + template <> + struct C + { + }; + }; +}; + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei5.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei5.cpp new file mode 100644 index 00000000000..d2c916e87cf --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei5.cpp @@ -0,0 +1,43 @@ +/* + * It is known that this code not compiled by following compilers: + * gcc 3.4.1 + * gcc 4.1.1 + * + * It is known that this code compiled by following compilers: + * gcc 2.95.3 + * gcc 3.3.3 + * + * MSVC 6 + * MSVC 8 Beta + */ + +/* + * Indeed this code is wrong: explicit template specialization + * have to appear out-of-class. + * + */ + +struct A +{ + private: + struct B + { + template + static void f( T& ) {} + + template + struct C + { + template + static void f( T& ) {} + }; + + template <> + struct C + { + template + static void f( T& ) {} + }; + }; +}; + diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei6.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei6.cpp new file mode 100644 index 00000000000..6e51e22c8d6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei6.cpp @@ -0,0 +1,30 @@ +/* + * It is known that this code not compiled by following compilers: + * + * It is known that this code compiled by following compilers: + * + * MSVC 6 + * MSVC 8 Beta + */ + +/* + * This code represent what STLport waits from a compiler which support + * member template classes (!_STLP_NO_MEMBER_TEMPLATE_CLASSES) + */ + +template +struct A +{ + template + struct B + { + typedef T2 _Type; + }; +}; + + +template +struct C +{ + typedef typename A:: template B::_Type ABType; +}; diff --git a/reactos/lib/3rdparty/stlport/test/compiler/ttei7.cpp b/reactos/lib/3rdparty/stlport/test/compiler/ttei7.cpp new file mode 100644 index 00000000000..08742e37147 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/compiler/ttei7.cpp @@ -0,0 +1,31 @@ +/* + * It is known that this code not compiled by following compilers: + * + * MSVC 6 + * + * It is known that this code compiled by following compilers: + * + * MSVC 8 Beta + */ + +/* + * This code represent what STLport waits from a compiler which support + * the rebind member template class technique (!_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) + */ + +template +struct A +{ + template + struct B + { + typedef A _Type; + }; +}; + + +template +struct C +{ + typedef typename A:: template B::_Type _ATType; +}; diff --git a/reactos/lib/3rdparty/stlport/test/eh/LeakCheck.h b/reactos/lib/3rdparty/stlport/test/eh/LeakCheck.h new file mode 100644 index 00000000000..b6e7267d3a9 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/LeakCheck.h @@ -0,0 +1,198 @@ +/* + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ +/*********************************************************************************** + LeakCheck.h + + SUMMARY: A suite of template functions for verifying the behavior of + operations in the presence of exceptions. Requires that the operations + be written so that each operation that could cause an exception causes + simulate_possible_failure() to be called (see "nc_alloc.h"). + +***********************************************************************************/ +#ifndef INCLUDED_MOTU_LeakCheck +#define INCLUDED_MOTU_LeakCheck 1 + +#include "Prefix.h" + +#include "nc_alloc.h" + +#include +#include +#include + +#include + +EH_BEGIN_NAMESPACE + +template +inline ostream& operator << ( +ostream& s, +const pair & p) { + return s<<'['< +void CheckInvariant(const C&) +{} + +/*=================================================================================== + WeakCheck + + EFFECTS: Given a value and an operation, repeatedly applies the operation to a + copy of the value triggering the nth possible exception, where n increments + with each repetition until no exception is thrown or max_iters is reached. + Reports any detected memory leaks and checks any invariant defined for the + value type whether the operation succeeds or fails. +====================================================================================*/ +template +void WeakCheck(const Value& v, const Operation& op, long max_iters = 2000000) { + bool succeeded = false; + bool failed = false; + gTestController.SetCurrentTestCategory("weak"); + for (long count = 0; !succeeded && !failed && count < max_iters; ++count) { + gTestController.BeginLeakDetection(); + { + Value dup = v; +#ifndef EH_NO_EXCEPTIONS + try { +#endif + gTestController.SetFailureCountdown(count); + op( dup ); + succeeded = true; +#ifndef EH_NO_EXCEPTIONS + } + catch (...) {} // Just try again. +#endif + gTestController.CancelFailureCountdown(); + CheckInvariant(dup); + } + failed = gTestController.ReportLeaked(); + EH_ASSERT( !failed ); + + if ( succeeded ) + gTestController.ReportSuccess(count); + } + EH_ASSERT( succeeded || failed ); // Make sure the count hasn't gone over +} + +/*=================================================================================== + ConstCheck + + EFFECTS: Similar to WeakCheck (above), but for operations which may not modify + their arguments. The operation is performed on the value itself, and no + invariant checking is performed. Leak checking still occurs. +====================================================================================*/ +template +void ConstCheck(const Value& v, const Operation& op, long max_iters = 2000000) { + bool succeeded = false; + bool failed = false; + gTestController.SetCurrentTestCategory("const"); + for (long count = 0; !succeeded && !failed && count < max_iters; ++count) { + gTestController.BeginLeakDetection(); + { +#ifndef EH_NO_EXCEPTIONS + try { +#endif + gTestController.SetFailureCountdown(count); + op( v ); + succeeded = true; +#ifndef EH_NO_EXCEPTIONS + } + catch(...) {} // Just try again. +# endif + gTestController.CancelFailureCountdown(); + } + failed = gTestController.ReportLeaked(); + EH_ASSERT( !failed ); + + if ( succeeded ) + gTestController.ReportSuccess(count); + } + EH_ASSERT( succeeded || failed ); // Make sure the count hasn't gone over +} + +/*=================================================================================== + StrongCheck + + EFFECTS: Similar to WeakCheck (above), but additionally checks a component of + the "strong guarantee": if the operation fails due to an exception, the + value being operated on must be unchanged, as checked with operator==(). + + CAVEATS: Note that this does not check everything required for the strong + guarantee, which says that if an exception is thrown, the operation has no + effects. Do do that we would have to check that no there were no side-effects + on objects which are not part of v (e.g. iterator validity must be preserved). + +====================================================================================*/ +template +void StrongCheck(const Value& v, const Operation& op, long max_iters = 2000000) { + bool succeeded = false; + bool failed = false; + gTestController.SetCurrentTestCategory("strong"); + for ( long count = 0; !succeeded && !failed && count < max_iters; count++ ) { + gTestController.BeginLeakDetection(); + + { + Value dup = v; + { +#ifndef EH_NO_EXCEPTIONS + try { +#endif + gTestController.SetFailureCountdown(count); + op( dup ); + succeeded = true; + gTestController.CancelFailureCountdown(); +# ifndef EH_NO_EXCEPTIONS + } + catch (...) { + gTestController.CancelFailureCountdown(); + bool unchanged = (dup == v); + EH_ASSERT( unchanged ); + + if ( !unchanged ) { +#if 0 + typedef typename Value::value_type value_type; + EH_STD::ostream_iterator o(EH_STD::cerr, " "); + EH_STD::cerr<<"EH test FAILED:\nStrong guaranee failed !\n"; + EH_STD::copy(dup.begin(), dup.end(), o); + EH_STD::cerr<<"\nOriginal is:\n"; + EH_STD::copy(v.begin(), v.end(), o); + EH_STD::cerr< + +#ifndef _STLP_CALL +# define _STLP_CALL +#endif + +#if defined(_STLP_USE_NAMESPACES) +# define EH_USE_NAMESPACES _STLP_USE_NAMESPACES +#endif + +#define EH_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE +#define EH_END_NAMESPACE _STLP_END_NAMESPACE + +#define EH_NEW_HEADERS 1 + +//#if defined (_STLP_USE_NEW_IOSTREAMS) +#define EH_NEW_IOSTREAMS 1 +//#endif + +#if !defined (_STLP_USE_EXCEPTIONS) +# define EH_NO_EXCEPTIONS +#endif + +#if defined (_STLP_TEMPLATE_PARAM_SUBTYPE_BUG) +# define EH_TEMPLATE_PARAM_SUBTYPE_BUG _STLP_TEMPLATE_PARAM_SUBTYPE_BUG +#endif + +#if defined(_STLP_MULTI_CONST_TEMPLATE_ARG_BUG) +# define EH_MULTI_CONST_TEMPLATE_ARG_BUG _STLP_MULTI_CONST_TEMPLATE_ARG_BUG +#endif + +#if defined (STLPORT) +# define EH_STD STLPORT +#elif defined(__STD) +# define EH_STD __STD +#endif + +// we want to be portable here, so std:: won't work. +#if defined(STLPORT_CSTD) +# define EH_CSTD STLPORT_CSTD +#else +# define EH_CSTD std +#endif + +#define EH_DISTANCE(a, b, result) EH_STD::distance(a, b, result) + +#define EH_HASHED_CONTAINERS_IMPLEMENTED 1 +#define EH_HASH_CONTAINERS_SUPPORT_RESIZE 1 +#define EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION 1 +#define EH_SLIST_IMPLEMENTED 1 +#define EH_SELECT1ST_HINT __select1st_hint +// fbp : DEC cxx is unable to compile it for some reason +#if !(defined (__DECCXX) || defined (__amigaos__) || \ + (defined (__GNUC__) && (__GNUC__ <= 2) && (__GNUC_MINOR__ < 8))) +# define EH_ROPE_IMPLEMENTED 1 +#endif +#define EH_STRING_IMPLEMENTED 1 +// # define EH_BITSET_IMPLEMENTED 1 +//# define EH_VALARRAY_IMPLEMENTED 1 - we have no tests yet for valarray + +#define stl_destroy EH_STD::destroy +#include + +template +class /*_STLP_CLASS_DECLSPEC*/ EH_allocator; + +template +class /*_STLP_CLASS_DECLSPEC*/ EH_allocator { +public: + + typedef _Tp value_type; + typedef value_type * pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef EH_CSTD::size_t size_type; + typedef EH_CSTD::ptrdiff_t difference_type; +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template struct rebind { + typedef EH_allocator<_Tp1> other; + }; +# endif + EH_allocator() _STLP_NOTHROW {} + # if defined (_STLP_MEMBER_TEMPLATES) + template EH_allocator(const EH_allocator<_Tp1>&) _STLP_NOTHROW {} + # endif + EH_allocator(const EH_allocator<_Tp>&) _STLP_NOTHROW {} + ~EH_allocator() _STLP_NOTHROW {} + pointer address(reference __x) { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0. + _Tp* allocate(size_type __n, const void* = 0) const { + return __n != 0 ? __REINTERPRET_CAST(value_type*,EH_STD::__new_alloc::allocate(__n * sizeof(value_type))) : 0; + } + // __p is permitted to be a null pointer, only if n==0. + void deallocate(pointer __p, size_type __n) const { + _STLP_ASSERT( (__p == 0) == (__n == 0) ) + if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, __n * sizeof(value_type)); + } + // backwards compatibility + void deallocate(pointer __p) const { if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, sizeof(value_type)); } + size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); } + void construct(pointer __p, const _Tp& __val) const { stlport::construct(__p, __val); } + void destroy(pointer __p) const { stlport::destroy(__p); } +}; + +template inline bool _STLP_CALL operator==(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return true; } +template inline bool _STLP_CALL operator!=(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return false; } + +_STLP_BEGIN_NAMESPACE +// If custom allocators are being used without member template classes support : +// user (on purpose) is forced to define rebind/get operations !!! +template +inline EH_allocator<_Tp2>& _STLP_CALL +__stl_alloc_rebind(EH_allocator<_Tp1>& __a, const _Tp2*) { return (EH_allocator<_Tp2>&)(__a); } +template +inline EH_allocator<_Tp2> _STLP_CALL +__stl_alloc_create(const EH_allocator<_Tp1>&, const _Tp2*) { return EH_allocator<_Tp2>(); } +_STLP_END_NAMESPACE + +# define eh_allocator(T) ::EH_allocator + +# define EH_BIT_VECTOR_IMPLEMENTED + +# if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined(_STLP_NO_BOOL) +# define EH_BIT_VECTOR EH_STD::vector +# else +# ifdef _STLP_NO_BOOL +# undef EH_BIT_VECTOR_IMPLEMENTED +# else +# define EH_BIT_VECTOR EH_STD::vector +# endif +# endif + +#else // !USE_SGI_STL +//========================================================================= +// Configuration for testing other non-SGI STL implementations +//========================================================================= + +// Metrowerks configuration +# ifdef __MWERKS__ + +# define EH_ASSERT assert +// Get MSL configuration header +# include + +# if __MSL__ >= 24 + +# define EH_NEW_HEADERS 1 +# if defined (_MSL_USING_NAMESPACE) +# define EH_USE_NAMESPACES 1 +# endif +# define EH_BIT_VECTOR vector +# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0) + +# else + +# error No configuration for earlier versions of MSL + +# endif // __MSL__ >= 24 + +// Bugs fixed in CWPro3 +# if __MWERKS__ < 0x2100 +# define EH_TEMPLATE_PARAM_SUBTYPE_BUG 1 +# endif + +// Bugs in CWPro3 +# if __MWERKS__ <= 0x2110 +# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1 +# else +# pragma warning not sure the above bug is fixed yet +# endif + +# define EH_SLIST_IMPLEMENTED 1 +//# define EH_HASHED_CONTAINERS_IMPLEMENTED 1 + +# define EH_NEW_IOSTREAMS 1 +# define EH_USE_NOTHROW 1 +# endif // Metrowerks configuration + +#if defined (__SUNPRO_CC) +# define stl_destroy __RWSTD::__destroy +# define EH_DISTANCE( a, b, result ) distance( a, b, result ) +# define EH_BIT_VECTOR EH_STD::vector +# define EH_NEW_HEADERS 1 +# define EH_USE_NAMESPACES 1 +# define EH_NEW_IOSTREAMS 1 +# define EH_ASSERT assert +# define EH_STRING_IMPLEMENTED 1 +# elif defined (__KCC) +# define stl_destroy EH_STD::destroy +# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0) +# define EH_BIT_VECTOR EH_STD::vector +# define EH_NEW_HEADERS 1 +# define EH_USE_NAMESPACES 1 +# define EH_NEW_IOSTREAMS 1 +# define EH_ASSERT assert +# define EH_CSTD +# define EH_STRING_IMPLEMENTED 1 +# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1 +# define EH_SELECT1ST_HINT select1st +# else +# define stl_destroy destroy +#endif + +// +// Compiler-independent configuration +// +# ifdef EH_USE_NAMESPACES +# ifdef STLPORT +# define EH_STD STLPORT +# else +# define EH_STD std +# endif +# ifdef STLPORT_CSTD +# define EH_STD STLPORT_CSTD +# else +# define EH_STD std +# endif +# define EH_BEGIN_NAMESPACE namespace EH_STD { +# define EH_END_NAMESPACE } +# else +# define EH_BEGIN_NAMESPACE +# define EH_END_NAMESPACE +# define EH_STD +# endif + +# ifndef EH_CSTD +# define EH_CSTD EH_STD +# endif + +#endif // !USE_SGI_STL + + +// +// Library-independent configuration. +// +#if defined( EH_MULTI_CONST_TEMPLATE_ARG_BUG) && !defined( EH_SELECT1ST_HINT ) +template +// JDJ (CW Pro1 doesn't like const when first_type is also const) +struct eh_select1st_hint : public unary_function { + const U& operator () (const Pair& x) const { return x.first; } +}; +# define EH_SELECT1ST_HINT eh_select1st_hint +#endif + + +#if EH_USE_NAMESPACES +# define EH_USE_STD using namespace EH_STD; +#else +# define EH_USE_STD +#endif + +#if defined (EH_USE_NAMESPACES) && !defined(_STLP_VENDOR_GLOBAL_CSTD) +# define USING_CSTD_NAME(name) using EH_CSTD :: name; +#else +# define USING_CSTD_NAME(name) +#endif + +#endif // INCLUDED_MOTU_Prefix diff --git a/reactos/lib/3rdparty/stlport/test/eh/SortClass.h b/reactos/lib/3rdparty/stlport/test/eh/SortClass.h new file mode 100644 index 00000000000..220300ef6f8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/SortClass.h @@ -0,0 +1,81 @@ +/*********************************************************************************** + SortClass.h + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + + SUMMARY: A class designed to test operations that compares objects. All + comparisons on SortClass may fail. Also records its own address for + the sake of testing the stability of sorting algorithms. + +***********************************************************************************/ +#if ! defined (INCLUDED_MOTU_SortClass) +#define INCLUDED_MOTU_SortClass 1 + +# include "Prefix.h" +# include "TestClass.h" + +class SortClass : public TestClass +{ +public: + enum { kRange = 100 }; + + SortClass( int v ) : TestClass( v ), addr(0) { + ResetAddress(); + } + + SortClass() : TestClass( (int)get_random(kRange) ), addr(0) { + ResetAddress(); + } + + bool operator<( const TestClass& rhs ) const + { + simulate_possible_failure(); + return (const TestClass&)*this < ( rhs ); + } + + bool operator==( const TestClass& rhs ) const + { + simulate_possible_failure(); + return (const TestClass&)*this == ( rhs ); + } + + SortClass* GetAddress() const { return addr; } + void ResetAddress() { addr = this; } + +private: + SortClass* addr; +}; + +inline bool operator>( const SortClass& lhs, const SortClass& rhs ) { + return rhs < lhs; +} + +inline bool operator<=( const SortClass& lhs, const SortClass& rhs ) { + return !(rhs < lhs); +} + +inline bool operator>=( const SortClass& lhs, const SortClass& rhs ) { + return !(lhs < rhs); +} + +inline bool operator != ( const SortClass& lhs, const SortClass& rhs ) { + return !(lhs == rhs); +} + +#if defined( __MWERKS__ ) && __MWERKS__ <= 0x3000 && !__SGI_STL +# if defined( __MSL__ ) && __MSL__ < 0x2406 +__MSL_FIX_ITERATORS__(SortClass); +__MSL_FIX_ITERATORS__(const SortClass); +# endif +#endif + +#endif // INCLUDED_MOTU_SortClass diff --git a/reactos/lib/3rdparty/stlport/test/eh/TestClass.cpp b/reactos/lib/3rdparty/stlport/test/eh/TestClass.cpp new file mode 100644 index 00000000000..8732c4fbfb7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/TestClass.cpp @@ -0,0 +1,24 @@ +/*********************************************************************************** + TestClass.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "TestClass.h" + +#include + +std::ostream& operator << (std::ostream& s, const TestClass& t) { + return s << t.value(); +} + + diff --git a/reactos/lib/3rdparty/stlport/test/eh/TestClass.h b/reactos/lib/3rdparty/stlport/test/eh/TestClass.h new file mode 100644 index 00000000000..79f5c090cb7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/TestClass.h @@ -0,0 +1,161 @@ +/*********************************************************************************** + TestClass.h + + * Copyright (c) 1997-1998 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + + SUMMARY: TestClass simulates a class that uses resources. It is designed to + cause exceptions when it is constructed or copied. + +***********************************************************************************/ +#ifndef INCLUDED_MOTU_TestClass +#define INCLUDED_MOTU_TestClass 1 + +# include "Prefix.h" + +# include +# include +# include + +#include +#include "random_number.h" +#include "nc_alloc.h" + +class TestClass +{ +public: + inline TestClass(); + inline TestClass( int value ); + inline TestClass( const TestClass& rhs ); + inline ~TestClass(); + + inline TestClass& operator=( const TestClass& rhs ); + inline int value() const; + + inline TestClass operator!() const; + + bool operator==( const TestClass& rhs ) const + { + return value() == rhs.value(); + } + + bool operator<( const TestClass& rhs ) const { + return value() < rhs.value(); + } + +protected: + static inline unsigned int get_random(unsigned range = UINT_MAX); +private: + inline void Init( int value ); + +#if TESTCLASS_DEEP_DATA + int *p; +#else + int v; +#endif +}; + +#if defined( __MWERKS__ ) && __MWERKS__ <= 0x3000 && !__SGI_STL +# if defined( __MSL__ ) && __MSL__ < 0x2406 +# include +__MSL_FIX_ITERATORS__(TestClass); +__MSL_FIX_ITERATORS__(const TestClass); +typedef EH_STD::pair pair_testclass_testclass; +__MSL_FIX_ITERATORS__( pair_testclass_testclass ); +__MSL_FIX_ITERATORS__( const pair_testclass_testclass ); +# endif +#endif + +inline void TestClass::Init( int value ) +{ +#if TESTCLASS_DEEP_DATA + p = new int( value ); +#else + simulate_constructor(); + v = value; +#endif +} + +inline TestClass::TestClass() +{ + Init( int(get_random()) ); +} + +inline TestClass::TestClass( int value ) +{ + Init( value ); +} + +inline TestClass::TestClass( const TestClass& rhs ) +{ + Init( rhs.value() ); +} + +inline TestClass::~TestClass() +{ +#if TESTCLASS_DEEP_DATA + delete p; +#else + simulate_destructor(); +#endif +} + +inline TestClass& TestClass::operator=( const TestClass& rhs ) +{ +#if TESTCLASS_DEEP_DATA + int *newP = new int( rhs.value() ); + delete p; + p = newP; +#else + simulate_possible_failure(); + v = rhs.value(); +#endif + return *this; +} + +inline int TestClass::value() const +{ +#if TESTCLASS_DEEP_DATA + return *p; +#else + return v; +#endif +} + +inline TestClass TestClass::operator!() const +{ + return TestClass( value()+1 ); +} + +inline bool operator>( const TestClass& lhs, const TestClass& rhs ) { + return rhs < lhs; +} + +inline bool operator>=( const TestClass& lhs, const TestClass& rhs ) { + return !(lhs < rhs); +} + +inline bool operator<=( const TestClass& lhs, const TestClass& rhs ) { + return !(rhs < lhs); +} + +inline bool operator != ( const TestClass& lhs, const TestClass& rhs ) { + return lhs.value() != rhs.value(); +} + +inline unsigned int TestClass::get_random( unsigned range ) +{ + return random_number( range ); +} + +extern std::ostream& operator << ( std::ostream& s, const TestClass&); + +#endif // INCLUDED_MOTU_TestClass diff --git a/reactos/lib/3rdparty/stlport/test/eh/Tests.h b/reactos/lib/3rdparty/stlport/test/eh/Tests.h new file mode 100644 index 00000000000..8102fb3387d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/Tests.h @@ -0,0 +1,59 @@ +/*********************************************************************************** + Tests.h + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + + SUMMARY: Declarations of all of the tests in the exception test suite. + +***********************************************************************************/ +#if ! defined (INCLUDED_MOTU_Tests) +#define INCLUDED_MOTU_Tests 1 + +#include "Prefix.h" + +void test_algobase(); +void test_algo(); +void test_list(); +void test_map(); +void test_multimap(); +void test_set(); +void test_multiset(); +void test_vector(); +void test_deque(); +void test_bit_vector(); + +#if defined (EH_HASHED_CONTAINERS_IMPLEMENTED) +void test_hash_map(); +void test_hash_multimap(); +void test_hash_set(); +void test_hash_multiset(); +#endif + +#if defined (EH_ROPE_IMPLEMENTED) +void test_rope(); +#endif + +#if defined( EH_SLIST_IMPLEMENTED ) +void test_slist(); +#endif + +#if defined( EH_STRING_IMPLEMENTED ) +void test_string(); +#endif +#if defined( EH_BITSET_IMPLEMENTED ) +void test_bitset(); +#endif +#if defined( EH_VALARRAY_IMPLEMENTED ) +void test_valarray(); +#endif + +#endif // INCLUDED_MOTU_Tests diff --git a/reactos/lib/3rdparty/stlport/test/eh/ThrowCompare.h b/reactos/lib/3rdparty/stlport/test/eh/ThrowCompare.h new file mode 100644 index 00000000000..34811b596e2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/ThrowCompare.h @@ -0,0 +1,46 @@ +/*********************************************************************************** + ThrowCompare.h + + Interface for the ThrowCompare class + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef ThrowCompare_H_ +#define ThrowCompare_H_ + +#include "Prefix.h" +#include "TestClass.h" + +struct ThrowCompare { + bool operator()( const TestClass& a, const TestClass& b ) const { + simulate_possible_failure(); + return a < b; + } +}; + + +struct ThrowEqual { + inline bool operator()( const TestClass& a, const TestClass& b ) const { + simulate_possible_failure(); + return a == b; + } +}; + +struct ThrowHash { // : private ThrowCompare + inline EH_CSTD::size_t operator()( const TestClass& a ) const { + simulate_possible_failure(); + return EH_CSTD::size_t(a.value()); + } +}; + +#endif // ThrowCompare_H_ diff --git a/reactos/lib/3rdparty/stlport/test/eh/bcb.mak b/reactos/lib/3rdparty/stlport/test/eh/bcb.mak new file mode 100644 index 00000000000..6a13314aba9 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/bcb.mak @@ -0,0 +1,78 @@ +# --------------------------------------------------------------------------- +BCC32=bcc32 +CPP32=cpp32 + +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +# --------------------------------------------------------------------------- +PROJECT = eh_test.exe +OBJFILES = TestClass.obj \ + nc_alloc.obj \ + random_number.obj \ + test_algo.obj \ + test_algobase.obj \ + test_bit_vector.obj \ + test_bitset.obj \ + test_deque.obj \ + test_hash_map.obj \ + test_hash_set.obj \ + test_list.obj \ + test_map.obj \ + test_rope.obj \ + test_set.obj \ + test_slist.obj \ + test_string.obj \ + test_valarray.obj \ + test_vector.obj main.obj + +# --------------------------------------------------------------------------- +PATHCPP = .; +PATHPAS = .; +PATHASM = .; +PATHRC = .; + +# USERDEFINES = _STLP_NO_OWN_IOSTREAMS + +USERDEFINES = _DEBUG + +SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES +# SYSDEFINES = NO_STRICT;USEPACKAGES + # --------------------------------------------------------------------------- +CFLAG1 = -w- -jb -j1 -I.;..\..\stlport;$(BCB)\include; -Od -v -N -x -xp -tWC -D$(SYSDEFINES);$(USERDEFINES) + +LDFLAGS = -L..\..\lib;$(BCB)\..\lib cw32i.lib stlp.4.5.lib + +.autodepend +# --------------------------------------------------------------------------- + +all : $(PROJECT) + cd ..\..\lib + ..\test\eh\eh_test.exe -s 100 + +$(PROJECT) : $(OBJFILES) + $(BCC32) -e$(PROJECT) $(CFLAG1) $(LDFLAGS) $(OBJFILES) + +clean: + del *.obj *.exe *.core *.tds + +# --------------------------------------------------------------------------- +.cpp.obj: + $(BCC32) $(CFLAG1) -n$(@D) -c $< + +.cpp.exe: + $(BCC32) $(CFLAG1) $(LDFLAGS) -n$(@D) $< + +.cpp.i: + $(CPP32) $(CFLAG1) -n. -Sr -Ss -Sd {$< } +# --------------------------------------------------------------------------- + diff --git a/reactos/lib/3rdparty/stlport/test/eh/bug.cpp b/reactos/lib/3rdparty/stlport/test/eh/bug.cpp new file mode 100644 index 00000000000..b723d5cc9df --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/bug.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include + +struct compare +{ + bool operator()(int* x, int* y) + { return *x < *y; } + +}; + +int main(int argc, char const* const argv[]) +{ + std::size_t niters = argc < 2 ? 1000 : boost::lexical_cast(argv[1]); + + boost::timer t; + + std::vector v; + for (int n = 0; n < niters; ++n) + { + v.insert(v.begin() + v.size()/2, n); + } + + std::cout << "vector fill: " << t.elapsed() << std::endl; + + std::multiset m; + for (int n = 0; n < niters; ++n) + { + m.insert(&v[n]); + } + std::cout << "map fill 1: " << t.elapsed() << std::endl; + for (int n = 0; n < niters; ++n) + { + m.insert(&v[n]); + } + std::cout << "map fill 2: " << t.elapsed() << std::endl; +} diff --git a/reactos/lib/3rdparty/stlport/test/eh/como-linux.mak b/reactos/lib/3rdparty/stlport/test/eh/como-linux.mak new file mode 100644 index 00000000000..530a62e2d04 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/como-linux.mak @@ -0,0 +1,69 @@ +# +# Note : this makefile has been tested for como-4.3.0.1+gcc-2.96 on Redhat 7.3 +# + +.SUFFIXES: +.SUFFIXES: .cc .cpp .o .exe .out + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +TEST = ./eh_test.out + +CC = como +CXX = $(CC) + +CXXFLAGS = -DLIBCIO= --diag_suppress=68 -D__null=0L -D__GNUG__ -D_STLP_DEBUG -I${STL_INCL} -I. ${CXX_EXTRA_FLAGS} + +LIBS = -L../../lib -lstlport_como_stldebug -lpthread -lm +LIBSTDCXX = + +check: $(TEST) + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H -o $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.out *.o *.ii *.ti diff --git a/reactos/lib/3rdparty/stlport/test/eh/como.mak b/reactos/lib/3rdparty/stlport/test/eh/como.mak new file mode 100644 index 00000000000..a4ec20ca559 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/como.mak @@ -0,0 +1,67 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +TEST = ./eh_test.out + +CC = e:\lang\como\bin\como +CXX = $(CC) + +# __COMO__ appears not to be defined automatically ;( +CXXFLAGS = -D__COMO__ -D_MSC_VER=1200 --exceptions --microsoft -D_STLP_DEBUG -I${STL_INCL} -I. ${CXX_EXTRA_FLAGS} + +LIBS = -lm +LIBSTDCXX = + +check: $(TEST) + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H -o $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/cray.mak b/reactos/lib/3rdparty/stlport/test/eh/cray.mak new file mode 100644 index 00000000000..418a4cae6b1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/cray.mak @@ -0,0 +1,56 @@ + +SHELL=/bin/sh + +# srcdir = . +# VPATH = . + +STL_INCL=-I${PWD}/../../stlport/ + +AUX_LIST=TestClass.o main.o nc_alloc.o random_number.o + +TEST_LIST=test_algo.o \ +test_algobase.o test_list.o test_slist.o \ +test_bit_vector.o test_vector.o \ +test_deque_cray.o test_set.o test_map.o \ +test_hash_map.o test_hash_set.o test_rope.o \ +test_string.o test_bitset.o test_valarray.o + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST) +EXECS = $(LIST:%.o=%) +TESTS = $(LIST:%.o=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = CC +CXX = $(CC) + +#CXXFLAGS = -hexceptions -DEH_DELETE_HAS_THROW_SPEC -I. ${STL_INCL} ${DEBUG_FLAGS} +CXXFLAGS = -D_STLP_HAS_NO_EXCEPTIONS -I. ${STL_INCL} ${DEBUG_FLAGS} + +#LIBS = -L../../lib -lstlportx -lpthread +LIBS = -L../../lib -lstlport -lpthread + +.SUFFIXES: .cpp .i .o .out + +check: $(TEST) + +$(TEST) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(LIBS) $(OBJECTS) -o $(TEST_EXE) + ./$(TEST_EXE) -s 100 + +.cpp.o: + $(CXX) $(CXXFLAGS) $< -c -o $@ + +.cpp.i: + $(CXX) $(CXXFLAGS) $< -E > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $*.cpp -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $(LIBS) $*.o -o $* + ./$* -q + -rm -f $* + +clean: + -rm -fr ${TEST_EXE} *.o *.ii *.out core diff --git a/reactos/lib/3rdparty/stlport/test/eh/cygwin.mak b/reactos/lib/3rdparty/stlport/test/eh/cygwin.mak new file mode 100644 index 00000000000..582c219e0dc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/cygwin.mak @@ -0,0 +1,123 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = c++ +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_cygwin_stldebug +LIBSTLPORT = -L../../lib -lstlport_cygwin + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + echo "Cygwin has bugs in exception handling, runnning w/o throwing exceptions..." + ./$(TEST_EXE) -e + +$(D_TEST) : $(D_TEST_EXE) + echo "Cygwin has bugs in exception handling, runnning w/o throwing exceptions..." + ./$(D_TEST_EXE) -e + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + echo "Cygwin has bugs in exception handling, runnning w/o throwing exceptions..." + ./$(NOSGI_TEST_EXE) -e + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -D_STLP_DEBUG -D_REENTRANT -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(D_LIBSTLPORT) $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/deccxx.mak b/reactos/lib/3rdparty/stlport/test/eh/deccxx.mak new file mode 100644 index 00000000000..5b986e87eea --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/deccxx.mak @@ -0,0 +1,73 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +SHELL=/bin/sh + +# srcdir = . +# VPATH = . + + +# point this to proper location +STL_INCL= -I../../stlport + +# STL_INCL= -DEH_NO_SGI_STL + +AUX_LIST=TestClass.o main.o nc_alloc.o random_number.o + +TEST_LIST=test_algo.o \ +test_algobase.o test_list.o test_slist.o \ +test_bit_vector.o test_vector.o \ +test_deque.o test_set.o test_map.o \ +test_hash_map.o test_hash_set.o test_rope.o \ +test_string.o test_bitset.o test_valarray.o + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST) +EXECS = $(LIST:%.o=%) +TESTS = $(LIST:%.o=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = cxx +CXX = $(CC) + +# -std strict_ansi_errors + +CXXFLAGS = ${STL_INCL} -std strict_ansi_errors -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC -gall + +# CXXFLAGS = ${STL_INCL} -std strict_ansi_errors -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + +# This is to test with native STL +# CXXFLAGS = +w2 -xildoff -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + + +LIBS = -L../../lib -lstlport_dec -lm +LIBSTDCXX = + +.SUFFIXES: .cpp .i .o .out .res + +check: $(TEST) + +$(TEST) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100 + +.cpp.o: + $(CXX) $(CXXFLAGS) $< -c -o $@ + +.cpp.i: + $(CXX) $(CXXFLAGS) $< -E > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $*.cpp -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* -q + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $*.cpp -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache cxx_repository diff --git a/reactos/lib/3rdparty/stlport/test/eh/descrip.mms b/reactos/lib/3rdparty/stlport/test/eh/descrip.mms new file mode 100644 index 00000000000..39f4faebbca --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/descrip.mms @@ -0,0 +1,54 @@ +# ;;; -*- Mode:makefile;-*- +# Generated manually for MMS + +# point this to proper location +STL_INCL= /include="../../stlport" + + +# STL_INCL= -DEH_NO_SGI_STL + +.SUFFIXES .obj .cpp + +all : check + +AUX_LIST=TestClass.obj,main.obj,nc_alloc.obj,random_number.obj + +TEST_LIST=test_algo.obj,- +test_algobase.obj,test_list.obj,test_slist.obj,- +test_bit_vector.obj,test_vector.obj,- +test_deque.obj,test_set.obj,test_map.obj,- +test_hash_map.obj,test_hash_set.obj,test_rope.obj,- +test_string.obj,test_bitset.obj,test_valarray.obj + +LIST=$(AUX_LIST),$(TEST_LIST) + +OBJECTS = $(LIST) +EXECS = $(LIST:%.obj=%.exe) +TESTS = $(LIST:%.obj=%.out) +TEST_EXE = eh_test.exe +TEST = eh_test.out + +CC = cxx +CXX = $(CC) +LINK = cxxlink + +# -std strict_ansi_errors + +CXXFLAGS = $(STL_INCL) /define=(__NO_USE_STD_IOSTREAM,EH_VECTOR_OPERATOR_NEW,EH_DELETE_HAS_THROW_SPEC) + +# This is to test with native STL +# CXXFLAGS = +w2 -xildoff -D__STL_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + + +LIBS = +LIBSTDCXX = + +check : $(TEST) + +$(TEST) : $(OBJECTS) + $(LINK)/exe=$(TEST_EXE) $(OBJECTS) $(LIBS) + run $(TEST_EXE) + +.cpp.obj : + $(CXX) $(CXXFLAGS) /obj=$@ $< + diff --git a/reactos/lib/3rdparty/stlport/test/eh/djgpp.mak b/reactos/lib/3rdparty/stlport/test/eh/djgpp.mak new file mode 100644 index 00000000000..dcf638a28b6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/djgpp.mak @@ -0,0 +1,121 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = gcc +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -ftemplate-depth-32 -mbnu210 -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_NO_SGI_IOSTREAMS +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_SGI_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lstdcxx -lm +D_LIBSTLPORT = ../../lib/libstlport_djgpp_debug_static.a +LIBSTLPORT = ../../lib/libstlport_djgpp_stldebug_static.a + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +$(D_TEST) : $(D_TEST_EXE) + $(D_TEST_EXE) + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/egcs.mak b/reactos/lib/3rdparty/stlport/test/eh/egcs.mak new file mode 100644 index 00000000000..d622835b3d8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/egcs.mak @@ -0,0 +1,75 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +TEST = ./eh_test.out + +CC = egcs-c++ +CXX = $(CC) + +# for egcs +REPO_FLAGS = + +# CXXFLAGS = -g -Wall -I${STL_INCL} -I. -D_STLP_USE_NEWALLOC -D_STLP_DEBUG_ALLOC ${REPO_FLAGS} -DEH_NEW_HEADERS + +# CXXFLAGS = -Wall -ansi -I${STL_INCL} -I. -D_STLP_DEBUG ${REPO_FLAGS} ${CXX_EXTRA_FLAGS} +CXXFLAGS = -Wall -g -D_STLP_USE_NEWALLOC -DNO_FAST_ALLOCATOR -ansi -I${STL_INCL} -I. ${REPO_FLAGS} ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_NO_DEBUG_EXCEPTIONS + +# CXXFLAGS = -Wall -I${STL_INCL} -I. -D_STLP_USE_NEWALLOC ${REPO_FLAGS} ${CXX_EXTRA_FLAGS} + + +LIBS = -lm +LIBSTDCXX = + +check: $(TEST) + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H -o $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} $(OBJDIR) $(D_OBJDIR) $(NOSGI_OBJDIR) *.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/export b/reactos/lib/3rdparty/stlport/test/eh/export new file mode 100644 index 00000000000..7dec9847f62 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/export @@ -0,0 +1,37 @@ +LeakCheck.h +Prefix.h +SortClass.h +TestClass.cpp +TestClass.h +Tests.h +ThrowCompare.h +export +gcc.mak +main.cpp +nc_alloc.cpp +nc_alloc.h +random_number.cpp +random_number.h +sunpro.mak +test_algo.cpp +test_algobase.cpp +test_assign_op.h +test_bit_vector.cpp +test_bitset.cpp +test_construct.h +test_deque.cpp +test_hash_map.cpp +test_hash_resize.h +test_hash_set.cpp +test_insert.h +test_list.cpp +test_map.cpp +test_push_back.h +test_push_front.h +test_rope.cpp +test_set.cpp +test_slist.cpp +test_string.cpp +test_valarray.cpp +test_vector.cpp +vc.mak diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-99r1.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-99r1.mak new file mode 100644 index 00000000000..482763f1634 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-99r1.mak @@ -0,0 +1,109 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC =c++ +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -g -D_STLP_HAS_NO_NAMESPACES +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG +NOSGI_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + $(D_TEST_EXE) + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -O2 -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $* + ./$* > $@ + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} $(D_TEST_EXE) *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-amigaos-m68k.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-amigaos-m68k.mak new file mode 100644 index 00000000000..fc1e2abbd18 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-amigaos-m68k.mak @@ -0,0 +1,119 @@ +# +# This requires GNU make. +# + +srcdir = . +VPATH = . +SHELL = /bin/sh + +# point this to proper location +STL_INCL = -I../../stlport + +AUX_LIST = TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST = test_algo.cpp \ + test_algobase.cpp test_list.cpp test_slist.cpp \ + test_bit_vector.cpp test_vector.cpp \ + test_deque.cpp test_set.cpp test_map.cpp \ + test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ + test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST = ${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = gcc +CXX = g++ + +CXXFLAGS = -s -noixemul -m68020 -Wall -O2 ${STL_INCL} -I. -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-apple-macosx.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-apple-macosx.mak new file mode 100644 index 00000000000..5b40abdbadc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-apple-macosx.mak @@ -0,0 +1,122 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . +SHELL=/bin/sh + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = g++ +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $* + ./$* > $@ +# -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-freebsd.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-freebsd.mak new file mode 100644 index 00000000000..095add21cce --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-freebsd.mak @@ -0,0 +1,123 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . +SHELL=/bin/sh + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = c++ -pthread +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW + +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-hp11.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-hp11.mak new file mode 100644 index 00000000000..8c6b0a9d1f0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-hp11.mak @@ -0,0 +1,123 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . +SHELL=/bin/sh + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +# CC = g++ -pthreads +CC = g++ -D_REENTRANT -D_POSIX_C_SOURCE=199506L -D__EXTENSIONS__ +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lpthread -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -D_STLP_DEBUG -D_STLP_NO_OWN_IOSTREAMS -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $* + ./$* > $@ +# -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-irix.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-irix.mak new file mode 100644 index 00000000000..d9688eaf0d4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-irix.mak @@ -0,0 +1,122 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . +SHELL=/bin/sh + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = g++ +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir obj +$(NOSGI_OBJDIR): + mkdir obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -D_STLP_DEBUG -D_STLP_NO_OWN_IOSTREAMS -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $* + ./$* > $@ +# -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-linux.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-linux.mak new file mode 100644 index 00000000000..3866d37c622 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-linux.mak @@ -0,0 +1,120 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. +SHELL=/bin/sh + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = c++ -pthread +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -USINGLE -DMAIN -o $*.o + $(CXX) $(D_CXXFLAGS) $*.o $(LIBS) $(D_LIBSTLPORT) -o $* + ./$* > $@ +# -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc-netbsd.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc-netbsd.mak new file mode 100644 index 00000000000..4f9504ecf5f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc-netbsd.mak @@ -0,0 +1,122 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . +SHELL=/bin/sh + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = c++ +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm -lpthread +D_LIBSTLPORT = -L../../lib -R../../lib -lstlport_gcc_stldebug +LIBSTLPORT = -L../../lib -R../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc.mak new file mode 100644 index 00000000000..7e0c50a5fb2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc.mak @@ -0,0 +1,122 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . +SHELL=/bin/sh + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = g++ -pthread +CXX = $(CC) + +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +OBJDIR=obj +D_OBJDIR=d_obj +NOSGI_OBJDIR=nosgi_obj + +$(OBJDIR): + mkdir obj +$(D_OBJDIR): + mkdir d_obj +$(NOSGI_OBJDIR): + mkdir nosgi_obj + +$(TEST_EXE) : $(OBJDIR) $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + +$(TEST) : $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100 + +$(D_TEST) : $(D_TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100 + + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $* + ./$* > $@ +# -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/gcc7.mak b/reactos/lib/3rdparty/stlport/test/eh/gcc7.mak new file mode 100644 index 00000000000..33160c4da27 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/gcc7.mak @@ -0,0 +1,93 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = c++ +CXX = $(CC) + +CXXFLAGS = -Wall -fhandle-exceptions -g ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED + +check: $(TEST) + +LIBS = -lm +D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug +LIBSTLPORT = -L../../lib -lstlport_gcc + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +$(D_TEST) : $(D_TEST_EXE) + $(D_TEST_EXE) + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/hp.mak b/reactos/lib/3rdparty/stlport/test/eh/hp.mak new file mode 100644 index 00000000000..8ae7e6bf4f1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/hp.mak @@ -0,0 +1,81 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +# SHELL=/bin/sh +# srcdir = . +# VPATH = . + + +# point this to proper location +STL_INCL= -I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +OBJECTS = test_algo.o \ +test_algobase.o test_list.o test_slist.o \ +test_bit_vector.o test_vector.o \ +test_deque.o test_set.o test_map.o \ +test_hash_map.o test_hash_set.o test_rope.o \ +test_string.o test_bitset.o test_valarray.o + +LIST=${AUX_LIST} ${TEST_LIST} + +# OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = CC +CXX = $(CC) + +CXXFLAGS = -w ${STL_INCL} -D_STLP_NO_CUSTOM_IO + +LIBS = -lm + +LIBSTLPORT = -L../../lib -lstlport_hp + +check: $(TEST) + +all: $(TEST_EXE) + echo done. + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE) + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +SUFFIXES: .cpp .o .i .s .out .res .y + +.cpp.o : + $(CXX) $(CXXFLAGS) $< -c -o $@ + +.cpp.i : + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +.cpp.out: + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* -q + -rm -f $* + +.cpp.s: + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache + + + + + + diff --git a/reactos/lib/3rdparty/stlport/test/eh/hpacc.mak b/reactos/lib/3rdparty/stlport/test/eh/hpacc.mak new file mode 100644 index 00000000000..fea29044eb7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/hpacc.mak @@ -0,0 +1,119 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +srcdir = . +VPATH = . + +# point this to proper location +STL_INCL=-I../../stlport + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE) +D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE) +NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE) + +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = ./eh_test +D_TEST_EXE = ./eh_test_d +NOSGI_TEST_EXE = ./eh_test_nosgi + +TEST = ./eh_test.out +D_TEST = ./eh_test_d.out +NOSGI_TEST = ./eh_test_nosgi.out + +CC = aCC +CXX = $(CC) + +CXX_EXTRA_FLAGS = -AA -DEH_DELETE_HAS_THROW_SPEC +# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS +# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails +# in the assembler with 'invalid relocation type' +CXXFLAGS = -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW +D_CXXFLAGS = -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB +NOSGI_CXXFLAGS = -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW + +check: $(TEST) + +HP_VERSION=$(shell uname -r) +ifeq (${HP_VERSION},B.10.20) +PTHREAD_LIB=-lcma +else +PTHREAD_LIB=-lpthread +nostl +endif + +LIBS = $(PTHREAD_LIB) -lm + +D_LIBSTLPORT = -L../../lib -lstlport_aCC_debug +LIBSTLPORT = -L../../lib -lstlport_aCC + +all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE) + +check_nosgi: $(NOSGI_TEST) +check_d: $(D_TEST) + + +$(TEST_EXE) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE) + +$(D_TEST_EXE) : $(D_OBJECTS) + $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE) + +$(NOSGI_TEST_EXE) : $(NOSGI_OBJECTS) + $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE) + + +$(TEST) : $(TEST_EXE) + $(TEST_EXE) + +$(D_TEST) : $(D_TEST_EXE) + $(D_TEST_EXE) + +$(NOSGI_TEST) : $(NOSGI_TEST_EXE) + $(NOSGI_TEST_EXE) + +SUFFIXES: .cpp.o.exe.out.res + +nosgi_obj/%.o : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@ + +d_obj/%.o : %.cpp + $(CXX) $(D_CXXFLAGS) $< -c -o $@ + +obj/%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +nosgi_obj/%.i : %.cpp + $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/intel.mak b/reactos/lib/3rdparty/stlport/test/eh/intel.mak new file mode 100644 index 00000000000..edc50eca176 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/intel.mak @@ -0,0 +1,69 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +RSC=rc.exe +CPP=icl.exe +F90=fl32.exe + +OUTDIR=. +INTDIR=. + +# set this directories +STL_INCL=../../stlport +VC_INCL=. +# d:/vc41/msdev/include + +Dep_stl = TestClass.obj main.obj nc_alloc.obj \ +random_number.obj test_algo.obj test_algobase.obj test_bit_vector.obj test_deque.obj \ +test_hash_map.obj test_hash_set.obj test_list.obj test_map.obj test_rope.obj test_set.obj \ +test_slist.obj test_vector.obj test_string.obj test_bitset.obj test_valarray.obj + +LINK32=link.exe + +CPP_PROJ=/nologo /W3 /GX /D "WIN32" /MTd /Zi /Gm /Od /D "_CONSOLE" /I$(STL_INCL) /I. /D_DEBUG + +CPP_LIBS = /link /libpath:"..\..\lib" + +check: eh_test.out + +eh_test.out : $(Dep_stl) + $(CPP) $(CPP_PROJ) $(Dep_stl) -o eh_test.exe $(CPP_LIBS) + .\eh_test.exe + echo done + +clean : + -@erase "$(INTDIR)\*.obj" + -@erase "$(OUTDIR)\*.exe" + -@erase "$(OUTDIR)\*.obj" + + +.exe.out: + $< > $@ + +.cpp.exe: + $(CPP) $(CPP_PROJ) -DMAIN $< $(CPP_LIBS) + +.c.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cpp.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cxx.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cpp.E: + $(CPP) $(CPP_PROJ) -E $< >$*.E + +.cpp.sbr: + $(CPP) $(CPP_PROJ) $< diff --git a/reactos/lib/3rdparty/stlport/test/eh/intel45.mak b/reactos/lib/3rdparty/stlport/test/eh/intel45.mak new file mode 100644 index 00000000000..f605eeffb5a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/intel45.mak @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +RSC=rc.exe +CPP=icl.exe +LINK32=xilink.exe + +OUTDIR=. +INTDIR=. + +# set this directories +STL_PATH=..\.. + +Dep_stl = TestClass.obj main.obj nc_alloc.obj \ +random_number.obj test_algo.obj test_algobase.obj test_bit_vector.obj test_deque.obj \ +test_hash_map.obj test_hash_set.obj test_list.obj test_map.obj test_rope.obj test_set.obj \ +test_slist.obj test_vector.obj test_string.obj test_bitset.obj test_valarray.obj + +CPP_LIBS = /link /incremental:no /LIBPATH:$(STL_PATH)\lib + +#disable warnings complaining about debug ...info exceeded.... +CPP_PRJ_EXTRA = /Qwd985 +CPP_PRJ_CMN = /nologo /W3 /GR /GX /DWIN32 /D_WINDOWS /D_CONSOLE /I$(STL_PATH)\stlport /I. + +# +LIBTYPE = STATIC +# LIBTYPE = DYNAMIC +# +#DEBUG = STL +DEBUG = ON +#DEBUG = +# +IOS = SGI +#IOS = NOSGI +#IOS = NONE + +!IF "$(IOS)" == "NOSGI" +CPP_PRJ_IOS = /D_STLP_NO_OWN_IOSTREAMS +!ELSEIF "$(IOS)" == "NONE" +CPP_PRJ_IOS = /D_STLP_NO_IOSTREAM +!ELSE +CPP_PRJ_IOS = +!ENDIF + +#MT/MD etc should be LAST in CPP_PRJ_LIBTYP string!!! +#Library selection should be BEFORE debug processing!!! +!IF "$(LIBTYPE)" == "STATIC" +CPP_PRJ_LIBTYP = /MT +!ELSE +CPP_PRJ_LIBTYP = /MD +!ENDIF + +!IF "$(DEBUG)" == "" +CPP_PRJ_DBG = /DNDEBUG /O2 /Qsox- +!ELSE +CPP_PRJ_LIBTYP = $(CPP_PRJ_LIBTYP)d +CPP_PRJ_DBG = /D_DEBUG /Od +!IF "$(DEBUG)" == "STL" +CPP_PRJ_DBG = $(CPP_PRJ_DBG) /D_STLP_DEBUG +!ENDIF +CPP_PRJ_CMN = $(CPP_PRJ_CMN) /Zi /Gm +!ENDIF + +CPP_PROJ = $(CPP_PRJ_CMN) $(CPP_PRJ_EXTRA) $(CPP_PRJ_IOS) $(CPP_PRJ_LIBTYP) $(CPP_PRJ_DBG) + +check: eh_test.out + +eh_test.out : $(Dep_stl) + $(CPP) $(CPP_PROJ) $(Dep_stl) /Feeh_test.exe $(CPP_LIBS) + cd ..\..\lib + ..\test\eh\eh_test.exe -s 100 + echo done + +clean : + -@erase "$(INTDIR)\*.obj" + -@erase "$(OUTDIR)\*.exe" + -@erase "$(OUTDIR)\*.obj" + + +.exe.out: + $< > $@ + +.cpp.exe: + $(CPP) $(CPP_PROJ) -DMAIN $< + +.c.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cpp.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cxx.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cpp.E: + $(CPP) $(CPP_PROJ) -E $< >$*.E + +.cpp.sbr: + $(CPP) $(CPP_PROJ) $< diff --git a/reactos/lib/3rdparty/stlport/test/eh/intel50.mak b/reactos/lib/3rdparty/stlport/test/eh/intel50.mak new file mode 100644 index 00000000000..ea1d1d09530 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/intel50.mak @@ -0,0 +1,115 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +RSC=rc.exe +CPP=icl.exe +LINK32=xilink.exe + +OUTDIR=. +INTDIR=. + +# set this directories +STL_PATH=..\.. + +Dep_stl = TestClass.obj main.obj nc_alloc.obj \ +random_number.obj test_algo.obj test_algobase.obj test_bit_vector.obj test_deque.obj \ +test_hash_map.obj test_hash_set.obj test_list.obj test_map.obj test_rope.obj test_set.obj \ +test_slist.obj test_vector.obj test_string.obj test_bitset.obj test_valarray.obj + +# linker finds proper STLport lib automatically, only path to the library is needed +CPP_PRJ_LINK = /link /incremental:no /LIBPATH:$(STL_PATH)\lib + +#disable warnings complaining about debug ...info exceeded.... +CPP_PRJ_EXTRA = /Qwd985 +CPP_PRJ_CMN = /nologo /W3 /GR /GX /DWIN32 /D_WINDOWS /D_CONSOLE /I$(STL_PATH)\stlport /I. + +# +LIBTYPE = STATIC +# LIBTYPE = DYNAMIC +# +#DEBUG = STL +DEBUG = ON +#DEBUG = +# +IOS = SGI +#IOS = NOSGI +#IOS = NONE + +!IF "$(IOS)" == "NOSGI" +CPP_PRJ_IOS = /D_STLP_NO_SGI_IOSTREAMS +!ELSEIF "$(IOS)" == "NONE" +CPP_PRJ_IOS = /D_STLP_NO_IOSTREAM +!ELSE +CPP_PRJ_IOS = +!ENDIF + +#MT/MD etc should be LAST in CPP_PRJ_LIBTYP string!!! +#Library selection should be BEFORE debug processing!!! +!IF "$(LIBTYPE)" == "STATIC" +CPP_PRJ_LIBTYP = /D_STLP_USE_STATIC_LIB /MT +!ELSE +CPP_PRJ_LIBTYP = /D_STLP_USE_DYNAMIC_LIB /MD +!ENDIF + +!IF "$(DEBUG)" == "" +CPP_PRJ_DBG = /DNDEBUG /O2 /Qsox- +!ELSE +CPP_PRJ_LIBTYP = $(CPP_PRJ_LIBTYP)d +CPP_PRJ_DBG = /D_DEBUG /Od +!IF "$(DEBUG)" == "STL" +CPP_PRJ_DBG = $(CPP_PRJ_DBG) /D_STLP_DEBUG +!ENDIF +CPP_PRJ_CMN = $(CPP_PRJ_CMN) /Zi /Gm +!ENDIF + +CPP_IGNORE_LIB = LIBCMT +#CPP_PRJ_LINK = $(CPP_PRJ_LINK) /NODEFAULTLIB:$(CPP_IGNORE_LIB) +CPP_PRJ_LINK = $(CPP_PRJ_LINK) /VERBOSE:LIB + +CPP_PROJ = $(CPP_PRJ_CMN) $(CPP_PRJ_EXTRA) $(CPP_PRJ_IOS) $(CPP_PRJ_LIBTYP) $(CPP_PRJ_DBG) + +check: eh_test.out + +eh_test.out : $(Dep_stl) + $(CPP) $(CPP_PROJ) $(Dep_stl) /Feeh_test.exe $(CPP_PRJ_LINK) +# fbp : this is to locate DLL + cd ..\..\lib + ..\test\eh\eh_test.exe -s 100 + echo done + +clean : + -@erase "$(INTDIR)\*.obj" + -@erase "$(OUTDIR)\*.exe" + -@erase "$(OUTDIR)\*.obj" + + +.exe.out: + $< > $@ + +.cpp.exe: + $(CPP) $(CPP_PROJ) -DMAIN $< $(CPP_PRJ_LINK) + +.c.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cpp.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cxx.obj: + $(CPP) $(CPP_PROJ) /c $< + +.cpp.E: + $(CPP) $(CPP_PROJ) -E $< >$*.E + +.cpp.sbr: + $(CPP) $(CPP_PROJ) $< diff --git a/reactos/lib/3rdparty/stlport/test/eh/kai.mak b/reactos/lib/3rdparty/stlport/test/eh/kai.mak new file mode 100644 index 00000000000..8ce85b9712b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/kai.mak @@ -0,0 +1,65 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. + +# point this to proper location +STL_INCL= -I../../stlport +# STL_INCL= -DEH_NO_SGI_STL + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +# TEST_LIST=test_deque.cpp + + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = KCC +CXX = $(CC) + +CXXFLAGS = -w -mt --one_per ${STL_INCL} -D_STLP_USE_NEWALLOC -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + +# This is to test with native STL +# CXXFLAGS = -w -mt --one_per -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + +# This is to test with STLport iostreams +LIBS = -L../../lib -lstlport_kcc -lm + +LIBSTDCXX = + +check: $(TEST) + +$(TEST) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + $(TEST_EXE) + +SUFFIXES: .cpp.o.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* -q + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache ti_files diff --git a/reactos/lib/3rdparty/stlport/test/eh/locale.cpp b/reactos/lib/3rdparty/stlport/test/eh/locale.cpp new file mode 100644 index 00000000000..1f5a1c54a2f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/locale.cpp @@ -0,0 +1,60 @@ +#include +#include +#include +#include + +using namespace std; + +void main() +{ + try + { + locale c_loc; + //locale sys(c_loc, "LC_TIME=UKR_UKR.OCP;LC_NUMERIC=RUS_RUS.OCP;LC_CTYPE=ukr_ukr.ocp;", locale::numeric | locale::time | locale::ctype); + locale sys(".ocp"); + locale::global(sys); + cin.imbue(sys); + cout.imbue(sys); + + cout<<"Locale name is: "<>value; + cout<& num_punct=use_facet >(cout.getloc()); + cout << num_punct.decimal_point() << '\n'; + const time_put > >& time_fac= + use_facet > > >(cout.getloc()); + time_fac.put(cout, cout, NULL, cur_time, 'x'); cout<<'\n'; + time_fac.put(cout, cout, NULL, cur_time, 'x', '#'); cout<<'\n'; + time_fac.put(cout, cout, NULL, cur_time, 'X'); cout<<'\n'; + time_fac.put(cout, cout, NULL, cur_time, 'c'); cout<<'\n'; + time_fac.put(cout, cout, NULL, cur_time, 'c', '#'); cout<<'\n'; + time_fac.put(cout, cout, NULL, cur_time, 'I'); cout<<'\n'; + + const ctype& char_type=use_facet >(cout.getloc()); + if(char_type.is(ctype_base::upper, '')) puts("Upper"); + if(char_type.is(ctype_base::lower, '¯')) puts("Lower"); + puts("Next"); + if(isupper('', cout.getloc())) puts("Upper"); + if(islower('¯', cout.getloc())) puts("Lower"); + /*for(int ch=128; ch<256; ch++) + printf("Character %c (%d) - upper %c, lower %c\n",(char)ch, ch,toupper((char)ch, cout.getloc()), tolower((char)ch, cout.getloc()));*/ + } + catch(exception &e) + { + cout<<"Exception fired:\n"< +# else +# include +#endif + +#if defined(macintosh)&&(!defined(__MRC__) && !defined(__SC__)) || defined (_MAC) && defined(__MWERKS__) + +# include +# include +# include + +# ifdef EH_NEW_HEADERS +# include +# include +# include +# else +# include +# include +# include +# endif + +# if defined (_STL_DEBUG) + +# if defined ( EH_USE_SGI_STL ) +// Override assertion behavior +# include +//# include +void STLPORT::__stl_debug_message(const char * format_str, ...) +{ + std::va_list args; + va_start( args, format_str ); + char msg[256]; + std::vsnprintf(msg, sizeof(msg)/sizeof(*msg) - 1, format_str, args ); + DebugStr( c2pstr(msg) ); +} +# else +/*=================================================================================== + __assertion_failed (override standard library function) + + EFFECTS: Breaks into the debugger and shows the assertion. This implementation + is Mac-specific; others could be added for other platforms. +====================================================================================*/ +extern "C" +{ + void __assertion_failed(char *condition, char *testfilename, int lineno); + void __assertion_failed(char *condition, char *testfilename, int lineno) + { + char msg[256]; + std::strncpy( msg, condition, 255 ); + std::strncat( msg, ": ", 255 ); + std::strncat( msg, testfilename, 255 ); + std::strncat( msg, ", ", 255 ); + char line[20]; + std::sprintf( line, "%d", lineno ); + std::strncat( msg, line, 255 ); + DebugStr( c2pstr( msg ) ); + } +} +# endif + +# endif + +#endif + +#include "nc_alloc.h" + +#if defined (EH_NEW_HEADERS) +# include +# include +# else +# include +# include +#endif + +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#ifdef __BORLANDC__ +# include +#endif + +# if defined(EH_USE_NAMESPACES) +namespace // dwa 1/21/00 - must use unnamed namespace here to avoid conflict under gcc using native streams +{ + using namespace std; + // using std::cerr; + // using std::endl; +} +# endif + + +/*=================================================================================== + usage (file-static helper) + + EFFECTS: Prints a message describing the command-line parameters +====================================================================================*/ +static void usage(const char* name) +{ + cerr<<"Usage : "<] [-s ] [-l] [-e] [-q]/[-v] [-t] [test_name...]\n"; + cerr<<"\t[-n ] : number of test iterations, default==100;"<] : base value for random container sizes, default==1000;"< +#else +# include +#endif + +#if defined(_WIN32_WCE) +#include +#endif + +int _STLP_CALL main(int argc, char** argv) +{ +#if defined(_WIN32_WCE) + std::ofstream file( "\\eh_test.txt" ); + std::streambuf* old_cout_buf = cout.rdbuf(file.rdbuf()); + std::streambuf* old_cerr_buf = cerr.rdbuf(file.rdbuf()); +#endif +#if defined( __MWERKS__ ) && defined( macintosh ) // Get command line. + argc = ccommand(&argv); + // Allow the i/o window to be repositioned. +// EH_STD::string s; +// getline(EH_STD::cin, s); +#endif + unsigned int niters=2; + bool run_all=true; + bool run_slist = false; + bool run_list = false; + bool run_vector = false; + bool run_bit_vector = false; + bool run_deque = false; + bool run_hash_map = false; + bool run_hash_set = false; + bool run_set = false; + bool run_map = false; + bool run_algo = false; + bool run_algobase = false; + bool run_rope = false; + bool run_string = false; + bool run_bitset = false; + bool run_valarray = false; + + int cur_argv; + char *p, *p1; +#if defined (EH_NEW_IOSTREAMS) + std::ios_base::sync_with_stdio(false); +#endif + + cerr << argv[0]<<" : Exception handling testsuite.\n"; + cerr.flush(); + + bool track_allocations = false; + // parse parameters : + // leak_test [-iterations] [-test] ... + for (cur_argv=1; cur_argv $@ + +d_obj/%.i : %.cpp + $(CXX) $(D_CXXFLAGS) $< -E -H > $@ + +obj/%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* > $@ + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +%.E: %.cpp + $(CXX) $(CXXFLAGS) -E $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB diff --git a/reactos/lib/3rdparty/stlport/test/eh/mwerks_console_OS_X.c b/reactos/lib/3rdparty/stlport/test/eh/mwerks_console_OS_X.c new file mode 100644 index 00000000000..a82e1e63aa5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/mwerks_console_OS_X.c @@ -0,0 +1,193 @@ +/* Metrowerks Standard Library + * Copyright © 1995-2002 Metrowerks Corporation. All rights reserved. + * + * $Date$ + * $Revision$ + */ + +#include +#include +#include +#include + +#if __MACH__ + short InstallConsole(short fd) + { + #pragma unused (fd) + + return 0; + } +#else + #include + + typedef int (*ReadPtr)(int, void *, __std(size_t)); + typedef int (*WritePtr)(int, const void *, __std(size_t)); + + static struct + { + Boolean isLoaded; + CFBundleRef theBundle; + ReadPtr theRead; + WritePtr theWrite; + } __msl_os_x; + + static OSErr __msl_CreateFrameworkBundleFromName(CFStringRef theFrameworkName, + CFBundleRef *theBundle) + { + OSErr theErr; + FSRef theRef; + CFURLRef theFrameworkURL; + CFURLRef theBundleURL; + + /* Find the folder containing all the frameworks */ + theErr = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, false, &theRef); + + if (theErr == noErr) + { + /* Turn the framework folder FSRef into a CFURL */ + theFrameworkURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &theRef); + + if (theFrameworkURL != NULL) + { + /* Create a CFURL pointing to the desired framework */ + theBundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, + theFrameworkURL, theFrameworkName, false); + + CFRelease(theFrameworkURL); + + if (theBundleURL != NULL) + { + /* Turn the CFURL into a bundle reference */ + *theBundle = CFBundleCreate(kCFAllocatorSystemDefault, theBundleURL); + + CFRelease(theBundleURL); + } + } + } + + return theErr; + } + + short InstallConsole(short fd) + { + #pragma unused (fd) + OSErr theErr; + short theResult; + + theResult = -1; + + /* Start with no bundle */ + __msl_os_x.isLoaded = false; + __msl_os_x.theBundle = NULL; + __msl_os_x.theRead = NULL; + __msl_os_x.theWrite = NULL; + + /* Create a bundle reference based on its name */ + theErr = __msl_CreateFrameworkBundleFromName(CFSTR("System.framework"), + &__msl_os_x.theBundle); + + if ((theErr == noErr) && (__msl_os_x.theBundle != NULL)) + { + theResult = 0; + + __msl_os_x.isLoaded = CFBundleLoadExecutable(__msl_os_x.theBundle); + + if (__msl_os_x.isLoaded) + { + /* Lookup the functions in the bundle by name */ + __msl_os_x.theRead = (ReadPtr) + CFBundleGetFunctionPointerForName(__msl_os_x.theBundle, CFSTR("read")); + __msl_os_x.theWrite = (WritePtr) + CFBundleGetFunctionPointerForName(__msl_os_x.theBundle, CFSTR("write")); + } + } + + return theResult; + } +#endif + +void RemoveConsole(void) +{ +#if !__MACH__ + if (__msl_os_x.theBundle != NULL) + { + if (__msl_os_x.isLoaded) + { + __msl_os_x.theRead = NULL; + __msl_os_x.theWrite = NULL; + + CFBundleUnloadExecutable(__msl_os_x.theBundle); + __msl_os_x.isLoaded = false; + } + + CFRelease(__msl_os_x.theBundle); + __msl_os_x.theBundle = NULL; + } +#endif +} + +long WriteCharsToConsole(char *buffer, long n) +{ +#if __MACH__ + return write(1, buffer, n); +#else + /* Call the function if it was found */ + if (__msl_os_x.theWrite == NULL) + return -1; + else + return __msl_os_x.theWrite(1, buffer, n); +#endif +} + +#if __MACH__ +long WriteCharsToErrorConsole(char *buffer, long n) +{ + return write(2, buffer, n); +} +#endif + +long ReadCharsFromConsole(char *buffer, long n) +{ +#if __MACH__ + return read(0, buffer, n); +#else + /* Call the function if it was found */ + if (__msl_os_x.theRead == NULL) + return -1; + else + return __msl_os_x.theRead(0, buffer, n); +#endif +} + +/* JWW - This code should never be reached, but it's needed for link purposes */ +char *__ttyname(long fildes) +{ +#pragma unused (fildes) + /* all streams have the same name */ + static char *__devicename = "Terminal"; + + if (fildes >= 0 && fildes <= 2) + return (__devicename); + + return (0L); +} + +int kbhit(void) +{ + return 0; +} + +int getch(void) +{ + return 0; +} + +void clrscr() +{ + return; +} + +/* Change record: + * JWW 010919 Created Mach-O console stubs file + * JWW 020418 Use __std() for all size_t, and #include to get proper C++ definitions + */ diff --git a/reactos/lib/3rdparty/stlport/test/eh/mwerks_debug_prefix.h b/reactos/lib/3rdparty/stlport/test/eh/mwerks_debug_prefix.h new file mode 100644 index 00000000000..68c1dc66c2f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/mwerks_debug_prefix.h @@ -0,0 +1,8 @@ +//mwerks_debug_prefix.h +#define _STLP_NO_FORCE_INSTANTIATE 1// for debugging +#define EH_VECTOR_OPERATOR_NEW 1 +#define _STLP_DEBUG 1 // enable the use of allocation debugging + +#if __MWERKS__ >= 0x3000 +#include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_debug_prefix.h b/reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_debug_prefix.h new file mode 100644 index 00000000000..665282507db --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_debug_prefix.h @@ -0,0 +1,5 @@ +//mwerks_nosgi_debug_prefix.h +#define _STLP_NO_SGI_IOSTREAMS 1 +#define _STLP_NO_FORCE_INSTANTIATE 1 // for debugging +#define _STLP_DEBUG_UNINITIALIZED 1 // enable the use of allocation debugging +#define EH_VECTOR_OPERATOR_NEW 1 diff --git a/reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_prefix.h b/reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_prefix.h new file mode 100644 index 00000000000..660fac2a504 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/mwerks_nosgi_prefix.h @@ -0,0 +1,5 @@ +//mwerks_nosgi_prefix.h +#define _STLP_NO_SGI_IOSTREAMS 1 +#define _STLP_NO_FORCE_INSTANTIATE 1 // for debugging +#define EH_VECTOR_OPERATOR_NEW 1 +#define NDEBUG 1 diff --git a/reactos/lib/3rdparty/stlport/test/eh/mwerks_prefix.h b/reactos/lib/3rdparty/stlport/test/eh/mwerks_prefix.h new file mode 100644 index 00000000000..111a4ad91fa --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/mwerks_prefix.h @@ -0,0 +1,8 @@ +//mwerks_prefix.h +#define _STLP_NO_FORCE_INSTANTIATE 1// for debugging +#define EH_VECTOR_OPERATOR_NEW 1 +#define NDEBUG 1 + +#if __MWERKS__ >= 0x3000 +#include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp b/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp new file mode 100644 index 00000000000..6234eab0e23 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/nc_alloc.cpp @@ -0,0 +1,328 @@ +/************************************************************************************************ + NC_ALLOC.CPP + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +************************************************************************************************/ + +#include "nc_alloc.h" +#include + +#if defined (EH_NEW_HEADERS) +# include +# include +# include +#else +# include +# include +# include +#endif + +#if defined (EH_NEW_IOSTREAMS) +# include +#else +# include +#endif + +long alloc_count = 0; +long object_count = 0; +long TestController::possible_failure_count = 0; +const char* TestController::current_test = ""; +const char* TestController::current_test_category = "no category"; +const char* TestController::current_container = 0; +bool TestController::nc_verbose = true; +bool TestController::never_fail = false; +bool TestController::track_allocations = false; +bool TestController::leak_detection_enabled = false; +TestController gTestController; + +//************************************************************************************************ +void TestController::maybe_fail(long) { + if (never_fail || Failure_threshold() == kNotInExceptionTest) + return; + + // throw if allocation would satisfy the threshold + if (possible_failure_count++ >= Failure_threshold()) { + // what about doing some standard new_handler() behavior here (to test it!) ??? + + // reset and simulate an out-of-memory failure + Failure_threshold() = kNotInExceptionTest; +#ifndef EH_NO_EXCEPTIONS + throw EH_STD::bad_alloc(); +#endif + } +} + +#if defined (EH_HASHED_CONTAINERS_IMPLEMENTED) +# if defined (__SGI_STL) +# if defined (EH_NEW_HEADERS) +# include +# else +# include +# endif +# elif defined (__MSL__) +# include +# else +# error what do I include to get hash_set? +# endif +#else +# if defined (EH_NEW_HEADERS) +# include +# else +# include +# endif +#endif + +#if !defined (EH_HASHED_CONTAINERS_IMPLEMENTED) +typedef EH_STD::set > allocation_set; +#else + +USING_CSTD_NAME(size_t) + +struct hash_void { + size_t operator()(void* x) const { return (size_t)x; } +}; + +typedef EH_STD::hash_set > allocation_set; +#endif + +static allocation_set& alloc_set() { + static allocation_set s; + return s; +} + +// Prevents infinite recursion during allocation +static bool using_alloc_set = false; + +#if !defined (NO_FAST_ALLOCATOR) +// +// FastAllocator -- speeds up construction of TestClass objects when +// TESTCLASS_DEEP_DATA is enabled, and speeds up tracking of allocations +// when the suite is run with the -t option. +// +class FastAllocator { +public: + //FastAllocator() : mFree(0), mUsed(0) {} + static void *Allocate(size_t s) { + void *result = 0; + + if (s <= sizeof(Block)) { + if (mFree != 0) { + result = mFree; + mFree = mFree->next; + } + else if (mBlocks != 0 && mUsed < kBlockCount) { + result = (void*)&mBlocks[mUsed++]; + } + } + return result; + } + + static bool Free(void* p) { + Block* b = (Block*)p; + if (mBlocks == 0 || b < mBlocks || b >= mBlocks + kBlockCount) + return false; + b->next = mFree; + mFree = b; + return true; + } + + struct Block; + friend struct Block; + + enum { + // Number of fast allocation blocks to create. + kBlockCount = 1500, + + // You may need to adjust this number for your platform. + // A good choice will speed tests. A bad choice will still work. + kMinBlockSize = 48 + }; + + struct Block { + union { + Block *next; + double dummy; // fbp - force alignment + char dummy2[kMinBlockSize]; + }; + }; + + static Block* mBlocks; + static Block *mFree; + static size_t mUsed; +}; + +FastAllocator::Block *FastAllocator::mBlocks = +(FastAllocator::Block*)EH_CSTD::calloc( sizeof(FastAllocator::Block), FastAllocator::kBlockCount ); +FastAllocator::Block *FastAllocator::mFree; +size_t FastAllocator::mUsed; + + +static FastAllocator gFastAllocator; +#endif + +inline char* AllocateBlock(size_t s) { +#if !defined (NO_FAST_ALLOCATOR) + char * const p = (char*)gFastAllocator.Allocate( s ); + if (p != 0) + return p; +#endif + + return (char*)EH_CSTD::malloc(s); +} + +static void* OperatorNew( size_t s ) { + if (!using_alloc_set) { + simulate_possible_failure(); + ++alloc_count; + } + + char *p = AllocateBlock(s); + + if (gTestController.TrackingEnabled() && + gTestController.LeakDetectionEnabled() && + !using_alloc_set) { + using_alloc_set = true; + bool inserted = alloc_set().insert(p).second; + // Suppress warning about unused variable. + inserted; + EH_ASSERT(inserted); + using_alloc_set = false; + } + + return p; +} + +void* _STLP_CALL operator new(size_t s) +#ifdef EH_DELETE_HAS_THROW_SPEC +throw(EH_STD::bad_alloc) +#endif +{ return OperatorNew( s ); } + +#ifdef EH_USE_NOTHROW +void* _STLP_CALL operator new(size_t size, const EH_STD::nothrow_t&) throw() { + try { + return OperatorNew( size ); + } + catch (...) { + return 0; + } +} +#endif + +#if 1 /* defined (EH_VECTOR_OPERATOR_NEW) */ +void* _STLP_CALL operator new[](size_t size ) throw(EH_STD::bad_alloc) { + return OperatorNew( size ); +} + +# ifdef EH_USE_NOTHROW +void* _STLP_CALL operator new[](size_t size, const EH_STD::nothrow_t&) throw() { + try { + return OperatorNew(size); + } + catch (...) { + return 0; + } +} +# endif + +void _STLP_CALL operator delete[](void* ptr) throw() +{ operator delete( ptr ); } +#endif + +#if defined (EH_DELETE_HAS_THROW_SPEC) +void _STLP_CALL operator delete(void* s) throw() +#else +void _STLP_CALL operator delete(void* s) +#endif +{ + if ( s != 0 ) { + if ( !using_alloc_set ) { + --alloc_count; + + if ( gTestController.TrackingEnabled() && gTestController.LeakDetectionEnabled() ) { + using_alloc_set = true; + allocation_set::iterator p = alloc_set().find( (char*)s ); + EH_ASSERT( p != alloc_set().end() ); + alloc_set().erase( p ); + using_alloc_set = false; + } + } +# if ! defined (NO_FAST_ALLOCATOR) + if ( !gFastAllocator.Free( s ) ) +# endif + EH_CSTD::free(s); + } +} + + +/*=================================================================================== + ClearAllocationSet (private helper) + + EFFECTS: Empty the set of allocated blocks. +====================================================================================*/ +void TestController::ClearAllocationSet() { + if (!using_alloc_set) { + using_alloc_set = true; + alloc_set().clear(); + using_alloc_set = false; + } +} + + +bool TestController::ReportLeaked() { + EndLeakDetection(); + + EH_ASSERT( !using_alloc_set || (alloc_count == static_cast(alloc_set().size())) ); + + if (alloc_count != 0 || object_count != 0) { + EH_STD::cerr<<"\nEH TEST FAILURE !\n"; + PrintTestName(true); + if (alloc_count) + EH_STD::cerr << "ERROR : " << alloc_count << " outstanding allocations.\n"; + if (object_count) + EH_STD::cerr << "ERROR : " << object_count << " non-destroyed objects.\n"; + alloc_count = object_count = 0; + return true; + } + return false; +} + + + +/*=================================================================================== + PrintTestName + + EFFECTS: Prints information about the current test. If err is false, ends with + an ellipsis, because the test is ongoing. If err is true an error is being + reported, and the output ends with an endl. +====================================================================================*/ + +void TestController::PrintTestName(bool err) { + if (current_container) + EH_STD::cerr<<"["< +#else +# include +#endif + +extern long alloc_count; +extern long object_count; + +struct TestController { + // Report that the current test has succeeded. + static void ReportSuccess(int); + + // + // Leak detection + // + + // Turn the recording of the addresses of individual allocated + // blocks on or off. If not called, allocations will only be + // counted, but deallocations won't be checked for validity. + static void TrackAllocations( bool ); + static bool TrackingEnabled(); + + // Call this to begin a new leak-detection cycle. Resets all + // allocation counts, etc. + static void BeginLeakDetection(); + + // Returns true iff leak detection is currently in effect + static bool LeakDetectionEnabled(); + + // Ends leak detection and reports any resource leaks. + // Returns true if any occurred. + static bool ReportLeaked(); + + // + // Exception-safety + // + + // Don't test for exception-safety + static void TurnOffExceptions(); + + // Set operator new to fail on the nth invocation + static void SetFailureCountdown( long n ); + + // Set operator new to never fail. + static void CancelFailureCountdown(); + + // Throws an exception if the count has been reached. Call this + // before every operation that might fail in the real world. + static void maybe_fail(long); + + // + // Managing verbose feedback. + // + + // Call to begin a strong, weak, or const test. If verbose + // reporting is enabled, prints the test category. + static void SetCurrentTestCategory( const char* str ); + + // Call to set the name of the container being tested. + static void SetCurrentContainer( const char* str ); + + // Sets the name of the current test. + static void SetCurrentTestName(const char* str); + + // Turn verbose reporting on or off. + static void SetVerbose(bool val); + +private: + enum { kNotInExceptionTest = -1 }; + + static void ClearAllocationSet(); + static void EndLeakDetection(); + static void PrintTestName( bool err=false ); + + static long& Failure_threshold(); + static long possible_failure_count; + static const char* current_test; + static const char* current_test_category; + static const char* current_container; + static bool nc_verbose; + static bool never_fail; + static bool track_allocations; + static bool leak_detection_enabled; +}; + +extern TestController gTestController; + +// +// inline implementations +// + +inline void simulate_possible_failure() { + gTestController.maybe_fail(0); +} + +inline void simulate_constructor() { + gTestController.maybe_fail(0); + ++object_count; +} + +inline void simulate_destructor() { + --object_count; +} + +inline void TestController::TrackAllocations(bool track) { + track_allocations = track; +} + +inline bool TestController::TrackingEnabled() { + return track_allocations; +} + +inline void TestController::SetFailureCountdown(long count) { + Failure_threshold() = count; + possible_failure_count = 0; +} + +inline void TestController::CancelFailureCountdown() { + Failure_threshold() = kNotInExceptionTest; +} + +inline void TestController::BeginLeakDetection() { + alloc_count = 0; + object_count = 0; + ClearAllocationSet(); + leak_detection_enabled = true; +} + +inline bool TestController::LeakDetectionEnabled() { + return leak_detection_enabled; +} + +inline void TestController::EndLeakDetection() { + leak_detection_enabled = false; +} + +inline void TestController::SetCurrentTestCategory(const char* str) { + current_test_category = str; + if (nc_verbose) + PrintTestName(); +} + +inline void TestController::SetCurrentContainer(const char* str) { + current_container=str; +} + +inline void TestController::SetCurrentTestName(const char* str) { + current_test = str; +} + +inline void TestController::SetVerbose(bool val) { + nc_verbose = val; +} + +inline void TestController::TurnOffExceptions() { + never_fail = true; +} + +#endif // INCLUDED_MOTU_nc_alloc diff --git a/reactos/lib/3rdparty/stlport/test/eh/random_number.cpp b/reactos/lib/3rdparty/stlport/test/eh/random_number.cpp new file mode 100644 index 00000000000..a5bf5986cb6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/random_number.cpp @@ -0,0 +1,39 @@ +/*********************************************************************************** + random_number.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "random_number.h" +#include "Prefix.h" +#if defined (EH_NEW_HEADERS) +# include +# include +#else +# include +# include +#endif + +unsigned random_number( size_t range ) +{ +#if !defined( __SGI_STL ) + if (range == 0) return 0; + return (unsigned)(EH_STD::rand() + EH_STD::rand()) % range; +#else + static EH_STD::subtractive_rng rnd; + if (range==0) return 0; + return rnd(range); +#endif +} + +// default base for random container sizes +unsigned random_base = 1000; diff --git a/reactos/lib/3rdparty/stlport/test/eh/random_number.h b/reactos/lib/3rdparty/stlport/test/eh/random_number.h new file mode 100644 index 00000000000..20754c17b03 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/random_number.h @@ -0,0 +1,27 @@ +/*********************************************************************************** + random_number.h + + * Copyright (c) 1997-1998 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef RANDOM_NUMBER_DWA120298_H_ +#define RANDOM_NUMBER_DWA120298_H_ + +#include + +// Return a random number in the given range. +unsigned random_number( size_t range ); + +// default base for random container sizes +extern unsigned random_base; + +#endif // #include guard diff --git a/reactos/lib/3rdparty/stlport/test/eh/sgi_mipspro.mak b/reactos/lib/3rdparty/stlport/test/eh/sgi_mipspro.mak new file mode 100644 index 00000000000..dd2db1af234 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/sgi_mipspro.mak @@ -0,0 +1,62 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +SHELL=/bin/sh + +# srcdir = . +# VPATH = . + + +STL_INCL=-I${PWD}/../../stlport/ + +# STL_INCL= -DEH_NO_SGI_STL + +AUX_LIST=TestClass.o main.o nc_alloc.o random_number.o + +TEST_LIST=test_algo.o \ +test_algobase.o test_list.o test_slist.o \ +test_bit_vector.o test_vector.o \ +test_deque.o test_set.o test_map.o \ +test_hash_map.o test_hash_set.o test_rope.o \ +test_string.o test_bitset.o test_valarray.o + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST) +EXECS = $(LIST:%.o=%) +TESTS = $(LIST:%.o=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = CC +CXX = $(CC) + +# CXXFLAGS = -J 4 -ansi -LANG:std -I. ${STL_INCL} ${DEBUG_FLAGS} -I. -D_STLP_NO_OWN_IOSTREAMS -D_STLP_NO_NEW_IOSTREAMS +CXXFLAGS = -J 4 -ansi -LANG:std -I. ${STL_INCL} ${DEBUG_FLAGS} -I. + +LIBS = -L../../lib -lstlport_mipspro -lm +LIBSTDCXX = + +.SUFFIXES: .cpp .i .o .out .res + +check: $(TEST) + +$(TEST) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100 + +.cpp.o: + $(CXX) $(CXXFLAGS) $< -c -o $@ + +.cpp.i: + $(CXX) $(CXXFLAGS) $< -E > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $*.cpp -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* -q + -rm -f $* + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache cxx_repository diff --git a/reactos/lib/3rdparty/stlport/test/eh/sunpro-64.mak b/reactos/lib/3rdparty/stlport/test/eh/sunpro-64.mak new file mode 100644 index 00000000000..773bf0af84e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/sunpro-64.mak @@ -0,0 +1,69 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + + +SHELL=/bin/sh + +# point this to proper location +STL_INCL= -I${PWD}/../../stlport + +# STL_INCL= -DEH_NO_SGI_STL + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = CC +CXX = $(CC) + +CXXFLAGS = ${STL_INCL} -xarch=v9 -library=no%Cstd -features=rtti -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC -xildoff -g -D_REENTRANT -DNO_FAST_ALLOCATOR + +# This is to test with native STL +# CXXFLAGS = +w2 -xildoff -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + + +LIBS = -lm +LIBSTDCXX = + +LIBSTLPORT = -library=no%Cstd -L../../lib -lstlport_sunpro64 + + +check: $(TEST) + +$(TEST) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE) + LD_LIBRARY_PATH="../../lib;${LD_LIBRARY_PATH}" ./$(TEST_EXE) -s 100 + +SUFFIXES: .cpp.o.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $* + ./$* -q + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache diff --git a/reactos/lib/3rdparty/stlport/test/eh/sunpro.mak b/reactos/lib/3rdparty/stlport/test/eh/sunpro.mak new file mode 100644 index 00000000000..682668fe0eb --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/sunpro.mak @@ -0,0 +1,71 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + + +SHELL=/bin/sh + +# point this to proper location +STL_INCL= -I${PWD}/../../stlport + +# STL_INCL= -DEH_NO_SGI_STL + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = CC +CXX = $(CC) + +# CXXFLAGS = ${STL_INCL} -library=no%Cstd -qoption ccfe -instlib=../../lib/libstlport_sunpro.so -features=rtti -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + +CXXFLAGS = ${STL_INCL} -library=no%Cstd -features=rtti -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + +# This is to test with native STL +# CXXFLAGS = +w2 -xildoff -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC + + +LIBS = -lm +LIBSTDCXX = + +LIBSTLPORT = -library=no%Cstd -L../../lib -lstlport_sunpro + + +check: $(TEST) + +$(TEST) : $(OBJECTS) + $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE) + LD_LIBRARY_PATH="../../lib;${LD_LIBRARY_PATH}" ./$(TEST_EXE) -s 100 + +SUFFIXES: .cpp.o.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBS) ${LIBSTLPORT} -o $* + LD_LIBRARY_PATH="../../lib;${LD_LIBRARY_PATH}" ./$* + + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache diff --git a/reactos/lib/3rdparty/stlport/test/eh/sunpro42.mak b/reactos/lib/3rdparty/stlport/test/eh/sunpro42.mak new file mode 100644 index 00000000000..6e58f6a897a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/sunpro42.mak @@ -0,0 +1,76 @@ +# ;;; -*- Mode:makefile;-*- +# Generated automatically from Makefile.in by configure. +# This requires GNU make. + +# SHELL=/bin/sh +# srcdir = . +# VPATH = . + +SHELL=/bin/sh + +# point this to proper location +STL_INCL= -I../../stlport + +# STL_INCL= -DEH_NO_SGI_STL + +AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp + +TEST_LIST=test_algo.cpp \ +test_algobase.cpp test_list.cpp test_slist.cpp \ +test_bit_vector.cpp test_vector.cpp \ +test_deque.cpp test_set.cpp test_map.cpp \ +test_hash_map.cpp test_hash_set.cpp test_rope.cpp \ +test_string.cpp test_bitset.cpp test_valarray.cpp + +LIST=${AUX_LIST} ${TEST_LIST} + +OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE) +EXECS = $(LIST:%.cpp=%) +TESTS = $(LIST:%.cpp=%.out) +TEST_EXE = eh_test +TEST = eh_test.out + +CC = CC +CXX = $(CC) + +CXXFLAGS = $(ARCHF) +w2 -mt -features=rtti ${STL_INCL} +# CXXFLAGS = +w2 ${STL_INCL} + + + +LIBS = -lm + +LIBSTLPORT = -L../../lib -lstlport_sunpro42 + +check: $(TEST) + +$(TEST) : $(OBJECTS) + echo 'Info: For CC 4.x, warnings from ld in the form "symbol `XXX' has differing sizes" are normal.' + $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE) + LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100 + +SUFFIXES: .cpp.o.out.res + +%.o : %.cpp + $(CXX) $(CXXFLAGS) $< -c -o $@ + +%.i : %.cpp + $(CXX) $(CXXFLAGS) $< -E -H > $@ + +%.out: %.cpp + $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o + $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $* + ./$* -q + -rm -f $* + +%.s: %.cpp + $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@ + +clean: + -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache + + + + + + diff --git a/reactos/lib/3rdparty/stlport/test/eh/test.cpp b/reactos/lib/3rdparty/stlport/test/eh/test.cpp new file mode 100644 index 00000000000..89943031b4c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test.cpp @@ -0,0 +1,42 @@ + #include + #include + #include + + template + inline void printElements(const T& coll, const char* msg = "") + { + typename T::const_iterator it; + std::cout << msg; + for(it = coll.begin(); it != coll.end(); ++it) { + std::cout << *it << ' '; + } + std::cout << std:: endl; + } + + int main(int /* argc */, char** /* argv */) + { + std::set set1, set2; + std::vector aVector; + + aVector.push_back(1); + aVector.push_back(1); + + set1.insert(aVector.begin(), aVector.end()); + + set2.insert(1); + set2.insert(1); + + printElements(aVector, "vector: "); + printElements(set1, "set1 : "); + printElements(set2, "set2 : "); + + return 0; + } +# if 0 +# include +main() +{ + // std::stringstream tstr; + std::cout<<"hello world\n"; +} +# endif diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_algo.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_algo.cpp new file mode 100644 index 00000000000..7ff905ba2e8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_algo.cpp @@ -0,0 +1,261 @@ +/*********************************************************************************** + test_algo.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#include "LeakCheck.h" +#include "SortClass.h" + +#if defined (EH_NEW_HEADERS) +# include +# include +#else +# include +# include +#endif + +#if defined (EH_NEW_IOSTREAMS) +# include +#else +# include +#endif + +// +// SortBuffer -- a buffer of SortClass objects that can be used to test sorting. +// +struct SortBuffer +{ + enum { kBufferSize = 100 }; + + SortClass* begin() { return items; } + const SortClass* begin() const { return items; } + SortClass* end() { return items + kBufferSize; } + const SortClass* end() const { return items + kBufferSize; } + + // Sort each half of the buffer and reset the address of each element + // so that merge() can be tested for stability. + void PrepareMerge() + { + EH_STD::sort( begin(), begin() + ( end() - begin() )/2 ); + EH_STD::sort( begin() + ( end() - begin() )/2, end() ); + for ( SortClass* p = begin(); p != end(); p++ ) + p->ResetAddress(); + } + + SortBuffer() + { + PrepareMerge(); + } + + SortBuffer( const SortBuffer& rhs ) + { + SortClass* q = begin(); + for ( const SortClass* p = rhs.begin() ; p != rhs.end(); p++,q++ ) + *q = *p; + } + +private: + SortClass items[kBufferSize]; +}; + +// +// less_by_reference -- a functor for comparing objects against a +// constant value. +// +template +struct less_by_reference +{ + less_by_reference( const T& arg ) : fArg(arg) {} + bool operator()( const T& x ) const { return x < fArg; } +private: + const T& fArg; +}; + +struct test_stable_partition +{ + test_stable_partition( const SortBuffer& buf ) + : orig( buf ), partitionPoint(SortClass::kRange / 2) { + gTestController.SetCurrentTestName("stable_partition()"); + } + + void operator()( SortBuffer& buf ) const + { + less_by_reference throw_cmp( partitionPoint ); + + SortClass* d = EH_STD::stable_partition( buf.begin(), buf.end(), throw_cmp ); + + // Suppress warning about unused variable. + d; + + // If we get here no exception occurred during the operation. + // Stop any potential failures that might occur during verification. + gTestController.CancelFailureCountdown(); + + // Prepare an array of counts of the occurrence of each value in + // the legal range. + unsigned counts[SortClass::kRange]; + EH_STD::fill_n( counts, (int)SortClass::kRange, 0 ); + for ( const SortClass *q = orig.begin(); q != orig.end(); q++ ) + counts[ q->value() ]++; + + less_by_reference cmp( partitionPoint ); + for ( const SortClass* p = buf.begin(); p != buf.end(); p++ ) + { + // Check that adjacent items with the same value haven't been + // reordered. This could be a more thorough test. + if ( p != buf.begin() && p->value() == p[-1].value() ) { + EH_ASSERT( p->GetAddress() > p[-1].GetAddress() ); + } + + // Check that the partitioning worked. + EH_ASSERT( (p < d) == cmp( *p ) ); + + // Decrement the appropriate count for each value. + counts[ p->value() ]--; + } + + // Check that the values were only rearranged, and none were lost. + for ( unsigned j = 0; j < SortClass::kRange; j++ ) { + EH_ASSERT( counts[j] == 0 ); + } + } + +private: + const SortBuffer& orig; + SortClass partitionPoint; +}; + +void assert_sorted_version( const SortBuffer& orig, const SortBuffer& buf ); + +/*=================================================================================== + assert_sorted_version + + EFFECTS: Asserts that buf is a stable-sorted version of orig. +====================================================================================*/ +void assert_sorted_version( const SortBuffer& orig, const SortBuffer& buf ) +{ + // Stop any potential failures that might occur during verification. + gTestController.CancelFailureCountdown(); + + // Prepare an array of counts of the occurrence of each value in + // the legal range. + unsigned counts[SortClass::kRange]; + EH_STD::fill_n( counts, (int)SortClass::kRange, 0 ); + for ( const SortClass *q = orig.begin(); q != orig.end(); q++ ) + counts[ q->value() ]++; + + // Check that each element is greater than the previous one, or if they are + // equal, that their order has been preserved. + for ( const SortClass* p = buf.begin(); p != buf.end(); p++ ) + { + if ( p != buf.begin() ) { + EH_ASSERT( p->value() > p[-1].value() + || p->value() == p[-1].value() && p->GetAddress() > p[-1].GetAddress() ); + } + // Decrement the appropriate count for each value. + counts[ p->value() ]--; + } + + // Check that the values were only rearranged, and none were lost. + for ( unsigned j = 0; j < SortClass::kRange; j++ ) { + EH_ASSERT( counts[j] == 0 ); + } +} + +// +// The test operators +// +struct test_stable_sort_1 +{ + test_stable_sort_1( const SortBuffer& buf ) + : orig( buf ) { + gTestController.SetCurrentTestName("stable_sort() #1"); + } + + void operator()( SortBuffer& buf ) const + { + EH_STD::stable_sort( buf.begin(), buf.end() ); + assert_sorted_version( orig, buf ); + } + +private: + const SortBuffer& orig; +}; + +struct test_stable_sort_2 +{ + test_stable_sort_2( const SortBuffer& buf ) + : orig( buf ) { + gTestController.SetCurrentTestName("stable_sort() #2"); + } + + void operator()( SortBuffer& buf ) const + { + EH_STD::stable_sort( buf.begin(), buf.end(), EH_STD::less() ); + assert_sorted_version( orig, buf ); + } + +private: + const SortBuffer& orig; +}; + +struct test_inplace_merge_1 +{ + test_inplace_merge_1( SortBuffer& buf ) + : orig( buf ) { + gTestController.SetCurrentTestName("inplace_merge #1()"); + } + + void operator()( SortBuffer& buf ) const + { + EH_STD::inplace_merge( buf.begin(), buf.begin() + ( buf.end() - buf.begin() )/2, buf.end() ); + assert_sorted_version( orig, buf ); + } + +private: + const SortBuffer& orig; +}; + +struct test_inplace_merge_2 +{ + test_inplace_merge_2( SortBuffer& buf ) + : orig( buf ) { + gTestController.SetCurrentTestName("inplace_merge() #2"); + } + + void operator()( SortBuffer& buf ) const + { + EH_STD::inplace_merge( buf.begin(), buf.begin() + ( buf.end() - buf.begin() )/2, buf.end(), + EH_STD::less() ); + assert_sorted_version( orig, buf ); + } + +private: + const SortBuffer& orig; +}; + +void test_algo() +{ + SortBuffer mergeBuf; + mergeBuf.PrepareMerge(); + + EH_STD::cerr<<"EH test : testing algo.h"< +# endif +#include +# else +#include +# endif +#include "Tests.h" +#include "LeakCheck.h" +#include "TestClass.h" + +// EH_USE_STD + +enum { kBufferSize = 100 }; + +struct test_uninitialized_copy +{ + test_uninitialized_copy() + : stuff( new TestClass[kBufferSize] ), end_of_stuff(stuff + kBufferSize) { + gTestController.SetCurrentTestName("uninitialized_copy()"); + } + + ~test_uninitialized_copy() { delete[] stuff; } + + void operator()( TestClass* buffer ) const + { + EH_STD::uninitialized_copy((TestClass*)stuff, (TestClass*)end_of_stuff, buffer ); + EH_ASSERT( EH_STD::equal( (TestClass*)stuff, (TestClass*)end_of_stuff, buffer ) ); + stl_destroy( buffer, buffer+kBufferSize ); + } + +private: + TestClass * stuff; + TestClass * end_of_stuff; +}; + +struct test_uninitialized_fill +{ + test_uninitialized_fill() { + gTestController.SetCurrentTestName("uninitialized_fill()"); + } + + void operator()( TestClass* buffer ) const + { + TestClass* buf_end = buffer + kBufferSize; + EH_STD::uninitialized_fill( buffer, buf_end, testValue ); + for ( EH_CSTD::size_t i = 0; i < kBufferSize; i++ ) + EH_ASSERT( buffer[i] == testValue ); + stl_destroy( buffer, buf_end ); + } +private: + TestClass testValue; +}; + +struct test_uninitialized_fill_n +{ + test_uninitialized_fill_n() { + gTestController.SetCurrentTestName("uninitialized_fill_n()"); + } + void operator()( TestClass* buffer ) const + { + TestClass* end = buffer + kBufferSize; + EH_STD::uninitialized_fill_n( buffer, (EH_CSTD::size_t)kBufferSize, testValue ); + for ( EH_CSTD::size_t i = 0; i < kBufferSize; i++ ) + EH_ASSERT( buffer[i] == testValue ); + stl_destroy( buffer, end ); + } +private: + TestClass testValue; +}; + +void test_algobase() +{ + // force alignment + double arr[ sizeof(TestClass) * kBufferSize ]; + TestClass* c = (TestClass*)arr; + WeakCheck( c, test_uninitialized_copy() ); + WeakCheck( c, test_uninitialized_fill() ); + WeakCheck( c, test_uninitialized_fill_n() ); +} diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_assign_op.h b/reactos/lib/3rdparty/stlport/test/eh/test_assign_op.h new file mode 100644 index 00000000000..018e7c6b9a3 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_assign_op.h @@ -0,0 +1,47 @@ +/*********************************************************************************** + test_assign_op.h + + SUMMARY: Test functor template for assignment operators. + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef test_assign_op_H_ +#define test_assign_op_H_ + +#include "Prefix.h" +#ifdef EH_NEW_HEADERS +# include +#else +# include +#endif +#include "nc_alloc.h" + +template +struct test_assign_op { + test_assign_op( const T& src ) + : source(src) { + gTestController.SetCurrentTestName("assignment operator"); + } + + void operator()( T& t ) const { + t = source; + + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + //EH_ASSERT( source == t ); + } +private: + const T& source; +}; + +#endif // test_assign_op_H_ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_bit_vector.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_bit_vector.cpp new file mode 100644 index 00000000000..2b1121e98f7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_bit_vector.cpp @@ -0,0 +1,129 @@ +/*********************************************************************************** + test_bit_vector.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" + +#if defined( EH_BIT_VECTOR_IMPLEMENTED ) + +# if defined (EH_NEW_HEADERS) +# ifdef __SUNPRO_CC +# include +# endif +#include +# else +#include +# endif + +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +typedef EH_BIT_VECTOR BitVector; + +inline sequence_container_tag +container_category(const BitVector&) +{ + return sequence_container_tag(); +} + +USING_CSTD_NAME(size_t) + + // +// test_BitVector_reserve +// +struct test_BitVector_reserve +{ + test_BitVector_reserve( size_t n ) : fAmount(n) + { + gTestController.SetCurrentTestName("BitVector::reserve()"); + } + + void operator()( BitVector& v ) const + { + v.reserve( fAmount ); + } +private: + size_t fAmount; +}; + +/*=================================================================================== + test_bit_vector + + EFFECTS: Performs tests on bit vectors +====================================================================================*/ +void test_bit_vector() +{ +#define __WORD_BIT (int(CHAR_BIT*sizeof(unsigned int))) + + // Make some bit vectors to work with. + BitVector emptyVector; + BitVector testVector, testVector2; + + EH_ASSERT( testVector.size() == 0 ); + + size_t BitVectorSize = random_number( random_base ); + // Half the time, choose a size that will guarantee immediate reallocation + if ( random_number(2) ) + BitVectorSize = BitVectorSize / __WORD_BIT * __WORD_BIT; + + EH_ASSERT( testVector.size() == 0 ); + testVector.reserve(BitVectorSize); + EH_ASSERT( testVector.size() == 0 ); + while (testVector.size() < BitVectorSize) { + testVector.push_back(random_number(2) != 0); + testVector2.push_back(random_number(2) != 0); + } + + // Test insertions + StrongCheck(testVector, test_insert_one(testVector) ); + StrongCheck(testVector, test_insert_one(testVector,0) ); + StrongCheck(testVector, test_insert_one(testVector, (int)testVector.size()) ); + + StrongCheck(testVector, test_insert_n(testVector, random_number(random_base) ) ); + StrongCheck(testVector, test_insert_n(testVector, random_number(random_base),0 ) ); + StrongCheck(testVector, test_insert_n(testVector, random_number(random_base), (int)testVector.size()) ); +#if 0 + // Allocate some random bools to insert + size_t insCnt = 1 + random_number(random_base); + bool *insFirst = new BitVector::value_type[insCnt]; + for (size_t n = 0; n < insCnt; n++) + insFirst[n] = random_number(2); + StrongCheck(testVector, insert_range_tester(testVector, insFirst, insFirst+insCnt)); + StrongCheck(testVector, insert_range_at_begin_tester(testVector, insFirst, insFirst+insCnt)); + StrongCheck(testVector, insert_range_at_end_tester(testVector, insFirst, insFirst+insCnt)); + ConstCheck(0, test_construct_pointer_range( insFirst, insFirst + insCnt)); + delete[] insFirst; +#endif + StrongCheck(testVector, insert_range_tester(testVector, testVector2.begin(), testVector2.end())); + StrongCheck(testVector, insert_range_at_begin_tester(testVector, testVector2.begin(), + testVector2.end())); + StrongCheck(testVector, insert_range_at_end_tester(testVector, testVector2.begin(), + testVector2.end())); + StrongCheck(testVector, test_BitVector_reserve( testVector.capacity() + random_number(50))); + StrongCheck(testVector, test_push_back(testVector)); + StrongCheck(emptyVector, test_push_back(emptyVector)); + + ConstCheck(0, test_default_construct()); + ConstCheck(0, test_construct_n(random_number(random_base))); + ConstCheck(0, test_construct_n_instance(random_number(random_base))); + ConstCheck(0, test_construct_iter_range(testVector2)); + ConstCheck(testVector, test_copy_construct() ); + WeakCheck(testVector, test_assign_op(testVector2) ); +} + +# endif /* BIT_VECTOR_IMPLEMENTED */ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_bitset.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_bitset.cpp new file mode 100644 index 00000000000..fd26f9930a4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_bitset.cpp @@ -0,0 +1,39 @@ +/*********************************************************************************** + test_bitset.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Prefix.h" +#if defined( EH_BITSET_IMPLEMENTED ) +#include "Tests.h" +#include +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +typedef bitset<100> TestBitset; + +inline sequence_container_tag +container_category(const TestBitset&) +{ + return sequence_container_tag(); +} + +void test_bitset() +{ +} +#endif // EH_BITSET_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_construct.h b/reactos/lib/3rdparty/stlport/test/eh/test_construct.h new file mode 100644 index 00000000000..a90003a11d6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_construct.h @@ -0,0 +1,125 @@ +/*********************************************************************************** + test_construct.h + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef test_construct_H_ +#define test_construct_H_ + +#include "Prefix.h" +#if defined (EH_NEW_HEADERS) +# include +# include +# include +#else +# include +# include +# include +#endif + +USING_CSTD_NAME(size_t) + +template +struct test_copy_construct { + test_copy_construct() { + gTestController.SetCurrentTestName("copy constructor"); + } + + void operator()( const T& t ) const { + T aCopy( t ); + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + //EH_ASSERT( aCopy == t ); + CheckInvariant(t); + } +}; + +template +struct test_default_construct { + test_default_construct() { + gTestController.SetCurrentTestName("default constructor"); + } + + void operator()( int ) const { + T t; + CheckInvariant(t); + } +}; + +template +struct test_construct_n { + test_construct_n( size_t _n ) : n(_n+1) { + gTestController.SetCurrentTestName("n-size constructor"); + } + + void operator()( int ) const { + T t(n); + CheckInvariant(t); + } + + size_t n; +}; + +template +struct test_construct_n_instance { + test_construct_n_instance( size_t _n ) : n(_n+1) { + gTestController.SetCurrentTestName("n-size with instance constructor"); + } + + void operator()( int ) const { + typedef typename T::value_type Value_type; + Value_type Val = 0; + T t( n, Val ); + CheckInvariant(t); + } + + size_t n; +}; + +template +struct test_construct_pointer_range { + test_construct_pointer_range( const typename T::value_type *first, + const typename T::value_type* last ) + : fItems( first ), fEnd( last ) { + gTestController.SetCurrentTestName("pointer range constructor"); + } + + void operator()( int ) const { + T t( fItems, fEnd ); + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + CheckInvariant(t); + } + + const typename T::value_type* fItems, *fEnd; +}; + +template +struct test_construct_iter_range { + + test_construct_iter_range( const T& src ) : fItems( src ) { + gTestController.SetCurrentTestName("iterator range constructor"); + } + + void operator()( int ) const { + T t( fItems.begin(), fItems.end() ); + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + EH_ASSERT( t == fItems ); + CheckInvariant(t); + } + + const T& fItems; +}; + +#endif // test_construct_H_ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_deque.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_deque.cpp new file mode 100644 index 00000000000..2a377564add --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_deque.cpp @@ -0,0 +1,95 @@ +/*********************************************************************************** + test_deque.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ + +#include "Tests.h" +# if defined (EH_NEW_HEADERS) +# ifdef __SUNPRO_CC +# include +# else +# include +# endif +# include +# else +# include +# include +# endif +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +typedef TestClass DQTestClass; + +typedef EH_STD::deque TestDeque; + +inline sequence_container_tag +container_category(const TestDeque&) +{ + return sequence_container_tag(); +} + +void test_deque() +{ + size_t dequeSize = random_number(random_base); + TestDeque emptyDeque; + TestDeque testDeque, testDeque2; + while ( testDeque.size() < dequeSize ) + { + DQTestClass x; + testDeque.push_back( x ); + testDeque2.push_back( DQTestClass() ); + } + + ConstCheck( testDeque, test_copy_construct() ); + WeakCheck( testDeque, test_insert_one(testDeque) ); + StrongCheck( testDeque, test_insert_one(testDeque, 0) ); + StrongCheck( testDeque, test_insert_one(testDeque, (int)testDeque.size()) ); + + WeakCheck( testDeque, test_insert_n(testDeque, random_number(random_base) ) ); + StrongCheck( testDeque, test_insert_n(testDeque, random_number(random_base), 0 ) ); + StrongCheck( testDeque, test_insert_n(testDeque, random_number(random_base), (int)testDeque.size() ) ); + + size_t insCnt = random_number(random_base); + DQTestClass *insFirst = new TestDeque::value_type[insCnt + 1]; + + WeakCheck( testDeque, insert_range_tester(testDeque, insFirst, insFirst + insCnt) ); + StrongCheck( testDeque, insert_range_at_begin_tester(testDeque, insFirst, insFirst + insCnt) ); + StrongCheck( testDeque, insert_range_at_end_tester(testDeque, insFirst, insFirst + insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst + insCnt) ); + delete[] insFirst; + + WeakCheck( testDeque, insert_range_tester(testDeque, testDeque2.begin(), testDeque2.end() ) ); + + StrongCheck( testDeque, test_push_back(testDeque) ); + StrongCheck( emptyDeque, test_push_back(emptyDeque) ); + StrongCheck( testDeque, test_push_front(testDeque) ); + StrongCheck( emptyDeque, test_push_front(emptyDeque) ); + + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testDeque2 ) ); + + testDeque2.resize( testDeque.size() * 3 / 2 ); + WeakCheck( testDeque, test_assign_op( testDeque2 ) ); + testDeque2.resize( testDeque.size() * 2 / 3 ); + WeakCheck( testDeque, test_assign_op( testDeque2 ) ); +} diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_hash_map.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_hash_map.cpp new file mode 100644 index 00000000000..420bbb86712 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_hash_map.cpp @@ -0,0 +1,131 @@ +/*********************************************************************************** + test_hash_map.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#if defined( EH_HASHED_CONTAINERS_IMPLEMENTED ) +#include "TestClass.h" +#include "LeakCheck.h" + +# include + +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" +#include "ThrowCompare.h" +#include "test_hash_resize.h" +/* +template struct pair; +template struct __hashtable_node >; +template class hash_map; +template class hash_multimap; +*/ + +typedef EH_STD::__hash_multimap__ TestMultiMap; + + +inline multimap_tag +container_category(const TestMultiMap&) { + return multimap_tag(); +} + +void test_hash_multimap() { +# if !(defined (_MSC_VER) && (_MSC_VER < 1100)) + TestMultiMap testMultiMap, testMultiMap2; + + const size_t hash_mapSize = random_number(random_base); + + while ( testMultiMap.size() < hash_mapSize ) + { + TestMultiMap::value_type x; + testMultiMap.insert( x ); + testMultiMap2.insert( TestMultiMap::value_type() ); + } + +# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE ) + WeakCheck( testMultiMap, test_hash_resize() ); + // TestMultiMap == TestMultiMap: no such operator! - ptr + // StrongCheck( testMultiMap, test_insert_noresize(testMultiMap) ); +# endif + WeakCheck( testMultiMap, test_insert_value(testMultiMap) ); + + size_t insCnt = random_number(random_base); + TestMultiMap::value_type *insFirst = new TestMultiMap::value_type[1+insCnt]; + WeakCheck( testMultiMap, insert_range_tester(testMultiMap, insFirst, insFirst+insCnt) ); + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testMultiMap, insert_range_tester(testMultiMap, testMultiMap2.begin(), testMultiMap2.end() ) ); + + ConstCheck( 0, test_default_construct() ); +# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION + ConstCheck( 0, test_construct_iter_range_n( testMultiMap2 ) ); +# endif + ConstCheck( testMultiMap, test_copy_construct() ); + + WeakCheck( testMultiMap, test_assign_op( testMultiMap2 ) ); +# endif +} + +typedef EH_STD::__hash_map__ TestMap; + +inline map_tag +container_category(const TestMap&) +{ + return map_tag(); +} + +void test_hash_map() +{ +# if !(defined (_MSC_VER) && (_MSC_VER < 1100)) + TestMap testMap, testMap2; + + const size_t hash_mapSize = random_number(random_base); + + while ( testMap.size() < hash_mapSize ) { + TestMap::value_type x; + testMap.insert( x ); + testMap2.insert( TestMap::value_type() ); + } + +#if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE ) + WeakCheck( testMap, test_hash_resize() ); + // TestMultiMap == TestMultiMap: no such operator! - ptr + // StrongCheck( testMap, test_insert_noresize(testMap) ); +#endif + WeakCheck( testMap, test_insert_value(testMap) ); + + size_t insCnt = random_number(random_base); + TestMap::value_type *insFirst = new TestMap::value_type[1+insCnt]; + WeakCheck( testMap, insert_range_tester(testMap, insFirst, insFirst+insCnt) ); + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testMap, insert_range_tester(testMap, testMap2.begin(), testMap2.end() ) ); + + ConstCheck( 0, test_default_construct() ); +# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION + ConstCheck( 0, test_construct_iter_range_n( testMap2 ) ); +# endif + ConstCheck( testMap, test_copy_construct() ); + + WeakCheck( testMap, test_assign_op( testMap2 ) ); +# endif +} + +#endif // EH_HASHED_CONTAINERS_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_hash_resize.h b/reactos/lib/3rdparty/stlport/test/eh/test_hash_resize.h new file mode 100644 index 00000000000..d7beb3e3fe4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_hash_resize.h @@ -0,0 +1,56 @@ +/*********************************************************************************** + test_hash_resize.h + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef test_hash_resize__ +#define test_hash_resize__ + +#include "random_number.h" +#include "nc_alloc.h" + +template +struct test_hash_resize +{ + test_hash_resize() + { + gTestController.SetCurrentTestName("hash resize"); + } + + void operator()( T& t ) const + { + t.resize( 1+random_number(random_base) + t.bucket_count() ); + } +}; + +template +struct test_construct_iter_range_n +{ + test_construct_iter_range_n( const T& src ) + : fItems( src ) + { + gTestController.SetCurrentTestName("iterator range n-size constructor"); + } + + void operator()( int ) const + { + T t( fItems.begin(), fItems.end(), fItems.size() ); + // prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + CheckInvariant(t); + } + + const T& fItems; +}; + +#endif //__test_hash_resize__ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_hash_set.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_hash_set.cpp new file mode 100644 index 00000000000..e4479e56f26 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_hash_set.cpp @@ -0,0 +1,127 @@ +/*********************************************************************************** + test_hash_set.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" + +#if defined( EH_HASHED_CONTAINERS_IMPLEMENTED ) + +# include + +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" +#include "ThrowCompare.h" +#include "test_hash_resize.h" + +typedef EH_STD::__hash_multiset__ TestMultiSet; + +inline multiset_tag +container_category(const TestMultiSet&) +{ + return multiset_tag(); +} + +void test_hash_multiset() +{ +# if !(defined (_MSC_VER) && (_MSC_VER < 1100)) + TestMultiSet testMultiSet, testMultiSet2; + + const size_t hash_setSize = random_number(random_base); + + while ( testMultiSet.size() < hash_setSize ) + { + TestMultiSet::value_type x; + testMultiSet.insert( x ); + testMultiSet2.insert( TestMultiSet::value_type() ); + } + +# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE ) + WeakCheck( testMultiSet, test_hash_resize() ); + // TestMultiSet == TestMultiSet: no such operator! - ptr + // StrongCheck( testMultiSet, test_insert_noresize(testMultiSet) ); +# endif + WeakCheck( testMultiSet, test_insert_value(testMultiSet) ); + + size_t insCnt = random_number(random_base); + TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt]; + WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) ); + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) ); + + ConstCheck( 0, test_default_construct() ); +# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION + ConstCheck( 0, test_construct_iter_range_n( testMultiSet2 ) ); +# endif + ConstCheck( testMultiSet, test_copy_construct() ); + + WeakCheck( testMultiSet, test_assign_op( testMultiSet2 ) ); +# endif +} + +typedef EH_STD::__hash_set__ TestSet; + +inline set_tag +container_category(const TestSet&) +{ + return set_tag(); +} + +void test_hash_set() +{ +# if !(defined (_MSC_VER) && (_MSC_VER < 1100)) + TestSet testSet, testSet2; + + const size_t hash_setSize = random_number(random_base); + + while ( testSet.size() < hash_setSize ) + { + TestSet::value_type x; + testSet.insert( x ); + testSet2.insert( TestSet::value_type() ); + } + +# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE ) + WeakCheck( testSet, test_hash_resize() ); + // TestMultiSet == TestMultiSet: no such operator! - ptr + // StrongCheck( testSet, test_insert_noresize(testSet) ); +# endif + WeakCheck( testSet, test_insert_value(testSet) ); + + size_t insCnt = random_number(random_base); + TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt]; + WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) ); + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) ); + + ConstCheck( 0, test_default_construct() ); +# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION + ConstCheck( 0, test_construct_iter_range_n( testSet2 ) ); +# endif + ConstCheck( testSet, test_copy_construct() ); + + WeakCheck( testSet, test_assign_op( testSet2 ) ); +# endif +} + +#endif // EH_HASHED_CONTAINERS_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_insert.h b/reactos/lib/3rdparty/stlport/test/eh/test_insert.h new file mode 100644 index 00000000000..cd56a5fcbf4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_insert.h @@ -0,0 +1,552 @@ +/*********************************************************************************** + test_insert.h + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef test_insert_H_ +#define test_insert_H_ + +# include "Prefix.h" +# if defined (EH_NEW_HEADERS) +# include +# include +# include +# include +# else +# include +# include +# include +# endif +#include "random_number.h" +#include "nc_alloc.h" +#include "ThrowCompare.h" + +// A classification system for containers, for verification +struct container_tag {}; +struct sequence_container_tag {}; +struct associative_container_tag {}; + +struct set_tag {}; +struct multiset_tag {}; +struct map_tag {}; +struct multimap_tag {}; + +template +size_t CountNewItems( const C&, const Iter& firstNew, + const Iter& lastNew, sequence_container_tag ) +{ + size_t dist = 0; +#if 0 //def __SUNPRO_CC + EH_DISTANCE( firstNew, lastNew, dist ); +#else + EH_DISTANCE( Iter(firstNew), Iter(lastNew), dist ); +#endif + return dist; +} + +template +size_t CountNewItems( const C& c, const Iter& firstNew, + const Iter& lastNew, multimap_tag ) +{ + return CountNewItems( c, firstNew, lastNew, sequence_container_tag() ); +} + +template +size_t CountNewItems( const C& c, const Iter& firstNew, + const Iter& lastNew, multiset_tag ) +{ + return CountNewItems( c, firstNew, lastNew, sequence_container_tag() ); +} + + +template +#ifdef __BORLANDC__ +size_t CountUniqueItems_Aux( const C& original, const Iter& firstNew, +#else +size_t CountUniqueItems_Aux( const C& original, Iter firstNew, +#endif + Iter lastNew, const KeyOfValue& keyOfValue ) +{ + typedef typename C::key_type key; + typedef typename C::const_iterator const_iter; + typedef EH_STD::vector key_list; + typedef typename key_list::iterator key_iterator; + key_list keys; + size_t dist = 0; +#ifdef __SUNPRO_CC + EH_DISTANCE( firstNew, lastNew, dist ); +#else + EH_DISTANCE( Iter(firstNew), Iter(lastNew), dist ); +#endif + keys.reserve( dist ); + for ( Iter x = firstNew; x != lastNew; ++x ) + keys.push_back( keyOfValue(*x) ); + + EH_STD::sort( keys.begin(), keys.end() ); + key_iterator last = EH_STD::unique( keys.begin(), keys.end() ); + + size_t cnt = 0; + for ( key_iterator tmp = keys.begin(); tmp != last; ++tmp ) + { + if ( const_iter(original.find( *tmp )) == const_iter(original.end()) ) + ++cnt; + } + return cnt; +} + +#if ! defined (__SGI_STL) +EH_BEGIN_NAMESPACE +template +struct identity +{ + const T& operator()( const T& x ) const { return x; } +}; +# if ! defined (__KCC) +template +struct select1st : public unary_function<_Pair, typename _Pair::first_type> { + const typename _Pair::first_type& operator()(const _Pair& __x) const { + return __x.first; + } +}; +# endif +EH_END_NAMESPACE +#endif + +template +size_t CountUniqueItems( const C& original, const Iter& firstNew, + const Iter& lastNew, set_tag ) +{ + typedef typename C::value_type value_type; + return CountUniqueItems_Aux( original, firstNew, lastNew, + EH_STD::identity() ); +} + +template +size_t CountUniqueItems( const C& original, const Iter& firstNew, + const Iter& lastNew, map_tag ) +{ +#ifdef EH_MULTI_CONST_TEMPLATE_ARG_BUG + return CountUniqueItems_Aux( original, firstNew, lastNew, + EH_SELECT1ST_HINT() ); +#else + typedef typename C::value_type value_type; + return CountUniqueItems_Aux( original, firstNew, lastNew, + EH_STD::select1st() ); +#endif +} + +template +size_t CountNewItems( const C& original, const Iter& firstNew, + const Iter& lastNew, map_tag ) +{ + return CountUniqueItems( original, firstNew, lastNew, + container_category( original ) ); +} + +template +size_t CountNewItems( const C& original, const Iter& firstNew, + const Iter& lastNew, set_tag ) +{ + return CountUniqueItems( original, firstNew, lastNew, + container_category( original ) ); +} + +template +inline void VerifyInsertion( const C& original, const C& result, + const SrcIter& firstNew, const SrcIter& lastNew, + size_t, associative_container_tag ) +{ + typedef typename C::const_iterator DstIter; + DstIter first1 = original.begin(); + DstIter first2 = result.begin(); + + DstIter* from_orig = new DstIter[original.size()]; + DstIter* last_from_orig = from_orig; + + // fbp : for hashed containers, the following is needed : + while ( first2 != result.end() ) + { + EH_STD::pair p = EH_STD::mismatch( first1, original.end(), first2 ); + if ( p.second != result.end() ) + { + SrcIter srcItem = EH_STD::find( SrcIter(firstNew), SrcIter(lastNew), *p.second ); + + if (srcItem == lastNew) + { + // not found in input range, probably re-ordered from the orig + DstIter* tmp; + tmp = EH_STD::find( from_orig, last_from_orig, p.first ); + + // if already here, exclude + if (tmp != last_from_orig) + { + EH_STD::copy(tmp+1, last_from_orig, tmp); + last_from_orig--; + } + else + { + // register re-ordered element + DstIter dstItem; + dstItem = EH_STD::find( first1, original.end(), *p.first ); + EH_ASSERT( dstItem != original.end() ); + *last_from_orig = dstItem; + last_from_orig++; + ++p.first; + } + } + ++p.second; + } + first1 = p.first; + first2 = p.second; + } + + delete [] from_orig; +} + +// VC++ +template +inline void VerifyInsertion( + const C& original, const C& result, const SrcIter& firstNew, + const SrcIter& lastNew, size_t, set_tag ) +{ + VerifyInsertion( original, result, firstNew, lastNew, + size_t(0), associative_container_tag() ); +} + +template +inline void VerifyInsertion(const C& original, const C& result, + const SrcIter& firstNew, const SrcIter& lastNew, + size_t, multiset_tag ) +{ + VerifyInsertion( original, result, firstNew, lastNew, + size_t(0), associative_container_tag() ); +} + +template +inline void VerifyInsertion( + const C& original, const C& result, const SrcIter& firstNew, + const SrcIter& lastNew, size_t, map_tag ) +{ + VerifyInsertion( original, result, firstNew, lastNew, + size_t(0), associative_container_tag() ); +} + +template +inline void VerifyInsertion( + const C& original, const C& result, const SrcIter& firstNew, + const SrcIter& lastNew, size_t, multimap_tag ) +{ + VerifyInsertion( original, result, firstNew, lastNew, + size_t(0), associative_container_tag() ); +} + +template +void VerifyInsertion( +# ifdef _MSC_VER + const C& original, const C& result, SrcIter firstNew, + SrcIter lastNew, size_t insPos, sequence_container_tag ) +# else + const C& original, const C& result, const SrcIter& firstNew, + const SrcIter& lastNew, size_t insPos, sequence_container_tag ) +# endif +{ + typename C::const_iterator p1 = original.begin(); + typename C::const_iterator p2 = result.begin(); + SrcIter tmp(firstNew); + + for ( size_t n = 0; n < insPos; n++, ++p1, ++p2) + EH_ASSERT( *p1 == *p2 ); + + for (; tmp != lastNew; ++p2, ++tmp ) { + EH_ASSERT(p2 != result.end()); + EH_ASSERT(*p2 == *tmp); + } + + for (; p2 != result.end(); ++p1, ++p2 ) + EH_ASSERT( *p1 == *p2 ); + EH_ASSERT( p1 == original.end() ); +} + +template +inline void VerifyInsertion( const C& original, const C& result, + const SrcIter& firstNew, + const SrcIter& lastNew, size_t insPos ) +{ + EH_ASSERT( result.size() == original.size() + + CountNewItems( original, firstNew, lastNew, + container_category(original) ) ); + VerifyInsertion( original, result, firstNew, lastNew, insPos, + container_category(original) ); +} + +template +void VerifyInsertN( const C& original, const C& result, size_t insCnt, + const Value& val, size_t insPos ) +{ + typename C::const_iterator p1 = original.begin(); + typename C::const_iterator p2 = result.begin(); + (void)val; //*TY 02/06/2000 - to suppress unused variable warning under nondebug build + + for ( size_t n = 0; n < insPos; n++ ) + EH_ASSERT( *p1++ == *p2++ ); + + while ( insCnt-- > 0 ) + { + EH_ASSERT(p2 != result.end()); + EH_ASSERT(*p2 == val ); + ++p2; + } + + while ( p2 != result.end() ) { + EH_ASSERT( *p1 == *p2 ); + ++p1; ++p2; + } + EH_ASSERT( p1 == original.end() ); +} + +template +void prepare_insert_n( C&, size_t ) {} + +// Metrowerks 1.8 compiler requires that specializations appear first (!!) +// or it won't call them. Fixed in 1.9, though. +inline void MakeRandomValue(bool& b) { b = bool(random_number(2) != 0); } + +template +inline void MakeRandomValue(T&) {} + +template +struct test_insert_one +{ + test_insert_one( const C& orig, int pos =-1 ) + : original( orig ), fPos( random_number( orig.size() )) + { + MakeRandomValue( fInsVal ); + if ( pos != -1 ) + { + fPos = size_t(pos); + if ( pos == 0 ) + gTestController.SetCurrentTestName("single insertion at begin()"); + else + gTestController.SetCurrentTestName("single insertion at end()"); + } + else + gTestController.SetCurrentTestName("single insertion at random position"); + } + + void operator()( C& c ) const + { + prepare_insert_n( c, (size_t)1 ); + typename C::iterator pos = c.begin(); + EH_STD::advance( pos, size_t(fPos) ); + c.insert( pos, fInsVal ); + + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + // Success. Check results. + VerifyInsertion( original, c, &fInsVal, 1+&fInsVal, fPos ); + } +private: + typename C::value_type fInsVal; + const C& original; + size_t fPos; +}; + +template +struct test_insert_n +{ + test_insert_n( const C& orig, size_t insCnt, int pos =-1 ) + : original( orig ), fPos( random_number( orig.size() )), fInsCnt(insCnt) + { + MakeRandomValue( fInsVal ); + if (pos!=-1) + { + fPos=size_t(pos); + if (pos==0) + gTestController.SetCurrentTestName("n-ary insertion at begin()"); + else + gTestController.SetCurrentTestName("n-ary insertion at end()"); + } + else + gTestController.SetCurrentTestName("n-ary insertion at random position"); + } + + void operator()( C& c ) const + { + prepare_insert_n( c, fInsCnt ); + typename C::iterator pos = c.begin(); + EH_STD::advance( pos, fPos ); + c.insert( pos, fInsCnt, fInsVal ); + + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + // Success. Check results. + VerifyInsertN( original, c, fInsCnt, fInsVal, fPos ); + } +private: + typename C::value_type fInsVal; + const C& original; + size_t fPos; + size_t fInsCnt; +}; + +template +struct test_insert_value +{ + test_insert_value( const C& orig ) + : original( orig ) + { + MakeRandomValue( fInsVal ); + gTestController.SetCurrentTestName("insertion of random value"); + } + + void operator()( C& c ) const + { + c.insert( fInsVal ); + + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + // Success. Check results. + VerifyInsertion( original, c, &fInsVal, 1+&fInsVal, size_t(0) ); + } +private: + typename C::value_type fInsVal; + const C& original; +}; + +template +struct test_insert_noresize +{ + test_insert_noresize( const C& orig ) + : original( orig ) + { + MakeRandomValue( fInsVal ); + gTestController.SetCurrentTestName("insertion of random value without resize"); + } + + void operator()( C& c ) const + { + c.insert_noresize( fInsVal ); + + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + // Success. Check results. + VerifyInsertion( original, c, &fInsVal, 1+&fInsVal, size_t(0) ); + } +private: + typename C::value_type fInsVal; + const C& original; +}; + +template +void do_insert_range( C& c_inst, Position offset, + Iter first, Iter last, sequence_container_tag ) +{ + typedef typename C::iterator CIter; + CIter pos = c_inst.begin(); + EH_STD::advance( pos, offset ); + c_inst.insert( pos, first, last ); +} + +template +void do_insert_range( C& c, Position, + Iter first, Iter last, associative_container_tag ) +{ + c.insert( first, last ); +} + +template +void do_insert_range( C& c, Position, Iter first, Iter last, multiset_tag ) +{ + c.insert( first, last ); +} + +template +void do_insert_range( C& c, Position, Iter first, Iter last, multimap_tag ) +{ + c.insert( first, last ); +} + +template +void do_insert_range( C& c, Position, Iter first, Iter last, set_tag ) +{ + c.insert( first, last ); +} + +template +void do_insert_range( C& c, Position, Iter first, Iter last, map_tag ) +{ + c.insert( first, last ); +} + +/* +template +void prepare_insert_range( C&, size_t, Iter, Iter) {} +*/ + +template +struct test_insert_range +{ + test_insert_range( const C& orig, Iter first, Iter last, int pos=-1 ) + : fFirst( first ), + fLast( last ), + original( orig ), + fPos( random_number( orig.size() )) + { + gTestController.SetCurrentTestName("range insertion"); + if ( pos != -1 ) + { + fPos = size_t(pos); + if ( pos == 0 ) + gTestController.SetCurrentTestName("range insertion at begin()"); + else + gTestController.SetCurrentTestName("range insertion at end()"); + } + else + gTestController.SetCurrentTestName("range insertion at random position"); + } + + void operator()( C& c ) const + { +// prepare_insert_range( c, fPos, fFirst, fLast ); + do_insert_range( c, fPos, fFirst, fLast, container_category(c) ); + + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + // Success. Check results. + VerifyInsertion( original, c, fFirst, fLast, fPos ); + } +private: + Iter fFirst, fLast; + const C& original; + size_t fPos; +}; + +template +test_insert_range insert_range_tester( const C& orig, const Iter& first, const Iter& last ) +{ + return test_insert_range( orig, first, last ); +} + +template +test_insert_range insert_range_at_begin_tester( const C& orig, const Iter& first, const Iter& last ) +{ + return test_insert_range( orig, first, last , 0); +} + +template +test_insert_range insert_range_at_end_tester( const C& orig, const Iter& first, const Iter& last ) +{ + return test_insert_range( orig, first, last , (int)orig.size()); +} + +#endif // test_insert_H_ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_list.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_list.cpp new file mode 100644 index 00000000000..e6375c5b337 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_list.cpp @@ -0,0 +1,108 @@ +/*********************************************************************************** + test_list.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#include "TestClass.h" +#include "LeakCheck.h" +# if defined (EH_NEW_HEADERS) +#include +#else +#include +#endif +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" +#include "nc_alloc.h" + +typedef EH_STD::__list__ TestList; + +inline sequence_container_tag +container_category(const TestList&) +{ + return sequence_container_tag(); +} + +// +// list sort() member test operation. Does not verify stability. +// +struct test_list_sort +{ + test_list_sort() + { + gTestController.SetCurrentTestName("list::sort()"); + } + + void operator()( TestList& list ) const + { + list.sort(); + + gTestController.CancelFailureCountdown(); + + for ( TestList::iterator p = list.begin(); p != list.end(); p++ ) + if ( p != list.begin() ) { + TestList::iterator tmp=p; + --tmp; + EH_ASSERT( *p >= *tmp ); + } + } +}; + +void test_list() +{ + TestList testList, testList2; + size_t listSize = random_number(random_base); + + while ( testList.size() < listSize ) + { + TestClass x; + testList.push_back( x ); + testList2.push_back( TestClass() ); + } + + StrongCheck( testList, test_insert_one(testList) ); + StrongCheck( testList, test_insert_one(testList, 0) ); + StrongCheck( testList, test_insert_one(testList, (int)testList.size()) ); + + WeakCheck( testList, test_insert_n(testList, random_number(random_base) ) ); + WeakCheck( testList, test_insert_n(testList, random_number(random_base), 0 ) ); + WeakCheck( testList, test_insert_n(testList, random_number(random_base), (int)testList.size() ) ); + + size_t insCnt = random_number(random_base); + TestClass *insFirst = new TestList::value_type[1+insCnt]; + + WeakCheck( testList, insert_range_tester(testList, insFirst, insFirst+insCnt) ); + WeakCheck( testList, insert_range_at_begin_tester(testList, insFirst, insFirst+insCnt) ); + WeakCheck( testList, insert_range_at_end_tester(testList, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testList, insert_range_tester(testList, testList2.begin(), testList2.end() ) ); + + StrongCheck( testList, test_push_front(testList) ); + StrongCheck( testList, test_push_back(testList) ); + + StrongCheck( testList, test_list_sort() ); // Simply to verify strength. + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testList2 ) ); + ConstCheck( testList, test_copy_construct() ); + + WeakCheck( testList, test_assign_op( testList2 ) ); +} diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_map.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_map.cpp new file mode 100644 index 00000000000..9678b17ea21 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_map.cpp @@ -0,0 +1,127 @@ +/*********************************************************************************** + test_map.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#include "TestClass.h" +#include "LeakCheck.h" +# if defined (EH_NEW_HEADERS) +#include +# else +#include +#include +# endif + +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" +#include "ThrowCompare.h" +#include "test_insert.h" + +template +inline multimap_tag +container_category(const EH_STD::__multimap__&) +{ + return multimap_tag(); +} + +template +inline map_tag +container_category(const EH_STD::__map__&) +{ + return map_tag(); +} + +typedef EH_STD::__multimap__ TestMultiMap; + +void test_multimap() +{ + TestMultiMap testMultiMap, testMultiMap2; + + const size_t mapSize = random_number(random_base); + + while ( testMultiMap.size() < mapSize ) + { + TestMultiMap::value_type x; + testMultiMap.insert( x ); + testMultiMap2.insert( TestMultiMap::value_type() ); + } + + StrongCheck( testMultiMap, test_insert_value(testMultiMap) ); + + size_t insCnt = 1 + random_number(random_base); + TestMultiMap::value_type *insFirst = new TestMultiMap::value_type[insCnt]; + + WeakCheck( testMultiMap, insert_range_tester(testMultiMap, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + + WeakCheck( testMultiMap, insert_range_tester(testMultiMap, testMultiMap2.begin(), testMultiMap2.end() ) ); + + + ConstCheck( 0, test_default_construct() ); + + ConstCheck( 0, test_construct_iter_range( testMultiMap2 ) ); + + ConstCheck( testMultiMap, test_copy_construct() ); + + WeakCheck( testMultiMap, test_assign_op( testMultiMap2 ) ); +} + +typedef EH_STD::__map__ TestMap; + +void CheckInvariant( const TestMap& m ); + +void CheckInvariant( const TestMap& m ) +{ +// assert( map.__rb_verify() ); + size_t total = 0; + EH_DISTANCE( m.begin(), m.end(), total ); + assert( m.size() == total ); +} + +void test_map() +{ + TestMap testMap, testMap2; + + const size_t mapSize = random_number(random_base); + + while ( testMap.size() < mapSize ) + { + TestMap::value_type x; + testMap.insert( x ); + testMap2.insert( TestMap::value_type() ); + } + + StrongCheck( testMap, test_insert_value(testMap) ); + + size_t insCnt = random_number(random_base); + TestMap::value_type *insFirst = new TestMap::value_type[1+insCnt]; + + WeakCheck( testMap, insert_range_tester(testMap, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testMap, insert_range_tester(testMap, testMap2.begin(), testMap2.end() ) ); + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_iter_range( testMap2 ) ); + ConstCheck( testMap, test_copy_construct() ); + WeakCheck( testMap, test_assign_op( testMap2 ) ); +} + diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_push_back.h b/reactos/lib/3rdparty/stlport/test/eh/test_push_back.h new file mode 100644 index 00000000000..e4e3b6e40dc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_push_back.h @@ -0,0 +1,50 @@ +/*********************************************************************************** + test_push_back.h + + Interface for the test_push_back class + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef test_push_back_H_ +#define test_push_back_H_ +# ifdef EH_NEW_HEADERS +# include +# else +# include +# endif + +# include "Prefix.h" +#include "nc_alloc.h" + +template +struct test_push_back +{ + test_push_back( const C& orig ) : original( orig ) + { + gTestController.SetCurrentTestName("push_back() method"); + } + + void operator()( C& c ) const + { + typedef typename C::value_type _value_type; + c.push_back(_value_type() ); + // Prevent simulated failures during verification + gTestController.CancelFailureCountdown(); + EH_ASSERT( c.size() == original.size() + 1 ); + EH_ASSERT( EH_STD::equal( original.begin(), original.end(), c.begin() ) ); + } +private: + const C& original; +}; + +#endif // test_push_back_H_ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_push_front.h b/reactos/lib/3rdparty/stlport/test/eh/test_push_front.h new file mode 100644 index 00000000000..feff911b538 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_push_front.h @@ -0,0 +1,46 @@ +/*********************************************************************************** + test_push_front.h + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#ifndef test_push_front_H_ +#define test_push_front_H_ + +# if defined (EH_NEW_HEADERS) +# include +# else +# include +# endif +# include "Prefix.h" + +template +struct test_push_front +{ + test_push_front( const C& orig ) : original( orig ) { + gTestController.SetCurrentTestName("push_front() method"); + } + + void operator()( C& c ) const + { + typedef typename C::value_type _value_type; + c.push_front( _value_type() ); + EH_ASSERT( c.size() == original.size() + 1 ); + typename C::const_iterator next = c.begin(); + + EH_ASSERT( EH_STD::equal( original.begin(), original.end(), ++next ) ); + } +private: + const C& original; +}; + +#endif // test_push_front_H_ diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_rope.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_rope.cpp new file mode 100644 index 00000000000..33f89cb5711 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_rope.cpp @@ -0,0 +1,99 @@ +/*********************************************************************************** + test_rope.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ + +# ifdef __SUNPRO_CC +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# endif + +#include "Prefix.h" +#include "Tests.h" +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +#if defined( EH_ROPE_IMPLEMENTED ) +#if !( defined(__MWERKS__) && __MWERKS__ < 0x1900 ) // CW1.8 can't compile this! +# define __STD_STUFF 1 +# if defined (EH_NEW_HEADERS) +#include +#else +#include +#endif + + +typedef STLPORT::rope TestRope; + +inline sequence_container_tag +container_category(const TestRope&) +{ + return sequence_container_tag(); +} + +void test_rope() +{ + TestRope testRope, testRope2; + size_t ropeSize = random_number(random_base); + + while ( testRope.size() < ropeSize ) + { + TestRope::value_type x = TestRope::value_type(random_number(random_base)); // initialize before use + testRope.push_back( x ); + testRope2.push_back( TestRope::value_type() ); + } + WeakCheck( testRope, test_insert_one(testRope) ); + WeakCheck( testRope, test_insert_one(testRope, 0) ); + WeakCheck( testRope, test_insert_one(testRope, (int)testRope.size()) ); + + WeakCheck( testRope, test_insert_n(testRope, random_number(random_base) ) ); + WeakCheck( testRope, test_insert_n(testRope, random_number(random_base), 0 ) ); + WeakCheck( testRope, test_insert_n(testRope, random_number(random_base), (int)testRope.size() ) ); + + size_t insCnt = random_number(random_base); + TestRope::value_type *insFirst = new TestRope::value_type[1+insCnt]; + + WeakCheck( testRope, insert_range_tester(testRope, insFirst, insFirst+insCnt) ); + WeakCheck( testRope, insert_range_at_begin_tester(testRope, insFirst, insFirst+insCnt) ); + WeakCheck( testRope, insert_range_at_end_tester(testRope, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testRope, insert_range_tester(testRope, testRope2.begin(), testRope2.end() ) ); + + WeakCheck( testRope, test_push_front(testRope) ); + WeakCheck( testRope, test_push_back(testRope) ); + + ConstCheck( 0, test_default_construct() ); + +// dwa 1/25/00 - not actually valid for rope, because it doesn't +// have the constructor in question! The code will compile, but with the +// wrong result (the constructor that gets used does something different). + +// ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testRope2 ) ); + ConstCheck( testRope, test_copy_construct() ); + + WeakCheck( testRope, test_assign_op( testRope2 ) ); +} +#endif // __MWERKS__ + +#endif // EH_ROPE_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_set.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_set.cpp new file mode 100644 index 00000000000..7d2bd080aec --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_set.cpp @@ -0,0 +1,100 @@ +/*********************************************************************************** + test_set.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#include "TestClass.h" +#include "LeakCheck.h" +#if defined (EH_NEW_HEADERS) +# include +#else +# include +# include +#endif +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" +#include "ThrowCompare.h" + +void test_multiset(); + +typedef EH_STD::__multiset__ TestMultiSet; + +inline multiset_tag +container_category(const TestMultiSet&) { + return multiset_tag(); +} + +void test_multiset() { + TestMultiSet testMultiSet, testMultiSet2; + + const size_t setSize = random_number(random_base); + + while (testMultiSet.size() < setSize) { + TestMultiSet::value_type x; + testMultiSet.insert( x ); + testMultiSet2.insert( TestMultiSet::value_type() ); + } + + StrongCheck( testMultiSet, test_insert_value(testMultiSet) ); + + size_t insCnt = random_number(random_base); + TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt]; + WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) ); + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) ); + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_iter_range( testMultiSet2 ) ); + ConstCheck( testMultiSet, test_copy_construct() ); + + WeakCheck( testMultiSet, test_assign_op( testMultiSet2 ) ); +} + +typedef EH_STD::__set__ TestSet; + +inline set_tag +container_category(const TestSet&) { + return set_tag(); +} + +void test_set() { + TestSet testSet, testSet2; + + const size_t setSize = random_number(random_base); + + while ( testSet.size() < setSize ) { + TestSet::value_type x; + testSet.insert( x ); + testSet2.insert( TestSet::value_type() ); + } + StrongCheck( testSet, test_insert_value(testSet) ); + + size_t insCnt = random_number(random_base); + TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt]; + + WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) ); + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_iter_range( testSet2 ) ); + ConstCheck( testSet, test_copy_construct() ); + WeakCheck( testSet, test_assign_op( testSet2 ) ); +} diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_slist.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_slist.cpp new file mode 100644 index 00000000000..2741e4cf117 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_slist.cpp @@ -0,0 +1,91 @@ +/*********************************************************************************** + test_slist.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#if defined( EH_SLIST_IMPLEMENTED ) +# include "TestClass.h" +# include "LeakCheck.h" +# if defined (EH_NEW_HEADERS) && defined (EH_USE_SGI_STL) +# include +# else +# include +# endif +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +#if defined (__GNUC__) && defined (__APPLE__) +typedef EH_STD::slist TestSList; +#else +typedef EH_STD::__slist__ TestSList; +#endif + +inline sequence_container_tag +container_category(const TestSList&) { + return sequence_container_tag(); +} + +struct test_slist_sort { + test_slist_sort() { + gTestController.SetCurrentTestName("slist::sort()"); + } + void operator()( TestSList& slist ) const { + slist.sort(); + for ( TestSList::iterator p = slist.begin(), q; p != slist.end(); q = p, p++ ) + if ( p != slist.begin() ) { + EH_ASSERT( *p >= *q ); + } + } +}; + +void test_slist() { + TestSList testSList, testSList2; + size_t slistSize = random_number(random_base); + + while (testSList.size() < slistSize) { + TestClass x; + testSList.push_front( x ); + testSList2.push_front( TestClass() ); + } + + StrongCheck( testSList, test_insert_one(testSList) ); + StrongCheck( testSList, test_insert_one(testSList, 0) ); + StrongCheck( testSList, test_insert_one(testSList, (int)testSList.size()) ); + + WeakCheck( testSList, test_insert_n(testSList, random_number(random_base) ) ); + WeakCheck( testSList, test_insert_n(testSList, random_number(random_base), 0 ) ); + WeakCheck( testSList, test_insert_n(testSList, random_number(random_base), (int)testSList.size() ) ); + + size_t insCnt = random_number(random_base); + TestClass *insFirst = new TestSList::value_type[1+insCnt]; + WeakCheck( testSList, insert_range_tester(testSList, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + WeakCheck( testSList, test_insert_range(testSList, testSList2.begin(), testSList2.end() ) ); + StrongCheck( testSList, test_push_front(testSList) ); + StrongCheck( testSList, test_slist_sort() ); // Simply to verify strength. + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testSList2 ) ); + ConstCheck( testSList, test_copy_construct() ); + WeakCheck( testSList, test_assign_op( testSList2 ) ); +} + +#endif // EH_SLIST_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_string.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_string.cpp new file mode 100644 index 00000000000..a8c944231f6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_string.cpp @@ -0,0 +1,79 @@ +/*********************************************************************************** + test_string.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Prefix.h" +#if defined( EH_STRING_IMPLEMENTED ) +#include "Tests.h" +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" +#include + +USING_CSTD_NAME(size_t) + +typedef EH_STD::basic_string, eh_allocator(char) > TestString; + +inline sequence_container_tag +container_category(const TestString&) +{ + return sequence_container_tag(); +} + +void test_string() { + TestString testString, testString2; + size_t ropeSize = random_number(random_base); + + while ( testString.size() < ropeSize ) { + TestString::value_type x = TestString::value_type(random_number(random_base)) ; // initialize before use + testString.append(1, x ); + testString2.append(1, TestString::value_type() ); + } + WeakCheck( testString, test_insert_one(testString) ); + WeakCheck( testString, test_insert_one(testString, 0) ); + WeakCheck( testString, test_insert_one(testString, (int)testString.size()) ); + + WeakCheck( testString, test_insert_n(testString, random_number(random_base) ) ); + WeakCheck( testString, test_insert_n(testString, random_number(random_base), 0 ) ); + WeakCheck( testString, test_insert_n(testString, random_number(random_base), (int)testString.size() ) ); + + size_t insCnt = random_number(random_base); + TestString::value_type *insFirst = new TestString::value_type[1+insCnt]; + + WeakCheck( testString, insert_range_tester(testString, insFirst, insFirst+insCnt) ); + WeakCheck( testString, insert_range_at_begin_tester(testString, insFirst, insFirst+insCnt) ); + WeakCheck( testString, insert_range_at_end_tester(testString, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testString, insert_range_tester(testString, testString2.begin(), testString2.end() ) ); + /* + WeakCheck( testString, test_push_front(testString) ); + WeakCheck( testString, test_push_back(testString) ); + */ + ConstCheck( 0, test_default_construct() ); + // requires _Reserve_t ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testString2 ) ); + ConstCheck( testString, test_copy_construct() ); + + WeakCheck( testString, test_assign_op( testString2 ) ); +} + +#endif // EH_ROPE_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_valarray.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_valarray.cpp new file mode 100644 index 00000000000..f1bc75ee3e5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_valarray.cpp @@ -0,0 +1,81 @@ +// Boris - this file is, um, rather incomplete. Please remove from distribution. + +/*********************************************************************************** + test_string.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Prefix.h" +#if defined( EH_VALARRAY_IMPLEMENTED ) +#include "Tests.h" +#include +#include "TestClass.h" +#include "LeakCheck.h" +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +typedef __valarray__ TestValarray; + +inline sequence_container_tag +container_category(const TestValarray&) +{ + return sequence_container_tag(); +} + +void test_rope() +{ + TestValarray testValarray, testValarray2; + size_t ropeSize = random_number(random_base); + + while ( testValarray.size() < ropeSize ) + { + TestValarray::value_type x = random_number(random_base) ; // initialize before use + testValarray.push_back( x ); + testValarray2.push_back( TestValarray::value_type() ); + } + WeakCheck( testValarray, test_insert_one(testValarray) ); + WeakCheck( testValarray, test_insert_one(testValarray, 0) ); + WeakCheck( testValarray, test_insert_one(testValarray, testValarray.size()) ); + + WeakCheck( testValarray, test_insert_n(testValarray, random_number(random_base) ) ); + WeakCheck( testValarray, test_insert_n(testValarray, random_number(random_base), 0 ) ); + WeakCheck( testValarray, test_insert_n(testValarray, random_number(random_base), testValarray.size() ) ); + + size_t insCnt = random_number(random_base); + TestValarray::value_type *insFirst = new TestValarray::value_type[1+insCnt]; + + WeakCheck( testValarray, insert_range_tester(testValarray, insFirst, insFirst+insCnt) ); + WeakCheck( testValarray, insert_range_at_begin_tester(testValarray, insFirst, insFirst+insCnt) ); + WeakCheck( testValarray, insert_range_at_end_tester(testValarray, insFirst, insFirst+insCnt) ); + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testValarray, insert_range_tester(testValarray, testValarray2.begin(), testValarray2.end() ) ); + + WeakCheck( testValarray, test_push_front(testValarray) ); + WeakCheck( testValarray, test_push_back(testValarray) ); + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testValarray2 ) ); + ConstCheck( testValarray, test_copy_construct() ); + + WeakCheck( testValarray, test_assign_op( testValarray2 ) ); +} + +#endif // EH_ROPE_IMPLEMENTED diff --git a/reactos/lib/3rdparty/stlport/test/eh/test_vector.cpp b/reactos/lib/3rdparty/stlport/test/eh/test_vector.cpp new file mode 100644 index 00000000000..55c35b92dcc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/eh/test_vector.cpp @@ -0,0 +1,126 @@ +/*********************************************************************************** + test_vector.cpp + + * Copyright (c) 1997 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + +***********************************************************************************/ +#include "Tests.h" +#include "TestClass.h" +#include "LeakCheck.h" +# if defined (EH_NEW_HEADERS) +#include +#else +#include +#endif +#include "test_construct.h" +#include "test_assign_op.h" +#include "test_push_back.h" +#include "test_insert.h" +#include "test_push_front.h" + +# if defined (__GNUC__) && defined (__APPLE__) +typedef EH_STD::vector TestVector; +# else +typedef EH_STD::__vector__ TestVector; +# endif + +inline sequence_container_tag +container_category(const TestVector&) +{ + return sequence_container_tag(); +} + +void prepare_insert_n( TestVector& c, size_t insCnt ); + +void prepare_insert_n( TestVector& c, size_t insCnt ) +{ + if ( random_number(2) ) + c.reserve( c.size() + insCnt ); +} + +struct test_reserve +{ + test_reserve( size_t n ) : fAmount(n) { + gTestController.SetCurrentTestName("vector::reserve()"); + } + + void operator()( TestVector& v ) const + { + v.reserve( fAmount ); + } +private: + size_t fAmount; +}; + +inline void prepare_insert_range( TestVector& vec, size_t, TestClass* first, TestClass* last ) +{ + if ( random_number(2) ) + { + ptrdiff_t d = 0; + EH_DISTANCE( first, last, d ); + vec.reserve( vec.size() + d ); + } +} + +void test_vector() +{ + + ConstCheck( 0, test_construct_n( random_number(random_base) ) ); + + TestVector emptyVector; + TestVector testVector, testVector2; + size_t vectorSize = random_number(random_base); + + testVector.reserve(vectorSize*4); + while ( testVector.size() < vectorSize ) + { + TestClass x; + testVector.push_back( x ); + testVector2.push_back( TestClass() ); + } + + size_t insCnt = random_number(random_base); + TestClass *insFirst = new TestVector::value_type[1+ insCnt]; + + ConstCheck( 0, test_construct_pointer_range(insFirst, insFirst+insCnt) ); + + WeakCheck( testVector, insert_range_tester(testVector, insFirst, insFirst+insCnt) ); + WeakCheck( testVector, insert_range_at_begin_tester(testVector, insFirst, insFirst+insCnt) ); + WeakCheck( testVector, insert_range_at_end_tester(testVector, insFirst, insFirst+insCnt) ); + delete[] insFirst; + + WeakCheck( testVector, test_insert_one(testVector) ); + WeakCheck( testVector, test_insert_one(testVector, 0) ); + WeakCheck( testVector, test_insert_one(testVector, (int)testVector.size()) ); + + WeakCheck( testVector, test_insert_n(testVector, random_number(random_base) ) ); + WeakCheck( testVector, test_insert_n(testVector, random_number(random_base), 0 ) ); + WeakCheck( testVector, test_insert_n(testVector, random_number(random_base), (int)testVector.size() ) ); + + WeakCheck( testVector, insert_range_tester(testVector, testVector2.begin(), testVector2.end() ) ); + + + StrongCheck( testVector, test_reserve( testVector.capacity() + random_number(random_base) ) ); + StrongCheck( testVector, test_push_back(testVector) ); + StrongCheck( emptyVector, test_push_back(emptyVector) ); + + ConstCheck( 0, test_default_construct() ); + ConstCheck( 0, test_construct_n_instance( random_number(random_base) ) ); + ConstCheck( 0, test_construct_iter_range( testVector2 ) ); + ConstCheck( testVector, test_copy_construct() ); + + testVector2.resize( testVector.size() * 3 / 2 ); + WeakCheck( testVector, test_assign_op( testVector2 ) ); + testVector2.clear(); + testVector2.resize( testVector.size() * 2 / 3 ); + WeakCheck( testVector, test_assign_op( testVector2 ) ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/_template.cpp b/reactos/lib/3rdparty/stlport/test/unit/_template.cpp new file mode 100644 index 00000000000..a2a86d6a781 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/_template.cpp @@ -0,0 +1,31 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class Test : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); + +protected: + void test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +// +// tests implementation +// +void Test::test() +{ + CPPUNIT_ASSERT(true); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/accum_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/accum_test.cpp new file mode 100644 index 00000000000..bb585614ca1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/accum_test.cpp @@ -0,0 +1,50 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class AccumTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(AccumTest); + CPPUNIT_TEST(accum1); + CPPUNIT_TEST(accum2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void accum1(); + void accum2(); + static int mult(int initial_, int element_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(AccumTest); + +// +// tests implementation +// +void AccumTest::accum1() +{ + vector v(5); + for(int i = 0; (size_t)i < v.size(); ++i) + v[i] = i + 1; + int sum = accumulate(v.begin(), v.end(), 0); + CPPUNIT_ASSERT(sum==15); +} +void AccumTest::accum2() +{ + vector v(5); + for(int i = 0; (size_t)i < v.size(); ++i) + v[i] = i + 1; + int prod = accumulate(v.begin(), v.end(), 1, mult); + CPPUNIT_ASSERT(prod==120); +} +int AccumTest::mult(int initial_, int element_) +{ + return initial_ * element_; +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/adj_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/adj_test.cpp new file mode 100644 index 00000000000..588838c0e99 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/adj_test.cpp @@ -0,0 +1,135 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class AdjTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(AdjTest); + CPPUNIT_TEST(adjfind0); + CPPUNIT_TEST(adjfind1); + CPPUNIT_TEST(adjfind2); + CPPUNIT_TEST(adjdiff0); + CPPUNIT_TEST(adjdiff1); + CPPUNIT_TEST(adjdiff2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void adjfind0(); + void adjfind1(); + void adjfind2(); + void adjdiff0(); + void adjdiff1(); + void adjdiff2(); + static int equal_length(const char* v1_, const char* v2_); + static int mult(int a_, int b_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(AdjTest); + +// +// tests implementation +// +void AdjTest::adjfind0() +{ + int numbers1 [5] = { 1, 2, 4, 8, 16 }; + int numbers2 [5] = { 5, 3, 2, 1, 1 }; + + int* location = adjacent_find((int*)numbers1, (int*)numbers1 + 5); + CPPUNIT_ASSERT(location == numbers1 + 5); // no adj so loc should be _last + + location = adjacent_find((int*)numbers2, (int*)numbers2 + 5); + CPPUNIT_ASSERT(location != numbers2 + 5); // adj location off should be 3 (first 1) + CPPUNIT_ASSERT((location - numbers2)==3); +} +void AdjTest::adjfind1() +{ + typedef vector IntVector; + IntVector v(10); + for (int i = 0; (size_t)i < v.size(); ++i) + v[i] = i; + IntVector::iterator location; + location = adjacent_find(v.begin(), v.end()); + CPPUNIT_ASSERT(location == v.end()); + v[6] = 7; + location = adjacent_find(v.begin(), v.end()); + CPPUNIT_ASSERT(location != v.end()); +} +void AdjTest::adjfind2() +{ + typedef vector CStrVector; + + const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" }; + + const int nameCount = sizeof(names)/sizeof(names[0]); + CStrVector v(nameCount); + for(int i = 0; i < nameCount; i++) + v[i] = names[i]; + CStrVector::iterator location; + location = adjacent_find(v.begin(), v.end(), equal_length); + + CPPUNIT_ASSERT(location != v.end()); +} +int AdjTest::equal_length(const char* v1_, const char* v2_) +{ + return ::strlen(v1_) == ::strlen(v2_); +} +void AdjTest::adjdiff0() +{ + int numbers[5] = { 1, 2, 4, 8, 16 }; + int difference[5]; + adjacent_difference(numbers, numbers + 5, (int*)difference); + CPPUNIT_ASSERT(difference[0]==1); + CPPUNIT_ASSERT(difference[1]==1); + CPPUNIT_ASSERT(difference[2]==2); + CPPUNIT_ASSERT(difference[3]==4); + CPPUNIT_ASSERT(difference[4]==8); +} +void AdjTest::adjdiff1() +{ + vector v(10); + for(int i = 0; (size_t)i < v.size(); ++i) + v[i] = i * i; + vector result(v.size()); + adjacent_difference(v.begin(), v.end(), result.begin()); + CPPUNIT_ASSERT(result[0]==0) + CPPUNIT_ASSERT(result[1]==1) + CPPUNIT_ASSERT(result[2]==3) + CPPUNIT_ASSERT(result[3]==5) + CPPUNIT_ASSERT(result[4]==7) + CPPUNIT_ASSERT(result[5]==9) + CPPUNIT_ASSERT(result[6]==11) + CPPUNIT_ASSERT(result[7]==13) + CPPUNIT_ASSERT(result[8]==15) + CPPUNIT_ASSERT(result[9]==17) +} +void AdjTest::adjdiff2() +{ + vector v(10); + for (int i = 0; (size_t)i < v.size(); ++i) + v[i] = i + 1; + vector result(v.size()); + adjacent_difference(v.begin(), v.end(), result.begin(), mult); + CPPUNIT_ASSERT(result[0]==1) + CPPUNIT_ASSERT(result[1]==2) + CPPUNIT_ASSERT(result[2]==6) + CPPUNIT_ASSERT(result[3]==12) + CPPUNIT_ASSERT(result[4]==20) + CPPUNIT_ASSERT(result[5]==30) + CPPUNIT_ASSERT(result[6]==42) + CPPUNIT_ASSERT(result[7]==56) + CPPUNIT_ASSERT(result[8]==72) + CPPUNIT_ASSERT(result[9]==90) +} +int AdjTest::mult(int a_, int b_) +{ + return a_ * b_; +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/advance_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/advance_test.cpp new file mode 100644 index 00000000000..bd7a16822b2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/advance_test.cpp @@ -0,0 +1,38 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class AdvanceTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(AdvanceTest); + CPPUNIT_TEST(adv); + CPPUNIT_TEST_SUITE_END(); + +protected: + void adv(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(AdvanceTest); + +// +// tests implementation +// +void AdvanceTest::adv() +{ + typedef vector IntVector; + IntVector v(10); + for (int i = 0; (size_t)i < v.size(); ++i) + v[i] = i; + IntVector::iterator location = v.begin(); + CPPUNIT_ASSERT(*location==0); + advance(location, 5); + CPPUNIT_ASSERT(*location==5); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/alg_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/alg_test.cpp new file mode 100644 index 00000000000..da4977a56fa --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/alg_test.cpp @@ -0,0 +1,364 @@ +#include +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +#endif +#include +#include +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class AlgTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(AlgTest); + CPPUNIT_TEST(min_max); + CPPUNIT_TEST(count_test); + CPPUNIT_TEST(sort_test); + CPPUNIT_TEST(search_n_test); + CPPUNIT_TEST(find_first_of_test); + CPPUNIT_TEST(find_first_of_nsc_test); + CPPUNIT_TEST_SUITE_END(); + +protected: + void min_max(); + void count_test(); + void sort_test(); + void search_n_test(); + void find_first_of_test(); + void find_first_of_nsc_test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(AlgTest); + +// +// tests implementation +// +void AlgTest::min_max() +{ + int i = min(4, 7); + CPPUNIT_ASSERT( i == 4 ); + char c = max('a', 'z'); + CPPUNIT_ASSERT( c == 'z' ); + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + c = min('a', 'z', greater()); + CPPUNIT_ASSERT( c == 'z' ); + i = max(4, 7, greater()); + CPPUNIT_ASSERT( i == 4 ); +#endif +} + +void AlgTest::count_test() +{ + { + int i[] = { 1, 4, 2, 8, 2, 2 }; + int n = count(i, i + 6, 2); + CPPUNIT_ASSERT(n==3); +#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS) + n = 0; + count(i, i + 6, 2, n); + CPPUNIT_ASSERT(n==3); +#endif + } + { + vector i; + i.push_back(1); + i.push_back(4); + i.push_back(2); + i.push_back(8); + i.push_back(2); + i.push_back(2); + int n = count(i.begin(), i.end(), 2); + CPPUNIT_ASSERT(n==3); +#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS) + n = 0; + count(i.begin(), i.end(), 2, n); + CPPUNIT_ASSERT(n==3); +#endif + } +} + +void AlgTest::sort_test() +{ + { + vector years; + years.push_back(1962); + years.push_back(1992); + years.push_back(2001); + years.push_back(1999); + sort(years.begin(), years.end()); + CPPUNIT_ASSERT(years[0]==1962); + CPPUNIT_ASSERT(years[1]==1992); + CPPUNIT_ASSERT(years[2]==1999); + CPPUNIT_ASSERT(years[3]==2001); + } + { + deque years; + years.push_back(1962); + years.push_back(1992); + years.push_back(2001); + years.push_back(1999); + sort(years.begin(), years.end()); // <-- changed! + CPPUNIT_ASSERT(years[0]==1962); + CPPUNIT_ASSERT(years[1]==1992); + CPPUNIT_ASSERT(years[2]==1999); + CPPUNIT_ASSERT(years[3]==2001); + } +} + +#define ARRAY_SIZE(arr) sizeof(arr) / sizeof(arr[0]) + +void AlgTest::search_n_test() +{ + int ints[] = {0, 1, 2, 3, 3, 4, 4, 4, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}; + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + //search_n + //Forward iterator + { + slist slint(ints, ints + ARRAY_SIZE(ints)); + slist::iterator slit = search_n(slint.begin(), slint.end(), 2, 2); + CPPUNIT_ASSERT( slit != slint.end() ); + CPPUNIT_ASSERT( *(slit++) == 2 ); + CPPUNIT_ASSERT( *slit == 2 ); + } +#endif + + //Bidirectionnal iterator + { + list lint(ints, ints + ARRAY_SIZE(ints)); + list::iterator lit = search_n(lint.begin(), lint.end(), 3, 3); + CPPUNIT_ASSERT( lit != lint.end() ); + CPPUNIT_ASSERT( *(lit++) == 3 ); + CPPUNIT_ASSERT( *(lit++) == 3 ); + CPPUNIT_ASSERT( *lit == 3 ); + } + + //Random access iterator + { + deque dint(ints, ints + ARRAY_SIZE(ints)); + deque::iterator dit = search_n(dint.begin(), dint.end(), 4, 4); + CPPUNIT_ASSERT( dit != dint.end() ); + CPPUNIT_ASSERT( *(dit++) == 4 ); + CPPUNIT_ASSERT( *(dit++) == 4 ); + CPPUNIT_ASSERT( *(dit++) == 4 ); + CPPUNIT_ASSERT( *dit == 4 ); + } + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + //search_n with predicate + //Forward iterator + { + slist slint(ints, ints + ARRAY_SIZE(ints)); + slist::iterator slit = search_n(slint.begin(), slint.end(), 2, 1, greater()); + CPPUNIT_ASSERT( slit != slint.end() ); + CPPUNIT_ASSERT( *(slit++) > 1 ); + CPPUNIT_ASSERT( *slit > 2 ); + } +#endif + + //Bidirectionnal iterator + { + list lint(ints, ints + ARRAY_SIZE(ints)); + list::iterator lit = search_n(lint.begin(), lint.end(), 3, 2, greater()); + CPPUNIT_ASSERT( lit != lint.end() ); + CPPUNIT_ASSERT( *(lit++) > 2 ); + CPPUNIT_ASSERT( *(lit++) > 2 ); + CPPUNIT_ASSERT( *lit > 2 ); + } + + //Random access iterator + { + deque dint(ints, ints + ARRAY_SIZE(ints)); + deque::iterator dit = search_n(dint.begin(), dint.end(), 4, 3, greater()); + CPPUNIT_ASSERT( dit != dint.end() ); + CPPUNIT_ASSERT( *(dit++) > 3 ); + CPPUNIT_ASSERT( *(dit++) > 3 ); + CPPUNIT_ASSERT( *(dit++) > 3 ); + CPPUNIT_ASSERT( *dit > 3 ); + } + + // test for bug reported by Jim Xochellis + { + int array[] = {0, 0, 1, 0, 1, 1}; + int* array_end = array + sizeof(array) / sizeof(*array); + CPPUNIT_ASSERT(search_n(array, array_end, 3, 1) == array_end); + } + + // test for bug with counter == 1, reported by Timmie Smith + { + int array[] = {0, 1, 2, 3, 4, 5}; + int* array_end = array + sizeof(array) / sizeof(*array); + CPPUNIT_ASSERT( search_n(array, array_end, 1, 1, equal_to() ) == &array[1] ); + } +} + +struct MyIntComparable { + MyIntComparable(int val) : _val(val) {} + bool operator == (const MyIntComparable& other) const + { return _val == other._val; } + +private: + int _val; +}; + +void AlgTest::find_first_of_test() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + slist intsl; + intsl.push_front(1); + intsl.push_front(2); + + { + vector intv; + intv.push_back(0); + intv.push_back(1); + intv.push_back(2); + intv.push_back(3); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), intsl.begin(), intsl.end()); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 1 ); + } + { + vector intv; + intv.push_back(3); + intv.push_back(2); + intv.push_back(1); + intv.push_back(0); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), intsl.begin(), intsl.end()); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 2 ); + } +#endif + + list intl; + intl.push_front(1); + intl.push_front(2); + + { + vector intv; + intv.push_back(0); + intv.push_back(1); + intv.push_back(2); + intv.push_back(3); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), intl.begin(), intl.end()); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 1 ); + } + { + vector intv; + intv.push_back(3); + intv.push_back(2); + intv.push_back(1); + intv.push_back(0); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), intl.begin(), intl.end()); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 2 ); + } + { + char chars[] = {1, 2}; + + vector intv; + intv.push_back(0); + intv.push_back(1); + intv.push_back(2); + intv.push_back(3); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars)); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 1 ); + } + { + unsigned char chars[] = {1, 2, 255}; + + vector intv; + intv.push_back(-10); + intv.push_back(1029); + intv.push_back(255); + intv.push_back(4); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars)); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 255 ); + } + { + signed char chars[] = {93, 2, -101, 13}; + + vector intv; + intv.push_back(-10); + intv.push_back(1029); + intv.push_back(-2035); + intv.push_back(-101); + intv.push_back(4); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars)); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == -101 ); + } + { + char chars[] = {1, 2}; + + vector intv; + intv.push_back(0); + intv.push_back(1); + intv.push_back(2); + intv.push_back(3); + + vector::iterator first; + first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars)); + CPPUNIT_ASSERT( first != intv.end() ); + CPPUNIT_ASSERT( *first == 1 ); + } +} + +typedef pair Pair; + +struct ValueFinder : + public binary_function +{ + bool operator () ( const Pair &p, const string& value ) const + { return p.second == value; } +}; + +void AlgTest::find_first_of_nsc_test() +{ + // Non-symmetrical comparator + + map m; + vector values; + + m[1] = "one"; + m[4] = "four"; + m[10] = "ten"; + m[20] = "twenty"; + + values.push_back( "four" ); + values.push_back( "ten" ); + + map::iterator i = find_first_of(m.begin(), m.end(), values.begin(), values.end(), ValueFinder()); + + CPPUNIT_ASSERT( i != m.end() ); + CPPUNIT_ASSERT( i->first == 4 || i->first == 10 ); + CPPUNIT_ASSERT( i->second == "four" || i->second == "ten" ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/algorithm_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/algorithm_header_test.cpp new file mode 100644 index 00000000000..8c3577fb724 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/algorithm_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/allocator_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/allocator_test.cpp new file mode 100644 index 00000000000..2760cd10f7b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/allocator_test.cpp @@ -0,0 +1,168 @@ +#include +#include + +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class AllocatorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(AllocatorTest); + CPPUNIT_TEST(zero_allocation); +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + CPPUNIT_TEST(bad_alloc_test); +#endif +#if defined (STLPORT) && defined (_STLP_THREADS) && defined (_STLP_USE_PERTHREAD_ALLOC) + CPPUNIT_TEST(per_thread_alloc); +#endif + CPPUNIT_TEST_SUITE_END(); + +protected: + void zero_allocation(); + void bad_alloc_test(); + void per_thread_alloc(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(AllocatorTest); + +// +// tests implementation +// +void AllocatorTest::zero_allocation() +{ + typedef allocator CharAllocator; + CharAllocator charAllocator; + + char* buf = charAllocator.allocate(0); + charAllocator.deallocate(buf, 0); + + charAllocator.deallocate(0, 0); +} + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + +struct BigStruct +{ + char _data[4096]; +}; + +void AllocatorTest::bad_alloc_test() +{ + typedef allocator BigStructAllocType; + BigStructAllocType bigStructAlloc; + + try { + //Lets try to allocate almost 4096 Go (on most of the platforms) of memory: + BigStructAllocType::pointer pbigStruct = bigStructAlloc.allocate(1024 * 1024 * 1024); + + //Allocation failed but no exception thrown + CPPUNIT_ASSERT( pbigStruct != 0 ); + + // Just it case it succeeds: + bigStructAlloc.deallocate(pbigStruct, 1024 * 1024 * 1024); + } + catch (bad_alloc const&) { + } + catch (...) { + //We shouldn't be there: + //Not bad_alloc exception thrown. + CPPUNIT_FAIL; + } +} +#endif + +#if defined (STLPORT) && defined (_STLP_THREADS) && defined (_STLP_USE_PERTHREAD_ALLOC) +# include + +class SharedDatas +{ +public: + typedef vector > thread_vector; + + SharedDatas(size_t nbElems) : threadVectors(nbElems, (thread_vector*)0) { + pthread_mutex_init(&mutex, 0); + pthread_cond_init(&condition, 0); + } + + ~SharedDatas() { + for (size_t i = 0; i < threadVectors.size(); ++i) { + delete threadVectors[i]; + } + } + + size_t initThreadVector() { + size_t ret; + + pthread_mutex_lock(&mutex); + + for (size_t i = 0; i < threadVectors.size(); ++i) { + if (threadVectors[i] == 0) { + threadVectors[i] = new thread_vector(); + ret = i; + break; + } + } + + if (ret != threadVectors.size() - 1) { + //We wait for other thread(s) to call this method too: + printf("Thread %d wait\n", ret); + pthread_cond_wait(&condition, &mutex); + } + else { + //We are the last thread calling this method, we signal this + //to the other thread(s) that might be waiting: + printf("Thread %d signal\n", ret); + pthread_cond_signal(&condition); + } + + pthread_mutex_unlock(&mutex); + + return ret; + } + + thread_vector& getThreadVector(size_t index) { + //We return other thread thread_vector instance: + return *threadVectors[(index + 1 == threadVectors.size()) ? 0 : index + 1]; + } + +private: + pthread_mutex_t mutex; + pthread_cond_t condition; + vector threadVectors; +}; + +void* f(void* pdatas) { + SharedDatas *psharedDatas = (SharedDatas*)pdatas; + + int threadIndex = psharedDatas->initThreadVector(); + + for (int i = 0; i < 100; ++i) { + psharedDatas->getThreadVector(threadIndex).push_back(i); + } + + return 0; +} + +void AllocatorTest::per_thread_alloc() +{ + const size_t nth = 2; + SharedDatas datas(nth); + pthread_t t[nth]; + + size_t i; + for (i = 0; i < nth; ++i) { + pthread_create(&t[i], 0, f, &datas); + } + + for (i = 0; i < nth; ++i ) { + pthread_join(t[i], 0); + } +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/assert_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/assert_header_test.c new file mode 100644 index 00000000000..a478877661c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/assert_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/bcompos_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bcompos_test.cpp new file mode 100644 index 00000000000..d117fab21a5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bcompos_test.cpp @@ -0,0 +1,55 @@ +#include +#include "unary.h" + +#include "cppunit/cppunit_proxy.h" + +#if defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BcomposTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BcomposTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(bcompos1); + CPPUNIT_TEST(bcompos2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void bcompos1(); + void bcompos2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BcomposTest); + +// +// tests implementation +// +void BcomposTest::bcompos1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int array [6] = { -2, -1, 0, 1, 2, 3 }; + + binary_compose, odd, positive> + b = binary_compose, odd, positive>(logical_and(), odd(), positive()); + + int* p = find_if((int*)array, (int*)array + 6, b); + CPPUNIT_ASSERT(p != array + 6); +#endif +} + +void BcomposTest::bcompos2() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int array [6] = { -2, -1 , 0, 1, 2, 3 }; + + int* p = find_if((int*)array, (int*)array + 6, + compose2(logical_and(), odd(), positive())); + CPPUNIT_ASSERT(p != array + 6); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/bind_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bind_test.cpp new file mode 100644 index 00000000000..8773baaab72 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bind_test.cpp @@ -0,0 +1,149 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BindTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BindTest); + CPPUNIT_TEST(bind1st1); + CPPUNIT_TEST(bind2nd1); + CPPUNIT_TEST(bind2nd2); +#if !defined (STLPORT) || \ + defined (_STLP_NO_EXTENSIONS) || !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(bind2nd3); + CPPUNIT_TEST(bind_memfn); + CPPUNIT_TEST_SUITE_END(); + +protected: + void bind1st1(); + void bind2nd1(); + void bind2nd2(); + void bind2nd3(); + void bind_memfn(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BindTest); + +class pre_increment : public binary_function { +public: + int operator()(int incr, int& val) const + { return val += incr; } +}; + +class post_increment : public binary_function { +public: + int operator()(int& val, int incr) const + { return val += incr; } +}; + + +// +// tests implementation +// +void BindTest::bind1st1() +{ + int array [3] = { 1, 2, 3 }; + int* p = remove_if((int*)array, (int*)array + 3, bind1st(less(), 2)); + + CPPUNIT_ASSERT(p == &array[2]); + CPPUNIT_ASSERT(array[0] == 1); + CPPUNIT_ASSERT(array[1] == 2); + + for_each((int*)array, (int*)array + 3, bind1st(pre_increment(), 1)); + CPPUNIT_ASSERT(array[0] == 2); + CPPUNIT_ASSERT(array[1] == 3); + CPPUNIT_ASSERT(array[2] == 4); + + for_each((int*)array, (int*)array + 3, bind2nd(post_increment(), 1)); + CPPUNIT_ASSERT(array[0] == 3); + CPPUNIT_ASSERT(array[1] == 4); + CPPUNIT_ASSERT(array[2] == 5); +} + +void BindTest::bind2nd1() +{ + int array [3] = { 1, 2, 3 }; + replace_if(array, array + 3, binder2nd >(greater(), 2), 4); + + CPPUNIT_ASSERT(array[0]==1); + CPPUNIT_ASSERT(array[1]==2); + CPPUNIT_ASSERT(array[2]==4); +} +void BindTest::bind2nd2() +{ + int array [3] = { 1, 2, 3 }; + replace_if(array, array + 3, bind2nd(greater(), 2), 4); + CPPUNIT_ASSERT(array[0]==1); + CPPUNIT_ASSERT(array[1]==2); + CPPUNIT_ASSERT(array[2]==4); +} + +int test_func1 (const int ¶m1, const int ¶m2) { + return param1 + param2; +} + +int test_func2 (int ¶m1, int param2) { + param1 += param2; + return param1 + param2; +} + +void BindTest::bind2nd3() +{ +#if defined (STLPORT) && \ + !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + int array[3] = { 1, 2, 3 }; + transform(array, array + 3, array, bind2nd(ptr_fun(test_func1), 1)); + transform(array, array + 3, array, bind1st(ptr_fun(test_func1), -1)); + CPPUNIT_ASSERT(array[0] == 1); + CPPUNIT_ASSERT(array[1] == 2); + CPPUNIT_ASSERT(array[2] == 3); + + transform(array, array + 3, array, bind2nd(ptr_fun(test_func2), 10)); + CPPUNIT_ASSERT(array[0] == 21); + CPPUNIT_ASSERT(array[1] == 22); + CPPUNIT_ASSERT(array[2] == 23); +#endif +} + +class A +{ + public: + A() : m_n( 0 ) + {} + + void f( int n ) const { +#if defined (STLPORT) + _STLP_MUTABLE(A, m_n) = n; +#else + m_n = n; +#endif + } + + int v() const + { return m_n; } + + private: + mutable int m_n; +}; + +void BindTest::bind_memfn() +{ +#if defined (STLPORT) && \ + !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + A array[3]; + + for_each( array, array + 3, bind2nd( mem_fun_ref(&A::f), 12 ) ); + + CPPUNIT_CHECK( array[0].v() == 12 ); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/binsert_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/binsert_test.cpp new file mode 100644 index 00000000000..e085a5ce07e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/binsert_test.cpp @@ -0,0 +1,54 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BinsertTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BinsertTest); + CPPUNIT_TEST(binsert1); + CPPUNIT_TEST(binsert2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void binsert1(); + void binsert2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BinsertTest); + +// +// tests implementation +// +void BinsertTest::binsert1() +{ + const char* array [] = { "laurie", "jennifer", "leisa" }; + vector names; + back_insert_iterator > bit(names); + bit = copy(array, array + 3, bit); + + CPPUNIT_ASSERT(!strcmp(names[0],array[0])); + CPPUNIT_ASSERT(!strcmp(names[1],array[1])); + CPPUNIT_ASSERT(!strcmp(names[2],array[2])); + + copy(array, array + 3, bit); + CPPUNIT_ASSERT(!strcmp(names[3],array[0])); + CPPUNIT_ASSERT(!strcmp(names[4],array[1])); + CPPUNIT_ASSERT(!strcmp(names[5],array[2])); +} +void BinsertTest::binsert2() +{ + const char* array [] = { "laurie", "jennifer", "leisa" }; + vector names; + copy(array, array + 3, back_inserter(names)); + CPPUNIT_ASSERT(!strcmp(names[0],array[0])); + CPPUNIT_ASSERT(!strcmp(names[1],array[1])); + CPPUNIT_ASSERT(!strcmp(names[2],array[2])); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/bitset_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bitset_header_test.cpp new file mode 100644 index 00000000000..dbd5cc213b8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bitset_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/bitset_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bitset_test.cpp new file mode 100644 index 00000000000..141f646bc6a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bitset_test.cpp @@ -0,0 +1,110 @@ +#include +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BitsetTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BitsetTest); + CPPUNIT_TEST(bitset1); +#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(iostream); + CPPUNIT_TEST_SUITE_END(); + +protected: + void bitset1(); + void iostream(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BitsetTest); + +// +// tests implementation +// +void BitsetTest::bitset1() +{ + bitset<13U> b1(0xFFFF); + bitset<13U> b2(0x1111); + CPPUNIT_ASSERT(b1.size() == 13); + CPPUNIT_ASSERT(b1 == 0x1FFF); + CPPUNIT_ASSERT(b2.size() == 13); + CPPUNIT_ASSERT(b2 == 0x1111); + +#if !defined (STLPORT) || !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) + b1 = b1 ^ (b2 << 2); + CPPUNIT_ASSERT(b1 == 0x1BBB); + + CPPUNIT_ASSERT(b1.count() == 10); + CPPUNIT_ASSERT(b2.count() == 4); + +# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + size_t __pos = b2._Find_first(); + CPPUNIT_ASSERT( __pos == 0 ); + __pos = b2._Find_next(__pos); + CPPUNIT_ASSERT( __pos == 4 ); + __pos = b2._Find_next(__pos); + CPPUNIT_ASSERT( __pos == 8 ); + __pos = b2._Find_next(__pos); + CPPUNIT_ASSERT( __pos == 12 ); + __pos = b2._Find_next(__pos); + CPPUNIT_ASSERT( __pos == 13 ); +# endif +#endif + +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) + string representation = b2.to_string, allocator >(); + CPPUNIT_ASSERT( representation == "1000100010001" ); +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + wstring wrepresentation = b2.to_string, allocator >(); + CPPUNIT_ASSERT( wrepresentation == L"1000100010001" ); +# endif +#else + CPPUNIT_ASSERT( b2.to_string() == "1000100010001" ); +#endif +} + +void BitsetTest::iostream() +{ +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) + { + stringstream sstr; + bitset<13U> b(0x1111); + sstr << b; + CPPUNIT_ASSERT( sstr.str() == "1000100010001" ); + + bitset<13U> b1; + sstr >> b1; + CPPUNIT_ASSERT( b1.test(0) ); + CPPUNIT_ASSERT( b1.test(4) ); + CPPUNIT_ASSERT( b1.test(8) ); + CPPUNIT_ASSERT( b1.test(12) ); + } +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + { + wstringstream sstr; + bitset<13U> b(0x1111); + sstr << b; + CPPUNIT_ASSERT( sstr.str() == L"1000100010001" ); + + bitset<13U> b1; + sstr >> b1; + CPPUNIT_ASSERT( b1.test(0) ); + CPPUNIT_ASSERT( b1.test(4) ); + CPPUNIT_ASSERT( b1.test(8) ); + CPPUNIT_ASSERT( b1.test(12) ); + } +# endif +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/bnegate_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bnegate_test.cpp new file mode 100644 index 00000000000..888b036ea81 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bnegate_test.cpp @@ -0,0 +1,48 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BnegateTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BnegateTest); + CPPUNIT_TEST(bnegate1); + CPPUNIT_TEST(bnegate2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void bnegate1(); + void bnegate2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BnegateTest); + +// +// tests implementation +// +void BnegateTest::bnegate1() +{ + int array [4] = { 4, 9, 7, 1 }; + + sort(array, array + 4, binary_negate >(greater())); + CPPUNIT_ASSERT(array[0]==1); + CPPUNIT_ASSERT(array[1]==4); + CPPUNIT_ASSERT(array[2]==7); + CPPUNIT_ASSERT(array[3]==9); +} +void BnegateTest::bnegate2() +{ + int array [4] = { 4, 9, 7, 1 }; + sort(array, array + 4, not2(greater())); + CPPUNIT_ASSERT(array[0]==1); + CPPUNIT_ASSERT(array[1]==4); + CPPUNIT_ASSERT(array[2]==7); + CPPUNIT_ASSERT(array[3]==9); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/boost_check.cpp b/reactos/lib/3rdparty/stlport/test/unit/boost_check.cpp new file mode 100644 index 00000000000..4bf7b95659a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/boost_check.cpp @@ -0,0 +1,49 @@ +#ifndef WITHOUT_STLPORT +#include + +#ifdef _STLP_USE_BOOST_SUPPORT + +#include + +#endif // _STLP_USE_BOOST_SUPPORT + +#else + +#if 0 // Problem 1: +/* ******************************* +../../../stlport/functional:63: error: 'boost::mem_fn' has not been declared +../../../stlport/functional:64: error: 'boost::bind' has not been declared +../../../stlport/functional:67: error: '::_1' has not been declared +../../../stlport/functional:68: error: '::_2' has not been declared +../../../stlport/functional:69: error: '::_3' has not been declared +../../../stlport/functional:70: error: '::_4' has not been declared +../../../stlport/functional:71: error: '::_5' has not been declared +../../../stlport/functional:72: error: '::_6' has not been declared +../../../stlport/functional:73: error: '::_7' has not been declared +../../../stlport/functional:74: error: '::_8' has not been declared +../../../stlport/functional:75: error: '::_9' has not been declared + ******************************* */ + +#include + +#endif // Problem 1 + +#if 0 // Problem 2 + +#include + +#endif // Problem 2 + +#if 0 // Problem 3 + +#include + +#endif // Problem 3 + +#if 0 // Problem 4 + +#include + +#endif // Problem 4 + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/bound_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bound_test.cpp new file mode 100644 index 00000000000..f7cc6e28b7e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bound_test.cpp @@ -0,0 +1,80 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BoundTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BoundTest); + CPPUNIT_TEST(lwrbnd1); + CPPUNIT_TEST(lwrbnd2); + CPPUNIT_TEST(uprbnd1); + CPPUNIT_TEST(uprbnd2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void lwrbnd1(); + void lwrbnd2(); + void uprbnd1(); + void uprbnd2(); + + static bool char_str_less(const char* a_, const char* b_) + { + return strcmp(a_, b_) < 0 ? 1 : 0; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BoundTest); + +// +// tests implementation +// +void BoundTest::uprbnd1() +{ + int arr[20]; + for(int i = 0; i < 20; i++) + { + arr[i] = i/4; + } + int location = upper_bound((int*)arr, (int*)arr + 20, 3) - arr; + CPPUNIT_ASSERT(location==16); +} + +void BoundTest::uprbnd2() +{ + char const* str [] = { "a", "a", "b", "b", "q", "w", "z" }; + + const unsigned strCt = sizeof(str)/sizeof(str[0]); + + int location = (upper_bound((char const**)str, (char const**)str + strCt, (const char *)"d", char_str_less) - str); + CPPUNIT_ASSERT(location==4); +} +void BoundTest::lwrbnd1() +{ + vector v1(20); + for (int i = 0; (size_t)i < v1.size(); ++i) + { + v1[i] = i/4; + } + // 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 + vector::iterator location = lower_bound(v1.begin(), v1.end(), 3); + + CPPUNIT_ASSERT((location - v1.begin())==12); +} + +void BoundTest::lwrbnd2() +{ + char const* str [] = { "a", "a", "b", "b", "q", "w", "z" }; + + const unsigned strCt = sizeof(str)/sizeof(str[0]); + char const** location = lower_bound((char const**)str, (char const**)str + strCt, (const char *)"d", char_str_less); + + CPPUNIT_ASSERT((location - str) == 4); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/bsearch_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bsearch_test.cpp new file mode 100644 index 00000000000..27dcc0264d7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bsearch_test.cpp @@ -0,0 +1,49 @@ +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BsearchTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BsearchTest); + CPPUNIT_TEST(bsearch1); + CPPUNIT_TEST(bsearch2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void bsearch1(); + void bsearch2(); + static bool str_compare(const char* a_, const char* b_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BsearchTest); + +// +// tests implementation +// +void BsearchTest::bsearch1() +{ + int vector[100]; + for(int i = 0; i < 100; i++) + vector[i] = i; + CPPUNIT_ASSERT(binary_search(vector, vector + 100, 42)); +} + +void BsearchTest::bsearch2() +{ + char const* labels[] = { "aa", "dd", "ff", "jj", "ss", "zz" }; + const unsigned count = sizeof(labels) / sizeof(labels[0]); + // DEC C++ generates incorrect template instatiation code + // for "ff" so must cast + CPPUNIT_ASSERT(binary_search(labels, labels + count, (const char *)"ff", str_compare)); +} +bool BsearchTest::str_compare(const char* a_, const char* b_) +{ + return strcmp(a_, b_) < 0 ? 1 : 0; +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/bvector_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/bvector_test.cpp new file mode 100644 index 00000000000..b0c49122f58 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/bvector_test.cpp @@ -0,0 +1,71 @@ +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class BvectorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(BvectorTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(bvec1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void bvec1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BvectorTest); + +// +// tests implementation +// +void BvectorTest::bvec1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + bool ii[3]= {1,0,1}; + bit_vector b(3); + + CPPUNIT_ASSERT(b[0]==0); + CPPUNIT_ASSERT(b[1]==0); + CPPUNIT_ASSERT(b[2]==0); + + b[0] = b[2] = 1; + + CPPUNIT_ASSERT(b[0]==1); + CPPUNIT_ASSERT(b[1]==0); + CPPUNIT_ASSERT(b[2]==1); + + b.insert(b.begin(),(bool*)ii, ii+2); + + CPPUNIT_ASSERT(b[0]==1); + CPPUNIT_ASSERT(b[1]==0); + CPPUNIT_ASSERT(b[2]==1); + CPPUNIT_ASSERT(b[3]==0); + CPPUNIT_ASSERT(b[4]==1); + + bit_vector bb = b; + if (bb != b) + exit(1); + + b[0] |= 0; + b[1] |= 0; + b[2] |= 1; + b[3] |= 1; + CPPUNIT_ASSERT(!((b[0] != 1) || (b[1] != 0) || (b[2] != 1) || (b[3] != 1))); + + + bb[0] &= 0; + bb[1] &= 0; + bb[2] &= 1; + bb[3] &= 1; + CPPUNIT_ASSERT(!((bb[0] != 0) || (bb[1] != 0) || (bb[2] != 1) || (bb[3] != 0))); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/c_limits_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/c_limits_header_test.c new file mode 100644 index 00000000000..04b2bf202d6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/c_limits_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/c_locale_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/c_locale_header_test.c new file mode 100644 index 00000000000..8dbec46ad66 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/c_locale_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cassert_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cassert_header_test.cpp new file mode 100644 index 00000000000..bafdf327897 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cassert_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cctype_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cctype_header_test.cpp new file mode 100644 index 00000000000..8a67339df4a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cctype_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cerrno_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cerrno_header_test.cpp new file mode 100644 index 00000000000..c0e1d5a37a7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cerrno_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cfloat_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cfloat_header_test.cpp new file mode 100644 index 00000000000..4579c73b94a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cfloat_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/ciso646_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ciso646_header_test.cpp new file mode 100644 index 00000000000..4b7b25713c8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ciso646_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/climits_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/climits_header_test.cpp new file mode 100644 index 00000000000..cf71b9fecf8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/climits_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/clocale_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/clocale_header_test.cpp new file mode 100644 index 00000000000..5d3b36af07e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/clocale_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cmath_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cmath_header_test.cpp new file mode 100644 index 00000000000..5c9b7cbd08f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cmath_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cmath_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cmath_test.cpp new file mode 100644 index 00000000000..07185e9f233 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cmath_test.cpp @@ -0,0 +1,170 @@ +#define _STLP_DO_IMPORT_CSTD_FUNCTIONS + +#include +#include +//We also test math functions imported from stdlib.h or +//defined in cstdlib +#include + +#include "math_aux.h" +#include "cppunit/cppunit_proxy.h" + +//This test purpose is to check the right import of math.h C symbols +//into the std namespace so we do not use the using namespace std +//specification + +// +// TestCase class +// +class CMathTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(CMathTest); +#if defined (STLPORT) && !defined (_STLP_USE_NAMESPACES) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(import_checks); + CPPUNIT_TEST_SUITE_END(); + + protected: + void import_checks(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(CMathTest); + +// +// tests implementation +// +void CMathTest::import_checks() +{ +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) + int int_val = -1; + long long_val = -1l; + float float_val = -1.0f; + double double_val = -1.0; +# if !defined (_STLP_NO_LONG_DOUBLE) + long double long_double_val = -1.0l; +# endif + + CPPUNIT_CHECK( are_equals(std::abs(int_val), -int_val) ); + CPPUNIT_CHECK( are_equals(std::abs(long_val), -long_val) ); + CPPUNIT_CHECK( are_equals(std::labs(long_val), -long_val) ); + CPPUNIT_CHECK( are_equals(std::abs(float_val), -float_val) ); + CPPUNIT_CHECK( are_equals(std::abs(double_val), -double_val) ); +# if !defined (_STLP_NO_LONG_DOUBLE) + CPPUNIT_CHECK( are_equals(std::abs(long_double_val), -long_double_val) ); +# endif + + CPPUNIT_CHECK( are_equals(std::fabs(float_val), -float_val) ); + CPPUNIT_CHECK( are_equals(std::fabs(double_val), -double_val) ); +# if !defined (_STLP_NO_LONG_DOUBLE) + CPPUNIT_CHECK( are_equals(std::fabs(long_double_val), -long_double_val) ); +# endif + + std::div_t div_res = std::div(3, 2); + CPPUNIT_CHECK( div_res.quot == 1 ); + CPPUNIT_CHECK( div_res.rem == 1 ); + std::ldiv_t ldiv_res = std::ldiv(3l, 2l); + CPPUNIT_CHECK( ldiv_res.quot == 1l ); + CPPUNIT_CHECK( ldiv_res.rem == 1l ); + ldiv_res = std::div(3l, 2l); + CPPUNIT_CHECK( ldiv_res.quot == 1l ); + CPPUNIT_CHECK( ldiv_res.rem == 1l ); + + std::srand(2); + int rand_val = std::rand(); + CPPUNIT_CHECK( rand_val >= 0 && rand_val <= RAND_MAX ); + + CPPUNIT_CHECK( are_equals(std::floor(1.5), 1.0) ); + CPPUNIT_CHECK( are_equals(std::ceil(1.5), 2.0) ); + CPPUNIT_CHECK( are_equals(std::fmod(1.5, 1.0), 0.5) ); + CPPUNIT_CHECK( are_equals(std::sqrt(4.0), 2.0) ); + CPPUNIT_CHECK( are_equals(std::pow(2.0, 2), 4.0) ); + /* + * Uncomment the following to check that it generates an ambiguous call + * as there is no Standard pow(int, int) function only pow(double, int), + * pow(float, int) and some others... + * If it do not generate a compile time error it should at least give + * the good result. + */ + //CPPUNIT_CHECK( are_equals(std::pow(10, -2), 0.01) ); + CPPUNIT_CHECK( are_equals(std::pow(10.0, -2), 0.01) ); + CPPUNIT_CHECK( are_equals(std::exp(0.0), 1.0) ); + CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0)), 1.0) ); + CPPUNIT_CHECK( are_equals(std::log10(100.0), 2.0) ); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64) + CPPUNIT_CHECK( are_equals(std::modf(100.5, &double_val), 0.5) ); + CPPUNIT_CHECK( are_equals(double_val, 100.0) ); +# endif + double_val = std::frexp(8.0, &int_val); + CPPUNIT_CHECK( are_equals(double_val * std::pow(2.0, int_val), 8.0) ); + CPPUNIT_CHECK( are_equals(std::ldexp(1.0, 2), 4.0) ); + CPPUNIT_CHECK( are_equals(std::cos(std::acos(1.0)), 1.0) ); + CPPUNIT_CHECK( are_equals(std::sin(std::asin(1.0)), 1.0) ); + CPPUNIT_CHECK( are_equals(std::tan(std::atan(1.0)), 1.0) ); + CPPUNIT_CHECK( are_equals(std::tan(std::atan2(1.0, 1.0)), 1.0) ); + CPPUNIT_CHECK( are_equals(std::cosh(0.0), 1.0) ); + CPPUNIT_CHECK( are_equals(std::sinh(0.0), 0.0) ); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64) + CPPUNIT_CHECK( are_equals(std::tanh(0.0), 0.0) ); +# endif + + CPPUNIT_CHECK( are_equals(std::floor(1.5f), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::ceil(1.5f), 2.0f) ); + CPPUNIT_CHECK( are_equals(std::fmod(1.5f, 1.0f), 0.5f) ); + CPPUNIT_CHECK( are_equals(std::sqrt(4.0f), 2.0f) ); + CPPUNIT_CHECK( are_equals(std::pow(2.0f, 2), 4.0f) ); + CPPUNIT_CHECK( are_equals(std::exp(0.0f), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0f)), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::log10(100.0f), 2.0f) ); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64) + CPPUNIT_CHECK( are_equals(std::modf(100.5f, &float_val), 0.5f) ); + CPPUNIT_CHECK( are_equals(float_val, 100.0f) ); +# endif + float_val = std::frexp(8.0f, &int_val); + CPPUNIT_CHECK( are_equals(float_val * std::pow(2.0f, int_val), 8.0f) ); + CPPUNIT_CHECK( are_equals(std::ldexp(1.0f, 2), 4.0f) ); + CPPUNIT_CHECK( are_equals(std::cos(std::acos(1.0f)), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::sin(std::asin(1.0f)), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::tan(std::atan(1.0f)), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::tan(std::atan2(1.0f, 1.0f)), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::cosh(0.0f), 1.0f) ); + CPPUNIT_CHECK( are_equals(std::sinh(0.0f), 0.0f) ); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64) + CPPUNIT_CHECK( are_equals(std::tanh(0.0f), 0.0f) ); +# endif + +# if !defined (_STLP_NO_LONG_DOUBLE) + CPPUNIT_CHECK( are_equals(std::floor(1.5l), 1.0l) ); + CPPUNIT_CHECK( are_equals(std::ceil(1.5l), 2.0l) ); + CPPUNIT_CHECK( are_equals(std::fmod(1.5l, 1.0l), 0.5l) ); + CPPUNIT_CHECK( are_equals(std::sqrt(4.0l), 2.0l) ); + CPPUNIT_CHECK( are_equals(std::pow(2.0l, 2), 4.0l) ); + CPPUNIT_CHECK( are_equals(std::exp(0.0l), 1.0l) ); + CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0l)), 1.0l) ); + CPPUNIT_CHECK( are_equals(std::log10(100.0l), 2.0l) ); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64) + CPPUNIT_CHECK( are_equals(std::modf(100.5l, &long_double_val), 0.5l) ); + CPPUNIT_CHECK( are_equals(long_double_val, 100.0l) ); +# endif + long_double_val = std::frexp(8.0l, &int_val); + CPPUNIT_CHECK( are_equals(long_double_val * std::pow(2.0l, int_val), 8.0l) ); + CPPUNIT_CHECK( are_equals(std::ldexp(1.0l, 2), 4.0l) ); + CPPUNIT_CHECK( are_equals(std::cos(std::acos(1.0l)), 1.0l) ); + CPPUNIT_CHECK( are_equals(std::sin(std::asin(1.0l)), 1.0l) ); + CPPUNIT_CHECK( are_equals(std::tan(0.0l), 0.0l) ); + CPPUNIT_CHECK( are_equals(std::atan(0.0l), 0.0l) ); + CPPUNIT_CHECK( are_equals(std::atan2(0.0l, 1.0l), 0.0l) ); + CPPUNIT_CHECK( are_equals(std::cosh(0.0l), 1.0l) ); + CPPUNIT_CHECK( are_equals(std::sinh(0.0l), 0.0l) ); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64) + CPPUNIT_CHECK( are_equals(std::tanh(0.0l), 0.0l) ); +# endif +# endif + + CPPUNIT_CHECK( are_equals(std::sqrt(std::sqrt(std::sqrt(256.0))), 2.0) ); + CPPUNIT_CHECK( are_equals(std::sqrt(std::sqrt(std::sqrt(256.0f))), 2.0f) ); +# if !defined (_STLP_NO_LONG_DOUBLE) + CPPUNIT_CHECK( are_equals(std::sqrt(std::sqrt(std::sqrt(256.0l))), 2.0l) ); +# endif +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/codecvt_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/codecvt_test.cpp new file mode 100644 index 00000000000..c33fe1518fd --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/codecvt_test.cpp @@ -0,0 +1,654 @@ +#include + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include +# include // for WEOF + +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// TestCase class +// +class CodecvtTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(CodecvtTest); +#if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(variable_encoding); + CPPUNIT_STOP_IGNORE; +#if defined (STLPORT) && (defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS)) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(in_out_test); + CPPUNIT_TEST(length_test); + CPPUNIT_TEST(imbue_while_reading); + CPPUNIT_TEST(special_encodings); + CPPUNIT_TEST_SUITE_END(); + +protected: + void variable_encoding(); + void in_out_test(); + void length_test(); + void imbue_while_reading(); + void special_encodings(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(CodecvtTest); + +#if defined (STLPORT) +# define __NO_THROW _STLP_NOTHROW +#else +# define __NO_THROW throw() +#endif + + +/* Codecvt facet eating some characters from the external buffer. + * Transform '01' in 'a' + */ +struct eater_codecvt : public codecvt { + typedef codecvt base; + + explicit eater_codecvt(size_t refs = 0) : base(refs) {} + + // primitive conversion + virtual base::result + do_in(mbstate_t& mb, + const char* ebegin, const char* eend, const char*& ecur, + char* ibegin, char* iend, char*& icur) const __NO_THROW { + char *state = (char*)&mb; + ecur = ebegin; + icur = ibegin; + + while (ecur != eend) { + if (icur == iend) + return partial; + if (*ecur == '0' || *state == 1) { + if (*state != 1) { + ++ecur; + } + if (ecur == eend) { + *state = 1; + return ok; + } + + if (*ecur == '1') { + *icur = 'a'; + } + else { + *(icur++) = '0'; + if (icur == iend) { + if (*state != 1) { + --ecur; + } + return partial; + } + *icur = *ecur; + } + } + else { + *icur = *ecur; + } + + *state = 0; + ++icur; + ++ecur; + } + + return ok; + } + + // claim it's not a null-conversion + virtual bool do_always_noconv() const __NO_THROW + { return false; } + + // claim it doesn't have a fixed-length encoding + virtual int do_encoding() const __NO_THROW + { return 0; } + + // implemented for consistency with do_in overload + virtual int do_length(mbstate_t &state, + const char *efrom, const char *eend, size_t m) const { + char *ibegin = new char[m]; + const char *ecur = efrom; + char *icur = ibegin; + mbstate_t tmp = state; + do_in(tmp, efrom, eend, ecur, ibegin, ibegin + m, icur); + delete[] ibegin; + return ecur - efrom; + } + + virtual int do_max_length() const __NO_THROW + { return 2; } + +#ifdef __DMC__ + static locale::id id; +#endif +}; + +#ifdef __DMC__ +locale::id eater_codecvt::id; + +locale::id& _GetFacetId(const eater_codecvt*) +{ return eater_codecvt::id; } +#endif + +/* Codecvt facet generating more characters than the ones read from the + * external buffer, transform '01' in 'abc' + * This kind of facet do not allow systematical positionning in the external + * buffer (tellg -> -1), when you just read a 'a' you are at an undefined + * external buffer position. + */ +struct generator_codecvt : public codecvt { + typedef codecvt base; + + explicit generator_codecvt(size_t refs = 0) : base(refs) {} + + // primitive conversion + virtual base::result + do_in(mbstate_t& mb, + const char* ebegin, const char* eend, const char*& ecur, + char* ibegin, char* iend, char*& icur) const __NO_THROW { + //Access the mbstate information in a portable way: + char *state = (char*)&mb; + ecur = ebegin; + icur = ibegin; + + if (icur == iend) return ok; + + if (*state == 2) { + *(icur++) = 'b'; + if (icur == iend) { + *state = 3; + return ok; + } + *(icur++) = 'c'; + *state = 0; + } + else if (*state == 3) { + *(icur++) = 'c'; + *state = 0; + } + + while (ecur != eend) { + if (icur == iend) + return ok; + if (*ecur == '0' || *state == 1) { + if (*state != 1) { + ++ecur; + } + if (ecur == eend) { + *state = 1; + return partial; + } + + if (*ecur == '1') { + *(icur++) = 'a'; + if (icur == iend) { + *state = 2; + return ok; + } + *(icur++) = 'b'; + if (icur == iend) { + *state = 3; + return ok; + } + *icur = 'c'; + } + else { + *(icur++) = '0'; + if (icur == iend) { + if (*state != 1) { + --ecur; + } + return ok; + } + *icur = *ecur; + } + } + else { + *icur = *ecur; + } + + *state = 0; + ++icur; + ++ecur; + } + + return ok; + } + + // claim it's not a null-conversion + virtual bool do_always_noconv() const __NO_THROW + { return false; } + + // claim it doesn't have a fixed-length encoding + virtual int do_encoding() const __NO_THROW + { return 0; } + + // implemented for consistency with do_in overload + virtual int do_length(mbstate_t &mb, + const char *efrom, const char *eend, size_t m) const { + const char *state = (const char*)&mb; + int offset = 0; + if (*state == 2) + offset = 2; + else if (*state == 3) + offset = 1; + + char *ibegin = new char[m + offset]; + const char *ecur = efrom; + char *icur = ibegin; + mbstate_t tmpState = mb; + do_in(tmpState, efrom, eend, ecur, ibegin, ibegin + m + offset, icur); + /* + char *state = (char*)&tmpState; + if (*state != 0) { + if (*state == 1) + --ecur; + else if (*state == 2 || *state == 3) { + //Undefined position, we return -1: + ecur = efrom - 1; + } + } + else { + if (*((char*)&mb) != 0) { + //We take into account the character that hasn't been counted yet in + //the previous decoding step: + ecur++; + } + } + */ + delete[] ibegin; + return (int)min((size_t)(ecur - efrom), m); + } + + virtual int do_max_length() const __NO_THROW + { return 0; } +#ifdef __DMC__ + static locale::id id; +#endif +}; + +#ifdef __DMC__ +locale::id generator_codecvt::id; + +locale::id& _GetFacetId(const generator_codecvt*) +{ return generator_codecvt::id; } +#endif + +// +// tests implementation +// +void CodecvtTest::variable_encoding() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + //We first generate the file used for test: + const char* fileName = "test_file.txt"; + { + ofstream ostr(fileName); + //Maybe we simply do not have write access to repository + CPPUNIT_ASSERT( ostr.good() ); + for (int i = 0; i < 2048; ++i) { + ostr << "0123456789"; + } + CPPUNIT_ASSERT( ostr.good() ); + } + + { + ifstream istr(fileName); + CPPUNIT_ASSERT( istr.good() ); + CPPUNIT_ASSERT( !istr.eof() ); + + eater_codecvt codec(1); + locale loc(locale::classic(), &codec); + + istr.imbue(loc); + CPPUNIT_ASSERT( istr.good() ); + CPPUNIT_ASSERT( (int)istr.tellg() == 0 ); + + int theoricalPos = 0; + do { + int c = istr.get(); + if (char_traits::eq_int_type(c, char_traits::eof())) { + break; + } + ++theoricalPos; + if (c == 'a') { + ++theoricalPos; + } + + CPPUNIT_ASSERT( (int)istr.tellg() == theoricalPos ); + } + while (!istr.eof()); + + CPPUNIT_ASSERT( istr.eof() ); + } + +# if 0 + /* This test is broken, not sure if it is really possible to get a position in + * a locale having a codecvt such as generator_codecvt. Maybe generator_codecvt + * is not a valid theorical example of codecvt implementation. */ + { + ifstream istr(fileName); + CPPUNIT_ASSERT( istr.good() ); + CPPUNIT_ASSERT( !istr.eof() ); + + generator_codecvt codec(1); + locale loc(locale::classic(), &codec); + + istr.imbue(loc); + CPPUNIT_ASSERT( istr.good() ); + CPPUNIT_ASSERT( (int)istr.tellg() == 0 ); + + int theoricalPos = 0; + int theoricalTellg; + do { + char c = istr.get(); + if (c == char_traits::eof()) { + break; + } + switch (c) { + case 'a': + case 'b': + theoricalTellg = -1; + break; + case 'c': + ++theoricalPos; + default: + ++theoricalPos; + theoricalTellg = theoricalPos; + break; + } + + if ((int)istr.tellg() != theoricalTellg) { + CPPUNIT_ASSERT( (int)istr.tellg() == theoricalTellg ); + } + } + while (!istr.eof()); + + CPPUNIT_ASSERT( istr.eof() ); + } +# endif +#endif +} + +void CodecvtTest::in_out_test() +{ +#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS)) + try { + locale loc(""); + + typedef codecvt cdecvt_type; + if (has_facet(loc)) { + cdecvt_type const& cdect = use_facet(loc); + { + cdecvt_type::state_type state; + memset(&state, 0, sizeof(cdecvt_type::state_type)); + string from("abcdef"); + const char* next_from; + wchar_t to[1]; + wchar_t *next_to; + cdecvt_type::result res = cdect.in(state, from.data(), from.data() + from.size(), next_from, + to, to + sizeof(to) / sizeof(wchar_t), next_to); + CPPUNIT_ASSERT( res == cdecvt_type::ok ); + CPPUNIT_ASSERT( next_from == from.data() + 1 ); + CPPUNIT_ASSERT( next_to == &to[0] + 1 ); + CPPUNIT_ASSERT( to[0] == L'a'); + } + { + cdecvt_type::state_type state; + memset(&state, 0, sizeof(cdecvt_type::state_type)); + wstring from(L"abcdef"); + const wchar_t* next_from; + char to[1]; + char *next_to; + cdecvt_type::result res = cdect.out(state, from.data(), from.data() + from.size(), next_from, + to, to + sizeof(to) / sizeof(char), next_to); + CPPUNIT_ASSERT( res == cdecvt_type::ok ); + CPPUNIT_ASSERT( next_from == from.data() + 1 ); + CPPUNIT_ASSERT( next_to == &to[0] + 1 ); + CPPUNIT_ASSERT( to[0] == 'a'); + } + } + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +#endif +} + +void CodecvtTest::length_test() +{ +#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS)) + try { + locale loc(""); + + typedef codecvt cdecvt_type; + if (has_facet(loc)) { + cdecvt_type const& cdect = use_facet(loc); + { + cdecvt_type::state_type state; + memset(&state, 0, sizeof(cdecvt_type::state_type)); + string from("abcdef"); + int res = cdect.length(state, from.data(), from.data() + from.size(), from.size()); + CPPUNIT_ASSERT( (size_t)res == from.size() ); + } + } + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +#endif +} + +#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS)) +typedef std::codecvt my_codecvt_base; + +class my_codecvt : public my_codecvt_base { +public: + explicit my_codecvt(size_t r = 0) + : my_codecvt_base(r) {} + +protected: + virtual result do_in(state_type& /*state*/, const extern_type* first1, + const extern_type* last1, const extern_type*& next1, + intern_type* first2, intern_type* last2, + intern_type*& next2) const { + for ( next1 = first1, next2 = first2; next1 < last1; next1 += 2 ) { + if ( (last1 - next1) < 2 || (last2 - next2) < 1 ) + return partial; + *next2++ = (intern_type)((*(next1 + 1) << 8) | (*next1 & 255)); + } + return ok; + } + virtual bool do_always_noconv() const __NO_THROW + { return false; } + virtual int do_max_length() const __NO_THROW + { return 2; } + virtual int do_encoding() const __NO_THROW + { return 2; } +}; +#endif + +void CodecvtTest::imbue_while_reading() +{ +#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS)) + { + wofstream ofs( "test.txt" ); + const wchar_t buf[] = L" "; + for ( int i = 0; i < 4098; ++i ) { + ofs << buf[0]; + } + } + + wifstream ifs("test.txt"); // a file containing 4098 wchars + + ifs.imbue( locale(locale(), new my_codecvt) ); + ifs.get(); + ifs.seekg(0); + ifs.imbue( locale() ); + ifs.ignore(4096); + int ch = ifs.get(); + CPPUNIT_CHECK( ch != (int)WEOF ); +#endif +} + +void CodecvtTest::special_encodings() +{ +#if !defined (STLPORT) || (!defined (_STLP_NO_WCHAR_T) && defined (_STLP_USE_EXCEPTIONS)) + { + locale loc(locale::classic(), new codecvt_byname("C")); + codecvt const& cvt = use_facet >(loc); + mbstate_t state; + memset(&state, 0, sizeof(mbstate_t)); + char c = '0'; + const char *from_next; + wchar_t wc; + wchar_t *to_next; + CPPUNIT_ASSERT( cvt.in(state, &c, &c + 1, from_next, &wc, &wc, to_next) == codecvt_base::ok ); + CPPUNIT_ASSERT( to_next == &wc ); + CPPUNIT_ASSERT( cvt.in(state, &c, &c + 1, from_next, &wc, &wc + 1, to_next) == codecvt_base::ok ); + CPPUNIT_ASSERT( wc == L'0' ); + CPPUNIT_ASSERT( to_next == &wc + 1 ); + } + try + { + wstring cp936_wstr; + const string cp936_str = "\xd6\xd0\xb9\xfa\xc9\xe7\xbb\xe1\xbf\xc6\xd1\xa7\xd4\xba\xb7\xa2\xb2\xbc\x32\x30\x30\x38\xc4\xea\xa1\xb6\xbe\xad\xbc\xc3\xc0\xb6\xc6\xa4\xca\xe9\xa1\xb7\xd6\xb8\xb3\xf6\xa3\xac\x32\x30\x30\x37\xc4\xea\xd6\xd0\xb9\xfa\xbe\xad\xbc\xc3\xd4\xf6\xb3\xa4\xd3\xc9\xc6\xab\xbf\xec\xd7\xaa\xcf\xf2\xb9\xfd\xc8\xc8\xb5\xc4\xc7\xf7\xca\xc6\xc3\xf7\xcf\xd4\xd4\xa4\xbc\xc6\xc8\xab\xc4\xea\x47\x44\x50\xd4\xf6\xcb\xd9\xbd\xab\xb4\xef\x31\x31\x2e\x36\x25\xa1\xa3"; + locale loc(locale::classic(), ".936", locale::ctype); + codecvt const& cvt = use_facet >(loc); + mbstate_t state; + memset(&state, 0, sizeof(mbstate_t)); + + codecvt_base::result res; + + { + wchar_t wbuf[4096]; + // Check we will have enough room for the generated wide string generated from the whole char buffer: + int len = cvt.length(state, cp936_str.data(), cp936_str.data() + cp936_str.size(), sizeof(wbuf) / sizeof(wchar_t)); + CPPUNIT_ASSERT( cp936_str.size() == (size_t)len ); + + const char *from_next; + wchar_t *to_next; + res = cvt.in(state, cp936_str.data(), cp936_str.data() + cp936_str.size(), from_next, + wbuf, wbuf + sizeof(wbuf) / sizeof(wchar_t), to_next); + CPPUNIT_ASSERT( res == codecvt_base::ok ); + CPPUNIT_ASSERT( from_next == cp936_str.data() + cp936_str.size() ); + cp936_wstr.assign(wbuf, to_next); + } + + { + const wchar_t *from_next; + char buf[4096]; + char *to_next; + res = cvt.out(state, cp936_wstr.data(), cp936_wstr.data() + cp936_wstr.size(), from_next, + buf, buf + sizeof(buf), to_next); + CPPUNIT_ASSERT( res == codecvt_base::ok ); + CPPUNIT_CHECK( string(buf, to_next) == cp936_str ); + } + } + catch (const runtime_error&) + { + CPPUNIT_MESSAGE("Not enough platform localization support to check 936 code page encoding."); + } + try + { + const string utf8_str = "\xe4\xb8\xad\xe5\x9b\xbd\xe7\xa4\xbe\xe4\xbc\x9a\xe7\xa7\x91\xe5\xad\xa6\xe9\x99\xa2\xe5\x8f\x91\xe5\xb8\x83\x32\x30\x30\x38\xe5\xb9\xb4\xe3\x80\x8a\xe7\xbb\x8f\xe6\xb5\x8e\xe8\x93\x9d\xe7\x9a\xae\xe4\xb9\xa6\xe3\x80\x8b\xe6\x8c\x87\xe5\x87\xba\xef\xbc\x8c\x32\x30\x30\x37\xe5\xb9\xb4\xe4\xb8\xad\xe5\x9b\xbd\xe7\xbb\x8f\xe6\xb5\x8e\xe5\xa2\x9e\xe9\x95\xbf\xe7\x94\xb1\xe5\x81\x8f\xe5\xbf\xab\xe8\xbd\xac\xe5\x90\x91\xe8\xbf\x87\xe7\x83\xad\xe7\x9a\x84\xe8\xb6\x8b\xe5\x8a\xbf\xe6\x98\x8e\xe6\x98\xbe\xe9\xa2\x84\xe8\xae\xa1\xe5\x85\xa8\xe5\xb9\xb4\x47\x44\x50\xe5\xa2\x9e\xe9\x80\x9f\xe5\xb0\x86\xe8\xbe\xbe\x31\x31\x2e\x36\x25\xe3\x80\x82"; + wstring utf8_wstr; + locale loc(locale::classic(), new codecvt_byname(".utf8")); + codecvt const& cvt = use_facet >(loc); + mbstate_t state; + memset(&state, 0, sizeof(mbstate_t)); + + codecvt_base::result res; + + { + wchar_t wbuf[4096]; + // Check we will have enough room for the wide string generated from the whole char buffer: + int len = cvt.length(state, utf8_str.data(), utf8_str.data() + utf8_str.size(), sizeof(wbuf) / sizeof(wchar_t)); + CPPUNIT_ASSERT( utf8_str.size() == (size_t)len ); + + const char *from_next; + wchar_t *to_next; + res = cvt.in(state, utf8_str.data(), utf8_str.data() + utf8_str.size(), from_next, + wbuf, wbuf + sizeof(wbuf) / sizeof(wchar_t), to_next); + CPPUNIT_ASSERT( res == codecvt_base::ok ); + CPPUNIT_ASSERT( from_next == utf8_str.data() + utf8_str.size() ); + utf8_wstr.assign(wbuf, to_next); + + // Try to read one char after the other: + wchar_t wc; + const char* from = utf8_str.data(); + const char* from_end = from + utf8_str.size(); + from_next = utf8_str.data(); + size_t length = 1; + size_t windex = 0; + while (from + length <= from_end) { + res = cvt.in(state, from, from + length, from_next, + &wc, &wc + 1, to_next); + switch (res) { + case codecvt_base::ok: + // reset length: + from = from_next; + length = 1; + CPPUNIT_ASSERT( wc == utf8_wstr[windex++] ); + wc = 0; + break; + case codecvt_base::partial: + if (from_next == from) + // from_next hasn't move so we have to pass more chars + ++length; + else + // char between from and from_next has been eaten, we simply restart + // conversion from from_next: + from = from_next; + continue; + case codecvt_base::error: + case codecvt_base::noconv: + CPPUNIT_FAIL; + //break; + } + } + CPPUNIT_ASSERT( windex == utf8_wstr.size() ); + } + + { + const wchar_t *from_next; + char buf[4096]; + char *to_next; + res = cvt.out(state, utf8_wstr.data(), utf8_wstr.data() + utf8_wstr.size(), from_next, + buf, buf + sizeof(buf), to_next); + CPPUNIT_ASSERT( res == codecvt_base::ok ); + CPPUNIT_CHECK( string(buf, to_next) == utf8_str ); + } + + { + // Check that an obviously wrong UTF8 encoded string is correctly detected: + const string bad_utf8_str("\xdf\xdf\xdf\xdf\xdf"); + wchar_t wc; + const char *from_next; + wchar_t *to_next; + res = cvt.in(state, bad_utf8_str.data(), bad_utf8_str.data() + bad_utf8_str.size(), from_next, + &wc, &wc + 1, to_next); + CPPUNIT_ASSERT( res == codecvt_base::error ); + } + } + catch (const runtime_error&) + { + CPPUNIT_MESSAGE("Not enough platform localization support to check UTF8 encoding."); + } +#endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/collate_facets_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/collate_facets_test.cpp new file mode 100644 index 00000000000..b6a1b14851f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/collate_facets_test.cpp @@ -0,0 +1,279 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include +# include + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// tests implementation +// +void LocaleTest::collate_facet() +{ + { + CPPUNIT_ASSERT( has_facet >(locale::classic()) ); + collate const& col = use_facet >(locale::classic()); + + char const str1[] = "abcdef1"; + char const str2[] = "abcdef2"; + const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1; + const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1; + + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 ); + CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 ); + + //Smallest string should be before largest one: + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 ); + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 ); + } + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + locale loc("fr_FR"); + { + CPPUNIT_ASSERT( has_facet >(loc) ); + collate const& col = use_facet >(loc); + + char const str1[] = "abcdef1"; + char const str2[] = "abcdef2"; + const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1; + const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1; + + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 ); + CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 ); + + //Smallest string should be before largest one: + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 ); + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 ); + } + { + CPPUNIT_ASSERT( has_facet >(loc) ); + collate const& col = use_facet >(loc); + + string strs[] = {"abdd", "abçd", "abbd", "abcd"}; + + string transformed[4]; + for (size_t i = 0; i < 4; ++i) { + transformed[i] = col.transform(strs[i].data(), strs[i].data() + strs[i].size()); + } + + sort(strs, strs + 4, loc); + CPPUNIT_ASSERT( strs[0] == "abbd" ); + CPPUNIT_ASSERT( strs[1] == "abcd" ); + CPPUNIT_ASSERT( strs[2] == "abçd" ); + CPPUNIT_ASSERT( strs[3] == "abdd" ); + + sort(transformed, transformed + 4); + + CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + strs[0].size()) == transformed[0] ); + CPPUNIT_ASSERT( col.transform(strs[1].data(), strs[1].data() + strs[1].size()) == transformed[1] ); + CPPUNIT_ASSERT( col.transform(strs[2].data(), strs[2].data() + strs[2].size()) == transformed[2] ); + CPPUNIT_ASSERT( col.transform(strs[3].data(), strs[3].data() + strs[3].size()) == transformed[3] ); + + // Check empty string result in empty key. + CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data()).empty() ); + + // Check that only characters that matter are taken into accout to build the key. + CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + 2) == col.transform(strs[1].data(), strs[1].data() + 2) ); + } +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + { + CPPUNIT_ASSERT( has_facet >(loc) ); + collate const& col = use_facet >(loc); + + wchar_t const str1[] = L"abcdef1"; + wchar_t const str2[] = L"abcdef2"; + const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1; + const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1; + + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 ); + CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 ); + + //Smallest string should be before largest one: + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 ); + CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 ); + } + { + size_t i; + CPPUNIT_ASSERT( has_facet >(loc) ); + collate const& col = use_facet >(loc); + + // Here we would like to use L"abçd" but it looks like all compilers + // do not support storage of unicode characters in exe resulting in + // compilation error. We avoid this test for the moment. + wstring strs[] = {L"abdd", L"abcd", L"abbd", L"abcd"}; + + wstring transformed[4]; + for (i = 0; i < 4; ++i) { + transformed[i] = col.transform(strs[i].data(), strs[i].data() + strs[i].size()); + } + + sort(strs, strs + 4, loc); + CPPUNIT_ASSERT( strs[0] == L"abbd" ); + CPPUNIT_ASSERT( strs[1] == L"abcd" ); + CPPUNIT_ASSERT( strs[2] == L"abcd" ); + CPPUNIT_ASSERT( strs[3] == L"abdd" ); + + sort(transformed, transformed + 4); + + CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + strs[0].size()) == transformed[0] ); + CPPUNIT_ASSERT( col.transform(strs[1].data(), strs[1].data() + strs[1].size()) == transformed[1] ); + CPPUNIT_ASSERT( col.transform(strs[2].data(), strs[2].data() + strs[2].size()) == transformed[2] ); + CPPUNIT_ASSERT( col.transform(strs[3].data(), strs[3].data() + strs[3].size()) == transformed[3] ); + + CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data()).empty() ); + + CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + 2) == col.transform(strs[1].data(), strs[1].data() + 2) ); + } +# endif + } + catch (runtime_error const&) { + CPPUNIT_MESSAGE("No french locale to check collate facet"); + } +# endif +} + +void LocaleTest::collate_by_name() +{ + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new collate_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new collate_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string veryLongFacetName("LC_COLLATE="); + veryLongFacetName.append(512, '?'); + locale loc(locale::classic(), new collate_byname(veryLongFacetName.c_str())); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), "C", locale::collate); + } + catch (runtime_error const& e) { + CPPUNIT_MESSAGE( e.what() ); + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" facet. + locale loc(locale::classic(), "", locale::collate); + } + catch (runtime_error const& e) { + CPPUNIT_MESSAGE( e.what() ); + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new collate_byname("C")); + + //We check that the C locale gives a lexicographical comparison: + collate const& cfacet_byname = use_facet >(loc); + collate const& cfacet = use_facet >(locale::classic()); + + char const str1[] = "abcdef1"; + char const str2[] = "abcdef2"; + const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1; + const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1; + + CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == + cfacet.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) ); + CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1, str2, str2 + size2) == + cfacet.compare(str1, str1 + size1, str2, str2 + size2) ); + + //Smallest string should be before largest one: + CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == + cfacet.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) ); + CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == + cfacet.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) ); + + // We cannot play with 'ç' char here because doing so would make test result + // dependant on char being consider as signed or not... + string strs[] = {"abdd", /* "abçd",*/ "abbd", "abcd"}; + + vector v1(strs, strs + sizeof(strs) / sizeof(strs[0])); + sort(v1.begin(), v1.end(), loc); + vector v2(strs, strs + sizeof(strs) / sizeof(strs[0])); + sort(v2.begin(), v2.end(), locale::classic()); + CPPUNIT_ASSERT( v1 == v2 ); + + CPPUNIT_ASSERT( (cfacet_byname.transform(v1[0].data(), v1[0].data() + v1[0].size()).compare(cfacet_byname.transform(v1[1].data(), v1[1].data() + v1[1].size())) == + v1[0].compare(v1[1])) ); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new collate_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new collate_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/complete_digits.h b/reactos/lib/3rdparty/stlport/test/unit/complete_digits.h new file mode 100644 index 00000000000..0a3d933a5e4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/complete_digits.h @@ -0,0 +1,19 @@ +#ifndef STLP_DIGITS_H +#define STLP_DIGITS_H + +#include + +inline void +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +complete_digits(std::string &digits) +#else +complete_digits(string &digits) +#endif +{ + while (digits.size() < 2) + { + digits.insert(digits.begin(), '0'); + } +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/complex_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/complex_header_test.cpp new file mode 100644 index 00000000000..367f3d010a8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/complex_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/config_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/config_test.cpp new file mode 100644 index 00000000000..92846baa5a0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/config_test.cpp @@ -0,0 +1,121 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if defined (_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class ConfigTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ConfigTest); +#if !defined (STLPORT) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(placement_new_bug); + CPPUNIT_TEST(endianess); + CPPUNIT_TEST(template_function_partial_ordering); +#if !defined (_STLP_USE_EXCEPTIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(new_throw_bad_alloc); + CPPUNIT_TEST_SUITE_END(); + + protected: + void placement_new_bug(); + void endianess(); + void template_function_partial_ordering(); + void new_throw_bad_alloc(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ConfigTest); + +void ConfigTest::placement_new_bug() +{ +#if defined (STLPORT) + int int_val = 1; + int *pint; + pint = new(&int_val) int(); + CPPUNIT_ASSERT( pint == &int_val ); +# if defined (_STLP_DEF_CONST_PLCT_NEW_BUG) + CPPUNIT_ASSERT( int_val != 0 ); +# else + CPPUNIT_ASSERT( int_val == 0 ); +# endif +#endif +} + +void ConfigTest::endianess() +{ +#if defined (STLPORT) + int val = 0x01020304; + char *ptr = (char*)(&val); +# if defined (_STLP_BIG_ENDIAN) + //This test only work if sizeof(int) == 4, this is a known limitation + //that will be handle the day we find a compiler for which it is false. + CPPUNIT_ASSERT( *ptr == 0x01 || + sizeof(int) > 4 && *ptr == 0x00 ); +# elif defined (_STLP_LITTLE_ENDIAN) + CPPUNIT_ASSERT( *ptr == 0x04 ); +# endif +#endif +} + +void ConfigTest::template_function_partial_ordering() +{ +#if defined (STLPORT) + vector vect1(10, 0); + int* pvect1Front = &vect1.front(); + vector vect2(10, 0); + int* pvect2Front = &vect2.front(); + + swap(vect1, vect2); + +# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + CPPUNIT_ASSERT( pvect1Front == &vect2.front() ); + CPPUNIT_ASSERT( pvect2Front == &vect1.front() ); +# else + CPPUNIT_ASSERT( pvect1Front != &vect2.front() ); + CPPUNIT_ASSERT( pvect2Front != &vect1.front() ); +# endif +#endif +} + +void ConfigTest::new_throw_bad_alloc() +{ +#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS) + try + { + /* We try to exhaust heap memory. However, we don't actually use the + largest possible size_t value bus slightly less in order to avoid + triggering any overflows due to the allocator adding some more for + its internal data structures. */ + size_t const huge_amount = size_t(-1) - 1024; + void* pvoid = operator new (huge_amount); +#if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) + // Allocation should have fail + CPPUNIT_ASSERT( pvoid != 0 ); +#endif + // Just in case it succeeds: + operator delete(pvoid); + } + catch (const bad_alloc&) + { +#if defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) + // Looks like your compiler new operator finally throw bad_alloc, you can fix + // configuration. + CPPUNIT_FAIL; +#endif + } + catch (...) + { + //We shouldn't be there: + //Not bad_alloc exception thrown. + CPPUNIT_FAIL; + } +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/copy_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/copy_test.cpp new file mode 100644 index 00000000000..852e687764d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/copy_test.cpp @@ -0,0 +1,129 @@ +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class CopyTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(CopyTest); + CPPUNIT_TEST(copy_array); + CPPUNIT_TEST(copy_volatile); + CPPUNIT_TEST(copy_vector); + CPPUNIT_TEST(copy_insert); + CPPUNIT_TEST(copy_back); + CPPUNIT_TEST(copy_back_array); + CPPUNIT_TEST_SUITE_END(); + +protected: + void copy_array(); + void copy_volatile(); + void copy_vector(); + void copy_insert(); + void copy_back(); + void copy_back_array(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(CopyTest); + +// +// tests implementation +// +void CopyTest::copy_array() +{ + char string[23] = "A string to be copied."; + char result[23]; + copy(string, string + 23, result); + CPPUNIT_ASSERT(!strncmp(string, result, 23)); +} + +void CopyTest::copy_volatile() +{ + { + int a[] = {0, 1, 2, 3, 4, 5}; + const size_t size = sizeof(a) / sizeof(a[0]); + volatile int va[size]; + copy(a, a + size, va); + for (size_t i = 0; i != size; ++i) { + CPPUNIT_ASSERT( a[i] == va[i] ); + } + } + + { + const int a[] = {0, 1, 2, 3, 4, 5}; + const size_t size = sizeof(a) / sizeof(a[0]); + volatile int va[size]; + copy(a, a + size, va); + for (size_t i = 0; i != size; ++i) { + CPPUNIT_ASSERT( a[i] == va[i] ); + } + } + + // Following code can be activated to check that it doesn't compiled +#if 0 + { + int a[] = {0, 1, 2, 3, 4, 5}; + const size_t size = sizeof(a) / sizeof(a[0]); + const volatile int va[size] = {5, 4, 3, 2, 1, 0}; + copy(a, a + size, va); + for (size_t i = 0; i != size; ++i) { + CPPUNIT_ASSERT( a[i] == va[i] ); + } + } +#endif +} + +void CopyTest::copy_vector() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i; + + vector v2(v1.size()); + copy(v1.begin(), v1.end(), v2.begin()); + + CPPUNIT_ASSERT( v2 == v1 ); +} + +void CopyTest::copy_insert() { + vector v1(10); + for (int loc = 0; (size_t)loc < v1.size(); ++loc) + v1[loc] = loc; + vector v2; + insert_iterator > i(v2, v2.begin()); + copy(v1.begin(), v1.end(), i); + + CPPUNIT_ASSERT( v2 == v1 ); +} + +void CopyTest::copy_back() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i; + vector v2(v1.size()); + copy_backward(v1.begin(), v1.end(), v2.end()); + + CPPUNIT_ASSERT( v2 == v1 ); +} + +void CopyTest::copy_back_array() +{ + int numbers[5] = { 1, 2, 3, 4, 5 }; + + int result[5]; + copy_backward(numbers, numbers + 5, (int*)result + 5); + CPPUNIT_ASSERT(result[0]==numbers[0]); + CPPUNIT_ASSERT(result[1]==numbers[1]); + CPPUNIT_ASSERT(result[2]==numbers[2]); + CPPUNIT_ASSERT(result[3]==numbers[3]); + CPPUNIT_ASSERT(result[4]==numbers[4]); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/count_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/count_test.cpp new file mode 100644 index 00000000000..edf96e0bbb7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/count_test.cpp @@ -0,0 +1,73 @@ +#include +#include +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class CountTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(CountTest); + CPPUNIT_TEST(count0); + CPPUNIT_TEST(count1); + CPPUNIT_TEST(countif1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void count0(); + void count1(); + void countif1(); + static int odd(int a_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(CountTest); + +// +// tests implementation +// +void CountTest::count0() +{ + int numbers[10] = { 1, 2, 4, 1, 2, 4, 1, 2, 4, 1 }; + + int result = count(numbers, numbers + 10, 1); + CPPUNIT_ASSERT(result==4); +#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS) + result = 0; + count(numbers, numbers + 10, 1, result); + CPPUNIT_ASSERT(result==4); +#endif +} +void CountTest::count1() +{ + vector numbers(100); + for(int i = 0; i < 100; i++) + numbers[i] = i % 3; + int elements = count(numbers.begin(), numbers.end(), 2); + CPPUNIT_ASSERT(elements==33); +#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS) + elements = 0; + count(numbers.begin(), numbers.end(), 2, elements); + CPPUNIT_ASSERT(elements==33); +#endif +} +void CountTest::countif1() +{ + vector numbers(100); + for(int i = 0; i < 100; i++) + numbers[i] = i % 3; + int elements = count_if(numbers.begin(), numbers.end(), odd); + CPPUNIT_ASSERT(elements==33); +#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS) + elements = 0; + count_if(numbers.begin(), numbers.end(), odd, elements); + CPPUNIT_ASSERT(elements==33); +#endif +} +int CountTest::odd(int a_) +{ + return a_ % 2; +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_mini.h b/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_mini.h new file mode 100644 index 00000000000..98b4a7a790d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_mini.h @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2003, 2004 + * Zdenek Nemec + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* $Id$ */ + +#ifndef _CPPUNITMPFR_H_ +#define _CPPUNITMPFR_H_ + +#if 0 +# define CPPUNIT_NS CppUnitMini +#else +# define CPPUNIT_NS +#endif + +#include + +#if 0 +namespace CPPUNIT_NS +{ +#endif + class Reporter { + public: + virtual ~Reporter() {} + virtual void error(const char * /*macroName*/, const char * /*in_macro*/, const char * /*in_file*/, int /*in_line*/) {} + virtual void message( const char * /*msg*/ ) {} + virtual void progress( const char * /*in_className*/, const char * /*in_testName*/, bool /*ignored*/, bool /* explicit */) {} + virtual void end() {} + virtual void printSummary() {} + }; + + class TestFixture { + public: + virtual ~TestFixture() {} + + //! \brief Set up context before running a test. + virtual void setUp() {} + + //! Clean up after the test run. + virtual void tearDown() {} + }; + + class TestCase : public TestFixture { + public: + TestCase() { registerTestCase(this); } + + void setUp() { m_failed = false; } + static int run(Reporter *in_reporter = 0, const char *in_testName = "", bool invert = false); + int numErrors() { return m_numErrors; } + static void registerTestCase(TestCase *in_testCase); + + virtual void myRun(const char * /*in_name*/, bool /*invert*/ = false) {} + + virtual void error(const char *in_macroName, const char *in_macro, const char *in_file, int in_line) { + m_failed = true; + if (m_reporter) { + m_reporter->error(in_macroName, in_macro, in_file, in_line); + } + } + + static void message(const char *msg) { + if (m_reporter) { + m_reporter->message(msg); + } + } + + bool equalDoubles(double in_expected, double in_real, double in_maxErr) { + double diff = in_expected - in_real; + if (diff < 0.) { + diff = -diff; + } + return diff < in_maxErr; + } + + virtual void progress(const char *in_className, const char *in_functionName, bool ignored, bool explicitTest) { + ++m_numTests; + if (m_reporter) { + m_reporter->progress(in_className, in_functionName, ignored, explicitTest); + } + } + + bool shouldRunThis(const char *in_desiredTest, const char *in_className, const char *in_functionName, + bool invert, bool explicit_test, bool &do_progress) { + if ((in_desiredTest) && (in_desiredTest[0] != '\0')) { + do_progress = false; + const char *ptr = strstr(in_desiredTest, "::"); + if (ptr) { + bool match = (strncmp(in_desiredTest, in_className, strlen(in_className)) == 0) && + (strncmp(ptr + 2, in_functionName, strlen(in_functionName)) == 0); + // Invert shall not make explicit test run: + return invert ? (match ? !match : !explicit_test) + : match; + } + bool match = (strcmp(in_desiredTest, in_className) == 0); + do_progress = match; + return !explicit_test && (match == !invert); + } + do_progress = true; + return !explicit_test; + } + + void tearDown() { + if (m_failed) + ++m_numErrors; + m_reporter->end(); + } + + protected: + static int m_numErrors; + static int m_numTests; + + private: + static TestCase *m_root; + TestCase *m_next; + bool m_failed; + + static Reporter *m_reporter; + }; +#if 0 +} +#endif + +#if !defined (CPPUNIT_MINI_HIDE_UNUSED_VARIABLE) +# if defined (_MSC_VER) +# define CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(v) (v); +# else +# define CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(v) +# endif +#endif + +#define CPPUNIT_TEST_SUITE(X) \ + typedef CPPUNIT_NS::TestCase Base; \ + virtual void myRun(const char *in_name, bool invert = false) { \ + const char *className = #X; CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(className) \ + bool ignoring = false; CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(ignoring) + +#if defined CPPUNIT_MINI_USE_EXCEPTIONS +# define CPPUNIT_TEST_BASE(X, Y) \ + { \ + bool do_progress; \ + bool shouldRun = shouldRunThis(in_name, className, #X, invert, Y, do_progress); \ + if (shouldRun || do_progress) { \ + setUp(); \ + progress(className, #X, ignoring || !shouldRun, !ignoring && Y); \ + if (shouldRun && !ignoring) { \ + try { \ + X(); \ + } \ + catch(...) { \ + Base::error("Test Failed: An Exception was thrown.", #X, __FILE__, __LINE__); \ + } \ + } \ + tearDown(); \ + } \ + } +#else +# define CPPUNIT_TEST_BASE(X, Y) \ + { \ + bool do_progress; \ + bool shouldRun = shouldRunThis(in_name, className, #X, invert, Y, do_progress); \ + if (shouldRun || do_progress) { \ + setUp(); \ + progress(className, #X, ignoring || !shouldRun, !ignoring && Y); \ + if (shouldRun && !ignoring) \ + X(); \ + tearDown(); \ + } \ + } +#endif + +#define CPPUNIT_TEST(X) CPPUNIT_TEST_BASE(X, false) +#define CPPUNIT_EXPLICIT_TEST(X) CPPUNIT_TEST_BASE(X, true) + +#define CPPUNIT_IGNORE \ + ignoring = true + +#define CPPUNIT_STOP_IGNORE \ + ignoring = false + +#define CPPUNIT_TEST_SUITE_END() } + +#define CPPUNIT_TEST_SUITE_REGISTRATION(X) static X local + +#define CPPUNIT_CHECK(X) \ + if (!(X)) { \ + Base::error("CPPUNIT_CHECK", #X, __FILE__, __LINE__); \ + } + +#define CPPUNIT_ASSERT(X) \ + if (!(X)) { \ + Base::error("CPPUNIT_ASSERT", #X, __FILE__, __LINE__); \ + return; \ + } + +#define CPPUNIT_FAIL { \ + Base::error("CPPUNIT_FAIL", "", __FILE__, __LINE__); \ + return; \ + } + +#define CPPUNIT_ASSERT_EQUAL(X, Y) \ + if ((X) != (Y)) { \ + Base::error("CPPUNIT_ASSERT_EQUAL", #X","#Y, __FILE__, __LINE__); \ + return; \ + } + +#define CPPUNIT_ASSERT_DOUBLES_EQUAL(X, Y, Z) \ + if (!equalDoubles((X), (Y), (Z))) { \ + Base::error("CPPUNIT_ASSERT_DOUBLES_EQUAL", #X","#Y","#Z, __FILE__, __LINE__); \ + return; \ + } + +#define CPPUNIT_MESSAGE(m) CPPUNIT_NS::TestCase::message(m) + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_proxy.h b/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_proxy.h new file mode 100644 index 00000000000..41cdc2a2402 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_proxy.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2003, 2004 + * Zdenek Nemec + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* $Id$ */ + +#ifndef _CPPUNITPROXYINTERFACE_H_ +#define _CPPUNITPROXYINTERFACE_H_ + +/* + * STLport specific + */ +#if !defined (CPPUNIT_MINI_USE_EXCEPTIONS) && \ + (!defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)) +# define CPPUNIT_MINI_USE_EXCEPTIONS +#endif + +#include "cppunit_mini.h" + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_timer.h b/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_timer.h new file mode 100644 index 00000000000..61f907617f6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cppunit/cppunit_timer.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2006 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef CPPUNIT_TIMER_H +#define CPPUNIT_TIMER_H + +#if defined (_WIN32) +# define CPPUNIT_WIN32_TIMER +# include +#endif + +class Timer { +public: + Timer() { +#if defined (CPPUNIT_WIN32_TIMER) + m_start.LowPart = m_restart.LowPart = m_stop.LowPart = 0; + m_start.HighPart = m_restart.HighPart = m_stop.HighPart = 0; + QueryPerformanceFrequency(&m_frequency); +#endif + } + + void start() { +#if defined (CPPUNIT_WIN32_TIMER) + QueryPerformanceCounter(&m_start); +#endif + } + + void restart() { +#if defined (CPPUNIT_WIN32_TIMER) + QueryPerformanceCounter(&m_restart); + if (m_start.HighPart == 0 && m_start.LowPart == 0) { + m_start = m_restart; + } +#endif + } + + void stop() { +#if defined (CPPUNIT_WIN32_TIMER) + LARGE_INTEGER stop; + QueryPerformanceCounter(&stop); + if ((m_stop.HighPart != 0 || m_stop.LowPart != 0) && + m_restart.HighPart != 0 && m_restart.LowPart != 0) { + m_stop.HighPart += (stop.HighPart - m_restart.HighPart); + if (stop.LowPart < m_restart.LowPart) { + if (m_restart.LowPart - stop.LowPart > m_stop.LowPart) { + m_stop.HighPart -= 1; + } + m_stop.LowPart -= m_restart.LowPart - stop.LowPart; + } + else { + if (stop.LowPart - m_restart.LowPart > 0xFFFFFFFF - m_stop.LowPart) { + m_stop.HighPart += 1; + } + m_stop.LowPart += stop.LowPart - m_restart.LowPart; + } + } + else { + m_stop = stop; + } +#endif + } + + double elapsedMilliseconds() const { +#if defined (CPPUNIT_WIN32_TIMER) + LARGE_INTEGER elapsed; + elapsed.HighPart = m_stop.HighPart - m_start.HighPart; + elapsed.LowPart = m_stop.LowPart - m_start.LowPart; + return (double)elapsed.QuadPart / (double)m_frequency.QuadPart * 1000; +#else + return 0; +#endif + } + + static bool supported() { +#if defined (CPPUNIT_WIN32_TIMER) + return true; +#else + return false; +#endif + } + +private: +#if defined (CPPUNIT_WIN32_TIMER) + LARGE_INTEGER m_frequency; + LARGE_INTEGER m_start, m_stop, m_restart; +#endif +}; + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/cppunit/file_reporter.h b/reactos/lib/3rdparty/stlport/test/unit/cppunit/file_reporter.h new file mode 100644 index 00000000000..2c7633bc99c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cppunit/file_reporter.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2003, 2004 + * Zdenek Nemec + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* $Id$ */ + +#ifndef _CPPUNITMINIFILEREPORTERINTERFACE_H_ +#define _CPPUNITMINIFILEREPORTERINTERFACE_H_ + +#include + +#include "cppunit_timer.h" + +// +// CppUnit mini file(stream) reporter +// +class FileReporter : public CPPUNIT_NS::Reporter { +private: + FileReporter(const FileReporter&); + FileReporter& operator=(const FileReporter&); +public: + // reporting to stderr + explicit FileReporter(bool doMonitor = false): + m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(false), + m_failed(false), m_doMonitor(doMonitor) + { _file = stderr; } + + // reporting to the file with the given name + explicit FileReporter(const char* file, bool doMonitor = false): + m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(true), + m_failed(false), m_doMonitor(doMonitor) + { +#ifndef _STLP_USE_SAFE_STRING_FUNCTIONS + _file = fopen(file, "w"); +#else + fopen_s(&_file, file, "w"); +#endif + } + + // reporting to the given file + explicit FileReporter(FILE* stream, bool doMonitor = false): + m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(false), + m_failed(false), m_doMonitor(doMonitor) + { _file = stream; } + + virtual ~FileReporter() { + if (_myStream) + fclose(_file); + else + fflush(_file); + } + + virtual void error(const char *in_macroName, const char *in_macro, const char *in_file, int in_line) { + // Error might be called several times between 2 progress calls, we shouldn't however consider + // that a test failed twice so we simply keep the info that test failed, number of failed tests + // is computed later in end method. + m_failed = true; + fprintf(_file, "\n\n%s(%d) : %s(%s);", in_file, in_line, in_macroName, in_macro); + } + + virtual void message( const char *msg ) + { fprintf(_file, "\n\t%s", msg ); } + + virtual void progress(const char *in_className, const char *in_shortTestName, bool ignored, bool explicitTest) { + if (m_doMonitor) { + m_globalTimer.restart(); + m_testTimer.start(); + } + ++m_numTests; + m_failed = false; + if (ignored) + ++m_numIgnored; + fprintf(_file, "%s::%s", in_className, in_shortTestName); + if (ignored) { + const char *ignoredReason; + if (explicitTest) { + ++m_numExplicit; + ignoredReason = " EXPLICIT"; + } + else + ignoredReason = " IGNORED"; + + fprintf(_file, "%s", ignoredReason); + } + } + + virtual void end() { + if (m_doMonitor) { + m_globalTimer.stop(); + m_testTimer.stop(); + fprintf(_file, " %f msec", m_testTimer.elapsedMilliseconds()); + } + if (m_failed) { + ++m_numErrors; + } + fprintf(_file, "\n"); + } + + virtual void printSummary() { + if (m_numErrors > 0) { + fprintf(_file, "\nThere were errors! %d of %d tests", m_numErrors, m_numTests); + } + else { + fprintf(_file, "\nOK %d tests", m_numTests); + } + + if (m_numIgnored > 0) { + fprintf(_file, ", %d ignored", m_numIgnored); + } + + if (m_numExplicit > 0) { + fprintf(_file, " (%d explicit)", m_numExplicit); + } + + if (m_doMonitor) { + fprintf(_file, " %f msec", m_globalTimer.elapsedMilliseconds()); + } + + fprintf(_file, "\n\n"); + } +private: + int m_numErrors; + int m_numIgnored; + int m_numExplicit; + int m_numTests; + // flag whether we own '_file' and are thus responsible for releasing it in the destructor + bool _myStream; + bool m_failed; + bool m_doMonitor; + Timer m_globalTimer, m_testTimer; + FILE* _file; +}; + +#endif /*_CPPUNITMINIFILEREPORTERINTERFACE_H_*/ diff --git a/reactos/lib/3rdparty/stlport/test/unit/cppunit/test_main.cpp b/reactos/lib/3rdparty/stlport/test/unit/cppunit/test_main.cpp new file mode 100644 index 00000000000..8519d4fe6eb --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cppunit/test_main.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2003, 2004 + * Zdenek Nemec + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "cppunit_proxy.h" +#include "file_reporter.h" +#include "cppunit_timer.h" + +#include "stdio.h" + +#if 0 +namespace CPPUNIT_NS +{ +#endif + int TestCase::m_numErrors = 0; + int TestCase::m_numTests = 0; + + TestCase *TestCase::m_root = 0; + Reporter *TestCase::m_reporter = 0; + + void TestCase::registerTestCase(TestCase *in_testCase) { + in_testCase->m_next = m_root; + m_root = in_testCase; + } + + int TestCase::run(Reporter *in_reporter, const char *in_testName, bool invert) { + TestCase::m_reporter = in_reporter; + + m_numErrors = 0; + m_numTests = 0; + + TestCase *tmp = m_root; + while (tmp != 0) { + tmp->myRun(in_testName, invert); + tmp = tmp->m_next; + } + return m_numErrors; + } +#if 0 +} +#endif + +static void usage(const char* name) +{ + printf("Usage : %s [-t=[::]] [-x=[::]] [-f=]%s\n", + name, Timer::supported() ? " [-m]": ""); + printf("\t[-t=[::]] : test class or class::test to execute;\n"); + printf("\t[-x=[::]] : test class or class::test to exclude from execution;\n"); + printf("\t[-f=] : output file"); + if (Timer::supported()) + printf(";\n\t[-m] : monitor test execution, display time duration for each test\n"); + else + printf("\n"); +} + +int main(int argc, char** argv) { + + // CppUnit(mini) test launcher + // command line option syntax: + // test [OPTIONS] + // where OPTIONS are + // -t=CLASS[::TEST] run the test class CLASS or member test CLASS::TEST + // -x=CLASS[::TEST] run all except the test class CLASS or member test CLASS::TEST + // -f=FILE save output in file FILE instead of stdout + // -m monitor test(s) execution + const char *fileName = 0; + const char *testName = ""; + const char *xtestName = ""; + bool doMonitoring = false; + + for (int i = 1; i < argc; ++i) { + if (argv[i][0] == '-') { + if (!strncmp(argv[i], "-t=", 3)) { + testName = argv[i]+3; + continue; + } + else if (!strncmp(argv[i], "-f=", 3)) { + fileName = argv[i]+3; + continue; + } + else if (!strncmp(argv[i], "-x=", 3)) { + xtestName = argv[i]+3; + continue; + } + else if (Timer::supported() && !strncmp(argv[i], "-m", 2)) { + doMonitoring = true; + continue; + } + } + + // invalid option, we display normal usage. + usage(argv[0]); + return 1; + } + + CPPUNIT_NS::Reporter* reporter; + if (fileName != 0) + reporter = new FileReporter(fileName, doMonitoring); + else + reporter = new FileReporter(stdout, doMonitoring); + + int num_errors; + if (xtestName[0] != 0) { + num_errors = CPPUNIT_NS::TestCase::run(reporter, xtestName, true); + } else { + num_errors = CPPUNIT_NS::TestCase::run(reporter, testName); + } + + reporter->printSummary(); + delete reporter; + + return num_errors; +} + +// See doc/README.intel for explanation about this code +#if defined (STLPORT) && defined (__ICL) && (__ICL >= 900) && \ + (_STLP_MSVC_LIB < 1300) && defined (_STLP_USE_DYNAMIC_LIB) +# include + +# undef std +namespace std +{ + void _STLP_CALL unexpected() { + unexpected_handler hdl; + set_unexpected(hdl = set_unexpected((unexpected_handler)0)); + hdl(); + } +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/csetjmp_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/csetjmp_header_test.cpp new file mode 100644 index 00000000000..b817862dbcc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/csetjmp_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/csignal_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/csignal_header_test.cpp new file mode 100644 index 00000000000..9a9c6e03a79 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/csignal_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cstdarg_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cstdarg_header_test.cpp new file mode 100644 index 00000000000..06cf0a5a49d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cstdarg_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cstddef_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cstddef_header_test.cpp new file mode 100644 index 00000000000..201d3f6f465 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cstddef_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cstdio_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cstdio_header_test.cpp new file mode 100644 index 00000000000..e38a5e99427 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cstdio_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cstdlib_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cstdlib_header_test.cpp new file mode 100644 index 00000000000..f35607934a4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cstdlib_header_test.cpp @@ -0,0 +1,13 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include + +//Just an additionnal compilation test for Borland that used to fail here. +#if defined (__BORLANDC__) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/cstring_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cstring_header_test.cpp new file mode 100644 index 00000000000..dd5d2cfcd6a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cstring_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cstring_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cstring_test.cpp new file mode 100644 index 00000000000..b51da07788d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cstring_test.cpp @@ -0,0 +1,75 @@ +#define _STLP_DO_IMPORT_CSTD_FUNCTIONS + +#include + +#include "cppunit/cppunit_proxy.h" + +//This test purpose is to check the right import of math.h C symbols +//into the std namespace so we do not use the using namespace std +//specification + +// +// TestCase class +// +class CStringTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(CStringTest); +#if defined (STLPORT) && !defined (_STLP_USE_NAMESPACES) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(import_checks); + CPPUNIT_TEST_SUITE_END(); + + protected: + void import_checks(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(CStringTest); + +#if defined (_MSC_VER) && (_MSC_VER >= 1400) +//For deprecated symbols like strcat, strtok... +# pragma warning (disable : 4996) +#endif + +// +// tests implementation +// +void CStringTest::import_checks() +{ +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) + std::size_t bar = 0; + CPPUNIT_CHECK( bar == 0 ); + + CPPUNIT_CHECK( std::memchr("foo", 'o', 3) != NULL ); + CPPUNIT_CHECK( std::memcmp("foo1", "foo2", 3) == 0 ); + char buf1[1], buf2[1]; + CPPUNIT_CHECK( std::memcpy(buf1, buf2, 0) != NULL ); + CPPUNIT_CHECK( std::memmove(buf1, buf2, 0) != NULL ); + CPPUNIT_CHECK( std::memset(buf1, 0, 1) != NULL ); + char buf[16]; buf[0] = 0; + const char* foo = "foo"; +# if !defined(_WIN32_WCE) + CPPUNIT_CHECK( std::strcoll("foo", "foo") == 0 ); + CPPUNIT_CHECK( std::strerror(0) != NULL ); +# endif + CPPUNIT_CHECK( std::strcat((char*)buf, foo) == (char*)buf ); // buf <- foo + CPPUNIT_CHECK( std::strchr(foo, 'o') != NULL ); + CPPUNIT_CHECK( std::strcmp("foo1", "foo2") < 0 ); + CPPUNIT_CHECK( std::strcpy((char*)buf, foo) == (char*)buf ); // buf <- foo + CPPUNIT_CHECK( std::strcspn("foo", "o") == 1 ); + CPPUNIT_CHECK( std::strlen("foo") == 3 ); + CPPUNIT_CHECK( std::strncat((char*)buf, foo, 2) == (char*)buf ); // buf <- foofo + CPPUNIT_CHECK( std::strncmp("foo1", "foo2", 3) == 0 ); + CPPUNIT_CHECK( std::strncpy((char*)buf, foo, 3) == (char*)buf ); // buf <- foo + CPPUNIT_CHECK( std::strpbrk(foo, "abcdo") == foo + 1 ); + const char* foofoo = "foofoo"; + CPPUNIT_CHECK( std::strrchr(foofoo, 'f') == foofoo + 3 ); + CPPUNIT_CHECK( std::strspn(foofoo, "aofz") == 6 ); + CPPUNIT_CHECK( std::strstr(foo, "") == foo ); + char foofoobuf[] = "foofoo"; + CPPUNIT_CHECK( std::strtok(foofoobuf, "z") != NULL ); +# if !defined(_WIN32_WCE) + CPPUNIT_CHECK( std::strxfrm((char*)buf, foo, 3) != 0 ); +# endif +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/ctime_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ctime_header_test.cpp new file mode 100644 index 00000000000..4e71c18ae6d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ctime_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/ctype_facets_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ctype_facets_test.cpp new file mode 100644 index 00000000000..9609e21c131 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ctype_facets_test.cpp @@ -0,0 +1,520 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +static const char* tested_locales[] = { +//name, +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + // We need exception support to check support of the following localizations. + "fr_FR", + "ru_RU.koi8r", + "en_GB", + "en_US", +# endif + "", + "C" +}; + +// +// tests implementation +// +void LocaleTest::_ctype_facet( const locale& loc) +{ + CPPUNIT_ASSERT( has_facet >(loc) ); + ctype const& ct = use_facet >(loc); + //is + { + CPPUNIT_ASSERT( ct.is(ctype_base::digit, '0') ); + CPPUNIT_ASSERT( ct.is(ctype_base::upper, 'A') ); + CPPUNIT_ASSERT( ct.is(ctype_base::lower, 'a') ); + CPPUNIT_ASSERT( ct.is(ctype_base::alpha, 'A') ); + CPPUNIT_ASSERT( ct.is(ctype_base::space, ' ') ); + CPPUNIT_ASSERT( !ct.is(ctype_base::space, '2') ); + CPPUNIT_ASSERT( ct.is(ctype_base::punct, '.') ); + CPPUNIT_ASSERT( ct.is(ctype_base::xdigit, 'a') ); + } + + //is range + { + char values[] = "0Aa ."; + ctype_base::mask res[sizeof(values)]; + ct.is(values, values + sizeof(values), res); + // '0' + CPPUNIT_ASSERT( (res[0] & ctype_base::print) != 0 ); + CPPUNIT_ASSERT( (res[0] & ctype_base::digit) != 0 ); + CPPUNIT_ASSERT( (res[0] & ctype_base::xdigit) != 0 ); + // 'A' + CPPUNIT_ASSERT( (res[1] & ctype_base::print) != 0 ); + CPPUNIT_ASSERT( (res[1] & ctype_base::alpha) != 0 ); + CPPUNIT_ASSERT( (res[1] & ctype_base::xdigit) != 0 ); + CPPUNIT_ASSERT( (res[1] & ctype_base::upper) != 0 ); + // 'a' + CPPUNIT_ASSERT( (res[2] & ctype_base::print) != 0 ); + CPPUNIT_ASSERT( (res[2] & ctype_base::alpha) != 0 ); + CPPUNIT_ASSERT( (res[2] & ctype_base::xdigit) != 0 ); + CPPUNIT_ASSERT( (res[2] & ctype_base::lower) != 0 ); + CPPUNIT_ASSERT( (res[2] & ctype_base::space) == 0 ); + // ' ' + CPPUNIT_ASSERT( (res[3] & ctype_base::print) != 0 ); + CPPUNIT_ASSERT( (res[3] & ctype_base::space) != 0 ); + CPPUNIT_ASSERT( (res[3] & ctype_base::digit) == 0 ); + // '.' + CPPUNIT_ASSERT( (res[4] & ctype_base::print) != 0 ); + CPPUNIT_ASSERT( (res[4] & ctype_base::punct) != 0 ); + CPPUNIT_ASSERT( (res[4] & ctype_base::digit) == 0 ); + } + + //scan_is + { + char range[] = "abAc123 ."; + const char *rbeg = range; + const char *rend = range + sizeof(range); + + const char *res; + res = ct.scan_is((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend); + CPPUNIT_ASSERT( res != rend ); + CPPUNIT_ASSERT( *res == 'a' ); + + res = ct.scan_is(ctype_base::upper, rbeg, rend); + CPPUNIT_ASSERT( res != rend ); + CPPUNIT_ASSERT( *res == 'A' ); + + res = ct.scan_is(ctype_base::punct, rbeg, rend); + CPPUNIT_ASSERT( res != rend ); + CPPUNIT_ASSERT( *res == '.' ); + } + + //scan_not + { + char range[] = "abAc123 ."; + const char *rbeg = range; + const char *rend = range + sizeof(range); + + const char *res; + res = ct.scan_not((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend); + CPPUNIT_ASSERT( res != rend ); + CPPUNIT_ASSERT( *res == '1' ); + + res = ct.scan_not(ctype_base::alpha, rbeg, rend); + CPPUNIT_ASSERT( res != rend ); + CPPUNIT_ASSERT( *res == '1' ); + + res = ct.scan_not(ctype_base::punct, rbeg, rend); + CPPUNIT_ASSERT( res != rend ); + CPPUNIT_ASSERT( *res == 'a' ); + } + + //toupper + { + CPPUNIT_ASSERT( ct.toupper('a') == 'A' ); + CPPUNIT_ASSERT( ct.toupper('A') == 'A' ); + CPPUNIT_ASSERT( ct.toupper('1') == '1' ); + } + + //toupper range + { + char range[] = "abAc1"; + char expected_range[] = "ABAC1"; + ct.toupper(range, range + sizeof(range)); + CPPUNIT_ASSERT( equal(range, range + sizeof(range), expected_range) ); + } + + //tolower + { + CPPUNIT_ASSERT( ct.tolower('A') == 'a' ); + CPPUNIT_ASSERT( ct.tolower('a') == 'a' ); + CPPUNIT_ASSERT( ct.tolower('1') == '1' ); + } + + //tolower range + { + char range[] = "ABaC1"; + char expected_range[] = "abac1"; + ct.tolower(range, range + sizeof(range)); + CPPUNIT_ASSERT( equal(range, range + sizeof(range), expected_range) ); + } + + //widen + { + CPPUNIT_ASSERT( ct.widen('a') == 'a' ); + } + + //widen range + { + char range[] = "ABaC1"; + char res[sizeof(range)]; + ct.widen(range, range + sizeof(range), res); + CPPUNIT_ASSERT( equal(range, range + sizeof(range), res) ); + } + + //narrow + { + CPPUNIT_ASSERT( ct.narrow('a', 'b') == 'a' ); + } + + //narrow range + { + char range[] = "ABaC1"; + char res[sizeof(range)]; + ct.narrow(range, range + sizeof(range), 'b', res); + CPPUNIT_ASSERT( equal(range, range + sizeof(range), res) ); + } +} + +void LocaleTest::_ctype_facet_w( const locale& loc ) +{ +# ifndef _STLP_NO_WCHAR_T + CPPUNIT_ASSERT( has_facet >(loc) ); + ctype const& wct = use_facet >(loc); + //is + { + CPPUNIT_CHECK( wct.is(ctype_base::digit, L'0') ); + CPPUNIT_CHECK( wct.is(ctype_base::upper, L'A') ); + CPPUNIT_CHECK( wct.is(ctype_base::lower, L'a') ); + CPPUNIT_CHECK( wct.is(ctype_base::alpha, L'A') ); + CPPUNIT_CHECK( wct.is(ctype_base::space, L' ') ); + CPPUNIT_CHECK( !wct.is(ctype_base::space, L'2') ); + CPPUNIT_CHECK( wct.is(ctype_base::punct, L'.') ); + CPPUNIT_CHECK( wct.is(ctype_base::xdigit, L'a') ); + } + + //is range + { + wchar_t values[] = L"0Aa ."; + ctype_base::mask res[sizeof(values) / sizeof(wchar_t)]; + wct.is(values, values + (sizeof(values) / sizeof(wchar_t)), res); + // '0' + CPPUNIT_CHECK( (res[0] & ctype_base::print) != 0 ); + CPPUNIT_CHECK( (res[0] & ctype_base::digit) != 0 ); + CPPUNIT_CHECK( (res[0] & ctype_base::xdigit) != 0 ); + // 'A' + CPPUNIT_CHECK( (res[1] & ctype_base::print) != 0 ); + CPPUNIT_CHECK( (res[1] & ctype_base::alpha) != 0 ); + CPPUNIT_CHECK( (res[1] & ctype_base::xdigit) != 0 ); + CPPUNIT_CHECK( (res[1] & ctype_base::upper) != 0 ); + // 'a' + CPPUNIT_CHECK( (res[2] & ctype_base::print) != 0 ); + CPPUNIT_CHECK( (res[2] & ctype_base::alpha) != 0 ); + CPPUNIT_CHECK( (res[2] & ctype_base::xdigit) != 0 ); + CPPUNIT_CHECK( (res[2] & ctype_base::lower) != 0 ); + CPPUNIT_CHECK( (res[2] & ctype_base::space) == 0 ); + // ' ' + CPPUNIT_CHECK( (res[3] & ctype_base::print) != 0 ); + CPPUNIT_CHECK( (res[3] & ctype_base::space) != 0 ); + CPPUNIT_CHECK( (res[3] & ctype_base::digit) == 0 ); + // '.' + CPPUNIT_CHECK( (res[4] & ctype_base::print) != 0 ); + CPPUNIT_CHECK( (res[4] & ctype_base::punct) != 0 ); + CPPUNIT_CHECK( (res[4] & ctype_base::digit) == 0 ); + } + + //scan_is + { + wchar_t range[] = L"abAc123 ."; + const wchar_t *rbeg = range; + const wchar_t *rend = range + (sizeof(range) / sizeof(wchar_t)); + + const wchar_t *res; + res = wct.scan_is((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend); + CPPUNIT_CHECK( res != rend ); + CPPUNIT_CHECK( *res == L'a' ); + + res = wct.scan_is(ctype_base::upper, rbeg, rend); + CPPUNIT_CHECK( res != rend ); + CPPUNIT_CHECK( *res == L'A' ); + + res = wct.scan_is(ctype_base::punct, rbeg, rend); + CPPUNIT_CHECK( res != rend ); + CPPUNIT_CHECK( *res == L'.' ); + } + + //scan_not + { + wchar_t range[] = L"abAc123 ."; + const wchar_t *rbeg = range; + const wchar_t *rend = range + (sizeof(range) / sizeof(wchar_t)); + + const wchar_t *res; + res = wct.scan_not((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend); + CPPUNIT_CHECK( res != rend ); + CPPUNIT_CHECK( *res == L'1' ); + + res = wct.scan_not(ctype_base::alpha, rbeg, rend); + CPPUNIT_CHECK( res != rend ); + CPPUNIT_CHECK( *res == L'1' ); + + res = wct.scan_not(ctype_base::punct, rbeg, rend); + CPPUNIT_CHECK( res != rend ); + CPPUNIT_CHECK( *res == L'a' ); + } + + //toupper + { + CPPUNIT_CHECK( wct.toupper(L'a') == L'A' ); + CPPUNIT_CHECK( wct.toupper(L'A') == L'A' ); + CPPUNIT_CHECK( wct.toupper(L'1') == L'1' ); + } + + //toupper range + { + wchar_t range[] = L"abAc1"; + wchar_t expected_range[] = L"ABAC1"; + wct.toupper(range, range + sizeof(range) / sizeof(wchar_t)); + CPPUNIT_CHECK( equal(range, range + sizeof(range) / sizeof(wchar_t), expected_range) ); + } + + //tolower + { + CPPUNIT_CHECK( wct.tolower(L'A') == L'a' ); + CPPUNIT_CHECK( wct.tolower(L'a') == L'a' ); + CPPUNIT_CHECK( wct.tolower(L'1') == L'1' ); + } + + //tolower range + { + wchar_t range[] = L"ABaC1"; + wchar_t expected_range[] = L"abac1"; + wct.tolower(range, range + sizeof(range) / sizeof(wchar_t)); + CPPUNIT_CHECK( equal(range, range + sizeof(range) / sizeof(wchar_t), expected_range) ); + } + + //widen + { + CPPUNIT_CHECK( wct.widen('a') == L'a' ); + } + + //widen range + { + char range[] = "ABaC1"; + wchar_t res[sizeof(range)]; + wchar_t expected_res[] = L"ABaC1"; + wct.widen(range, range + sizeof(range), res); + CPPUNIT_CHECK( equal(expected_res, expected_res + sizeof(range), res) ); + } + + //narrow + { + CPPUNIT_CHECK( wct.narrow(L'a', 'b') == L'a' ); + } + + //narrow range + { + wchar_t range[] = L"ABaC1"; + char res[sizeof(range) / sizeof(wchar_t)]; + char expected_res[] = "ABaC1"; + wct.narrow(range, range + sizeof(range) / sizeof(wchar_t), 'b', res); + CPPUNIT_CHECK( equal(expected_res, expected_res + sizeof(range) / sizeof(wchar_t), res) ); + } +# endif +} + + +typedef void (LocaleTest::*_Test) (const locale&); +static void test_supported_locale(LocaleTest& inst, _Test __test) { + size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]); + for (size_t i = 0; i < n; ++i) { + locale loc; +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try +# endif + { + locale tmp(tested_locales[i]); + loc = tmp; + } +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + catch (runtime_error const&) { + //This locale is not supported. + continue; + } +# endif + + CPPUNIT_MESSAGE( loc.name().c_str() ); + (inst.*__test)(loc); + + { + locale tmp(locale::classic(), tested_locales[i], locale::ctype); + loc = tmp; + } + (inst.*__test)(loc); + + { + locale tmp(locale::classic(), new ctype_byname(tested_locales[i])); +#ifndef _STLP_NO_WCHAR_T + locale tmp0(tmp, new ctype_byname(tested_locales[i])); + tmp = tmp0; +#endif + loc = tmp; + } + (inst.*__test)(loc); + } +} + +void LocaleTest::ctype_facet() +{ + test_supported_locale(*this, &LocaleTest::_ctype_facet); +#ifndef _STLP_NO_WCHAR_T + test_supported_locale(*this, &LocaleTest::_ctype_facet_w); +#endif +} + +void LocaleTest::ctype_by_name() +{ + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# if defined (STLPORT) || (!defined(__GNUC__) && (!defined (_MSC_VER) || (_MSC_VER > 1400))) + // libstdc++ call freelocate on bad locale + try { + locale loc(locale::classic(), new ctype_byname(static_cast(0))); + CPPUNIT_ASSERT( false ); + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_ASSERT( false ); + } +# endif + + try { + locale loc(locale::classic(), new ctype_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + +# if defined(STLPORT) || !defined(__GNUC__) + try { + locale loc(locale::classic(), new codecvt_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new codecvt_byname("yasli_language")); + //STLport implementation do not care about name pass to this facet. +# if !defined (STLPORT) + CPPUNIT_FAIL; +# endif + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new ctype_byname("fr_FR")); + CPPUNIT_ASSERT( has_facet >(loc) ); + ctype const& ct = use_facet >(loc); + CPPUNIT_ASSERT( ct.is(ctype_base::mask(ctype_base::print | ctype_base::lower | ctype_base::alpha), 'ç') ); + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new ctype_byname("C")); + ctype const& cfacet_byname = use_facet >(loc); + ctype const& cfacet = use_facet >(locale::classic()); + + for (char c = 0;; ++c) { + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::space, c) == cfacet.is(ctype_base::space, c)); + if (cfacet_byname.is(ctype_base::print, c) != cfacet.is(ctype_base::print, c)) + { + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::print, c) == cfacet.is(ctype_base::print, c)); + } + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::cntrl, c) == cfacet.is(ctype_base::cntrl, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::upper, c) == cfacet.is(ctype_base::upper, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::lower, c) == cfacet.is(ctype_base::lower, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::alpha, c) == cfacet.is(ctype_base::alpha, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::digit, c) == cfacet.is(ctype_base::digit, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::punct, c) == cfacet.is(ctype_base::punct, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::xdigit, c) == cfacet.is(ctype_base::xdigit, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::alnum, c) == cfacet.is(ctype_base::alnum, c)); + CPPUNIT_CHECK(cfacet_byname.is(ctype_base::graph, c) == cfacet.is(ctype_base::graph, c)); + if (c == 127) break; + } + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +# if defined(STLPORT) || !defined(__GNUC__) + try { + locale loc(locale::classic(), new ctype_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new ctype_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + +# if defined(STLPORT) || !defined(__GNUC__) + try { + locale loc(locale::classic(), new codecvt_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new codecvt_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/ctype_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/ctype_header_test.c new file mode 100644 index 00000000000..8bd9fa66c3d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ctype_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cwchar_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cwchar_header_test.cpp new file mode 100644 index 00000000000..7a633906b52 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cwchar_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/cwctype_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/cwctype_header_test.cpp new file mode 100644 index 00000000000..0746b838fcf --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/cwctype_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/deque_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/deque_header_test.cpp new file mode 100644 index 00000000000..c9459482eec --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/deque_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/deque_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/deque_test.cpp new file mode 100644 index 00000000000..6be7e01fc71 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/deque_test.cpp @@ -0,0 +1,330 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class DequeTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(DequeTest); + CPPUNIT_TEST(deque1); + CPPUNIT_TEST(at); + CPPUNIT_TEST(insert); + CPPUNIT_TEST(erase); + CPPUNIT_TEST(auto_ref); + CPPUNIT_TEST(allocator_with_state); +#if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(optimizations_check); + CPPUNIT_TEST_SUITE_END(); + +protected: + void deque1(); + void insert(); + void erase(); + void at(); + void auto_ref(); + void allocator_with_state(); + void optimizations_check(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(DequeTest); + +// +// tests implementation +// +void DequeTest::deque1() +{ + deque d; + d.push_back(4); + d.push_back(9); + d.push_back(16); + d.push_front(1); + + CPPUNIT_ASSERT( d[0] == 1 ); + CPPUNIT_ASSERT( d[1] == 4 ); + CPPUNIT_ASSERT( d[2] == 9 ); + CPPUNIT_ASSERT( d[3] == 16 ); + + d.pop_front(); + d[2] = 25; + + CPPUNIT_ASSERT( d[0] == 4 ); + CPPUNIT_ASSERT( d[1] == 9 ); + CPPUNIT_ASSERT( d[2] == 25 ); + + //Some compile time tests: + deque::iterator dit = d.begin(); + deque::const_iterator cdit(d.begin()); + CPPUNIT_ASSERT( (dit - cdit) == 0 ); + CPPUNIT_ASSERT( (cdit - dit) == 0 ); + CPPUNIT_ASSERT( (dit - dit) == 0 ); + CPPUNIT_ASSERT( (cdit - cdit) == 0 ); + CPPUNIT_ASSERT(!((dit < cdit) || (dit > cdit) || (dit != cdit) || !(dit <= cdit) || !(dit >= cdit))); +} + +void DequeTest::insert() +{ + deque d; + d.push_back(0); + d.push_back(1); + d.push_back(2); + CPPUNIT_ASSERT( d.size() == 3 ); + + deque::iterator dit; + + //Insertion before begin: + dit = d.insert(d.begin(), 3); + CPPUNIT_ASSERT( dit != d.end() ); + CPPUNIT_CHECK( *dit == 3 ); + CPPUNIT_ASSERT( d.size() == 4 ); + CPPUNIT_ASSERT( d[0] == 3 ); + + //Insertion after begin: + dit = d.insert(d.begin() + 1, 4); + CPPUNIT_ASSERT( dit != d.end() ); + CPPUNIT_CHECK( *dit == 4 ); + CPPUNIT_ASSERT( d.size() == 5 ); + CPPUNIT_ASSERT( d[1] == 4 ); + + //Insertion at end: + dit = d.insert(d.end(), 5); + CPPUNIT_ASSERT( dit != d.end() ); + CPPUNIT_CHECK( *dit == 5 ); + CPPUNIT_ASSERT( d.size() == 6 ); + CPPUNIT_ASSERT( d[5] == 5 ); + + //Insertion before last element: + dit = d.insert(d.end() - 1, 6); + CPPUNIT_ASSERT( dit != d.end() ); + CPPUNIT_CHECK( *dit == 6 ); + CPPUNIT_ASSERT( d.size() == 7 ); + CPPUNIT_ASSERT( d[5] == 6 ); + + //Insertion of several elements before begin + d.insert(d.begin(), 2, 7); + CPPUNIT_ASSERT( d.size() == 9 ); + CPPUNIT_ASSERT( d[0] == 7 ); + CPPUNIT_ASSERT( d[1] == 7 ); + + //Insertion of several elements after begin + //There is more elements to insert than elements before insertion position + d.insert(d.begin() + 1, 2, 8); + CPPUNIT_ASSERT( d.size() == 11 ); + CPPUNIT_ASSERT( d[1] == 8 ); + CPPUNIT_ASSERT( d[2] == 8 ); + + //There is less elements to insert than elements before insertion position + d.insert(d.begin() + 3, 2, 9); + CPPUNIT_ASSERT( d.size() == 13 ); + CPPUNIT_ASSERT( d[3] == 9 ); + CPPUNIT_ASSERT( d[4] == 9 ); + + //Insertion of several elements at end: + d.insert(d.end(), 2, 10); + CPPUNIT_ASSERT( d.size() == 15 ); + CPPUNIT_ASSERT( d[14] == 10 ); + CPPUNIT_ASSERT( d[13] == 10 ); + + //Insertion of several elements before last: + //There is more elements to insert than elements after insertion position + d.insert(d.end() - 1, 2, 11); + CPPUNIT_ASSERT( d.size() == 17 ); + CPPUNIT_ASSERT( d[15] == 11 ); + CPPUNIT_ASSERT( d[14] == 11 ); + + //There is less elements to insert than elements after insertion position + d.insert(d.end() - 3, 2, 12); + CPPUNIT_ASSERT( d.size() == 19 ); + CPPUNIT_ASSERT( d[15] == 12 ); + CPPUNIT_ASSERT( d[14] == 12 ); +} + +void DequeTest::at() { + deque d; + deque const& cd = d; + + d.push_back(10); + CPPUNIT_ASSERT( d.at(0) == 10 ); + d.at(0) = 20; + CPPUNIT_ASSERT( cd.at(0) == 20 ); + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + for (;;) { + try { + d.at(1) = 20; + CPPUNIT_ASSERT(false); + } + catch (out_of_range const&) { + return; + } + catch (...) { + CPPUNIT_ASSERT(false); + } + } +#endif +} + +void DequeTest::auto_ref() +{ + int i; + deque ref; + for (i = 0; i < 5; ++i) { + ref.push_back(i); + } + + deque > d_d_int(1, ref); + d_d_int.push_back(d_d_int[0]); + d_d_int.push_back(ref); + d_d_int.push_back(d_d_int[0]); + d_d_int.push_back(d_d_int[0]); + d_d_int.push_back(ref); + + for (i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( d_d_int[i] == ref ); + } +} + +void DequeTest::allocator_with_state() +{ + char buf1[1024]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + { + typedef deque > DequeInt; + DequeInt dint1(10, 0, stack1); + DequeInt dint1Cpy(dint1); + + DequeInt dint2(10, 1, stack2); + DequeInt dint2Cpy(dint2); + + dint1.swap(dint2); + + CPPUNIT_ASSERT( dint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( dint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( dint1 == dint2Cpy ); + CPPUNIT_ASSERT( dint2 == dint1Cpy ); + CPPUNIT_ASSERT( dint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( dint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); +} + +struct Point { + int x, y; +}; + +struct PointEx : public Point { + PointEx() : builtFromBase(false) {} + PointEx(const Point&) : builtFromBase(true) {} + + bool builtFromBase; +}; + +#if defined (STLPORT) +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __type_traits { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +//This test check that deque implementation do not over optimize +//operation as PointEx copy constructor is trivial +void DequeTest::optimizations_check() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + deque d1(1); + CPPUNIT_ASSERT( d1.size() == 1 ); + + deque d2(d1.begin(), d1.end()); + CPPUNIT_ASSERT( d2.size() == 1 ); + CPPUNIT_ASSERT( d2[0].builtFromBase == true ); + + d2.insert(d2.end(), d1.begin(), d1.end()); + CPPUNIT_ASSERT( d2.size() == 2 ); + CPPUNIT_ASSERT( d2[1].builtFromBase == true ); +#endif +} + +void DequeTest::erase() +{ + deque dint; + dint.push_back(3); + dint.push_front(2); + dint.push_back(4); + dint.push_front(1); + dint.push_back(5); + dint.push_front(0); + dint.push_back(6); + + deque::iterator it(dint.begin() + 1); + CPPUNIT_ASSERT( *it == 1 ); + + dint.erase(dint.begin()); + CPPUNIT_ASSERT( *it == 1 ); + + it = dint.end() - 2; + CPPUNIT_ASSERT( *it == 5 ); + + dint.erase(dint.end() - 1); + CPPUNIT_ASSERT( *it == 5 ); + + dint.push_back(6); + dint.push_front(0); + + it = dint.begin() + 2; + CPPUNIT_ASSERT( *it == 2 ); + + dint.erase(dint.begin(), dint.begin() + 2); + CPPUNIT_ASSERT( *it == 2 ); + + it = dint.end() - 3; + CPPUNIT_ASSERT( *it == 4 ); + + dint.erase(dint.end() - 2, dint.end()); + CPPUNIT_ASSERT( *it == 4 ); +} + +#if (!defined (STLPORT) || \ + (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION))) && \ + (!defined (_MSC_VER) || (_MSC_VER > 1400)) && \ + (!defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC_MINOR__ < 3)) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + deque instances; + typedef deque::size_type size; +}; +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/divides_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/divides_test.cpp new file mode 100644 index 00000000000..73e35cda4aa --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/divides_test.cpp @@ -0,0 +1,33 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class DivideTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(DivideTest); + CPPUNIT_TEST(div); + CPPUNIT_TEST_SUITE_END(); + +protected: + void div(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(DivideTest); + +// +// tests implementation +// +void DivideTest::div() +{ + int input [3] = { 2, 3, 4 }; + int result = accumulate(input, input + 3, 48, divides()); + CPPUNIT_ASSERT(result==2); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/epilog_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/epilog_test.cpp new file mode 100644 index 00000000000..07e28f3ba17 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/epilog_test.cpp @@ -0,0 +1,10 @@ +#include +#include + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) + +struct some_struct { + std::string s; // if std not properly redefined, error will be here +}; + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/equal_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/equal_test.cpp new file mode 100644 index 00000000000..91c0ae21c92 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/equal_test.cpp @@ -0,0 +1,178 @@ +#include +#include +#include +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class EqualTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(EqualTest); + CPPUNIT_TEST(equal_range0); + CPPUNIT_TEST(equal_range1); + CPPUNIT_TEST(equal_range2); + CPPUNIT_TEST(equal0); + CPPUNIT_TEST(equal1); + CPPUNIT_TEST(equal2); + CPPUNIT_TEST(equalto); + CPPUNIT_TEST_SUITE_END(); + +protected: + void equal_range0(); + void equal_range1(); + void equal_range2(); + void equal0(); + void equal1(); + void equal2(); + void equalto(); + static bool values_squared(int a_, int b_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(EqualTest); + +// +// tests implementation +// +void EqualTest::equal_range0() +{ + int numbers[10] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3 }; + pair range = equal_range((int*)numbers, (int*)numbers + 10, 2); + CPPUNIT_ASSERT( (range.first - numbers) == 4 ); + CPPUNIT_ASSERT( (range.second - numbers) == 8 ); +} + +void EqualTest::equal_range1() +{ + typedef vector IntVec; + IntVec v(10); + for (int i = 0; (size_t)i < v.size(); ++i) + v[i] = i / 3; + + pair range = equal_range(v.begin(), v.end(), 2); + CPPUNIT_ASSERT( (range.first - v.begin()) == 6 ); + CPPUNIT_ASSERT( (range.second - v.begin()) == 9 ); + for (; range.first != range.second; ++range.first) + CPPUNIT_ASSERT( *range.first == 2 ); + + range = equal_range(v.begin(), v.end(), 4); + CPPUNIT_ASSERT( range.first == range.second ); + CPPUNIT_ASSERT( range.first == v.end() ); +} + +struct Test { +#if defined (__DMC__) + Test(); +#endif + + Test(int val) : value(val) {} + int value; + + bool operator == (int i) const + { return value == i; } +}; + +bool operator < (const Test& v1, int v2) +{ return v1.value < v2; } + +bool operator < (int v1, const Test& v2) +{ return v1 < v2.value; } + +#if defined (_MSC_VER) && !defined (STLPORT) +bool operator < (const Test& v1, const Test& v2) +{ return v1.value < v2.value; } +#endif + +void EqualTest::equal_range2() +{ + char chars[] = "aabbccddggghhklllmqqqqssyyzz"; + + const unsigned count = sizeof(chars) - 1; + pair range = equal_range((char*)chars, (char*)chars + count, 'q', less()); + CPPUNIT_ASSERT( (range.first - chars) == 18 ); + CPPUNIT_ASSERT( (range.second - chars) == 22 ); + for (; range.first != range.second; ++range.first) + CPPUNIT_ASSERT( *range.first == 'q' ); + + range = equal_range((char*)chars, (char*)chars + count, 'm', less()); + CPPUNIT_ASSERT( (range.second - range.first) == 1 ); + CPPUNIT_ASSERT( *range.first == 'm' ); + + vector tv; + vector::iterator it; + pair::iterator, vector::iterator> p; + + for (int i = 0; i < 10; ++i) { + tv.push_back(i); + } + + it = upper_bound(tv.begin(), tv.end(), 5); + CPPUNIT_ASSERT( it != tv.end() ); + CPPUNIT_ASSERT( *it == 6 ); + + it = lower_bound(tv.begin(), tv.end(), 5); + CPPUNIT_ASSERT( it != tv.end() ); + CPPUNIT_ASSERT( *it == 5 ); + + p = equal_range(tv.begin(), tv.end(), 5); + CPPUNIT_ASSERT( p.first != p.second ); + CPPUNIT_ASSERT( p.first != tv.end() ); + CPPUNIT_ASSERT( p.second != tv.end() ); + CPPUNIT_ASSERT( *p.first == 5 ); + CPPUNIT_ASSERT( *p.second == 6 ); +} + +void EqualTest::equal0() +{ + int numbers1[5] = { 1, 2, 3, 4, 5 }; + int numbers2[5] = { 1, 2, 4, 8, 16 }; + int numbers3[2] = { 1, 2 }; + + CPPUNIT_ASSERT( !equal(numbers1, numbers1 + 5, numbers2) ); + CPPUNIT_ASSERT( equal(numbers3, numbers3 + 2, numbers1) ); +} + +void EqualTest::equal1() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i; + vector v2(10); + CPPUNIT_ASSERT( !equal(v1.begin(), v1.end(), v2.begin()) ); + + copy(v1.begin(), v1.end(), v2.begin()); + CPPUNIT_ASSERT( equal(v1.begin(), v1.end(), v2.begin()) ) +} + +void EqualTest::equal2() +{ + vector v1(10); + vector v2(10); + for (int i = 0; (size_t)i < v1.size(); ++i) { + v1[i] = i; + v2[i] = i * i; + } + CPPUNIT_ASSERT( equal(v1.begin(), v1.end(), v2.begin(), values_squared) ); +} + +void EqualTest::equalto() +{ + int input1 [4] = { 1, 7, 2, 2 }; + int input2 [4] = { 1, 6, 2, 3 }; + + int output [4]; + transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, equal_to()); + CPPUNIT_ASSERT( output[0] == 1 ); + CPPUNIT_ASSERT( output[1] == 0 ); + CPPUNIT_ASSERT( output[2] == 1 ); + CPPUNIT_ASSERT( output[3] == 0 ); +} + +bool EqualTest::values_squared(int a_, int b_) +{ + return (a_ * a_ == b_); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/errno_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/errno_header_test.c new file mode 100644 index 00000000000..0a0accb6d4b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/errno_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/exception_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/exception_header_test.cpp new file mode 100644 index 00000000000..d784ab9e67c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/exception_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/exception_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/exception_test.cpp new file mode 100644 index 00000000000..1879945161b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/exception_test.cpp @@ -0,0 +1,193 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if defined (STLPORT) && defined (_STLP_USE_NAMESPACES) +/* + * This test case purpose is to check that the exception handling + * functions are correctly imported to the STLport namespace only + * if they have a right behavior. + * Otherwise they are not imported to report the problem as a compile + * time error. + */ + +// +// TestCase class +// +class ExceptionTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ExceptionTest); +#if defined (STLPORT) && !defined (_STLP_USE_EXCEPTIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(what); +#if defined (STLPORT) && defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(unexpected_except); +#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS) + CPPUNIT_STOP_IGNORE; +#endif +#if defined (STLPORT) && defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(uncaught_except); +#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS) + CPPUNIT_STOP_IGNORE; +#endif + CPPUNIT_TEST(exception_emission); + CPPUNIT_TEST_SUITE_END(); + +protected: + void what(); + void unexpected_except(); + void uncaught_except(); + void exception_emission(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ExceptionTest); + +#if !defined (STLPORT) || !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT) +bool g_unexpected_called = false; +void unexpected_hdl() { + g_unexpected_called = true; + throw std::bad_exception(); +} + +struct special_except {}; +void throw_func() { + throw special_except(); +} + +void throw_except_func() throw(std::exception) { + throw_func(); +} +#endif + +void ExceptionTest::what() +{ + try { + throw std::runtime_error( std::string( "message" ) ); + } + catch ( std::runtime_error& err ) { + CPPUNIT_CHECK( strcmp( err.what(), "message" ) == 0 ); + } +} + +void ExceptionTest::unexpected_except() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT) + std::unexpected_handler hdl = &unexpected_hdl; + std::set_unexpected(hdl); + + try { + throw_except_func(); + } + catch (std::bad_exception const&) { + CPPUNIT_ASSERT( true ); + } + catch (special_except) { + CPPUNIT_ASSERT( false ); + } + CPPUNIT_ASSERT( g_unexpected_called ); +#endif +} + +#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) +struct UncaughtClassTest +{ + UncaughtClassTest(int &res) : _res(res) + {} + + ~UncaughtClassTest() { + _res = std::uncaught_exception()?1:0; + } + + int &_res; +}; +#endif + +void ExceptionTest::uncaught_except() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) + int uncaught_result = -1; + { + UncaughtClassTest test_inst(uncaught_result); + CPPUNIT_ASSERT( uncaught_result == -1 ); + } + CPPUNIT_ASSERT( uncaught_result == 0 ); + + { + try { + uncaught_result = -1; + UncaughtClassTest test_inst(uncaught_result); + throw "exception"; + } + catch (...) { + } + } + CPPUNIT_ASSERT( uncaught_result == 1 ); +#endif +} + +void ExceptionTest::exception_emission() +{ +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + std::string foo = "foo"; + try { + throw std::runtime_error(foo); + } + catch (std::runtime_error const& e) { + CPPUNIT_ASSERT( foo == e.what() ); + std::runtime_error clone(""); + clone = e; + CPPUNIT_ASSERT(foo == clone.what() ); + } + catch (...) { + CPPUNIT_ASSERT( false ); + } + + try { + throw std::runtime_error(foo); + } + catch (std::runtime_error e) { + CPPUNIT_ASSERT( foo == e.what() ); + std::runtime_error clone(""); + clone = e; + CPPUNIT_ASSERT(foo == clone.what() ); + } + catch (...) { + CPPUNIT_ASSERT( false ); + } + + std::string msg(512, 'a'); + try { + throw std::runtime_error(msg); + } + catch (std::runtime_error const& e) { + CPPUNIT_ASSERT(msg == e.what() ); + std::runtime_error clone(""); + clone = e; + CPPUNIT_ASSERT(msg == clone.what() ); + } + catch (...) { + CPPUNIT_ASSERT( false ); + } + + try { + throw std::runtime_error(msg); + } + catch (std::runtime_error e) { + CPPUNIT_ASSERT(msg == e.what() ); + std::runtime_error clone(""); + clone = e; + CPPUNIT_ASSERT(msg == clone.what() ); + } + catch (...) { + CPPUNIT_ASSERT( false ); + } +#endif +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/fadapter.h b/reactos/lib/3rdparty/stlport/test/unit/fadapter.h new file mode 100644 index 00000000000..b1cceaf88be --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/fadapter.h @@ -0,0 +1,80 @@ +#ifndef _fadapter_h_ +#define _fadapter_h_ + +#include + +// used as adaptor's return/argument type, +// to allow binders/composers usage +struct __void_tag {}; + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +using std::unary_function; +#endif + +template +class pointer_to_void_function { +protected: + Result (*ptr)(); +public: + explicit pointer_to_void_function(Result (*x)()) : ptr(x) {} + Result operator()() const { return ptr(); } + Result operator()(__void_tag) const { return ptr(); } +}; + +// to feed composers +template +struct projectvoid : public unary_function { + __void_tag operator()(const Arg1& x) const { return __void_tag(); } +}; + +#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG) + +template +pointer_to_void_function ptr_fun(Result (*x)()) { + return pointer_to_void_function(x); +} + +// alternate name +template +pointer_to_void_function ptr_gen(Result (*x)()) { + return pointer_to_void_function(x); +} + +#endif /* !defined (_STLP_MEMBER_POINTER_PARAM_BUG) */ + +template +class pointer_to_unary_procedure /* :public unary_function */ { +protected: + typedef void (*fun_type)(Arg); + fun_type ptr; +public: + typedef Arg argument_type; + pointer_to_unary_procedure() {} + pointer_to_unary_procedure(fun_type x) : ptr(x) {} + void operator() (Arg x) const { ptr(x); } +}; + +template +inline pointer_to_unary_procedure ptr_proc(void (*x)(Arg)) { + return pointer_to_unary_procedure(x); +} + +template +class pointer_to_binary_procedure /* : public unary_function */ { +protected: + typedef void (*fun_type)(Arg1, Arg2); + fun_type ptr; +public: + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + pointer_to_binary_procedure() {} + pointer_to_binary_procedure(fun_type x) : ptr(x) {} + void operator() (Arg1 x, Arg2 y) const { ptr(x, y); } +}; + +template +inline pointer_to_binary_procedure ptr_proc(void (*x)(Arg1, Arg2)) { + return pointer_to_binary_procedure(x); +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/fib.h b/reactos/lib/3rdparty/stlport/test/unit/fib.h new file mode 100644 index 00000000000..9c740384bc1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/fib.h @@ -0,0 +1,21 @@ +#ifndef _fib_h +#define _fib_h +class Fibonacci +{ + public: + Fibonacci() : v1(0), v2(1) {} + inline int operator()(); + private: + int v1; + int v2; +}; + +inline int +Fibonacci::operator()() +{ + int r = v1 + v2; + v1 = v2; + v2 = r; + return v1; +} +#endif // _fib_h diff --git a/reactos/lib/3rdparty/stlport/test/unit/fill_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/fill_test.cpp new file mode 100644 index 00000000000..22d3fe9f0a5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/fill_test.cpp @@ -0,0 +1,61 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class FillTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(FillTest); + CPPUNIT_TEST(fill1); + CPPUNIT_TEST(filln1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void fill1(); + void filln1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(FillTest); + +// +// tests implementation +// +void FillTest::fill1() +{ + vector v(10); + fill(v.begin(), v.end(), 42); + + CPPUNIT_ASSERT(v[0]==42); + CPPUNIT_ASSERT(v[1]==42); + CPPUNIT_ASSERT(v[2]==42); + CPPUNIT_ASSERT(v[3]==42); + CPPUNIT_ASSERT(v[4]==42); + CPPUNIT_ASSERT(v[5]==42); + CPPUNIT_ASSERT(v[6]==42); + CPPUNIT_ASSERT(v[7]==42); + CPPUNIT_ASSERT(v[8]==42); + CPPUNIT_ASSERT(v[9]==42); +} +void FillTest::filln1() +{ + vector v(10); + fill_n(v.begin(), v.size(), 42); + + CPPUNIT_ASSERT(v[0]==42); + CPPUNIT_ASSERT(v[1]==42); + CPPUNIT_ASSERT(v[2]==42); + CPPUNIT_ASSERT(v[3]==42); + CPPUNIT_ASSERT(v[4]==42); + CPPUNIT_ASSERT(v[5]==42); + CPPUNIT_ASSERT(v[6]==42); + CPPUNIT_ASSERT(v[7]==42); + CPPUNIT_ASSERT(v[8]==42); + CPPUNIT_ASSERT(v[9]==42); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/find_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/find_test.cpp new file mode 100644 index 00000000000..d910f33cc5e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/find_test.cpp @@ -0,0 +1,135 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class FindTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(FindTest); + CPPUNIT_TEST(find0); + CPPUNIT_TEST(find1); + CPPUNIT_TEST(findif0); + CPPUNIT_TEST(findif1); + CPPUNIT_TEST(find_char); + CPPUNIT_TEST_SUITE_END(); + +protected: + void find0(); + void find1(); + void findif0(); + void findif1(); + void find_char(); + static bool odd(int a_); + static bool div_3(int a_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(FindTest); + +// +// tests implementation +// +void FindTest::find0() +{ + int numbers[10] = { 0, 1, 4, 9, 16, 25, 36, 49, 64 }; + + int *location = find((int*)numbers, (int*)numbers + 10, 25); + + CPPUNIT_ASSERT((location - numbers)==5); + + int *out_range = find((int*)numbers, (int*)numbers + 10, 128); + + CPPUNIT_ASSERT( out_range == (int *)(numbers + 10) ); +} + +struct Key +{ + int data; + + /* This operator should rather be global and commutative + but implementing it this way show that STLport used to + ask too much from the user code. */ + bool operator == (int d) const + { + return data == d; + } +}; + +void FindTest::find1() +{ + int years[] = { 1942, 1952, 1962, 1972, 1982, 1992 }; + + const unsigned yearCount = sizeof(years) / sizeof(years[0]); + int* location = find((int*)years, (int*)years + yearCount, 1972); + + CPPUNIT_ASSERT((location - years)==3); +} + +void FindTest::findif0() +{ + { + int numbers[6] = { 2, 4, 8, 15, 32, 64 }; + int *location = find_if((int*)numbers, (int*)numbers + 6, odd); + + CPPUNIT_ASSERT((location - numbers)==3); + + int numbers_even[6] = { 2, 4, 8, 16, 32, 64 }; + + int *out_range = find_if((int*)numbers_even, (int*)numbers_even + 6, odd); + + CPPUNIT_ASSERT( out_range == (int *)(numbers_even + 6) ); + } + + { + Key keys[10] = { {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} }; + Key const* k = find(keys + 0, keys + 10, 5); + CPPUNIT_ASSERT( k == keys + 10 ); + } +} + +void FindTest::findif1() +{ + typedef vector IntVec; + IntVec v(10); + for(int i = 0; (size_t)i < v.size(); ++i) + v[i] =(i + 1) *(i + 1); + IntVec::iterator iter; + iter = find_if(v.begin(), v.end(), div_3); + CPPUNIT_ASSERT((iter - v.begin())==2); +} + +bool FindTest::odd(int a_) +{ + return (a_ % 2) != 0; +} + +bool FindTest::div_3(int a_) +{ + return a_ % 3 ? 0 : 1; +} + +void FindTest::find_char() +{ + char str[] = "abcdefghij"; + char *pstr = (char*)str; + const char* cpstr = (const char*)str; + size_t str_size = sizeof(str) / sizeof(char); + + char *d = find(pstr, pstr + str_size, 'd'); + CPPUNIT_ASSERT( *d == 'd' ); + + const char *e = find(cpstr, cpstr + str_size, 'e'); + CPPUNIT_ASSERT( *e == 'e' ); + + char *last = find(pstr, pstr + str_size, 'x'); + CPPUNIT_ASSERT( last == pstr + str_size ); + + const char *clast = find(cpstr, cpstr + str_size, 'x'); + CPPUNIT_ASSERT( clast == cpstr + str_size ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/finsert_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/finsert_test.cpp new file mode 100644 index 00000000000..e45289e9f87 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/finsert_test.cpp @@ -0,0 +1,58 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class FinsertTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(FinsertTest); + CPPUNIT_TEST(finsert1); + CPPUNIT_TEST(finsert2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void finsert1(); + void finsert2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(FinsertTest); + +// +// tests implementation +// +void FinsertTest::finsert1() +{ + char const* array [] = { "laurie", "jennifer", "leisa" }; + deque names; + front_insert_iterator > fit(names); + fit = copy(array, array + 3, front_insert_iterator >(names)); + + CPPUNIT_ASSERT(names[0]==array[2]); + CPPUNIT_ASSERT(names[1]==array[1]); + CPPUNIT_ASSERT(names[2]==array[0]); + + copy(array, array + 3, fit); + CPPUNIT_ASSERT(names[3]==array[2]); + CPPUNIT_ASSERT(names[4]==array[1]); + CPPUNIT_ASSERT(names[5]==array[0]); +} + +void FinsertTest::finsert2() +{ + char const* array [] = { "laurie", "jennifer", "leisa" }; + + deque names; + copy(array, array + 3, front_inserter(names)); + + CPPUNIT_ASSERT(names[0]==array[2]); + CPPUNIT_ASSERT(names[1]==array[1]); + CPPUNIT_ASSERT(names[2]==array[0]); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/float_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/float_header_test.c new file mode 100644 index 00000000000..bb3f28d3457 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/float_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/foreach_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/foreach_test.cpp new file mode 100644 index 00000000000..76fd5144730 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/foreach_test.cpp @@ -0,0 +1,73 @@ +#include +#include +#include "fadapter.h" + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class ForeachTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ForeachTest); + CPPUNIT_TEST(foreach0); + CPPUNIT_TEST(foreach1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void foreach0(); + void foreach1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ForeachTest); + +// +// tests implementation +// +static void increase(int& a_) +{ + a_ += 1; +} +void ForeachTest::foreach0() +{ + int numbers[10] = { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 }; + + for_each(numbers, numbers + 10, ptr_fun(increase)); + + CPPUNIT_ASSERT(numbers[0]==2); + CPPUNIT_ASSERT(numbers[1]==2); + CPPUNIT_ASSERT(numbers[2]==3); + CPPUNIT_ASSERT(numbers[3]==4); + CPPUNIT_ASSERT(numbers[4]==6); + CPPUNIT_ASSERT(numbers[5]==9); + CPPUNIT_ASSERT(numbers[6]==14); + CPPUNIT_ASSERT(numbers[7]==22); + CPPUNIT_ASSERT(numbers[8]==35); + CPPUNIT_ASSERT(numbers[9]==56); +} +static void sqr(int& a_) +{ + a_ = a_ * a_; +} +void ForeachTest::foreach1() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i; + for_each(v1.begin(), v1.end(), ptr_fun(sqr) ); + + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==4); + CPPUNIT_ASSERT(v1[3]==9); + CPPUNIT_ASSERT(v1[4]==16); + CPPUNIT_ASSERT(v1[5]==25); + CPPUNIT_ASSERT(v1[6]==36); + CPPUNIT_ASSERT(v1[7]==49); + CPPUNIT_ASSERT(v1[8]==64); + CPPUNIT_ASSERT(v1[9]==81); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/fstream_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/fstream_header_test.cpp new file mode 100644 index 00000000000..7fbe26862fd --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/fstream_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/fstream_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/fstream_test.cpp new file mode 100644 index 00000000000..bba41a202ac --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/fstream_test.cpp @@ -0,0 +1,915 @@ +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include +# include +# include +# include + +#include + +# include "full_streambuf.h" +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +//The macro value gives approximately the generated file +//size in Go +//#define CHECK_BIG_FILE 4 + +# if (!defined(STLPORT) && (defined (__GNUC__) && (__GNUC__ > 3))) || \ + (defined (STLPORT) && !defined (_STLP_NO_CUSTOM_IO) && !defined (_STLP_NO_MEMBER_TEMPLATES) && \ + !((defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) || \ + (defined (__GNUC__) && (__GNUC__ < 3)) || \ + (defined (__SUNPRO_CC)) || \ + (defined (__DMC__) && defined (_DLL)))) +# define DO_CUSTOM_FACET_TEST +# endif + +// +// TestCase class +// +class FstreamTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(FstreamTest); + CPPUNIT_TEST(output); + CPPUNIT_TEST(input); + CPPUNIT_TEST(input_char); + CPPUNIT_TEST(io); + CPPUNIT_TEST(err); + CPPUNIT_TEST(tellg); + CPPUNIT_TEST(tellp); + CPPUNIT_TEST(seek); + CPPUNIT_TEST(buf); + CPPUNIT_TEST(rdbuf); + CPPUNIT_TEST(streambuf_output); + CPPUNIT_TEST(win32_file_format); + CPPUNIT_TEST(null_stream); +# if defined (STLPORT) && (defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS)) + CPPUNIT_IGNORE; +# endif + CPPUNIT_TEST(null_buf); +# if !defined (STLPORT) || !defined (_STLP_WIN32) + CPPUNIT_TEST(offset); +# endif +# if defined (CHECK_BIG_FILE) + CPPUNIT_TEST(big_file); +# endif +# if !defined (DO_CUSTOM_FACET_TEST) + CPPUNIT_IGNORE; +# endif + CPPUNIT_TEST(custom_facet); + CPPUNIT_TEST_SUITE_END(); + + protected: + void output(); + void input(); + void input_char(); + void io(); + void err(); + void tellg(); + void tellp(); + void seek(); + void buf(); + void rdbuf(); + void streambuf_output(); + void win32_file_format(); + void null_stream(); + void null_buf(); +# if !defined (STLPORT) || !defined (_STLP_WIN32) + void offset(); +# endif + void custom_facet(); +# if defined (CHECK_BIG_FILE) + void big_file(); +# endif +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(FstreamTest); + +// +// tests implementation +// +void FstreamTest::output() +{ + ofstream f( "test_file.txt" ); + + f << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef"; + CPPUNIT_ASSERT (f.good()); + // CPPUNIT_ASSERT( s.str() == "1\n2\nabcd\nghk lm\nabcd ef" ); +} + +void FstreamTest::input() +{ + { + ifstream f( "test_file.txt" ); + int i = 0; + f >> i; + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( i == 1 ); + double d = 0.0; + f >> d; + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( d == 2.0 ); + string str; + f >> str; + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( str == "abcd" ); + char c; + f.get(c); // extract newline, that not extracted by operator >> + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( c == '\n' ); + getline( f, str ); + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( str == "ghk lm" ); + getline( f, str ); + CPPUNIT_ASSERT( f.eof() ); + CPPUNIT_ASSERT( str == "abcd ef" ); + } +#if defined (STLPORT) && !defined (_STLP_USE_WIN32_IO) + { + ifstream in("/tmp"); + if (in.good()) { + string s; + getline(in, s); + CPPUNIT_ASSERT( in.fail() ); + } + } +#endif +} + +void FstreamTest::input_char() +{ + char buf[16] = { 0, '1', '2', '3' }; + ifstream s( "test_file.txt" ); + s >> buf; + + CPPUNIT_ASSERT( buf[0] == '1' ); + CPPUNIT_ASSERT( buf[1] == 0 ); + CPPUNIT_ASSERT( buf[2] == '2' ); +} + +void FstreamTest::io() +{ + basic_fstream > f( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc ); + + CPPUNIT_ASSERT( f.is_open() ); + + f << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef"; + + // f.flush(); + f.seekg( 0, ios_base::beg ); + + int i = 0; + f >> i; + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( i == 1 ); + double d = 0.0; + f >> d; + CPPUNIT_ASSERT( d == 2.0 ); + string s; + f >> s; + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( s == "abcd" ); + char c; + f.get(c); // extract newline, that not extracted by operator >> + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( c == '\n' ); + getline( f, s ); + CPPUNIT_ASSERT( f.good() ); + CPPUNIT_ASSERT( s == "ghk lm" ); + getline( f, s ); + CPPUNIT_ASSERT( !f.fail() ); + CPPUNIT_ASSERT( s == "abcd ef" ); + CPPUNIT_ASSERT( f.eof() ); +} + +void FstreamTest::err() +{ + basic_fstream > f( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc ); + + CPPUNIT_ASSERT( f.is_open() ); + + int i = 9; + f << i; + CPPUNIT_ASSERT( f.good() ); + i = 0; + f.seekg( 0, ios_base::beg ); + f >> i; + CPPUNIT_ASSERT( !f.fail() ); + CPPUNIT_ASSERT( i == 9 ); + f >> i; + CPPUNIT_ASSERT( f.fail() ); + CPPUNIT_ASSERT( f.eof() ); + CPPUNIT_ASSERT( i == 9 ); +} + +void FstreamTest::tellg() +{ + { + // bogus ios_base::binary is for Wins + ofstream of("test_file.txt", ios_base::out | ios_base::binary | ios_base::trunc); + CPPUNIT_ASSERT( of.is_open() ); + + for (int i = 0; i < 50; ++i) { + of << "line " << setiosflags(ios_base::right) << setfill('0') << setw(2) << i << "\n"; + CPPUNIT_ASSERT( !of.fail() ); + } + of.close(); + } + + { + // bogus ios_base::binary is for Wins + ifstream is("test_file.txt", ios_base::in | ios_base::binary); + CPPUNIT_ASSERT( is.is_open() ); + char buf[64]; + + // CPPUNIT_ASSERT( is.tellg() == 0 ); + streampos p = 0; + for (int i = 0; i < 50; ++i) { + is.read(buf, 0); + CPPUNIT_ASSERT( is.gcount() == 0 ); + CPPUNIT_ASSERT( is.tellg() == p ); + is.read( buf, 8 ); + CPPUNIT_ASSERT( !is.fail() ); + CPPUNIT_ASSERT( is.gcount() == 8 ); + p += 8; + } + } + + { + // bogus ios_base::binary is for Wins + ifstream is("test_file.txt", ios_base::in | ios_base::binary); + CPPUNIT_ASSERT( is.is_open() ); + + streampos p = 0; + for (int i = 0; i < 50; ++i) { + CPPUNIT_ASSERT( !is.fail() ); + is.tellg(); + CPPUNIT_ASSERT( is.tellg() == p ); + p += 8; + is.seekg( p, ios_base::beg ); + CPPUNIT_ASSERT( !is.fail() ); + } + } + + { + // bogus ios_base::binary is for Wins + ifstream is("test_file.txt", ios_base::in | ios_base::binary); + CPPUNIT_ASSERT( is.is_open() ); + + streampos p = 0; + for (int i = 0; i < 50; ++i) { + CPPUNIT_ASSERT( is.tellg() == p ); + p += 8; + is.seekg( 8, ios_base::cur ); + CPPUNIT_ASSERT( !is.fail() ); + } + } +} + +void FstreamTest::tellp() +{ + { + ofstream o( "test_file.txt" ); + + o << "123456"; + + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(6) ); + CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(6) ); + } + { + ofstream o( "test_file.txt" ); + + o << "123456789"; + + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(9) ); + CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(9) ); + } + /* According to the standard + ofstream o( "test_file.txt", ios_base::app | ios_base::out ) + should give the same effect as fopen( "test_file.txt", "a" ). + Problem is fopen( "test_file.txt", "a" ) has a bit different behaviour + on different platforms, and this difference is not covered by specification. + After fopen( "test_file.txt", "a" ) in this context ftell( f ) == 9 for + Linux and Mac OS X (I expect the same for others POSIX-like platforms too); + on Windows (independently from version?) ftell( f ) == 0, i.e. write pointer not + shifted to EOF (but shifted to EOF just before write, as described in the specs). + + It isn't specifications violation, neither for Linux and Mac OS X nor for Windows. + + The code below is intended to demonstrate ambiguity (dependance from fopen implementation). + */ + { + #ifdef WIN32 + //In Windows, stlport and fopen use kernel32.CreateFile for open. + //File position is at BOF after open, unless we open with ios_base::ate + long expected_pos = 0; + #else + //On UNIX flavours, stlport and fopen use unix's open + //File position is at EOF after open + // + //3rd possible scenario, "other platforms" - _STLP_USE_STDIO_IO + //stlport uses fopen here. This case may fail this test, since the file position after + //fopen is implementation-dependent + long expected_pos = 9; + #endif + ofstream o( "test_file.txt", ios_base::app | ios_base::out ); + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(expected_pos) ); + CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(expected_pos) ); + } + { // for reference, to test fopen/ftell behaviour in append mode: + #ifdef WIN32 + long expected_pos = 0; + #else + long expected_pos = 9; + #endif + FILE* f = fopen( "test_file.txt", "a" ); + CPPUNIT_CHECK( ftell( f ) == expected_pos ); + fclose( f ); + } + { + //In append mode, file is positioned at EOF just before a write. + // After a write, file is at EOF. This is implementation-independent. + ofstream o( "test_file.txt", ios_base::app | ios_base::out ); + o << "X"; + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(10) ); + CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(10) ); + } +} + +void FstreamTest::buf() +{ + fstream ss( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc ); + + ss << "1234567\n89\n"; + ss.seekg( 0, ios_base::beg ); + char buf[10]; + buf[7] = 'x'; + ss.get( buf, 10 ); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( buf[0] == '1' ); + CPPUNIT_ASSERT( buf[1] == '2' ); + CPPUNIT_ASSERT( buf[2] == '3' ); + CPPUNIT_ASSERT( buf[3] == '4' ); + CPPUNIT_ASSERT( buf[4] == '5' ); + CPPUNIT_ASSERT( buf[5] == '6' ); + CPPUNIT_ASSERT( buf[6] == '7' ); // 27.6.1.3 paragraph 10, paragraph 7 + CPPUNIT_ASSERT( buf[7] == 0 ); // 27.6.1.3 paragraph 8 + char c; + ss.get(c); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 10, paragraph 7 + ss.get(c); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( c == '8' ); +} + +void FstreamTest::seek() +{ + { + // Test in binary mode: + { + fstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc ); + CPPUNIT_ASSERT( s ); + + s << "1234567890\n"; + CPPUNIT_ASSERT( s ); + } + + char b1[] = { 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' }; + fstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary ); + CPPUNIT_ASSERT( s ); + + int chars_read = (int)s.rdbuf()->sgetn( b1, sizeof(b1) ); + CPPUNIT_CHECK( chars_read == 11 ); + CPPUNIT_CHECK( b1[9] == '0' ); + CPPUNIT_ASSERT( s.rdbuf()->pubseekoff( 0, ios_base::cur ) == fstream::pos_type(chars_read) ); + CPPUNIT_ASSERT( s.rdbuf()->pubseekoff( -chars_read, ios_base::cur ) == fstream::pos_type(0) ); + + char b2[10] = { 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y' }; + + CPPUNIT_ASSERT( s.rdbuf()->sgetn( b2, 10 ) == 10 ); + CPPUNIT_CHECK( b2[9] == '0' ); + } + + { + // Test in text mode: + { + fstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc ); + CPPUNIT_ASSERT( s ); + + s << "1234567890\n"; + CPPUNIT_ASSERT( s ); + } + + char b1[] = { 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' }; + fstream s( "test_file.txt", ios_base::in | ios_base::out ); + CPPUNIT_ASSERT( s ); + + int chars_read = (int)s.rdbuf()->sgetn( b1, sizeof(b1) ); + CPPUNIT_CHECK( chars_read == 11 ); + CPPUNIT_CHECK( b1[9] == '0' ); + + fstream::pos_type pos = s.rdbuf()->pubseekoff(0, ios_base::cur); + // Depending on how '\n' is written in file, file position can be greater or equal to the number of chars_read read. + streamoff offset = pos; + CPPUNIT_ASSERT( offset >= chars_read ); + offset = s.rdbuf()->pubseekoff( -offset, ios_base::cur ); + CPPUNIT_ASSERT( offset == 0 ); + + char b2[10] = { 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y' }; + + CPPUNIT_ASSERT( s.rdbuf()->sgetn( b2, 5 ) == 5 ); + CPPUNIT_CHECK( b2[4] == '5' ); + + pos = s.rdbuf()->pubseekoff(0, ios_base::cur); + CPPUNIT_ASSERT( pos == fstream::pos_type(5) ); + CPPUNIT_ASSERT( s.rdbuf()->pubseekoff(-5, ios_base::cur) == fstream::pos_type(0) ); + } + +#if !defined (STLPORT) || \ + (!defined (_STLP_NO_WCHAR_T) && defined (_STLP_USE_EXCEPTIONS)) + { + // Test with a wariable encoding: + locale loc; + try + { + locale tmp(locale::classic(), new codecvt_byname(".UTF8")); + loc = tmp; + } + catch (const runtime_error&) + { + // Localization no supported so no test: + return; + } + + { + wfstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc ); + CPPUNIT_ASSERT( s ); + s.imbue(loc); + CPPUNIT_ASSERT( s ); + + s << L"1234567890\n"; + CPPUNIT_ASSERT( s ); + } + + wchar_t b1[] = { L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x' }; + wfstream s( "test_file.txt", ios_base::in | ios_base::out ); + CPPUNIT_ASSERT( s ); + s.imbue(loc); + CPPUNIT_ASSERT( s ); + + int chars_read = (int)s.rdbuf()->sgetn( b1, sizeof(b1) / sizeof(wchar_t) ); + CPPUNIT_CHECK( chars_read == 11 ); + CPPUNIT_CHECK( b1[9] == L'0' ); + + fstream::pos_type pos = s.rdbuf()->pubseekoff(0, ios_base::cur); + // Depending on how '\n' is written in file, file position can be greater or equal to the number of chars_read read. + streamoff off = pos; + CPPUNIT_ASSERT( off >= chars_read ); + off = s.rdbuf()->pubseekoff(-off, ios_base::cur); + CPPUNIT_ASSERT( off == -1 ); + off = s.rdbuf()->pubseekoff(0, ios_base::beg); + CPPUNIT_ASSERT( off == 0 ); + + wchar_t b2[10] = { L'y', L'y', L'y', L'y', L'y', L'y', L'y', L'y', L'y', L'y' }; + + CPPUNIT_ASSERT( s.rdbuf()->sgetn( b2, 5 ) == 5 ); + CPPUNIT_CHECK( b2[4] == L'5' ); + + pos = s.rdbuf()->pubseekoff(0, ios_base::cur); + CPPUNIT_ASSERT( pos == fstream::pos_type(5) ); + //CPPUNIT_ASSERT( s.rdbuf()->pubseekoff(-5, ios_base::cur) == fstream::pos_type(0) ); + } +#endif +} + +void FstreamTest::rdbuf() +{ + fstream ss( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc ); + + ss << "1234567\n89\n"; + ss.seekg( 0, ios_base::beg ); + + ostringstream os; + ss.get( *os.rdbuf(), '\n' ); + CPPUNIT_ASSERT( !ss.fail() ); + char c; + ss.get(c); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 12 + CPPUNIT_ASSERT( os.str() == "1234567" ); +} + +void FstreamTest::streambuf_output() +{ + { + ofstream ofstr("test_file.txt", ios_base::binary); + if (!ofstr) + //No test if we cannot create the file + return; + ofstr << "01234567890123456789"; + CPPUNIT_ASSERT( ofstr ); + } + + { + ifstream in("test_file.txt", ios_base::binary); + CPPUNIT_ASSERT( in ); + + full_streambuf full_buf(10); + ostream out(&full_buf); + CPPUNIT_ASSERT( out ); + + out << in.rdbuf(); + CPPUNIT_ASSERT( out ); + CPPUNIT_ASSERT( in ); + CPPUNIT_ASSERT( full_buf.str() == "0123456789" ); + + out << in.rdbuf(); + CPPUNIT_ASSERT( out.fail() ); + CPPUNIT_ASSERT( in ); + + ostringstream ostr; + ostr << in.rdbuf(); + CPPUNIT_ASSERT( ostr ); + CPPUNIT_ASSERT( in ); + CPPUNIT_ASSERT( ostr.str() == "0123456789" ); + } + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + { + //If the output stream buffer throws: + ifstream in("test_file.txt", ios_base::binary); + CPPUNIT_ASSERT( in ); + + full_streambuf full_buf(10, true); + ostream out(&full_buf); + CPPUNIT_ASSERT( out ); + + out << in.rdbuf(); + CPPUNIT_ASSERT( out.bad() ); + CPPUNIT_ASSERT( in ); + //out is bad we have no guaranty on what has been extracted: + //CPPUNIT_ASSERT( full_buf.str() == "0123456789" ); + + out.clear(); + out << in.rdbuf(); + CPPUNIT_ASSERT( out.fail() && out.bad() ); + CPPUNIT_ASSERT( in ); + + ostringstream ostr; + ostr << in.rdbuf(); + CPPUNIT_ASSERT( ostr ); + CPPUNIT_ASSERT( in ); + CPPUNIT_ASSERT( ostr.str() == "0123456789" ); + } +# endif +} + +void FstreamTest::win32_file_format() +{ + const char* file_name = "win32_file_format.tmp"; + const size_t nb_lines = 2049; + { + ofstream out(file_name); + CPPUNIT_ASSERT( out.good() ); + out << 'a'; + for (size_t i = 0; i < nb_lines - 1; ++i) { + out << '\n'; + } + out << '\r'; + CPPUNIT_ASSERT( out.good() ); + } + { + ifstream in(file_name); + CPPUNIT_ASSERT( in.good() ); + string line, last_line; + size_t nb_read_lines = 0; + while (getline(in, line)) { + ++nb_read_lines; + last_line = line; + } + CPPUNIT_ASSERT( in.eof() ); + CPPUNIT_ASSERT( nb_read_lines == nb_lines ); + CPPUNIT_ASSERT( !last_line.empty() && (last_line[0] == '\r') ); + } +} + +#if defined (DO_CUSTOM_FACET_TEST) +struct my_state { + char dummy; +}; + +struct my_traits : public char_traits { + typedef my_state state_type; + typedef fpos pos_type; +}; + +#if !defined (STLPORT) +//STLport grant a default implementation, other Standard libs implementation +//do not necessarily do the same: +namespace std { + template <> + class codecvt + : public locale::facet, public codecvt_base { + public: + typedef char intern_type; + typedef char extern_type; + typedef my_state state_type; + + explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} + result out(state_type&, + const intern_type* __from, + const intern_type*, + const intern_type*& __from_next, + extern_type* __to, + extern_type*, + extern_type*& __to_next) const + { __from_next = __from; __to_next = __to; return noconv; } + + result in (state_type&, + const extern_type* __from, + const extern_type*, + const extern_type*& __from_next, + intern_type* __to, + intern_type*, + intern_type*& __to_next) const + { __from_next = __from; __to_next = __to; return noconv; } + + result unshift(state_type&, + extern_type* __to, + extern_type*, + extern_type*& __to_next) const + { __to_next = __to; return noconv; } + + int encoding() const throw() + { return 1; } + + bool always_noconv() const throw() + { return true; } + + int length(const state_type&, + const extern_type* __from, + const extern_type* __end, + size_t __max) const + { return (int)min(static_cast(__end - __from), __max); } + + int max_length() const throw() + { return 1; } + + static locale::id id; + }; + + locale::id codecvt::id; +} +# else +# if defined (__BORLANDC__) && (__BORLANDC__ < 0x590) +template <> +locale::id codecvt::id; +# endif +# endif +#endif + +void FstreamTest::custom_facet() +{ +#if defined (DO_CUSTOM_FACET_TEST) + const char* fileName = "test_file.txt"; + //File preparation: + { + ofstream ofstr(fileName, ios_base::binary); + ofstr << "0123456789"; + CPPUNIT_ASSERT( ofstr ); + } + + { + typedef basic_ifstream my_ifstream; + typedef basic_string my_string; + + my_ifstream ifstr(fileName); + CPPUNIT_ASSERT( ifstr ); + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + ifstr.imbue(locale::classic()); + CPPUNIT_ASSERT( ifstr.fail() && !ifstr.bad() ); + ifstr.clear(); +# endif + typedef codecvt my_codecvt; + locale my_loc(locale::classic(), new my_codecvt()); + // Check that my_codecvt has not replace default codecvt: + CPPUNIT_ASSERT( (has_facet(my_loc)) ); + CPPUNIT_ASSERT( (has_facet >(my_loc)) ); +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + CPPUNIT_ASSERT( (has_facet >(my_loc)) ); +# endif + ifstr.imbue(my_loc); + CPPUNIT_ASSERT( ifstr.good() ); + /* + my_string res; + ifstr >> res; + CPPUNIT_ASSERT( !ifstr.fail() ); + CPPUNIT_ASSERT( !ifstr.bad() ); + CPPUNIT_ASSERT( ifstr.eof() ); + CPPUNIT_ASSERT( res == "0123456789" ); + */ + } +#endif +} + +# if defined (CHECK_BIG_FILE) +void FstreamTest::big_file() +{ + vector > file_pos; + + //Big file creation: + { + ofstream out("big_file.txt"); + CPPUNIT_ASSERT( out ); + + //We are going to generate a file with the following schema for the content: + //0(1019 times)0000 //1023 characters + 1 charater for \n (for some platforms it will be a 1 ko line) + //0(1019 times)0001 + //... + //0(1019 times)1234 + //... + + //Generation of the number of loop: + streamoff nb = 1; + for (int i = 0; i < 20; ++i) { + //This assertion check that the streamoff can at least represent the necessary integers values + //for this test: + CPPUNIT_ASSERT( (nb << 1) > nb ); + nb <<= 1; + } + CPPUNIT_ASSERT( nb * CHECK_BIG_FILE >= nb ); + nb *= CHECK_BIG_FILE; + + //Preparation of the ouput stream state: + out << setiosflags(ios_base::right) << setfill('*'); + for (streamoff index = 0; index < nb; ++index) { + if (index % 1024 == 0) { + file_pos.push_back(make_pair(out.tellp(), index)); + CPPUNIT_ASSERT( file_pos.back().first != streamsize(-1) ); + if (file_pos.size() > 1) { + CPPUNIT_ASSERT( file_pos[file_pos.size() - 1].first > file_pos[file_pos.size() - 2].first ); + } + } + out << setw(1023) << index << '\n'; + } + } + + { + ifstream in("big_file.txt"); + CPPUNIT_ASSERT( in ); + + string line; + vector >::const_iterator pit(file_pos.begin()), + pitEnd(file_pos.end()); + for (; pit != pitEnd; ++pit) { + in.seekg((*pit).first); + CPPUNIT_ASSERT( in ); + in >> line; + size_t lastStarPos = line.rfind('*'); + CPPUNIT_ASSERT( atoi(line.substr(lastStarPos + 1).c_str()) == (*pit).second ); + } + } + + /* + The following test has been used to check that STLport do not generate + an infinite loop when the file size is larger than the streamsize and + streamoff representation (32 bits or 64 bits). + { + ifstream in("big_file.txt"); + CPPUNIT_ASSERT( in ); + char tmp[4096]; + streamsize nb_reads = 0; + while ((!in.eof()) && in.good()){ + in.read(tmp, 4096); + nb_reads += in.gcount(); + } + } + */ +} +# endif + +void FstreamTest::null_stream() +{ +# if (defined (STLPORT) && defined (_STLP_USE_WIN32_IO)) || \ + (!defined (STLPORT) && (defined (WIN32) || defined (_WIN32))) + const char* nullStreamName = "NUL"; +# else + const char* nullStreamName = "/dev/null"; +# endif + { + ofstream nullStream(nullStreamName); + CPPUNIT_CHECK( nullStream ); + } + + { + ofstream nullStream(nullStreamName, ios_base::ate); + CPPUNIT_CHECK( nullStream ); + } + + { + ofstream nullStream(nullStreamName, ios_base::trunc); + CPPUNIT_CHECK( nullStream ); + } + + { + ofstream nullStream(nullStreamName, ios_base::app); + CPPUNIT_CHECK( nullStream ); + } + + { + ifstream nullStream(nullStreamName); + CPPUNIT_CHECK( nullStream ); + } + + { + ifstream nullStream(nullStreamName, ios_base::ate); + CPPUNIT_CHECK( nullStream ); + } + + { + fstream nullStream(nullStreamName); + CPPUNIT_CHECK( nullStream ); + } + + { + fstream nullStream(nullStreamName, ios_base::in | ios_base::out | ios_base::ate); + CPPUNIT_CHECK( nullStream ); + } + + { + fstream nullStream(nullStreamName, ios_base::in | ios_base::out | ios_base::trunc); + CPPUNIT_CHECK( nullStream ); + } +} + +void FstreamTest::null_buf() +{ + /* ********************************************************************************** + + testcase for bug #1830513: + in _istream.c + + template < class _CharT, class _Traits, class _Is_Delim> + streamsize _STLP_CALL __read_unbuffered(basic_istream<_CharT, _Traits>* __that, + basic_streambuf<_CharT, _Traits>* __buf, + streamsize _Num, _CharT* __s, + _Is_Delim __is_delim, + bool __extract_delim, bool __append_null, + bool __is_getline) + + can't accept _Num == 0; this is legal case, and may happen from + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n, _CharT __delim) + + *********************************************************************************** */ + + fstream f( "test.txt", ios_base::in | ios_base::out | ios_base::trunc ); + // string line; + + for ( int i = 0; i < 0x200; ++i ) { + f.put( ' ' ); + } + + // const streambuf *b = f.rdbuf(); + + // string s; + char buf[1024]; + buf[0] = 'a'; + buf[1] = 'b'; + buf[2] = 'c'; + + // getline( f, s ); + // cerr << f.good() << endl; + f.seekg( 0, ios_base::beg ); + // f.seekg( 0, ios_base::end ); + // buf[0] = f.get(); + + // cerr << (void *)(b->_M_gptr()) << " " << (void *)(b->_M_egptr()) << endl; + // cerr << f.good() << endl; + // getline( f, s ); + f.getline( buf, 1 ); // <-- key line + CPPUNIT_CHECK( buf[0] == 0 ); + CPPUNIT_CHECK( f.fail() ); // due to delimiter not found while buffer was exhausted +} + +# if !defined (STLPORT) || !defined (_STLP_WIN32) +void FstreamTest::offset() +{ +# if (defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)) && !defined(_STLP_USE_DEFAULT_FILE_OFFSET) + CPPUNIT_CHECK( sizeof(streamoff) == 8 ); +# else + CPPUNIT_CHECK( sizeof(streamoff) == sizeof(off_t) ); +# endif +} +# endif + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/full_streambuf.h b/reactos/lib/3rdparty/stlport/test/unit/full_streambuf.h new file mode 100644 index 00000000000..34766acb305 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/full_streambuf.h @@ -0,0 +1,46 @@ +#ifndef _FULL_STREAM_H +#define _FULL_STREAM_H + +#include + +/* + * This full_streambuf purpose is to act like a full disk to check the right behavior + * of the STLport code in such a case. + */ + +class full_streambuf : public std::streambuf { +public: + typedef std::streambuf _Base; + + typedef _Base::int_type int_type; + typedef _Base::traits_type traits_type; + + full_streambuf(size_t nb_output, bool do_throw = false) + : _nb_output(nb_output), _do_throw(do_throw) + {} + + std::string const& str() const + { return _buf; } + +protected: + int_type overflow(int_type c) { + if (_nb_output == 0) { +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + if (_do_throw) { + throw "streambuf full"; + } +#endif + return traits_type::eof(); + } + --_nb_output; + _buf += traits_type::to_char_type(c); + return c; + } + +private: + size_t _nb_output; + bool _do_throw; + std::string _buf; +}; + +#endif //_FULL_STREAM_H diff --git a/reactos/lib/3rdparty/stlport/test/unit/func_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/func_test.cpp new file mode 100644 index 00000000000..91ad1ef40c4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/func_test.cpp @@ -0,0 +1,76 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class FuncTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(FuncTest); + CPPUNIT_TEST(func1); + CPPUNIT_TEST(func2); + CPPUNIT_TEST(func3); + CPPUNIT_TEST_SUITE_END(); + +protected: + void func1(); + void func2(); + void func3(); + static bool bigger(int i_); + static bool bigger_than(int x_, int y_); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(FuncTest); + +// +// tests implementation +// +bool FuncTest::bigger(int i_) +{ + return i_ > 3; +} +bool FuncTest::bigger_than(int x_, int y_) +{ + return x_ > y_; +} +void FuncTest::func1() +{ + vectorv; + v.push_back(4); + v.push_back(1); + v.push_back(5); + int n = count_if(v.begin(), v.end(), bigger); + CPPUNIT_ASSERT( n == 2 ) +} + +void FuncTest::func2() +{ + vector v; + v.push_back(4); + v.push_back(1); + v.push_back(5); + sort(v.begin(), v.end(), bigger_than); + + CPPUNIT_ASSERT( v[0] == 5 ); + CPPUNIT_ASSERT( v[1] == 4 ); + CPPUNIT_ASSERT( v[2] == 1 ); +} +void FuncTest::func3() +{ + vector v; + v.push_back(4); + v.push_back(1); + v.push_back(5); + sort(v.begin(), v.end(), greater()); + + CPPUNIT_ASSERT( v[0] == 5 ); + CPPUNIT_ASSERT( v[1] == 4 ); + CPPUNIT_ASSERT( v[2] == 1 ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/functional_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/functional_header_test.cpp new file mode 100644 index 00000000000..47bce7223e7 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/functional_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/generator_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/generator_test.cpp new file mode 100644 index 00000000000..70ac945ae54 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/generator_test.cpp @@ -0,0 +1,92 @@ +#include +#include +#include "fadapter.h" +#include "fib.h" + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class GeneratorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(GeneratorTest); + CPPUNIT_TEST(gener1); + CPPUNIT_TEST(gener2); + CPPUNIT_TEST(genern1); + CPPUNIT_TEST(genern2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void gener1(); + void gener2(); + void genern1(); + void genern2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(GeneratorTest); + +// +// tests implementation +// + +static int cxxrand() { return rand();} + +void GeneratorTest::gener1() +{ + int numbers[10]; +#if defined(__MVS__) + generate(numbers, numbers + 10, ptr_gen(cxxrand)); +#else + generate(numbers, numbers + 10, cxxrand); +#endif + // any suggestions? +} +void GeneratorTest::gener2() +{ + vector v1(10); + Fibonacci generator; + generate(v1.begin(), v1.end(), generator); + + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==3); + CPPUNIT_ASSERT(v1[4]==5); + CPPUNIT_ASSERT(v1[5]==8); + CPPUNIT_ASSERT(v1[6]==13); + CPPUNIT_ASSERT(v1[7]==21); + CPPUNIT_ASSERT(v1[8]==34); + CPPUNIT_ASSERT(v1[9]==55); +} +void GeneratorTest::genern1() +{ +#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG) + //*TY 07/18/98 - added conditional + // since ptr_gen() is not defined under this condition + // (see xfunction.h) + vector v1(10); + generate_n(v1.begin(), v1.size(), ptr_gen(cxxrand)); +#endif //_STLP_MEMBER_POINTER_PARAM_BUG //*TY 07/18/98 - added +} +void GeneratorTest::genern2() +{ + vector v1(10); + Fibonacci generator; + generate_n(v1.begin(), v1.size(), generator); + + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==3); + CPPUNIT_ASSERT(v1[4]==5); + CPPUNIT_ASSERT(v1[5]==8); + CPPUNIT_ASSERT(v1[6]==13); + CPPUNIT_ASSERT(v1[7]==21); + CPPUNIT_ASSERT(v1[8]==34); + CPPUNIT_ASSERT(v1[9]==55); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/greater_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/greater_test.cpp new file mode 100644 index 00000000000..a3b8585c061 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/greater_test.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class GreaterTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(GreaterTest); + CPPUNIT_TEST(greatert); + CPPUNIT_TEST(greatereq); + CPPUNIT_TEST_SUITE_END(); + +protected: + void greatert(); + void greatereq(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(GreaterTest); + +// +// tests implementation +// +void GreaterTest::greatert() +{ + int array[4] = { 3, 1, 4, 2 }; + sort(array, array + 4, greater() ); + + CPPUNIT_ASSERT(array[0]==4); + CPPUNIT_ASSERT(array[1]==3); + CPPUNIT_ASSERT(array[2]==2); + CPPUNIT_ASSERT(array[3]==1); +} +void GreaterTest::greatereq() +{ + int array [4] = { 3, 1, 4, 2 }; + sort(array, array + 4, greater_equal()); + CPPUNIT_ASSERT(array[0]==4); + CPPUNIT_ASSERT(array[1]==3); + CPPUNIT_ASSERT(array[2]==2); + CPPUNIT_ASSERT(array[3]==1); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/hash_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/hash_test.cpp new file mode 100644 index 00000000000..4ea913ec292 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/hash_test.cpp @@ -0,0 +1,434 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include +#include +#include + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +# include +# include +#endif + +#include + +#include "cppunit/cppunit_proxy.h" + +#if defined (__MVS__) +const char star = 92; +#else +const char star = 42; +#endif + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class HashTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(HashTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(hmap1); + CPPUNIT_TEST(hmmap1); + CPPUNIT_TEST(hmmap2); + CPPUNIT_TEST(hmset1); + CPPUNIT_TEST(hset2); + CPPUNIT_TEST(insert_erase); + CPPUNIT_TEST(allocator_with_state); + //CPPUNIT_TEST(equality); + CPPUNIT_TEST_SUITE_END(); + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + typedef hash_multiset, equal_to > hmset; +#endif + +protected: + void hmap1(); + void hmmap1(); + void hmmap2(); + void hmset1(); + void hset2(); + void insert_erase(); + //void equality(); + void allocator_with_state(); + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + typedef hash_multimap hashType; + typedef multimap mapType; + + void check_keys( hashType& h, mapType& m ); +#endif +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(HashTest); + +// +// tests implementation +// +void HashTest::hmap1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + typedef hash_map, equal_to > maptype; + maptype m; + // Store mappings between roman numerals and decimals. + m['l'] = "50"; + m['x'] = "20"; // Deliberate mistake. + m['v'] = "5"; + m['i'] = "1"; + CPPUNIT_ASSERT( !strcmp(m['x'].c_str(),"20") ); + m['x'] = "10"; // Correct mistake. + CPPUNIT_ASSERT( !strcmp(m['x'].c_str(),"10") ); + + CPPUNIT_ASSERT( !strcmp(m['z'].c_str(),"") ); + + CPPUNIT_ASSERT( m.count('z')==1 ); + pair p = m.insert(pair('c', crope("100"))); + + CPPUNIT_ASSERT(p.second); + + p = m.insert(pair('c', crope("100"))); + CPPUNIT_ASSERT(!p.second); + + //Some iterators compare check, really compile time checks + maptype::iterator ite(m.begin()); + maptype::const_iterator cite(m.begin()); + cite = m.begin(); + maptype const& cm = m; + cite = cm.begin(); + CPPUNIT_ASSERT( ite == cite ); + CPPUNIT_ASSERT( !(ite != cite) ); + CPPUNIT_ASSERT( cite == ite ); + CPPUNIT_ASSERT( !(cite != ite) ); +#endif +} + +void HashTest::hmmap1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + typedef hash_multimap,equal_to > mmap; + mmap m; + CPPUNIT_ASSERT(m.count('X')==0); + m.insert(pair('X', 10)); // Standard way. + CPPUNIT_ASSERT(m.count('X')==1); +// m.insert('X', 20); // Non-standard, but very convenient! + m.insert(pair('X', 20)); // jbuck: standard way + CPPUNIT_ASSERT(m.count('X')==2); +// m.insert('Y', 32); + m.insert(pair('Y', 32)); // jbuck: standard way + mmap::iterator i = m.find('X'); // Find first match. + + CPPUNIT_ASSERT((*i).first=='X'); + CPPUNIT_ASSERT((*i).second==10); + i++; + CPPUNIT_ASSERT((*i).first=='X'); + CPPUNIT_ASSERT((*i).second==20); + i++; + CPPUNIT_ASSERT((*i).first=='Y'); + CPPUNIT_ASSERT((*i).second==32); + i++; + CPPUNIT_ASSERT(i==m.end()); + + size_t count = m.erase('X'); + CPPUNIT_ASSERT(count==2); + + //Some iterators compare check, really compile time checks + mmap::iterator ite(m.begin()); + mmap::const_iterator cite(m.begin()); + CPPUNIT_ASSERT( ite == cite ); + CPPUNIT_ASSERT( !(ite != cite) ); + CPPUNIT_ASSERT( cite == ite ); + CPPUNIT_ASSERT( !(cite != ite) ); + + typedef hash_multimap HMapType; + HMapType hmap; + + //We fill the map to implicitely start a rehash. + for (size_t counter = 0; counter < 3077; ++counter) + hmap.insert(HMapType::value_type(1, counter)); + + hmap.insert(HMapType::value_type(12325, 1)); + hmap.insert(HMapType::value_type(12325, 2)); + + CPPUNIT_ASSERT( hmap.count(12325) == 2 ); + + //At this point 23 goes to the same bucket as 12325, it used to reveal a bug. + hmap.insert(HMapType::value_type(23, 0)); + + CPPUNIT_ASSERT( hmap.count(12325) == 2 ); +#endif +} + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +// Short demonstrator that helps reproducing a bug in the hash-table implementation +// of STLPort 5.0.1/5.0.2. +// +// Problem: Fill a hash_multimap with entries of which many have the same key +// Internally, entries with the same key are kept as one block within the same bucket. +// Thus, when calling equal_range(key) the begin/end of that block is returned. +// However, this code shows that for key =3, that block is destroyed after inserting the 194th element. +// According to _hashtable.c we will have a rehash from size 193 to size 389 in that situation. +// After that rehash, equal_range only returns 2 elements with key = 3 whereas there are 65 in it. +// Reproduction: +// In the main()-method we fill a hash_multimap as well as a multi_map with the same pairs +// After each insertion we call check_keys(...) to assure validity of these two containers. +// This works fine up to the 193th insertion. Insertion 194 generates the bug. +// +// check_keys() works as follows: +// (a) we check whether both containers contain the same number of elements. +// (b) Assuming that the multi_map works correctly, we iterate over all its elements and check +// whether we can find that key also in the hash_multimap. We collect all data for that specific +// key in in a set ("collection"). Notice that data is unique by construction in main(), thus the +// number of elements in the set must equal the number of entries in the hash_multimap and in the multimap +// (c) We check if we have seen as many data elements in collection as we have seen in the multimap. +// if so, we print "OK", otherwise we print a detailed key/data overview and assert. +// Caution: +// There are several configurations of the program that will NOT fail. (see comment in code below) +// E.g. it seems that whenever the keys are more or less sorted, the problem does not occur. +// Also, using numbers from 200 downto 1 or from 300 downto 1 cannot generate the problem, +// whereas using 400 downto 1 will fail. +// Finally, if we use key 1 (rather than key 3) we cannot generate a problem. + +void HashTest::check_keys( HashTest::hashType& h, HashTest::mapType& m ) +{ + set collection; + + // (a) check sizes + CPPUNIT_CHECK( h.size() == m.size() ); + + // (b) iterate over multi_map + for ( mapType::iterator i = m.begin(); i != m.end(); ++i ) { + // look up that key in hash-table and keep all data in the set + pair range = h.equal_range( i->first ); + for ( hashType::iterator j = range.first; j != range.second; ++j ) { + collection.insert( j->second ); + } + } + // (c) we should have seen as many elements as there are in the hash-table +#if 0 + if (collection.size() == h.size()) cout << " OK" << endl; + else { + // if not, please report + cout << " FAILED: " << endl; + int lastKey = -1; + // iterate over all elements in multi_map + for (mapType::iterator mIter = m.begin(); mIter != m.end(); mIter++) { + // new key? print a new status line + if (mIter->first != lastKey) { + cout << endl << "Key : " << mIter->first << endl; + lastKey = mIter->first; + + // print all hashed values for that key + cout << " data in hash: "; + pair range = h.equal_range(mIter->first); + + for (hashType::iterator h = range.first; h != range.second; h++) { + assert (h->first == lastKey); + cerr << h->second << ", "; // print all data for that key in Hash-Table + } + cout << endl << " data in map: "; + } + // and print all member in multi-map until the next key occurs + cout << mIter->second << ", " ; // print all data for that key in Map + } + } +#endif + CPPUNIT_CHECK( collection.size() == h.size() ); +} + +#endif + +void HashTest::hmmap2() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + hashType h; + mapType m; + + // CAUTION the following configurations WORKS in our setting + // for (int id = 1; id != 400; id ++) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 200; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 300; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 400; id != 1; id --) and int key = (id %3 == 0 ? 1 : id) + // for (int id = 4000; id != 1; id --) and int key = (id %3 == 0 ? 1 : id) + // + // whereas these will FAIL + // for (int id = 400; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 4000; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // + + for ( int id = 400; id != 1; id-- ) { + // generate many entries with key 3, fill up with unique keys. Data is unique (needed in check_keys()) + int key = (id % 3 == 0 ? 3 : id); + + // keep hash_multi_map and multimap in sync + h.insert(make_pair(key, id)); + m.insert(make_pair(key, id)); + + // check whether both contain the same elements + check_keys( h, m ); + } +#endif +} + +void HashTest::hmset1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + hmset s; + CPPUNIT_ASSERT( s.count(star) == 0 ); + s.insert(star); + CPPUNIT_ASSERT( s.count(star) == 1 ); + s.insert(star); + CPPUNIT_ASSERT( s.count(star) == 2 ); + hmset::iterator i = s.find(char(40)); + CPPUNIT_ASSERT( i == s.end() ); + + i = s.find(star); + CPPUNIT_ASSERT( i != s.end() ) + CPPUNIT_ASSERT( *i == '*' ); + CPPUNIT_ASSERT( s.erase(star) == 2 ); +#endif +} +void HashTest::hset2() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + hash_set, equal_to > s; + pair, equal_to >::iterator, bool> p = s.insert(42); + CPPUNIT_ASSERT( p.second ); + CPPUNIT_ASSERT( *(p.first) == 42 ); + + p = s.insert(42); + CPPUNIT_ASSERT( !p.second ); +#endif +} + +void HashTest::insert_erase() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + typedef hash_map, equal_to > hmap; + typedef hmap::value_type val_type; + { + hmap values; +# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564) + CPPUNIT_ASSERT( values.insert(val_type("foo", 0)).second ); + CPPUNIT_ASSERT( values.insert(val_type("bar", 0)).second ); + CPPUNIT_ASSERT( values.insert(val_type("abc", 0)).second ); +# else + CPPUNIT_ASSERT( values.insert(hmap::value_type("foo", 0)).second ); + CPPUNIT_ASSERT( values.insert(hmap::value_type("bar", 0)).second ); + CPPUNIT_ASSERT( values.insert(hmap::value_type("abc", 0)).second ); +# endif + + CPPUNIT_ASSERT( values.erase("foo") == 1 ); + CPPUNIT_ASSERT( values.erase("bar") == 1 ); + CPPUNIT_ASSERT( values.erase("abc") == 1 ); + } + + { + hmap values; +# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564) + CPPUNIT_ASSERT( values.insert(val_type("foo", 0)).second ); + CPPUNIT_ASSERT( values.insert(val_type("bar", 0)).second ); + CPPUNIT_ASSERT( values.insert(val_type("abc", 0)).second ); +# else + CPPUNIT_ASSERT( values.insert(hmap::value_type("foo", 0)).second ); + CPPUNIT_ASSERT( values.insert(hmap::value_type("bar", 0)).second ); + CPPUNIT_ASSERT( values.insert(hmap::value_type("abc", 0)).second ); +# endif + + CPPUNIT_ASSERT( values.erase("abc") == 1 ); + CPPUNIT_ASSERT( values.erase("bar") == 1 ); + CPPUNIT_ASSERT( values.erase("foo") == 1 ); + } +#endif +} + +/* + * Here is the test showing why equality operator on hash containers + * has no meaning: + +struct equality_hash_func { + size_t operator () (size_t val) const { + return val % 10; + } +}; + +void HashTest::equality() +{ + hash_set > s1, s2; + + s1.insert(10); + s1.insert(20); + + s2.insert(20); + s2.insert(10); + + //s1 and s2 contains both 10 and 20: + CPPUNIT_ASSERT( s1 == s2 ); +} +*/ + +void HashTest::allocator_with_state() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + char buf1[2048]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[2048]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + { + typedef hash_set, equal_to, StackAllocator > HashSetInt; + HashSetInt hint1(10, hash(), equal_to(), stack1); + + int i; + for (i = 0; i < 5; ++i) + hint1.insert(i); + HashSetInt hint1Cpy(hint1); + + HashSetInt hint2(10, hash(), equal_to(), stack2); + for (; i < 10; ++i) + hint2.insert(i); + HashSetInt hint2Cpy(hint2); + + hint1.swap(hint2); + + CPPUNIT_ASSERT( hint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( hint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( hint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( hint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); +#endif +} + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \ + (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)) +# if !defined (__DMC__) + +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + hash_set hsinstances; + typedef hash_set::iterator hsit; + hash_multiset hsminstances; + typedef hash_multiset::iterator hsmit; + + hash_map hminstances; + typedef hash_map::iterator hmit; + hash_multimap hmminstances; + typedef hash_multimap::iterator hmmit; +}; +# endif +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/heap_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/heap_test.cpp new file mode 100644 index 00000000000..87eb75dca52 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/heap_test.cpp @@ -0,0 +1,108 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class HeapTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(HeapTest); + CPPUNIT_TEST(mkheap0); + CPPUNIT_TEST(mkheap1); + CPPUNIT_TEST(pheap1); + CPPUNIT_TEST(pheap2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void mkheap0(); + void mkheap1(); + void pheap1(); + void pheap2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(HeapTest); + +// +// tests implementation +// +void HeapTest::mkheap0() +{ + int numbers[6] = { 5, 10, 4, 13, 11, 19 }; + + make_heap(numbers, numbers + 6); + CPPUNIT_ASSERT(numbers[0]==19) + pop_heap(numbers, numbers + 6); + CPPUNIT_ASSERT(numbers[0]==13) + pop_heap(numbers, numbers + 5); + CPPUNIT_ASSERT(numbers[0]==11) + pop_heap(numbers, numbers + 4); + CPPUNIT_ASSERT(numbers[0]==10) + pop_heap(numbers, numbers + 3); + CPPUNIT_ASSERT(numbers[0]==5) + pop_heap(numbers, numbers + 2); + CPPUNIT_ASSERT(numbers[0]==4) + pop_heap(numbers, numbers + 1); +} +void HeapTest::mkheap1() +{ + int numbers[6] = { 5, 10, 4, 13, 11, 19 }; + + make_heap(numbers, numbers + 6, greater()); + + CPPUNIT_ASSERT(numbers[0]==4) + pop_heap(numbers, numbers + 6, greater()); + CPPUNIT_ASSERT(numbers[0]==5) + pop_heap(numbers, numbers + 5, greater()); + CPPUNIT_ASSERT(numbers[0]==10) + pop_heap(numbers, numbers + 4, greater()); + CPPUNIT_ASSERT(numbers[0]==11) + pop_heap(numbers, numbers + 3, greater()); + CPPUNIT_ASSERT(numbers[0]==13) + pop_heap(numbers, numbers + 2, greater()); + CPPUNIT_ASSERT(numbers[0]==19) +} +void HeapTest::pheap1() +{ + vector v; + + v.push_back(1); + v.push_back(20); + v.push_back(4); + make_heap(v.begin(), v.end()); + + v.push_back(7); + push_heap(v.begin(), v.end()); + + sort_heap(v.begin(), v.end()); + + CPPUNIT_ASSERT(v[0]==1); + CPPUNIT_ASSERT(v[1]==4); + CPPUNIT_ASSERT(v[2]==7); + CPPUNIT_ASSERT(v[3]==20); +} +void HeapTest::pheap2() +{ + vector v; + + v.push_back(1); + v.push_back(20); + v.push_back(4); + make_heap(v.begin(), v.end(), greater()); + + v.push_back(7); + push_heap(v.begin(), v.end(), greater()); + + sort_heap(v.begin(), v.end(), greater()); + + CPPUNIT_ASSERT(v[0]==20); + CPPUNIT_ASSERT(v[1]==7); + CPPUNIT_ASSERT(v[2]==4); + CPPUNIT_ASSERT(v[3]==1); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/includes_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/includes_test.cpp new file mode 100644 index 00000000000..d6417978351 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/includes_test.cpp @@ -0,0 +1,87 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class IncludesTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(IncludesTest); + CPPUNIT_TEST(incl0); + CPPUNIT_TEST(incl1); + CPPUNIT_TEST(incl2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void incl0(); + void incl1(); + void incl2(); + + static bool compare_strings(const char* s1_, const char* s2_) + { + return strcmp(s1_, s2_) < 0 ? 1 : 0; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(IncludesTest); + +// +// tests implementation +// +void IncludesTest::incl0() +{ + int numbers1[5] = { 1, 2, 3, 4, 5 }; + //int numbers2[5] = { 1, 2, 4, 8, 16 }; + int numbers3[2] = { 4, 8 }; + bool r1=includes(numbers1, numbers1 + 5, numbers3, numbers3 + 2); + CPPUNIT_ASSERT(!r1); +} +void IncludesTest::incl1() +{ + vector v1(10); + vector v2(3); + int i; + for (i = 0; (size_t)i < v1.size(); ++i) { + v1[i] = i; + } + + bool r1=includes(v1.begin(), v1.end(), v2.begin(), v2.end()); + CPPUNIT_ASSERT(!r1); + + for (i = 0; (size_t)i < v2.size(); ++i) + v2[i] = i + 3; + + bool r2=includes(v1.begin(), v1.end(), v2.begin(), v2.end()); + CPPUNIT_ASSERT(r2); +} +void IncludesTest::incl2() +{ + char const* names[] = { "Todd", "Mike", "Graham", "Jack", "Brett"}; + + const unsigned nameSize = sizeof(names)/sizeof(names[0]); + vector v1(nameSize); + for (int i = 0; (size_t)i < v1.size(); ++i) { + v1[i] = names[i]; + } + vector v2(2); + + v2[0] = "foo"; + v2[1] = "bar"; + sort(v1.begin(), v1.end(), compare_strings); + sort(v2.begin(), v2.end(), compare_strings); + + bool r1 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings); + CPPUNIT_ASSERT(!r1); + + v2[0] = "Brett"; + v2[1] = "Todd"; + bool r2 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings); + CPPUNIT_ASSERT(r2); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/innerprod_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/innerprod_test.cpp new file mode 100644 index 00000000000..3d77f5ddee5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/innerprod_test.cpp @@ -0,0 +1,72 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class InnerprodTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(InnerprodTest); + CPPUNIT_TEST(inprod0); + CPPUNIT_TEST(inprod1); + CPPUNIT_TEST(inprod2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void inprod0(); + void inprod1(); + void inprod2(); + + static size_t add(size_t a_, size_t b_) { + return a_ + b_; + } + + static size_t mult(size_t a_, size_t b_) { + return a_ * b_; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(InnerprodTest); + +// +// tests implementation +// +void InnerprodTest::inprod0() +{ + int vector1[5] = { 1, 2, 3, 4, 5 }; + int vector2[5] = { 1, 2, 3, 4, 5 }; + + int result; + result = inner_product(vector1, vector1 + 5, vector2, 0); + CPPUNIT_ASSERT(result==55); +} +void InnerprodTest::inprod1() +{ + vector v1(3); + vector v2(v1.size()); + for (size_t i = 0; i < v1.size(); ++i) { + v1[i] = i + 1; + v2[i] = v1.size() - i; + } + size_t result = inner_product(v1.begin(), v1.end(), v2.begin(), (size_t)0); + CPPUNIT_ASSERT(result == 10); +} +void InnerprodTest::inprod2() +{ + vector v1(3); + vector v2(v1.size()); + for(size_t i = 0; i < v1.size(); ++i) { + v1[i] = i + 1; + v2[i] = v1.size() - i; + } + size_t result=inner_product(v1.begin(), v1.end(), v2.begin(), (size_t)1, mult, add); + + CPPUNIT_ASSERT(result == 64); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/inplace_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/inplace_test.cpp new file mode 100644 index 00000000000..2c9bd99c399 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/inplace_test.cpp @@ -0,0 +1,61 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class InplaceTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(InplaceTest); + CPPUNIT_TEST(inplmrg1); + CPPUNIT_TEST(inplmrg2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void inplmrg1(); + void inplmrg2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(InplaceTest); + +// +// tests implementation +// +void InplaceTest::inplmrg1() +{ + int numbers[6] = { 1, 10, 42, 3, 16, 32 }; + inplace_merge(numbers, numbers + 3, numbers + 6); + + CPPUNIT_ASSERT(numbers[0]==1); + CPPUNIT_ASSERT(numbers[1]==3); + CPPUNIT_ASSERT(numbers[2]==10); + CPPUNIT_ASSERT(numbers[3]==16); + CPPUNIT_ASSERT(numbers[4]==32); + CPPUNIT_ASSERT(numbers[5]==42); +} +void InplaceTest::inplmrg2() +{ + vector v1(10); + for(size_t i = 0; i < v1.size(); ++i) + v1[i] =(v1.size() - i - 1) % 5; + + inplace_merge(v1.begin(), v1.begin() + 5, v1.end(), greater()); + + CPPUNIT_ASSERT(v1[0]==4); + CPPUNIT_ASSERT(v1[1]==4); + CPPUNIT_ASSERT(v1[2]==3); + CPPUNIT_ASSERT(v1[3]==3); + CPPUNIT_ASSERT(v1[4]==2); + CPPUNIT_ASSERT(v1[5]==2); + CPPUNIT_ASSERT(v1[6]==1); + CPPUNIT_ASSERT(v1[7]==1); + CPPUNIT_ASSERT(v1[8]==0); + CPPUNIT_ASSERT(v1[9]==0); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/insert_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/insert_test.cpp new file mode 100644 index 00000000000..e0ec1a24f5c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/insert_test.cpp @@ -0,0 +1,70 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class InsertTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(InsertTest); + CPPUNIT_TEST(insert1); + CPPUNIT_TEST(insert2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void insert1(); + void insert2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(InsertTest); + +// +// tests implementation +// +void InsertTest::insert1() +{ + char const* array1 [] = { "laurie", "jennifer", "leisa" }; + char const* array2 [] = { "amanda", "saskia", "carrie" }; + + deque names(array1, array1 + 3); + deque::iterator i = names.begin() + 2; + + insert_iterator > itd(names, i); + itd = copy(array2, array2 + 3, insert_iterator >(names, i)); + + CPPUNIT_ASSERT( !strcmp(names[0], "laurie") ); + CPPUNIT_ASSERT( !strcmp(names[1], "jennifer") ); + CPPUNIT_ASSERT( !strcmp(names[2], "amanda") ); + CPPUNIT_ASSERT( !strcmp(names[3], "saskia") ); + CPPUNIT_ASSERT( !strcmp(names[4], "carrie") ); + CPPUNIT_ASSERT( !strcmp(names[5], "leisa") ); + + copy(array1, array1 + 3, itd); + CPPUNIT_ASSERT( !strcmp(names[5], "laurie") ); + CPPUNIT_ASSERT( !strcmp(names[6], "jennifer") ); + CPPUNIT_ASSERT( !strcmp(names[7], "leisa") ); + CPPUNIT_ASSERT( !strcmp(names[8], "leisa") ); +} +void InsertTest::insert2() +{ + char const* array1 [] = { "laurie", "jennifer", "leisa" }; + char const* array2 [] = { "amanda", "saskia", "carrie" }; + + deque names(array1, array1 + 3); + deque::iterator i = names.begin() + 2; + copy(array2, array2 + 3, inserter(names, i)); + + CPPUNIT_ASSERT( !strcmp(names[0], "laurie") ); + CPPUNIT_ASSERT( !strcmp(names[1], "jennifer") ); + CPPUNIT_ASSERT( !strcmp(names[2], "amanda") ); + CPPUNIT_ASSERT( !strcmp(names[3], "saskia") ); + CPPUNIT_ASSERT( !strcmp(names[4], "carrie") ); + CPPUNIT_ASSERT( !strcmp(names[5], "leisa") ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/ioiter_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ioiter_test.cpp new file mode 100644 index 00000000000..6f0aeb9a949 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ioiter_test.cpp @@ -0,0 +1,110 @@ +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +class IoiterTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(IoiterTest); + CPPUNIT_TEST(ioiter_test); + CPPUNIT_TEST(assign_test); + CPPUNIT_TEST(assign2_test); + CPPUNIT_TEST_SUITE_END(); + +protected: + void ioiter_test(); + void assign_test(); + void assign2_test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(IoiterTest); + +void IoiterTest::ioiter_test() +{ + + char c; + const char *pc; + const char *strorg = "abcd"; + string tmp; + + string objStr(strorg); + + istringstream objIStrStrm1(objStr); + istringstream objIStrStrm2(objStr); + istringstream objIStrStrm3(objStr); + + pc = strorg; + string::size_type sz = strlen(strorg); + string::size_type i; + for ( i = 0; i < sz; ++i ) { + c = *pc++; + tmp += c; + } + CPPUNIT_ASSERT( tmp == "abcd" ); + + istreambuf_iterator > objIStrmbIt1( objIStrStrm1.rdbuf() ); + istreambuf_iterator > end; + + tmp.clear(); + + for ( i = 0; i < sz /* objIStrmbIt1 != end */; ++i ) { + c = *objIStrmbIt1++; + tmp += c; + } + CPPUNIT_ASSERT( tmp == "abcd" ); + + tmp.clear(); + + istreambuf_iterator > objIStrmbIt2( objIStrStrm2.rdbuf() ); + for ( i = 0; i < sz; ++i ) { + c = *objIStrmbIt2; + tmp += c; + objIStrmbIt2++; + } + CPPUNIT_ASSERT( tmp == "abcd" ); + + tmp.clear(); + + istreambuf_iterator > objIStrmbIt3( objIStrStrm3.rdbuf() ); + + while ( objIStrmbIt3 != end ) { + c = *objIStrmbIt3++; + tmp += c; + } + CPPUNIT_ASSERT( tmp == "abcd" ); +} + +void IoiterTest::assign_test() +{ + stringstream s( "1234567890" ); + vector v; + + v.assign( istreambuf_iterator(s), istreambuf_iterator() ); + CPPUNIT_CHECK( v.size() == 10 ); + if ( v.size() == 10 ) { + CPPUNIT_CHECK( v[0] == '1' ); + CPPUNIT_CHECK( v[9] == '0' ); + } +} + +void IoiterTest::assign2_test() +{ + stringstream s( "1234567890" ); + vector v; + + v.assign( istreambuf_iterator(s.rdbuf()), istreambuf_iterator() ); + CPPUNIT_CHECK( v.size() == 10 ); + if ( v.size() == 10 ) { + CPPUNIT_CHECK( v[0] == '1' ); + CPPUNIT_CHECK( v[9] == '0' ); + } +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iomanip_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iomanip_header_test.cpp new file mode 100644 index 00000000000..fa0ab0f1f99 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iomanip_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/ios_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ios_header_test.cpp new file mode 100644 index 00000000000..c2396431d74 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ios_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iosfwd_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iosfwd_header_test.cpp new file mode 100644 index 00000000000..8c3adccbe56 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iosfwd_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#ifndef _STLP_NO_IOSTREAMS +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iostream_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iostream_header_test.cpp new file mode 100644 index 00000000000..51e6df6355e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iostream_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iostream_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iostream_test.cpp new file mode 100644 index 00000000000..a4db5d822de --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iostream_test.cpp @@ -0,0 +1,116 @@ +#include + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +//# include +# include +//# include + +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// TestCase class +// +class IOStreamTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(IOStreamTest); + CPPUNIT_TEST(manipulators); + CPPUNIT_TEST(in_avail); +//#if defined (STLPORT) && defined (_STLP_NO_WCHAR_T) + //CPPUNIT_IGNORE; +//#endif + //CPPUNIT_TEST(wimbue); + CPPUNIT_TEST_SUITE_END(); + +private: + void manipulators(); + void in_avail(); + //void wimbue(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(IOStreamTest); + +// +// tests implementation +// +void IOStreamTest::manipulators() +{ + { + istringstream istr; + istr.str("bar"); + + istr >> ws; + CPPUNIT_ASSERT( istr.good() ); + + string foo; + istr >> foo; + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( foo == "bar" ); + + istr >> ws; + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( !istr.fail() ); + istr.clear(); + } + + { + istringstream istr; + istr.str(" bar "); + + istr >> ws; + CPPUNIT_ASSERT( istr.good() ); + + string foo; + istr >> foo; + CPPUNIT_ASSERT( !istr.eof() ); + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( foo == "bar" ); + + istr >> ws; + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( !istr.fail() ); + istr.clear(); + } +} + + +void IOStreamTest::in_avail() +{ + CPPUNIT_CHECK( cin.rdbuf()->in_avail() == 0 ); + CPPUNIT_CHECK( cout.rdbuf()->in_avail() == -1 ); + CPPUNIT_CHECK( clog.rdbuf()->in_avail() == -1 ); + CPPUNIT_CHECK( cerr.rdbuf()->in_avail() == -1 ); + +#if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + CPPUNIT_CHECK( wcin.rdbuf()->in_avail() == 0 ); + CPPUNIT_CHECK( wcout.rdbuf()->in_avail() == 0 ); + CPPUNIT_CHECK( wclog.rdbuf()->in_avail() == 0 ); + CPPUNIT_CHECK( wcerr.rdbuf()->in_avail() == 0 ); +#endif +} + +//void IOStreamTest::wimbue() +//{ +//#if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +// locale loc; +// try { +// locale tmp(".866"); +// loc = tmp; +// } +// catch (const runtime_error&) { +// return; +// } +// +// wcout.imbue(loc); +// wcout << L"Hello world" << endl; +// wcout.imbue(loc); +// wcout << L"Hello world" << endl; +//#endif +//} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iota.h b/reactos/lib/3rdparty/stlport/test/unit/iota.h new file mode 100644 index 00000000000..1cffefbee48 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iota.h @@ -0,0 +1,18 @@ +#ifndef IOTA_H +#define IOTA_H + +#include + +//iota definition used in unit test +template +void __iota(_It __first, _It __last, _Tp __val) { +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + iota(__first, __last, __val); +#else + while (__first != __last) { + *__first++ = __val++; + } +#endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iota_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iota_test.cpp new file mode 100644 index 00000000000..24339b2222c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iota_test.cpp @@ -0,0 +1,47 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class IotaTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(IotaTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(iota1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void iota1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(IotaTest); + +// +// tests implementation +// +void IotaTest::iota1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int numbers[10]; + iota(numbers, numbers + 10, 42); + CPPUNIT_ASSERT(numbers[0]==42); + CPPUNIT_ASSERT(numbers[1]==43); + CPPUNIT_ASSERT(numbers[2]==44); + CPPUNIT_ASSERT(numbers[3]==45); + CPPUNIT_ASSERT(numbers[4]==46); + CPPUNIT_ASSERT(numbers[5]==47); + CPPUNIT_ASSERT(numbers[6]==48); + CPPUNIT_ASSERT(numbers[7]==49); + CPPUNIT_ASSERT(numbers[8]==50); + CPPUNIT_ASSERT(numbers[9]==51); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/iso646_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/iso646_header_test.c new file mode 100644 index 00000000000..41d7432da06 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iso646_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/istmit_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/istmit_test.cpp new file mode 100644 index 00000000000..c1e2d17440a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/istmit_test.cpp @@ -0,0 +1,159 @@ +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include +# include +# include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class IStreamIteratorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(IStreamIteratorTest); +#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(istmit1); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(copy_n_test); + CPPUNIT_TEST_SUITE_END(); + +protected: + void istmit1(); + void copy_n_test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(IStreamIteratorTest); + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# if !defined (STLPORT) || !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +typedef istream_iterator istream_char_ite; +typedef istream_iterator istream_int_ite; +typedef istream_iterator istream_string_ite; +# else +typedef istream_iterator istream_char_ite; +typedef istream_iterator istream_int_ite; +typedef istream_iterator istream_string_ite; +# endif +#endif + +// +// tests implementation +// +void IStreamIteratorTest::istmit1() +{ +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) + const char* buff = "MyString"; + istringstream istr(buff); + + char buffer[100]; + size_t i = 0; + istr.unsetf(ios::skipws); // Disable white-space skipping. + istream_char_ite s(istr), meos; + while (!(s == meos) && + //*TY 01/10/1999 - added end of stream check + // NOTE operator!= should not be used here ifndef _STLP_FUNCTION_TMPL_PARTIAL_ORDER + (*s != '\n') && + (i < sizeof(buffer) / sizeof(buffer[0]))) { //*TY 07/28/98 - added index check + buffer[i++] = *s++; + } + buffer[i] = '\0'; // Null terminate buffer. + + CPPUNIT_ASSERT(!strcmp(buffer, buff)); + + { + istringstream empty_istr; + CPPUNIT_ASSERT( istream_char_ite(empty_istr) == istream_char_ite() ); + } +#endif +} + +void IStreamIteratorTest::copy_n_test() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && !defined (_STLP_USE_NO_IOSTREAMS) + //This test check that no character is lost while reading the istream + //through a istream_iterator. + { + istringstream istr("aabbcd"); + string chars; + istream_char_ite ite = copy_n(copy_n(istream_char_ite(istr), + 2, back_inserter(chars)).first, + 2, back_inserter(chars)).first; + CPPUNIT_ASSERT( chars == "aabb" ); + copy_n(ite, 2, back_inserter(chars)); + CPPUNIT_ASSERT( chars == "aabbcd" ); + } + + { + istringstream istr("11 22 AA BB 33 44 CC DD"); + vector ints; + vector strings; + + copy_n(istream_int_ite(istr), 2, back_inserter(ints)); + CPPUNIT_ASSERT( ints.size() == 2 ); + CPPUNIT_ASSERT( ints[0] == 11 ); + CPPUNIT_ASSERT( ints[1] == 22 ); + ints.clear(); + istr.clear(); + copy_n(istream_string_ite(istr), 2, back_inserter(strings)); + CPPUNIT_ASSERT( strings.size() == 2 ); + CPPUNIT_ASSERT( strings[0] == "AA" ); + CPPUNIT_ASSERT( strings[1] == "BB" ); + strings.clear(); + istr.clear(); + /* The following code cannot work, '33' is extracted as a string + * in the previous copy_n call, this value is returned in the pair + * returned by copy_n but is lost as this istream_iterator is not used. + * copy_n and istream_iterator can only be combined safely if: + * - you always extract the same type of istream_iterator and you always reuse + * the istream_iterator returned by copy_n (see previous test with "aabbcd") + * - you extract different type of object and no object is convertible to an other + * as in this current test when you extract int and string (when you extract ints + * again it fails as int can be converted to strings. + * + copy_n(istream_int_ite(istr), 2, back_inserter(ints)); + CPPUNIT_ASSERT( ints.size() == 2 ); + CPPUNIT_ASSERT( ints[0] == 33 ); + CPPUNIT_ASSERT( ints[1] == 44 ); + istr.clear(); + copy_n(istream_string_ite(istr), 2, back_inserter(strings)); + CPPUNIT_ASSERT( strings.size() == 2 ); + CPPUNIT_ASSERT( strings[0] == "CC" ); + CPPUNIT_ASSERT( strings[1] == "DD" ); + */ + } + + { + istringstream is("1 2 3 4 5 6 7 8 9 10"); + vector ints; + istream_iterator itr(is); + itr = copy_n(itr, 0, back_inserter(ints)).first; + CPPUNIT_ASSERT( ints.empty() ); + itr = copy_n(itr, -1, back_inserter(ints)).first; + CPPUNIT_ASSERT( ints.empty() ); + itr = copy_n(itr, 2, back_inserter(ints)).first; + CPPUNIT_ASSERT( ints.size() == 2 ); + CPPUNIT_ASSERT( ints[0] == 1 ); + CPPUNIT_ASSERT( ints[1] == 2 ); + itr = copy_n(itr, 2, back_inserter(ints)).first; + CPPUNIT_ASSERT( ints.size() == 4 ); + CPPUNIT_ASSERT( ints[2] == 3 ); + CPPUNIT_ASSERT( ints[3] == 4 ); + itr = copy_n(itr, 2, back_inserter(ints)).first; + CPPUNIT_ASSERT( ints.size() == 6 ); + CPPUNIT_ASSERT( ints[4] == 5 ); + CPPUNIT_ASSERT( ints[5] == 6 ); + } +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/istream_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/istream_header_test.cpp new file mode 100644 index 00000000000..7c83854673c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/istream_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/iter_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iter_test.cpp new file mode 100644 index 00000000000..52e4348df6e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iter_test.cpp @@ -0,0 +1,169 @@ +#include +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class IterTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(IterTest); + CPPUNIT_TEST(iter1); + CPPUNIT_TEST(iter3); + CPPUNIT_TEST(iter4); + CPPUNIT_TEST(iterswp0); + CPPUNIT_TEST(iterswp1); + CPPUNIT_TEST(iterswp2); + CPPUNIT_TEST(iterswp3); + CPPUNIT_TEST_SUITE_END(); + +protected: + void iter1(); + void iter3(); + void iter4(); + void iterswp0(); + void iterswp1(); + void iterswp2(); + void iterswp3(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(IterTest); + +// +// tests implementation +// +void IterTest::iter1() +{ + vector v; // Vector of character strings. + v.push_back("zippy"); // First element. + v.push_back("motorboy"); // Second element. + typedef vector vec; + unsigned counter = 0; + for (vec::iterator i = v.begin(); i != v.end(); ++i, ++counter) { + switch (counter) { + case 0: + CPPUNIT_ASSERT(!strcmp(*i, "zippy")); + break; + case 1: + CPPUNIT_ASSERT(!strcmp(*i, "motorboy")); + break; + default: + CPPUNIT_FAIL; + } + } +} +void IterTest::iter3() +{ + typedef vector Vec; + Vec v; // Vector of character strings. + v.push_back("zippy"); // First element. + v.push_back("motorboy"); // Second element. + Vec::reverse_iterator it; + unsigned counter = 0; + for (it = v.rbegin(); it != v.rend(); ++it, ++counter) { + switch (counter) { + case 1: + CPPUNIT_ASSERT(!strcmp(*it, "zippy")); + break; + case 0: + CPPUNIT_ASSERT(!strcmp(*it, "motorboy")); + break; + default: + CPPUNIT_FAIL; + } + } +} +void IterTest::iter4() +{ + vector v; // Empty vector of integers. + v.push_back(1); + v.push_back(2); + v.push_back(3); + // Position immediately after last item. + vector::iterator i = v.end(); + // Move back one and then access. + CPPUNIT_ASSERT((*--i)==3); + i -= 2; // Jump back two items. + CPPUNIT_ASSERT((*i)==1); +} +void IterTest::iterswp0() +{ + int numbers[6] = { 0, 1, 2, 3, 4, 5 }; + + iter_swap(numbers, numbers + 3); + + CPPUNIT_ASSERT(numbers[0]==3); + CPPUNIT_ASSERT(numbers[1]==1); + CPPUNIT_ASSERT(numbers[2]==2); + CPPUNIT_ASSERT(numbers[3]==0); + CPPUNIT_ASSERT(numbers[4]==4); + CPPUNIT_ASSERT(numbers[5]==5); + +} +void IterTest::iterswp1() +{ + vector v1(6); + __iota(v1.begin(), v1.end(), 0); + iter_swap( v1.begin(), v1.begin() + 3 ); + + CPPUNIT_ASSERT(v1[0]==3); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==0); + CPPUNIT_ASSERT(v1[4]==4); + CPPUNIT_ASSERT(v1[5]==5); +} +void IterTest::iterswp2() +{ + vector boolVector; + + boolVector.push_back( true ); + boolVector.push_back( false ); + + vector::iterator i1 = boolVector.begin(); + vector::iterator i2 = boolVector.begin(); + ++i2; + + bool v0 = *i1; + bool v1 = *i2; + + iter_swap( i1, i2 ); + + CPPUNIT_ASSERT(( *i1 == v1 && *i2 == v0 )); +} + + +void IterTest::iterswp3() +{ + vector vvref(10, 10); + vector lvref(10, 20); + + vector > vvints(4, vvref); + list > lvints(4, lvref); + + iter_swap(vvints.begin(), lvints.begin()); + CPPUNIT_CHECK( vvints.front() == lvref ); + CPPUNIT_CHECK( lvints.front() == vvref ); + + //const vector > &cvvints = vvints; + //iter_swap(cvvints.begin(), lvints.begin()); + //iter_swap(lvints.begin(), cvvints.begin()); + +#if defined (STLPORT) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + int *pvvint = &vvints.front().front(); + int *plvint = &lvints.front().front(); + + iter_swap(vvints.begin(), lvints.begin()); + //Check that elements have been swaped: + CPPUNIT_CHECK( pvvint == &lvints.front().front() ); + CPPUNIT_CHECK( plvint == &vvints.front().front() ); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/iterator_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/iterator_header_test.cpp new file mode 100644 index 00000000000..cb7ed29762d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/iterator_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/less_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/less_test.cpp new file mode 100644 index 00000000000..a87eae837fa --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/less_test.cpp @@ -0,0 +1,50 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class LessTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(LessTest); + CPPUNIT_TEST(lesst); + CPPUNIT_TEST(lesseqt); + CPPUNIT_TEST_SUITE_END(); + +protected: + void lesst(); + void lesseqt(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(LessTest); + +// +// tests implementation +// +void LessTest::lesst() +{ + int array [4] = { 3, 1, 4, 2 }; + sort(array, array + 4, less()); + + CPPUNIT_ASSERT(array[0]==1); + CPPUNIT_ASSERT(array[1]==2); + CPPUNIT_ASSERT(array[2]==3); + CPPUNIT_ASSERT(array[3]==4); +} +void LessTest::lesseqt() +{ + int array [4] = { 3, 1, 4, 2 }; + sort(array, array + 4, less_equal()); + + CPPUNIT_ASSERT(array[0]==1); + CPPUNIT_ASSERT(array[1]==2); + CPPUNIT_ASSERT(array[2]==3); + CPPUNIT_ASSERT(array[3]==4); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/lexcmp_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/lexcmp_test.cpp new file mode 100644 index 00000000000..f913f4163e2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/lexcmp_test.cpp @@ -0,0 +1,48 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class LexcmpTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(LexcmpTest); + CPPUNIT_TEST(lexcmp1); + CPPUNIT_TEST(lexcmp2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void lexcmp1(); + void lexcmp2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(LexcmpTest); + +// +// tests implementation +// +void LexcmpTest::lexcmp1() +{ + const unsigned size = 6; + char n1[size] = "shoe"; + char n2[size] = "shine"; + + bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size); + CPPUNIT_ASSERT(!before); +} +void LexcmpTest::lexcmp2() +{ + const unsigned size = 6; + char n1[size] = "shoe"; + char n2[size] = "shine"; + + bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size, greater()); + CPPUNIT_ASSERT(before); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/limits_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/limits_header_test.cpp new file mode 100644 index 00000000000..5954a04c003 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/limits_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/limits_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/limits_test.cpp new file mode 100644 index 00000000000..d8102ee9dc9 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/limits_test.cpp @@ -0,0 +1,317 @@ +/* boost limits_test.cpp test your file for important + * + * Copyright Jens Maurer 2000 + * Permission to use, copy, modify, sell, and distribute this software + * is hereby granted without fee provided that the above copyright notice + * appears in all copies and that both that copyright notice and this + * permission notice appear in supporting documentation, + * + * Jens Maurer makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + */ + +#include +//#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class LimitTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(LimitTest); +# if defined (__BORLANDC__) + /* Ignore FPU exceptions, set FPU precision to 64 bits */ + unsigned int _float_control_word = _control87(0, 0); + _control87(PC_64|MCW_EM|IC_AFFINE, MCW_PC|MCW_EM|MCW_IC); +# endif + CPPUNIT_TEST(test); + CPPUNIT_TEST(qnan_test); +# if defined (__BORLANDC__) + /* Reset floating point control word */ + _clear87(); + _control87(_float_control_word, MCW_PC|MCW_EM|MCW_IC); +# endif + CPPUNIT_TEST_SUITE_END(); + +protected: + void test(); + void qnan_test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(LimitTest); + +#if defined (STLPORT) && defined (_STLP_STATIC_CONST_INIT_BUG) +# define CHECK_COND(X) if (!(X)) { CPPUNIT_MESSAGE(#X); return false; } +#else +//This version force to have external linkage on static constant which might +//reveal that _STLP_NO_STATIC_CONST_DEFINITION should be commented. +bool check_cond(const bool& cond) { return cond; } +# define CHECK_COND(X) if (!check_cond(X)) { CPPUNIT_MESSAGE(#X); return false; } +#endif + +bool valid_sign_info(bool, bool) +{ return true; } + +template +bool valid_sign_info(bool limit_is_signed, const _Tp &) { + return (limit_is_signed && _Tp(-1) < 0) || + (!limit_is_signed && _Tp(-1) > 0); +} + +template +bool test_integral_limits_base(const _Tp &, bool unknown_sign = true, bool is_signed = true) { + typedef numeric_limits<_Tp> lim; + + CHECK_COND(lim::is_specialized); + CHECK_COND(lim::is_exact); + CHECK_COND(lim::is_integer); + CHECK_COND(!lim::is_iec559); + CHECK_COND(lim::min() < lim::max()); + CHECK_COND((unknown_sign && ((lim::is_signed && (lim::min() != 0)) || (!lim::is_signed && (lim::min() == 0)))) || + (!unknown_sign && ((lim::is_signed && is_signed) || (!lim::is_signed && !is_signed)))); + + if (unknown_sign) { + CHECK_COND(valid_sign_info(lim::is_signed, _Tp())); + } + return true; +} + +template +bool test_integral_limits(const _Tp &val, bool unknown_sign = true, bool is_signed = true) { + if (!test_integral_limits_base(val, unknown_sign, is_signed)) + return false; + + typedef numeric_limits<_Tp> lim; + + CHECK_COND(lim::is_modulo); + + if (lim::is_bounded || + (!lim::is_bounded && !lim::is_signed)) { + _Tp tmp = lim::min(); + CHECK_COND( --tmp > lim::min() ); + } + + if (lim::is_bounded) { + _Tp tmp = lim::max(); + CHECK_COND( ++tmp < lim::max() ); + } + + return true; +} + +template +bool test_signed_integral_limits(const _Tp &__val) { + return test_integral_limits(__val, false, true); +} +template +bool test_unsigned_integral_limits(const _Tp &__val) { + return test_integral_limits(__val, false, false); +} + +template +bool test_float_values(_Tp lhs, _Tp rhs) +{ return lhs == rhs; } + +template +bool test_float_limits(const _Tp &) { + typedef numeric_limits<_Tp> lim; + CHECK_COND(lim::is_specialized); + CHECK_COND(!lim::is_modulo); + CHECK_COND(!lim::is_integer); + CHECK_COND(lim::is_signed); + + CHECK_COND(lim::max() > 1000); + CHECK_COND(lim::min() > 0); + CHECK_COND(lim::min() < 0.001); + CHECK_COND(lim::epsilon() > 0); + + if (lim::is_iec559) { + CHECK_COND(lim::has_infinity); + CHECK_COND(lim::has_quiet_NaN); + CHECK_COND(lim::has_signaling_NaN); + CHECK_COND(lim::has_denorm == denorm_present); + } + + if (lim::has_denorm == denorm_absent) { + CHECK_COND(lim::denorm_min() == lim::min()); + _Tp tmp = lim::min(); + tmp /= 2; + if (tmp > 0 && tmp < lim::min()) { + // has_denorm could be denorm_present + CPPUNIT_MESSAGE("It looks like your compiler/platform supports denormalized floating point representation."); + } + } + else if (lim::has_denorm == denorm_present) { + CHECK_COND(lim::denorm_min() > 0); + CHECK_COND(lim::denorm_min() < lim::min()); + + _Tp tmp = lim::min(); + while (tmp != 0) { + _Tp old_tmp = tmp; + tmp /= 2; + CHECK_COND(tmp < old_tmp); + CHECK_COND(tmp >= lim::denorm_min() || tmp == (_Tp)0); + //ostringstream str; + //str << "denorm_min = " << lim::denorm_min() << ", tmp = " << tmp; + //CPPUNIT_MESSAGE(str.str().c_str()); + } + } + + if (lim::has_infinity) { + const _Tp infinity = lim::infinity(); + /* Make sure those values are not 0 or similar nonsense. + * Infinity must compare as if larger than the maximum representable value. */ + + _Tp val = lim::max(); + val *= 2; + + /* We use test_float_values because without it some compilers (gcc) perform weird + * optimization on the test giving unexpected result. */ + CHECK_COND(test_float_values(val, infinity)); + + /* + ostringstream str; + str << "lim::max() = " << lim::max() << ", val = " << val << ", infinity = " << infinity; + CPPUNIT_MESSAGE( str.str().c_str() ); + str.str(string()); + str << "sizeof(_Tp) = " << sizeof(_Tp); + CPPUNIT_MESSAGE( str.str().c_str() ); + if (sizeof(_Tp) == 4) { + str.str(string()); + str << "val in hexa: " << showbase << hex << *((const unsigned int*)&val); + str << ", infinity in hexa: " << showbase << hex << *((const unsigned int*)&infinity); + } +#if defined (_STLP_LONG_LONG) + else if (sizeof(_Tp) == sizeof(_STLP_LONG_LONG)) { + str.str(string()); + str << "val in hexa: " << showbase << hex << *((const unsigned _STLP_LONG_LONG*)&val); + str << ", infinity in hexa: " << showbase << hex << *((const unsigned _STLP_LONG_LONG*)&infinity); + } +#endif + else { + str.str(string()); + str << "val: "; + for (int i = 0; i != sizeof(_Tp) / sizeof(unsigned short); ++i) { + if (i != 0) str << ' '; + str << showbase << hex << setw(4) << setfill('0') << *((const unsigned short*)&val + i); + } + str << ", infinity: "; + for (int i = 0; i != sizeof(_Tp) / sizeof(unsigned short); ++i) { + if (i != 0) str << ' '; + str << showbase << hex << setw(4) << setfill('0') << *((const unsigned short*)&infinity + i); + } + } + CPPUNIT_MESSAGE( str.str().c_str() ); + str.str(string()); + str << dec; + str << "lim::digits = " << lim::digits << ", lim::digits10 = " << lim::digits10 << endl; + str << "lim::min_exponent = " << lim::min_exponent << ", lim::min_exponent10 = " << lim::min_exponent10 << endl; + str << "lim::max_exponent = " << lim::max_exponent << ", lim::max_exponent10 = " << lim::max_exponent10 << endl; + CPPUNIT_MESSAGE( str.str().c_str() ); + */ + + CHECK_COND(infinity == infinity); + CHECK_COND(infinity > lim::max()); + CHECK_COND(-infinity < -lim::max()); + } + + return true; +} + +//float generate_nan(float f) { +// return 0.0f / f; +//} +template +bool test_qnan(const _Tp &) { + typedef numeric_limits<_Tp> lim; + if (lim::has_quiet_NaN) { + const _Tp qnan = lim::quiet_NaN(); + + //if (sizeof(_Tp) == 4) { + // ostringstream str; + // str << "qnan " << qnan << ", in hexa: " << showbase << hex << *((unsigned int*)&qnan); + // CPPUNIT_MESSAGE( str.str().c_str() ); + // str.str(""); + // float val = generate_nan(0.0f); + // str << "val " << val << ", in hexa: " << showbase << hex << *((unsigned int*)&val); + // CPPUNIT_MESSAGE( str.str().c_str() ); + // str.str(""); + // val = -qnan; + // str << "-qnan " << val << ", in hexa: " << showbase << hex << *((unsigned int*)&val); + // CPPUNIT_MESSAGE( str.str().c_str() ); + //} + /* NaNs shall always compare "false" when compared for equality + * If one of these fail, your compiler may be optimizing incorrectly, + * or the STLport is incorrectly configured. + */ + CHECK_COND(! (qnan == 42)); + CHECK_COND(! (qnan == qnan)); + CHECK_COND(qnan != 42); + CHECK_COND(qnan != qnan); + + /* The following tests may cause arithmetic traps. + * CHECK_COND(! (qnan < 42)); + * CHECK_COND(! (qnan > 42)); + * CHECK_COND(! (qnan <= 42)); + * CHECK_COND(! (qnan >= 42)); + */ + } + return true; +} + + +class ArbitraryType +{}; + +void LimitTest::test() { + CPPUNIT_CHECK(test_integral_limits_base(bool())); + CPPUNIT_CHECK(test_integral_limits(char())); + typedef signed char signed_char; + CPPUNIT_CHECK(test_signed_integral_limits(signed_char())); + typedef unsigned char unsigned_char; + CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_char())); +# if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT) + CPPUNIT_CHECK(test_integral_limits(wchar_t())); +# endif + CPPUNIT_CHECK(test_signed_integral_limits(short())); + typedef unsigned short unsigned_short; + CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_short())); + CPPUNIT_CHECK(test_signed_integral_limits(int())); + typedef unsigned int unsigned_int; + CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_int())); + CPPUNIT_CHECK(test_signed_integral_limits(long())); + typedef unsigned long unsigned_long; + CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_long())); +# if defined (_STLP_LONG_LONG) + typedef _STLP_LONG_LONG long_long; + CPPUNIT_CHECK(test_signed_integral_limits(long_long())); + typedef unsigned _STLP_LONG_LONG unsigned_long_long; + CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_long_long())); +#endif + + CPPUNIT_CHECK(test_float_limits(float())); + CPPUNIT_CHECK(test_float_limits(double())); +# if !defined ( _STLP_NO_LONG_DOUBLE ) + typedef long double long_double; + CPPUNIT_CHECK(test_float_limits(long_double())); +# endif + + CPPUNIT_ASSERT( !numeric_limits::is_specialized ); +} + +void LimitTest::qnan_test() { + CPPUNIT_CHECK(test_qnan(float())); + CPPUNIT_CHECK(test_qnan(double())); +# if !defined ( _STLP_NO_LONG_DOUBLE ) + typedef long double long_double; + CPPUNIT_CHECK(test_qnan(long_double())); +# endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/list_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/list_header_test.cpp new file mode 100644 index 00000000000..36cb6c47d18 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/list_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/list_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/list_test.cpp new file mode 100644 index 00000000000..7345d409873 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/list_test.cpp @@ -0,0 +1,468 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class ListTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ListTest); + CPPUNIT_TEST(list1); + CPPUNIT_TEST(list2); + CPPUNIT_TEST(list3); + CPPUNIT_TEST(list4); + CPPUNIT_TEST(erase); + CPPUNIT_TEST(resize); + CPPUNIT_TEST(push_back); + CPPUNIT_TEST(push_front); + CPPUNIT_TEST(allocator_with_state); + CPPUNIT_TEST(swap); + CPPUNIT_TEST(adl); + //CPPUNIT_TEST(const_list); + CPPUNIT_TEST_SUITE_END(); + +protected: + void list1(); + void list2(); + void list3(); + void list4(); + void erase(); + void resize(); + void push_back(); + void push_front(); + void allocator_with_state(); + void swap(); + void adl(); + //void const_list(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ListTest); + +// +// tests implementation +// +void ListTest::list1() +{ + int array1 [] = { 9, 16, 36 }; + int array2 [] = { 1, 4 }; + + list l1(array1, array1 + 3); + list l2(array2, array2 + 2); + list::iterator i1 = l1.begin(); + list::iterator i2 = l2.begin(); + list::const_iterator ci(i1); + list::const_iterator ci1(ci); + l1.splice(i1, l2); + i1 = l1.begin(); + CPPUNIT_ASSERT( *i1++ == 1 ); + CPPUNIT_ASSERT( *i1++ == 4 ); + CPPUNIT_ASSERT( *i1++ == 9 ); + CPPUNIT_ASSERT( *i1++ == 16 ); + CPPUNIT_ASSERT( *i1++ == 36 ); + +#if defined (STLPORT) && \ + (!defined (_STLP_DEBUG) || (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)) + CPPUNIT_ASSERT( i2 == l1.begin() ); +#endif + + //Default construct check (_STLP_DEF_CONST_PLCT_NEW_BUG) + list l(2); + i1 = l.begin(); + CPPUNIT_ASSERT( *(i1++) == 0 ); + CPPUNIT_ASSERT( *i1 == 0 ); +#if 0 + //A small compilation time check to be activated from time to time, + //compilation should fail. + { + list::iterator l_char_ite; + list::iterator l_int_ite; + CPPUNIT_ASSERT( l_char_ite != l_int_ite ); + } +#endif +} + +void ListTest::list2() +{ + int array1 [] = { 1, 16 }; + int array2 [] = { 4, 9 }; + + list l1(array1, array1 + 2); + list l2(array2, array2 + 2); + list::iterator i = l1.begin(); + i++; + l1.splice(i, l2, l2.begin(), l2.end()); + i = l1.begin(); + CPPUNIT_ASSERT(*i++==1); + CPPUNIT_ASSERT(*i++==4); + CPPUNIT_ASSERT(*i++==9); + CPPUNIT_ASSERT(*i++==16); +} + +void ListTest::list3() +{ + char array [] = { 'x', 'l', 'x', 't', 's', 's' }; + + list str(array, array + 6); + list::iterator i; + + str.reverse(); + i = str.begin(); + CPPUNIT_ASSERT(*i++=='s'); + CPPUNIT_ASSERT(*i++=='s'); + CPPUNIT_ASSERT(*i++=='t'); + CPPUNIT_ASSERT(*i++=='x'); + CPPUNIT_ASSERT(*i++=='l'); + CPPUNIT_ASSERT(*i++=='x'); + + str.remove('x'); + i = str.begin(); + CPPUNIT_ASSERT(*i++=='s'); + CPPUNIT_ASSERT(*i++=='s'); + CPPUNIT_ASSERT(*i++=='t'); + CPPUNIT_ASSERT(*i++=='l'); + + str.unique(); + i = str.begin(); + CPPUNIT_ASSERT(*i++=='s'); + CPPUNIT_ASSERT(*i++=='t'); + CPPUNIT_ASSERT(*i++=='l'); + + str.sort(); + i = str.begin(); + CPPUNIT_ASSERT(*i++=='l'); + CPPUNIT_ASSERT(*i++=='s'); + CPPUNIT_ASSERT(*i++=='t'); +} + +void ListTest::list4() +{ + int array1 [] = { 1, 3, 6, 7 }; + int array2 [] = { 2, 4 }; + + list l1(array1, array1 + 4); + list l2(array2, array2 + 2); + l1.merge(l2); + list::iterator i = l1.begin(); + CPPUNIT_ASSERT(*i++==1); + CPPUNIT_ASSERT(*i++==2); + CPPUNIT_ASSERT(*i++==3); + CPPUNIT_ASSERT(*i++==4); + CPPUNIT_ASSERT(*i++==6); + CPPUNIT_ASSERT(*i++==7); + + //We use distance to avoid a simple call to an internal counter + CPPUNIT_ASSERT(distance(l1.begin(), l1.end()) == 6); + CPPUNIT_ASSERT(distance(l2.begin(), l2.end()) == 0); + + l1.swap(l2); + + CPPUNIT_ASSERT(distance(l1.begin(), l1.end()) == 0); + CPPUNIT_ASSERT(distance(l2.begin(), l2.end()) == 6); +} + +void ListTest::erase() +{ + list l; + l.push_back( 1 ); + l.erase(l.begin()); + CPPUNIT_ASSERT( l.empty() ); + + int array[] = { 0, 1, 2, 3 }; + l.assign(array, array + 4); + list::iterator lit; + lit = l.erase(l.begin()); + CPPUNIT_ASSERT( *lit == 1 ); + + lit = l.erase(l.begin(), --l.end()); + CPPUNIT_ASSERT( *lit == 3 ); + + l.clear(); + CPPUNIT_ASSERT( l.empty() ); +} + + +void ListTest::resize() +{ + { + list l; + l.resize(5, 1); + + size_t i; + list::iterator lit(l.begin()); + for (i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( lit != l.end() ); + CPPUNIT_ASSERT( *(lit++) == 1 ); + } + CPPUNIT_ASSERT( lit == l.end() ); + + l.resize(3); + lit = l.begin(); + for (i = 0; i < 3; ++i) { + CPPUNIT_ASSERT( lit != l.end() ); + CPPUNIT_ASSERT( *(lit++) == 1 ); + } + CPPUNIT_ASSERT( lit == l.end() ); + } + + { + list l; + l.resize(5); + + size_t i; + list::iterator lit(l.begin()); + for (i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( lit != l.end() ); + CPPUNIT_ASSERT( *(lit++) == 0 ); + } + CPPUNIT_ASSERT( lit == l.end() ); + } +} + +void ListTest::push_back() +{ + list l; + l.push_back( 1 ); + l.push_back( 2 ); + l.push_back( 3 ); + + list::reverse_iterator r = l.rbegin(); + + CPPUNIT_ASSERT( *r == 3 ); + l.push_back( 4 ); + /* + * Following lines are commented, because ones show standard contradiction + * (24.4.1 and 23.2.2.3); but present behaviour is valid, 24.4.1, paragraphs 1 and 2, + * 24.4.1.3.3 and 23.1 paragraph 9 (Table 66). The 24.4.1 is more common rule, + * so it has preference under 23.2.2.3, by my opinion. + * + * - ptr + */ + // CPPUNIT_ASSERT( *r == 3 ); + // ++r; + // CPPUNIT_ASSERT( *r == 2 ); +} + +void ListTest::push_front() +{ + list l; + l.push_back( 1 ); + l.push_back( 2 ); + l.push_back( 3 ); + + list::iterator i = l.begin(); + + CPPUNIT_ASSERT( *i == 1 ); + l.push_front( 0 ); + CPPUNIT_ASSERT( *i == 1 ); + ++i; + CPPUNIT_ASSERT( *i == 2 ); +} + +void ListTest::allocator_with_state() +{ + char buf1[1024]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + typedef list > ListInt; + { + //Swap with both list non empty + ListInt lint1(10, 0, stack1); + ListInt lint1Cpy(lint1); + + ListInt lint2(10, 1, stack2); + ListInt lint2Cpy(lint2); + + lint1.swap(lint2); + + CPPUNIT_ASSERT( lint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( lint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( lint1 == lint2Cpy ); + CPPUNIT_ASSERT( lint2 == lint1Cpy ); + CPPUNIT_ASSERT( lint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( lint2.get_allocator() == stack1 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + //Swap with empty calle list + ListInt lint1(10, 0, stack1); + ListInt lint1Cpy(lint1); + + ListInt lint2(stack2); + ListInt lint2Cpy(lint2); + + lint1.swap(lint2); + + CPPUNIT_ASSERT( lint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( lint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( lint1 == lint2Cpy ); + CPPUNIT_ASSERT( lint2 == lint1Cpy ); + CPPUNIT_ASSERT( lint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( lint2.get_allocator() == stack1 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + //Swap with empty caller list + ListInt lint1(stack1); + ListInt lint1Cpy(lint1); + + ListInt lint2(10, 0, stack2); + ListInt lint2Cpy(lint2); + + lint1.swap(lint2); + + CPPUNIT_ASSERT( lint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( lint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( lint1 == lint2Cpy ); + CPPUNIT_ASSERT( lint2 == lint1Cpy ); + CPPUNIT_ASSERT( lint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( lint2.get_allocator() == stack1 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + ListInt lint1(10, 0, stack1); + ListInt lint2(10, 1, stack2); + + lint1.splice(lint1.begin(), lint2); + CPPUNIT_ASSERT( lint1.size() == 20 ); + CPPUNIT_ASSERT( lint2.empty() ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + ListInt lint1(10, 0, stack1); + ListInt lint2(10, 1, stack2); + + lint1.splice(lint1.begin(), lint2, lint2.begin()); + CPPUNIT_ASSERT( lint1.size() == 11 ); + CPPUNIT_ASSERT( lint2.size() == 9 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + ListInt lint1(10, 0, stack1); + ListInt lint2(10, 1, stack2); + + ListInt::iterator lit(lint2.begin()); + advance(lit, 5); + lint1.splice(lint1.begin(), lint2, lint2.begin(), lit); + CPPUNIT_ASSERT( lint1.size() == 15 ); + CPPUNIT_ASSERT( lint2.size() == 5 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + ListInt lint1(10, 0, stack1); + ListInt lint2(10, 1, stack2); + + ListInt lintref(stack2); + lintref.insert(lintref.begin(), 10, 1); + lintref.insert(lintref.begin(), 10, 0); + + lint1.merge(lint2); + CPPUNIT_ASSERT( lint1.size() == 20 ); + CPPUNIT_ASSERT( lint1 == lintref ); + CPPUNIT_ASSERT( lint2.empty() ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + +#if defined (STLPORT) && !defined (_STLP_NO_MEMBER_TEMPLATES) && \ + (!defined (_MSC_VER) || (_MSC_VER >= 1300)) + { + //This is a compile time test. + //We check that sort implementation is correct when list is instanciated + //with an allocator that do not have a default constructor. + ListInt lint1(10, 0, stack1); + lint1.sort(); + lint1.sort(greater()); + } +#endif +} + +/* +void ListTest::const_list() +{ + list cint_list; + cint_list.push_back(1); + cint_list.push_front(2); +} +*/ +void ListTest::swap() +{ + list lst1; + list lst2; + + lst1.push_back(1); + lst2.push_back(2); + + lst1.swap( lst2 ); + + CPPUNIT_CHECK( lst1.front() == 2 ); + CPPUNIT_CHECK( lst2.front() == 1 ); + CPPUNIT_CHECK( lst1.size() == 1 ); + CPPUNIT_CHECK( lst2.size() == 1 ); + + lst1.pop_front(); + lst2.pop_front(); + + CPPUNIT_CHECK( lst1.empty() ); + CPPUNIT_CHECK( lst2.empty() ); +} + +namespace foo { + class bar {}; + + template + size_t distance(_It, _It); +} + +void ListTest::adl() +{ + list lbar; + CPPUNIT_ASSERT( lbar.size() == 0); +} + +#if !defined (STLPORT) || \ + !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + list instances; + typedef list::iterator it; +}; +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/locale_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/locale_header_test.cpp new file mode 100644 index 00000000000..bb2dec139bf --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/locale_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/locale_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/locale_test.cpp new file mode 100644 index 00000000000..71d3da9990f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/locale_test.cpp @@ -0,0 +1,337 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +static const char* tested_locales[] = { +//name, +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + "fr_FR", + "ru_RU.koi8r", + "en_GB", + "en_US", +# endif + "", + "C" +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(LocaleTest); + +// +// tests implementation +// +typedef void (LocaleTest::*_Test) (const locale&); +static void test_supported_locale(LocaleTest &inst, _Test __test) { + size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]); + for (size_t i = 0; i < n; ++i) { + locale loc; +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { +# endif + locale tmp(tested_locales[i]); + loc = tmp; +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + } + catch (runtime_error const&) { + //This locale is not supported. + continue; + } +# endif + CPPUNIT_MESSAGE( loc.name().c_str() ); + (inst.*__test)(loc); + } +} + +void LocaleTest::locale_by_name() { +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ + try { + locale loc(static_cast(0)); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc("yasli_language"); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string very_large_locale_name(1024, '?'); + locale loc(very_large_locale_name.c_str()); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + +#if defined (STLPORT) || !defined (_MSC_VER) || (_MSC_VER > 1400) + try { + string very_large_locale_name("LC_CTYPE="); + very_large_locale_name.append(1024, '?'); + locale loc(very_large_locale_name.c_str()); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string very_large_locale_name("LC_ALL="); + very_large_locale_name.append(1024, '?'); + locale loc(very_large_locale_name.c_str()); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +#endif + + try { + locale loc("C"); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" locale facet. + locale loc(""); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + +# endif +} + +void LocaleTest::loc_has_facet() { + locale loc("C"); + typedef numpunct implemented_facet; + CPPUNIT_ASSERT( has_facet(loc) ); + /* + typedef num_put > not_implemented_facet; + CPPUNIT_ASSERT( !has_facet(loc) ); + */ +} + +void LocaleTest::locale_init_problem() { +# if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + test_supported_locale(*this, &LocaleTest::_locale_init_problem); +# endif +} + +/* + * Creation of a locale instance imply initialization of some STLport internal + * static objects first. We use a static instance of locale to check that this + * initialization is done correctly. + */ +static locale global_loc; +static locale other_loc(""); + +# if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) +void LocaleTest::_locale_init_problem( const locale& loc) +{ +# if !defined (__APPLE__) && !defined (__FreeBSD__) || \ + !defined(__GNUC__) || ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__> 3))) + typedef codecvt my_facet; +# else +// std::mbstate_t required for gcc 3.3.2 on FreeBSD... +// I am not sure what key here---FreeBSD or 3.3.2... +// - ptr 2005-04-04 + typedef codecvt my_facet; +# endif + + locale loc_ref(global_loc); + { + locale gloc( loc_ref, new my_facet() ); + CPPUNIT_ASSERT( has_facet( gloc ) ); + //The following code is just here to try to confuse the reference counting underlying mecanism: + locale::global( locale::classic() ); + locale::global( gloc ); + } + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { +# endif + ostringstream os("test") ; + locale loc2( loc, new my_facet() ); + CPPUNIT_ASSERT( has_facet( loc2 ) ); + os.imbue( loc2 ); +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + } + catch ( runtime_error& ) { + CPPUNIT_FAIL; + } + catch ( ... ) { + CPPUNIT_FAIL; + } +# endif + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { +# endif + ostringstream os2("test2"); +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + } + catch ( runtime_error& ) { + CPPUNIT_FAIL; + } + catch ( ... ) { + CPPUNIT_FAIL; + } +# endif +} +#endif + +void LocaleTest::default_locale() +{ + locale loc( "" ); +} + +class dummy_facet : public locale::facet { +public: + static locale::id id; +}; + +locale::id dummy_facet::id; + +void LocaleTest::combine() +{ +# if (!defined (STLPORT) || \ + (defined (_STLP_USE_EXCEPTIONS) && !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS))) + { + try { + locale loc(""); + if (!has_facet >(loc)) { + loc.combine >(loc); + CPPUNIT_FAIL; + } + } + catch (const runtime_error & /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + } + + try { + locale loc; + if (!has_facet(loc)) { + loc.combine(loc); + CPPUNIT_FAIL; + } + } + catch (const runtime_error & /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + } + } + + locale loc1(locale::classic()), loc2; + size_t loc1_index = 0; + for (size_t i = 0; _get_ref_monetary(i) != 0; ++i) { + try { + { + locale loc(_get_ref_monetary_name(_get_ref_monetary(i))); + if (loc1 == locale::classic()) + { + loc1 = loc; + loc1_index = i; + continue; + } + else + { + loc2 = loc; + } + } + + //We can start the test + ostringstream ostr; + ostr << "combining '" << loc2.name() << "' money facets with '" << loc1.name() << "'"; + CPPUNIT_MESSAGE( ostr.str().c_str() ); + + //We are going to combine money facets as all formats are different. + { + //We check that resulting locale has correctly acquire loc2 facets. + locale loc = loc1.combine >(loc2); + loc = loc.combine >(loc2); + loc = loc.combine >(loc2); + loc = loc.combine >(loc2); + + //Check loc has the correct facets: + _money_put_get2(loc2, loc, _get_ref_monetary(i)); + + //Check loc1 has not been impacted: + _money_put_get2(loc1, loc1, _get_ref_monetary(loc1_index)); + + //Check loc2 has not been impacted: + _money_put_get2(loc2, loc2, _get_ref_monetary(i)); + } + { + //We check that resulting locale has not wrongly acquire loc1 facets that hasn't been combine: + locale loc = loc2.combine >(loc1); + loc = loc.combine >(loc1); + loc = loc.combine >(loc1); + + //Check loc has the correct facets: + _money_put_get2(loc2, loc, _get_ref_monetary(i)); + + //Check loc1 has not been impacted: + _money_put_get2(loc1, loc1, _get_ref_monetary(loc1_index)); + + //Check loc2 has not been impacted: + _money_put_get2(loc2, loc2, _get_ref_monetary(i)); + } + + { + // Check auto combination do not result in weird reference counting behavior + // (might generate a crash). + loc1.combine >(loc1); + } + + loc1 = loc2; + loc1_index = i; + } + catch (runtime_error const&) { + //This locale is not supported. + continue; + } + } +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/locale_test.h b/reactos/lib/3rdparty/stlport/test/unit/locale_test.h new file mode 100644 index 00000000000..ab97ac4a577 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/locale_test.h @@ -0,0 +1,94 @@ +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include + +# include "cppunit/cppunit_proxy.h" +# include + +struct ref_monetary; +struct ref_locale; + +# if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +# define STD std:: +# else +# define STD +# endif + +// +// TestCase class +// +class LocaleTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(LocaleTest); +# if defined (STLPORT) && !defined (_STLP_USE_EXCEPTIONS) + CPPUNIT_IGNORE; +# endif + CPPUNIT_TEST(locale_by_name); + CPPUNIT_TEST(moneypunct_by_name); + CPPUNIT_TEST(time_by_name); + CPPUNIT_TEST(numpunct_by_name); + CPPUNIT_TEST(ctype_by_name); + CPPUNIT_TEST(collate_by_name); + CPPUNIT_TEST(messages_by_name); + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(loc_has_facet); + CPPUNIT_TEST(num_put_get); + CPPUNIT_TEST(money_put_get); + CPPUNIT_TEST(money_put_X_bug); + CPPUNIT_TEST(time_put_get); + CPPUNIT_TEST(collate_facet); + CPPUNIT_TEST(ctype_facet); +# if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES) + CPPUNIT_IGNORE; +# endif + CPPUNIT_TEST(locale_init_problem); + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(default_locale); +# if !defined (STLPORT) + CPPUNIT_IGNORE; +# endif + CPPUNIT_STOP_IGNORE; +#if (defined (STLPORT) && \ + (!defined (_STLP_USE_EXCEPTIONS) || defined (_STLP_NO_MEMBER_TEMPLATES) || defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS))) + CPPUNIT_IGNORE; +# endif + CPPUNIT_TEST(combine); + CPPUNIT_TEST_SUITE_END(); + +public: + void locale_by_name(); + void loc_has_facet(); + void num_put_get(); + void numpunct_by_name(); + void time_put_get(); + void time_by_name(); + void collate_facet(); + void collate_by_name(); + void ctype_facet(); + void ctype_by_name(); + void locale_init_problem(); + void money_put_get(); + void money_put_X_bug(); + void moneypunct_by_name(); + void default_locale(); + void combine(); + void messages_by_name(); +private: + void _loc_has_facet( const STD locale& ); + void _num_put_get( const STD locale&, const ref_locale* ); + void _time_put_get( const STD locale& ); + void _ctype_facet( const STD locale& ); + void _ctype_facet_w( const STD locale& ); + void _locale_init_problem( const STD locale& ); + + static const ref_monetary* _get_ref_monetary(size_t); + static const char* _get_ref_monetary_name(const ref_monetary*); + + void _money_put_get( const STD locale&, const ref_monetary* ); + void _money_put_get2( const STD locale& loc, const STD locale& streamLoc, const ref_monetary* ); + void _money_put_X_bug( const STD locale&, const ref_monetary* ); +}; + +# undef STD +#endif + diff --git a/reactos/lib/3rdparty/stlport/test/unit/logic_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/logic_test.cpp new file mode 100644 index 00000000000..69ceea193c8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/logic_test.cpp @@ -0,0 +1,65 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class LogicTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(LogicTest); + CPPUNIT_TEST(logicand); + CPPUNIT_TEST(logicnot); + CPPUNIT_TEST(logicor); + CPPUNIT_TEST_SUITE_END(); + +protected: + void logicand(); + void logicnot(); + void logicor(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(LogicTest); + +// +// tests implementation +// +void LogicTest::logicand() +{ + bool input1 [4] = { true, true, false, true }; + bool input2 [4] = { false, true, false, false }; + + bool output [4]; + transform((bool*)input1, (bool*)input1 + 4, (bool*)input2, (bool*)output, logical_and()); + + CPPUNIT_ASSERT(output[0]==false); + CPPUNIT_ASSERT(output[1]==true); + CPPUNIT_ASSERT(output[2]==false); + CPPUNIT_ASSERT(output[3]==false); +} +void LogicTest::logicnot() +{ + bool input [7] = { 1, 0, 0, 1, 1, 1, 1 }; + + int n = count_if(input, input + 7, logical_not()); + CPPUNIT_ASSERT( n == 2 ); +} +void LogicTest::logicor() +{ + bool input1 [4] = { true, true, false, true }; + bool input2 [4] = { false, true, false, false }; + + bool output [4]; + transform((bool*)input1, (bool*)input1 + 4, (bool*)input2, (bool*)output, logical_or()); + + CPPUNIT_ASSERT(output[0]==true); + CPPUNIT_ASSERT(output[1]==true); + CPPUNIT_ASSERT(output[2]==false); + CPPUNIT_ASSERT(output[3]==true); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/macro_checks.cpp b/reactos/lib/3rdparty/stlport/test/unit/macro_checks.cpp new file mode 100644 index 00000000000..171a9fa8f21 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/macro_checks.cpp @@ -0,0 +1,115 @@ +#include +#include +#include + +#if !defined (CHAR_BIT) +# error Missing CHAR_BIT definition. +#endif + +#if (CHAR_BIT < 0) +# error Weird WCHAR_BIT value. +#endif + +#if !defined (CHAR_MAX) +# error Missing CHAR_MAX definition. +#endif + +#if !defined (CHAR_MIN) +# error Missing CHAR_MIN definition. +#endif + +#if !(CHAR_MIN < CHAR_MAX) +# error Weird CHAR_MIN or CHAR_MAX macro values. +#endif + +#if !defined (INT_MAX) +# error Missing INT_MAX definition. +#endif + +#if !defined (INT_MIN) +# error Missing INT_MIN definition. +#endif + +#if !(INT_MIN < INT_MAX) +# error Weird INT_MIN or INT_MAX macro values. +#endif + +#if !defined (LONG_MAX) +# error Missing LONG_MAX definition. +#endif + +#if !defined (LONG_MIN) +# error Missing LONG_MIN definition. +#endif + +#if !(LONG_MIN < LONG_MAX) +# error Weird LONG_MIN or LONG_MAX macro values. +#endif + +#if !defined (SCHAR_MAX) +# error Missing SCHAR_MAX definition. +#endif + +#if !defined (SCHAR_MIN) +# error Missing SCHAR_MIN definition. +#endif + +#if !(SCHAR_MIN < SCHAR_MAX) +# error Weird SCHAR_MIN or SCHAR_MAX macro values. +#endif + +#if !defined (SHRT_MAX) +# error Missing SHRT_MAX definition. +#endif + +#if !defined (SHRT_MIN) +# error Missing SHRT_MIN definition. +#endif + +#if !(SHRT_MIN < SHRT_MAX) +# error Weird SHRT_MIN or SHRT_MAX macro values. +#endif + +#if !defined (WCHAR_MIN) +# error Missing WCHAR_MIN definition. +#endif + +#if !defined (WCHAR_MAX) +# error Missing WCHAR_MAX definition. +#endif + +#if !(WCHAR_MIN < WCHAR_MAX) +# error Weird WCHAR_MIN or WCHAR_MAX macro value. +#endif + +#if !defined (UCHAR_MAX) +# error Missing UCHAR_MAX definition. +#endif + +#if (UCHAR_MAX < 0) +# error Weird UCHAR_MAX macro value. +#endif + +#if !defined (UINT_MAX) +# error Missing UINT_MAX definition. +#endif + +#if (UINT_MAX < 0) +# error Weird UINT_MAX macro value. +#endif + +#if !defined (ULONG_MAX) +# error Missing ULONG_MAX definition. +#endif + +#if (ULONG_MAX < 0) +# error Weird ULONG_MAX macro value. +#endif + +#if !defined (USHRT_MAX) +# error Missing USHRT_MAX definition. +#endif + +#if (USHRT_MAX < 0) +# error Weird USHRT_MAX macro value. +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/map_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/map_header_test.cpp new file mode 100644 index 00000000000..84cf154cdb0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/map_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/map_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/map_test.cpp new file mode 100644 index 00000000000..46256a91274 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/map_test.cpp @@ -0,0 +1,454 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MapTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MapTest); + CPPUNIT_TEST(map1); + CPPUNIT_TEST(mmap1); + CPPUNIT_TEST(mmap2); + CPPUNIT_TEST(iterators); + CPPUNIT_TEST(equal_range); + CPPUNIT_TEST(allocator_with_state); +#if !defined (STLPORT) || !defined (_STLP_USE_CONTAINERS_EXTENSION) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(template_methods); + CPPUNIT_TEST_SUITE_END(); + +protected: + void map1(); + void mmap1(); + void mmap2(); + void iterators(); + void equal_range(); + void allocator_with_state(); + void template_methods(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MapTest); + +// +// tests implementation +// +void MapTest::map1() +{ + typedef map > maptype; + maptype m; + // Store mappings between roman numerals and decimals. + m['l'] = 50; + m['x'] = 20; // Deliberate mistake. + m['v'] = 5; + m['i'] = 1; +// cout << "m['x'] = " << m['x'] << endl; + CPPUNIT_ASSERT( m['x']== 20 ); + m['x'] = 10; // Correct mistake. + CPPUNIT_ASSERT( m['x']== 10 ); + CPPUNIT_ASSERT( m['z']== 0 ); + //cout << "m['z'] = " << m['z'] << endl; // Note default value is added. + CPPUNIT_ASSERT( m.count('z') == 1 ); + //cout << "m.count('z') = " << m.count('z') << endl; + pair p = m.insert(pair('c', 100)); + CPPUNIT_ASSERT( p.second ); + CPPUNIT_ASSERT( p.first != m.end() ); + CPPUNIT_ASSERT( (*p.first).first == 'c' ); + CPPUNIT_ASSERT( (*p.first).second == 100 ); + + p = m.insert(pair('c', 100)); + CPPUNIT_ASSERT( !p.second ); // already existing pair + CPPUNIT_ASSERT( p.first != m.end() ); + CPPUNIT_ASSERT( (*p.first).first == 'c' ); + CPPUNIT_ASSERT( (*p.first).second == 100 ); +} + +void MapTest::mmap1() +{ + typedef multimap > mmap; + mmap m; + CPPUNIT_ASSERT(m.count('X')==0); + + m.insert(pair('X', 10)); // Standard way. + CPPUNIT_ASSERT(m.count('X')==1); + + m.insert(pair('X', 20)); // jbuck: standard way + CPPUNIT_ASSERT(m.count('X')==2); + + m.insert(pair('Y', 32)); // jbuck: standard way + mmap::iterator i = m.find('X'); // Find first match. +#ifndef _STLP_CONST +# define _STLP_CONST const +#endif + pair<_STLP_CONST char, int> p('X', 10); + CPPUNIT_ASSERT(*i == p); + CPPUNIT_ASSERT((*i).first == 'X'); + CPPUNIT_ASSERT((*i).second == 10); + i++; + CPPUNIT_ASSERT((*i).first == 'X'); + CPPUNIT_ASSERT((*i).second == 20); + i++; + CPPUNIT_ASSERT((*i).first == 'Y'); + CPPUNIT_ASSERT((*i).second == 32); + i++; + CPPUNIT_ASSERT(i == m.end()); + + size_t count = m.erase('X'); + CPPUNIT_ASSERT(count==2); +} +void MapTest::mmap2() +{ + typedef pair pair_type; + + pair_type p1(3, 'c'); + pair_type p2(6, 'f'); + pair_type p3(1, 'a'); + pair_type p4(2, 'b'); + pair_type p5(3, 'x'); + pair_type p6(6, 'f'); + + typedef multimap > mmap; + + pair_type array [] = { + p1, + p2, + p3, + p4, + p5, + p6 + }; + + mmap m(array + 0, array + 6); + mmap::iterator i; + i = m.lower_bound(3); + CPPUNIT_ASSERT((*i).first==3); + CPPUNIT_ASSERT((*i).second=='c'); + + i = m.upper_bound(3); + CPPUNIT_ASSERT((*i).first==6); + CPPUNIT_ASSERT((*i).second=='f'); +} + + +void MapTest::iterators() +{ + typedef map > int_map; + int_map imap; + { + int_map::iterator ite(imap.begin()); + int_map::const_iterator cite(imap.begin()); + CPPUNIT_ASSERT( ite == cite ); + CPPUNIT_ASSERT( !(ite != cite) ); + CPPUNIT_ASSERT( cite == ite ); + CPPUNIT_ASSERT( !(cite != ite) ); + } + + typedef multimap > mmap; + typedef mmap::value_type pair_type; + + pair_type p1(3, 'c'); + pair_type p2(6, 'f'); + pair_type p3(1, 'a'); + pair_type p4(2, 'b'); + pair_type p5(3, 'x'); + pair_type p6(6, 'f'); + + pair_type array [] = { + p1, + p2, + p3, + p4, + p5, + p6 + }; + + mmap m(array+0, array + 6); + + { + mmap::iterator ite(m.begin()); + mmap::const_iterator cite(m.begin()); + //test compare between const_iterator and iterator + CPPUNIT_ASSERT( ite == cite ); + CPPUNIT_ASSERT( !(ite != cite) ); + CPPUNIT_ASSERT( cite == ite ); + CPPUNIT_ASSERT( !(cite != ite) ); + } + +#if 0 + /* + * A check that map and multimap iterators are NOT comparable + * the following code should generate a compile time error + */ + { + int_map::iterator mite(imap.begin()); + int_map::const_iterator mcite(imap.begin()); + mmap::iterator mmite(m.begin()); + mmap::const_iterator mmcite(m.begin()); + CPPUNIT_ASSERT( !(mite == mmite) ); + CPPUNIT_ASSERT( !(mcite == mmcite) ); + CPPUNIT_ASSERT( mite != mmite ); + CPPUNIT_ASSERT( mcite != mmcite ); + CPPUNIT_ASSERT( !(mite == mmcite) ); + CPPUNIT_ASSERT( !(mite == mmcite) ); + CPPUNIT_ASSERT( mite != mmcite ); + CPPUNIT_ASSERT( mite != mmcite ); + } + +#endif + + mmap::reverse_iterator ri = m.rbegin(); + CPPUNIT_ASSERT( ri != m.rend() ); + CPPUNIT_ASSERT( ri == m.rbegin() ); + CPPUNIT_ASSERT( (*ri).first == 6 ); + CPPUNIT_ASSERT( (*ri++).second == 'f' ); + CPPUNIT_ASSERT( (*ri).first == 6 ); + CPPUNIT_ASSERT( (*ri).second == 'f' ); + + mmap const& cm = m; + mmap::const_reverse_iterator rci = cm.rbegin(); + CPPUNIT_ASSERT( rci != cm.rend() ); + CPPUNIT_ASSERT( (*rci).first == 6 ); + CPPUNIT_ASSERT( (*rci++).second == 'f' ); + CPPUNIT_ASSERT( (*rci).first == 6 ); + CPPUNIT_ASSERT( (*rci).second == 'f' ); +} + +void MapTest::equal_range() +{ + typedef map > maptype; + { + maptype m; + m['x'] = 10; + + pair ret; + ret = m.equal_range('x'); + CPPUNIT_ASSERT( ret.first != ret.second ); + CPPUNIT_ASSERT( (*(ret.first)).first == 'x' ); + CPPUNIT_ASSERT( (*(ret.first)).second == 10 ); + CPPUNIT_ASSERT( ++(ret.first) == ret.second ); + } + { + { + maptype m; + + maptype::iterator i = m.lower_bound( 'x' ); + CPPUNIT_ASSERT( i == m.end() ); + + i = m.upper_bound( 'x' ); + CPPUNIT_ASSERT( i == m.end() ); + + pair ret; + ret = m.equal_range('x'); + CPPUNIT_ASSERT( ret.first == ret.second ); + CPPUNIT_ASSERT( ret.first == m.end() ); + } + + { + const maptype m; + pair ret; + ret = m.equal_range('x'); + CPPUNIT_ASSERT( ret.first == ret.second ); + CPPUNIT_ASSERT( ret.first == m.end() ); + } + } +} + +void MapTest::allocator_with_state() +{ + char buf1[1024]; + StackAllocator > stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator > stack2(buf2, buf2 + sizeof(buf2)); + + { + typedef map, StackAllocator > > MapInt; + less intLess; + MapInt mint1(intLess, stack1); + int i; + for (i = 0; i < 5; ++i) + mint1.insert(MapInt::value_type(i, i)); + MapInt mint1Cpy(mint1); + + MapInt mint2(intLess, stack2); + for (; i < 10; ++i) + mint2.insert(MapInt::value_type(i, i)); + MapInt mint2Cpy(mint2); + + mint1.swap(mint2); + + CPPUNIT_ASSERT( mint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( mint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( mint1 == mint2Cpy ); + CPPUNIT_ASSERT( mint2 == mint1Cpy ); + CPPUNIT_ASSERT( mint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( mint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); +} + +struct Key +{ + Key() : m_data(0) {} + explicit Key(int data) : m_data(data) {} + + int m_data; +}; + +struct KeyCmp +{ + bool operator () (Key lhs, Key rhs) const + { return lhs.m_data < rhs.m_data; } + + bool operator () (Key lhs, int rhs) const + { return lhs.m_data < rhs; } + + bool operator () (int lhs, Key rhs) const + { return lhs < rhs.m_data; } +}; + +struct KeyCmpPtr +{ + bool operator () (Key const volatile *lhs, Key const volatile *rhs) const + { return (*lhs).m_data < (*rhs).m_data; } + + bool operator () (Key const volatile *lhs, int rhs) const + { return (*lhs).m_data < rhs; } + + bool operator () (int lhs, Key const volatile *rhs) const + { return lhs < (*rhs).m_data; } +}; + +void MapTest::template_methods() +{ +#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION) + { + typedef map Container; + typedef Container::value_type value; + Container cont; + cont.insert(value(Key(1), 1)); + cont.insert(value(Key(2), 2)); + cont.insert(value(Key(3), 3)); + cont.insert(value(Key(4), 4)); + + CPPUNIT_ASSERT( cont.count(Key(1)) == 1 ); + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.end(), ccont.end()) ); + } + + { + typedef map Container; + typedef Container::value_type value; + Container cont; + Key key1(1), key2(2), key3(3), key4(4); + cont.insert(value(&key1, 1)); + cont.insert(value(&key2, 2)); + cont.insert(value(&key3, 3)); + cont.insert(value(&key4, 4)); + + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) ); + } + { + typedef multimap Container; + typedef Container::value_type value; + Container cont; + cont.insert(value(Key(1), 1)); + cont.insert(value(Key(2), 2)); + cont.insert(value(Key(3), 3)); + cont.insert(value(Key(4), 4)); + + CPPUNIT_ASSERT( cont.count(Key(1)) == 1 ); + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.end(), ccont.end()) ); + } + + { + typedef multimap Container; + typedef Container::value_type value; + Container cont; + Key key1(1), key2(2), key3(3), key4(4); + cont.insert(value(&key1, 1)); + cont.insert(value(&key2, 2)); + cont.insert(value(&key3, 3)); + cont.insert(value(&key4, 4)); + + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) ); + } +#endif +} + +#if !defined (STLPORT) || \ + !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (__DMC__) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + map instances; + typedef map::iterator it; + multimap minstances; + typedef multimap::iterator mit; +}; +# endif +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/math_aux.h b/reactos/lib/3rdparty/stlport/test/unit/math_aux.h new file mode 100644 index 00000000000..c1291af7bd2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/math_aux.h @@ -0,0 +1,30 @@ +#ifndef __MATH_AUX_H +#define __MATH_AUX_H + +#include + +#undef __STD +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +# define __STD std:: +#else +# define __STD +#endif + +/* + * This function is not only used to compare floating point values with a tolerance, + * it also leads to ambiguity problems if the called functions do not have the + * right prototype. + */ +template +bool are_equals(_Tp val, _Tp ref) { + if (val < ref) { + return (ref - val) <= __STD numeric_limits<_Tp>::epsilon(); + } + else { + return (val - ref) <= __STD numeric_limits<_Tp>::epsilon(); + } +} + +#undef __STD + +#endif // __MATH_AUX_H diff --git a/reactos/lib/3rdparty/stlport/test/unit/math_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/math_header_test.c new file mode 100644 index 00000000000..955749681c8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/math_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/max_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/max_test.cpp new file mode 100644 index 00000000000..d8ab006fa57 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/max_test.cpp @@ -0,0 +1,64 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MaxTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MaxTest); + CPPUNIT_TEST(max1); + CPPUNIT_TEST(max2); + CPPUNIT_TEST(maxelem1); + CPPUNIT_TEST(maxelem2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void max1(); + void max2(); + void maxelem1(); + void maxelem2(); + + static bool str_compare(const char* a_, const char* b_) + { return strcmp(a_, b_) < 0 ? 1 : 0; } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MaxTest); + +// +// tests implementation +// +void MaxTest::max1() +{ + int r = max(42, 100); + CPPUNIT_ASSERT( r == 100 ); + + int t = max(++r, 0); + CPPUNIT_ASSERT( t == 101 ); +} +void MaxTest::max2() +{ + const char* r = max((const char*)"shoe", (const char*)"shine", str_compare); + CPPUNIT_ASSERT(!strcmp(r, "shoe")); +} +void MaxTest::maxelem1() +{ + int numbers[6] = { 4, 10, 56, 11, -42, 19 }; + + int* r = max_element((int*)numbers, (int*)numbers + 6); + CPPUNIT_ASSERT(*r==56); +} +void MaxTest::maxelem2() +{ + const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" }; + + const unsigned namesCt = sizeof(names) / sizeof(names[0]); + const char** r = max_element((const char**)names, (const char**)names + namesCt, str_compare); + CPPUNIT_ASSERT(!strcmp(*r, "Todd")); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/memory_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/memory_header_test.cpp new file mode 100644 index 00000000000..afd9f05c6c9 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/memory_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/memory_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/memory_test.cpp new file mode 100644 index 00000000000..a1171095f21 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/memory_test.cpp @@ -0,0 +1,67 @@ +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MemoryTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MemoryTest); +#if defined (_STLP_MSVC) && (_STLP_MSVC < 1310) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(auto_ptr_test); + CPPUNIT_TEST_SUITE_END(); + +protected: + void auto_ptr_test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MemoryTest); + +#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1310) +auto_ptr CreateAutoPtr(int val) +{ return auto_ptr(new int(val)); } + +bool CheckEquality(auto_ptr pint, int val) +{ return *pint == val; } +#endif + +// +// tests implementation +// +void MemoryTest::auto_ptr_test() +{ +#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1310) + { + auto_ptr pint(new int(1)); + CPPUNIT_ASSERT( *pint == 1 ); + *pint = 2; + CPPUNIT_ASSERT( *pint == 2 ); + } + + { + auto_ptr pint(CreateAutoPtr(3)); + CPPUNIT_ASSERT( *pint == 3 ); + CPPUNIT_ASSERT( CheckEquality(pint, 3) ); + } + + { + auto_ptr pint(new int(2)); + CPPUNIT_ASSERT( *pint == 2 ); + } + { + auto_ptr pint(new int(2)); + CPPUNIT_ASSERT( *pint == 2 ); + } + { + auto_ptr pint(new int(2)); + CPPUNIT_ASSERT( *pint == 2 ); + } +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/merge_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/merge_test.cpp new file mode 100644 index 00000000000..7435b8fae78 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/merge_test.cpp @@ -0,0 +1,97 @@ +#include +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MergeTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MergeTest); + CPPUNIT_TEST(merge0); + CPPUNIT_TEST(merge1); + CPPUNIT_TEST(merge2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void merge0(); + void merge1(); + void merge2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MergeTest); + +// +// tests implementation +// +void MergeTest::merge0() +{ + int numbers1[5] = { 1, 6, 13, 25, 101 }; + int numbers2[5] = {-5, 26, 36, 46, 99 }; + + int result[10]; + merge((int*)numbers1, (int*)numbers1 + 5, (int*)numbers2, (int*)numbers2 + 5, (int*)result); + + CPPUNIT_ASSERT(result[0]==-5); + CPPUNIT_ASSERT(result[1]==1); + CPPUNIT_ASSERT(result[2]==6); + CPPUNIT_ASSERT(result[3]==13); + CPPUNIT_ASSERT(result[4]==25); + CPPUNIT_ASSERT(result[5]==26); + CPPUNIT_ASSERT(result[6]==36); + CPPUNIT_ASSERT(result[7]==46); + CPPUNIT_ASSERT(result[8]==99); + CPPUNIT_ASSERT(result[9]==101); +} +void MergeTest::merge1() +{ + vector v1(5); + vector v2(v1.size()); + __iota(v1.begin(), v1.end(), 0); + __iota(v2.begin(), v2.end(), 3); + + vector result(v1.size() + v2.size()); + merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin()); + + CPPUNIT_ASSERT(result[0]==0); + CPPUNIT_ASSERT(result[1]==1); + CPPUNIT_ASSERT(result[2]==2); + CPPUNIT_ASSERT(result[3]==3); + CPPUNIT_ASSERT(result[4]==3); + CPPUNIT_ASSERT(result[5]==4); + CPPUNIT_ASSERT(result[6]==4); + CPPUNIT_ASSERT(result[7]==5); + CPPUNIT_ASSERT(result[8]==6); + CPPUNIT_ASSERT(result[9]==7); + +} +void MergeTest::merge2() +{ + vector v1(5); + vector v2(v1.size()); + for (int i = 0; (size_t)i < v1.size(); ++i) { + v1[i] = 10 - i; + v2[i] = 7 - i; + } + vector result(v1.size() + v2.size()); + merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin(), greater() ); + + CPPUNIT_ASSERT(result[0]==10); + CPPUNIT_ASSERT(result[1]==9); + CPPUNIT_ASSERT(result[2]==8); + CPPUNIT_ASSERT(result[3]==7); + CPPUNIT_ASSERT(result[4]==7); + CPPUNIT_ASSERT(result[5]==6); + CPPUNIT_ASSERT(result[6]==6); + CPPUNIT_ASSERT(result[7]==5); + CPPUNIT_ASSERT(result[8]==4); + CPPUNIT_ASSERT(result[9]==3); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/messages_facets_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/messages_facets_test.cpp new file mode 100644 index 00000000000..610bbaaba3f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/messages_facets_test.cpp @@ -0,0 +1,85 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// tests implementation +// +void LocaleTest::messages_by_name() +{ + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new messages_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new messages_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + /* + try { + locale loc(locale::classic(), new messages_byname("")); + CPPUNIT_FAIL; + } + catch (runtime_error const& e) { + CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + */ + +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new messages_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new messages_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/mfunptr_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/mfunptr_test.cpp new file mode 100644 index 00000000000..d29d598fca2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/mfunptr_test.cpp @@ -0,0 +1,230 @@ +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MemFunPtrTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MemFunPtrTest); + CPPUNIT_TEST(mem_ptr_fun); +#if defined (STLPORT) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + //This test require partial template specialization feature to avoid the + //reference to reference problem. No workaround yet for limited compilers. + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(find); + CPPUNIT_TEST_SUITE_END(); + +protected: + // compile test not neccessary to run but... + void mem_ptr_fun(); + void find(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MemFunPtrTest); + +#if defined(_STLP_DONT_RETURN_VOID) && (defined(_STLP_NO_MEMBER_TEMPLATE_CLASSES) && defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)) +# define _STLP_DONT_TEST_RETURN_VOID +#endif +//else there is no workaround for the return void bug + +struct S1 { } s1; +struct S2 { } s2; + +int f1(S1&); +int f2(S1&, S2&); +int f1c(const S1&); +int f2c(const S1&, const S2&); + +void vf1(S1&); +void vf2(S1&, S2&); +void vf1c(const S1&); +void vf2c(const S1&, const S2&); + +class Class { +public: + int f0(); + int f1(const S1&); + + void vf0(); + void vf1(const S1&); + + int f0c() const; + int f1c(const S1&) const; + + void vf0c() const; + void vf1c(const S1&) const; +}; + +// +// tests implementation +// +void MemFunPtrTest::mem_ptr_fun() +{ + Class obj; + const Class& objc = obj; + + // ptr_fun + + ptr_fun(f1)(s1); + ptr_fun(f2)(s1, s2); + + ptr_fun(f1c)(s1); + ptr_fun(f2c)(s1, s2); + +#ifndef _STLP_DONT_TEST_RETURN_VOID + ptr_fun(vf1)(s1); + ptr_fun(vf2)(s1, s2); + + ptr_fun(vf1c)(s1); + ptr_fun(vf2c)(s1, s2); +#endif /* _STLP_DONT_TEST_RETURN_VOID */ + + // mem_fun + + mem_fun(&Class::f0)(&obj); + mem_fun(&Class::f1)(&obj, s1); + +#ifndef _STLP_DONT_TEST_RETURN_VOID + mem_fun(&Class::vf0)(&obj); + mem_fun(&Class::vf1)(&obj, s1); +#endif /* _STLP_DONT_TEST_RETURN_VOID */ + + // mem_fun (const) + + mem_fun(&Class::f0c)(&objc); + mem_fun(&Class::f1c)(&objc, s1); + +#ifndef _STLP_DONT_TEST_RETURN_VOID + mem_fun(&Class::vf0c)(&objc); + mem_fun(&Class::vf1c)(&objc, s1); +#endif /* _STLP_DONT_TEST_RETURN_VOID */ + + // mem_fun_ref + + mem_fun_ref(&Class::f0)(obj); + mem_fun_ref(&Class::f1)(obj, s1); + +#ifndef _STLP_DONT_TEST_RETURN_VOID + mem_fun_ref(&Class::vf0)(obj); + mem_fun_ref(&Class::vf1)(obj, s1); +#endif /* _STLP_DONT_TEST_RETURN_VOID */ + + // mem_fun_ref (const) + mem_fun_ref(&Class::f0c)(objc); + mem_fun_ref(&Class::f1c)(objc, s1); + +#ifndef _STLP_DONT_TEST_RETURN_VOID + mem_fun_ref(&Class::vf0c)(objc); + mem_fun_ref(&Class::vf1c)(objc, s1); +#endif /* _STLP_DONT_TEST_RETURN_VOID */ +} +int f1(S1&) +{return 1;} + +int f2(S1&, S2&) +{return 2;} + +int f1c(const S1&) +{return 1;} + +int f2c(const S1&, const S2&) +{return 2;} + +void vf1(S1&) +{} + +void vf2(S1&, S2&) +{} + +void vf1c(const S1&) +{} + +void vf2c(const S1&, const S2&) +{} + +int Class::f0() +{return 0;} + +int Class::f1(const S1&) +{return 1;} + +void Class::vf0() +{} + +void Class::vf1(const S1&) +{} + +int Class::f0c() const +{return 0;} + +int Class::f1c(const S1&) const +{return 1;} + +void Class::vf0c() const +{} + +void Class::vf1c(const S1&) const +{} + +struct V { + public: + V(int _v) : + v(_v) + { } + + bool f( int _v ) const { return (v == _v); } + + int v; +#if defined (__DMC__) + V(){} +#endif +}; + +void MemFunPtrTest::find() +{ +#if !defined (STLPORT) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + vector v; + + v.push_back( V(1) ); + v.push_back( V(2) ); + v.push_back( V(3) ); + + // step-by-step complication of work for compiler: + + // step 1: + const_mem_fun1_ref_t pmf = mem_fun_ref( &V::f ); + binder2nd > b(pmf, 2); + vector::iterator i = find_if( v.begin(), v.end(), b ); + CPPUNIT_ASSERT(i != v.end()); + CPPUNIT_ASSERT(i->v == 2); + + // step 2, just check that compiler understand what pass to bind2nd: + binder2nd > b2 = bind2nd( pmf, 2 ); + + // step 3, the same as step 1, but more intellect from compiler required: + binder2nd > b3 = bind2nd( mem_fun_ref( &V::f ), 2 ); + + vector::iterator j = find_if( v.begin(), v.end(), b3 ); + CPPUNIT_ASSERT(j != v.end()); + CPPUNIT_ASSERT(j->v == 2); + + // step 4, more brief, more complex: + vector::iterator k = find_if( v.begin(), v.end(), bind2nd( mem_fun_ref( &V::f ), 2 ) ); + CPPUNIT_ASSERT(k != v.end()); + CPPUNIT_ASSERT(k->v == 2); +#endif +} + +#ifdef _STLP_DONT_TEST_RETURN_VOID +# undef _STLP_DONT_TEST_RETURN_VOID +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/min_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/min_test.cpp new file mode 100644 index 00000000000..2f45ade419f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/min_test.cpp @@ -0,0 +1,62 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MinTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MinTest); + CPPUNIT_TEST(min1); + CPPUNIT_TEST(min2); + CPPUNIT_TEST(minelem1); + CPPUNIT_TEST(minelem2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void min1(); + void min2(); + void minelem1(); + void minelem2(); + static bool str_compare(const char* a_, const char* b_) + { return strcmp(a_, b_) < 0 ? 1 : 0; } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MinTest); + +// +// tests implementation +// +void MinTest::min1() +{ + int r = min(42, 100); + CPPUNIT_ASSERT( r == 42 ); + + r = min(--r, r); + CPPUNIT_ASSERT( r == 41 ); +} +void MinTest::min2() +{ + const char* r = min((const char*)"shoe", (const char*)"shine", str_compare); + CPPUNIT_ASSERT(!strcmp(r, "shine")); +} +void MinTest::minelem1() +{ + int numbers[6] = { -10, 15, -100, 36, -242, 42 }; + int* r = min_element((int*)numbers, (int*)numbers + 6); + CPPUNIT_ASSERT(*r==-242); +} +void MinTest::minelem2() +{ + const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" }; + + const unsigned namesCt = sizeof(names) / sizeof(names[0]); + const char** r = min_element((const char**)names, (const char**)names + namesCt, str_compare); + CPPUNIT_ASSERT(!strcmp(*r, "Brett")); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/mismatch_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/mismatch_test.cpp new file mode 100644 index 00000000000..13f7cd0588c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/mismatch_test.cpp @@ -0,0 +1,82 @@ +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MismatchTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MismatchTest); + CPPUNIT_TEST(mismatch0); + CPPUNIT_TEST(mismatch1); + CPPUNIT_TEST(mismatch2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void mismatch0(); + void mismatch1(); + void mismatch2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MismatchTest); + +// +// tests implementation +// +bool str_equal(const char* a_, const char* b_) +{ + return strcmp(a_, b_) == 0 ? 1 : 0; +} +void MismatchTest::mismatch0() +{ + int n1[5] = { 1, 2, 3, 4, 5 }; + int n2[5] = { 1, 2, 3, 4, 5 }; + int n3[5] = { 1, 2, 3, 2, 1 }; + + pair result = mismatch((int*)n1, (int*)n1 + 5, (int*)n2); + CPPUNIT_ASSERT(result.first ==(n1 + 5) && result.second ==(n2 + 5)); + + result = mismatch((int*)n1, (int*)n1 + 5, (int*)n3); + CPPUNIT_ASSERT(!(result.first ==(n1 + 5) && result.second ==(n3 + 5))); + CPPUNIT_ASSERT((result.first - n1)==3); +} +void MismatchTest::mismatch1() +{ + typedef vector IntVec; + IntVec v1(10); + __iota(v1.begin(), v1.end(), 0); + IntVec v2(v1); + + pair result = mismatch(v1.begin(), v1.end(), v2.begin()); + + CPPUNIT_ASSERT(result.first == v1.end() && result.second == v2.end()); + + v2[v2.size()/2] = 42; + result = mismatch(v1.begin(), v1.end(), v2.begin()); + CPPUNIT_ASSERT(!(result.first == v1.end() && result.second == v2.end())); + CPPUNIT_ASSERT((result.first - v1.begin())==5); +} +void MismatchTest::mismatch2() +{ + const unsigned size = 5; + char const* n1[size] = { "Brett", "Graham", "Jack", "Mike", "Todd" }; + + char const* n2[size]; + copy(n1, n1 + 5, (char const**)n2); + pair result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal); + + CPPUNIT_ASSERT(result.first == n1 + size && result.second == n2 + size); + + n2[2] = "QED"; + result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal); + CPPUNIT_ASSERT(!(result.first == n2 + size && result.second == n2 + size)); + CPPUNIT_ASSERT((result.first - n1)==2); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/modulus_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/modulus_test.cpp new file mode 100644 index 00000000000..2fab979a98a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/modulus_test.cpp @@ -0,0 +1,40 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class ModulusTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ModulusTest); + CPPUNIT_TEST(modulus0); + CPPUNIT_TEST_SUITE_END(); + +protected: + void modulus0(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ModulusTest); + +// +// tests implementation +// +void ModulusTest::modulus0() +{ + int input1 [4] = { 6, 8, 10, 2 }; + int input2 [4] = { 4, 2, 11, 3 }; + + int output [4]; + + transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, modulus()); + CPPUNIT_ASSERT(output[0]==2); + CPPUNIT_ASSERT(output[1]==0); + CPPUNIT_ASSERT(output[2]==10); + CPPUNIT_ASSERT(output[3]==2); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/money_facets_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/money_facets_test.cpp new file mode 100644 index 00000000000..5ace7709334 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/money_facets_test.cpp @@ -0,0 +1,655 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +struct ref_monetary { + const char *name; + const char *money_int_prefix; + const char *money_int_prefix_old; + const char *money_prefix; + const char *money_suffix; + const char *money_decimal_point; + const char *money_thousands_sep; +}; + +static const ref_monetary tested_locales[] = { +//{ name, money_int_prefix, money_int_prefix_old, money_prefix, money_suffix, money_decimal_point, money_thousands_sep}, +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + { "fr_FR", "EUR ", "FRF ", "", "", ",", +# if defined (WIN32) || defined (_WIN32) + "\xa0" }, +# else + " " }, +# endif + { "ru_RU.koi8r", "RUB ", "RUR ", "", "\xd2\xd5\xc2", ".", " " }, + { "en_GB", "GBP ", "", "\xa3", "", ".", "," }, + { "en_US", "USD ", "", "$", "", ".", "," }, +# endif + { "C", "", "", "", "", " ", " " }, +}; + + +const ref_monetary* LocaleTest::_get_ref_monetary(size_t i) +{ + if (i < sizeof(tested_locales) / sizeof(tested_locales[0])) { + return tested_locales + i; + } + return 0; +} + +const char* LocaleTest::_get_ref_monetary_name(const ref_monetary* _ref) +{ + return _ref->name; +} + +void LocaleTest::_money_put_get( const locale& loc, const ref_monetary* rl ) +{ + _money_put_get2(loc, loc, rl); +} + +void LocaleTest::_money_put_get2( const locale& loc, const locale& streamLoc, const ref_monetary* prl ) +{ + const ref_monetary &rl = *prl; + CPPUNIT_ASSERT( has_facet >(loc) ); + money_put const& fmp = use_facet >(loc); + CPPUNIT_ASSERT( has_facet >(loc) ); + money_get const& fmg = use_facet >(loc); + + ostringstream ostr; + ostr.imbue(streamLoc); + ostr << showbase; + + //Check a positive value (international format) + { + string str_res; + //money_put + { + CPPUNIT_ASSERT( (has_facet >(loc)) ); + moneypunct const& intl_fmp = use_facet >(loc); + + ostreambuf_iterator > res = fmp.put(ostr, true, ostr, ' ', 123456); + + CPPUNIT_ASSERT( !res.failed() ); + str_res = ostr.str(); + //CPPUNIT_MESSAGE(str_res.c_str()); + + size_t fieldIndex = 0; + size_t index = 0; + + //On a positive value we skip the sign field if exists: + if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { + ++fieldIndex; + } + // international currency abbreviation, if it is before value + + /* + * int_curr_symbol + * + * The international currency symbol. The operand is a four-character + * string, with the first three characters containing the alphabetic + * international currency symbol in accordance with those specified + * in the ISO 4217 specification. The fourth character is the character used + * to separate the international currency symbol from the monetary quantity. + * + * (http://www.opengroup.org/onlinepubs/7990989775/xbd/locale.html) + */ + string::size_type p = strlen( rl.money_int_prefix ); + if (p != 0) { + CPPUNIT_ASSERT( intl_fmp.pos_format().field[fieldIndex] == money_base::symbol ); + string::size_type p_old = strlen( rl.money_int_prefix_old ); + CPPUNIT_ASSERT( (str_res.substr(index, p) == rl.money_int_prefix) || + ((p_old != 0) && + (str_res.substr(index, p_old) == rl.money_int_prefix_old)) ); + if ( str_res.substr(index, p) == rl.money_int_prefix ) { + index += p; + } else { + index += p_old; + } + ++fieldIndex; + } + + // space after currency + if (intl_fmp.pos_format().field[fieldIndex] == money_base::space || + intl_fmp.pos_format().field[fieldIndex] == money_base::none) { + // iternational currency symobol has four chars, one of these chars + // is separator, so if format has space on this place, it should + // be skipped. + ++fieldIndex; + } + + // sign + if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { + ++fieldIndex; + } + + // value + CPPUNIT_ASSERT( str_res[index++] == '1' ); + if (!intl_fmp.grouping().empty()) { + CPPUNIT_ASSERT( str_res[index++] == /* intl_fmp.thousands_sep() */ *rl.money_thousands_sep ); + } + CPPUNIT_ASSERT( str_res[index++] == '2' ); + CPPUNIT_ASSERT( str_res[index++] == '3' ); + CPPUNIT_ASSERT( str_res[index++] == '4' ); + if (intl_fmp.frac_digits() != 0) { + CPPUNIT_ASSERT( str_res[index++] == /* intl_fmp.decimal_point() */ *rl.money_decimal_point ); + } + CPPUNIT_ASSERT( str_res[index++] == '5' ); + CPPUNIT_ASSERT( str_res[index++] == '6' ); + ++fieldIndex; + + // sign + if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { + ++fieldIndex; + } + + // space + if (intl_fmp.pos_format().field[fieldIndex] == money_base::space ) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + + // sign + if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { + ++fieldIndex; + } + + //as space cannot be last the only left format can be none: + while ( fieldIndex < 3 ) { + CPPUNIT_ASSERT( intl_fmp.pos_format().field[fieldIndex] == money_base::none ); + ++fieldIndex; + } + } + + //money_get + { + ios_base::iostate err = ios_base::goodbit; + string digits; + + istringstream istr(str_res); + ostr.str( "" ); + ostr.clear(); + fmg.get(istr, istreambuf_iterator >(), true, ostr, err, digits); + CPPUNIT_ASSERT( (err & (ios_base::failbit | ios_base::badbit)) == 0 ); + CPPUNIT_ASSERT( digits == "123456" ); + } + } + + ostr.str(""); + //Check a negative value (national format) + { + CPPUNIT_ASSERT( (has_facet >(loc)) ); + moneypunct const& dom_fmp = use_facet >(loc); + string str_res; + //Check money_put + { + ostreambuf_iterator > res = fmp.put(ostr, false, ostr, ' ', -123456); + + CPPUNIT_ASSERT( !res.failed() ); + str_res = ostr.str(); + //CPPUNIT_MESSAGE(str_res.c_str()); + + size_t fieldIndex = 0; + size_t index = 0; + + if (dom_fmp.neg_format().field[fieldIndex] == money_base::sign) { + CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.negative_sign().size()) == dom_fmp.negative_sign() ); + index += dom_fmp.negative_sign().size(); + ++fieldIndex; + } + + string::size_type p = strlen( rl.money_prefix ); + if (p != 0) { + CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix ); + index += p; + ++fieldIndex; + } + if (dom_fmp.neg_format().field[fieldIndex] == money_base::space || + dom_fmp.neg_format().field[fieldIndex] == money_base::none) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + + CPPUNIT_ASSERT( str_res[index++] == '1' ); + if (!dom_fmp.grouping().empty()) { + CPPUNIT_ASSERT( str_res[index++] == dom_fmp.thousands_sep() ); + } + CPPUNIT_ASSERT( str_res[index++] == '2' ); + CPPUNIT_ASSERT( str_res[index++] == '3' ); + CPPUNIT_ASSERT( str_res[index++] == '4' ); + if (dom_fmp.frac_digits() != 0) { + CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() ); + } + CPPUNIT_ASSERT( str_res[index++] == '5' ); + CPPUNIT_ASSERT( str_res[index++] == '6' ); + ++fieldIndex; + + //space cannot be last: + if ((fieldIndex < 3) && + dom_fmp.neg_format().field[fieldIndex] == money_base::space) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + + if (fieldIndex == 3) { + //If none is last we should not add anything to the resulting string: + if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) { + CPPUNIT_ASSERT( index == str_res.size() ); + } else { + CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol ); + CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix ); + } + } + } + + //money_get + { + ios_base::iostate err = ios_base::goodbit; +# if defined (STLPORT) + _STLP_LONGEST_FLOAT_TYPE val; +# else + long double val; +# endif + + istringstream istr(str_res); + fmg.get(istr, istreambuf_iterator >(), false, ostr, err, val); + CPPUNIT_ASSERT( (err & (ios_base::failbit | ios_base::badbit)) == 0 ); + if (dom_fmp.negative_sign().empty()) { + //Without negative sign there is no way to guess the resulting amount sign ("C" locale): + CPPUNIT_ASSERT( val == 123456 ); + } + else { + CPPUNIT_ASSERT( val == -123456 ); + } + } + } +} + + +// Test for bug in case when number of digits in value less then number +// of digits in fraction. I.e. '9' should be printed as '0.09', +// if x.frac_digits() == 2. + +void LocaleTest::_money_put_X_bug( const locale& loc, const ref_monetary* prl ) +{ + const ref_monetary &rl = *prl; + CPPUNIT_ASSERT( has_facet >(loc) ); + money_put const& fmp = use_facet >(loc); + + ostringstream ostr; + ostr.imbue(loc); + ostr << showbase; + + // ostr.str(""); + // Check value with one decimal digit: + { + CPPUNIT_ASSERT( (has_facet >(loc)) ); + moneypunct const& dom_fmp = use_facet >(loc); + string str_res; + // Check money_put + { + ostreambuf_iterator > res = fmp.put(ostr, false, ostr, ' ', 9); + + CPPUNIT_ASSERT( !res.failed() ); + str_res = ostr.str(); + + size_t fieldIndex = 0; + size_t index = 0; + + if (dom_fmp.pos_format().field[fieldIndex] == money_base::sign) { + CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.positive_sign().size()) == dom_fmp.positive_sign() ); + index += dom_fmp.positive_sign().size(); + ++fieldIndex; + } + + string::size_type p = strlen( rl.money_prefix ); + if (p != 0) { + CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix ); + index += p; + ++fieldIndex; + } + if (dom_fmp.neg_format().field[fieldIndex] == money_base::space || + dom_fmp.neg_format().field[fieldIndex] == money_base::none) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + if (dom_fmp.frac_digits() != 0) { + CPPUNIT_ASSERT( str_res[index++] == '0' ); + CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() ); + for ( int fd = 1; fd < dom_fmp.frac_digits(); ++fd ) { + CPPUNIT_ASSERT( str_res[index++] == '0' ); + } + } + CPPUNIT_ASSERT( str_res[index++] == '9' ); + ++fieldIndex; + + //space cannot be last: + if ((fieldIndex < 3) && + dom_fmp.neg_format().field[fieldIndex] == money_base::space) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + + if (fieldIndex == 3) { + //If none is last we should not add anything to the resulting string: + if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) { + CPPUNIT_ASSERT( index == str_res.size() ); + } else { + CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol ); + CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix ); + } + } + } + } + + ostr.str(""); + // Check value with two decimal digit: + { + CPPUNIT_ASSERT( (has_facet >(loc)) ); + moneypunct const& dom_fmp = use_facet >(loc); + string str_res; + // Check money_put + { + ostreambuf_iterator > res = fmp.put(ostr, false, ostr, ' ', 90); + + CPPUNIT_ASSERT( !res.failed() ); + str_res = ostr.str(); + + size_t fieldIndex = 0; + size_t index = 0; + + if (dom_fmp.pos_format().field[fieldIndex] == money_base::sign) { + CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.positive_sign().size()) == dom_fmp.positive_sign() ); + index += dom_fmp.positive_sign().size(); + ++fieldIndex; + } + + string::size_type p = strlen( rl.money_prefix ); + if (p != 0) { + CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix ); + index += p; + ++fieldIndex; + } + if (dom_fmp.neg_format().field[fieldIndex] == money_base::space || + dom_fmp.neg_format().field[fieldIndex] == money_base::none) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + if (dom_fmp.frac_digits() != 0) { + CPPUNIT_ASSERT( str_res[index++] == '0' ); + CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() ); + for ( int fd = 1; fd < dom_fmp.frac_digits() - 1; ++fd ) { + CPPUNIT_ASSERT( str_res[index++] == '0' ); + } + } + CPPUNIT_ASSERT( str_res[index++] == '9' ); + if (dom_fmp.frac_digits() != 0) { + CPPUNIT_ASSERT( str_res[index++] == '0' ); + } + ++fieldIndex; + + //space cannot be last: + if ((fieldIndex < 3) && + dom_fmp.neg_format().field[fieldIndex] == money_base::space) { + CPPUNIT_ASSERT( str_res[index++] == ' ' ); + ++fieldIndex; + } + + if (fieldIndex == 3) { + //If none is last we should not add anything to the resulting string: + if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) { + CPPUNIT_ASSERT( index == str_res.size() ); + } else { + CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol ); + CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix ); + } + } + } + } +} + +typedef void (LocaleTest::*_Test) (const locale&, const ref_monetary*); +static void test_supported_locale(LocaleTest& inst, _Test __test) { + size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]); + for (size_t i = 0; i < n; ++i) { + locale loc; +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try +# endif + { + locale tmp(tested_locales[i].name); + loc = tmp; + } +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + catch (runtime_error const&) { + //This locale is not supported. + continue; + } +# endif + CPPUNIT_MESSAGE( loc.name().c_str() ); + (inst.*__test)(loc, tested_locales + i); + + { + locale tmp(locale::classic(), tested_locales[i].name, locale::monetary); + loc = tmp; + } + (inst.*__test)(loc, tested_locales + i); + + { + locale tmp0(locale::classic(), new moneypunct_byname(tested_locales[i].name)); + locale tmp1(tmp0, new moneypunct_byname(tested_locales[i].name)); + loc = tmp1; + } + (inst.*__test)(loc, tested_locales + i); + } +} + +void LocaleTest::money_put_get() +{ test_supported_locale(*this, &LocaleTest::_money_put_get); } + +void LocaleTest::money_put_X_bug() +{ test_supported_locale(*this, &LocaleTest::_money_put_X_bug); } + +void LocaleTest::moneypunct_by_name() +{ + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new moneypunct_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new moneypunct_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string veryLongFacetName("LC_MONETARY="); + veryLongFacetName.append(512, '?'); + locale loc(locale::classic(), new moneypunct_byname(veryLongFacetName.c_str())); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new moneypunct_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new moneypunct_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string veryLongFacetName("LC_MONETARY="); + veryLongFacetName.append(512, '?'); + locale loc(locale::classic(), new moneypunct_byname(veryLongFacetName.c_str())); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new moneypunct_byname("C")); + moneypunct const& cfacet_byname = use_facet >(loc); + moneypunct const& cfacet = use_facet >(locale::classic()); + + money_base::pattern cp = cfacet.pos_format(); + money_base::pattern cp_bn = cfacet_byname.pos_format(); + CPPUNIT_CHECK( cp_bn.field[0] == cp.field[0] ); + CPPUNIT_CHECK( cp_bn.field[1] == cp.field[1] ); + CPPUNIT_CHECK( cp_bn.field[2] == cp.field[2] ); + CPPUNIT_CHECK( cp_bn.field[3] == cp.field[3] ); + + CPPUNIT_CHECK( cfacet_byname.frac_digits() == cfacet.frac_digits() ); + if (cfacet_byname.frac_digits() != 0) + CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() ); + CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() ); + if (!cfacet_byname.grouping().empty()) + CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() ); + CPPUNIT_CHECK( cfacet_byname.positive_sign() == cfacet.positive_sign() ); + CPPUNIT_CHECK( cfacet_byname.negative_sign() == cfacet.negative_sign() ); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new moneypunct_byname("C")); + moneypunct const& cfacet_byname = use_facet >(loc); + moneypunct const& cfacet = use_facet >(locale::classic()); + + money_base::pattern cp = cfacet.pos_format(); + money_base::pattern cp_bn = cfacet_byname.pos_format(); + CPPUNIT_CHECK( cp_bn.field[0] == cp.field[0] ); + CPPUNIT_CHECK( cp_bn.field[1] == cp.field[1] ); + CPPUNIT_CHECK( cp_bn.field[2] == cp.field[2] ); + CPPUNIT_CHECK( cp_bn.field[3] == cp.field[3] ); + + CPPUNIT_CHECK( cfacet_byname.frac_digits() == cfacet.frac_digits() ); + if (cfacet_byname.frac_digits() != 0) + CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() ); + CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() ); + if (!cfacet_byname.grouping().empty()) + CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() ); + CPPUNIT_CHECK( cfacet_byname.positive_sign() == cfacet.positive_sign() ); + CPPUNIT_CHECK( cfacet_byname.negative_sign() == cfacet.negative_sign() ); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" locale facet. + locale loc(locale::classic(), new moneypunct_byname("")); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new moneypunct_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new moneypunct_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new moneypunct_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new moneypunct_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/multiset_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/multiset_test.cpp new file mode 100644 index 00000000000..3e30917839b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/multiset_test.cpp @@ -0,0 +1,127 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class MultisetTest : public CPPUNIT_NS::TestCase +{ + typedef multiset > mset; + + CPPUNIT_TEST_SUITE(MultisetTest); + CPPUNIT_TEST(mset1); + CPPUNIT_TEST(mset3); + CPPUNIT_TEST(mset5); + CPPUNIT_TEST_SUITE_END(); + +protected: + void mset1(); + void mset3(); + void mset5(); + + static bool less_than(int a_, int b_) + { + return a_ < b_; + } + + static bool greater_than(int a_, int b_) + { + return a_ > b_; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MultisetTest); + +// +// tests implementation +// +void MultisetTest::mset1() +{ + mset s; + CPPUNIT_ASSERT(s.count(42) == 0); + s.insert(42); + CPPUNIT_ASSERT(s.count(42) == 1); + s.insert(42); + CPPUNIT_ASSERT(s.count(42) == 2); + + mset::iterator i = s.find(40); + CPPUNIT_ASSERT(i == s.end()); + + i = s.find(42); + CPPUNIT_ASSERT(i != s.end()); + size_t count = s.erase(42); + CPPUNIT_ASSERT(count == 2); +} +void MultisetTest::mset3() +{ + int array [] = { 3, 6, 1, 2, 3, 2, 6, 7, 9 }; + + //Check iterator on a mutable set + mset s(array, array + 9); + mset::iterator i; + i = s.lower_bound(3); + CPPUNIT_ASSERT(*i == 3); + i = s.upper_bound(3); + CPPUNIT_ASSERT(*i == 6); + pair p = s.equal_range(5); + CPPUNIT_ASSERT(*(p.first) == 6); + CPPUNIT_ASSERT(*(p.second) == 6); + + //Check const_iterator on a mutable multiset + mset::const_iterator ci; + ci = s.lower_bound(3); + CPPUNIT_ASSERT(*ci == 3); + ci = s.upper_bound(3); + CPPUNIT_ASSERT(*ci == 6); + pair cp; +#ifdef _STLP_MEMBER_TEMPLATES + cp = s.equal_range(5); + CPPUNIT_ASSERT(*(cp.first) == 6); + CPPUNIT_ASSERT(*(cp.second) == 6); +#endif + + //Check const_iterator on a const multiset + mset const& crs = s; + ci = crs.lower_bound(3); + CPPUNIT_ASSERT(*ci == 3); + ci = crs.upper_bound(3); + CPPUNIT_ASSERT(*ci == 6); + cp = crs.equal_range(5); + CPPUNIT_ASSERT(*(cp.first) == 6); + CPPUNIT_ASSERT(*(cp.second) == 6); +} +void MultisetTest::mset5() +{ + int array [] = { 3, 6, 1, 9 }; + int j; + + typedef pointer_to_binary_function fn_type; + typedef multiset > fn_mset; + + fn_type f(less_than); + fn_mset s1(array+0, array + 4 , f ); + fn_mset::const_iterator i = s1.begin(); + for (j = 0; i != s1.end(); ++i, ++j) { + CPPUNIT_ASSERT(j != 0 || *i == 1); + CPPUNIT_ASSERT(j != 1 || *i == 3); + CPPUNIT_ASSERT(j != 2 || *i == 6); + CPPUNIT_ASSERT(j != 3 || *i == 9); + } + + fn_type g(greater_than); + fn_mset s2(array, array + 4, g); + i = s2.begin(); + for (j = 0; i != s2.end(); ++i, ++j) { + CPPUNIT_ASSERT(j != 0 || *i == 9); + CPPUNIT_ASSERT(j != 1 || *i == 6); + CPPUNIT_ASSERT(j != 2 || *i == 3); + CPPUNIT_ASSERT(j != 3 || *i == 1); + } + +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/mvctor_declaration_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/mvctor_declaration_test.cpp new file mode 100644 index 00000000000..cb6f8a386b8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/mvctor_declaration_test.cpp @@ -0,0 +1,369 @@ +#include +#include +#include +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +#endif +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +#endif +#include +#include +#include +#include +#if defined (STLPORT) +# include +# include +#endif +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +# include +#endif +#include +#include + +#include "mvctor_test.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# if defined (STLPORT) +using namespace std::tr1; +# endif +#endif + +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + +# if defined (__GNUC__) && defined (_STLP_USE_NAMESPACES) +// libstdc++ sometimes exposed its own __true_type in +// global namespace resulting in an ambiguity. +# define __true_type std::__true_type +# define __false_type std::__false_type +# endif + +static bool type_to_bool(__true_type) +{ return true; } +static bool type_to_bool(__false_type) +{ return false; } + +template +static bool is_movable(const _Tp&) { + typedef typename __move_traits<_Tp>::implemented _MovableTp; + return type_to_bool(_MovableTp()); +} + +template +static bool is_move_complete(const _Tp&) { + typedef __move_traits<_Tp> _TpMoveTraits; + typedef typename _TpMoveTraits::complete _TpMoveComplete; + return type_to_bool(_TpMoveComplete()); +} + +struct specially_allocated_struct { + bool operator < (const specially_allocated_struct&) const; +# if defined (__DMC__) // slist<_Tp,_Alloc>::remove error + bool operator==(const specially_allocated_struct&) const; +# endif +}; + +#if defined (__DMC__) +bool specially_allocated_struct::operator < (const specially_allocated_struct&) const +{ return false; } +#endif + +struct struct_with_specialized_less {}; + +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + class allocator { + //This allocator just represent what a STLport could do and in this + //case the STL containers implemented with it should still be movable + //but not completely as we cannot do any hypothesis on what is in this + //allocator. + public: + typedef specially_allocated_struct value_type; + typedef value_type * pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template struct rebind { + typedef allocator<_Tp1> other; + }; +# endif + allocator() _STLP_NOTHROW {} +# if defined (_STLP_MEMBER_TEMPLATES) + template allocator(const allocator<_Tp1>&) _STLP_NOTHROW {} +# endif + allocator(const allocator&) _STLP_NOTHROW {} + ~allocator() _STLP_NOTHROW {} + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + pointer allocate(size_type, const void* = 0) { return 0; } + void deallocate(pointer, size_type) {} + size_type max_size() const _STLP_NOTHROW { return 0; } + void construct(pointer, const_reference) {} + void destroy(pointer) {} + }; + + _STLP_TEMPLATE_NULL + struct less { + bool operator() (struct_with_specialized_less const&, + struct_with_specialized_less const&) const; + }; + +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564) + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; + _STLP_TEMPLATE_NULL + struct __move_traits > { + typedef __true_type implemented; + typedef __false_type complete; + }; +# endif +# endif +# endif + +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +void MoveConstructorTest::movable_declaration() +{ +#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \ + !defined (_STLP_NO_MOVE_SEMANTIC) + //This test purpose is to check correct detection of the STL movable + //traits declaration + { + //string, wstring: + CPPUNIT_ASSERT( is_movable(string()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(string()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(string()) ); +# endif +# if defined (_STLP_HAS_WCHAR_T) + CPPUNIT_ASSERT( is_movable(wstring()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(wstring()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(wstring()) ); +# endif +# endif + } + +# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + { + //crope, wrope: + CPPUNIT_ASSERT( is_movable(crope()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(crope()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(crope()) ); +# endif +# if defined (_STLP_HAS_WCHAR_T) + CPPUNIT_ASSERT( is_movable(wrope()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(wrope()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(wrope()) ); +# endif +# endif + } +# endif + + { + //vector: + CPPUNIT_ASSERT( is_movable(vector()) ); + CPPUNIT_ASSERT( is_movable(vector()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(vector()) ); + CPPUNIT_ASSERT( !is_move_complete(vector()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(vector()) ); +# endif + } + + { + //deque: + CPPUNIT_ASSERT( is_movable(deque()) ); + CPPUNIT_ASSERT( is_movable(deque()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(deque()) ); + CPPUNIT_ASSERT( !is_move_complete(deque()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(deque()) ); +# endif + } + + { + //list: + CPPUNIT_ASSERT( is_movable(list()) ); + CPPUNIT_ASSERT( is_movable(list()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(list()) ); + CPPUNIT_ASSERT( !is_move_complete(list()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(list()) ); +# endif + } + +# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + { + //slist: + CPPUNIT_ASSERT( is_movable(slist()) ); + CPPUNIT_ASSERT( is_movable(slist()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(slist()) ); + CPPUNIT_ASSERT( !is_move_complete(slist()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(slist()) ); +# endif + } +# endif + + { + //queue: + CPPUNIT_ASSERT( is_movable(queue()) ); + CPPUNIT_ASSERT( is_movable(queue()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(queue()) ); + CPPUNIT_ASSERT( !is_move_complete(queue()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(queue()) ); +# endif + } + + { + //stack: + CPPUNIT_ASSERT( is_movable(stack()) ); + CPPUNIT_ASSERT( is_movable(stack()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(stack()) ); + CPPUNIT_ASSERT( !is_move_complete(stack()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(stack()) ); +# endif + } + +#endif +} + +void MoveConstructorTest::movable_declaration_assoc() +{ +#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \ + !defined (_STLP_NO_MOVE_SEMANTIC) + { + //associative containers, set multiset, map, multimap: + + //For associative containers it is important that less is correctly recognize as + //the STLport less or a user specialized less: +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(less()) ); +# endif + CPPUNIT_ASSERT( !is_move_complete(less()) ); + + //set + CPPUNIT_ASSERT( is_movable(set()) ); + CPPUNIT_ASSERT( is_movable(set()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(set()) ); + CPPUNIT_ASSERT( !is_move_complete(set()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(set()) ); +# endif + + //multiset + CPPUNIT_ASSERT( is_movable(multiset()) ); + CPPUNIT_ASSERT( is_movable(multiset()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(multiset()) ); + CPPUNIT_ASSERT( !is_move_complete(multiset()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(multiset()) ); +# endif + + //map + CPPUNIT_ASSERT( is_movable(map()) ); + CPPUNIT_ASSERT( is_movable(map()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(map()) ); + //Here even if allocator has been specialized for specially_allocated_struct + //this pecialization won't be used in default map instanciation as the default + //allocator is allocator > + CPPUNIT_ASSERT( is_move_complete(map()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(map()) ); +# endif + + //multimap + CPPUNIT_ASSERT( is_movable(multimap()) ); + CPPUNIT_ASSERT( is_movable(multimap()) ); +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( is_move_complete(multimap()) ); + //Idem map remark + CPPUNIT_ASSERT( is_move_complete(multimap()) ); +# else + CPPUNIT_ASSERT( !is_move_complete(multimap()) ); +# endif + } +#endif +} + +void MoveConstructorTest::movable_declaration_hash() +{ +#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \ + !defined (_STLP_NO_MOVE_SEMANTIC) + { + //hashed containers, unordered_set unordered_multiset, unordered_map, unordered_multimap, + // hash_set, hash_multiset, hash_map, hash_multimap: + + //We only check that they are movable, completness is not yet supported + CPPUNIT_ASSERT( is_movable(unordered_set()) ); + CPPUNIT_ASSERT( is_movable(unordered_multiset()) ); + CPPUNIT_ASSERT( is_movable(unordered_map()) ); + CPPUNIT_ASSERT( is_movable(unordered_multimap()) ); +# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + CPPUNIT_ASSERT( is_movable(hash_set()) ); + CPPUNIT_ASSERT( is_movable(hash_multiset()) ); + CPPUNIT_ASSERT( is_movable(hash_map()) ); + CPPUNIT_ASSERT( is_movable(hash_multimap()) ); +# endif + } +#endif +} + diff --git a/reactos/lib/3rdparty/stlport/test/unit/mvctor_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/mvctor_test.cpp new file mode 100644 index 00000000000..ddac32f072c --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/mvctor_test.cpp @@ -0,0 +1,816 @@ +#include +#include +#include +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +#endif +#include +#include +#include +#if defined (STLPORT) +# include +#endif + +#include "mvctor_test.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# if defined (STLPORT) +using namespace std::tr1; +# endif +#endif + +CPPUNIT_TEST_SUITE_REGISTRATION(MoveConstructorTest); + +// +// tests implementation +// +void MoveConstructorTest::move_construct_test() +{ + //cout << "vector>"; + vector const ref_vec(10, 0); + vector > v_v_ints(1, ref_vec); + +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + int *pint = &(v_v_ints.front().front()); +#endif + + size_t cur_capacity = v_v_ints.capacity(); + while (v_v_ints.capacity() <= cur_capacity) { + v_v_ints.push_back(ref_vec); + } + + //v_v_ints has been resized +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT((pint == &v_v_ints.front().front())); +#endif + + //cout << "vector>::erase"; + //We need at least 3 elements: + while (v_v_ints.size() < 3) { + v_v_ints.push_back(ref_vec); + } + + //We erase the 2nd +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + pint = &v_v_ints[2].front(); +#endif + v_v_ints.erase(v_v_ints.begin() + 1); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT((pint == &v_v_ints[1].front())); +#endif + + //cout << "vector"; + string const ref_str("ref string, big enough to be a dynamic one"); + vector vec_strs(1, ref_str); + +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + char const* pstr = vec_strs.front().c_str(); +#endif + cur_capacity = vec_strs.capacity(); + while (vec_strs.capacity() <= cur_capacity) { + vec_strs.push_back(ref_str); + } + + //vec_str has been resized +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT((pstr == vec_strs.front().c_str())); +#endif + + //cout << "vector::erase"; + //We need at least 3 elements: + while (vec_strs.size() < 3) { + vec_strs.push_back(ref_str); + } + + //We erase the 2nd +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + pstr = vec_strs[2].c_str(); +#endif + vec_strs.erase(vec_strs.begin() + 1); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT((pstr == vec_strs[1].c_str())); +#endif + + //cout << "swap(vector, vector)"; + vector elem1(10, 0), elem2(10, 0); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + int *p1 = &elem1.front(); + int *p2 = &elem2.front(); +#endif + swap(elem1, elem2); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT(((p1 == &elem2.front()) && (p2 == &elem1.front()))); +#endif + + { + vector bit_vec(5, true); + bit_vec.insert(bit_vec.end(), 5, false); + vector > v_v_bits(1, bit_vec); + + /* + * This is a STLport specific test as we are using internal implementation + * details to check that the move has been correctly handled. For other + * STL implementation it is only a compile check. + */ +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) +# if defined (_STLP_DEBUG) + unsigned int *punit = v_v_bits.front().begin()._M_iterator._M_p; +# else + unsigned int *punit = v_v_bits.front().begin()._M_p; +# endif +#endif + + cur_capacity = v_v_bits.capacity(); + while (v_v_bits.capacity() <= cur_capacity) { + v_v_bits.push_back(bit_vec); + } + +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + //v_v_bits has been resized +# if defined (_STLP_DEBUG) + CPPUNIT_ASSERT( punit == v_v_bits.front().begin()._M_iterator._M_p ); +# else + CPPUNIT_ASSERT( punit == v_v_bits.front().begin()._M_p ); +# endif +#endif + } + + // zero: don't like this kind of tests + // because of template test function + // we should find another way to provide + // move constructor testing... + +/* + standard_test1(list(10)); + + + standard_test1(slist(10)); + + standard_test1(deque(10)); +*/ + + /* + int int_values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + set int_set(int_values, int_values + sizeof(in_values) / sizeof(int)); + standard_test1(int_set); + + multiset int_multiset(int_values, int_values + sizeof(in_values) / sizeof(int)); + standard_test1(int_multiset); + */ + + /* + CheckFullMoveSupport(string()); + CheckFullMoveSupport(vector()); + CheckFullMoveSupport(deque()); + CheckFullMoveSupport(list()); + CheckFullMoveSupport(slist()); + */ +} + +void MoveConstructorTest::deque_test() +{ + //Check the insert range method. + //To the front: + { +# if !defined (STLPORT) || !defined (_STLP_DEBUG) || !defined (_STLP_NO_MEMBER_TEMPLATES) + deque > vect_deque; + vector bufs; + vect_deque.assign(3, vector(10)); + bufs.push_back(&vect_deque[0].front()); + bufs.push_back(&vect_deque[1].front()); + bufs.push_back(&vect_deque[2].front()); + + int nb_insert = 5; + //Initialize to 1 to generate a front insertion: + int pos = 1; + while (nb_insert--) { + vector > vect_vect(2, vector(10)); + vect_deque.insert(vect_deque.begin() + pos, vect_vect.begin(), vect_vect.end()); + bufs.insert(bufs.begin() + pos, &vect_deque[pos].front()); + bufs.insert(bufs.begin() + pos + 1, &vect_deque[pos + 1].front()); + ++pos; + } + CPPUNIT_ASSERT( vect_deque.size() == 13 ); +# if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (int i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( bufs[i] == &vect_deque[i].front() ); + CPPUNIT_ASSERT( bufs[11 - i] == &vect_deque[11 - i].front() ); + } +# endif +# endif + } + + //To the back + { +# if !defined (STLPORT) || !defined (_STLP_DEBUG) || !defined (_STLP_NO_MEMBER_TEMPLATES) + deque > vect_deque; + vector bufs; + vect_deque.assign(3, vector(10)); + bufs.push_back(&vect_deque[0].front()); + bufs.push_back(&vect_deque[1].front()); + bufs.push_back(&vect_deque[2].front()); + + int nb_insert = 5; + //Initialize to 2 to generate a back insertion: + int pos = 2; + while (nb_insert--) { + vector > vect_vect(2, vector(10)); + vect_deque.insert(vect_deque.begin() + pos, vect_vect.begin(), vect_vect.end()); + bufs.insert(bufs.begin() + pos, &vect_deque[pos].front()); + bufs.insert(bufs.begin() + pos + 1, &vect_deque[pos + 1].front()); + ++pos; + } + CPPUNIT_ASSERT( vect_deque.size() == 13 ); +# if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (int i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( bufs[i + 1] == &vect_deque[i + 1].front() ); + CPPUNIT_ASSERT( bufs[12 - i] == &vect_deque[12 - i].front() ); + } +# endif +# endif + } + + //Check the different erase methods. + { + deque > vect_deque; + vect_deque.assign(20, vector(10)); + deque >::iterator vdit(vect_deque.begin()), vditEnd(vect_deque.end()); + vector bufs; + for (; vdit != vditEnd; ++vdit) { + bufs.push_back(&vdit->front()); + } + + { + // This check, repeated after each operation, check the deque consistency: + deque >::iterator it = vect_deque.end() - 5; + int nb_incr = 0; + for (; it != vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //erase in front: + vect_deque.erase(vect_deque.begin() + 2); + bufs.erase(bufs.begin() + 2); + CPPUNIT_ASSERT( vect_deque.size() == 19 ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + deque >::iterator it = vect_deque.end() - 5; + int nb_incr = 0; + for (; it != vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //erase in the back: + vect_deque.erase(vect_deque.end() - 2); + bufs.erase(bufs.end() - 2); + CPPUNIT_ASSERT( vect_deque.size() == 18 ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + deque >::iterator it = vect_deque.end() - 5; + int nb_incr = 0; + for (; it != vect_deque.end() && nb_incr < 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //range erase in front + vect_deque.erase(vect_deque.begin() + 3, vect_deque.begin() + 5); + bufs.erase(bufs.begin() + 3, bufs.begin() + 5); + CPPUNIT_ASSERT( vect_deque.size() == 16 ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + deque >::iterator it = vect_deque.end() - 5; + int nb_incr = 0; + for (; it != vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //range erase in back + vect_deque.erase(vect_deque.end() - 5, vect_deque.end() - 3); + bufs.erase(bufs.end() - 5, bufs.end() - 3); + CPPUNIT_ASSERT( vect_deque.size() == 14 ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + } + + //Check the insert value(s) + { + deque > vect_deque; + vect_deque.assign(20, vector(10)); + deque >::iterator vdit(vect_deque.begin()), vditEnd(vect_deque.end()); + vector bufs; + for (; vdit != vditEnd; ++vdit) { + bufs.push_back(&vdit->front()); + } + + { + //2 values in front: + vect_deque.insert(vect_deque.begin() + 2, 2, vector(10)); + bufs.insert(bufs.begin() + 2, &vect_deque[2].front()); + bufs.insert(bufs.begin() + 3, &vect_deque[3].front()); + CPPUNIT_ASSERT( vect_deque.size() == 22 ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + //2 values in back: + vect_deque.insert(vect_deque.end() - 2, 2, vector(10)); + bufs.insert(bufs.end() - 2, &vect_deque[20].front()); + bufs.insert(bufs.end() - 2, &vect_deque[21].front()); + CPPUNIT_ASSERT( vect_deque.size() == 24 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + //1 value in front: + deque >::iterator ret; + ret = vect_deque.insert(vect_deque.begin() + 2, vector(10)); + bufs.insert(bufs.begin() + 2, &vect_deque[2].front()); + CPPUNIT_ASSERT( vect_deque.size() == 25 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( &ret->front() == bufs[2] ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + //1 value in back: + deque >::iterator ret; + ret = vect_deque.insert(vect_deque.end() - 2, vector(10)); + bufs.insert(bufs.end() - 2, &vect_deque[23].front()); + CPPUNIT_ASSERT( vect_deque.size() == 26 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( &ret->front() == bufs[23] ); + deque >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + } +} + +void MoveConstructorTest::vector_test() +{ + //Check the insert range method. + //To the front: + { + vector > vect_vector; + vector bufs; + vect_vector.assign(3, vector(10)); + bufs.push_back(&vect_vector[0].front()); + bufs.push_back(&vect_vector[1].front()); + bufs.push_back(&vect_vector[2].front()); + + int nb_insert = 5; + int pos = 1; + while (nb_insert--) { + vector > vect_vect(2, vector(10)); + vect_vector.insert(vect_vector.begin() + pos, vect_vect.begin(), vect_vect.end()); + bufs.insert(bufs.begin() + pos, &vect_vector[pos].front()); + bufs.insert(bufs.begin() + pos + 1, &vect_vector[pos + 1].front()); + ++pos; + } + CPPUNIT_ASSERT( vect_vector.size() == 13 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (int i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( bufs[i] == &vect_vector[i].front() ); + CPPUNIT_ASSERT( bufs[11 - i] == &vect_vector[11 - i].front() ); + } +#endif + } + + //To the back + { + vector > vect_vector; + vector bufs; + vect_vector.assign(3, vector(10)); + bufs.push_back(&vect_vector[0].front()); + bufs.push_back(&vect_vector[1].front()); + bufs.push_back(&vect_vector[2].front()); + + int nb_insert = 5; + //Initialize to 2 to generate a back insertion: + int pos = 2; + while (nb_insert--) { + vector > vect_vect(2, vector(10)); + vect_vector.insert(vect_vector.begin() + pos, vect_vect.begin(), vect_vect.end()); + bufs.insert(bufs.begin() + pos, &vect_vector[pos].front()); + bufs.insert(bufs.begin() + pos + 1, &vect_vector[pos + 1].front()); + ++pos; + } + CPPUNIT_ASSERT( vect_vector.size() == 13 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + for (int i = 0; i < 5; ++i) { + CPPUNIT_ASSERT( bufs[i + 1] == &vect_vector[i + 1].front() ); + CPPUNIT_ASSERT( bufs[12 - i] == &vect_vector[12 - i].front() ); + } +#endif + } + + //Check the different erase methods. + { + vector > vect_vector; + vect_vector.assign(20, vector(10)); + vector >::iterator vdit(vect_vector.begin()), vditEnd(vect_vector.end()); + vector bufs; + for (; vdit != vditEnd; ++vdit) { + bufs.push_back(&vdit->front()); + } + + { + // This check, repeated after each operation, check the vector consistency: + vector >::iterator it = vect_vector.end() - 5; + int nb_incr = 0; + for (; it != vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //erase in front: + vect_vector.erase(vect_vector.begin() + 2); + bufs.erase(bufs.begin() + 2); + CPPUNIT_ASSERT( vect_vector.size() == 19 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + vector >::iterator it = vect_vector.end() - 5; + int nb_incr = 0; + for (; it != vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //erase in the back: + vect_vector.erase(vect_vector.end() - 2); + bufs.erase(bufs.end() - 2); + CPPUNIT_ASSERT( vect_vector.size() == 18 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + vector >::iterator it = vect_vector.end() - 5; + int nb_incr = 0; + for (; it != vect_vector.end() && nb_incr < 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //range erase in front + vect_vector.erase(vect_vector.begin() + 3, vect_vector.begin() + 5); + bufs.erase(bufs.begin() + 3, bufs.begin() + 5); + CPPUNIT_ASSERT( vect_vector.size() == 16 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + vector >::iterator it = vect_vector.end() - 5; + int nb_incr = 0; + for (; it != vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {} + CPPUNIT_ASSERT( nb_incr == 5 ); + } + + { + //range erase in back + vect_vector.erase(vect_vector.end() - 5, vect_vector.end() - 3); + bufs.erase(bufs.end() - 5, bufs.end() - 3); + CPPUNIT_ASSERT( vect_vector.size() == 14 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + } + + //Check the insert value(s) + { + vector > vect_vector; + vect_vector.assign(20, vector(10)); + vector >::iterator vdit(vect_vector.begin()), vditEnd(vect_vector.end()); + vector bufs; + for (; vdit != vditEnd; ++vdit) { + bufs.push_back(&vdit->front()); + } + + { + //2 values in front: + vect_vector.insert(vect_vector.begin() + 2, 2, vector(10)); + bufs.insert(bufs.begin() + 2, &vect_vector[2].front()); + bufs.insert(bufs.begin() + 3, &vect_vector[3].front()); + CPPUNIT_ASSERT( vect_vector.size() == 22 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + //2 values in back: + vect_vector.insert(vect_vector.end() - 2, 2, vector(10)); + bufs.insert(bufs.end() - 2, &vect_vector[20].front()); + bufs.insert(bufs.end() - 2, &vect_vector[21].front()); + CPPUNIT_ASSERT( vect_vector.size() == 24 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + //1 value in front: +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator ret = +#endif + vect_vector.insert(vect_vector.begin() + 2, vector(10)); + bufs.insert(bufs.begin() + 2, &vect_vector[2].front()); + CPPUNIT_ASSERT( vect_vector.size() == 25 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( &ret->front() == bufs[2] ); + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + + { + //1 value in back: +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + vector >::iterator ret = +#endif + vect_vector.insert(vect_vector.end() - 2, vector(10)); + bufs.insert(bufs.end() - 2, &vect_vector[23].front()); + CPPUNIT_ASSERT( vect_vector.size() == 26 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( &ret->front() == bufs[23] ); + vector >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end()); + for (size_t i = 0; dit != ditEnd; ++dit, ++i) { + CPPUNIT_ASSERT( bufs[i] == &dit->front() ); + } +#endif + } + } + + //The following tests are checking move contructor implementations: + const string long_str("long enough string to force dynamic allocation"); + { + //vector move contructor: + vector > vect(10, vector(10, long_str)); + vector strs; + size_t index = 0; + for (;;) { + vector >::iterator it(vect.begin()); + advance(it, index % vect.size()); + strs.push_back(it->front()); + it->erase(it->begin()); + if (it->empty()) { + vect.erase(it); + if (vect.empty()) + break; + } + index += 3; + } + CPPUNIT_ASSERT( strs.size() == 10 * 10 ); + vector::iterator it(strs.begin()), itEnd(strs.end()); + for (; it != itEnd; ++it) { + CPPUNIT_ASSERT( *it == long_str ); + } + } + + { + //deque move contructor: +# if !defined (__DMC__) + vector > vect(10, deque(10, long_str)); +# else + deque deq_str = deque(10, long_str); + vector > vect(10, deq_str); +# endif + vector strs; + size_t index = 0; + for (;;) { + vector >::iterator it(vect.begin()); + advance(it, index % vect.size()); + strs.push_back(it->front()); + it->pop_front(); + if (it->empty()) { + vect.erase(it); + if (vect.empty()) + break; + } + index += 3; + } + CPPUNIT_ASSERT( strs.size() == 10 * 10 ); + vector::iterator it(strs.begin()), itEnd(strs.end()); + for (; it != itEnd; ++it) { + CPPUNIT_ASSERT( *it == long_str ); + } + } + + { + //list move contructor: + vector > vect(10, list(10, long_str)); + vector strs; + size_t index = 0; + for (;;) { + vector >::iterator it(vect.begin()); + advance(it, index % vect.size()); + strs.push_back(it->front()); + it->pop_front(); + if (it->empty()) { + vect.erase(it); + if (vect.empty()) + break; + } + index += 3; + } + CPPUNIT_ASSERT( strs.size() == 10 * 10 ); + vector::iterator it(strs.begin()), itEnd(strs.end()); + for (; it != itEnd; ++it) { + CPPUNIT_ASSERT( *it == long_str ); + } + } + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + { + //slist move contructor: + vector > vect(10, slist(10, long_str)); + vector strs; + size_t index = 0; + while (true) { + vector >::iterator it(vect.begin()); + advance(it, index % vect.size()); + strs.push_back(it->front()); + it->pop_front(); + if (it->empty()) { + vect.erase(it); + if (vect.empty()) + break; + } + index += 3; + } + CPPUNIT_ASSERT( strs.size() == 10 * 10 ); + vector::iterator it(strs.begin()), itEnd(strs.end()); + for (; it != itEnd; ++it) { + CPPUNIT_ASSERT( *it == long_str ); + } + } +#endif + + { + //binary tree move contructor: + multiset ref; + for (size_t i = 0; i < 10; ++i) { + ref.insert(long_str); + } + vector > vect(10, ref); + vector strs; + size_t index = 0; + for (;;) { + vector >::iterator it(vect.begin()); + advance(it, index % vect.size()); + strs.push_back(*it->begin()); + it->erase(it->begin()); + if (it->empty()) { + vect.erase(it); + if (vect.empty()) + break; + } + index += 3; + } + CPPUNIT_ASSERT( strs.size() == 10 * 10 ); + vector::iterator it(strs.begin()), itEnd(strs.end()); + for (; it != itEnd; ++it) { + CPPUNIT_ASSERT( *it == long_str ); + } + } + +#if defined (STLPORT) +# if !defined (__DMC__) + { + //hash container move contructor: + unordered_multiset ref; + for (size_t i = 0; i < 10; ++i) { + ref.insert(long_str); + } + vector > vect(10, ref); + vector strs; + size_t index = 0; + while (true) { + vector >::iterator it(vect.begin()); + advance(it, index % vect.size()); + strs.push_back(*it->begin()); + it->erase(it->begin()); + if (it->empty()) { + vect.erase(it); + if (vect.empty()) + break; + } + index += 3; + } + CPPUNIT_ASSERT( strs.size() == 10 * 10 ); + vector::iterator it(strs.begin()), itEnd(strs.end()); + for (; it != itEnd; ++it) { + CPPUNIT_ASSERT( *it == long_str ); + } + } +# endif +#endif +} + +#if defined (__BORLANDC__) +/* Specific Borland test case to show a really weird compiler behavior. + */ +class Standalone +{ +public: + //Uncomment following to pass the test + //Standalone() {} + ~Standalone() {} + + MovableStruct movableStruct; + vector intVector; +}; + +void MoveConstructorTest::nb_destructor_calls() +{ + MovableStruct::reset(); + + try + { + Standalone standalone; + throw "some exception"; + MovableStruct movableStruct; + } + catch (const char*) + { + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 1 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 ); + } +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/mvctor_test.h b/reactos/lib/3rdparty/stlport/test/unit/mvctor_test.h new file mode 100644 index 00000000000..8314db623ff --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/mvctor_test.h @@ -0,0 +1,97 @@ +#include //size_t and STLport macros + +#include "cppunit/cppunit_proxy.h" + +// +// TestCase class +// +class MoveConstructorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(MoveConstructorTest); + CPPUNIT_TEST(move_construct_test); + CPPUNIT_TEST(deque_test); + CPPUNIT_TEST(vector_test); + CPPUNIT_TEST(move_traits); +#if !defined (STLPORT) || defined (_STLP_NO_MOVE_SEMANTIC) || \ + defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) || \ + (defined (__BORLANDC__) && (__BORLANDC__ < 0x564)) + CPPUNIT_IGNORE; +# endif + CPPUNIT_TEST(movable_declaration) + CPPUNIT_TEST(movable_declaration_assoc) + CPPUNIT_TEST(movable_declaration_hash) +#if defined (__BORLANDC__) + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(nb_destructor_calls); +#endif + CPPUNIT_TEST_SUITE_END(); + +protected: + void move_construct_test(); + void deque_test(); + void vector_test(); + void move_traits(); + void movable_declaration(); + void movable_declaration_assoc(); + void movable_declaration_hash(); + void nb_destructor_calls(); + + /* + template + void standard_test1(_Container const& ref_cont) { + vector<_Container> vec_cont(1, ref_cont); + typedef typename _Container::value_type value_type; + value_type *pvalue = &(*vec_cont.front().begin()); + size_t cur_capacity= vec_cont.capacity(); + //force reallocation + while (cur_capacity == vec_cont.capacity()) { + vec_cont.push_back(ref_cont); + } + bool b=( (pvalue==(&(*vec_cont.front().begin()))) ); + CPPUNIT_ASSERT(b); + } + */ + +private: + void move_traits_vec(); + void move_traits_vec_complete(); + void move_traits_deq(); + void move_traits_deq_complete(); +}; + +struct MovableStruct { + MovableStruct() { ++nb_dft_construct_call; } + MovableStruct(MovableStruct const&) { ++nb_cpy_construct_call; } +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) +# if defined (_STLP_USE_NAMESPACES) + MovableStruct(std::__move_source) +# else + MovableStruct(__move_source) +# endif + { ++nb_mv_construct_call; } +#endif + ~MovableStruct() { ++nb_destruct_call; } + + MovableStruct& operator = (const MovableStruct&) { + ++nb_assignment_call; + return *this; + } + + static void reset() { + nb_dft_construct_call = nb_cpy_construct_call = nb_mv_construct_call = 0; + nb_assignment_call = 0; + nb_destruct_call = 0; + } + + static size_t nb_dft_construct_call; + static size_t nb_cpy_construct_call; + static size_t nb_mv_construct_call; + static size_t nb_assignment_call; + static size_t nb_destruct_call; + + //Dummy data just to control struct sizeof + //As node allocator implementation align memory blocks on 2 * sizeof(void*) + //we give MovableStruct the same size in order to have expected allocation + //and not more + void* dummy_data[2]; +}; diff --git a/reactos/lib/3rdparty/stlport/test/unit/mvctor_traits_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/mvctor_traits_test.cpp new file mode 100644 index 00000000000..7cea98f98aa --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/mvctor_traits_test.cpp @@ -0,0 +1,460 @@ +#include +#include + +#include "mvctor_test.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +size_t MovableStruct::nb_dft_construct_call = 0; +size_t MovableStruct::nb_cpy_construct_call = 0; +size_t MovableStruct::nb_mv_construct_call = 0; +size_t MovableStruct::nb_assignment_call = 0; +size_t MovableStruct::nb_destruct_call = 0; + +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __move_traits { + typedef __true_type implemented; + typedef __false_type complete; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +struct CompleteMovableStruct { + CompleteMovableStruct() { ++nb_dft_construct_call; } + CompleteMovableStruct(CompleteMovableStruct const&) { ++nb_cpy_construct_call; } +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CompleteMovableStruct(__move_source) { ++nb_mv_construct_call; } +#endif + ~CompleteMovableStruct() { ++nb_destruct_call; } + + CompleteMovableStruct& operator = (const CompleteMovableStruct&) { + ++nb_assignment_call; + return *this; + } + static void reset() { + nb_dft_construct_call = nb_cpy_construct_call = nb_mv_construct_call = 0; + nb_assignment_call = 0; + nb_destruct_call = 0; + } + + static size_t nb_dft_construct_call; + static size_t nb_cpy_construct_call; + static size_t nb_mv_construct_call; + static size_t nb_assignment_call; + static size_t nb_destruct_call; + + //See MovableStruct + void* dummy_data[2]; +}; + +size_t CompleteMovableStruct::nb_dft_construct_call = 0; +size_t CompleteMovableStruct::nb_cpy_construct_call = 0; +size_t CompleteMovableStruct::nb_mv_construct_call = 0; +size_t CompleteMovableStruct::nb_assignment_call = 0; +size_t CompleteMovableStruct::nb_destruct_call = 0; + +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __move_traits { + typedef __true_type implemented; + typedef __true_type complete; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +void MoveConstructorTest::move_traits() +{ + move_traits_vec(); + move_traits_vec_complete(); + move_traits_deq(); + move_traits_deq_complete(); +} + +void MoveConstructorTest::move_traits_vec() +{ + { + { + vector vect; + vect.push_back(MovableStruct()); + vect.push_back(MovableStruct()); + vect.push_back(MovableStruct()); + vect.push_back(MovableStruct()); + + // vect contains 4 elements + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 ); +#if defined (STLPORT) +# if !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 3 ); +# else + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 7 ); +# endif + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 7 ); +#elif !defined (_MSC_VER) + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 7 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 7 ); +#else + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 14 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 14 ); +#endif + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 ); + + // Following test violate requirements to sequiences (23.1.1 Table 67) + /* + vect.insert(vect.begin() + 2, vect.begin(), vect.end()); + // vect contains 8 elements + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 8 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 7 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 11 ); + */ + + MovableStruct::reset(); + vector v2 = vect; + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 0 ); + + MovableStruct::reset(); + vect.insert(vect.begin() + 2, v2.begin(), v2.end() ); + + // vect contains 8 elements + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 4 ); +#else + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 8 ); +#endif + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 4 ); + + MovableStruct::reset(); + vect.erase(vect.begin(), vect.begin() + 2 ); + + // vect contains 6 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 6 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 8 ); +#else + CPPUNIT_ASSERT_EQUAL( MovableStruct::nb_assignment_call, 6 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 ); +#endif + + MovableStruct::reset(); + vect.erase(vect.end() - 2, vect.end()); + + // vect contains 4 elements + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 ); + + MovableStruct::reset(); + vect.erase(vect.begin()); + + // vect contains 3 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 3 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 4 ); +#else + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 3 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 ); +#endif + + MovableStruct::reset(); + } + //vect with 3 elements and v2 with 4 elements are now out of scope + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 + 4 ); + } +} + +void MoveConstructorTest::move_traits_vec_complete() +{ + { + { + vector vect; + vect.push_back(CompleteMovableStruct()); + vect.push_back(CompleteMovableStruct()); + vect.push_back(CompleteMovableStruct()); + vect.push_back(CompleteMovableStruct()); + + // vect contains 4 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 ); +#if defined (STLPORT) +# if !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 3 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 ); +# else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 7 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 7 ); +# endif +#elif !defined (_MSC_VER) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 7 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 7 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 14 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 14 ); +#endif + + // Following test violate requirements to sequiences (23.1.1 Table 67) + /* + vect.insert(vect.begin() + 2, vect.begin(), vect.end()); + + // vect contains 8 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 8 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 7 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 ); + */ + + CompleteMovableStruct::reset(); + vector v2 = vect; + + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 ); + + CompleteMovableStruct::reset(); + vect.insert(vect.begin() + 2, v2.begin(), v2.end()); + + // vect contains 8 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 8 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 ); +#endif + + CompleteMovableStruct::reset(); + vect.erase(vect.begin(), vect.begin() + 2); + + // vect contains 6 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 6 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 6 ); +#endif + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 ); + + CompleteMovableStruct::reset(); + vect.erase(vect.end() - 2, vect.end()); + + // vect contains 4 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 ); + + CompleteMovableStruct::reset(); + vect.erase(vect.begin()); + + // vect contains 3 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 3 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 3 ); +#endif + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 1 ); + + CompleteMovableStruct::reset(); + } + //vect with 3 elements and v2 with 4 elements are now out of scope + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 3 + 4 ); + } +} + +void MoveConstructorTest::move_traits_deq() +{ + { + MovableStruct::reset(); + { + deque deq; + deq.push_back(MovableStruct()); + deq.push_back(MovableStruct()); + deq.push_back(MovableStruct()); + deq.push_back(MovableStruct()); + + // deq contains 4 elements + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 4 ); + + // Following test violate requirements to sequiences (23.1.1 Table 67) + /* + deq.insert(deq.begin() + 2, deq.begin(), deq.end()); + // deq contains 8 elements + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 8 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 7 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 11 ); + */ + + MovableStruct::reset(); + deque d2 = deq; + + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 0 ); + + MovableStruct::reset(); + deq.insert(deq.begin() + 2, d2.begin(), d2.end() ); + + // deq contains 8 elements + CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 ); + CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 2 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 ); +#else + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 2 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 0 ); +#endif + + MovableStruct::reset(); + deq.erase(deq.begin() + 1, deq.begin() + 3 ); + + // deq contains 6 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 1 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 ); +#else + //Following check is highly deque implementation dependant so + //it might not always work... + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 1 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 ); +#endif + + MovableStruct::reset(); + deq.erase(deq.end() - 3, deq.end() - 1); + + // deq contains 4 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 1 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 ); +#else + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 1 ); + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 ); +#endif + + MovableStruct::reset(); + deq.erase(deq.begin()); + + // deq contains 3 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 ); +#else + CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 ); +#endif + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 ); + + MovableStruct::reset(); + } + //deq with 3 elements and d2 with 4 elements are now out of scope + CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 + 4 ); + } +} + +void MoveConstructorTest::move_traits_deq_complete() +{ + { + CompleteMovableStruct::reset(); + { + deque deq; + deq.push_back(CompleteMovableStruct()); + deq.push_back(CompleteMovableStruct()); + deq.push_back(CompleteMovableStruct()); + deq.push_back(CompleteMovableStruct()); + + // deq contains 4 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 ); + + // Following test violate requirements to sequiences (23.1.1 Table 67) + /* + deq.insert(deq.begin() + 2, deq.begin(), deq.end()); + + // deq contains 8 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 8 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 7 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 ); + */ + + CompleteMovableStruct::reset(); + deque d2 = deq; + + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 ); + + CompleteMovableStruct::reset(); + deq.insert(deq.begin() + 2, d2.begin(), d2.end()); + + // deq contains 8 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 ); +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 2 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 2 ); +#endif + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 ); + + CompleteMovableStruct::reset(); + deq.erase(deq.begin() + 1, deq.begin() + 3); + + // deq contains 6 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 1 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 1 ); +#endif + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 ); + + CompleteMovableStruct::reset(); + deq.erase(deq.end() - 3, deq.end() - 1); + + // deq contains 4 elements +#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC) + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 1 ); +#else + CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 1 ); +#endif + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 ); + + CompleteMovableStruct::reset(); + deq.erase(deq.begin()); + + // deq contains 3 elements + CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 0 ); + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 1 ); + + CompleteMovableStruct::reset(); + } + //deq with 3 elements and v2 with 4 elements are now out of scope + CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 3 + 4 ); + } +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/neq_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/neq_test.cpp new file mode 100644 index 00000000000..7769e42996d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/neq_test.cpp @@ -0,0 +1,54 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class NeqTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(NeqTest); + CPPUNIT_TEST(negate0); + CPPUNIT_TEST(nequal0); + CPPUNIT_TEST_SUITE_END(); + +protected: + void negate0(); + void nequal0(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(NeqTest); + +// +// tests implementation +// +void NeqTest::negate0() +{ + int input [3] = { 1, 2, 3 }; + + int output[3]; + transform((int*)input, (int*)input + 3, (int*)output, negate()); + + CPPUNIT_ASSERT(output[0]==-1); + CPPUNIT_ASSERT(output[1]==-2); + CPPUNIT_ASSERT(output[2]==-3); +} +void NeqTest::nequal0() +{ + int input1 [4] = { 1, 7, 2, 2 }; + int input2 [4] = { 1, 6, 2, 3 }; + + int output [4]; + transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, not_equal_to()); + + CPPUNIT_ASSERT(output[0]==0); + CPPUNIT_ASSERT(output[1]==1); + CPPUNIT_ASSERT(output[2]==0); + CPPUNIT_ASSERT(output[3]==1); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/new_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/new_header_test.cpp new file mode 100644 index 00000000000..18842991cba --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/new_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/nthelm_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/nthelm_test.cpp new file mode 100644 index 00000000000..75c26d1744e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/nthelm_test.cpp @@ -0,0 +1,84 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class NthElemTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(NthElemTest); + CPPUNIT_TEST(nthelem0); + CPPUNIT_TEST(nthelem1); + CPPUNIT_TEST(nthelem2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void nthelem0(); + void nthelem1(); + void nthelem2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(NthElemTest); + +// +// tests implementation +// +void NthElemTest::nthelem0() +{ + int numbers[7] = { 5, 2, 4, 1, 0, 3 ,77}; + nth_element(numbers, numbers + 3, numbers + 6); + + CPPUNIT_ASSERT(numbers[0]==1); + CPPUNIT_ASSERT(numbers[1]==0); + CPPUNIT_ASSERT(numbers[2]==2); + CPPUNIT_ASSERT(numbers[3]==3); + CPPUNIT_ASSERT(numbers[4]==4); + CPPUNIT_ASSERT(numbers[5]==5); +} +void NthElemTest::nthelem1() +{ + //6 8 5 1 7 4 1 5 2 6 + //1 1 4 2 5 5 6 7 8 6 + int numbers[10] = { 6, 8, 5, 1, 7, 4, 1, 5, 2, 6 }; + + vector v1(numbers, numbers+10); + nth_element(v1.begin(), v1.begin() + v1.size() / 2, v1.end()); + + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==4); + CPPUNIT_ASSERT(v1[3]==2); + CPPUNIT_ASSERT(v1[4]==5); + CPPUNIT_ASSERT(v1[5]==5); + CPPUNIT_ASSERT(v1[6]==6); + CPPUNIT_ASSERT(v1[7]==7); + CPPUNIT_ASSERT(v1[8]==8); + CPPUNIT_ASSERT(v1[9]==6); +} +void NthElemTest::nthelem2() +{ + //4 5 4 2 1 7 4 3 1 6 + //6 7 4 4 5 4 3 2 1 1 + + int numbers[10] = { 4, 5, 4, 2, 1, 7, 4, 3, 1, 6 }; + vector v1(numbers, numbers+10); + nth_element(v1.begin(), v1.begin() + v1.size() / 2, v1.end(), greater()); + + CPPUNIT_ASSERT(v1[0]==6); + CPPUNIT_ASSERT(v1[1]==7); + CPPUNIT_ASSERT(v1[2]==4); + CPPUNIT_ASSERT(v1[3]==4); + CPPUNIT_ASSERT(v1[4]==5); + CPPUNIT_ASSERT(v1[5]==4); + CPPUNIT_ASSERT(v1[6]==3); + CPPUNIT_ASSERT(v1[7]==2); + CPPUNIT_ASSERT(v1[8]==1); + CPPUNIT_ASSERT(v1[9]==1); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/num_facets_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/num_facets_test.cpp new file mode 100644 index 00000000000..bc5195f8473 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/num_facets_test.cpp @@ -0,0 +1,297 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include + +# include "complete_digits.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +struct ref_locale { + const char *name; + const char *decimal_point; + const char *thousands_sep; +}; + +static const ref_locale tested_locales[] = { +//{ name, decimal_point, thousands_sepy_thousands_sep}, +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + { "fr_FR", ",", "\xa0"}, + { "ru_RU.koi8r", ",", "."}, + { "en_GB", ".", ","}, + { "en_US", ".", ","}, +# endif + { "C", ".", ","}, +}; + +// +// tests implementation +// +void LocaleTest::_num_put_get( const locale& loc, const ref_locale* prl ) { + const ref_locale& rl = *prl; + CPPUNIT_ASSERT( has_facet >(loc) ); + numpunct const& npct = use_facet >(loc); + CPPUNIT_ASSERT( npct.decimal_point() == *rl.decimal_point ); + + float val = 1234.56f; + ostringstream fostr; + fostr.imbue(loc); + fostr << val; + + string ref = "1"; + if (!npct.grouping().empty()) { + ref += npct.thousands_sep(); + } + ref += "234"; + ref += npct.decimal_point(); + ref += "56"; + //cout << "In " << loc.name() << " 1234.56 is written: " << fostr.str() << endl; + CPPUNIT_ASSERT( fostr.str() == ref ); + + val = 12345678.9f; + ref = "1"; + ref += npct.decimal_point(); + ref += "23457e+"; + string digits = "7"; + complete_digits(digits); + ref += digits; + fostr.str(""); + fostr << val; + CPPUNIT_ASSERT( fostr.str() == ref ); + + val = 1000000000.0f; + fostr.str(""); + fostr << val; + digits = "9"; + complete_digits(digits); + CPPUNIT_ASSERT( fostr.str() == string("1e+") + digits ); + + val = 1234.0f; + ref = "1"; + if (!npct.grouping().empty()) { + ref += npct.thousands_sep(); + } + ref += "234"; + fostr.str(""); + fostr << val; + CPPUNIT_ASSERT( fostr.str() == ref ); + + val = 10000001.0f; + fostr.str(""); + fostr << val; + digits = "7"; + complete_digits(digits); + CPPUNIT_ASSERT( fostr.str() == string("1e+") + digits ); + + if (npct.grouping().size() == 1 && npct.grouping()[0] == 3) { + int ival = 1234567890; + fostr.str(""); + fostr << ival; + ref = "1"; + ref += npct.thousands_sep(); + ref += "234"; + ref += npct.thousands_sep(); + ref += "567"; + ref += npct.thousands_sep(); + ref += "890"; + CPPUNIT_ASSERT( fostr.str() == ref ); + } + +#if defined (__BORLANDC__) + num_put const& nput = use_facet >(loc); + typedef numeric_limits limd; + fostr.setf(ios_base::uppercase | ios_base::showpos); + + if (limd::has_infinity) { + double infinity = limd::infinity(); + fostr.str(""); + nput.put(fostr, fostr, ' ', infinity); + CPPUNIT_ASSERT( fostr.str() == string("+Inf") ); + } + + if (limd::has_quiet_NaN) { + /* Ignore FPU exceptions */ + unsigned int _float_control_word = _control87(0, 0); + _control87(EM_INVALID|EM_INEXACT, MCW_EM); + double qnan = limd::quiet_NaN(); + /* Reset floating point control word */ + _clear87(); + _control87(_float_control_word, MCW_EM); + fostr.str(""); + nput.put(fostr, fostr, ' ', qnan); + CPPUNIT_ASSERT( fostr.str() == string("+NaN") ); + } +#endif +} + +typedef void (LocaleTest::*_Test) (const locale&, const ref_locale*); +static void test_supported_locale(LocaleTest& inst, _Test __test) { + size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]); + for (size_t i = 0; i < n; ++i) { + locale loc; +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try +# endif + { + locale tmp(tested_locales[i].name); + loc = tmp; + } +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + catch (runtime_error const&) { + //This locale is not supported. + continue; + } +# endif + CPPUNIT_MESSAGE( loc.name().c_str() ); + (inst.*__test)(loc, tested_locales + i); + + { + locale tmp(locale::classic(), tested_locales[i].name, locale::numeric); + loc = tmp; + } + (inst.*__test)(loc, tested_locales + i); + + { + locale tmp(locale::classic(), new numpunct_byname(tested_locales[i].name)); + loc = tmp; + } + (inst.*__test)(loc, tested_locales + i); + } +} + +void LocaleTest::num_put_get() +{ test_supported_locale(*this, &LocaleTest::_num_put_get); } + +void LocaleTest::numpunct_by_name() +{ + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new numpunct_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new numpunct_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string veryLongFacetName("LC_NUMERIC="); + veryLongFacetName.append(512, '?'); + locale loc(locale::classic(), new numpunct_byname(veryLongFacetName.c_str())); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), "C", locale::numeric); + } + catch (runtime_error const& e) { + CPPUNIT_MESSAGE( e.what() ); + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" facet. + locale loc(locale::classic(), "", locale::numeric); + } + catch (runtime_error const& e) { + CPPUNIT_MESSAGE( e.what() ); + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new numpunct_byname("C")); + numpunct const& cfacet_byname = use_facet >(loc); + numpunct const& cfacet = use_facet >(locale::classic()); + + CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() ); + CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() ); + if (!cfacet.grouping().empty()) + CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() ); +# if !defined (STLPORT) || !defined (__GLIBC__) + CPPUNIT_CHECK( cfacet_byname.truename() == cfacet.truename() ); + CPPUNIT_CHECK( cfacet_byname.falsename() == cfacet.falsename() ); +# endif + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" locale facet. + locale loc(locale::classic(), new numpunct_byname("")); + } + catch (runtime_error const& e) { + CPPUNIT_MESSAGE( e.what() ); + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +# if defined (STLPORT) || !defined (__GNUC__) + try { + locale loc(locale::classic(), new numpunct_byname(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new numpunct_byname("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/num_put_get_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/num_put_get_test.cpp new file mode 100644 index 00000000000..13b250f358f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/num_put_get_test.cpp @@ -0,0 +1,1266 @@ +#include + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include +# include +/* +# include +# include +*/ + +# include "complete_digits.h" +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// TestCase class +// +class NumPutGetTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(NumPutGetTest); +# if defined (__BORLANDC__) + /* Ignore FPU exceptions, set FPU precision to 64 bits */ + unsigned int _float_control_word = _control87(0, 0); + _control87(PC_64|MCW_EM|IC_AFFINE, MCW_PC|MCW_EM|MCW_IC); +# endif + CPPUNIT_TEST(num_put_float); + CPPUNIT_TEST(num_put_integer); + CPPUNIT_TEST(num_get_float); + CPPUNIT_TEST(num_get_integer); + CPPUNIT_TEST(inhex); + CPPUNIT_TEST(pointer); + CPPUNIT_TEST(fix_float_long); + CPPUNIT_TEST(custom_numpunct); +# if defined (__BORLANDC__) + /* Reset floating point control word */ + _clear87(); + _control87(_float_control_word, MCW_PC|MCW_EM|MCW_IC); +# endif + CPPUNIT_TEST_SUITE_END(); + +private: + void num_put_float(); + void num_put_integer(); + void num_get_float(); + void num_get_integer(); + void inhex(); + void pointer(); + void fix_float_long(); + void custom_numpunct(); + + static bool check_float(float val, float ref) + { + float epsilon = numeric_limits::epsilon(); + return val <= ref + epsilon && val >= ref - epsilon; + } + + static bool check_double(double val, double ref) + { + double epsilon = numeric_limits::epsilon(); + return val <= ref + epsilon && val >= ref - epsilon; + } + + static string reset_stream(ostringstream &ostr) + { + string tmp = ostr.str(); + ostr.str(""); + return tmp; + } + +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + template + void check_get_float( F v ) + { + F in_val_d = v; + typedef numeric_limits limits; + { + stringstream str; + + str << "1E+" << limits::max_exponent10; + + str >> in_val_d; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d != limits::infinity() ); + } + { + stringstream str; + + str << "-1E+" << limits::max_exponent10; + + str >> in_val_d; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d != -limits::infinity() ); + } + { + stringstream str; + + str << "1E" << limits::min_exponent10; + + str >> in_val_d; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d != F(0.0) ); + } + { + stringstream str; + + str << "1E+" << (limits::max_exponent10 + 1); + + str >> in_val_d; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d == limits::infinity() ); + } + { + stringstream str; + + str << "-1E+" << (limits::max_exponent10 + 1); + + str >> in_val_d; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d == -limits::infinity() ); + } + { + stringstream str; + + str << "1E" << (limits::min_exponent10 - 1); + + str >> in_val_d; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= limits::min() ); + } +#if !defined (__MINGW32__) + { + stringstream str; + + str << limits::max(); + + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_CHECK( str.str() != "inf" ); + CPPUNIT_CHECK( str.str() != "-inf" ); + CPPUNIT_CHECK( str.str() != "nan" ); + CPPUNIT_CHECK( str.str() != "-nan" ); + //CPPUNIT_MESSAGE( str.str().c_str() ); + + //str.str(""); + //str << limits::max_exponent10; + //CPPUNIT_MESSAGE( str.str().c_str() ); + + str >> in_val_d; + + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d != limits::infinity() ); + } + { + stringstream str; + + str << fixed << limits::max(); + + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_CHECK( str.str() != "inf" ); + CPPUNIT_CHECK( str.str() != "-inf" ); + CPPUNIT_CHECK( str.str() != "nan" ); + CPPUNIT_CHECK( str.str() != "-nan" ); + //CPPUNIT_MESSAGE( str.str().c_str() ); + + //str.str(""); + //str << limits::max_exponent10; + //CPPUNIT_MESSAGE( str.str().c_str() ); + + str >> in_val_d; + + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d != limits::infinity() ); + } + { + stringstream str; + + str << scientific << setprecision(50) << limits::max(); + + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_CHECK( str.str() != "inf" ); + CPPUNIT_CHECK( str.str() != "-inf" ); + CPPUNIT_CHECK( str.str() != "nan" ); + CPPUNIT_CHECK( str.str() != "-nan" ); + //CPPUNIT_MESSAGE( str.str().c_str() ); + + //str.str(""); + //str << limits::max_exponent10; + //CPPUNIT_MESSAGE( str.str().c_str() ); + + str >> in_val_d; + + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_CHECK( in_val_d == in_val_d ); + CPPUNIT_CHECK( in_val_d != limits::infinity() ); + } +#endif + { + stringstream str; + + str << limits::infinity(); + + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( !limits::has_infinity || str.str() == "inf" ); + } + { + stringstream str; + + str << -limits::infinity(); + + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( !limits::has_infinity || str.str() == "-inf" ); + } + { + stringstream str; + + str << limits::quiet_NaN(); + + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( !limits::has_quiet_NaN || str.str() == "nan" ); + } + { + stringstream str; + + str << -limits::quiet_NaN(); + + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( !limits::has_quiet_NaN || str.str() == "-nan" ); + } + { + stringstream str; + + str << "0." << string(limits::max_exponent10, '0') << "1e" << (limits::max_exponent10 + 1); + CPPUNIT_ASSERT( !str.fail() ); + + str >> in_val_d; + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( str.eof() ); + CPPUNIT_CHECK( in_val_d == 1 ); + } + { + stringstream str; + + str << "1" << string(-(limits::min_exponent10 - 1), '0') << "e" << (limits::min_exponent10 - 1); + CPPUNIT_ASSERT( !str.fail() ); + + str >> in_val_d; + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( str.eof() ); + CPPUNIT_CHECK( in_val_d == 1 ); + } +# if defined (_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x530) + // The following tests are showing that simply changing stream + // precision lead to different result. Do not seems to be a real + // problem, simply rounding approximation but additional study should + // be done after 5.2 release. + { + stringstream str; + str << setprecision(limits::digits10 + 2) << limits::max(); + + CPPUNIT_MESSAGE(str.str().c_str()); + CPPUNIT_ASSERT( !str.fail() ); + + F val; + str >> val; + + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( limits::infinity() > val ); + } + { + stringstream str; + str << setprecision(limits::digits10 + 1) << limits::max(); + + CPPUNIT_MESSAGE(str.str().c_str()); + CPPUNIT_ASSERT( !str.fail() ); + + F val; + str >> val; + + CPPUNIT_ASSERT( !str.fail() ); + CPPUNIT_ASSERT( limits::infinity() > val ); + } +# endif + } +#else +# define __check_get_float( F ) \ + void check_get_float( F v ) \ + { \ + F in_val_d = v; \ + { \ + stringstream str; \ + \ + str << "1E+" << numeric_limits::max_exponent10; \ + \ + str >> in_val_d; \ + CPPUNIT_ASSERT(!str.fail()); \ + CPPUNIT_ASSERT(str.eof()); \ + CPPUNIT_CHECK( in_val_d == in_val_d ); \ + CPPUNIT_CHECK( in_val_d != numeric_limits::infinity() ); \ + } \ + { \ + stringstream str; \ + \ + str << "-1E+" << numeric_limits::max_exponent10; \ + \ + str >> in_val_d; \ + CPPUNIT_ASSERT(!str.fail()); \ + CPPUNIT_ASSERT(str.eof()); \ + CPPUNIT_CHECK( in_val_d == in_val_d ); \ + CPPUNIT_CHECK( in_val_d != -numeric_limits::infinity() ); \ + } \ + { \ + stringstream str; \ + \ + str << "1E" << numeric_limits::min_exponent10; \ + \ + str >> in_val_d; \ + CPPUNIT_ASSERT(!str.fail()); \ + CPPUNIT_ASSERT(str.eof()); \ + CPPUNIT_CHECK( in_val_d == in_val_d ); \ + CPPUNIT_CHECK( in_val_d != F(0.0) ); \ + } \ + { \ + stringstream str; \ + \ + str << "1E+" << (numeric_limits::max_exponent10 + 1); \ + \ + str >> in_val_d; \ + CPPUNIT_ASSERT(!str.fail()); \ + CPPUNIT_ASSERT(str.eof()); \ + CPPUNIT_CHECK( in_val_d == in_val_d ); \ + CPPUNIT_CHECK( in_val_d == numeric_limits::infinity() ); \ + } \ + { \ + stringstream str; \ + \ + str << "-1E+" << (numeric_limits::max_exponent10 + 1); \ + \ + str >> in_val_d; \ + CPPUNIT_ASSERT(!str.fail()); \ + CPPUNIT_ASSERT(str.eof()); \ + CPPUNIT_CHECK( in_val_d == in_val_d ); \ + CPPUNIT_CHECK( in_val_d == -numeric_limits::infinity() ); \ + } \ + { \ + stringstream str; \ + \ + str << "1E" << (numeric_limits::min_exponent10 - 1); \ + \ + str >> in_val_d; \ + CPPUNIT_ASSERT(!str.fail()); \ + CPPUNIT_ASSERT(str.eof()); \ + CPPUNIT_CHECK( in_val_d == in_val_d ); \ + CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= numeric_limits::min() ); \ + } \ + } + + __check_get_float( float ) + __check_get_float( double ) +# if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) + __check_get_float( long double ) +# endif +# undef __check_get_float +#endif // _STLP_NO_MEMBER_TEMPLATES +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(NumPutGetTest); + +#if defined (_MSC_VER) +# pragma warning (disable : 4056) +# pragma warning (disable : 4756) +#endif + +// +// tests implementation +// +void NumPutGetTest::num_put_float() +{ + { + string output, digits; + + { + ostringstream ostr; + ostr << 1.23457e+17f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + digits = "17"; + complete_digits(digits); + CPPUNIT_CHECK(output == string("1.23457e+") + digits ); + } + + { + ostringstream ostr; + ostr << setprecision(200) << 1.23457e+17f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK( output.size() < 200 ); + } + + { + ostringstream ostr; + ostr << setprecision(200) << numeric_limits::min(); + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK( output.size() < 200 ); + } + + { + ostringstream ostr; + ostr << fixed << 1.23457e+17f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output.size() == 25); + CPPUNIT_CHECK(output.substr(0, 5) == "12345"); + CPPUNIT_CHECK(output.substr(18) == ".000000"); + } + + { + ostringstream ostr; + ostr << fixed << showpos << 1.23457e+17f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output.size() == 26); + CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); + CPPUNIT_CHECK(output.substr(19) == ".000000"); + } + + { + ostringstream ostr; + ostr << fixed << showpos << setprecision(100) << 1.23457e+17f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output.size() == 120); + CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); + CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); + } + + { + ostringstream ostr; + ostr << scientific << setprecision(8) << 0.12345678f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + digits = "1"; + complete_digits(digits); + CPPUNIT_CHECK(output == string("1.23456780e-") + digits ); + } + + { + ostringstream ostr; + ostr << fixed << setprecision(8) << setw(30) << setfill('0') << 0.12345678f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output == "000000000000000000000.12345678"); + } + + { + ostringstream ostr; + ostr << fixed << showpos << setprecision(8) << setw(30) << setfill('0') << 0.12345678f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output == "0000000000000000000+0.12345678"); + } + + { + ostringstream ostr; + ostr << fixed << showpos << setprecision(8) << setw(30) << left << setfill('0') << 0.12345678f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output == "+0.123456780000000000000000000"); + } + + { + ostringstream ostr; + ostr << fixed << showpos << setprecision(8) << setw(30) << internal << setfill('0') << 0.12345678f; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output == "+00000000000000000000.12345678"); + } + + { + ostringstream ostr; + ostr << fixed << showpos << setprecision(100) << 1.234567e+17; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output.size() == 120); + CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); + CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); + } + +#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) + { + ostringstream ostr; + ostr << fixed << showpos << setprecision(100) << 1.234567e+17l; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK(output.size() == 120); + CPPUNIT_CHECK(output.substr(0, 6) == "+12345"); + CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); + } +#endif + + { + ostringstream ostr; + ostr << scientific << setprecision(50) << 0.0; + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + CPPUNIT_CHECK( output == "0.00000000000000000000000000000000000000000000000000e+00" ); + } + { + ostringstream ostr; + ostr << fixed << setprecision(100) << numeric_limits::max(); + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + //CPPUNIT_MESSAGE( output.c_str() ); + } + + { + ostringstream ostr; + ostr << setprecision(100) << numeric_limits::max(); + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + //CPPUNIT_MESSAGE( output.c_str() ); + } + +#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) + { + ostringstream ostr; + ostr << setprecision(100) << numeric_limits::max(); + CPPUNIT_ASSERT(ostr.good()); + output = reset_stream(ostr); + //CPPUNIT_MESSAGE( output.c_str() ); + } +#endif + + //{ + // ostringstream ostr; + // ostr << setprecision(-numeric_limits::min_exponent10 + numeric_limits::digits10 + 9) << numeric_limits::min(); + // CPPUNIT_ASSERT(ostr.good()); + // output = reset_stream(ostr); + // //CPPUNIT_MESSAGE( output.c_str() ); + //} + + //{ + // ostringstream ostr; + // ostr << setprecision(-numeric_limits::min_exponent10 + numeric_limits::digits10) << numeric_limits::min(); + // CPPUNIT_ASSERT(ostr.good()); + // output = reset_stream(ostr); + // //CPPUNIT_MESSAGE( output.c_str() ); + //} + +//#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) +// { +// ostringstream ostr; +// ostr << setprecision(-numeric_limits::min_exponent10 + numeric_limits::digits10) << numeric_limits::min(); +// CPPUNIT_ASSERT(ostr.good()); +// output = reset_stream(ostr); +// CPPUNIT_MESSAGE( output.c_str() ); +// } +//#endif + } + + { + ostringstream str; + + str.setf(ios::fixed, ios::floatfield); + str << 1.0e+5; + // cerr << str.str() << endl; + CPPUNIT_CHECK( str.str() == "100000.000000" ); + + reset_stream(str); + str.precision(0); + str << 1.0e+5; + CPPUNIT_CHECK( str.str() == "100000" ); + + reset_stream(str); + str.precision(4); + str << 1.0e+5; + CPPUNIT_CHECK( str.str() == "100000.0000" ); + + reset_stream(str); + str.precision(0); + str << 1.0e+83; + CPPUNIT_CHECK( str.str().size() == 84 ); + //printf("\nC result: %.0f\n", 1.0e+83); + //CPPUNIT_MESSAGE( str.str().c_str() ); + //CPPUNIT_CHECK( str.str() == "100000000000000000000000000000000000000000000000000000000000000000000000000000000000" ); + + // cerr.setf(ios::fixed, ios::floatfield); + // cerr << DBL_MAX << endl; + // cerr << 1.0e+37 << endl; + } +} + +#define CHECK_COMPLETE(type, val, base, showbase, showpos, casing, width, adjust, expected) \ +{ \ + type tmp = val; \ + ostringstream ostr; \ + ostr << base << showbase << showpos << casing << setw(width) << adjust << tmp; \ + CPPUNIT_CHECK( ostr.str() == expected ); \ +} + +#define CHECK(type, val, base, expected) \ + CHECK_COMPLETE(type, val, base, noshowbase, noshowpos, nouppercase, 0, right, expected) + +void NumPutGetTest::num_put_integer() +{ + //octal outputs + { + CHECK(short, 0, oct, "0") + CHECK(short, 1, oct, "1") + CHECK(short, 12345, oct, "30071") + if (sizeof(short) == 2) { + CHECK(short, -1, oct, "177777") + CHECK(short, -12345, oct, "147707") + } + + CHECK(unsigned short, 0, oct, "0") + CHECK(unsigned short, 12345, oct, "30071") + + CHECK(int, 0, oct, "0") + CHECK(int, 12345678, oct, "57060516") + if (sizeof(int) == 4) { + CHECK(int, -1, oct, "37777777777") + CHECK(int, -12345678, oct, "37720717262") + } + + CHECK(unsigned int, 0, oct, "0") + CHECK(unsigned int, 12345678, oct, "57060516") + + CHECK(long, 0, oct, "0") + CHECK(long, 12345678, oct, "57060516") + if (sizeof(long) == 4) { + CHECK(long, -1, oct, "37777777777") + CHECK(long, -12345678, oct, "37720717262") + } + + CHECK(unsigned long, 0, oct, "0") + CHECK(unsigned long, 12345678, oct, "57060516") + +#if defined (STLPORT) && defined (_STLP_LONG_LONG) + CHECK(_STLP_LONG_LONG, 0, oct, "0") + CHECK(_STLP_LONG_LONG, 12345678, oct, "57060516") + if (sizeof(_STLP_LONG_LONG) == 8) { + CHECK(_STLP_LONG_LONG, -1, oct, "1777777777777777777777") + CHECK(_STLP_LONG_LONG, -12345678, oct, "1777777777777720717262") + } + + CHECK(unsigned _STLP_LONG_LONG, 0, oct, "0") + CHECK(unsigned _STLP_LONG_LONG, 12345678, oct, "57060516") +#endif + + //Even with showbase, 0 value gives "0" (see printf documentation) + CHECK_COMPLETE(short, 0, oct, showbase, noshowpos, nouppercase, 0, right, "0") + CHECK_COMPLETE(short, 0, oct, showbase, showpos, nouppercase, 6, right, " 0") + + CHECK_COMPLETE(short, 1, oct, showbase, noshowpos, nouppercase, 6, right, " 01") + CHECK_COMPLETE(short, 1, oct, showbase, noshowpos, nouppercase, 6, left, "01 ") + CHECK_COMPLETE(short, 1, oct, showbase, showpos, nouppercase, 6, internal, " 01") + } + + //decimal outputs + { + CHECK(short, 0, dec, "0") + CHECK(short, -1, dec, "-1") + CHECK(short, 12345, dec, "12345") + CHECK(short, -12345, dec, "-12345") + + CHECK(unsigned short, 0, dec, "0") + CHECK(unsigned short, 12345, dec, "12345") + + CHECK(int, 0, dec, "0") + CHECK(int, -1, dec, "-1") + CHECK(int, 12345678, dec, "12345678") + CHECK(int, -12345678, dec, "-12345678") + + CHECK(unsigned int, 0, dec, "0") + CHECK(unsigned int, 12345678, dec, "12345678") + + CHECK(long, 0, dec, "0") + CHECK(long, -1, dec, "-1") + CHECK(long, 12345678, dec, "12345678") + CHECK(long, -12345678, dec, "-12345678") + + CHECK(unsigned long, 0, dec, "0") + CHECK(unsigned long, 12345678, dec, "12345678") +#if defined (STLPORT) && defined (_STLP_LONG_LONG) + CHECK(_STLP_LONG_LONG, 0, dec, "0") + CHECK(_STLP_LONG_LONG, -1, dec, "-1") + CHECK(_STLP_LONG_LONG, 12345678, dec, "12345678") + CHECK(_STLP_LONG_LONG, -12345678, dec, "-12345678") + + CHECK(unsigned _STLP_LONG_LONG, 0, dec, "0") + CHECK(unsigned _STLP_LONG_LONG, 12345678, dec, "12345678") +#endif + + CHECK_COMPLETE(short, 0, dec, showbase, showpos, nouppercase, 0, right, "+0") + CHECK_COMPLETE(short, 0, dec, showbase, showpos, nouppercase, 6, right, " +0") + CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, right, " +1") + CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, left, "+1 ") + CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, internal, "+ 1") + } + + //hexadecimal outputs + { + CHECK(short, 0, hex, "0") + CHECK(short, 12345, hex, "3039") + if (sizeof(short) == 2) { + CHECK(short, -1, hex, "ffff") + CHECK(short, -12345, hex, "cfc7") + } + + CHECK(unsigned short, 0, hex, "0") + CHECK(unsigned short, 12345, hex, "3039") + + CHECK(int, 0, hex, "0") + CHECK(int, 12345678, hex, "bc614e") + if (sizeof(int) == 4) { + CHECK(int, -1, hex, "ffffffff") + CHECK(int, -12345678, hex, "ff439eb2") + } + + CHECK(unsigned int, 0, hex, "0") + CHECK(unsigned int, 12345678, hex, "bc614e") + + CHECK(long, 0, hex, "0") + CHECK(long, 12345678, hex, "bc614e") + if (sizeof(long) == 4) { + CHECK(long, -1, hex, "ffffffff") + CHECK(long, -12345678, hex, "ff439eb2") + } + + CHECK(unsigned long, 0, hex, "0") + CHECK(unsigned long, 12345678, hex, "bc614e") +#if defined (STLPORT) && defined (_STLP_LONG_LONG) + CHECK(_STLP_LONG_LONG, 0, hex, "0") + CHECK(_STLP_LONG_LONG, 12345678, hex, "bc614e") + if (sizeof(_STLP_LONG_LONG) == 8) { + CHECK(_STLP_LONG_LONG, -1, hex, "ffffffffffffffff") + CHECK(_STLP_LONG_LONG, -12345678, hex, "ffffffffff439eb2") + } + + CHECK(unsigned _STLP_LONG_LONG, 0, hex, "0") + CHECK(unsigned _STLP_LONG_LONG, 12345678, hex, "bc614e") +#endif + + //Even with showbase, 0 value gives "0" output (see printf documentation) + CHECK_COMPLETE(short, 0, hex, showbase, showpos, nouppercase, 0, right, "0") + CHECK_COMPLETE(short, 0, hex, showbase, noshowpos, nouppercase, 6, right, " 0") + CHECK_COMPLETE(short, 0, hex, showbase, noshowpos, nouppercase, 6, internal, " 0") + + CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, right, " 0x1") + CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, left, "0x1 ") + CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, internal, "0x 1") + CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, uppercase, 6, left, "0X1 ") + CHECK_COMPLETE(short, 1, hex, showbase, showpos, uppercase, 6, internal, "0X 1") + } +} + +void NumPutGetTest::num_get_float() +{ + float in_val; + + istringstream istr; + + istr.str("1.2345"); + istr >> in_val; + CPPUNIT_ASSERT(!istr.fail()); + CPPUNIT_ASSERT(istr.eof()); + CPPUNIT_ASSERT(check_float(in_val, 1.2345f)); + istr.clear(); + + istr.str("-1.2345"); + istr >> in_val; + CPPUNIT_ASSERT(!istr.fail()); + CPPUNIT_ASSERT(istr.eof()); + CPPUNIT_ASSERT(check_float(in_val, -1.2345f)); + istr.clear(); + + istr.str("+1.2345"); + istr >> in_val; + CPPUNIT_ASSERT(!istr.fail()); + CPPUNIT_ASSERT(check_float(in_val, 1.2345f)); + istr.clear(); + + istr.str("000000000000001.234500000000"); + istr >> in_val; + CPPUNIT_ASSERT(!istr.fail()); + CPPUNIT_ASSERT(istr.eof()); + CPPUNIT_ASSERT(check_float(in_val, 1.2345f)); + istr.clear(); + + istr.str("1.2345e+04"); + istr >> in_val; + CPPUNIT_ASSERT(!istr.fail()); + CPPUNIT_ASSERT(istr.eof()); + CPPUNIT_ASSERT(check_float(in_val, 12345.0f)); + istr.clear(); + + CPPUNIT_MESSAGE( "float" ); + check_get_float( 0.0F ); + CPPUNIT_MESSAGE( "double" ); + check_get_float( 0.0 ); +#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) + CPPUNIT_MESSAGE( "long double" ); + check_get_float( 0.0L ); +#endif + { + stringstream str; + + str << "1e" << numeric_limits::max_exponent10; + CPPUNIT_ASSERT(!str.fail()); + + float val; + str >> val; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_ASSERT( numeric_limits::max_exponent10 <= numeric_limits::max_exponent10 || + val == numeric_limits::infinity() ); + } + { + stringstream str; + + str << "1e" << numeric_limits::min_exponent10; + CPPUNIT_ASSERT(!str.fail()); + + float val; + str >> val; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_ASSERT( numeric_limits::min_exponent10 >= numeric_limits::min_exponent10 || + val == 0.0f ); + } +#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) + { + stringstream str; + + str << "1e" << numeric_limits::max_exponent10; + CPPUNIT_ASSERT(!str.fail()); + + double val; + str >> val; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_ASSERT( numeric_limits::max_exponent10 <= numeric_limits::max_exponent10 || + val == numeric_limits::infinity() ); + } + { + stringstream str; + + str << "1e" << numeric_limits::min_exponent10; + CPPUNIT_ASSERT(!str.fail()); + + double val; + str >> val; + CPPUNIT_ASSERT(!str.fail()); + CPPUNIT_ASSERT(str.eof()); + CPPUNIT_ASSERT( numeric_limits::min_exponent10 >= numeric_limits::min_exponent10 || + val == 0.0 ); + } + { + const char* p = "2.718281828459045235360287471352662497757247093e0"; + std::stringstream s; + s << p; + long double x; + s >> x; + CPPUNIT_ASSERT( x > 2.70l && x < 2.72l ); + } +#endif +} + +void NumPutGetTest::num_get_integer() +{ + //octal input + { + istringstream istr; + istr.str("30071"); + short val; + istr >> oct >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 12345 ); + istr.clear(); + + if (sizeof(short) == 2) { + istr.str("177777"); + istr >> oct >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == -1 ); + istr.clear(); + } + } + + //decimal input + { + istringstream istr; + istr.str("10000"); + short val = -1; + istr >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 10000 ); + istr.clear(); + + istr.str("+10000"); + val = -1; + istr >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 10000 ); + istr.clear(); + + if (sizeof(short) == 2) { + val = -1; + istr.str("10000000"); + istr >> val; + CPPUNIT_ASSERT( istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == -1 ); + istr.clear(); + } + + val = -1; + istr.str("0x0"); + istr >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( !istr.eof() ); + CPPUNIT_ASSERT( val == 0 ); + istr.clear(); + + val = -1; + istr.str("000001"); + istr >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 1 ); + istr.clear(); + } + + //hexadecimal input + { + istringstream istr; + istr.str("3039"); + short val = -1; + istr >> hex >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 12345 ); + istr.clear(); + + istr.str("x3039"); + val = -1; + istr >> hex >> val; + CPPUNIT_ASSERT( istr.fail() ); + CPPUNIT_ASSERT( !istr.eof() ); + CPPUNIT_ASSERT( val == -1 ); + istr.clear(); + + istr.str("03039"); + val = -1; + istr >> hex >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 12345 ); + istr.clear(); + + istr.str("0x3039"); + istr >> hex >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == 12345 ); + istr.clear(); + + if (sizeof(short) == 2) { + val = -1; + istr.str("cfc7"); + istr >> hex >> val; + CPPUNIT_ASSERT( !istr.fail() ); + CPPUNIT_ASSERT( istr.eof() ); + CPPUNIT_ASSERT( val == -12345 ); + istr.clear(); + } + } +} + +void NumPutGetTest::inhex() +{ + { + ostringstream s; + s << hex << 0; + CPPUNIT_CHECK( s.str() == "0" ); + } + { + ostringstream s; + s << hex << 0xff; + CPPUNIT_CHECK( s.str() == "ff" ); + } + { + ostringstream s; + s << hex << setw( 4 ) << 0xff; + CPPUNIT_CHECK( s.str() == " ff" ); + } + { + ostringstream s; + s << hex << setw( 4 ) << 0; + CPPUNIT_CHECK( s.str() == " 0" ); + } + { + ostringstream s; + s << hex << showbase << 0; + CPPUNIT_CHECK( s.str() == "0" ); + } + { + ostringstream s; + s << hex << showbase << 0xff; + CPPUNIT_CHECK( s.str() == "0xff" ); + } + { + ostringstream s; + s << hex << showbase << setw( 4 ) << 0xff; + CPPUNIT_CHECK( s.str() == "0xff" ); + } + { // special case for regression (partially duplicate CHECK_COMPLETE above): + ostringstream s; + s.setf( ios_base::internal, ios_base::adjustfield ); + s << hex << showbase << setw(8+2) << 0; + CPPUNIT_CHECK( s.str() == " 0" ); + } +} + +void NumPutGetTest::pointer() +{ + // Problem with printing pointer to null + + /* + * Really C's formatting not help here, due to: + * + * p The argument shall be a pointer to void. The value of + * the pointer is converted to a sequence of printable characters, + * in an implementation-defined manner. + */ + { + /* + char buf[128]; + void *p = (void *)0xff00; + sprintf( buf, "%p", p ); + // cerr << buf << endl; + // Hmmm, I see 0xff00 on box with 32-bits address; pointer like 'unsigned hex'? + if ( sizeof( p ) == 2 ) { + CPPUNIT_ASSERT( strcmp( buf, "0xff00" ) == 0 ); + } else if ( sizeof( p ) == 4 ) { + CPPUNIT_ASSERT( strcmp( buf, "0x0000ff00" ) == 0 ); + } else if ( sizeof( p ) == 8 ) { + CPPUNIT_ASSERT( strcmp( buf, "0x000000000000ff00" ) == 0 ); + } else { + CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 ); + } + */ + } + { + /* + char buf[128]; + void *p = 0; + */ + // sprintf( buf, "%p", p ); + /* Cool. "%p" print '(nil)'; "%#x" print '0' */ + // sprintf( buf, "%#x", (unsigned)p ); + // cerr << buf << endl; + } + { + ostringstream s; + void *p = (void *)0xff00; + s << p; + CPPUNIT_ASSERT( s.good() ); + if ( sizeof( p ) == 2 ) { + CPPUNIT_ASSERT( s.str() == "0xff00" ); + } else if ( sizeof( p ) == 4 ) { + CPPUNIT_ASSERT( s.str() == "0x0000ff00" ); // this pass + } else if ( sizeof( p ) == 8 ) { + CPPUNIT_ASSERT( s.str() == "0x000000000000ff00" ); + } else { + CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 ); + } + } + { + ostringstream s; + void *p = 0; + s << p; + CPPUNIT_ASSERT( s.good() ); + if ( sizeof( p ) == 2 ) { + CPPUNIT_ASSERT( s.str() == "0x0000" ); + } else if ( sizeof( p ) == 4 ) { + CPPUNIT_ASSERT( s.str() == "0x00000000" ); // but this will fail, if follow %p + } else if ( sizeof( p ) == 8 ) { + CPPUNIT_ASSERT( s.str() == "0x0000000000000000" ); + } else { + CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 ); + } + } +} + +void NumPutGetTest::fix_float_long() +{ + ostringstream str; + + str.setf(ios::fixed, ios::floatfield); + str << 1.0e+5; + CPPUNIT_CHECK( str.str() == "100000.000000" ); + + reset_stream(str); + str.precision(0); + str << 1.0e+5; + CPPUNIT_CHECK( str.str() == "100000" ); + + reset_stream(str); + str.precision(4); + str << 1.0e+5; + CPPUNIT_CHECK( str.str() == "100000.0000" ); + + reset_stream(str); + str.precision(0); + str << 1.0e+83; + { + istringstream istr( str.str() ); + double f; + istr >> f; + CPPUNIT_CHECK( !istr.fail() ); + if ( int(numeric_limits::digits10) < 83 ) { + double delta = 1.0; + for ( int ee = 83 - int(numeric_limits::digits10); ee > 0; --ee ) { + delta *= 10.0; + } + // we may loss some digits here, but not more than mantissa: + CPPUNIT_CHECK( (f > (1.0e+83 - delta)) && (f < (1.0e+83 + delta)) ); + } else { + CPPUNIT_CHECK( check_double(f, 1.0e+83) ); + } + } + +#if 0 // #ifndef _STLP_NO_LONG_DOUBLE + reset_stream(str); + str.precision(0); + str << 1.0e+83l; + { + istringstream istr( str.str() ); + long double f; + istr >> f; + CPPUNIT_CHECK( !istr.fail() ); + if ( int(numeric_limits::digits10) < 83 ) { + long double delta = 1.0l; + for ( int ee = 83 - int(numeric_limits::digits10); ee > 0; --ee ) { + delta *= 10.0l; + } + // we may loss some digits here, but not more than mantissa: + cerr << "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" << endl; + cerr << str.str() << endl; + cerr << delta << endl; + cerr << f << endl; + CPPUNIT_CHECK( (f > (1.0e+83l - delta)) && (f < (1.0e+83l + delta)) ); + } else { + CPPUNIT_CHECK( check_double(f, 1.0e+83l) ); + } + } +#endif + + reset_stream(str); + str.precision(0); + str << numeric_limits::max(); + { + istringstream istr( str.str() ); + double f; + istr >> f; + CPPUNIT_CHECK( !istr.fail() ); + if ( int(numeric_limits::digits10) < int(numeric_limits::max_exponent10) ) { + double delta = 9.0; + for ( int ee = int(numeric_limits::max_exponent10) - int(numeric_limits::digits10); ee > 0; --ee ) { + delta *= 10.0; + } + // we may loss some digits here, but not more than mantissa: + CPPUNIT_CHECK( (f > (numeric_limits::max() - delta)) ); + } + } + +#if 0 // #ifndef _STLP_NO_LONG_DOUBLE + reset_stream(str); + str.precision(0); + str << numeric_limits::max(); + { + istringstream istr( str.str() ); + long double f; + istr >> f; + CPPUNIT_CHECK( !istr.fail() ); + if ( int(numeric_limits::digits10) < int(numeric_limits::max_exponent10) ) { + long double delta = 1.0l; + for ( int ee = int(numeric_limits::max_exponent10) - int(numeric_limits::digits10); ee > 0; --ee ) { + delta *= 10.0l; + } + // we may loss some digits here, but not more than mantissa: + CPPUNIT_CHECK( (f > (numeric_limits::max() - delta)) ); + } + } +#endif +} + +class CommaSepNumPunct : public numpunct { + char do_thousands_sep() const { return ','; } + string do_grouping() const { return string("\1\2\3") + (char)CHAR_MAX; } +}; + +#define CHECK2(val, expected) \ + os.str(""); os << fixed << setprecision(3) << showpos << val; \ + CPPUNIT_ASSERT( os.str() == expected ) + +void NumPutGetTest::custom_numpunct() +{ + ostringstream os; + locale loc(os.getloc(), new CommaSepNumPunct()); + os.imbue(loc); + + CHECK2(1, "+1"); + CHECK2(10, "+1,0"); + CHECK2(100, "+10,0"); + CHECK2(1000, "+1,00,0"); + + CHECK2(1.234, "+1.234"); + CHECK2(123.456, "+12,3.456"); + CHECK2(1234.567, "+1,23,4.567"); + CHECK2(12345.678, "+12,34,5.678"); + CHECK2(123456.789, "+123,45,6.789"); + CHECK2(1234567.891, "+1,234,56,7.891"); + CHECK2(123456789.123, "+123,456,78,9.123"); + //CHECK2(100000000000000000000000000000.0, "+100000000000000000000000,000,00,0.000"); + CHECK2(numeric_limits::infinity(), "+inf"); + + CHECK2(-1.234, "-1.234"); + CHECK2(-123.456, "-12,3.456"); + CHECK2(-1234.567, "-1,23,4.567"); + CHECK2(-12345.678, "-12,34,5.678"); + CHECK2(-123456.789, "-123,45,6.789"); + CHECK2(-1234567.891, "-1,234,56,7.891"); + CHECK2(-123456789.123, "-123,456,78,9.123"); + //CHECK2(-100000000000000000000000000000.0, "-100000000000000000000000,000,00,0.000"); + CHECK2(-numeric_limits::infinity(), "-inf"); +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/numeric_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/numeric_header_test.cpp new file mode 100644 index 00000000000..38d23dd65dd --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/numeric_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/ostmit_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ostmit_test.cpp new file mode 100644 index 00000000000..f94353e9344 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ostmit_test.cpp @@ -0,0 +1,52 @@ +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class OstreamIteratorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(OstreamIteratorTest); + CPPUNIT_TEST(ostmit0); + CPPUNIT_TEST_SUITE_END(); + +protected: + void ostmit0(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(OstreamIteratorTest); + +// +// tests implementation +// +void OstreamIteratorTest::ostmit0() +{ + // not necessary, tested in copy_test + int array [] = { 1, 5, 2, 4 }; + + const char* text = "hello"; + + ostringstream os; + + ostream_iterator iter(os); + copy(text, text + 5, iter); + CPPUNIT_ASSERT(os.good()); + os << ' '; + CPPUNIT_ASSERT(os.good()); + + ostream_iterator iter2(os); + copy(array, array + 4, iter2); + CPPUNIT_ASSERT(os.good()); + CPPUNIT_ASSERT(os.str() == "hello 1524"); +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/ostream_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ostream_header_test.cpp new file mode 100644 index 00000000000..9c9ccb4be87 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ostream_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/pair_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/pair_test.cpp new file mode 100644 index 00000000000..6fc5172ac0d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/pair_test.cpp @@ -0,0 +1,46 @@ +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +class PairTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(PairTest); + CPPUNIT_TEST(pair0); + CPPUNIT_TEST(init); + CPPUNIT_TEST_SUITE_END(); + + protected: + void pair0(); + void init(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PairTest); + +void PairTest::pair0() +{ + pair p = make_pair(1, 10); + + CPPUNIT_ASSERT(p.first==1); + CPPUNIT_ASSERT(p.second==10); +} + +void PairTest::init() +{ + pair PAIR_ARRAY[] = { pair(0, "0") }; + + int PAIR_ARRAY_SIZE = sizeof(PAIR_ARRAY) > 0 ? sizeof(PAIR_ARRAY) / sizeof(PAIR_ARRAY[0]) : 0; + + + for ( int i = 0; i < PAIR_ARRAY_SIZE; i++ ) { + CPPUNIT_CHECK( PAIR_ARRAY[i].first == 0 ); + CPPUNIT_CHECK( PAIR_ARRAY[i].second == "0" ); + PAIR_ARRAY[i].second = "1"; + } +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/partial_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/partial_test.cpp new file mode 100644 index 00000000000..b7650fdddb6 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/partial_test.cpp @@ -0,0 +1,248 @@ +#include +#include +#include +#include + +#if defined (STLPORT) && defined (_STLP_DEBUG) && defined (_STLP_DEBUG_MODE_THROWS) +# define _STLP_DO_CHECK_BAD_PREDICATE +# include +#endif + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class PartialTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(PartialTest); + CPPUNIT_TEST(parsrt0); + CPPUNIT_TEST(parsrt1); + CPPUNIT_TEST(parsrt2); + CPPUNIT_TEST(parsrtc0); + CPPUNIT_TEST(parsrtc1); + CPPUNIT_TEST(parsrtc2); +#if defined (_STLP_DO_CHECK_BAD_PREDICATE) + CPPUNIT_TEST(bad_predicate_detected); +#endif + CPPUNIT_TEST(partsum0); + CPPUNIT_TEST(partsum1); + CPPUNIT_TEST(partsum2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void parsrt0(); + void parsrt1(); + void parsrt2(); + void parsrtc0(); + void parsrtc1(); + void parsrtc2(); + void partsum0(); + void partsum1(); + void partsum2(); + void bad_predicate_detected(); + + static bool str_compare(const char* a_, const char* b_) + { + return strcmp(a_, b_) < 0 ? 1 : 0; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PartialTest); + +// +// tests implementation +// +void PartialTest::parsrt0() +{ + int numbers[6] = { 5, 2, 4, 3, 1, 6 }; + + partial_sort((int*)numbers, (int*)numbers + 3, (int*)numbers + 6); + + // 1 2 3 5 4 6 + CPPUNIT_ASSERT(numbers[0]==1); + CPPUNIT_ASSERT(numbers[1]==2); + CPPUNIT_ASSERT(numbers[2]==3); + CPPUNIT_ASSERT(numbers[3]==5); + CPPUNIT_ASSERT(numbers[4]==4); + CPPUNIT_ASSERT(numbers[5]==6); +} + +void PartialTest::parsrt1() +{ + // 8 8 5 3 7 6 5 3 2 4 + // 2 3 3 4 5 8 8 7 6 5 + int numbers[10] ={ 8, 8, 5, 3, 7, 6, 5, 3, 2, 4 }; + + vector v1(numbers, numbers+10); + partial_sort(v1.begin(), v1.begin() + v1.size() / 2, v1.end()); + + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==3); + CPPUNIT_ASSERT(v1[2]==3); + CPPUNIT_ASSERT(v1[3]==4); + CPPUNIT_ASSERT(v1[4]==5); + CPPUNIT_ASSERT(v1[5]==8); + CPPUNIT_ASSERT(v1[6]==8); + CPPUNIT_ASSERT(v1[7]==7); + CPPUNIT_ASSERT(v1[8]==6); + CPPUNIT_ASSERT(v1[9]==5); +} + +void PartialTest::parsrt2() +{ + char const* names[] = { "aa", "ff", "dd", "ee", "cc", "bb" }; + + const unsigned nameSize = sizeof(names) / sizeof(names[0]); + vector v1(nameSize); + for(size_t i = 0; i < v1.size(); i++) + v1[i] = names[i]; + + partial_sort(v1.begin(), v1.begin() + nameSize / 2, v1.end(), str_compare); + + // aa bb cc ff ee dd + CPPUNIT_ASSERT( strcmp(v1[0], "aa") == 0 ); + CPPUNIT_ASSERT( v1[0] == names[0] ); + CPPUNIT_ASSERT( strcmp(v1[1], "bb") == 0 ); + CPPUNIT_ASSERT( v1[1] == names[5] ); + CPPUNIT_ASSERT( strcmp(v1[2], "cc") == 0 ); + CPPUNIT_ASSERT( v1[2] == names[4] ); + CPPUNIT_ASSERT( strcmp(v1[3], "ff") == 0 ); + CPPUNIT_ASSERT( v1[3] == names[1] ); + CPPUNIT_ASSERT( strcmp(v1[4], "ee") == 0 ); + CPPUNIT_ASSERT( v1[4] == names[3] ); + CPPUNIT_ASSERT( strcmp(v1[5], "dd") == 0 ); + CPPUNIT_ASSERT( v1[5] == names[2] ); +} + +void PartialTest::parsrtc0() +{ + int numbers[6] = { 5, 2, 4, 3, 1, 6 }; + + int result[3]; + partial_sort_copy((int*)numbers, (int*)numbers + 6, (int*)result, (int*)result + 3); + //1 2 3 + CPPUNIT_ASSERT(result[0]==1); + CPPUNIT_ASSERT(result[1]==2); + CPPUNIT_ASSERT(result[2]==3); +} + +void PartialTest::parsrtc1() +{ + int numbers[10] ={ 3, 0, 4, 3, 2, 8, 2, 7, 7, 5 }; + + //3 0 4 3 2 8 2 7 7 5 + //0 2 2 3 3 + + vector v1(numbers, numbers+10); + vector result(5); + + partial_sort_copy(v1.begin(), v1.end(), result.begin(), result.end()); + CPPUNIT_ASSERT(result[0]==0); + CPPUNIT_ASSERT(result[1]==2); + CPPUNIT_ASSERT(result[2]==2); + CPPUNIT_ASSERT(result[3]==3); + CPPUNIT_ASSERT(result[4]==3); +} + +void PartialTest::parsrtc2() +{ + char const* names[] = { "aa", "ff", "dd", "ee", "cc", "bb" }; + + const unsigned nameSize = sizeof(names) / sizeof(names[0]); + vector v1(nameSize); + for(size_t i = 0; i < v1.size(); i++) + v1[i] = names[i]; + vector result(3); + partial_sort_copy(v1.begin(), v1.end(), result.begin(), result.end(), str_compare); + + // aa bb cc + CPPUNIT_ASSERT( strcmp( result[0], "aa" ) == 0 ); + CPPUNIT_ASSERT( result[0] == names[0] ); + CPPUNIT_ASSERT( strcmp( result[1], "bb" ) == 0 ); + CPPUNIT_ASSERT( result[1] == names[5] ); + CPPUNIT_ASSERT( strcmp( result[2], "cc" ) == 0 ); + CPPUNIT_ASSERT( result[2] == names[4] ); +} + +#if defined (_STLP_DO_CHECK_BAD_PREDICATE) +void PartialTest::bad_predicate_detected() +{ + int numbers[] = { 0, 0, 1, 0, 0, 1, 0, 0 }; + const size_t s = sizeof(numbers) / sizeof(numbers[0]); + + try { + partial_sort(numbers, numbers + s / 2, numbers + s, less_equal()); + + //Here is means that no exception has been raised + CPPUNIT_ASSERT( false ); + } + catch (runtime_error const&) + { /*OK bad predicate has been detected.*/ } + + try { + vector result(s); + partial_sort_copy(numbers, numbers + s, result.begin(), result.end(), less_equal()); + + //Here is means that no exception has been raised + CPPUNIT_ASSERT( false ); + } + catch (runtime_error const&) + { /*OK bad predicate has been detected.*/ } +} +#endif + +void PartialTest::partsum0() +{ + int numbers[6] = { 1, 2, 3, 4, 5, 6 }; + + int result[6]; + partial_sum((int*)numbers, (int*)numbers + 6, (int*)result); + + // 1 3 6 10 15 21 + CPPUNIT_ASSERT(result[0]==1); + CPPUNIT_ASSERT(result[1]==3); + CPPUNIT_ASSERT(result[2]==6); + CPPUNIT_ASSERT(result[3]==10); + CPPUNIT_ASSERT(result[4]==15); + CPPUNIT_ASSERT(result[5]==21); +} + +void PartialTest::partsum1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + vector v2(v1.size()); + partial_sum(v1.begin(), v1.end(), v2.begin()); + + // 0 1 3 6 10 15 21 28 36 45 + CPPUNIT_ASSERT(v2[0]==0); + CPPUNIT_ASSERT(v2[1]==1); + CPPUNIT_ASSERT(v2[2]==3); + CPPUNIT_ASSERT(v2[3]==6); + CPPUNIT_ASSERT(v2[4]==10); + CPPUNIT_ASSERT(v2[5]==15); + CPPUNIT_ASSERT(v2[6]==21); + CPPUNIT_ASSERT(v2[7]==28); + CPPUNIT_ASSERT(v2[8]==36); + CPPUNIT_ASSERT(v2[9]==45); +} + +void PartialTest::partsum2() +{ + vector v1(5); + __iota(v1.begin(), v1.end(), 1); + vector v2(v1.size()); + partial_sum(v1.begin(), v1.end(), v2.begin(), multiplies()); + // 1 2 6 24 120 + CPPUNIT_ASSERT(v2[0]==1); + CPPUNIT_ASSERT(v2[1]==2); + CPPUNIT_ASSERT(v2[2]==6); + CPPUNIT_ASSERT(v2[3]==24); + CPPUNIT_ASSERT(v2[4]==120); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/partition_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/partition_test.cpp new file mode 100644 index 00000000000..cc5c91b4609 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/partition_test.cpp @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class PartitionTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(PartitionTest); + CPPUNIT_TEST(ptition0); + CPPUNIT_TEST(ptition1); + CPPUNIT_TEST(stblptn0); + CPPUNIT_TEST(stblptn1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void ptition0(); + void ptition1(); + void stblptn0(); + void stblptn1(); + + struct less_n { + less_n(int limit, size_t &nb_calls) + : _limit(limit), _nb_calls(nb_calls) {} + + bool operator() (int a_) const { + ++_nb_calls; + return a_ < _limit; + } + + int _limit; + size_t &_nb_calls; + + private: + //explicitely defined as private to avoid warnings: + less_n& operator = (less_n const&); + }; +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PartitionTest); + +// +// tests implementation +// +void PartitionTest::stblptn0() +{ + int numbers[6] = { 10, 5, 11, 20, 6, -2 }; + + size_t nb_pred_calls = 0; + stable_partition((int*)numbers, (int*)numbers + 6, less_n(10, nb_pred_calls)); + // 5 6 -2 10 11 20 + CPPUNIT_ASSERT(numbers[0]==5); + CPPUNIT_ASSERT(numbers[1]==6); + CPPUNIT_ASSERT(numbers[2]==-2); + CPPUNIT_ASSERT(numbers[3]==10); + CPPUNIT_ASSERT(numbers[4]==11); + CPPUNIT_ASSERT(numbers[5]==20); + + //Complexity check: + CPPUNIT_ASSERT( nb_pred_calls == sizeof(numbers) / sizeof(numbers[0]) ); +} +void PartitionTest::stblptn1() +{ + //5 5 2 10 0 12 5 0 0 19 + //5 5 2 10 0 5 0 0 12 19 + int numbers[] = { 5, 5, 2, 10, 0, 12, 5, 0, 0, 19 }; + vector v1(numbers, numbers+10); + + size_t nb_pred_calls = 0; + stable_partition(v1.begin(), v1.end(), less_n(11, nb_pred_calls)); + + CPPUNIT_ASSERT(v1[0]==5); + CPPUNIT_ASSERT(v1[1]==5); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==10); + CPPUNIT_ASSERT(v1[4]==0); + CPPUNIT_ASSERT(v1[5]==5); + CPPUNIT_ASSERT(v1[6]==0); + CPPUNIT_ASSERT(v1[7]==0); + CPPUNIT_ASSERT(v1[8]==12); + CPPUNIT_ASSERT(v1[9]==19); + CPPUNIT_ASSERT( nb_pred_calls == v1.size() ); +} +void PartitionTest::ptition0() +{ + int numbers[6] = { 6, 12, 3, 10, 1, 20 }; + size_t nb_pred_calls = 0; + // 6 1 3 10 12 20 + partition((int*)numbers, (int*)numbers + 6, less_n(10, nb_pred_calls)); + CPPUNIT_ASSERT(numbers[0]==6); + CPPUNIT_ASSERT(numbers[1]==1); + CPPUNIT_ASSERT(numbers[2]==3); + CPPUNIT_ASSERT(numbers[3]==10); + CPPUNIT_ASSERT(numbers[4]==12); + CPPUNIT_ASSERT(numbers[5]==20); + + CPPUNIT_ASSERT( nb_pred_calls == sizeof(numbers) / sizeof(numbers[0]) ); +} +void PartitionTest::ptition1() +{ + // 19 3 11 14 10 19 8 17 9 6 + // 6 3 9 8 10 19 14 17 11 19 + + int numbers[10] ={ 19, 3, 11, 14, 10, 19, 8, 17, 9, 6 }; + + vector v1(numbers, numbers+10); + size_t nb_pred_calls = 0; + partition(v1.begin(), v1.end(), less_n(11, nb_pred_calls)); + + CPPUNIT_ASSERT(v1[0]==6); + CPPUNIT_ASSERT(v1[1]==3); + CPPUNIT_ASSERT(v1[2]==9); + CPPUNIT_ASSERT(v1[3]==8); + CPPUNIT_ASSERT(v1[4]==10); + CPPUNIT_ASSERT(v1[5]==19); + CPPUNIT_ASSERT(v1[6]==14); + CPPUNIT_ASSERT(v1[7]==17); + CPPUNIT_ASSERT(v1[8]==11); + CPPUNIT_ASSERT(v1[9]==19); + CPPUNIT_ASSERT( nb_pred_calls == v1.size() ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/perm_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/perm_test.cpp new file mode 100644 index 00000000000..5be6ea09333 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/perm_test.cpp @@ -0,0 +1,228 @@ +#include +#include +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class PermTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(PermTest); + CPPUNIT_TEST(nextprm0); + CPPUNIT_TEST(nextprm1); + CPPUNIT_TEST(nextprm2); + CPPUNIT_TEST(prevprm0); + CPPUNIT_TEST(prevprm1); + CPPUNIT_TEST(prevprm2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void nextprm0(); + void nextprm1(); + void nextprm2(); + void prevprm0(); + void prevprm1(); + void prevprm2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PermTest); + +// +// tests implementation +// +void PermTest::prevprm0() +{ + int v1[3] = { 0, 1, 2 }; + prev_permutation(v1, v1 + 3); + + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==0); +} +void PermTest::prevprm1() +{ + vector v1(3); + __iota(v1.begin(), v1.end(), 0); + + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==0); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==1); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==0); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==2); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==2);// + CPPUNIT_ASSERT(v1[2]==1); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==0); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==1); + prev_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==0); +} +void PermTest::prevprm2() +{ + vector v1(3); + __iota(v1.begin(), v1.end(), 0); + + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==1); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==2); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==0); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==1); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==0); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==1); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==2); + prev_permutation(v1.begin(), v1.end(), greater()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==0); +} +void PermTest::nextprm0() +{ + int v1[3] = { 0, 1, 2 }; + next_permutation(v1, v1 + 3); + + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==1); +} +void PermTest::nextprm1() +{ + vector v1(3); + __iota(v1.begin(), v1.end(), 0); + + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==1); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==2); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==0); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==1); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==2); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==0); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==1); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==0); + CPPUNIT_ASSERT(v1[2]==2); + next_permutation(v1.begin(), v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==0); +} +void PermTest::nextprm2() +{ + vector v1(3); + __iota(v1.begin(), v1.end(), 'A'); + + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='A'); + CPPUNIT_ASSERT(v1[1]=='C'); + CPPUNIT_ASSERT(v1[2]=='B'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='B'); + CPPUNIT_ASSERT(v1[1]=='A'); + CPPUNIT_ASSERT(v1[2]=='C'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='B'); + CPPUNIT_ASSERT(v1[1]=='C'); + CPPUNIT_ASSERT(v1[2]=='A'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='C'); + CPPUNIT_ASSERT(v1[1]=='A'); + CPPUNIT_ASSERT(v1[2]=='B'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='C'); + CPPUNIT_ASSERT(v1[1]=='B'); + CPPUNIT_ASSERT(v1[2]=='A'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='A'); + CPPUNIT_ASSERT(v1[1]=='B'); + CPPUNIT_ASSERT(v1[2]=='C'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='A'); + CPPUNIT_ASSERT(v1[1]=='C'); + CPPUNIT_ASSERT(v1[2]=='B'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='B'); + CPPUNIT_ASSERT(v1[1]=='A'); + CPPUNIT_ASSERT(v1[2]=='C'); + next_permutation(v1.begin(), v1.end(), less()); + CPPUNIT_ASSERT(v1[0]=='B'); + CPPUNIT_ASSERT(v1[1]=='C'); + CPPUNIT_ASSERT(v1[2]=='A'); + +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/plusminus_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/plusminus_test.cpp new file mode 100644 index 00000000000..ee6f5c6f9d2 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/plusminus_test.cpp @@ -0,0 +1,52 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class PlusMinusTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(PlusMinusTest); + CPPUNIT_TEST(plus0); + CPPUNIT_TEST(minus0); + CPPUNIT_TEST_SUITE_END(); + +protected: + void plus0(); + void minus0(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PlusMinusTest); + +// +// tests implementation +// +void PlusMinusTest::plus0() +{ + int input1 [4] = { 1, 6, 11, 8 }; + int input2 [4] = { 1, 5, 2, 3 }; + + int total = inner_product(input1, input1 + 4, input2, 0, plus(), multiplies ()); + + CPPUNIT_ASSERT(total==77); +} +void PlusMinusTest::minus0() +{ + int input1 [4] = { 1, 5, 7, 8 }; + int input2 [4] = { 1, 4, 8, 3 }; + + int output [4]; + + transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, minus()); + CPPUNIT_ASSERT(output[0]==0); + CPPUNIT_ASSERT(output[1]==1); + CPPUNIT_ASSERT(output[2]==-1); + CPPUNIT_ASSERT(output[3]==5); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/ptr2_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ptr2_test.cpp new file mode 100644 index 00000000000..9a1155c2076 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ptr2_test.cpp @@ -0,0 +1,84 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class Ptr2Test : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(Ptr2Test); + CPPUNIT_TEST(ptrbin1); + CPPUNIT_TEST(ptrbin2); + CPPUNIT_TEST(ptrun1); + CPPUNIT_TEST(ptrun2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void ptrbin1(); + void ptrbin2(); + void ptrun1(); + void ptrun2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(Ptr2Test); + +// +// tests implementation +// +static int sum(int x_, int y_) +{ + return x_ + y_; +} +bool even(int n_) +{ + return(n_ % 2) == 0; +} +void Ptr2Test::ptrbin1() +{ + int input1 [4] = { 7, 2, 3, 5 }; + int input2 [4] = { 1, 5, 5, 8 }; + + int output [4]; + transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, pointer_to_binary_function(sum)); + + CPPUNIT_ASSERT(output[0]==8); + CPPUNIT_ASSERT(output[1]==7); + CPPUNIT_ASSERT(output[2]==8); + CPPUNIT_ASSERT(output[3]==13); +} +void Ptr2Test::ptrbin2() +{ + int input1 [4] = { 7, 2, 3, 5 }; + int input2 [4] = { 1, 5, 5, 8 }; + + int output [4]; + transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, ptr_fun(sum)); + + CPPUNIT_ASSERT(output[0]==8); + CPPUNIT_ASSERT(output[1]==7); + CPPUNIT_ASSERT(output[2]==8); + CPPUNIT_ASSERT(output[3]==13); +} +void Ptr2Test::ptrun1() +{ + int array [3] = { 1, 2, 3 }; + + int* p = find_if((int*)array, (int*)array + 3, pointer_to_unary_function(even)); + CPPUNIT_ASSERT(p != array+3); + CPPUNIT_ASSERT(*p==2); +} +void Ptr2Test::ptrun2() +{ + int array [3] = { 1, 2, 3 }; + + int* p = find_if((int*)array, (int*)array + 3, ptr_fun(even)); + CPPUNIT_ASSERT(p != array+3); + CPPUNIT_ASSERT(*p==2); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/ptrspec_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/ptrspec_test.cpp new file mode 100644 index 00000000000..6d0fcf5fd39 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/ptrspec_test.cpp @@ -0,0 +1,232 @@ +#include +#include +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +#endif +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class PtrSpecTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(PtrSpecTest); + CPPUNIT_TEST(ptr_specialization_test); + CPPUNIT_TEST(function_pointer); + CPPUNIT_TEST_SUITE_END(); + +protected: + /// this seems to be compile only test but... + void ptr_specialization_test(); + void function_pointer(); + + template + struct unary_pred { + bool operator () (_Tp *__ptr) const { + return *__ptr == 0; + } + }; + + template + struct binary_pred { + bool operator () (_Tp *__first, _Tp *__second) const { + return *__first < *__second; + } + }; +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PtrSpecTest); + +#define TEST_INSTANCIATE_CONTAINER(cont) \ + template class cont; \ + template class cont; \ + template class cont; \ + template class cont + +#if !defined(_MSC_VER) || (_MSC_VER > 1200) // excluding MSVC 6.0 +TEST_INSTANCIATE_CONTAINER(vector); +TEST_INSTANCIATE_CONTAINER(list); +# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +TEST_INSTANCIATE_CONTAINER(slist); +# endif +TEST_INSTANCIATE_CONTAINER(deque); +TEST_INSTANCIATE_CONTAINER(set); +TEST_INSTANCIATE_CONTAINER(multiset); +#endif + +//Function to test pointer to function support: +void FTypeInstance() {} + +//Class to test pointer to member method support: +class AClass { +public: + void func() {} +}; + +// +// tests implementation +// +void PtrSpecTest::ptr_specialization_test() +{ + int *int_array[] = {0, 0, 0}; + int const* cint_array[] = {0, 0, 0}; + + { + vector void_vect; + deque void_deque; + list void_list; +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + slist void_slist; +#endif + } + + { + typedef void (*FType)(); + vector func_vector; + func_vector.push_back(&FTypeInstance); + } + +#if !defined(__GNUC__) || (__GNUC__ > 2) + { + typedef void (AClass::*MFType)(); + vector mem_func_vector; + mem_func_vector.push_back(&AClass::func); + } +#endif + + vector pint_vect; + vector pint_vect2; + vector pcint_vect; + list pint_list; + list pint_list2; + list pcint_list; +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + slist pint_slist; + slist pint_slist2; + slist pcint_slist; +#endif + deque pint_deque; + deque pint_deque2; + deque pcint_deque; + +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + vector pint_vect_from_list(pint_list.begin(), pint_list.end()); +#endif + pint_vect.insert(pint_vect.end(), pint_vect2.begin(), pint_vect2.end()); + pint_vect.insert(pint_vect.end(), int_array, int_array + 3); + pint_vect2.insert(pint_vect2.end(), int_array, int_array + 3); + pcint_vect.insert(pcint_vect.end(), int_array, int_array + 3); + pcint_vect.insert(pcint_vect.end(), cint_array, cint_array + 3); +#if !defined (STLPORT) || !defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES) + pcint_vect.insert(pcint_vect.end(), pint_vect2.begin(), pint_vect2.end()); +#endif + pcint_vect.insert(pcint_vect.end(), int_array, int_array + 3); +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + pint_vect.insert(pint_vect.end(), pint_list.begin(), pint_list.end()); + pcint_vect.insert(pcint_vect.end(), pint_list.begin(), pint_list.end()); + pcint_vect.insert(pcint_vect.end(), pcint_list.begin(), pcint_list.end()); + pint_vect.assign(pint_list.begin(), pint_list.end()); + pcint_vect.assign(pint_list.begin(), pint_list.end()); +#endif + pint_vect.assign(int_array, int_array + 3); + pcint_vect.assign(int_array, int_array + 3); + pcint_vect.assign(cint_array, cint_array + 3); + copy(int_array, int_array + 3, back_inserter(pint_vect)); + +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + pint_list.sort(binary_pred()); + pcint_list.sort(binary_pred()); + pint_list.unique(binary_pred()); + pcint_list.unique(binary_pred()); + pint_list.merge(pint_list, binary_pred()); + pcint_list.merge(pcint_list, binary_pred()); + pint_list.remove_if(unary_pred()); + pcint_list.remove_if(unary_pred()); +#endif + + copy(int_array, int_array + 3, back_inserter(pint_list)); + copy(int_array, int_array + 3, back_inserter(pint_list2)); + pint_list.insert(pint_list.end(), pint_list2.begin(), pint_list2.end()); +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + pcint_list.insert(pcint_list.end(), pint_list.begin(), pint_list.end()); +#endif +#if !defined (STLPORT) || !defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES) + pint_list.insert(pint_list.end(), pint_vect.begin(), pint_vect.end()); + pcint_list.insert(pcint_list.end(), pint_vect.begin(), pint_vect.end()); + pcint_list.insert(pcint_list.end(), pcint_vect.begin(), pcint_vect.end()); + list pint_list_from_vect(pint_vect.begin(), pint_vect.end()); + pint_list.assign(pint_vect.begin(), pint_vect.end()); + pcint_list.assign(pint_vect.begin(), pint_vect.end()); +#endif + pint_list.insert(pint_list.begin(), int_array, int_array + 3); + pint_list.insert(pint_list.end(), int_array, int_array + 3); + pcint_list.insert(pcint_list.end(), int_array, int_array + 3); + pcint_list.insert(pcint_list.end(), cint_array, cint_array + 3); + pint_list.assign(int_array, int_array + 3); + pcint_list.assign(int_array, int_array + 3); + pcint_list.assign(cint_array, cint_array + 3); + //pint_list.assign(pcint_vect.begin(), pcint_vect.end()); + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + copy(int_array, int_array + 3, front_inserter(pint_slist)); + copy(int_array, int_array + 3, front_inserter(pint_slist2)); + pint_slist.insert(pint_slist.end(), pint_slist2.begin(), pint_slist2.end()); +# if defined (_STLP_MEMBER_TEMPLATES) + pcint_slist.insert(pcint_slist.end(), pint_slist.begin(), pint_slist.end()); +# endif +# if !defined (_STLP_DEBUG) || defined (_STLP_MEMBER_TEMPLATES) + pint_slist.insert(pint_slist.end(), pint_vect.begin(), pint_vect.end()); + pcint_slist.insert(pcint_slist.end(), pint_vect.begin(), pint_vect.end()); + pcint_slist.insert(pcint_slist.end(), pcint_vect.begin(), pcint_vect.end()); + slist pint_slist_from_vect(pint_vect.begin(), pint_vect.end()); + pint_slist.assign(pint_vect.begin(), pint_vect.end()); + pcint_slist.assign(pint_vect.begin(), pint_vect.end()); +# endif + pint_slist.insert(pint_slist.end(), int_array, int_array + 3); + pcint_slist.insert(pcint_slist.end(), int_array, int_array + 3); + pcint_slist.insert(pcint_slist.end(), cint_array, cint_array + 3); + pint_slist.assign(int_array, int_array + 3); + pcint_slist.assign(int_array, int_array + 3); + pcint_slist.assign(cint_array, cint_array + 3); + //pint_slist.assign(pcint_vect.begin(), pcint_vect.end()); +#endif + + copy(int_array, int_array + 3, back_inserter(pint_deque)); + copy(int_array, int_array + 3, back_inserter(pint_deque2)); + pint_deque.insert(pint_deque.end(), pint_deque2.begin(), pint_deque2.end()); +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + pcint_deque.insert(pcint_deque.end(), pint_deque.begin(), pint_deque.end()); +#endif +#if !defined (STLPORT) || !defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES) + pint_deque.insert(pint_deque.end(), pint_vect.begin(), pint_vect.end()); + pcint_deque.insert(pcint_deque.end(), pint_vect.begin(), pint_vect.end()); + pcint_deque.insert(pcint_deque.end(), pcint_vect.begin(), pcint_vect.end()); + deque pint_deque_from_vect(pint_vect.begin(), pint_vect.end()); + pint_deque.assign(pint_vect.begin(), pint_vect.end()); + pcint_deque.assign(pint_vect.begin(), pint_vect.end()); +#endif + pint_deque.insert(pint_deque.end(), int_array, int_array + 3); + pcint_deque.insert(pcint_deque.end(), int_array, int_array + 3); + pcint_deque.insert(pcint_deque.end(), cint_array, cint_array + 3); + pint_deque.assign(int_array, int_array + 3); + pcint_deque.assign(int_array, int_array + 3); + pcint_deque.assign(cint_array, cint_array + 3); +} + +typedef void (*Func)(int); +void f1(int) {} + +void PtrSpecTest::function_pointer() +{ + vector fs; + fs.push_back(&f1); + CPPUNIT_ASSERT( !fs.empty() ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/queue_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/queue_header_test.cpp new file mode 100644 index 00000000000..4149c22bbd1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/queue_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/queue_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/queue_test.cpp new file mode 100644 index 00000000000..2e6add37535 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/queue_test.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class QueueTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(QueueTest); + CPPUNIT_TEST(pqueue1); + CPPUNIT_TEST(queue1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void pqueue1(); + void queue1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(QueueTest); + +// +// tests implementation +// +void QueueTest::pqueue1() +{ + priority_queue, less > q; + q.push(42); + q.push(101); + q.push(69); + + CPPUNIT_ASSERT( q.top()==101 ); + q.pop(); + CPPUNIT_ASSERT( q.top()==69 ); + q.pop(); + CPPUNIT_ASSERT( q.top()==42 ); + q.pop(); + + CPPUNIT_ASSERT(q.empty()); +} +void QueueTest::queue1() +{ + queue > q; + q.push(42); + q.push(101); + q.push(69); + + CPPUNIT_ASSERT( q.front()==42 ); + q.pop(); + CPPUNIT_ASSERT( q.front()==101 ); + q.pop(); + CPPUNIT_ASSERT( q.front()==69 ); + q.pop(); + + CPPUNIT_ASSERT(q.empty()); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/rawriter_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/rawriter_test.cpp new file mode 100644 index 00000000000..0c8438a762d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/rawriter_test.cpp @@ -0,0 +1,66 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +class X +{ + public: + X(int i_ = 0) : i(i_) {} + ~X() {} + operator int() const { return i; } + + private: + int i; +}; + + +// +// TestCase class +// +class RawriterTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(RawriterTest); + CPPUNIT_TEST(rawiter1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void rawiter1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(RawriterTest); + +// +// tests implementation +// +void RawriterTest::rawiter1() +{ + allocator a; + typedef X* x_pointer; + x_pointer save_p, p; + p = a.allocate(5); + save_p=p; + raw_storage_iterator r(p); + int i; + for(i = 0; i < 5; i++) + *r++ = X(i); + + CPPUNIT_ASSERT(*p++ == 0); + CPPUNIT_ASSERT(*p++ == 1); + CPPUNIT_ASSERT(*p++ == 2); + CPPUNIT_ASSERT(*p++ == 3); + CPPUNIT_ASSERT(*p++ == 4); + +//#if defined (STLPORT) || defined (__GNUC__) + a.deallocate(save_p, 5); +/* +#else + a.deallocate(save_p); +#endif +*/ +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/reference_wrapper_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/reference_wrapper_test.cpp new file mode 100644 index 00000000000..4e3fb4154ce --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/reference_wrapper_test.cpp @@ -0,0 +1,85 @@ +#include + +#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) + +#include +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +class RefWrapperTest : + public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(RefWrapperTest); + CPPUNIT_TEST(ref); + CPPUNIT_TEST(cref); + CPPUNIT_TEST_SUITE_END(); + + protected: + void ref(); + void cref(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(RefWrapperTest); + +void RefWrapperTest::ref() +{ + typedef std::tr1::reference_wrapper rr_type; + + CPPUNIT_CHECK( (::boost::is_convertible::value) ); + CPPUNIT_CHECK( (::boost::is_same::value) ); + + int i = 1; + int j = 2; + + rr_type r1 = std::tr1::ref(i); + + CPPUNIT_CHECK( r1.get() == 1 ); + + r1 = std::tr1::ref(j); + + CPPUNIT_CHECK( r1.get() == 2 ); + + i = 3; + + CPPUNIT_CHECK( r1.get() == 2 ); + + j = 4; + + CPPUNIT_CHECK( r1.get() == 4 ); + + r1.get() = 5; + + CPPUNIT_CHECK( j == 5 ); +} + +void RefWrapperTest::cref() +{ + typedef std::tr1::reference_wrapper crr_type; + + CPPUNIT_CHECK( (::boost::is_convertible::value) ); + CPPUNIT_CHECK( (::boost::is_same::value) ); + + int i = 1; + int j = 2; + + crr_type r1 = std::tr1::cref(i); + + CPPUNIT_CHECK( r1.get() == 1 ); + + r1 = std::tr1::cref(j); + + CPPUNIT_CHECK( r1.get() == 2 ); + + i = 3; + + CPPUNIT_CHECK( r1.get() == 2 ); + + j = 4; + + CPPUNIT_CHECK( r1.get() == 4 ); +} + +#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */ diff --git a/reactos/lib/3rdparty/stlport/test/unit/resolve_name.cpp b/reactos/lib/3rdparty/stlport/test/unit/resolve_name.cpp new file mode 100644 index 00000000000..dc7c123697b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/resolve_name.cpp @@ -0,0 +1,83 @@ +#define _STLP_DO_IMPORT_CSTD_FUNCTIONS +#include + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) + +namespace NS1 { + +bool f() +{ + double d( 1.0 ); + + d = sqrt( d ); + d = ::sqrt( d ); + d = std::sqrt( d ); + return d == 1.0; +} + +} + +namespace { + +bool g() +{ + double d( 1.0 ); + + d = sqrt( d ); + d = ::sqrt( d ); + d = std::sqrt( d ); + return d == 1.0; +} + +} + +// VC6 consider call to sqrt ambiguous as soon as using namespace std has +// been invoked. +#if !defined (STLPORT) || !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) +using namespace std; +#endif + +bool h() +{ + double d( 1.0 ); + + d = sqrt( d ); + d = ::sqrt( d ); + d = std::sqrt( d ); + return d == 1.0; +} + +struct sq +{ + sq() {} + + double sqroot( double x ) { + using std::sqrt; + return sqrt(x); + } +}; + +#endif + + +#if 0 // Do nothing, this should be compiled only + +#include "cppunit/cppunit_proxy.h" + +class ResolveNameTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ResolveNameTest); + CPPUNIT_TEST(cstyle); + CPPUNIT_TEST_SUITE_END(); + +protected: + void cstyle(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ResolveNameTest); + +void ResolveNameTest::cstyle() +{ +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/reviter_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/reviter_test.cpp new file mode 100644 index 00000000000..15a3c34e44b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/reviter_test.cpp @@ -0,0 +1,72 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class ReviterTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ReviterTest); + CPPUNIT_TEST(reviter1); + CPPUNIT_TEST(reviter2); + CPPUNIT_TEST(revbit1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void reviter1(); + void reviter2(); + void revbit1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ReviterTest); + +// +// tests implementation +// +void ReviterTest::reviter1() +{ + int array [] = { 1, 5, 2, 3 }; + + vector v(array, array + 4); + typedef vector::reverse_iterator reviter; + reviter r(v.rend()); + r--; + + CPPUNIT_ASSERT(*r-- == 1); + CPPUNIT_ASSERT(*r-- == 5); + CPPUNIT_ASSERT(*r-- == 2); + CPPUNIT_ASSERT(*r == 3); + CPPUNIT_ASSERT(r==v.rbegin()); +} +void ReviterTest::reviter2() +{ + int array [] = { 1, 5, 2, 3 }; + + vector v(array, array + 4); + vector::reverse_iterator r; + r = v.rbegin(); + CPPUNIT_ASSERT(*r++ == 3); + CPPUNIT_ASSERT(*r++ == 2); + CPPUNIT_ASSERT(*r++ == 5); + CPPUNIT_ASSERT(*r++ == 1); + CPPUNIT_ASSERT(r==v.rend()); +} +void ReviterTest::revbit1() +{ + int array [] = { 1, 5, 2, 3 }; + + list v(array, array + 4); + list::reverse_iterator r(v.rbegin()); + CPPUNIT_ASSERT(*r++ == 3); + CPPUNIT_ASSERT(*r++ == 2); + CPPUNIT_ASSERT(*r++ == 5); + CPPUNIT_ASSERT(*r++ == 1); + CPPUNIT_ASSERT(r==v.rend()); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/rm_cp_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/rm_cp_test.cpp new file mode 100644 index 00000000000..3e3a4d66fbc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/rm_cp_test.cpp @@ -0,0 +1,245 @@ +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class RmCpTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(RmCpTest); + CPPUNIT_TEST(remcopy1); + CPPUNIT_TEST(remcpif1); + CPPUNIT_TEST(remif1); + CPPUNIT_TEST(remove1); + CPPUNIT_TEST(repcpif1); + CPPUNIT_TEST(replace0); + CPPUNIT_TEST(replace1); + CPPUNIT_TEST(replcpy1); + CPPUNIT_TEST(replif1); + CPPUNIT_TEST(revcopy1); + CPPUNIT_TEST(reverse1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void remcopy1(); + void remcpif1(); + void remif1(); + void remove1(); + void repcpif1(); + void replace0(); + void replace1(); + void replcpy1(); + void replif1(); + void revcopy1(); + void reverse1(); + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(RmCpTest); + +static bool odd(int a_) +{ + return (a_ % 2) != 0; +} +// +// tests implementation +// + +void RmCpTest::reverse1() +{ + int numbers[6] = { 0, 1, 2, 3, 4, 5 }; + + reverse(numbers, numbers + 6); + CPPUNIT_ASSERT(numbers[0]==5); + CPPUNIT_ASSERT(numbers[1]==4); + CPPUNIT_ASSERT(numbers[2]==3); + CPPUNIT_ASSERT(numbers[3]==2); + CPPUNIT_ASSERT(numbers[4]==1); + CPPUNIT_ASSERT(numbers[5]==0); +} + +void RmCpTest::revcopy1() +{ + int numbers[6] = { 0, 1, 2, 3, 4, 5 }; + + int result[6]; + reverse_copy((int*)numbers, (int*)numbers + 6, (int*)result); + // 5 4 3 2 1 0 + CPPUNIT_ASSERT(result[0]==5); + CPPUNIT_ASSERT(result[1]==4); + CPPUNIT_ASSERT(result[2]==3); + CPPUNIT_ASSERT(result[3]==2); + CPPUNIT_ASSERT(result[4]==1); + CPPUNIT_ASSERT(result[5]==0); +} + +void RmCpTest::replif1() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i % 5; + + replace_if(v1.begin(), v1.end(), odd, 42); + + // 0 42 2 42 4 0 42 2 42 4 + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==42); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==42); + CPPUNIT_ASSERT(v1[4]==4); + CPPUNIT_ASSERT(v1[5]==0); + CPPUNIT_ASSERT(v1[6]==42); + CPPUNIT_ASSERT(v1[7]==2); + CPPUNIT_ASSERT(v1[8]==42); + CPPUNIT_ASSERT(v1[9]==4); +} + +void RmCpTest::replcpy1() +{ + int numbers[6] = { 0, 1, 2, 0, 1, 2 }; + int result[6] = { 0, 0, 0, 0, 0, 0 }; + + replace_copy((int*)numbers, (int*)numbers + 6, (int*)result, 2, 42); + CPPUNIT_ASSERT(result[0]==0); + CPPUNIT_ASSERT(result[1]==1); + CPPUNIT_ASSERT(result[2]==42); + CPPUNIT_ASSERT(result[3]==0); + CPPUNIT_ASSERT(result[4]==1); + CPPUNIT_ASSERT(result[5]==42); +} + +void RmCpTest::replace0() +{ + int numbers[6] = { 0, 1, 2, 0, 1, 2 }; + + replace(numbers, numbers + 6, 2, 42); + + // 0 1 42 0 1 42 + CPPUNIT_ASSERT(numbers[0]==0); + CPPUNIT_ASSERT(numbers[1]==1); + CPPUNIT_ASSERT(numbers[2]==42); + CPPUNIT_ASSERT(numbers[3]==0); + CPPUNIT_ASSERT(numbers[4]==1); + CPPUNIT_ASSERT(numbers[5]==42); +} + +void RmCpTest::replace1() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i % 5; + replace(v1.begin(), v1.end(), 2, 42); + + // 0 1 2 3 4 0 1 2 3 4 + // 0 1 42 3 4 0 1 42 3 4 + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==42); + CPPUNIT_ASSERT(v1[3]==3); + CPPUNIT_ASSERT(v1[4]==4); + CPPUNIT_ASSERT(v1[5]==0); + CPPUNIT_ASSERT(v1[6]==1); + CPPUNIT_ASSERT(v1[7]==42); + CPPUNIT_ASSERT(v1[8]==3); + CPPUNIT_ASSERT(v1[9]==4); +} + +void RmCpTest::repcpif1() +{ + vector v1(10); + for (int i = 0; (size_t)i < v1.size(); ++i) + v1[i] = i % 5; + vector v2(v1.size()); + + // 0 1 2 3 4 0 1 2 3 4 + // 0 1 2 3 4 0 1 2 3 4 + // 0 42 2 42 4 0 42 2 42 4 + replace_copy_if(v1.begin(), v1.end(), v2.begin(), odd, 42); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==3); + CPPUNIT_ASSERT(v1[4]==4); + CPPUNIT_ASSERT(v1[5]==0); + CPPUNIT_ASSERT(v1[6]==1); + CPPUNIT_ASSERT(v1[7]==2); + CPPUNIT_ASSERT(v1[8]==3); + CPPUNIT_ASSERT(v1[9]==4); + + CPPUNIT_ASSERT(v2[0]==0); + CPPUNIT_ASSERT(v2[1]==42); + CPPUNIT_ASSERT(v2[2]==2); + CPPUNIT_ASSERT(v2[3]==42); + CPPUNIT_ASSERT(v2[4]==4); + CPPUNIT_ASSERT(v2[5]==0); + CPPUNIT_ASSERT(v2[6]==42); + CPPUNIT_ASSERT(v2[7]==2); + CPPUNIT_ASSERT(v2[8]==42); + CPPUNIT_ASSERT(v2[9]==4); +} + +void RmCpTest::remove1() +{ + int numbers[6] = { 1, 2, 3, 1, 2, 3 }; + remove((int*)numbers, (int*)numbers + 6, 1); + + // 2 3 2 3 2 3 + CPPUNIT_ASSERT(numbers[0]==2); + CPPUNIT_ASSERT(numbers[1]==3); + CPPUNIT_ASSERT(numbers[2]==2); + CPPUNIT_ASSERT(numbers[3]==3); + CPPUNIT_ASSERT(numbers[4]==2); + CPPUNIT_ASSERT(numbers[5]==3); +} + +void RmCpTest::remif1() +{ + int numbers[6] = { 0, 0, 1, 1, 2, 2 }; + + remove_if((int*)numbers, (int*)numbers + 6, odd); + + // 0 0 2 2 2 2 + CPPUNIT_ASSERT(numbers[0]==0); + CPPUNIT_ASSERT(numbers[1]==0); + CPPUNIT_ASSERT(numbers[2]==2); + CPPUNIT_ASSERT(numbers[3]==2); + CPPUNIT_ASSERT(numbers[4]==2); + CPPUNIT_ASSERT(numbers[5]==2); +} + +void RmCpTest::remcopy1() +{ + int numbers[6] = { 1, 2, 3, 1, 2, 3 }; + int result[6] = { 0, 0, 0, 0, 0, 0 }; + + remove_copy((int*)numbers, (int*)numbers + 6, (int*)result, 2); + + CPPUNIT_ASSERT(result[0]==1); + CPPUNIT_ASSERT(result[1]==3); + CPPUNIT_ASSERT(result[2]==1); + CPPUNIT_ASSERT(result[3]==3); + CPPUNIT_ASSERT(result[4]==0); + CPPUNIT_ASSERT(result[5]==0); +} + +void RmCpTest::remcpif1() +{ + int numbers[6] = { 1, 2, 3, 1, 2, 3 }; + int result[6] = { 0, 0, 0, 0, 0, 0 }; + + remove_copy_if((int*)numbers, (int*)numbers + 6, (int*)result, odd); + + // 2 2 0 0 0 0 + CPPUNIT_ASSERT(result[0]==2); + CPPUNIT_ASSERT(result[1]==2); + CPPUNIT_ASSERT(result[2]==0); + CPPUNIT_ASSERT(result[3]==0); + CPPUNIT_ASSERT(result[4]==0); + CPPUNIT_ASSERT(result[5]==0); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/rndshf_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/rndshf_test.cpp new file mode 100644 index 00000000000..ad57a533934 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/rndshf_test.cpp @@ -0,0 +1,73 @@ +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class RndShuffleTest : public CPPUNIT_NS::TestCase +{ + class MyRandomGenerator + { + public: + unsigned long operator()(unsigned long n_) + { + return rand() % n_; + } + }; + CPPUNIT_TEST_SUITE(RndShuffleTest); + CPPUNIT_TEST(rndshuf0); + CPPUNIT_TEST(rndshuf2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void rndshuf0(); + void rndshuf2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(RndShuffleTest); + +// +// tests implementation +// +void RndShuffleTest::rndshuf0() +{ + int numbers[6] = { 1, 2, 3, 4, 5, 6 }; + + random_shuffle(numbers, numbers + 6); + + CPPUNIT_ASSERT(count(numbers, numbers+6, 1)==1); + CPPUNIT_ASSERT(count(numbers, numbers+6, 2)==1); + CPPUNIT_ASSERT(count(numbers, numbers+6, 3)==1); + CPPUNIT_ASSERT(count(numbers, numbers+6, 4)==1); + CPPUNIT_ASSERT(count(numbers, numbers+6, 5)==1); + CPPUNIT_ASSERT(count(numbers, numbers+6, 6)==1); +} +void RndShuffleTest::rndshuf2() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + + MyRandomGenerator r; + for(int i = 0; i < 3; i++) + { + random_shuffle(v1.begin(), v1.end(), r); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 0)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 1)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 2)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 3)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 4)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 5)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 6)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 7)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 8)==1); + CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 9)==1); + } +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/rope_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/rope_test.cpp new file mode 100644 index 00000000000..c12fec873d1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/rope_test.cpp @@ -0,0 +1,189 @@ +//Small header to get STLport numerous defines: +#include + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include + +# if !defined (_STLP_USE_NO_IOSTREAMS) +# include +# endif +#endif + +#include "cppunit/cppunit_proxy.h" + +// #include // for rand etc + +#if defined (_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class RopeTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(RopeTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) || defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(io); +#if defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_STOP_IGNORE; +#endif + CPPUNIT_TEST(find1); + CPPUNIT_TEST(find2); + CPPUNIT_TEST(construct_from_char); + CPPUNIT_TEST(bug_report); +#if !defined (_STLP_MEMBER_TEMPLATES) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(test_saved_rope_iterators); + CPPUNIT_TEST_SUITE_END(); + +protected: + void io(); + void find1(); + void find2(); + void construct_from_char(); + void bug_report(); + void test_saved_rope_iterators(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(RopeTest); + +// +// tests implementation +// +void RopeTest::io() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && !defined (_STLP_USE_NO_IOSTREAMS) + char const* cstr = "rope test string"; + crope rstr(cstr); + + { + ostringstream ostr; + ostr << rstr; + + CPPUNIT_ASSERT( ostr ); + CPPUNIT_ASSERT( ostr.str() == cstr ); + } +#endif +} + +void RopeTest::find1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + crope r("Fuzzy Wuzzy was a bear"); + crope::size_type n = r.find( "hair" ); + CPPUNIT_ASSERT( n == crope::npos ); + + n = r.find("ear"); + + CPPUNIT_ASSERT( n == (r.size() - 3) ); +#endif +} + +void RopeTest::find2() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + crope r("Fuzzy Wuzzy was a bear"); + crope::size_type n = r.find( 'e' ); + CPPUNIT_ASSERT( n == (r.size() - 3) ); +#endif +} + +void RopeTest::construct_from_char() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + crope r('1'); + char const* s = r.c_str(); + CPPUNIT_ASSERT( '1' == s[0] && '\0' == s[1] ); +#endif +} + +// Test used for a bug report from Peter Hercek +void RopeTest::bug_report() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + //first create a rope bigger than crope::_S_copy_max = 23 + // so that any string addition is added to a new leaf + crope evilRope("12345678901234567890123_"); + //crope* pSevenCharRope( new TRope("1234567") ); + crope sevenCharRope0("12345678"); + crope sevenCharRope1("1234567"); + // add _Rope_RopeRep::_S_alloc_granularity-1 = 7 characters + evilRope += "1234567"; // creates a new leaf + crope sevenCharRope2("1234567"); + // add one more character to the leaf + evilRope += '8'; // here is the write beyond the allocated memory + CPPUNIT_ASSERT( strcmp(sevenCharRope2.c_str(), "1234567") == 0 ); +#endif +} + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +const char str[] = "ilcpsklryvmcpjnbpbwllsrehfmxrkecwitrsglrexvtjmxypu\ +nbqfgxmuvgfajclfvenhyuhuorjosamibdnjdbeyhkbsomblto\ +uujdrbwcrrcgbflqpottpegrwvgajcrgwdlpgitydvhedtusip\ +pyvxsuvbvfenodqasajoyomgsqcpjlhbmdahyviuemkssdslde\ +besnnngpesdntrrvysuipywatpfoelthrowhfexlwdysvspwlk\ +fblfdf"; + +crope create_rope( int len ) +{ + int l = len/2; + crope result; + if(l <= 2) + { + static int j = 0; + for(int i = 0; i < len; ++i) + { + // char c = 'a' + rand() % ('z' - 'a'); + result.append(1, /* c */ str[j++] ); + j %= sizeof(str); + } + } + else + { + result = create_rope(len/2); + result.append(create_rope(len/2)); + } + return result; +} + +#endif + +void RopeTest::test_saved_rope_iterators() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \ + defined (_STLP_MEMBER_TEMPLATES) + // + // Try and create a rope with a complex tree structure: + // + // srand(0); + crope r = create_rope(300); + string expected(r.begin(), r.end()); + CPPUNIT_ASSERT(expected.size() == r.size()); + CPPUNIT_ASSERT(equal(expected.begin(), expected.end(), r.begin())); + crope::const_iterator i(r.begin()), j(r.end()); + int pos = 0; + while(i != j) + { + crope::const_iterator k; + // This initial read triggers the bug: + CPPUNIT_ASSERT(*i); + k = i; + int newpos = pos; + // Now make sure that i is incremented into the next leaf: + while(i != j) + { + CPPUNIT_ASSERT(*i == expected[newpos]); + ++i; + ++newpos; + } + // Back up from stored value and continue: + i = k; + ++i; + ++pos; + } +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/rotate_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/rotate_test.cpp new file mode 100644 index 00000000000..730bf289271 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/rotate_test.cpp @@ -0,0 +1,133 @@ +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class RotateTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(RotateTest); + CPPUNIT_TEST(rotate0); + CPPUNIT_TEST(rotate1); + CPPUNIT_TEST(rotcopy0); + CPPUNIT_TEST(rotcopy1); + CPPUNIT_TEST_SUITE_END(); + +protected: + void rotate0(); + void rotate1(); + void rotcopy0(); + void rotcopy1(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(RotateTest); + +// +// tests implementation +// +void RotateTest::rotate0() +{ + int numbers[6] = { 0, 1, 2, 3, 4, 5 }; + // 3 4 5 0 1 2 + rotate((int*)numbers, numbers + 3, numbers + 6); + CPPUNIT_ASSERT(numbers[0]==3); + CPPUNIT_ASSERT(numbers[1]==4); + CPPUNIT_ASSERT(numbers[2]==5); + CPPUNIT_ASSERT(numbers[3]==0); + CPPUNIT_ASSERT(numbers[4]==1); + CPPUNIT_ASSERT(numbers[5]==2); +} +void RotateTest::rotate1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + + rotate(v1.begin(), v1.begin()+1, v1.end()); + CPPUNIT_ASSERT(v1[0]==1); + CPPUNIT_ASSERT(v1[1]==2); + CPPUNIT_ASSERT(v1[2]==3); + CPPUNIT_ASSERT(v1[3]==4); + CPPUNIT_ASSERT(v1[4]==5); + CPPUNIT_ASSERT(v1[5]==6); + CPPUNIT_ASSERT(v1[6]==7); + CPPUNIT_ASSERT(v1[7]==8); + CPPUNIT_ASSERT(v1[8]==9); + CPPUNIT_ASSERT(v1[9]==0); + + rotate(v1.begin(), v1.begin()+2, v1.end()); + CPPUNIT_ASSERT(v1[0]==3); + CPPUNIT_ASSERT(v1[1]==4); + CPPUNIT_ASSERT(v1[2]==5); + CPPUNIT_ASSERT(v1[3]==6); + CPPUNIT_ASSERT(v1[4]==7); + CPPUNIT_ASSERT(v1[5]==8); + CPPUNIT_ASSERT(v1[6]==9); + CPPUNIT_ASSERT(v1[7]==0); + CPPUNIT_ASSERT(v1[8]==1); + CPPUNIT_ASSERT(v1[9]==2); + + rotate(v1.begin(), v1.begin()+7, v1.end()); + CPPUNIT_ASSERT(v1[0]==0); + CPPUNIT_ASSERT(v1[1]==1); + CPPUNIT_ASSERT(v1[2]==2); + CPPUNIT_ASSERT(v1[3]==3); + CPPUNIT_ASSERT(v1[4]==4); + CPPUNIT_ASSERT(v1[5]==5); + CPPUNIT_ASSERT(v1[6]==6); + CPPUNIT_ASSERT(v1[7]==7); + CPPUNIT_ASSERT(v1[8]==8); + CPPUNIT_ASSERT(v1[9]==9); + +} +void RotateTest::rotcopy0() +{ + int numbers[6] = { 0, 1, 2, 3, 4, 5 }; + + int result[6]; + rotate_copy((int*)numbers, (int*)numbers + 3, (int*)numbers + 6, (int*)result); + // 3 4 5 0 1 2 + CPPUNIT_ASSERT(result[0]==3); + CPPUNIT_ASSERT(result[1]==4); + CPPUNIT_ASSERT(result[2]==5); + CPPUNIT_ASSERT(result[3]==0); + CPPUNIT_ASSERT(result[4]==1); + CPPUNIT_ASSERT(result[5]==2); +} +void RotateTest::rotcopy1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + vector v2(v1.size()); + + rotate_copy(v1.begin(), v1.begin()+1, v1.end(), v2.begin()); + CPPUNIT_ASSERT(v2[0]==1); + CPPUNIT_ASSERT(v2[1]==2); + CPPUNIT_ASSERT(v2[2]==3); + CPPUNIT_ASSERT(v2[3]==4); + CPPUNIT_ASSERT(v2[4]==5); + CPPUNIT_ASSERT(v2[5]==6); + CPPUNIT_ASSERT(v2[6]==7); + CPPUNIT_ASSERT(v2[7]==8); + CPPUNIT_ASSERT(v2[8]==9); + CPPUNIT_ASSERT(v2[9]==0); + + rotate_copy(v1.begin(), v1.begin()+3, v1.end(), v2.begin()); + CPPUNIT_ASSERT(v2[0]==3); + CPPUNIT_ASSERT(v2[1]==4); + CPPUNIT_ASSERT(v2[2]==5); + CPPUNIT_ASSERT(v2[3]==6); + CPPUNIT_ASSERT(v2[4]==7); + CPPUNIT_ASSERT(v2[5]==8); + CPPUNIT_ASSERT(v2[6]==9); + CPPUNIT_ASSERT(v2[7]==0); + CPPUNIT_ASSERT(v2[8]==1); + CPPUNIT_ASSERT(v2[9]==2); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/search_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/search_test.cpp new file mode 100644 index 00000000000..f7dd33dc0e4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/search_test.cpp @@ -0,0 +1,89 @@ +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SearchTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SearchTest); + CPPUNIT_TEST(search0); + CPPUNIT_TEST(search1); + CPPUNIT_TEST(search2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void search0(); + void search1(); + void search2(); + + static bool str_equal(const char* a_, const char* b_) + { + return strcmp(a_, b_) == 0 ? 1 : 0; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SearchTest); + +// +// tests implementation +// +void SearchTest::search0() +{ + int v1[6] = { 1, 1, 2, 3, 5, 8 }; + int v2[6] = { 0, 1, 2, 3, 4, 5 }; + int v3[2] = { 3, 4 }; + + int* location; + location = search((int*)v1, (int*)v1 + 6, (int*)v3, (int*)v3 + 2); + CPPUNIT_ASSERT(location == v1 + 6); + + location = search((int*)v2, (int*)v2 + 6, (int*)v3, (int*)v3 + 2); + CPPUNIT_ASSERT(location != v2 + 6); + CPPUNIT_ASSERT(location - v2 == 3); +} +void SearchTest::search1() +{ + typedef vector IntVec; + IntVec v1(10); + __iota(v1.begin(), v1.end(), 0); + IntVec v2(3); + __iota(v2.begin(), v2.end(), 50); + + IntVec::iterator location; + location = search(v1.begin(), v1.end(), v2.begin(), v2.end()); + + CPPUNIT_ASSERT(location == v1.end()); + + __iota(v2.begin(), v2.end(), 4); + + location = search(v1.begin(), v1.end(), v2.begin(), v2.end()); + + CPPUNIT_ASSERT(location != v1.end()); + CPPUNIT_ASSERT(location - v1.begin() == 4); +} +void SearchTest::search2() +{ + char const* grades[] = { "A", "B", "C", "D", "F" }; + char const* letters[] = { "Q", "E", "D" }; + const unsigned gradeCount = sizeof(grades) / sizeof(grades[0]); + const unsigned letterCount = sizeof(letters) / sizeof(letters[0]); + char const** location = search((char const**)grades, (char const**)grades + gradeCount, (char const**)letters, (char const**)letters + letterCount, str_equal); + + CPPUNIT_ASSERT(location == grades + gradeCount); + + copy((char const**)grades + 1, (char const**)grades + 1 + letterCount, (char const**)letters); + location = search((char const**)grades, (char const**)grades + gradeCount, (char const**)letters, (char const**)letters + letterCount, str_equal); + + CPPUNIT_ASSERT(location != grades + gradeCount); + CPPUNIT_ASSERT(location - grades == 1); + +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/set_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/set_header_test.cpp new file mode 100644 index 00000000000..8335e137965 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/set_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/set_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/set_test.cpp new file mode 100644 index 00000000000..9070b2fb797 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/set_test.cpp @@ -0,0 +1,507 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SetTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SetTest); + CPPUNIT_TEST(set1); + CPPUNIT_TEST(set2); + CPPUNIT_TEST(erase); + CPPUNIT_TEST(insert); + CPPUNIT_TEST(find); + CPPUNIT_TEST(bounds); + CPPUNIT_TEST(specialized_less); + CPPUNIT_TEST(implementation_check); + CPPUNIT_TEST(allocator_with_state); + CPPUNIT_TEST(reverse_iterator_test); +#if !defined (STLPORT) || !defined (_STLP_USE_CONTAINERS_EXTENSION) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(template_methods); + CPPUNIT_TEST_SUITE_END(); + +protected: + void set1(); + void set2(); + void erase(); + void insert(); + void find(); + void bounds(); + void specialized_less(); + void implementation_check(); + void allocator_with_state(); + void reverse_iterator_test(); + void template_methods(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SetTest); + + +// +// tests implementation +// +void SetTest::set1() +{ + set > s; + CPPUNIT_ASSERT (s.count(42) == 0); + s.insert(42); + CPPUNIT_ASSERT (s.count(42) == 1); + s.insert(42); + CPPUNIT_ASSERT (s.count(42) == 1); + size_t count = s.erase(42); + CPPUNIT_ASSERT (count == 1); +} + +void SetTest::set2() +{ + typedef set > int_set; + int_set s; + pair p = s.insert(42); + CPPUNIT_ASSERT (p.second == true); + p = s.insert(42); + CPPUNIT_ASSERT (p.second == false); + + int array1 [] = { 1, 3, 6, 7 }; + s.insert(array1, array1 + 4); + CPPUNIT_ASSERT (distance(s.begin(), s.end()) == 5); + + int_set s2; + s2.swap(s); + CPPUNIT_ASSERT (distance(s2.begin(), s2.end()) == 5); + CPPUNIT_ASSERT (distance(s.begin(), s.end()) == 0); + + int_set s3; + s3.swap(s); + s3.swap(s2); + CPPUNIT_ASSERT (distance(s.begin(), s.end()) == 0); + CPPUNIT_ASSERT (distance(s2.begin(), s2.end()) == 0); + CPPUNIT_ASSERT (distance(s3.begin(), s3.end()) == 5); +} + +void SetTest::erase() +{ + set > s; + s.insert(1); + s.erase(s.begin()); + CPPUNIT_ASSERT( s.empty() ); + + size_t nb = s.erase(1); + CPPUNIT_ASSERT(nb == 0); +} + +void SetTest::insert() +{ + set s; + set::iterator i = s.insert( s.end(), 0 ); + CPPUNIT_ASSERT( *i == 0 ); +} + +void SetTest::find() +{ + set s; + + CPPUNIT_ASSERT( s.find(0) == s.end() ); + + set const& crs = s; + + CPPUNIT_ASSERT( crs.find(0) == crs.end() ); +} + +void SetTest::bounds() +{ + int array1 [] = { 1, 3, 6, 7 }; + set s(array1, array1 + sizeof(array1) / sizeof(array1[0])); + set const& crs = s; + + set::iterator sit; + set::const_iterator scit; + pair::iterator, set::iterator> pit; + pair::const_iterator, set::const_iterator> pcit; + + //Check iterator on mutable set + sit = s.lower_bound(2); + CPPUNIT_ASSERT( sit != s.end() ); + CPPUNIT_ASSERT( *sit == 3 ); + + sit = s.upper_bound(5); + CPPUNIT_ASSERT( sit != s.end() ); + CPPUNIT_ASSERT( *sit == 6 ); + + pit = s.equal_range(6); + CPPUNIT_ASSERT( pit.first != pit.second ); + CPPUNIT_ASSERT( pit.first != s.end() ); + CPPUNIT_ASSERT( *pit.first == 6 ); + CPPUNIT_ASSERT( pit.second != s.end() ); + CPPUNIT_ASSERT( *pit.second == 7 ); + + pit = s.equal_range(4); + CPPUNIT_ASSERT( pit.first == pit.second ); + CPPUNIT_ASSERT( pit.first != s.end() ); + CPPUNIT_ASSERT( *pit.first == 6 ); + CPPUNIT_ASSERT( pit.second != s.end() ); + CPPUNIT_ASSERT( *pit.second == 6 ); + + //Check const_iterator on mutable set + scit = s.lower_bound(2); + CPPUNIT_ASSERT( scit != s.end() ); + CPPUNIT_ASSERT( *scit == 3 ); + + scit = s.upper_bound(5); + CPPUNIT_ASSERT( scit != s.end() ); + CPPUNIT_ASSERT( *scit == 6 ); + +#ifdef _STLP_MEMBER_TEMPLATES + pcit = s.equal_range(6); + CPPUNIT_ASSERT( pcit.first != pcit.second ); + CPPUNIT_ASSERT( pcit.first != s.end() ); + CPPUNIT_ASSERT( *pcit.first == 6 ); + CPPUNIT_ASSERT( pcit.second != s.end() ); + CPPUNIT_ASSERT( *pcit.second == 7 ); +#endif + + //Check const_iterator on const set + scit = crs.lower_bound(2); + CPPUNIT_ASSERT( scit != crs.end() ); + CPPUNIT_ASSERT( *scit == 3 ); + + scit = crs.upper_bound(5); + CPPUNIT_ASSERT( scit != crs.end() ); + CPPUNIT_ASSERT( *scit == 6 ); + + pcit = crs.equal_range(6); + CPPUNIT_ASSERT( pcit.first != pcit.second ); + CPPUNIT_ASSERT( pcit.first != crs.end() ); + CPPUNIT_ASSERT( *pcit.first == 6 ); + CPPUNIT_ASSERT( pcit.second != crs.end() ); + CPPUNIT_ASSERT( *pcit.second == 7 ); +} + + +class SetTestClass { +public: + SetTestClass (int data) : _data(data) + {} + + int data() const { + return _data; + } + +private: + int _data; +}; + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +namespace std { +#endif +#if defined (STLPORT) + _STLP_TEMPLATE_NULL +#else + template <> +#endif + struct less { + bool operator () (SetTestClass const& lhs, SetTestClass const& rhs) const { + return lhs.data() < rhs.data(); + } + }; +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +} +#endif + +void SetTest::specialized_less() +{ + set s; + s.insert(SetTestClass(1)); + s.insert(SetTestClass(3)); + s.insert(SetTestClass(2)); + s.insert(SetTestClass(0)); + + set::iterator sit(s.begin()), sitEnd(s.end()); + int i = 0; + for (; sit != sitEnd; ++sit, ++i) { + CPPUNIT_ASSERT( sit->data() == i ); + } +} + +void SetTest::implementation_check() +{ + set tree; + tree.insert(1); + set::iterator it = tree.begin(); + int const& int_ref = *it++; + CPPUNIT_ASSERT( int_ref == 1 ); + + CPPUNIT_ASSERT( it == tree.end() ); + CPPUNIT_ASSERT( it != tree.begin() ); + + set::const_iterator cit = tree.begin(); + int const& int_cref = *cit++; + CPPUNIT_ASSERT( int_cref == 1 ); +} + +void SetTest::reverse_iterator_test() +{ + set tree; + tree.insert(1); + tree.insert(2); + + { + set::reverse_iterator rit(tree.rbegin()); + CPPUNIT_ASSERT( *(rit++) == 2 ); + CPPUNIT_ASSERT( *(rit++) == 1 ); + CPPUNIT_ASSERT( rit == tree.rend() ); + } + + { + set const& ctree = tree; + set::const_reverse_iterator rit(ctree.rbegin()); + CPPUNIT_ASSERT( *(rit++) == 2 ); + CPPUNIT_ASSERT( *(rit++) == 1 ); + CPPUNIT_ASSERT( rit == ctree.rend() ); + } +} + +void SetTest::allocator_with_state() +{ + char buf1[1024]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + int i; + typedef set, StackAllocator > SetInt; + less intLess; + + { + SetInt sint1(intLess, stack1); + for (i = 0; i < 5; ++i) + sint1.insert(i); + SetInt sint1Cpy(sint1); + + SetInt sint2(intLess, stack2); + for (; i < 10; ++i) + sint2.insert(i); + SetInt sint2Cpy(sint2); + + sint1.swap(sint2); + + CPPUNIT_ASSERT( sint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( sint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( sint1 == sint2Cpy ); + CPPUNIT_ASSERT( sint2 == sint1Cpy ); + CPPUNIT_ASSERT( sint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( sint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + SetInt sint1(intLess, stack1); + SetInt sint1Cpy(sint1); + + SetInt sint2(intLess, stack2); + for (i = 0; i < 10; ++i) + sint2.insert(i); + SetInt sint2Cpy(sint2); + + sint1.swap(sint2); + + CPPUNIT_ASSERT( sint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( sint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( sint1 == sint2Cpy ); + CPPUNIT_ASSERT( sint2 == sint1Cpy ); + CPPUNIT_ASSERT( sint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( sint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + SetInt sint1(intLess, stack1); + for (i = 0; i < 10; ++i) + sint1.insert(i); + SetInt sint1Cpy(sint1); + + SetInt sint2(intLess, stack2); + SetInt sint2Cpy(sint2); + + sint1.swap(sint2); + + CPPUNIT_ASSERT( sint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( sint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( sint1 == sint2Cpy ); + CPPUNIT_ASSERT( sint2 == sint1Cpy ); + CPPUNIT_ASSERT( sint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( sint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); +} + +struct Key +{ + Key() : m_data(0) {} + explicit Key(int data) : m_data(data) {} + + int m_data; +}; + +struct KeyCmp +{ + bool operator () (Key lhs, Key rhs) const + { return lhs.m_data < rhs.m_data; } + + bool operator () (Key lhs, int rhs) const + { return lhs.m_data < rhs; } + + bool operator () (int lhs, Key rhs) const + { return lhs < rhs.m_data; } +}; + +struct KeyCmpPtr +{ + bool operator () (Key const volatile *lhs, Key const volatile *rhs) const + { return (*lhs).m_data < (*rhs).m_data; } + + bool operator () (Key const volatile *lhs, int rhs) const + { return (*lhs).m_data < rhs; } + + bool operator () (int lhs, Key const volatile *rhs) const + { return lhs < (*rhs).m_data; } +}; + +void SetTest::template_methods() +{ +#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION) + { + typedef set KeySet; + KeySet keySet; + keySet.insert(Key(1)); + keySet.insert(Key(2)); + keySet.insert(Key(3)); + keySet.insert(Key(4)); + + CPPUNIT_ASSERT( keySet.count(Key(1)) == 1 ); + CPPUNIT_ASSERT( keySet.count(1) == 1 ); + CPPUNIT_ASSERT( keySet.count(5) == 0 ); + + CPPUNIT_ASSERT( keySet.find(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) ); + + KeySet const& ckeySet = keySet; + CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) ); + } + + { + typedef set KeySet; + KeySet keySet; + Key key1(1), key2(2), key3(3), key4(4); + keySet.insert(&key1); + keySet.insert(&key2); + keySet.insert(&key3); + keySet.insert(&key4); + + CPPUNIT_ASSERT( keySet.count(1) == 1 ); + CPPUNIT_ASSERT( keySet.count(5) == 0 ); + + CPPUNIT_ASSERT( keySet.find(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) ); + + KeySet const& ckeySet = keySet; + CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) ); + } + { + typedef multiset KeySet; + KeySet keySet; + keySet.insert(Key(1)); + keySet.insert(Key(2)); + keySet.insert(Key(3)); + keySet.insert(Key(4)); + + CPPUNIT_ASSERT( keySet.count(Key(1)) == 1 ); + CPPUNIT_ASSERT( keySet.count(1) == 1 ); + CPPUNIT_ASSERT( keySet.count(5) == 0 ); + + CPPUNIT_ASSERT( keySet.find(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) ); + + KeySet const& ckeySet = keySet; + CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) ); + } + + { + typedef multiset KeySet; + KeySet keySet; + Key key1(1), key2(2), key3(3), key4(4); + keySet.insert(&key1); + keySet.insert(&key2); + keySet.insert(&key3); + keySet.insert(&key4); + + CPPUNIT_ASSERT( keySet.count(1) == 1 ); + CPPUNIT_ASSERT( keySet.count(5) == 0 ); + + CPPUNIT_ASSERT( keySet.find(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() ); + CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) ); + + KeySet const& ckeySet = keySet; + CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() ); + CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) ); + } +#endif +} + +#if !defined (STLPORT) || \ + !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (__DMC__) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + set instances; + typedef set::iterator it; + multiset minstances; + typedef multiset::iterator mit; +}; +# endif +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/setdiff_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/setdiff_test.cpp new file mode 100644 index 00000000000..8fa2ddaea8e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/setdiff_test.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SetDifferenceTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SetDifferenceTest); + CPPUNIT_TEST(setdiff0); + CPPUNIT_TEST(setdiff1); + CPPUNIT_TEST(setdiff2); + CPPUNIT_TEST(setsymd0); + CPPUNIT_TEST(setsymd1); + CPPUNIT_TEST(setsymd2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void setdiff0(); + void setdiff1(); + void setdiff2(); + void setsymd0(); + void setsymd1(); + void setsymd2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SetDifferenceTest); + +// +// tests implementation +// +void SetDifferenceTest::setsymd0() +{ + int v1[3] = { 13, 18, 23 }; + int v2[4] = { 10, 13, 17, 23 }; + int result[4] = { 0, 0, 0, 0 }; + + set_symmetric_difference((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result); + CPPUNIT_ASSERT(result[0]==10); + CPPUNIT_ASSERT(result[1]==17); + CPPUNIT_ASSERT(result[2]==18); + CPPUNIT_ASSERT(result[3]==0); +} + +void SetDifferenceTest::setsymd1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + vector v2(10); + __iota(v2.begin(), v2.end(), 7); + + vector diff; + set_symmetric_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff)); + CPPUNIT_ASSERT( diff.size() == 14 ); + int int_res[] = {0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16}; + for (int i = 0; i < 14; ++i) { + CPPUNIT_ASSERT( diff[i] == int_res[i] ); + } +} + +void SetDifferenceTest::setsymd2() +{ + const char* word1 = "ABCDEFGHIJKLMNO"; + const char* word2 = "LMNOPQRSTUVWXYZ"; + + string diff; + set_symmetric_difference(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2), + back_inserter(diff), less()); + CPPUNIT_ASSERT( diff.size() == 22 ); + char char_res[] = "ABCDEFGHIJKPQRSTUVWXYZ"; + for (int i = 0; i < 22; ++i) { + CPPUNIT_ASSERT( diff[i] == char_res[i] ); + } +} + +void SetDifferenceTest::setdiff0() +{ + int v1[3] = { 13, 18, 23 }; + int v2[4] = { 10, 13, 17, 23 }; + int result[4] = { 0, 0, 0, 0 }; + //18 0 0 0 + //10 17 23 0 + + set_difference((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result); + CPPUNIT_ASSERT( result[0] == 18 ); + CPPUNIT_ASSERT( result[1] == 0 ); + CPPUNIT_ASSERT( result[2] == 0 ); + CPPUNIT_ASSERT( result[3] == 0 ); + + set_difference((int*)v2, (int*)v2 + 4, (int*)v1, (int*)v1 + 2, (int*)result); + CPPUNIT_ASSERT( result[0] == 10 ); + CPPUNIT_ASSERT( result[1] == 17 ); + CPPUNIT_ASSERT( result[2] == 23 ); + CPPUNIT_ASSERT( result[3] == 0 ); +} + +void SetDifferenceTest::setdiff1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + vector v2(10); + __iota(v2.begin(), v2.end(), 7); + + vector diff; + set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff)); + CPPUNIT_ASSERT( diff.size() == 7 ); + for (int i = 0; i < 7; ++i) { + CPPUNIT_ASSERT( diff[i] == i ); + } +} + +void SetDifferenceTest::setdiff2() +{ + const char* word1 = "ABCDEFGHIJKLMNO"; + const char* word2 = "LMNOPQRSTUVWXYZ"; + + string diff; + set_difference(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2), back_inserter(diff), less()); + CPPUNIT_ASSERT( diff.size() == 11 ); + for (int i = 0; i < 11; ++i) { + CPPUNIT_ASSERT( diff[i] == ('A' + i) ); + } +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/setinter_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/setinter_test.cpp new file mode 100644 index 00000000000..ffcfd788038 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/setinter_test.cpp @@ -0,0 +1,79 @@ +#include +#include +#include +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SetIntersectionTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SetIntersectionTest); + CPPUNIT_TEST(setintr0); + CPPUNIT_TEST(setintr1); + CPPUNIT_TEST(setintr2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void setintr0(); + void setintr1(); + void setintr2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SetIntersectionTest); + +// +// tests implementation +// +void SetIntersectionTest::setintr0() +{ + int v1[3] = { 13, 18, 23 }; + int v2[4] = { 10, 13, 17, 23 }; + int result[4] = { 0, 0, 0, 0 }; + + set_intersection((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result); + + CPPUNIT_ASSERT(result[0]==13); + CPPUNIT_ASSERT(result[1]==23); + CPPUNIT_ASSERT(result[2]==0); + CPPUNIT_ASSERT(result[3]==0); +} + +void SetIntersectionTest::setintr1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + vector v2(10); + __iota(v2.begin(), v2.end(), 7); + + vector inter; + set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(inter)); + CPPUNIT_ASSERT( inter.size() == 3 ); + CPPUNIT_ASSERT( inter[0] == 7 ); + CPPUNIT_ASSERT( inter[1] == 8 ); + CPPUNIT_ASSERT( inter[2] == 9 ); +} + +void SetIntersectionTest::setintr2() +{ + const char* word1 = "ABCDEFGHIJKLMNO"; + const char* word2 = "LMNOPQRSTUVWXYZ"; + + string inter; + set_intersection(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2), + back_inserter(inter), less()); + CPPUNIT_ASSERT( inter.size() == 4 ); + CPPUNIT_ASSERT( inter[0] == 'L' ); + CPPUNIT_ASSERT( inter[1] == 'M' ); + CPPUNIT_ASSERT( inter[2] == 'N' ); + CPPUNIT_ASSERT( inter[3] == 'O' ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test.c new file mode 100644 index 00000000000..949628934cc --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test2.cpp b/reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test2.cpp new file mode 100644 index 00000000000..00e4e4af4e5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/setjmp_header_test2.cpp @@ -0,0 +1,15 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ + +/* + * Sometimes, if native setjmp.h was included first, the setjmp functions + * situated in global namespace, not in vendor's std. This may confuse + * following csetjmp + */ +#include +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/setunion_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/setunion_test.cpp new file mode 100644 index 00000000000..577953eacd5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/setunion_test.cpp @@ -0,0 +1,81 @@ +#include +#include +#include +#include +#include +#include + +#include "iota.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SetUnionTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SetUnionTest); + CPPUNIT_TEST(setunon0); + CPPUNIT_TEST(setunon1); + CPPUNIT_TEST(setunon2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void setunon0(); + void setunon1(); + void setunon2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SetUnionTest); + +// +// tests implementation +// +void SetUnionTest::setunon0() +{ + int v1[3] = { 13, 18, 23 }; + int v2[4] = { 10, 13, 17, 23 }; + int result[7] = { 0, 0, 0, 0, 0, 0, 0 }; + + set_union((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result); + + CPPUNIT_ASSERT(result[0]==10); + CPPUNIT_ASSERT(result[1]==13); + CPPUNIT_ASSERT(result[2]==17); + CPPUNIT_ASSERT(result[3]==18); + CPPUNIT_ASSERT(result[4]==23); + CPPUNIT_ASSERT(result[5]==0); + CPPUNIT_ASSERT(result[6]==0); +} + +void SetUnionTest::setunon1() +{ + vector v1(10); + __iota(v1.begin(), v1.end(), 0); + vector v2(10); + __iota(v2.begin(), v2.end(), 7); + + vector diff; + set_union(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff)); + CPPUNIT_ASSERT( diff.size() == 17 ); + for (int i = 0; i < 17; ++i) { + CPPUNIT_ASSERT( diff[i] == i ); + } +} + +void SetUnionTest::setunon2() +{ + const char* word1 = "ABCDEFGHIJKLMNO"; + const char* word2 = "LMNOPQRSTUVWXYZ"; + + string diff; + set_union(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2), + back_inserter(diff), less()); + CPPUNIT_ASSERT( diff.size() == 26 ); + for (int i = 0; i < 26; ++i) { + CPPUNIT_ASSERT( diff[i] == ('A' + i) ); + } +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/shared_ptr_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/shared_ptr_test.cpp new file mode 100644 index 00000000000..a5393de6f97 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/shared_ptr_test.cpp @@ -0,0 +1,41 @@ +#include + +#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) + +// #include +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +class SharedPtrTest : + public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SharedPtrTest); + CPPUNIT_TEST(shared_from_this); + CPPUNIT_TEST_SUITE_END(); + + protected: + void shared_from_this(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SharedPtrTest); + +struct X; + +struct X : + public std::tr1::enable_shared_from_this +{ +}; + +void SharedPtrTest::shared_from_this() +{ + std::tr1::shared_ptr p( new X ); + std::tr1::shared_ptr q = p->shared_from_this(); + + CPPUNIT_CHECK( p == q ); + CPPUNIT_CHECK( !(p < q) && !(q < p) ); // p and q share ownership +} + +#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */ diff --git a/reactos/lib/3rdparty/stlport/test/unit/signal_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/signal_header_test.c new file mode 100644 index 00000000000..e179eb26bb1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/signal_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/slist_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/slist_test.cpp new file mode 100644 index 00000000000..383ece29a9f --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/slist_test.cpp @@ -0,0 +1,554 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) +# include +# if !defined (_STLP_USE_NO_IOSTREAMS) +# include +# endif +# include +# include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +#if !defined (STLPORT) && defined(__GNUC__) +using namespace __gnu_cxx; +#endif + +// +// TestCase class +// +class SlistTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SlistTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) || defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(slist1); +#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_STOP_IGNORE; +#endif + CPPUNIT_TEST(erase); + CPPUNIT_TEST(insert); + CPPUNIT_TEST(splice); + CPPUNIT_TEST(allocator_with_state); + CPPUNIT_TEST_SUITE_END(); + +protected: + void slist1(); + void erase(); + void insert(); + void splice(); + void allocator_with_state(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SlistTest); + +// +// tests implementation +// +void SlistTest::slist1() +{ +#if defined (STLPORT) && !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_NO_EXTENSIONS) +/* +original: xlxtss +reversed: sstxlx +removed: sstl +uniqued: stl +sorted: lst +*/ + + char array [] = { 'x', 'l', 'x', 't', 's', 's' }; + ostringstream os; + ostream_iterator o(os,""); + slist str(array+0, array + 6); + slist::iterator i; + //Check const_iterator construction from iterator + slist::const_iterator ci(i); + slist::const_iterator ci2(ci); +// cout << "reversed: "; + str.reverse(); + for(i = str.begin(); i != str.end(); i++) + os << *i; + stringbuf* buff=os.rdbuf(); + string result=buff->str(); + CPPUNIT_ASSERT(!strcmp(result.c_str(),"sstxlx")); + + //cout << "removed: "; + str.remove('x'); + ostringstream os2; + for(i = str.begin(); i != str.end(); i++) + os2 << *i; + buff=os2.rdbuf(); + result=buff->str(); + CPPUNIT_ASSERT(!strcmp(result.c_str(),"sstl")); + + + //cout << "uniqued: "; + str.unique(); + ostringstream os3; + for(i = str.begin(); i != str.end(); i++) + os3 << *i; + buff=os3.rdbuf(); + result=buff->str(); + CPPUNIT_ASSERT(!strcmp(result.c_str(),"stl")); + + //cout << "sorted: "; + str.sort(); + ostringstream os4; + for(i = str.begin(); i != str.end(); i++) + os4 << *i; + buff = os4.rdbuf(); + result = buff->str(); + CPPUNIT_ASSERT(!strcmp(result.c_str(),"lst")); + + //A small compilation time check to be activated from time to time: +# if 0 + { + slist::iterator sl_char_ite; + slist::iterator sl_int_ite; + CPPUNIT_ASSERT( sl_char_ite != sl_int_ite ); + } +# endif +#endif +} + +void SlistTest::erase() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int array[] = { 0, 1, 2, 3, 4 }; + slist sl(array, array + 5); + slist::iterator slit; + + slit = sl.erase(sl.begin()); + CPPUNIT_ASSERT( *slit == 1); + + ++slit++; ++slit; + slit = sl.erase(sl.begin(), slit); + CPPUNIT_ASSERT( *slit == 3 ); + + sl.assign(array, array + 5); + + slit = sl.erase_after(sl.begin()); + CPPUNIT_ASSERT( *slit == 2 ); + + slit = sl.begin(); ++slit; ++slit; + slit = sl.erase_after(sl.begin(), slit); + CPPUNIT_ASSERT( *slit == 3 ); + + sl.erase_after(sl.before_begin()); + CPPUNIT_ASSERT( sl.front() == 3 ); +#endif +} + +void SlistTest::insert() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int array[] = { 0, 1, 2, 3, 4 }; + + //insert + { + slist sl; + + sl.insert(sl.begin(), 5); + CPPUNIT_ASSERT( sl.front() == 5 ); + CPPUNIT_ASSERT( sl.size() == 1 ); + + //debug mode check: + //sl.insert(sl.before_begin(), array, array + 5); + + sl.insert(sl.begin(), array, array + 5); + CPPUNIT_ASSERT( sl.size() == 6 ); + int i; + slist::iterator slit(sl.begin()); + for (i = 0; slit != sl.end(); ++slit, ++i) { + CPPUNIT_ASSERT( *slit == i ); + } + } + + //insert_after + { + slist sl; + + //debug check: + //sl.insert_after(sl.begin(), 5); + + sl.insert_after(sl.before_begin(), 5); + CPPUNIT_ASSERT( sl.front() == 5 ); + CPPUNIT_ASSERT( sl.size() == 1 ); + + sl.insert_after(sl.before_begin(), array, array + 5); + CPPUNIT_ASSERT( sl.size() == 6 ); + int i; + slist::iterator slit(sl.begin()); + for (i = 0; slit != sl.end(); ++slit, ++i) { + CPPUNIT_ASSERT( *slit == i ); + } + } +#endif +} + +void SlistTest::splice() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int array[] = { 0, 1, 2, 3, 4 }; + + //splice + { + slist sl1(array, array + 5); + slist sl2(array, array + 5); + slist::iterator slit; + + //a no op: + sl1.splice(sl1.begin(), sl1, sl1.begin()); + CPPUNIT_ASSERT( sl1 == sl2 ); + + slit = sl1.begin(); ++slit; + //a no op: + sl1.splice(slit, sl1, sl1.begin()); + CPPUNIT_ASSERT( sl1 == sl2 ); + + sl1.splice(sl1.end(), sl1, sl1.begin()); + slit = sl1.begin(); + CPPUNIT_ASSERT( *(slit++) == 1 ); + CPPUNIT_ASSERT( *(slit++) == 2 ); + CPPUNIT_ASSERT( *(slit++) == 3 ); + CPPUNIT_ASSERT( *(slit++) == 4 ); + CPPUNIT_ASSERT( *slit == 0 ); + sl1.splice(sl1.begin(), sl1, slit); + CPPUNIT_ASSERT( sl1 == sl2 ); + + sl1.splice(sl1.begin(), sl2); + size_t i; + for (i = 0, slit = sl1.begin(); slit != sl1.end(); ++slit, ++i) { + if (i == 5) i = 0; + CPPUNIT_ASSERT( *slit == array[i] ); + } + + slit = sl1.begin(); + advance(slit, 5); + CPPUNIT_ASSERT( *slit == 0 ); + sl2.splice(sl2.begin(), sl1, sl1.begin(), slit); + CPPUNIT_ASSERT( sl1 == sl2 ); + + slit = sl1.begin(); ++slit; + sl1.splice(sl1.begin(), sl1, slit, sl1.end()); + slit = sl1.begin(); + CPPUNIT_ASSERT( *(slit++) == 1 ); + CPPUNIT_ASSERT( *(slit++) == 2 ); + CPPUNIT_ASSERT( *(slit++) == 3 ); + CPPUNIT_ASSERT( *(slit++) == 4 ); + CPPUNIT_ASSERT( *slit == 0 ); + + // a no op + sl2.splice(sl2.end(), sl2, sl2.begin(), sl2.end()); + for (i = 0, slit = sl2.begin(); slit != sl2.end(); ++slit, ++i) { + CPPUNIT_ASSERT( i < 5 ); + CPPUNIT_ASSERT( *slit == array[i] ); + } + + slit = sl2.begin(); + advance(slit, 3); + sl2.splice(sl2.end(), sl2, sl2.begin(), slit); + slit = sl2.begin(); + CPPUNIT_ASSERT( *(slit++) == 3 ); + CPPUNIT_ASSERT( *(slit++) == 4 ); + CPPUNIT_ASSERT( *(slit++) == 0 ); + CPPUNIT_ASSERT( *(slit++) == 1 ); + CPPUNIT_ASSERT( *slit == 2 ); + } + + //splice_after + { + slist sl1(array, array + 5); + slist sl2(array, array + 5); + slist::iterator slit; + + //a no op: + sl1.splice_after(sl1.begin(), sl1, sl1.begin()); + CPPUNIT_ASSERT( sl1 == sl2 ); + + sl1.splice_after(sl1.before_begin(), sl1, sl1.begin()); + slit = sl1.begin(); + CPPUNIT_ASSERT( *(slit++) == 1 ); + CPPUNIT_ASSERT( *(slit++) == 0 ); + CPPUNIT_ASSERT( *(slit++) == 2 ); + CPPUNIT_ASSERT( *(slit++) == 3 ); + CPPUNIT_ASSERT( *slit == 4 ); + sl1.splice_after(sl1.before_begin(), sl1, sl1.begin()); + CPPUNIT_ASSERT( sl1 == sl2 ); + + sl1.splice_after(sl1.before_begin(), sl2); + size_t i; + for (i = 0, slit = sl1.begin(); slit != sl1.end(); ++slit, ++i) { + if (i == 5) i = 0; + CPPUNIT_ASSERT( *slit == array[i] ); + } + + slit = sl1.begin(); + advance(slit, 4); + CPPUNIT_ASSERT( *slit == 4 ); + sl2.splice_after(sl2.before_begin(), sl1, sl1.before_begin(), slit); + CPPUNIT_ASSERT( sl1 == sl2 ); + + sl1.splice_after(sl1.before_begin(), sl1, sl1.begin(), sl1.previous(sl1.end())); + slit = sl1.begin(); + CPPUNIT_ASSERT( *(slit++) == 1 ); + CPPUNIT_ASSERT( *(slit++) == 2 ); + CPPUNIT_ASSERT( *(slit++) == 3 ); + CPPUNIT_ASSERT( *(slit++) == 4 ); + CPPUNIT_ASSERT( *slit == 0 ); + + // a no op + sl2.splice_after(sl2.before_begin(), sl2, sl2.before_begin(), sl2.previous(sl2.end())); + for (i = 0, slit = sl2.begin(); slit != sl2.end(); ++slit, ++i) { + CPPUNIT_ASSERT( i < 5 ); + CPPUNIT_ASSERT( *slit == array[i] ); + } + + slit = sl2.begin(); + advance(slit, 2); + sl2.splice_after(sl2.previous(sl2.end()), sl2, sl2.before_begin(), slit); + slit = sl2.begin(); + CPPUNIT_ASSERT( *(slit++) == 3 ); + CPPUNIT_ASSERT( *(slit++) == 4 ); + CPPUNIT_ASSERT( *(slit++) == 0 ); + CPPUNIT_ASSERT( *(slit++) == 1 ); + CPPUNIT_ASSERT( *slit == 2 ); + } +#endif +} + + +void SlistTest::allocator_with_state() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + char buf1[1024]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + typedef slist > SlistInt; + { + SlistInt slint1(10, 0, stack1); + SlistInt slint1Cpy(slint1); + + SlistInt slint2(10, 1, stack2); + SlistInt slint2Cpy(slint2); + + slint1.swap(slint2); + + CPPUNIT_ASSERT( slint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( slint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( slint1 == slint2Cpy ); + CPPUNIT_ASSERT( slint2 == slint1Cpy ); + CPPUNIT_ASSERT( slint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( slint2.get_allocator() == stack1 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + SlistInt slint1(stack1); + SlistInt slint1Cpy(slint1); + + SlistInt slint2(10, 1, stack2); + SlistInt slint2Cpy(slint2); + + slint1.swap(slint2); + + CPPUNIT_ASSERT( slint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( slint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( slint1 == slint2Cpy ); + CPPUNIT_ASSERT( slint2 == slint1Cpy ); + CPPUNIT_ASSERT( slint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( slint2.get_allocator() == stack1 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + SlistInt slint1(10, 0, stack1); + SlistInt slint1Cpy(slint1); + + SlistInt slint2(stack2); + SlistInt slint2Cpy(slint2); + + slint1.swap(slint2); + + CPPUNIT_ASSERT( slint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( slint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( slint1 == slint2Cpy ); + CPPUNIT_ASSERT( slint2 == slint1Cpy ); + CPPUNIT_ASSERT( slint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( slint2.get_allocator() == stack1 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //splice(iterator, slist) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + slint1.splice(slint1.begin(), slint2); + CPPUNIT_ASSERT( slint1.size() == 20 ); + CPPUNIT_ASSERT( slint2.empty() ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //splice(iterator, slist, iterator) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + slint1.splice(slint1.begin(), slint2, slint2.begin()); + CPPUNIT_ASSERT( slint1.size() == 11 ); + CPPUNIT_ASSERT( slint2.size() == 9 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //splice(iterator, slist, iterator, iterator) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + SlistInt::iterator lit(slint2.begin()); + advance(lit, 5); + slint1.splice(slint1.begin(), slint2, slint2.begin(), lit); + CPPUNIT_ASSERT( slint1.size() == 15 ); + CPPUNIT_ASSERT( slint2.size() == 5 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //splice_after(iterator, slist) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + slint1.splice_after(slint1.before_begin(), slint2); + CPPUNIT_ASSERT( slint1.size() == 20 ); + CPPUNIT_ASSERT( slint2.empty() ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //splice_after(iterator, slist, iterator) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + slint1.splice_after(slint1.before_begin(), slint2, slint2.before_begin()); + CPPUNIT_ASSERT( slint1.size() == 11 ); + CPPUNIT_ASSERT( slint2.size() == 9 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //splice_after(iterator, slist, iterator, iterator) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + SlistInt::iterator lit(slint2.begin()); + advance(lit, 4); + slint1.splice_after(slint1.before_begin(), slint2, slint2.before_begin(), lit); + CPPUNIT_ASSERT( slint1.size() == 15 ); + CPPUNIT_ASSERT( slint2.size() == 5 ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + stack1.reset(); stack2.reset(); + + //merge(slist) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + SlistInt slintref(stack2); + slintref.insert_after(slintref.before_begin(), 10, 1); + slintref.insert_after(slintref.before_begin(), 10, 0); + + slint1.merge(slint2); + CPPUNIT_ASSERT( slint1.size() == 20 ); + CPPUNIT_ASSERT( slint1 == slintref ); + CPPUNIT_ASSERT( slint2.empty() ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + + //merge(slist, predicate) +# if (!defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)) && \ + (!defined (_MSC_VER) || (_MSC_VER >= 1300)) + { + SlistInt slint1(10, 0, stack1); + SlistInt slint2(10, 1, stack2); + + SlistInt slintref(stack2); + slintref.insert_after(slintref.before_begin(), 10, 0); + slintref.insert_after(slintref.before_begin(), 10, 1); + + slint1.merge(slint2, greater()); + CPPUNIT_ASSERT( slint1.size() == 20 ); + CPPUNIT_ASSERT( slint1 == slintref ); + CPPUNIT_ASSERT( slint2.empty() ); + } + CPPUNIT_CHECK( stack1.ok() ); + CPPUNIT_CHECK( stack2.ok() ); + + //sort + { + //This is rather a compile time test. + //We check that sort implementation is correct when list is instanciated + //with an allocator that do not have a default constructor. + SlistInt slint1(stack1); + slint1.push_front(1); + slint1.insert_after(slint1.before_begin(), 10, 0); + greater gt; + slint1.sort(gt); + CPPUNIT_ASSERT( slint1.front() == 1 ); + slint1.sort(); + SlistInt::iterator slit(slint1.begin()); + advance(slit, 10); + CPPUNIT_ASSERT( *slit == 1 ); + } +# endif +#endif +} + +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \ + (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)) +# if !defined (__DMC__) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + slist instances; + typedef slist::iterator it; +}; +# endif +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/sort_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/sort_test.cpp new file mode 100644 index 00000000000..49bc9468783 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/sort_test.cpp @@ -0,0 +1,217 @@ +#include +#include +#include + +#if defined (STLPORT) && defined (_STLP_DEBUG) && defined (_STLP_DEBUG_MODE_THROWS) +# define _STLP_DO_CHECK_BAD_PREDICATE +# include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SortTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SortTest); + CPPUNIT_TEST(sort1); + CPPUNIT_TEST(sort2); + CPPUNIT_TEST(sort3); + CPPUNIT_TEST(sort4); + CPPUNIT_TEST(stblsrt1); + CPPUNIT_TEST(stblsrt2); +#if defined (_STLP_DO_CHECK_BAD_PREDICATE) + CPPUNIT_TEST(bad_predicate_detected); +#endif + CPPUNIT_TEST_SUITE_END(); + +protected: + void sort1(); + void sort2(); + void sort3(); + void sort4(); + void stblsrt1(); + void stblsrt2(); + void bad_predicate_detected(); + + static bool string_less(const char* a_, const char* b_) + { + return strcmp(a_, b_) < 0 ? 1 : 0; + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SortTest); + +// +// tests implementation +// +void SortTest::stblsrt1() +{ + //Check that stable_sort do sort + int numbers[6] = { 1, 50, -10, 11, 42, 19 }; + stable_sort(numbers, numbers + 6); + //-10 1 11 19 42 50 + CPPUNIT_ASSERT(numbers[0]==-10); + CPPUNIT_ASSERT(numbers[1]==1); + CPPUNIT_ASSERT(numbers[2]==11); + CPPUNIT_ASSERT(numbers[3]==19); + CPPUNIT_ASSERT(numbers[4]==42); + CPPUNIT_ASSERT(numbers[5]==50); + + char const* letters[6] = {"bb", "aa", "ll", "dd", "qq", "cc" }; + stable_sort(letters, letters + 6, string_less); + // aa bb cc dd ll qq + CPPUNIT_ASSERT( strcmp(letters[0], "aa") == 0 ); + CPPUNIT_ASSERT( strcmp(letters[1], "bb") == 0 ); + CPPUNIT_ASSERT( strcmp(letters[2], "cc") == 0 ); + CPPUNIT_ASSERT( strcmp(letters[3], "dd") == 0 ); + CPPUNIT_ASSERT( strcmp(letters[4], "ll") == 0 ); + CPPUNIT_ASSERT( strcmp(letters[5], "qq") == 0 ); +} + +struct Data { + Data(int index, int value) + : m_index(index), m_value(value) {} + + bool operator == (const Data& other) const + { return m_index == other.m_index && m_value == other.m_value; } + bool operator < (const Data& other) const + { return m_value < other.m_value; } + +private: + int m_index, m_value; +}; + +void SortTest::stblsrt2() +{ + //Check that stable_sort is stable: + Data datas[] = { + Data(0, 10), + Data(1, 8), + Data(2, 6), + Data(3, 6), + Data(4, 6), + Data(5, 4), + Data(6, 9) + }; + stable_sort(datas, datas + 7); + + CPPUNIT_ASSERT( datas[0] == Data(5, 4) ); + CPPUNIT_ASSERT( datas[1] == Data(2, 6) ); + CPPUNIT_ASSERT( datas[2] == Data(3, 6) ); + CPPUNIT_ASSERT( datas[3] == Data(4, 6) ); + CPPUNIT_ASSERT( datas[4] == Data(1, 8) ); + CPPUNIT_ASSERT( datas[5] == Data(6, 9) ); + CPPUNIT_ASSERT( datas[6] == Data(0, 10) ); +} + +void SortTest::sort1() +{ + int numbers[6] = { 1, 50, -10, 11, 42, 19 }; + + sort(numbers, numbers + 6); + // -10 1 11 19 42 50 + CPPUNIT_ASSERT(numbers[0]==-10); + CPPUNIT_ASSERT(numbers[1]==1); + CPPUNIT_ASSERT(numbers[2]==11); + CPPUNIT_ASSERT(numbers[3]==19); + CPPUNIT_ASSERT(numbers[4]==42); + CPPUNIT_ASSERT(numbers[5]==50); +} + +void SortTest::sort2() +{ + int numbers[] = { 1, 50, -10, 11, 42, 19 }; + + int count = sizeof(numbers) / sizeof(numbers[0]); + sort(numbers, numbers + count, greater()); + + // 50 42 19 11 1 -10 + CPPUNIT_ASSERT(numbers[5]==-10); + CPPUNIT_ASSERT(numbers[4]==1); + CPPUNIT_ASSERT(numbers[3]==11); + CPPUNIT_ASSERT(numbers[2]==19); + CPPUNIT_ASSERT(numbers[1]==42); + CPPUNIT_ASSERT(numbers[0]==50); +} + +void SortTest::sort3() +{ + vector boolVector; + + boolVector.push_back( true ); + boolVector.push_back( false ); + + sort( boolVector.begin(), boolVector.end() ); + + CPPUNIT_ASSERT(boolVector[0]==false); + CPPUNIT_ASSERT(boolVector[1]==true); +} + +/* + * A small utility class to check a potential compiler bug + * that can result in a bad sort algorithm behavior. The type + * _Tp of the SortTestFunc has to be SortTestAux without any + * reference qualifier. + */ +struct SortTestAux { + SortTestAux (bool &b) : _b(b) + {} + + SortTestAux (SortTestAux const&other) : _b(other._b) { + _b = true; + } + + bool &_b; + +private: + //explicitely defined as private to avoid warnings: + SortTestAux& operator = (SortTestAux const&); +}; + +template +void SortTestFunc (_Tp) { +} + +void SortTest::sort4() +{ + bool copy_constructor_called = false; + SortTestAux instance(copy_constructor_called); + SortTestAux &r_instance = instance; + SortTestAux const& rc_instance = instance; + + SortTestFunc(r_instance); + CPPUNIT_ASSERT(copy_constructor_called); + copy_constructor_called = false; + SortTestFunc(rc_instance); + CPPUNIT_ASSERT(copy_constructor_called); +} + +#if defined (_STLP_DO_CHECK_BAD_PREDICATE) +void SortTest::bad_predicate_detected() +{ + int numbers[] = { 0, 0, 1, 0, 0, 1, 0, 0 }; + try { + sort(numbers, numbers + sizeof(numbers) / sizeof(numbers[0]), less_equal()); + + //Here is means that no exception has been raised + CPPUNIT_ASSERT( false ); + } + catch (runtime_error const&) + { /*OK bad predicate has been detected.*/ } + + try { + stable_sort(numbers, numbers + sizeof(numbers) / sizeof(numbers[0]), less_equal()); + + //Here is means that no exception has been raised + CPPUNIT_ASSERT( false ); + } + catch (runtime_error const&) + { /*OK bad predicate has been detected.*/ } +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/sstream_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/sstream_header_test.cpp new file mode 100644 index 00000000000..784f79a786d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/sstream_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/sstream_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/sstream_test.cpp new file mode 100644 index 00000000000..c22066d1d39 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/sstream_test.cpp @@ -0,0 +1,487 @@ +#include +#include "math_aux.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include + +# include "full_streambuf.h" + +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// TestCase class +// +class SstreamTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SstreamTest); + CPPUNIT_TEST(output); + CPPUNIT_TEST(input); + CPPUNIT_TEST(input_char); + CPPUNIT_TEST(io); + CPPUNIT_TEST(err); + CPPUNIT_TEST(err_long); + CPPUNIT_TEST(maxint); + CPPUNIT_TEST(init_in); + CPPUNIT_TEST(init_out); + CPPUNIT_TEST(buf); + CPPUNIT_TEST(rdbuf); + CPPUNIT_TEST(streambuf_output); + CPPUNIT_TEST(seek); + CPPUNIT_TEST(seekp); + CPPUNIT_TEST(seek_gp); + CPPUNIT_TEST(tellp); + CPPUNIT_TEST(negative); + CPPUNIT_TEST_SUITE_END(); + + protected: + void output(); + void input(); + void input_char(); + void io(); + void err(); + void err_long(); + void maxint(); + void init_in(); + void init_out(); + void buf(); + void rdbuf(); + void streambuf_output(); + void seek(); + void seekp(); + void seek_gp(); + void tellp(); + void negative(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SstreamTest); + +// +// tests implementation +// +void SstreamTest::output() +{ + { + ostringstream s; + + s << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef"; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( s.str() == "1\n2\nabcd\nghk lm\nabcd ef" ); + } + + //Following tests are mostly used to reveal problem with the MSVC /Wp64 option + //used to track 64 bits portability issue: + { + ostringstream s; + size_t i = 0; + s << i; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( s.str() == "0" ); + } + { + ostringstream s; + ptrdiff_t i = 0; + s << i; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( s.str() == "0" ); + } +} + +void SstreamTest::input() +{ + { + istringstream s( "1\n2\nabcd\nghk lm\nabcd ef" ); + int i = 0; + s >> i; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( i == 1 ); + double d = 0.0; + s >> d; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( d == 2.0 ); + string str; + s >> str; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( str == "abcd" ); + char c; + s.get(c); // extract newline, that not extracted by operator >> + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( c == '\n' ); + getline( s, str ); + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( str == "ghk lm" ); + getline( s, str ); + CPPUNIT_ASSERT( s.eof() ); + CPPUNIT_ASSERT( str == "abcd ef" ); + } + { + istringstream s("0"); + size_t i = 1; + s >> i; + CPPUNIT_ASSERT( !s.fail() ); + CPPUNIT_ASSERT( s.eof() ); + CPPUNIT_ASSERT( i == 0 ); + } +} + +void SstreamTest::input_char() +{ + char buf[16] = { 0, '1', '2', '3' }; + istringstream s( "0" ); + s >> buf; + + CPPUNIT_ASSERT( buf[0] == '0' ); + CPPUNIT_ASSERT( buf[1] == 0 ); + CPPUNIT_ASSERT( buf[2] == '2' ); +} + + +void SstreamTest::io() +{ + stringstream s; + s << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef"; + CPPUNIT_ASSERT( s.good() ); + + int i = 0; + s >> i; + CPPUNIT_ASSERT( i == 1 ); + CPPUNIT_ASSERT( s.good() ); + double d = 0.0; + s >> d; + CPPUNIT_ASSERT( d == 2.0 ); + CPPUNIT_ASSERT( s.good() ); + string str; + s >> str; + CPPUNIT_ASSERT( str == "abcd" ); + CPPUNIT_ASSERT( s.good() ); + char c; + s.get(c); // extract newline, that not extracted by operator >> + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( c == '\n' ); + getline( s, str ); + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( str == "ghk lm" ); + getline( s, str ); + CPPUNIT_ASSERT( str == "abcd ef" ); + CPPUNIT_ASSERT( s.eof() ); +} + +void SstreamTest::err() +{ + stringstream s( "9" ); + + int i = 0; + s >> i; + CPPUNIT_ASSERT( !s.fail() ); + CPPUNIT_ASSERT( i == 9 ); + s >> i; + CPPUNIT_ASSERT( s.fail() ); + CPPUNIT_ASSERT( s.eof() ); + CPPUNIT_ASSERT( i == 9 ); +} + +void SstreamTest::err_long() +{ + stringstream s( "9" ); + + long i = 0; + s >> i; + CPPUNIT_ASSERT( !s.fail() ); + CPPUNIT_ASSERT( i == 9 ); + s >> i; + CPPUNIT_ASSERT( s.fail() ); + CPPUNIT_ASSERT( s.eof() ); + CPPUNIT_ASSERT( i == 9 ); +} + +void SstreamTest::maxint() +{ + stringstream s; + + s << INT_MAX << " " << UINT_MAX << " " << LONG_MAX << " " << ULONG_MAX << " " + << INT_MIN << " " << LONG_MIN; + CPPUNIT_ASSERT( s.good() ); + + int i = 0; + unsigned int u = 0; + long l = 0; + unsigned long ul = 0; + + s >> i >> u >> l >> ul; + CPPUNIT_ASSERT( s.good() ); + CPPUNIT_ASSERT( i == INT_MAX ); + CPPUNIT_ASSERT( u == UINT_MAX ); + CPPUNIT_ASSERT( l == LONG_MAX ); + CPPUNIT_ASSERT( ul == ULONG_MAX ); + + s >> i >> l; + CPPUNIT_ASSERT( !s.fail() ); + CPPUNIT_ASSERT( i == INT_MIN ); + CPPUNIT_ASSERT( l == LONG_MIN ); +} + +void SstreamTest::init_in() +{ + istringstream is( "12345" ); + int n; + + is >> n; + CPPUNIT_ASSERT( !is.fail() ); + CPPUNIT_ASSERT( n == 12345 ); + + istringstream dis( "1.2345" ); + double d; + + dis >> d; + CPPUNIT_ASSERT( !dis.fail() ); + CPPUNIT_ASSERT( are_equals(d, 1.2345) ); + + istringstream fis( "1.2345" ); + float f; + + fis >> f; + CPPUNIT_ASSERT( !fis.fail() ); + CPPUNIT_ASSERT( are_equals(f, 1.2345f) ); +} + +void SstreamTest::init_out() +{ + ostringstream os( "12345" ); + CPPUNIT_ASSERT( os.str() == "12345" ); + + os << 67; + CPPUNIT_ASSERT( os.good() ); + + // This satisfy to the Standard: + // CPPUNIT_ASSERT( os.str() == "67345" ); + // But we don't know the reason, why standard state that. + + /* + * 27.7.1.1: ... then copies the content of str into the basic_sringbuf + * underlying character sequence and initializes the input and output + * sequences according to which. If which & ios_base::out is true, initializes + * the output sequence with underlying sequence. ... + * + * I can treat this as 'like output was performed', and then I should bump + * put pointer... Looks like more useful then my previous treatment. + * + * - ptr + */ + + CPPUNIT_ASSERT( os.str() == "1234567" ); + + + os.str( "89ab" ); + CPPUNIT_ASSERT( os.str() == "89ab" ); + + os << 10; + CPPUNIT_ASSERT( os.good() ); + // CPPUNIT_ASSERT( os.str() == "10ab" ); + CPPUNIT_ASSERT( os.str() == "89ab10" ); +} + +void SstreamTest::buf() +{ + stringstream ss; + + ss << "1234567\n89\n"; + char buf[10]; + buf[7] = 'x'; + ss.get( buf, 10 ); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( buf[0] == '1' ); + CPPUNIT_ASSERT( buf[1] == '2' ); + CPPUNIT_ASSERT( buf[2] == '3' ); + CPPUNIT_ASSERT( buf[3] == '4' ); + CPPUNIT_ASSERT( buf[4] == '5' ); + CPPUNIT_ASSERT( buf[5] == '6' ); + CPPUNIT_ASSERT( buf[6] == '7' ); // 27.6.1.3 paragraph 10, paragraph 7 + CPPUNIT_ASSERT( buf[7] == 0 ); // 27.6.1.3 paragraph 8 + char c; + ss.get(c); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 10, paragraph 7 + ss.get(c); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( c == '8' ); +} + +void SstreamTest::rdbuf() +{ + stringstream ss; + + ss << "1234567\n89\n"; + + ostringstream os; + ss.get( *os.rdbuf(), '\n' ); + CPPUNIT_ASSERT( !ss.fail() ); + char c; + ss.get(c); + CPPUNIT_ASSERT( !ss.fail() ); + CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 12 + CPPUNIT_ASSERT( os.str() == "1234567" ); +} + +void SstreamTest::streambuf_output() +{ + { + istringstream in("01234567890123456789"); + CPPUNIT_ASSERT( in ); + + full_streambuf full_buf(10); + ostream out(&full_buf); + CPPUNIT_ASSERT( out ); + + out << in.rdbuf(); + CPPUNIT_ASSERT( out ); + CPPUNIT_ASSERT( in ); + //out is good we can check what has been extracted: + CPPUNIT_ASSERT( full_buf.str() == "0123456789" ); + + out << in.rdbuf(); + CPPUNIT_ASSERT( out.fail() ); + CPPUNIT_ASSERT( in ); + + ostringstream ostr; + ostr << in.rdbuf(); + CPPUNIT_ASSERT( ostr ); + CPPUNIT_ASSERT( in ); + CPPUNIT_ASSERT( ostr.str() == "0123456789" ); + } + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + { + //If the output stream buffer throws: + istringstream in("01234567890123456789"); + CPPUNIT_ASSERT( in ); + + full_streambuf full_buf(10, true); + ostream out(&full_buf); + CPPUNIT_ASSERT( out ); + + out << in.rdbuf(); + CPPUNIT_ASSERT( out.bad() ); + CPPUNIT_ASSERT( in ); + //out is bad we have no guaranty on what has been extracted: + //CPPUNIT_ASSERT( full_buf.str() == "0123456789" ); + + out.clear(); + out << in.rdbuf(); + CPPUNIT_ASSERT( out.fail() && out.bad() ); + CPPUNIT_ASSERT( in ); + + ostringstream ostr; + ostr << in.rdbuf(); + CPPUNIT_ASSERT( ostr ); + CPPUNIT_ASSERT( in ); + CPPUNIT_ASSERT( ostr.str() == "01234567890123456789" ); + } +# endif +} + +void SstreamTest::seek() +{ + stringstream s( "0123456789" ); + + CPPUNIT_ASSERT( s.tellg() == stringstream::pos_type(0) ); + s.seekg( 6, ios::beg ); + CPPUNIT_ASSERT( s.tellg() == stringstream::pos_type(6) ); + s.seekg( -3, ios::cur ); + CPPUNIT_ASSERT( s.tellg() == stringstream::pos_type(3) ); + + istringstream is( "0123456789" ); + CPPUNIT_ASSERT( is.tellg() == stringstream::pos_type(0) ); + is.seekg( 6, ios::beg ); + CPPUNIT_ASSERT( is.tellg() == stringstream::pos_type(6) ); + is.seekg( -3, ios::cur ); + CPPUNIT_ASSERT( is.tellg() == stringstream::pos_type(3) ); +} + +void SstreamTest::seekp() +{ + ostringstream s; + + s << "1234567"; + CPPUNIT_CHECK( s.tellp() == stringstream::pos_type(7) ); + CPPUNIT_CHECK( s.str() == "1234567" ); + s.seekp( 0 ); + s << "X"; + CPPUNIT_CHECK( s.str() == "X234567" ); + s.seekp( 0, ios::beg ); + s << "Y"; + CPPUNIT_CHECK( s.str() == "Y234567" ); +} + +void SstreamTest::seek_gp() +{ + stringstream ss( "1" ); + + /* ISO/IEC 14882 2003 (and 1998 too) assume change as get as put positions + with seekg and seekp (27.6.1.3, par 38; 27.6.2.4 par 2), + but this contradict to common practice and proposed draft N2588 + (27.6.1.3, par 41; 27.6.2.5, par 4) + + Now STLport implement (i.e. change behaviour ) the draft's point of view. + */ + + ss.seekg( 0, ios::beg ); + ss.seekp( 0, ios::end ); + + ss << "2"; + + string str; + + ss >> str; + + /* CPPUNIT_CHECK( str == "2" ); --- according ISO/IEC 14882 2003 */ + CPPUNIT_CHECK( str == "12" ); +} + +void SstreamTest::tellp() +{ + { + ostringstream o( "1" ); + + o << "23456"; + + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == stringstream::pos_type(6) ); + CPPUNIT_CHECK( o.tellp() == stringstream::pos_type(6) ); + } + { + ostringstream o; + + o << "123456"; + + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == stringstream::pos_type(6) ); + CPPUNIT_CHECK( o.tellp() == stringstream::pos_type(6) ); + } + { + ostringstream o( "1" ); + + o << "23456789"; + + CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == stringstream::pos_type(9) ); + CPPUNIT_CHECK( o.tellp() == stringstream::pos_type(9) ); + } +} + + +template < class T > +string to_string( const T& v ) +{ + ostringstream oss; + oss << v; + return oss.str(); +} + +void SstreamTest::negative() +{ + CPPUNIT_CHECK( to_string(-1) == "-1" ); + CPPUNIT_CHECK( to_string(-1) == "-1" ); +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/stack_allocator.h b/reactos/lib/3rdparty/stlport/test/unit/stack_allocator.h new file mode 100644 index 00000000000..93db9602a67 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stack_allocator.h @@ -0,0 +1,206 @@ +#ifndef STLPORT_UNIT_TEST_STACK_ALLOCATOR_H +#define STLPORT_UNIT_TEST_STACK_ALLOCATOR_H + +#include + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +//For bad_alloc: +# include +#endif + +#undef __STD +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +# define __STD std:: +#else +# define __STD +#endif + +struct State { + char *m_beg, *m_end, *m_cur; + bool m_isOk, m_swaped; + int m_nbAlloc; + + //The following members are shared among all StackAllocator instance created from + //a reference StackAllocator instance: + char **m_sharedCur; + bool *m_sharedOk; + int *m_sharedNbAlloc; + +#if defined (__DMC__) + State(){} +#endif + + State(char *beg, char *end) + : m_beg(beg), m_end(end), m_cur(m_beg), m_isOk(true), m_swaped(false), m_nbAlloc(0), + m_sharedCur(&m_cur), m_sharedOk(&m_isOk), m_sharedNbAlloc(&m_nbAlloc) {} + + State(const State& other) + : m_beg(other.m_beg), m_end(other.m_end), m_cur(0), + m_isOk(true), m_swaped(other.m_swaped), m_nbAlloc(0), + m_sharedCur(other.m_sharedCur), m_sharedOk(other.m_sharedOk), + m_sharedNbAlloc(other.m_sharedNbAlloc) {} +}; + +/* This allocator is not thread safe: + */ +template +struct StackAllocator +#if defined (STLPORT) && \ + defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + //Special Borland workaround that have problem with function + //overloading when one of the overloaded version is a template + //one. This is the case for the std::swap function. + : public __STD __stlport_class > +#endif +{ + typedef _Tp value_type; + typedef value_type * pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + +#if defined (__DMC__) + StackAllocator(){} +#endif + + StackAllocator(char *beg, char *end) + : m_state(beg, end) {} + + const State& getState() const { return m_state; } +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + template + StackAllocator(StackAllocator<_OtherTp> const& other) + : m_state(other.getState()) {} +#else + StackAllocator(const State& state) + : m_state(state) {} +#endif + +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template + struct rebind { + typedef StackAllocator<_Other> other; + }; +#endif + + _Tp* allocate(size_type n, void* = 0) { + if (n == 0) + return 0; + + ++(*m_state.m_sharedNbAlloc); + + if (*m_state.m_sharedCur + (n * sizeof(_Tp)) < m_state.m_end) { + char *ret = *m_state.m_sharedCur; + *m_state.m_sharedCur += n * sizeof(_Tp); + return reinterpret_cast<_Tp*>(ret); + } +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + throw __STD bad_alloc(); +# if defined (__DMC__) + return 0; +# endif +#else + return 0; +#endif + } + +#if defined (STLPORT) && \ + defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + //Necessary extension to make StackAllocator a real STLport allocator + //implementation: + _Tp* _M_allocate(size_type n, size_type &new_n) { + new_n = n; + return allocate(n); + } +#endif + + void deallocate(pointer p, size_type n) { + if (p == 0) + return; + + --(*m_state.m_sharedNbAlloc); + + if ((char*)p == (*m_state.m_sharedCur - n * sizeof(_Tp))) { + *m_state.m_sharedCur -= n * sizeof(_Tp); + } + + if ((char*)p < m_state.m_beg || (char*)p >= m_state.m_end) { + //An object has been returned to the bad allocator instance: + *m_state.m_sharedOk = false; + } + } + + pointer address(reference __x) const {return &__x;} + const_pointer address(const_reference __x) const { return &__x; } + size_type max_size() const { return m_state.m_end - *m_state.m_sharedCur; } + void construct(pointer __p, const_reference __val) { new(__p) _Tp(__val); } + void destroy(pointer __p) { __p->~_Tp(); } + + bool ok() const { return m_state.m_isOk && (m_state.m_nbAlloc == 0); } + void reset () { + m_state.m_cur = m_state.m_beg; + m_state.m_isOk = true; + m_state.m_swaped = false; + } + bool swaped() const { return m_state.m_swaped; } + void swap(StackAllocator &other) { + __STD swap(m_state, other.m_state); + m_state.m_swaped = true; + other.m_state.m_swaped = true; + } +#if defined (STLPORT) && \ + defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(StackAllocator& __x) { swap(__x); } +#endif + + //2 StackAllocator instance are identical if they are built on top + //of the same buffer. + bool operator == (StackAllocator const& other) const + { return m_state.m_beg == other.m_state.m_beg; } + + bool operator != (StackAllocator const& other) const + { return !(*this == other); } + +private: + State m_state; +}; + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +namespace std { +#endif + +# if defined (STLPORT) && (defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES)) +template +inline StackAllocator<_Tp2>& +__stl_alloc_rebind(StackAllocator<_Tp1>& __a, const _Tp2*) { return (StackAllocator<_Tp2>&)(__a); } +template +inline StackAllocator<_Tp2> +__stl_alloc_create(const StackAllocator<_Tp1>& __a, const _Tp2*) { return StackAllocator<_Tp2>(__a.getState()); } +# endif + +# if !defined (STLPORT) || defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + template + inline void swap(StackAllocator<_Tp>& __a, StackAllocator<_Tp>& __b) + { __a.swap(__b); } +# elif !defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) +//The following overloads depends on instanciation, if new unit tests are written +//with new StackAllocator instanciations associated swap overload should also be +//written +inline void swap(StackAllocator& __a, StackAllocator& __b) +{ __a.swap(__b); } +inline void swap(StackAllocator& __a, StackAllocator& __b) +{ __a.swap(__b); } +inline void swap(StackAllocator >& __a, + StackAllocator >& __b) +{ __a.swap(__b); } +# endif + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +} +#endif + +#undef __STD + +#endif //STLPORT_UNIT_TEST_STACK_ALLOCATOR_H diff --git a/reactos/lib/3rdparty/stlport/test/unit/stack_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/stack_header_test.cpp new file mode 100644 index 00000000000..39946ea75e0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stack_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/stack_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/stack_test.cpp new file mode 100644 index 00000000000..5ff2aaa42f5 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stack_test.cpp @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class StackTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(StackTest); + CPPUNIT_TEST(stack1); + CPPUNIT_TEST(stack2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void stack1(); + void stack2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(StackTest); + +// +// tests implementation +// +void StackTest::stack1() +{ + stack > s; + s.push(42); + s.push(101); + s.push(69); + CPPUNIT_ASSERT(s.top()==69); + s.pop(); + CPPUNIT_ASSERT(s.top()==101); + s.pop(); + CPPUNIT_ASSERT(s.top()==42); + s.pop(); + CPPUNIT_ASSERT(s.empty()); +} +void StackTest::stack2() +{ + stack > s; + s.push(42); + s.push(101); + s.push(69); + CPPUNIT_ASSERT(s.top()==69); + s.pop(); + CPPUNIT_ASSERT(s.top()==101); + s.pop(); + CPPUNIT_ASSERT(s.top()==42); + s.pop(); + CPPUNIT_ASSERT(s.empty()); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/stdarg_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/stdarg_header_test.c new file mode 100644 index 00000000000..9901cba8d3b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stdarg_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/stddef_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/stddef_header_test.c new file mode 100644 index 00000000000..eb00372a847 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stddef_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/stdexcept_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/stdexcept_header_test.cpp new file mode 100644 index 00000000000..d8114e667b0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stdexcept_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/stdio_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/stdio_header_test.c new file mode 100644 index 00000000000..d8f42c117e8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stdio_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/stdlib_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/stdlib_header_test.c new file mode 100644 index 00000000000..a43f90693ef --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stdlib_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/stldbg_include.cpp b/reactos/lib/3rdparty/stlport/test/unit/stldbg_include.cpp new file mode 100644 index 00000000000..ab2c9a8b215 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/stldbg_include.cpp @@ -0,0 +1,40 @@ +/* + * This is compile-time test for situation below not happen. + * STLport use many defines and auxilary structures, namespaces and templates + * that included via _prolog.h. After preprocessor phase we may see: + * + * extern "C" { + * + * namespace std { } + * + * + * This is bad, but acceptable. But in STLPORT_DEBUG mode we can see + * + * extern "C" { + * + * namespace std { + * namespace private { + * + * template + * class __stl_debug_engine { + * + * + * This lead to compile-time error. + * [This due to sys/types.h contains + * + * __BEGIN_DECLS + * #include + * + * + * i.e. include other headers within extern "C" { scope. Bad, but this is fact.] + * + * Origin of problem: STLport provide proxy-headers as for C++ headers, as for C + * headers. For C headers, we shouldn't expose C++ constructions, because system + * headers may include each other by unexpected way (from STLport point of view). + * + * - ptr, 2007-04-05 + */ + +#ifdef __unix +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/streambuf_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/streambuf_header_test.cpp new file mode 100644 index 00000000000..935f909c34b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/streambuf_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/string_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/string_header_test.c new file mode 100644 index 00000000000..a242eeb66bd --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/string_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/string_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/string_header_test.cpp new file mode 100644 index 00000000000..4f36b275be8 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/string_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/string_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/string_test.cpp new file mode 100644 index 00000000000..987d68e6fc9 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/string_test.cpp @@ -0,0 +1,1427 @@ +//To make GLib C++ closer to STLport behavior we need this macro: +//Only mandatory when building unit tests without STLport, do not change +//anything when building with STLport +#define _GLIBCXX_FULLY_DYNAMIC_STRING + +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include +#include +#include +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +#endif + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# include +#endif + +#if !defined (STLPORT) || defined (_STLP_THREADS) +# if defined (STLPORT) && defined (_STLP_PTHREADS) || \ + defined (__GNUC__) && !defined (__MINGW32__) +# define USE_PTHREAD_API +# include +# endif + +# if defined (STLPORT) && defined (_STLP_WIN32THREADS) || \ + defined (__GNUC__) && defined (__MINGW32__) || \ + defined (_MSC_VER) +# define USE_WINDOWS_API +# include +# endif +#endif + +#include "stack_allocator.h" +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class StringTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(StringTest); + CPPUNIT_TEST(constructor); + CPPUNIT_TEST(trivial_char_compare); + CPPUNIT_TEST(reserve); + CPPUNIT_TEST(assign); + CPPUNIT_TEST(erase); + CPPUNIT_TEST(data); + CPPUNIT_TEST(c_str); + CPPUNIT_TEST(null_char); + CPPUNIT_TEST(insert); + CPPUNIT_TEST(replace); + CPPUNIT_TEST(resize); + CPPUNIT_TEST(short_string); + CPPUNIT_TEST(find); + CPPUNIT_TEST(bogus_edge_find); + CPPUNIT_TEST(rfind); + CPPUNIT_TEST(find_last_of); + CPPUNIT_TEST(find_last_not_of); + CPPUNIT_TEST(copy); +#if !defined (USE_PTHREAD_API) && !defined (USE_WINDOWS_API) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(mt); + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(short_string_optim_bug); + CPPUNIT_TEST(compare); + CPPUNIT_TEST(template_expression); +#if defined (STLPORT) && ((defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) || \ + (defined(__GNUC__) && defined(_STLP_USE_TEMPLATE_EXPRESSION) && \ + ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) ) ) +# define TE_TMP_TEST_IGNORED + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(te_tmp); +#if defined (TE_TMP_TEST_IGNORED) + CPPUNIT_STOP_IGNORE; +#endif + CPPUNIT_TEST(oper_tmp); +#if defined (STLPORT) && defined (_STLP_NO_WCHAR_T) + CPPUNIT_IGNORE; +#endif +#if defined (__CYGWIN__) && !defined (STLPORT) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(template_wexpression); + CPPUNIT_STOP_IGNORE; +#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(io); + CPPUNIT_STOP_IGNORE; +#if defined (STLPORT) && defined (_STLP_NO_CUSTOM_IO) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(allocator_with_state); + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(capacity); + CPPUNIT_TEST(concat24); + CPPUNIT_TEST_SUITE_END(); + +protected: + void constructor(); + void trivial_char_compare(); + void reserve(); + void erase(); + void data(); + void c_str(); + void null_char(); + void insert(); + void replace(); + void resize(); + void short_string(); + void find(); + void bogus_edge_find(); + void rfind(); + void find_last_of(); + void find_last_not_of(); + void copy(); + void assign(); + void mt(); + void short_string_optim_bug(); + void compare(); + void template_expression(); + void te_tmp(); + void oper_tmp(); + void template_wexpression(); + void io(); + void allocator_with_state(); + void capacity(); + void concat24(); + + static string func(const string& par) { + string tmp( par ); + return tmp; + } + +#if defined (USE_PTHREAD_API) || defined (USE_WINDOWS_API) +# if defined (USE_PTHREAD_API) + static void* f(void*) +# else + static DWORD __stdcall f(void*) +# endif + { + string s( "qyweyuewunfkHBUKGYUGL,wehbYGUW^(@T@H!BALWD:h^&@#*@(#:JKHWJ:CND" ); + + for ( int i = 0; i < 2000000; ++i ) { + string sx = func( s ); + } + + return 0; + } +#endif + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(StringTest); + +// +// tests implementation +// +void StringTest::constructor() +{ +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + string s((size_t)-1, 'a'); + CPPUNIT_FAIL; + } + catch (length_error const&) { + } + catch (...) { + //Expected exception is length_error: + CPPUNIT_FAIL; + } +#endif +} + +void StringTest::trivial_char_compare() +{ + string s( "message" ); + + CPPUNIT_CHECK( s == "message" ); + CPPUNIT_CHECK( "message" == s ); +} + +void StringTest::reserve() +{ + string s; +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + s.reserve(s.max_size() + 1); + CPPUNIT_FAIL; + } + catch (length_error const&) { + } + catch (...) { + //Expected exception is length_error: + CPPUNIT_FAIL; + } +#endif +} + +void StringTest::mt() +{ +#if defined (USE_PTHREAD_API) || defined (USE_WINDOWS_API) + const int nth = 2; +# if defined (USE_PTHREAD_API) + pthread_t t[nth]; + + for ( int i = 0; i < nth; ++i ) { + pthread_create( &t[i], 0, f, 0 ); + } + + for ( int i = 0; i < nth; ++i ) { + pthread_join( t[i], 0 ); + } +# endif // PTHREAD + +# if defined (USE_WINDOWS_API) + //DWORD start = GetTickCount(); + + HANDLE t[nth]; + + int i; // VC6 not support in-loop scope of cycle var + for ( i = 0; i < nth; ++i ) { + t[i] = CreateThread(NULL, 0, f, 0, 0, NULL); + } + + if (WaitForMultipleObjects(nth, t, TRUE, INFINITE) == WAIT_FAILED) { + // On some platforms (evc3/evc4) WaitForMultipleObjects() with fWaitAll == TRUE + // is not supported. We then wait with a loop on each thread: + for ( i = 0; i < nth; ++i ) { + WaitForSingleObject(t[i], INFINITE); + } + } + + /* + DWORD duration = GetTickCount() - start; + ostringstream ostr; + ostr << "Duration: " << duration << endl; + CPPUNIT_MESSAGE(ostr.str().c_str()); + */ +# endif +#endif +} + +void StringTest::short_string() +{ + string const ref_short_str1("str1"), ref_short_str2("str2"); + string short_str1(ref_short_str1), short_str2(ref_short_str2); + string const ref_long_str1("str 1"); + string const ref_long_str2("str 2"); + string long_str1(ref_long_str1), long_str2(ref_long_str2); + + CPPUNIT_ASSERT(short_str1 == ref_short_str1); + CPPUNIT_ASSERT(long_str1 == ref_long_str1); + + { + string str1(short_str1); + str1 = long_str1; + CPPUNIT_ASSERT(str1 == ref_long_str1); + } + + { + string str1(long_str1); + str1 = short_str1; + CPPUNIT_ASSERT(str1 == ref_short_str1); + } + + { + short_str1.swap(short_str2); + CPPUNIT_ASSERT((short_str1 == ref_short_str2) && (short_str2 == ref_short_str1)); + short_str1.swap(short_str2); + } + + { + long_str1.swap(long_str2); + CPPUNIT_ASSERT((long_str1 == ref_long_str2) && (long_str2 == ref_long_str1)); + long_str1.swap(long_str2); + } + + { + short_str1.swap(long_str1); + CPPUNIT_ASSERT((short_str1 == ref_long_str1) && (long_str1 == ref_short_str1)); + short_str1.swap(long_str1); + } + + { + long_str1.swap(short_str1); + CPPUNIT_ASSERT((short_str1 == ref_long_str1) && (long_str1 == ref_short_str1)); + long_str1.swap(short_str1); + } + + { + string a(256, 'a'); + string b(256, 'b'); + const char* as = a.c_str(); + const char* bs = b.c_str(); + swap(a, b); + CPPUNIT_ASSERT( a.c_str() == bs ); + CPPUNIT_ASSERT( b.c_str() == as ); + } + + { + //This is to test move constructor + vector str_vect; + str_vect.push_back(short_str1); + str_vect.push_back(long_str1); + str_vect.push_back(short_str2); + str_vect.push_back(long_str2); + CPPUNIT_ASSERT((str_vect[0] == ref_short_str1) && + (str_vect[1] == ref_long_str1) && + (str_vect[2] == ref_short_str2) && + (str_vect[3] == ref_long_str2)); + } +} + +void StringTest::erase() +{ + char const* c_str = "Hello, World!"; + string str(c_str); + CPPUNIT_ASSERT( str == c_str ); + + str.erase(str.begin() + 1, str.end() - 1); // Erase all but first and last. + + size_t i; + for (i = 0; i < str.size(); ++i) { + switch ( i ) { + case 0: + CPPUNIT_ASSERT( str[i] == 'H' ); + break; + case 1: + CPPUNIT_ASSERT( str[i] == '!' ); + break; + default: + CPPUNIT_FAIL; + } + } + + str.insert(1, c_str); + str.erase(str.begin()); // Erase first element. + str.erase(str.end() - 1); // Erase last element. + CPPUNIT_ASSERT( str == c_str ); + str.clear(); // Erase all. + CPPUNIT_ASSERT( str.empty() ); + + str = c_str; + CPPUNIT_ASSERT( str == c_str ); + + str.erase(1, str.size() - 1); // Erase all but first and last. + for (i = 0; i < str.size(); i++) { + switch ( i ) { + case 0: + CPPUNIT_ASSERT( str[i] == 'H' ); + break; + case 1: + CPPUNIT_ASSERT( str[i] == '!' ); + break; + default: + CPPUNIT_FAIL; + } + } + + str.erase(1); + CPPUNIT_ASSERT( str == "H" ); +} + +void StringTest::data() +{ + string xx; + + CPPUNIT_ASSERT( xx.data() != 0 ); // ISO-IEC-14882:1998(E), 21.3.6, paragraph 3 +#if 0 + /* This test really not required: in ISO-IEC-14882:1998(E) paragraph 3 stated: + * '... and can have zero added to it', again: 'CAN', but not 'MUST'. + * That's why I am comment this test. But I don't remove it due to I had + * unevident problem with misinterpretation of data() return (i.e. data() + * and c_str() provide different functionality!) and expect that this is + * more-or-less common pitfall. + * - ptr + */ + string low( "2004-01-01" ); + // Blocks A and B should follow each other. + // Block A: + xx = "123456"; + xx += low; + if ( strcmp( xx.data(), "1234562004-01-01" ) != 0 ) { + return -1; + } + // End of block A + + // Block B: + xx = "1234"; + xx += ";"; + + if ( strcmp( xx.data(), "1234;" ) != 0 ) { + return -1; + } + // End of block B +#endif +} + +void StringTest::c_str() +{ + string low( "2004-01-01" ); + string xx; + string yy; + + CPPUNIT_ASSERT( *(yy.c_str()) == '\0' ); // ISO-IEC-14882:1998(E), 21.3.6, paragraph 1 + + // Blocks A and B should follow each other. + // Block A: + xx = "123456"; + xx += low; + CPPUNIT_ASSERT( strcmp( xx.c_str(), "1234562004-01-01" ) == 0 ); + // End of block A + + // Block B: + xx = "1234"; + xx += ";"; + CPPUNIT_ASSERT( strcmp( xx.c_str(), "1234;" ) == 0 ); + // End of block B +} + +void StringTest::null_char() +{ + // ISO/IEC 14882:1998(E), ISO/IEC 14882:2003(E), 21.3.4 ('... the const version') + const string s( "123456" ); + + CPPUNIT_CHECK( s[s.size()] == '\0' ); + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + //Check is only here to avoid warning about value of expression not used + CPPUNIT_CHECK( s.at(s.size()) == '\0' ); + CPPUNIT_FAIL; + } + catch (out_of_range const&) { + CPPUNIT_ASSERT( true ); + } + catch ( ... ) { + CPPUNIT_FAIL; + } +#endif +} + +void StringTest::insert() +{ + string strorg = "This is test string for string calls"; + string str; + /* + * In case of reallocation there is no auto reference problem + * so we reserve a big enough string to be sure to test this + * particular point. + */ + str.reserve(100); + str = strorg; + + //test self insertion: + str.insert(10, str.c_str() + 5, 15); + CPPUNIT_ASSERT( str == "This is teis test string st string for string calls" ); + + str = strorg; + str.insert(15, str.c_str() + 5, 25); + CPPUNIT_ASSERT( str == "This is test stis test string for stringring for string calls" ); + + str = strorg; + str.insert(0, str.c_str() + str.size() - 4, 4); + CPPUNIT_ASSERT( str == "allsThis is test string for string calls" ); + + str = strorg; + str.insert(0, str.c_str() + str.size() / 2 - 1, str.size() / 2 + 1); + CPPUNIT_ASSERT( str == "ng for string callsThis is test string for string calls" ); + + str = strorg; + string::iterator b = str.begin(); + string::const_iterator s = str.begin() + str.size() / 2 - 1; + string::const_iterator e = str.end(); + str.insert( b, s, e ); + CPPUNIT_ASSERT( str == "ng for string callsThis is test string for string calls" ); + + str = strorg; + str.insert(str.begin(), str.begin() + str.size() / 2 - 1, str.end()); + CPPUNIT_ASSERT( str == "ng for string callsThis is test string for string calls" ); + +#ifdef _STLP_MEMBER_TEMPLATES + vector int_vect; + //Just a compile time test: + str.insert(str.end(), int_vect.begin(), int_vect.end()); +#endif + + string str0; + str0.insert(str0.begin(), 5, '0'); + CPPUNIT_ASSERT( str0 == "00000" ); + + string str1; + { + string::size_type pos = 0, nb = 2; + str1.insert(pos, nb, '1'); + } + CPPUNIT_ASSERT( str1 == "11" ); + + str0.insert(0, str1); + CPPUNIT_ASSERT( str0 == "1100000" ); + + string str2("2345"); + str0.insert(str0.size(), str2, 1, 2); + CPPUNIT_ASSERT( str0 == "110000034" ); + + str1.insert(str1.begin() + 1, 2, '2'); + CPPUNIT_ASSERT( str1 == "1221" ); + + str1.insert(2, "333333", 3); + CPPUNIT_ASSERT( str1 == "1233321" ); + + str1.insert(4, "4444"); + CPPUNIT_ASSERT( str1 == "12334444321" ); + + str1.insert(str1.begin() + 6, '5'); + CPPUNIT_ASSERT( str1 == "123344544321" ); +} + +void StringTest::replace() +{ + /* + * This test case is for the non template basic_string::replace method, + * this is why we play with the const iterators and reference to guaranty + * that the right method is called. + */ + const string v( "78" ); + string s( "123456" ); + string const& cs = s; + + string::iterator i = s.begin() + 1; + s.replace(i, i + 3, v.begin(), v.end()); + CPPUNIT_ASSERT( s == "17856" ); + + s = "123456"; + i = s.begin() + 1; + s.replace(i, i + 1, v.begin(), v.end()); + CPPUNIT_ASSERT( s == "1783456" ); + + s = "123456"; + i = s.begin() + 1; + string::const_iterator ci = s.begin() + 1; + s.replace(i, i + 3, ci + 3, cs.end()); + CPPUNIT_ASSERT( s == "15656" ); + + s = "123456"; + i = s.begin() + 1; + ci = s.begin() + 1; + s.replace(i, i + 3, ci, ci + 2); + CPPUNIT_ASSERT( s == "12356" ); + + s = "123456"; + i = s.begin() + 1; + ci = s.begin() + 1; + s.replace(i, i + 3, ci + 1, cs.end()); + CPPUNIT_ASSERT( s == "1345656" ); + + s = "123456"; + i = s.begin(); + ci = s.begin() + 1; + s.replace(i, i, ci, ci + 1); + CPPUNIT_CHECK( s == "2123456" ); + + s = "123456"; + s.replace(s.begin() + 4, s.end(), cs.begin(), cs.end()); + CPPUNIT_ASSERT( s == "1234123456" ); + + /* + * This is the test for the template replace method. + */ + s = "123456"; + string::iterator b = s.begin() + 4; + string::iterator e = s.end(); + string::const_iterator rb = s.begin(); + string::const_iterator re = s.end(); + s.replace(b, e, rb, re); + CPPUNIT_ASSERT( s == "1234123456" ); + + s = "123456"; + s.replace(s.begin() + 4, s.end(), s.begin(), s.end()); + CPPUNIT_ASSERT( s == "1234123456" ); + + string strorg("This is test string for string calls"); + string str = strorg; + str.replace(5, 15, str.c_str(), 10); + CPPUNIT_ASSERT( str == "This This is tefor string calls" ); + + str = strorg; + str.replace(5, 5, str.c_str(), 10); + CPPUNIT_ASSERT( str == "This This is test string for string calls" ); + +#if (defined (STLPORT) && defined(_STLP_MEMBER_TEMPLATES)) || ( !defined (STLPORT) && !defined(__GNUC__) ) + deque cdeque; + cdeque.push_back('I'); + str.replace(str.begin(), str.begin() + 11, cdeque.begin(), cdeque.end()); + CPPUNIT_ASSERT( str == "Is test string for string calls" ); +#endif +} + +void StringTest::resize() +{ + string s; + + s.resize(0); + + CPPUNIT_ASSERT( *s.c_str() == 0 ); + + s = "1234567"; + + s.resize(0); + CPPUNIT_ASSERT( *s.c_str() == 0 ); + + s = "1234567"; + s.resize(1); + CPPUNIT_ASSERT( s.size() == 1 ); + CPPUNIT_ASSERT( *s.c_str() == '1' ); + CPPUNIT_ASSERT( *(s.c_str() + 1) == 0 ); + + s = "1234567"; + s.resize(10); + CPPUNIT_ASSERT( s.size() == 10 ); + CPPUNIT_ASSERT( s[6] == '7' ); + CPPUNIT_ASSERT( s[7] == 0 ); + CPPUNIT_ASSERT( s[8] == 0 ); + CPPUNIT_ASSERT( s[9] == 0 ); +} + +void StringTest::find() +{ + string s("one two three one two three"); + CPPUNIT_ASSERT( s.find("one") == 0 ); + CPPUNIT_ASSERT( s.find('t') == 4 ); + CPPUNIT_ASSERT( s.find('t', 5) == 8 ); + //We are trying to get a const reference to the npos string static member to + //force the compiler to allocate memory for this variable. It is used to reveal + //a bug of STLport which was simply declaring npos without instanciating it. +#if defined (STLPORT) && defined (_STLP_STATIC_CONST_INIT_BUG) + string::size_type const& npos_local = string::npos; +#else +# define npos_local string::npos +#endif + CPPUNIT_ASSERT( s.find("four") == npos_local ); + CPPUNIT_ASSERT( s.find("one", string::npos) == npos_local ); + + CPPUNIT_ASSERT( s.find_first_of("abcde") == 2 ); + + CPPUNIT_ASSERT( s.find_first_not_of("enotw ") == 9 ); + + string empty; + CPPUNIT_ASSERT( s.substr(s.find(empty), empty.size()) == empty ); +} + +void StringTest::bogus_edge_find() +{ + /* ISO/IEC 14882 2003, 21.3.6.1 basic_string::find [lib.string::find] + * + * size_type find(const basic_string& str, + * size_type pos = 0) const; + * Effects: Determines the lowest position xpos, if possible, such that + * both of the following conditions obtain: + * pos <= xpos and xpos + str.size() <= size(); + * at(xpos+I) == str.at(I) for all elements I of the string controlled by str. + * Returns: xpos if the function can determine such a value for xpos. Otherwise, + * returns npos. + * Notes: Uses traits::eq(). + * + * === + * So, from formal point of view + * string s; string::size_type p = s.find( "", 0, 0 ); + * should return 0 in p, i.e. position out-of-bound of string, so + * code like following is bad: + * string s; + * + * string::size_type p = s.find( "", 0, 0 ); + * + * ... + * + * if ( p != string::npos ) { // normal + * char ch = s[p]; // Arghhhhhhhhhh + * } + * + * People near Standard commete has opinion opposite to my. Even if it looks + * like bogus behaviour for me, it should be fixed. + */ + + { + string s; + string::size_type p = s.find( "", 0, 0 ); + + /* CPPUNIT_CHECK( p == string::npos ); */ + CPPUNIT_CHECK( p == 0 ); // bogus result, isn't it? + } + { + string s( "123" ); + string::size_type p = s.find( "", 0, 0 ); + + CPPUNIT_CHECK( p == 0 ); + } + { + string s( "123" ); + string::size_type p = s.find( "", 1, 0 ); + + CPPUNIT_CHECK( p == 1 ); + } + { + string s( "" ); + string::size_type p = s.find( "", 1, 0 ); + + CPPUNIT_CHECK( p == string::npos ); + } + { + string s( "123" ); + string::size_type p = s.find( "", 3, 0 ); + + CPPUNIT_CHECK( p == 3 ); // bogus result, isn't it? + } + { + string s; + string::size_type p = s.rfind( "", 0, 0 ); + + /* CPPUNIT_CHECK( p == string::npos ); */ + CPPUNIT_CHECK( p == 0 ); // bogus result, isn't it? + } + { + string s( "123" ); + string::size_type p = s.rfind( "", 0, 0 ); + + CPPUNIT_CHECK( p == 0 ); + } + { + string s( "123" ); + string::size_type p = s.rfind( "", 1, 0 ); + + CPPUNIT_CHECK( p == 1 ); + } + { + string s( "" ); + string::size_type p = s.rfind( "", 1, 0 ); + + CPPUNIT_CHECK( p == 0 ); // bogus result, isn't it? + } + { + string s( "123" ); + string::size_type p = s.rfind( "", 3, 0 ); + + CPPUNIT_CHECK( p == 3 ); // bogus result, isn't it? + } +} + +void StringTest::rfind() +{ + // 21.3.6.2 + string s("one two three one two three"); + + CPPUNIT_ASSERT( s.rfind("two") == 18 ); + CPPUNIT_ASSERT( s.rfind("two", 0) == string::npos ); + CPPUNIT_ASSERT( s.rfind("two", 11) == 4 ); + CPPUNIT_ASSERT( s.rfind('w') == 19 ); + + string test( "aba" ); + + CPPUNIT_CHECK( test.rfind( "a", 2, 1 ) == 2 ); + CPPUNIT_CHECK( test.rfind( "a", 1, 1 ) == 0 ); + CPPUNIT_CHECK( test.rfind( "a", 0, 1 ) == 0 ); + + CPPUNIT_CHECK( test.rfind( 'a', 2 ) == 2 ); + CPPUNIT_CHECK( test.rfind( 'a', 1 ) == 0 ); + CPPUNIT_CHECK( test.rfind( 'a', 0 ) == 0 ); +} + +void StringTest::find_last_of() +{ + // 21.3.6.4 + string s("one two three one two three"); + + CPPUNIT_ASSERT( s.find_last_of("abcde") == 26 ); + + string test( "aba" ); + + CPPUNIT_CHECK( test.find_last_of( "a", 2, 1 ) == 2 ); + CPPUNIT_CHECK( test.find_last_of( "a", 1, 1 ) == 0 ); + CPPUNIT_CHECK( test.find_last_of( "a", 0, 1 ) == 0 ); + + CPPUNIT_CHECK( test.find_last_of( 'a', 2 ) == 2 ); + CPPUNIT_CHECK( test.find_last_of( 'a', 1 ) == 0 ); + CPPUNIT_CHECK( test.find_last_of( 'a', 0 ) == 0 ); +} + +void StringTest::find_last_not_of() +{ + // 21.3.6.6 + string s("one two three one two three"); + + CPPUNIT_ASSERT( s.find_last_not_of("ehortw ") == 15 ); + + string test( "aba" ); + + CPPUNIT_CHECK( test.find_last_not_of( "a", 2, 1 ) == 1 ); + CPPUNIT_CHECK( test.find_last_not_of( "b", 2, 1 ) == 2 ); + CPPUNIT_CHECK( test.find_last_not_of( "a", 1, 1 ) == 1 ); + CPPUNIT_CHECK( test.find_last_not_of( "b", 1, 1 ) == 0 ); + CPPUNIT_CHECK( test.find_last_not_of( "a", 0, 1 ) == string::npos ); + CPPUNIT_CHECK( test.find_last_not_of( "b", 0, 1 ) == 0 ); + + CPPUNIT_CHECK( test.find_last_not_of( 'a', 2 ) == 1 ); + CPPUNIT_CHECK( test.find_last_not_of( 'b', 2 ) == 2 ); + CPPUNIT_CHECK( test.find_last_not_of( 'a', 1 ) == 1 ); + CPPUNIT_CHECK( test.find_last_not_of( 'b', 1 ) == 0 ); + CPPUNIT_CHECK( test.find_last_not_of( 'a', 0 ) == string::npos ); + CPPUNIT_CHECK( test.find_last_not_of( 'b', 0 ) == 0 ); +} + +void StringTest::copy() +{ + string s("foo"); + char dest[4]; + dest[0] = dest[1] = dest[2] = dest[3] = 1; + s.copy(dest, 4); + int pos = 0; + CPPUNIT_ASSERT( dest[pos++] == 'f' ); + CPPUNIT_ASSERT( dest[pos++] == 'o' ); + CPPUNIT_ASSERT( dest[pos++] == 'o' ); + CPPUNIT_ASSERT( dest[pos++] == 1 ); + + dest[0] = dest[1] = dest[2] = dest[3] = 1; + s.copy(dest, 4, 2); + pos = 0; + CPPUNIT_ASSERT( dest[pos++] == 'o' ); + CPPUNIT_ASSERT( dest[pos++] == 1 ); + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + s.copy(dest, 4, 5); + CPPUNIT_FAIL; + } + catch (out_of_range const&) { + } + catch ( ... ) { + CPPUNIT_FAIL; + } +#endif +} + +void StringTest::assign() +{ + string s; + char const* cstr = "test string for assign"; + + s.assign(cstr, cstr + 22); + CPPUNIT_ASSERT( s == "test string for assign" ); + + string s2("other test string"); + s.assign(s2); + CPPUNIT_ASSERT( s == s2 ); + + static string str1; + static string str2; + + // short string optim: + str1 = "123456"; + // longer than short string: + str2 = "1234567890123456789012345678901234567890"; + + CPPUNIT_ASSERT(str1[5] == '6'); + CPPUNIT_ASSERT(str2[29] == '0'); +} + +/* This test is to check if string properly supports the short string + * optimization. It has been found out that eMbedded Visual C++ 3.0 and .NET + * compilers for the ARM platform fail to pass structs and classes of certain + * size per value. This seems to be a known compiler bug. For other processors + * (e.g. x86) the error doesn't occur. + * (The ARM compiler creates a temporary object from teststr on the stack, to + * pass it to the helper function. It uses the copy constructor for this. + * After this the temporary object is copied to another place on the stack. + * The result is that the _M_finish pointer then points to the wrong buffer + * end and the size of the short string is incorrectly calculated.) + */ +void StringTest::short_string_optim_bug() +{ + string teststr("shortest"); + + bool short_string_optim_bug_helper(string teststr); + + CPPUNIT_ASSERT(true == short_string_optim_bug_helper(teststr)); +} + +bool short_string_optim_bug_helper(string teststr) +{ + size_t ss = teststr.size(); + return (ss == 8); +} + +void StringTest::compare() +{ + string str1("abcdef"); + string str2; + + str2 = "abcdef"; + CPPUNIT_ASSERT( str1.compare(str2) == 0 ); + str2 = "abcde"; + CPPUNIT_ASSERT( str1.compare(str2) > 0 ); + str2 = "abcdefg"; + CPPUNIT_ASSERT( str1.compare(str2) < 0 ); + + CPPUNIT_ASSERT( str1.compare("abcdef") == 0 ); + CPPUNIT_ASSERT( str1.compare("abcde") > 0 ); + CPPUNIT_ASSERT( str1.compare("abcdefg") < 0 ); + + str2 = "cde"; + CPPUNIT_ASSERT( str1.compare(2, 3, str2) == 0 ); + str2 = "cd"; + CPPUNIT_ASSERT( str1.compare(2, 3, str2) > 0 ); + str2 = "cdef"; + CPPUNIT_ASSERT( str1.compare(2, 3, str2) < 0 ); + + str2 = "abcdef"; + CPPUNIT_ASSERT( str1.compare(2, 3, str2, 2, 3) == 0 ); + CPPUNIT_ASSERT( str1.compare(2, 3, str2, 2, 2) > 0 ); + CPPUNIT_ASSERT( str1.compare(2, 3, str2, 2, 4) < 0 ); + + CPPUNIT_ASSERT( str1.compare(2, 3, "cdefgh", 3) == 0 ); + CPPUNIT_ASSERT( str1.compare(2, 3, "cdefgh", 2) > 0 ); + CPPUNIT_ASSERT( str1.compare(2, 3, "cdefgh", 4) < 0 ); +} + +/* +class mystring : public string { +public: + mystring() {} + mystring(string const& s) : string(s) {} + + mystring& operator = (string const& s) { + string::operator = (s); + return *this; + }; +}; +*/ + +void StringTest::template_expression() +{ + string one("one"), two("two"), three("three"); + string space(1, ' '); + + // check availability of [un]equality operators + { + // string-string + one == two; + one != two; + // string-literal + one == "two"; + one != "two"; + // literal-string + "one" == two; + "one" != two; + // strsum-string + (one + two) == three; + (one + two) != three; + // string-strsum + one == (two + three); + one != (two + three); + // strsum-literal + (one + two) == "three"; + (one + two) != "three"; + // literal-strsum + "one" == (two + three); + "one" != (two + three); + // strsum-strsum + (one + two) == (two + three); + (one + two) != (two + three); + } + + { + string result(one + ' ' + two + ' ' + three); + CPPUNIT_CHECK( result == "one two three" ); + } + + { + string result(one + ' ' + two + ' ' + three, 4); + CPPUNIT_CHECK( result == "two three" ); + } + + { + string result(one + ' ' + two + ' ' + three, 4, 3); + CPPUNIT_CHECK( result == "two" ); + } + + //2 members expressions: + CPPUNIT_CHECK( (' ' + one) == " one" ); + CPPUNIT_CHECK( (one + ' ') == "one " ); + CPPUNIT_CHECK( (one + " two") == "one two" ); + CPPUNIT_CHECK( ("one " + two) == "one two" ); + CPPUNIT_CHECK( (one + space) == "one " ); + + //3 members expressions: + CPPUNIT_CHECK( ((one + space) + "two") == "one two" ); + CPPUNIT_CHECK( ("one" + (space + two)) == "one two" ); + CPPUNIT_CHECK( ((one + space) + two) == "one two" ); + CPPUNIT_CHECK( (one + (space + two)) == "one two" ); + CPPUNIT_CHECK( ((one + space) + 't') == "one t" ); + CPPUNIT_CHECK( ('o' + (space + two)) == "o two" ); + + //4 members expressions: + CPPUNIT_CHECK( ((one + space) + (two + space)) == "one two " ); + + //special operators + { + string result; + result = one + space + two; + CPPUNIT_CHECK( result == "one two" ); + + result += space + three; + CPPUNIT_CHECK( result == "one two three" ); + } + + //special append method + { + string result; + //Use reserve to avoid reallocation and really test auto-referencing problems: + result.reserve(64); + + result.append(one + space + two); + CPPUNIT_CHECK( result == "one two" ); + + result.append(space + result + space + three); + CPPUNIT_CHECK( result == "one two one two three" ); + + result = "one two"; + result.append(space + three, 1, 2); + CPPUNIT_ASSERT( result == "one twoth" ); + + result.append(space + result); + CPPUNIT_CHECK( result == "one twoth one twoth" ); + } + + //special assign method + { + string result; + //Use reserve to avoid reallocation and really test auto-referencing problems: + result.reserve(64); + + result.assign(one + space + two + space + three); + CPPUNIT_CHECK( result == "one two three" ); + + result.assign(one + space + two + space + three, 3, 5); + CPPUNIT_CHECK( result == " two " ); + + result.assign(one + result + three); + CPPUNIT_CHECK( result == "one two three" ); + } + + { + CPPUNIT_CHECK( !(one + ' ' + two).empty() ); + + char result = (one + ' ' + two)[3]; + CPPUNIT_CHECK( result == ' ' ); + + result = (one + ' ' + two).at(3); + CPPUNIT_CHECK( result == ' ' ); + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + result = (one + ' ' + two).at(10); + CPPUNIT_FAIL; + } + catch (out_of_range const&) { + CPPUNIT_ASSERT( result == ' ' ); + } + catch (...) { + CPPUNIT_FAIL; + } +#endif + } + + /* + mystring a("ing"); + //gcc failed to compile following expression when template expressions are activated. + //MSVC sees no problem. gcc limitation or MSVC is too cool ?? + mystring b = "str" + a; + */ +} + +#if !defined (TE_TMP_TEST_IGNORED) +class superstring +{ + public: + superstring() : + s("super") + {} + + superstring( const string& str ) : + s( str ) + {} + + superstring operator / (const string& str ) + { return superstring( s + "/" + str ); } + + superstring operator / (const char* str ) + { return superstring( s + "/" + str ); } + + private: + string s; +}; +#endif + +void StringTest::te_tmp() +{ +#if !defined (TE_TMP_TEST_IGNORED) + superstring s; + string more( "more" ); + string less( "less" ); + + superstring r = s / (more + less); +#endif +} + +class mypath +{ + public: + mypath( const string& s ) : + p( s ) + { } + + const mypath& operator / ( const string& ); + const string& str() const + { return p; } + + private: + string p; +}; + +const mypath& mypath::operator /( const string& s ) +{ + p += '/'; + p += s; + return *this; +} + +void StringTest::oper_tmp() +{ + string s1( "path1" ); + string s2( ".ext" ); + + string& rs1 = s1; + string& rs2 = s2; + + CPPUNIT_CHECK( (mypath( string( "/root" ) ) / (rs1 + rs2)).str() == "/root/path1.ext" ); +} + +void StringTest::template_wexpression() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) +# if !defined (__CYGWIN__) || defined (STLPORT) + wstring one(L"one"), two(L"two"), three(L"three"); + wstring space(L" "); + + { + wstring result(one + L' ' + two + L' ' + three); + CPPUNIT_CHECK( result == L"one two three" ); + } + + { + wstring result(one + L' ' + two + L' ' + three, 4); + CPPUNIT_CHECK( result == L"two three" ); + } + + { + wstring result(one + L' ' + two + L' ' + three, 4, 3); + CPPUNIT_CHECK( result == L"two" ); + } + + //2 members expressions: + CPPUNIT_CHECK( (L' ' + one) == L" one" ); + CPPUNIT_CHECK( (one + L' ') == L"one " ); + CPPUNIT_CHECK( (one + L" two") == L"one two" ); + CPPUNIT_CHECK( (L"one " + two) == L"one two" ); + CPPUNIT_CHECK( (one + space) == L"one " ); + + //3 members expressions: + CPPUNIT_CHECK( ((one + space) + L"two") == L"one two" ); + CPPUNIT_CHECK( (L"one" + (space + two)) == L"one two" ); + CPPUNIT_CHECK( ((one + space) + two) == L"one two" ); + CPPUNIT_CHECK( (one + (space + two)) == L"one two" ); + CPPUNIT_CHECK( ((one + space) + L't') == L"one t" ); + CPPUNIT_CHECK( (L'o' + (space + two)) == L"o two" ); + + //4 members expressions: + CPPUNIT_CHECK( ((one + space) + (two + space)) == L"one two " ); + + //special operators + { + wstring result; + result = one + space + two; + CPPUNIT_CHECK( result == L"one two" ); + + result += space + three; + CPPUNIT_CHECK( result == L"one two three" ); + } + + //special append method + { + wstring result; + //Use reserve to avoid reallocation and really test auto-referencing problems: + result.reserve(64); + + result.append(one + space + two); + CPPUNIT_CHECK( result == L"one two" ); + + result.append(space + result + space + three); + CPPUNIT_CHECK( result == L"one two one two three" ); + + result = L"one two"; + result.append(space + three, 1, 2); + CPPUNIT_ASSERT( result == L"one twoth" ); + + result.append(space + result); + CPPUNIT_CHECK( result == L"one twoth one twoth" ); + } + + //special assign method + { + wstring result; + //Use reserve to avoid reallocation and really test auto-referencing problems: + result.reserve(64); + + result.assign(one + space + two + space + three); + CPPUNIT_CHECK( result == L"one two three" ); + + result.assign(one + space + two + space + three, 3, 5); + CPPUNIT_CHECK( result == L" two " ); + + result.assign(one + result + three); + CPPUNIT_CHECK( result == L"one two three" ); + } + + { + CPPUNIT_CHECK( !(one + L' ' + two).empty() ); + + wchar_t result = (one + L' ' + two)[3]; + CPPUNIT_CHECK( result == L' ' ); + + result = (one + L' ' + two).at(3); + CPPUNIT_CHECK( result == L' ' ); + +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + result = (one + L' ' + two).at(10); + CPPUNIT_FAIL; + } + catch (out_of_range const&) { + CPPUNIT_ASSERT( result == L' ' ); + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + } +# endif +#endif +} + +void StringTest::io() +{ +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) + string str("STLport"); + { + ostringstream ostr; + ostr << str; + CPPUNIT_ASSERT( ostr.good() ); + CPPUNIT_ASSERT( ostr.str() == str ); + } + { + istringstream istr(str); + string istr_content; + istr >> istr_content; + CPPUNIT_ASSERT( !istr.fail() && istr.eof() ); + CPPUNIT_ASSERT( istr_content == str ); + } + { + istringstream istr(str); + istr.width(3); + string istr_content; + istr >> istr_content; + CPPUNIT_ASSERT( !istr.fail() && !istr.eof() ); + CPPUNIT_ASSERT( istr_content == "STL" ); + } +#endif +} + +void StringTest::allocator_with_state() +{ +#if !(defined (STLPORT) && defined (_STLP_NO_CUSTOM_IO)) + + char buf1[1024]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + typedef basic_string, StackAllocator > StackString; + { + StackString str1("string stack1", stack1); + StackString str1Cpy(str1); + + StackString str2("string stack2", stack2); + StackString str2Cpy(str2); + + str1.swap(str2); + + CPPUNIT_ASSERT( str1.get_allocator().swaped() ); + CPPUNIT_ASSERT( str2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( str1 == str2Cpy ); + CPPUNIT_ASSERT( str2 == str1Cpy ); + CPPUNIT_ASSERT( str1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( str2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); + + { + StackString str1("longer string from stack1 allocator instance for dynamic allocation", stack1); + StackString str1Cpy(str1); + + StackString str2("longer string from stack2 allocator instance for dynamic allocation", stack2); + StackString str2Cpy(str2); + + str1.swap(str2); + + CPPUNIT_ASSERT( str1.get_allocator().swaped() ); + CPPUNIT_ASSERT( str2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( str1 == str2Cpy ); + CPPUNIT_ASSERT( str2 == str1Cpy ); + CPPUNIT_ASSERT( str1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( str2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); + + + { + StackString str1("string stack1", stack1); + StackString str1Cpy(str1); + + StackString str2("longer string from stack2 allocator instance for dynamic allocation", stack2); + StackString str2Cpy(str2); + + str1.swap(str2); + + CPPUNIT_ASSERT( str1.get_allocator().swaped() ); + CPPUNIT_ASSERT( str2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( str1 == str2Cpy ); + CPPUNIT_ASSERT( str2 == str1Cpy ); + CPPUNIT_ASSERT( str1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( str2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); + + + { + StackString str1("longer string from stack1 allocator instance for dynamic allocation", stack1); + StackString str1Cpy(str1); + + StackString str2("string stack2", stack2); + StackString str2Cpy(str2); + + str1.swap(str2); + + CPPUNIT_ASSERT( str1.get_allocator().swaped() ); + CPPUNIT_ASSERT( str2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( str1 == str2Cpy ); + CPPUNIT_ASSERT( str2 == str1Cpy ); + CPPUNIT_ASSERT( str1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( str2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + stack1.reset(); stack2.reset(); +#endif +} + +void StringTest::capacity() +{ + string s; + + CPPUNIT_CHECK( s.capacity() > 0 ); + CPPUNIT_CHECK( s.capacity() < s.max_size() ); + CPPUNIT_CHECK( s.capacity() >= s.size() ); + +#ifndef _STLP_SHORT_STRING_SZ +# define _STLP_SHORT_STRING_SZ 16 // see stlport/stl/_string_base.h +#endif + + for ( int i = 0; i < _STLP_SHORT_STRING_SZ + 2; ++i ) { + s += ' '; + CPPUNIT_CHECK( s.capacity() > 0 ); + CPPUNIT_CHECK( s.capacity() < s.max_size() ); + CPPUNIT_CHECK( s.capacity() >= s.size() ); + } +} + +void StringTest::concat24() +{ + string s = string( "123456789012345678901234" ) + string( "123456789012345678901234" ); + + CPPUNIT_CHECK( s.length() == 48 ); + CPPUNIT_CHECK( s[23] == '4' ); + CPPUNIT_CHECK( s[24] == '1' ); + CPPUNIT_CHECK( s[47] == '4' ); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/strstream_buffer_read_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/strstream_buffer_read_test.cpp new file mode 100644 index 00000000000..978ac0c8572 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/strstream_buffer_read_test.cpp @@ -0,0 +1,35 @@ +/* + * Note: Strstreams are really broken in STLport. But strstreams are + * obsolete, and even if ones was mentioned in D7.1--D7.4 of + * Standard, we have no wish to spent time with repair ones. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include + +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +class StrstreamBufferTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(StrstreamBufferTest); + CPPUNIT_TEST(read_from_buffer); + CPPUNIT_TEST_SUITE_END(); + +protected: + void read_from_buffer(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamBufferTest); + +void StrstreamBufferTest::read_from_buffer() +{ + char hello[] = "Hello"; + strstream stream(hello, sizeof(hello), ios_base::in); + char cur; + stream >> cur; + CPPUNIT_ASSERT(cur == 'H'); +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/strstream_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/strstream_header_test.cpp new file mode 100644 index 00000000000..3d7504a94fb --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/strstream_header_test.cpp @@ -0,0 +1,10 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#if !defined (_STLP_NO_IOSTREAMS) +# include +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/strstream_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/strstream_test.cpp new file mode 100644 index 00000000000..195570ccfb3 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/strstream_test.cpp @@ -0,0 +1,49 @@ +#include + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include + +# include "cppunit/cppunit_proxy.h" + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +// +// TestCase class +// +class StrstreamTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(StrstreamTest); + CPPUNIT_TEST(input); + CPPUNIT_TEST_SUITE_END(); + +private: + void input(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamTest); + +// +// tests implementation +// +void StrstreamTest::input() +{ +# if defined (STLPORT) && defined (_STLP_LONG_LONG) + { + istrstream is("652208307"); + _STLP_LONG_LONG rval = 0; + is >> rval; + CPPUNIT_ASSERT( rval == 652208307 ); + } + { + istrstream is("-652208307"); + _STLP_LONG_LONG rval = 0; + is >> rval; + CPPUNIT_ASSERT( rval == -652208307 ); + } +} +# endif + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/swap_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/swap_test.cpp new file mode 100644 index 00000000000..056cabf7d10 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/swap_test.cpp @@ -0,0 +1,165 @@ +#include +#include +#include +#include + +#if 0 /* temporary: investigation of problem with swap */ +#include +#include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class SwapTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(SwapTest); + CPPUNIT_TEST(swap1); + CPPUNIT_TEST(swprnge1); + CPPUNIT_TEST(swap_container_non_spec); +#if defined (STLPORT) && \ + !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(swap_container_spec); + CPPUNIT_TEST_SUITE_END(); + +protected: + void swap1(); + void swprnge1(); + void swap_container_non_spec(); + void swap_container_spec(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(SwapTest); + +// +// tests implementation +// +void SwapTest::swap1() +{ + int a = 42; + int b = 19; + swap(a, b); + + CPPUNIT_ASSERT(a==19); + CPPUNIT_ASSERT(b==42); +} + +void SwapTest::swprnge1() +{ + char word1[] = "World"; + char word2[] = "Hello"; + swap_ranges((char*)word1, (char*)word1 + ::strlen(word1), (char*)word2); + CPPUNIT_ASSERT(!strcmp(word1, "Hello")); + CPPUNIT_ASSERT(!strcmp(word2, "World")); +} + +class Obj +{ + public: + Obj() : + v( 0 ) + { } + Obj( const Obj& ) : + v( 1 ) + { } + + Obj& operator =( const Obj& ) + { v = 2; return *this; } + + int v; +}; + +/* + * Following two tests check the corectness of specialization of swap(): + * for containers with container::swap method swap( a, b ) should + * use a.swap( b ), but don't try to do this substitution for container + * without swap method (in this case swap should be made via explicit members + * exchange; this assume usage of temporary object) + * + */ +void SwapTest::swap_container_non_spec() +{ + queue v1; + queue v2; + + v1.push( Obj() ); + v1.back().v = -1; + v1.push( Obj() ); + v1.back().v = -2; + + v2.push( Obj() ); + v2.back().v = 10; + v2.push( Obj() ); + v2.back().v = 11; + v2.push( Obj() ); + v2.back().v = 12; + + CPPUNIT_CHECK( v1.size() == 2 ); + CPPUNIT_CHECK( v2.size() == 3 ); + + swap( v1, v2 ); // this shouldn't try make it as v1.swap( v2 ), no queue::swap method! + + CPPUNIT_CHECK( v1.size() == 3 ); + CPPUNIT_CHECK( v2.size() == 2 ); + + // either copy constructor or assignment operator + CPPUNIT_CHECK( v1.front().v == 1 || v1.front().v == 2 ); + CPPUNIT_CHECK( v1.back().v == 1 || v1.back().v == 2 ); + CPPUNIT_CHECK( v2.front().v == 1 || v2.front().v == 2 ); + CPPUNIT_CHECK( v2.back().v == 1 || v2.back().v == 2 ); +} + +void SwapTest::swap_container_spec() +{ +#if 0 /* temporary: investigation of problem with swap */ + if ( typeid(/* _STLP_PRIV */ _SwapImplemented >::_Ret) == typeid(_STLP_PRIV __false_type) ) { + cerr << "false type" << endl; + } else if ( typeid(/* _STLP_PRIV */ _SwapImplemented >::_Ret) == typeid(_STLP_PRIV __true_type) ) { + cerr << "true type" << endl; + } else { + cerr << "unknown type" << endl; + } +#endif /* end of temporary */ +#if !defined (STLPORT) || \ + defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + vector v1; + vector v2; + + v1.push_back( Obj() ); + v1.push_back( Obj() ); + + v1[0].v = -1; + v1[1].v = -2; + + v2.push_back( Obj() ); + v2.push_back( Obj() ); + v2.push_back( Obj() ); + + v2[0].v = 10; + v2[1].v = 11; + v2[2].v = 12; + + CPPUNIT_CHECK( v1.size() == 2 ); + CPPUNIT_CHECK( v2.size() == 3 ); + + swap( v1, v2 ); // this should has effect v1.swap( v2 ) + + CPPUNIT_CHECK( v1.size() == 3 ); + CPPUNIT_CHECK( v2.size() == 2 ); + + CPPUNIT_CHECK( v1[0].v == 10 ); + CPPUNIT_CHECK( v1[1].v == 11 ); + CPPUNIT_CHECK( v1[2].v == 12 ); + + CPPUNIT_CHECK( v2[0].v == -1 ); + CPPUNIT_CHECK( v2[1].v == -2 ); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/test_errno.cpp b/reactos/lib/3rdparty/stlport/test/unit/test_errno.cpp new file mode 100644 index 00000000000..ad77d3ae017 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/test_errno.cpp @@ -0,0 +1,56 @@ +//We are including stdlib.h and stddef.h first because under MSVC +//those headers contains a errno macro definition without the underlying value +//definition. +#include +#include + +#include +#include // not typo, check errno def/undef/redef + +#ifndef _STLP_WCE + +#include "cppunit/cppunit_proxy.h" + +// +// TestCase class +// +class ErrnoTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ErrnoTest); + CPPUNIT_TEST(check); + CPPUNIT_TEST_SUITE_END(); + +protected: + void check(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ErrnoTest); + +void ErrnoTest::check() +{ + //We are using ERANGE as it is part of the C++ ISO (see Table 26 in section 19.3) + //Using ERANGE improve the test as it means that the native errno.h file has really + //been included. + errno = ERANGE; + + CPPUNIT_ASSERT( errno == ERANGE ); + errno = 0; + +/* Note: in common, you can't write ::errno or std::errno, + * due to errno in most cases is just a macro, that frequently + * (in MT environment errno is a per-thread value) expand to something like + * (*__errno_location()). I don't know way how masquerade such + * things: name of macro can't include ::. + * + * - ptr, 2005-03-30 + */ +# if 0 + if ( ::errno != 0 ) { + return 1; + } + if ( std::errno != 0 ) { + return 1; + } +# endif +} +#endif // _STLP_WCE diff --git a/reactos/lib/3rdparty/stlport/test/unit/time_facets_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/time_facets_test.cpp new file mode 100644 index 00000000000..19a7a3ad95b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/time_facets_test.cpp @@ -0,0 +1,402 @@ +#include "locale_test.h" + +#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) +# include +# include +# include +# include + +# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# endif + +static const char* tested_locales[] = { +// name, +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + "fr_FR", + "ru_RU.koi8r", + "en_GB", + "en_US", +# endif + "", + "C" +}; + +void LocaleTest::_time_put_get( const locale& loc ) +{ + { + typedef time_put > > time_put_facet; + CPPUNIT_ASSERT( has_facet(loc) ); + const time_put_facet& tmp = use_facet(loc); + + struct tm xmas = { 0, 0, 12, 25, 11, 93 }; + ostringstream ostr; + ostr.imbue(loc); + string format = "%B %d %Y"; + + time_put_facet::iter_type ret = tmp.put(ostr, ostr, ' ', &xmas, format.data(), format.data() + format.size()); + CPPUNIT_ASSERT( !ret.failed() ); + + /* + * In other words, user conformation is required for reliable parsing + * of user-entered dates and times, but machine-generated formats can be + * parsed reliably. This allows parsers to be aggressive about interpreting + * user variations on standard format. + * + * ISO/IEC 14882, 22.2.5.1 + */ + typedef time_get > > time_get_facet; + CPPUNIT_ASSERT( has_facet(loc) ); + const time_get_facet& tmg = use_facet(loc); + basic_ios io(0); + io.imbue(loc); + + istringstream istr( ostr.str() ); + istreambuf_iterator > i( istr ); + istreambuf_iterator > e; + ios_base::iostate err = ios_base::goodbit; + struct tm other = { 15, 20, 9, 14, 7, 105 }; + + i = tmg.get_monthname( i, e, io, err, &other ); + CPPUNIT_ASSERT( err == ios_base::goodbit ); + CPPUNIT_ASSERT( other.tm_mon == xmas.tm_mon ); + + ++i; ++i; ++i; ++i; // skip day of month and spaces around it + i = tmg.get_year( i, e, io, err, &other ); + + CPPUNIT_ASSERT( err == ios_base::eofbit ); + CPPUNIT_ASSERT( other.tm_year == xmas.tm_year ); + + ostringstream ostrX; + ostrX.imbue(loc); + format = "%x %X"; + + ret = tmp.put(ostrX, ostrX, ' ', &xmas, format.data(), format.data() + format.size()); + CPPUNIT_ASSERT( !ret.failed() ); + + istringstream istrX( ostrX.str() ); + istreambuf_iterator > j( istrX ); + + err = ios_base::goodbit; + + struct tm yet_more = { 15, 20, 9, 14, 7, 105 }; + + j = tmg.get_date( j, e, io, err, &yet_more ); + + CPPUNIT_ASSERT( err == ios_base::goodbit ); + + CPPUNIT_ASSERT( yet_more.tm_sec != xmas.tm_sec ); + CPPUNIT_ASSERT( yet_more.tm_min != xmas.tm_min ); + CPPUNIT_ASSERT( yet_more.tm_hour != xmas.tm_hour ); + CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday ); + CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon ); + CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year ); + + ++j; // skip space + + j = tmg.get_time( j, e, io, err, &yet_more ); + + CPPUNIT_ASSERT( err == ios_base::eofbit || err == ios_base::goodbit ); + + CPPUNIT_ASSERT( yet_more.tm_sec == xmas.tm_sec ); + CPPUNIT_ASSERT( yet_more.tm_min == xmas.tm_min ); + CPPUNIT_ASSERT( yet_more.tm_hour == xmas.tm_hour ); + CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday ); + CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon ); + CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year ); + } +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + { + typedef time_put > > time_put_facet; + CPPUNIT_ASSERT( has_facet(loc) ); + const time_put_facet& tmp = use_facet(loc); + + struct tm xmas = { 0, 0, 12, 25, 11, 93 }; + wostringstream ostr; + ostr.imbue(loc); + wstring format = L"%B %d %Y"; + + time_put_facet::iter_type ret = tmp.put(ostr, ostr, ' ', &xmas, format.data(), format.data() + format.size()); + CPPUNIT_ASSERT( !ret.failed() ); + + /* + * In other words, user conformation is required for reliable parsing + * of user-entered dates and times, but machine-generated formats can be + * parsed reliably. This allows parsers to be aggressive about interpreting + * user variations on standard format. + * + * ISO/IEC 14882, 22.2.5.1 + */ + typedef time_get > > time_get_facet; + CPPUNIT_ASSERT( has_facet(loc) ); + const time_get_facet& tmg = use_facet(loc); + // Intentional instantiation with char to show a bug in a previous STLport version. + basic_ios io(0); + io.imbue(loc); + + wistringstream istr( ostr.str() ); + istreambuf_iterator > i( istr ); + istreambuf_iterator > e; + ios_base::iostate err = ios_base::goodbit; + struct tm other = { 15, 20, 9, 14, 7, 105 }; + + i = tmg.get_monthname( i, e, io, err, &other ); + CPPUNIT_ASSERT( err == ios_base::goodbit ); + CPPUNIT_ASSERT( other.tm_mon == xmas.tm_mon ); + + ++i; ++i; ++i; ++i; // skip day of month and spaces around it + i = tmg.get_year( i, e, io, err, &other ); + + CPPUNIT_ASSERT( err == ios_base::eofbit ); + CPPUNIT_ASSERT( other.tm_year == xmas.tm_year ); + + wostringstream ostrX; + ostrX.imbue(loc); + format = L"%x %X"; + + ret = tmp.put(ostrX, ostrX, ' ', &xmas, format.data(), format.data() + format.size()); + CPPUNIT_ASSERT( !ret.failed() ); + + wistringstream istrX( ostrX.str() ); + istreambuf_iterator > j( istrX ); + + err = ios_base::goodbit; + + struct tm yet_more = { 15, 20, 9, 14, 7, 105 }; + + j = tmg.get_date( j, e, io, err, &yet_more ); + + CPPUNIT_ASSERT( err == ios_base::goodbit ); + + CPPUNIT_ASSERT( yet_more.tm_sec != xmas.tm_sec ); + CPPUNIT_ASSERT( yet_more.tm_min != xmas.tm_min ); + CPPUNIT_ASSERT( yet_more.tm_hour != xmas.tm_hour ); + CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday ); + CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon ); + CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year ); + + ++j; // skip space + + j = tmg.get_time( j, e, io, err, &yet_more ); + + CPPUNIT_ASSERT( err == ios_base::eofbit || err == ios_base::goodbit ); + + CPPUNIT_ASSERT( yet_more.tm_sec == xmas.tm_sec ); + CPPUNIT_ASSERT( yet_more.tm_min == xmas.tm_min ); + CPPUNIT_ASSERT( yet_more.tm_hour == xmas.tm_hour ); + CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday ); + CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon ); + CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year ); + } +# endif +} + +typedef void (LocaleTest::*_Test) (const locale&); +static void test_supported_locale(LocaleTest& inst, _Test __test) { + size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]); + for (size_t i = 0; i < n; ++i) { + locale loc; +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try +# endif + { + locale tmp(tested_locales[i]); + loc = tmp; + } +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + catch (runtime_error const&) { + //This locale is not supported. + continue; + } +# endif + CPPUNIT_MESSAGE( loc.name().c_str() ); + (inst.*__test)(loc); + + { + locale tmp(locale::classic(), tested_locales[i], locale::time); + loc = tmp; + } + (inst.*__test)(loc); + + { + typedef time_put_byname > > time_put_facet; + locale tmp0(locale::classic(), new time_put_facet(tested_locales[i])); + typedef time_get_byname > > time_get_facet; + locale tmp1(tmp0, new time_get_facet(tested_locales[i])); + loc = tmp1; + } + (inst.*__test)(loc); + } +} + +void LocaleTest::time_put_get() +{ test_supported_locale(*this, &LocaleTest::_time_put_get); } + +void LocaleTest::time_by_name() +{ +# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + /* + * Check of the 22.1.1.2.7 standard point. Construction of a locale + * instance from a null pointer or an unknown name should result in + * a runtime_error exception. + */ +# if defined (STLPORT) || !defined (_MSC_VER) || (_MSC_VER > 1400) + try { + locale loc(locale::classic(), new time_put_byname > >(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +# endif + + try { + locale loc(locale::classic(), new time_put_byname > >("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string veryLongFacetName("LC_TIME="); + veryLongFacetName.append(512, '?'); + locale loc(locale::classic(), new time_put_byname > >(veryLongFacetName.c_str())); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new time_get_byname > >(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new time_get_byname > >("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + string veryLongFacetName("LC_TIME="); + veryLongFacetName.append(512, '?'); + locale loc(locale::classic(), new time_get_byname > >(veryLongFacetName.c_str())); + CPPUNIT_FAIL; + } + catch (runtime_error const& /* e */) { + //CPPUNIT_MESSAGE( e.what() ); + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), "C", locale::time); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" facet. + locale loc(locale::classic(), "", locale::time); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new time_get_byname > >("C")); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + // On platform without real localization support we should rely on the "C" locale facet. + locale loc(locale::classic(), new time_get_byname > >("")); + } + catch (runtime_error const& /* e */) { + /* CPPUNIT_MESSAGE( e.what() ); */ + CPPUNIT_FAIL; + } + catch (...) { + CPPUNIT_FAIL; + } + +# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) + try { + locale loc(locale::classic(), new time_put_byname > >(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new time_put_byname > >("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new time_get_byname > >(static_cast(0))); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + + try { + locale loc(locale::classic(), new time_get_byname > >("yasli_language")); + CPPUNIT_FAIL; + } + catch (runtime_error const&) { + } + catch (...) { + CPPUNIT_FAIL; + } + +# endif +# endif +} + +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/time_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/time_header_test.c new file mode 100644 index 00000000000..dbfe64bd526 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/time_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/times_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/times_test.cpp new file mode 100644 index 00000000000..aa13925af75 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/times_test.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class TimesTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(TimesTest); + CPPUNIT_TEST(times); + CPPUNIT_TEST_SUITE_END(); + +protected: + void times(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(TimesTest); + +// +// tests implementation +// +void TimesTest::times() +{ + int input [4] = { 1, 5, 7, 2 }; + int total = accumulate(input, input + 4, 1, multiplies()); + CPPUNIT_ASSERT(total==70); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/transform_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/transform_test.cpp new file mode 100644 index 00000000000..81649e1fa46 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/transform_test.cpp @@ -0,0 +1,80 @@ +#include +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class TransformTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(TransformTest); + CPPUNIT_TEST(trnsfrm1); + CPPUNIT_TEST(trnsfrm2); + CPPUNIT_TEST(self_str); + CPPUNIT_TEST_SUITE_END(); + +protected: + void trnsfrm1(); + void trnsfrm2(); + void self_str(); + + static int negate_int(int a_) { + return -a_; + } + static char map_char(char a_, int b_) { + return char(a_ + b_); + } + static char shift( char c ) { + return char(((int)c + 1) % 256); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(TransformTest); + +// +// tests implementation +// +void TransformTest::trnsfrm1() +{ + int numbers[6] = { -5, -1, 0, 1, 6, 11 }; + + int result[6]; + transform((int*)numbers, (int*)numbers + 6, (int*)result, negate_int); + + CPPUNIT_ASSERT(result[0]==5); + CPPUNIT_ASSERT(result[1]==1); + CPPUNIT_ASSERT(result[2]==0); + CPPUNIT_ASSERT(result[3]==-1); + CPPUNIT_ASSERT(result[4]==-6); + CPPUNIT_ASSERT(result[5]==-11); +} +void TransformTest::trnsfrm2() +{ +#if defined (__MVS__) + int trans[] = {-11, 4, -6, -6, -18, 0, 18, -14, 6, 0, -1, -59}; +#else + int trans[] = {-4, 4, -6, -6, -10, 0, 10, -6, 6, 0, -1, -77}; +#endif + char n[] = "Larry Mullen"; + const size_t count = ::strlen(n); + + string res; + transform(n, n + count, trans, back_inserter(res), map_char); + CPPUNIT_ASSERT( res == "Hello World!" ) +} + +void TransformTest::self_str() +{ + string s( "0123456789abcdefg" ); + string r( "123456789:bcdefgh" ); + transform( s.begin(), s.end(), s.begin(), shift ); + CPPUNIT_ASSERT( s == r ); +} + diff --git a/reactos/lib/3rdparty/stlport/test/unit/type_traits_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/type_traits_test.cpp new file mode 100644 index 00000000000..d8814512780 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/type_traits_test.cpp @@ -0,0 +1,593 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if defined (_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class TypeTraitsTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(TypeTraitsTest); +#if !defined (STLPORT) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(manips); + CPPUNIT_TEST(integer); + CPPUNIT_TEST(rational); + CPPUNIT_TEST(pointer_type); +#if defined (STLPORT) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(reference_type); +#if defined (STLPORT) + CPPUNIT_STOP_IGNORE; +#endif + CPPUNIT_TEST(both_pointer_type); + CPPUNIT_TEST(ok_to_use_memcpy); + CPPUNIT_TEST(ok_to_use_memmove); + CPPUNIT_TEST(trivial_destructor); + CPPUNIT_TEST(is_POD); + CPPUNIT_TEST(stlport_class); + CPPUNIT_TEST_SUITE_END(); + +protected: + void manips(); + void integer(); + void rational(); + void pointer_type(); + void reference_type(); + void both_pointer_type(); + void ok_to_use_memcpy(); + void ok_to_use_memmove(); + void trivial_destructor(); + void is_POD(); + void stlport_class(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(TypeTraitsTest); + +#if defined (STLPORT) + +# if defined (__GNUC__) && defined (_STLP_USE_NAMESPACES) +// libstdc++ sometimes exposed its own __true_type type in global +// namespace resulting in an ambiguity. +# define __true_type std::__true_type +# define __false_type std::__false_type +# endif + +int type_to_value(__true_type) +{ return 1; } +int type_to_value(__false_type) +{ return 0; } + +int* int_pointer; +int const* int_const_pointer; +int volatile* int_volatile_pointer; +int const volatile* int_const_volatile_pointer; +int int_val = 0; +int const int_const_val = 0; +int volatile int_volatile_val = 0; +int & int_ref = int_val; +int const& int_const_ref = int_val; +int const volatile& int_const_volatile_ref = int_val; + +//A type that represent any type: +struct any_type +{ + //Dummy operations to forbid to compilers with intrinsic + //type traits support to consider this type as a POD. + any_type() : m_data(1) {} + any_type(const any_type&) : m_data(2) {} + any_type& operator = (const any_type&) + { m_data = 3; return *this; } + ~any_type() { m_data = 0; } + + size_t m_data; +}; + +any_type any; +any_type* any_pointer; +any_type const* any_const_pointer; +any_type volatile* any_volatile_pointer; +any_type const volatile* any_const_volatile_pointer; + +//A type that represent any pod type +struct any_pod_type +{}; + +# if defined (_STLP_USE_BOOST_SUPPORT) +//Mandatory for compilers without without partial template specialization. +BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(any_pod_type) +# endif + +any_pod_type any_pod; +any_pod_type* any_pod_pointer; +any_pod_type const* any_pod_const_pointer; +any_pod_type volatile* any_pod_volatile_pointer; +any_pod_type const volatile* any_pod_const_volatile_pointer; + +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __type_traits { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif + +struct base +{}; +struct derived : public base +{}; + +// +// tests implementation +// +template +int is_convertible(_Src, _Dst) { +# if !defined(__BORLANDC__) + typedef typename _IsConvertible<_Src, _Dst>::_Ret _Ret; +# else + enum { _Is = _IsConvertible<_Src, _Dst>::value }; + typedef typename __bool2type<_Is>::_Ret _Ret; +# endif + return type_to_value(_Ret()); +} + +template +int is_cv_convertible(_Src, _Dst) { +# if !defined(__BORLANDC__) + typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; +# else + enum { _Is = _IsCVConvertible<_Src, _Dst>::value }; + typedef typename __bool2type<_Is>::_Ret _Ret; +# endif + return type_to_value(_Ret()); +} +#endif + +void TypeTraitsTest::manips() +{ +#if defined (STLPORT) + { + typedef __bool2type<0>::_Ret _ZeroRet; + CPPUNIT_ASSERT( type_to_value(_ZeroRet()) == 0 ); + typedef __bool2type<1>::_Ret _OneRet; + CPPUNIT_ASSERT( type_to_value(_OneRet()) == 1 ); + typedef __bool2type<65456873>::_Ret _AnyRet; + CPPUNIT_ASSERT( type_to_value(_AnyRet()) == 1 ); + } + + { + CPPUNIT_ASSERT( __type2bool<__true_type>::_Ret == 1 ); + CPPUNIT_ASSERT( __type2bool<__false_type>::_Ret == 0 ); + CPPUNIT_ASSERT( __type2bool::_Ret == 1 ); + } + + { + typedef _Not<__true_type>::_Ret _NotTrueRet; + CPPUNIT_ASSERT( type_to_value(_NotTrueRet()) == 0 ); + typedef _Not<__false_type>::_Ret _NotFalseRet; + CPPUNIT_ASSERT( type_to_value(_NotFalseRet()) == 1 ); + } + + { + typedef _Land2<__true_type, __true_type>::_Ret _TrueTrueRet; + CPPUNIT_ASSERT( type_to_value(_TrueTrueRet()) == 1 ); + typedef _Land2<__true_type, __false_type>::_Ret _TrueFalseRet; + CPPUNIT_ASSERT( type_to_value(_TrueFalseRet()) == 0 ); + typedef _Land2<__false_type, __true_type>::_Ret _FalseTrueRet; + CPPUNIT_ASSERT( type_to_value(_FalseTrueRet()) == 0 ); + typedef _Land2<__false_type, __false_type>::_Ret _FalseFalseRet; + CPPUNIT_ASSERT( type_to_value(_FalseFalseRet()) == 0 ); + } + + { + typedef _Land3<__true_type, __true_type, __true_type>::_Ret _TrueTrueTrueRet; + CPPUNIT_ASSERT( type_to_value(_TrueTrueTrueRet()) == 1 ); + typedef _Land3<__true_type, __true_type, __false_type>::_Ret _TrueTrueFalseRet; + CPPUNIT_ASSERT( type_to_value(_TrueTrueFalseRet()) == 0 ); + typedef _Land3<__true_type, __false_type, __true_type>::_Ret _TrueFalseTrueRet; + CPPUNIT_ASSERT( type_to_value(_TrueFalseTrueRet()) == 0 ); + typedef _Land3<__true_type, __false_type, __false_type>::_Ret _TrueFalseFalseRet; + CPPUNIT_ASSERT( type_to_value(_TrueFalseFalseRet()) == 0 ); + typedef _Land3<__false_type, __true_type, __true_type>::_Ret _FalseTrueTrueRet; + CPPUNIT_ASSERT( type_to_value(_FalseTrueTrueRet()) == 0 ); + typedef _Land3<__false_type, __true_type, __false_type>::_Ret _FalseTrueFalseRet; + CPPUNIT_ASSERT( type_to_value(_FalseTrueFalseRet()) == 0 ); + typedef _Land3<__false_type, __false_type, __true_type>::_Ret _FalseFalseTrueRet; + CPPUNIT_ASSERT( type_to_value(_FalseFalseTrueRet()) == 0 ); + typedef _Land3<__false_type, __false_type, __false_type>::_Ret _FalseFalseFalseRet; + CPPUNIT_ASSERT( type_to_value(_FalseFalseFalseRet()) == 0 ); + } + + { + typedef _Lor2<__true_type, __true_type>::_Ret _TrueTrueRet; + CPPUNIT_ASSERT( type_to_value(_TrueTrueRet()) == 1 ); + typedef _Lor2<__true_type, __false_type>::_Ret _TrueFalseRet; + CPPUNIT_ASSERT( type_to_value(_TrueFalseRet()) == 1 ); + typedef _Lor2<__false_type, __true_type>::_Ret _FalseTrueRet; + CPPUNIT_ASSERT( type_to_value(_FalseTrueRet()) == 1 ); + typedef _Lor2<__false_type, __false_type>::_Ret _FalseFalseRet; + CPPUNIT_ASSERT( type_to_value(_FalseFalseRet()) == 0 ); + } + + { + typedef _Lor3<__true_type, __true_type, __true_type>::_Ret _TrueTrueTrueRet; + CPPUNIT_ASSERT( type_to_value(_TrueTrueTrueRet()) == 1 ); + typedef _Lor3<__true_type, __true_type, __false_type>::_Ret _TrueTrueFalseRet; + CPPUNIT_ASSERT( type_to_value(_TrueTrueFalseRet()) == 1 ); + typedef _Lor3<__true_type, __false_type, __true_type>::_Ret _TrueFalseTrueRet; + CPPUNIT_ASSERT( type_to_value(_TrueFalseTrueRet()) == 1 ); + typedef _Lor3<__true_type, __false_type, __false_type>::_Ret _TrueFalseFalseRet; + CPPUNIT_ASSERT( type_to_value(_TrueFalseFalseRet()) == 1 ); + typedef _Lor3<__false_type, __true_type, __true_type>::_Ret _FalseTrueTrueRet; + CPPUNIT_ASSERT( type_to_value(_FalseTrueTrueRet()) == 1 ); + typedef _Lor3<__false_type, __true_type, __false_type>::_Ret _FalseTrueFalseRet; + CPPUNIT_ASSERT( type_to_value(_FalseTrueFalseRet()) == 1 ); + typedef _Lor3<__false_type, __false_type, __true_type>::_Ret _FalseFalseTrueRet; + CPPUNIT_ASSERT( type_to_value(_FalseFalseTrueRet()) == 1 ); + typedef _Lor3<__false_type, __false_type, __false_type>::_Ret _FalseFalseFalseRet; + CPPUNIT_ASSERT( type_to_value(_FalseFalseFalseRet()) == 0 ); + } + + { + typedef __select<1, __true_type, __false_type>::_Ret _SelectFirstRet; + CPPUNIT_ASSERT( type_to_value(_SelectFirstRet()) == 1 ); + typedef __select<0, __true_type, __false_type>::_Ret _SelectSecondRet; + CPPUNIT_ASSERT( type_to_value(_SelectSecondRet()) == 0 ); +# if defined (__BORLANDC__) + typedef __selectT<__true_type, __true_type, __false_type>::_Ret _SelectFirstRet; + CPPUNIT_ASSERT( type_to_value(_SelectFirstRet()) == 1 ); + typedef __selectT<__false_type, __true_type, __false_type>::_Ret _SelectSecondRet; + CPPUNIT_ASSERT( type_to_value(_SelectSecondRet()) == 0 ); +# endif + } + + { + base b; + derived d; + const derived cd = d; + base *pb = &b; + derived *pd = &d; + derived const *pcd = pd; + CPPUNIT_CHECK( is_convertible(any, b) == 0 ); + CPPUNIT_CHECK( is_convertible(d, b) == 1 ); + CPPUNIT_CHECK( is_convertible(cd, b) == 1 ); + // _IsCVConvertible only needs to work for pointer type: + //CPPUNIT_CHECK( is_cv_convertible(d, b) == 1 ); + //CPPUNIT_CHECK( is_cv_convertible(cd, b) == 0 ); + + //_IsConvertible do not need to work for pointers: + //CPPUNIT_CHECK( is_convertible(pd, pb) == 1 ); + //CPPUNIT_CHECK( is_convertible(pcd, pb) == 1 ); + + CPPUNIT_CHECK( is_cv_convertible(pd, pb) == 1 ); + CPPUNIT_CHECK( is_cv_convertible(pcd, pb) == 0 ); + } +#endif +} + +#if defined (STLPORT) +template +int is_integer(_Type) { + typedef typename _IsIntegral<_Type>::_Ret _Ret; + return type_to_value(_Ret()); +} +#endif + +void TypeTraitsTest::integer() +{ +#if defined (STLPORT) + CPPUNIT_ASSERT( is_integer(bool()) == 1 ); + CPPUNIT_ASSERT( is_integer(char()) == 1 ); + typedef signed char signed_char; + CPPUNIT_ASSERT( is_integer(signed_char()) == 1 ); + typedef unsigned char unsigned_char; + CPPUNIT_ASSERT( is_integer(unsigned_char()) == 1 ); +# if defined (_STLP_HAS_WCHAR_T) + CPPUNIT_ASSERT( is_integer(wchar_t()) == 1 ); +# endif + CPPUNIT_ASSERT( is_integer(short()) == 1 ); + typedef unsigned short unsigned_short; + CPPUNIT_ASSERT( is_integer(unsigned_short()) == 1 ); + CPPUNIT_ASSERT( is_integer(int()) == 1 ); + typedef unsigned int unsigned_int; + CPPUNIT_ASSERT( is_integer(unsigned_int()) == 1 ); + CPPUNIT_ASSERT( is_integer(long()) == 1 ); + typedef unsigned long unsigned_long; + CPPUNIT_ASSERT( is_integer(unsigned_long()) == 1 ); +# if defined (_STLP_LONG_LONG) + typedef _STLP_LONG_LONG long_long; + CPPUNIT_ASSERT( is_integer(long_long()) == 1 ); + typedef unsigned _STLP_LONG_LONG unsigned_long_long; + CPPUNIT_ASSERT( is_integer(unsigned_long_long()) == 1 ); +# endif + CPPUNIT_ASSERT( is_integer(float()) == 0 ); + CPPUNIT_ASSERT( is_integer(double()) == 0 ); +# if !defined ( _STLP_NO_LONG_DOUBLE ) + typedef long double long_double; + CPPUNIT_ASSERT( is_integer(long_double()) == 0 ); +# endif + CPPUNIT_ASSERT( is_integer(any) == 0 ); + CPPUNIT_ASSERT( is_integer(any_pointer) == 0 ); +#endif +} + +#if defined (STLPORT) +template +int is_rational(_Type) { + typedef typename _IsRational<_Type>::_Ret _Ret; + return type_to_value(_Ret()); +} +#endif + +void TypeTraitsTest::rational() +{ +#if defined (STLPORT) + CPPUNIT_ASSERT( is_rational(bool()) == 0 ); + CPPUNIT_ASSERT( is_rational(char()) == 0 ); + typedef signed char signed_char; + CPPUNIT_ASSERT( is_rational(signed_char()) == 0 ); + typedef unsigned char unsigned_char; + CPPUNIT_ASSERT( is_rational(unsigned_char()) == 0 ); +# if defined (_STLP_HAS_WCHAR_T) + CPPUNIT_ASSERT( is_rational(wchar_t()) == 0 ); +# endif + CPPUNIT_ASSERT( is_rational(short()) == 0 ); + typedef unsigned short unsigned_short; + CPPUNIT_ASSERT( is_rational(unsigned_short()) == 0 ); + CPPUNIT_ASSERT( is_rational(int()) == 0 ); + typedef unsigned int unsigned_int; + CPPUNIT_ASSERT( is_rational(unsigned_int()) == 0 ); + CPPUNIT_ASSERT( is_rational(long()) == 0 ); + typedef unsigned long unsigned_long; + CPPUNIT_ASSERT( is_rational(unsigned_long()) == 0 ); +# if defined (_STLP_LONG_LONG) + typedef _STLP_LONG_LONG long_long; + CPPUNIT_ASSERT( is_rational(long_long()) == 0 ); + typedef unsigned _STLP_LONG_LONG unsigned_long_long; + CPPUNIT_ASSERT( is_rational(unsigned_long_long()) == 0 ); +# endif + CPPUNIT_ASSERT( is_rational(float()) == 1 ); + CPPUNIT_ASSERT( is_rational(double()) == 1 ); +# if !defined ( _STLP_NO_LONG_DOUBLE ) + typedef long double long_double; + CPPUNIT_ASSERT( is_rational(long_double()) == 1 ); +# endif + CPPUNIT_ASSERT( is_rational(any) == 0 ); + CPPUNIT_ASSERT( is_rational(any_pointer) == 0 ); +#endif +} + +#if defined (STLPORT) +template +int is_pointer_type(_Type) { + return type_to_value(_IsPtrType<_Type>::_Ret()); +} +#endif + +void TypeTraitsTest::pointer_type() +{ +#if defined (STLPORT) + CPPUNIT_ASSERT( is_pointer_type(int_val) == 0 ); + CPPUNIT_ASSERT( is_pointer_type(int_pointer) == 1 ); + CPPUNIT_ASSERT( is_pointer_type(int_const_pointer) == 1 ); + CPPUNIT_ASSERT( is_pointer_type(int_volatile_pointer) == 1 ); + CPPUNIT_ASSERT( is_pointer_type(int_const_volatile_pointer) == 1 ); + CPPUNIT_ASSERT( is_pointer_type(int_ref) == 0 ); + CPPUNIT_ASSERT( is_pointer_type(int_const_ref) == 0 ); + CPPUNIT_ASSERT( is_pointer_type(any) == 0 ); + CPPUNIT_ASSERT( is_pointer_type(any_pointer) == 1 ); +#endif +} + +void TypeTraitsTest::reference_type() +{ +#if defined (STLPORT) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_ASSERT( type_to_value(_IsRefType::_Ret()) == 0 ); + CPPUNIT_ASSERT( type_to_value(_IsRefType::_Ret()) == 0 ); + CPPUNIT_ASSERT( type_to_value(_IsRefType::_Ret()) == 1 ); + CPPUNIT_ASSERT( type_to_value(_IsRefType::_Ret()) == 1 ); + CPPUNIT_ASSERT( type_to_value(_IsRefType::_Ret()) == 1 ); + + CPPUNIT_ASSERT( type_to_value(_IsOKToSwap(int_pointer, int_pointer, __true_type(), __true_type())._Answer()) == 1 ); + CPPUNIT_ASSERT( type_to_value(_IsOKToSwap(int_pointer, int_pointer, __false_type(), __false_type())._Answer()) == 0 ); +#endif +} + +#if defined (STLPORT) +template +int are_both_pointer_type (_Tp1, _Tp2) { + return type_to_value(_BothPtrType<_Tp1, _Tp2>::_Answer()); +} +#endif + +void TypeTraitsTest::both_pointer_type() +{ +#if defined (STLPORT) + CPPUNIT_CHECK( are_both_pointer_type(int_val, int_val) == 0 ); + CPPUNIT_CHECK( are_both_pointer_type(int_pointer, int_pointer) == 1 ); + CPPUNIT_CHECK( are_both_pointer_type(int_const_pointer, int_const_pointer) == 1 ); + CPPUNIT_CHECK( are_both_pointer_type(int_volatile_pointer, int_volatile_pointer) == 1 ); + CPPUNIT_CHECK( are_both_pointer_type(int_const_volatile_pointer, int_const_volatile_pointer) == 1 ); + CPPUNIT_CHECK( are_both_pointer_type(int_ref, int_ref) == 0 ); + CPPUNIT_CHECK( are_both_pointer_type(int_const_ref, int_const_ref) == 0 ); + CPPUNIT_CHECK( are_both_pointer_type(any, any) == 0 ); + CPPUNIT_CHECK( are_both_pointer_type(any_pointer, any_pointer) == 1 ); +#endif +} + +#if defined (STLPORT) +template +int is_ok_to_use_memcpy(_Tp1 val1, _Tp2 val2) { + return type_to_value(_UseTrivialCopy(val1, val2)._Answer()); +} +#endif + +void TypeTraitsTest::ok_to_use_memcpy() +{ +#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, int_pointer) == 1 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_pointer) == 1 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, int_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, int_const_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_const_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_const_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_volatile_pointer, int_const_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, any_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pointer, int_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pointer, any_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pointer, any_const_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pod_pointer, int_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pod_pointer, any_pod_pointer) == 1 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pod_pointer, any_pod_const_pointer) == 0 ); + vector **pvf = 0; + vector **pvi = 0; + CPPUNIT_CHECK( is_ok_to_use_memcpy(pvf, pvi) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memcpy(pvi, pvf) == 0 ); +#endif +} + +#if defined (STLPORT) +template +int is_ok_to_use_memmove(_Tp1 val1, _Tp2 val2) { + return type_to_value(_UseTrivialUCopy(val1, val2)._Answer()); +} +#endif + +void TypeTraitsTest::ok_to_use_memmove() +{ +#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) + CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, int_pointer) == 1 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_pointer) == 1 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, int_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, int_const_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_const_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_const_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_volatile_pointer, int_const_volatile_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, any_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(any_pointer, int_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(any_pointer, any_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(any_pointer, any_const_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(any_pod_pointer, int_pointer) == 0 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(any_pod_pointer, any_pod_pointer) == 1 ); + CPPUNIT_CHECK( is_ok_to_use_memmove(any_pod_pointer, any_pod_const_pointer) == 0 ); +#endif +} + +#if defined (STLPORT) +template +int has_trivial_destructor(_Tp) { + typedef typename __type_traits<_Tp>::has_trivial_destructor _TrivialDestructor; + return type_to_value(_TrivialDestructor()); +} + +struct DestructorMonitor +{ + ~DestructorMonitor() + { ++nb_destructor_call; } + + static size_t nb_destructor_call; +}; + +size_t DestructorMonitor::nb_destructor_call = 0; + +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __type_traits { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +void TypeTraitsTest::trivial_destructor() +{ +#if defined (STLPORT) + CPPUNIT_CHECK( has_trivial_destructor(int_pointer) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(int_const_pointer) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(int_volatile_pointer) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(int_const_volatile_pointer) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(any_pointer) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(any) == 0 ); + CPPUNIT_CHECK( has_trivial_destructor(any_pointer) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(any_pod) == 1 ); + CPPUNIT_CHECK( has_trivial_destructor(string()) == 0 ); + + //Check of the meta information impact in a container implementation + { + vector v(10); + DestructorMonitor::nb_destructor_call = 0; + } + CPPUNIT_CHECK( DestructorMonitor::nb_destructor_call == 0 ); +#endif +} + +#if defined (STLPORT) +template +int is_POD_type(_Tp) { + typedef typename __type_traits<_Tp>::is_POD_type _IsPODType; + return type_to_value(_IsPODType()); +} +#endif + +void TypeTraitsTest::is_POD() +{ +#if defined (STLPORT) + CPPUNIT_CHECK( is_POD_type(int_pointer) == 1 ); + CPPUNIT_CHECK( is_POD_type(int_const_pointer) == 1 ); + CPPUNIT_CHECK( is_POD_type(int_volatile_pointer) == 1 ); + CPPUNIT_CHECK( is_POD_type(int_const_volatile_pointer) == 1 ); + CPPUNIT_CHECK( is_POD_type(any_pointer) == 1 ); + CPPUNIT_CHECK( is_POD_type(any) == 0 ); + CPPUNIT_CHECK( is_POD_type(any_pointer) == 1 ); + CPPUNIT_CHECK( is_POD_type(any_pod) == 1 ); + CPPUNIT_CHECK( is_POD_type(string()) == 0 ); +#endif +} + +#if defined (STLPORT) +template +int is_stlport_class(_Tp) { + typedef _IsSTLportClass<_Tp> _STLportClass; +# if !defined (__BORLANDC__) + typedef typename _STLportClass::_Ret _Is; +# else + typedef typename __bool2type<_STLportClass::_Is>::_Ret _Is; +# endif + return type_to_value(_Is()); +} +#endif + +void TypeTraitsTest::stlport_class() +{ +#if defined (STLPORT) + CPPUNIT_CHECK( is_stlport_class(allocator()) == 1 ); +# if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + CPPUNIT_CHECK( is_stlport_class(string()) == 1 ); +# endif + CPPUNIT_CHECK( is_stlport_class(any) == 0 ); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/typeinfo_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/typeinfo_header_test.cpp new file mode 100644 index 00000000000..7e3f5eb330d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/typeinfo_header_test.cpp @@ -0,0 +1,20 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include + +#if 0 /* !defined (_STLP_NO_RTTI) && !defined (_STLP_NO_TYPEINFO) */ +/* SourceForge: STLport bug report 1721844 + * type_info is not a member of stlp_std + */ +class A {}; + +void type_info_header_test() +{ + const std::type_info& ti = typeid(A); +} +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/unary.h b/reactos/lib/3rdparty/stlport/test/unit/unary.h new file mode 100644 index 00000000000..8c9ef4312e0 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/unary.h @@ -0,0 +1,23 @@ +#ifndef _unary_h +#define _unary_h +#include +#include +#include //*TY 12/26/1998 - added to get unary_function + +#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES) +using std::unary_function; +#endif + +struct odd : public unary_function { + bool operator()(int n_) const { return(n_ % 2) == 1; } +}; + +struct positive : public unary_function { + bool operator()(int n_) const { return n_ >= 0; } +}; + +struct square_root : public unary_function { + double operator()(double x_) const + { return ::sqrt(x_); } +}; +#endif // _unary_h diff --git a/reactos/lib/3rdparty/stlport/test/unit/unary_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/unary_test.cpp new file mode 100644 index 00000000000..ee480b742a4 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/unary_test.cpp @@ -0,0 +1,98 @@ +#include +#include "unary.h" +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class UnaryTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(UnaryTest); +#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(ucompos1); + CPPUNIT_TEST(ucompos2); + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(unegate1); + CPPUNIT_TEST(unegate2); +#if defined (STLPORT) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(unegate3); + CPPUNIT_TEST_SUITE_END(); + +protected: + void ucompos1(); + void ucompos2(); + void unegate1(); + void unegate2(); + void unegate3(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(UnaryTest); + +// +// tests implementation +// +void UnaryTest::unegate1() +{ + int array [3] = { 1, 2, 3 }; + //unary_negate::argument_type arg_val = 0; + int* p = find_if((int*)array, (int*)array + 3, unary_negate(odd())); + CPPUNIT_ASSERT((p != array + 3)); + CPPUNIT_ASSERT(*p==2); +} +void UnaryTest::unegate2() +{ + int array [3] = { 1, 2, 3 }; + int* p = find_if((int*)array, (int*)array + 3, not1(odd())); + CPPUNIT_ASSERT(p != array + 3); + CPPUNIT_ASSERT(*p==2); +} + +bool test_func(int param) { + return param < 3; +} +void UnaryTest::unegate3() +{ +#if !defined (STLPORT) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + int array [3] = { 1, 2, 3 }; + int* p = find_if((int*)array, (int*)array + 3, not1(ptr_fun(test_func))); + CPPUNIT_ASSERT(p != array + 3); + CPPUNIT_ASSERT(*p==3); +#endif +} + +void UnaryTest::ucompos1() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int input [3] = { -1, -4, -16 }; + + double output[3]; + transform((int*)input, (int*)input + 3, output, unary_compose >(square_root(), negate())); + + CPPUNIT_ASSERT(output[0]==1); + CPPUNIT_ASSERT(output[1]==2); + CPPUNIT_ASSERT(output[2]==4); +#endif +} +void UnaryTest::ucompos2() +{ +#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) + int input [3] = { -1, -4, -16 }; + + double output [3]; + transform((int*)input, (int*)input + 3, output, compose1(square_root(), negate())); + + CPPUNIT_ASSERT(output[0]==1); + CPPUNIT_ASSERT(output[1]==2); + CPPUNIT_ASSERT(output[2]==4); +#endif +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/uninitialized_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/uninitialized_test.cpp new file mode 100644 index 00000000000..37884f7580e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/uninitialized_test.cpp @@ -0,0 +1,245 @@ +#include +#include +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class UninitializedTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(UninitializedTest); + CPPUNIT_TEST(copy_test); + //CPPUNIT_TEST(fill_test); + //CPPUNIT_TEST(fill_n_test); + CPPUNIT_TEST_SUITE_END(); + +protected: + void copy_test(); + void fill_test(); + void fill_n_test(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(UninitializedTest); + +struct NotTrivialCopyStruct { + NotTrivialCopyStruct() : member(0) {} + NotTrivialCopyStruct(NotTrivialCopyStruct const&) : member(1) {} + + int member; +}; + +struct TrivialCopyStruct { + TrivialCopyStruct() : member(0) {} + TrivialCopyStruct(TrivialCopyStruct const&) : member(1) {} + + int member; +}; + +struct TrivialInitStruct { + TrivialInitStruct() + { ++nbConstructorCalls; } + + static size_t nbConstructorCalls; +}; + +size_t TrivialInitStruct::nbConstructorCalls = 0; + +#if defined (STLPORT) +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __type_traits { + typedef __false_type has_trivial_default_constructor; + //This is a wrong declaration just to check that internaly a simple memcpy is called: + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; + }; + + _STLP_TEMPLATE_NULL + struct __type_traits { + //This is a wrong declaration just to check that internaly no initialization is done: + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +struct base {}; +struct derived : public base {}; + +// +// tests implementation +// +void UninitializedTest::copy_test() +{ + { + //Random iterators + { + vector src(10); + vector dst(10); + uninitialized_copy(src.begin(), src.end(), dst.begin()); + vector::const_iterator it(dst.begin()), end(dst.end()); + for (; it != end; ++it) { + CPPUNIT_ASSERT( (*it).member == 1 ); + } + } + { + /** Note: we use static arrays here so the iterators are always + pointers, even in debug mode. */ + size_t const count = 10; + TrivialCopyStruct src[count]; + TrivialCopyStruct dst[count]; + + TrivialCopyStruct* it = src + 0; + TrivialCopyStruct* end = src + count; + for (; it != end; ++it) { + (*it).member = 0; + } + + uninitialized_copy(src+0, src+count, dst+0); + for (it = dst+0, end = dst+count; it != end; ++it) { +#if defined (STLPORT) + /* If the member is 1, it means that library has not found any + optimization oportunity and called the regular copy-ctor instead. */ + CPPUNIT_ASSERT( (*it).member == 0 ); +#else + CPPUNIT_ASSERT( (*it).member == 1 ); +#endif + } + } + } + + { + //Bidirectional iterator + { + vector src(10); + list dst(10); + + list::iterator it(dst.begin()), end(dst.end()); + for (; it != end; ++it) { + (*it).member = -1; + } + + uninitialized_copy(src.begin(), src.end(), dst.begin()); + + for (it = dst.begin(); it != end; ++it) { + CPPUNIT_ASSERT( (*it).member == 1 ); + } + } + + { + list src(10); + vector dst(10); + + vector::iterator it(dst.begin()), end(dst.end()); + for (; it != end; ++it) { + (*it).member = -1; + } + + uninitialized_copy(src.begin(), src.end(), dst.begin()); + + for (it = dst.begin(); it != end; ++it) { + CPPUNIT_ASSERT( (*it).member == 1 ); + } + } + } + + { + //Using containers of native types: +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + { + vector src; + int i; + for (i = -5; i < 6; ++i) { + src.push_back(i); + } + + //Building a vector result in a uninitialized_copy call internally + vector dst(src.begin(), src.end()); + vector::const_iterator it(dst.begin()); + for (i = -5; i < 6; ++i, ++it) { + CPPUNIT_ASSERT( *it == (unsigned int)i ); + } + } + + { + vector src; + char i; + for (i = -5; i < 6; ++i) { + src.push_back(i); + } + + //Building a vector result in a uninitialized_copy call internally + vector dst(src.begin(), src.end()); + vector::const_iterator it(dst.begin()); + for (i = -5; i < 6; ++i, ++it) { + CPPUNIT_ASSERT( *it == (unsigned int)i ); + } + } + + { + vector src; + int i; + for (i = -5; i < 6; ++i) { + src.push_back(i); + } + + //Building a vector result in a uninitialized_copy call internally + vector dst(src.begin(), src.end()); + vector::const_iterator it(dst.begin()); + for (i = -5; i < 6; ++i, ++it) { + CPPUNIT_ASSERT( *it == (float)i ); + } + } + + { + vector*> src(10); + vector*> dst(src.begin(), src.end()); + } + + { + derived d; + //base *pb = &d; + derived *pd = &d; + //base **ppb = &pd; + vector src(10, pd); + vector dst(src.begin(), src.end()); + vector::iterator it(dst.begin()), end(dst.end()); + for (; it != end; ++it) { + CPPUNIT_ASSERT( (*it) == pd ); + } + } +#endif + } + + { + //Vector initialization: + vector vect(10); + //Just 1 constructor call for the default value: + CPPUNIT_ASSERT( TrivialInitStruct::nbConstructorCalls == 1 ); + } +} + +/* +void UninitializedTest::fill_test() +{ +} + +void UninitializedTest::fill_n_test() +{ +} +*/ diff --git a/reactos/lib/3rdparty/stlport/test/unit/unique_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/unique_test.cpp new file mode 100644 index 00000000000..b080b7b87e1 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/unique_test.cpp @@ -0,0 +1,105 @@ +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class UniqueTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(UniqueTest); + CPPUNIT_TEST(uniqcpy1); + CPPUNIT_TEST(uniqcpy2); + CPPUNIT_TEST(unique1); + CPPUNIT_TEST(unique2); + CPPUNIT_TEST_SUITE_END(); + +protected: + void uniqcpy1(); + void uniqcpy2(); + void unique1(); + void unique2(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(UniqueTest); + +static bool str_equal(const char* a_, const char* b_) +{ return *a_ == *b_; } +// +// tests implementation +// +void UniqueTest::unique1() +{ + int numbers[8] = { 0, 1, 1, 2, 2, 2, 3, 4 }; + unique((int*)numbers, (int*)numbers + 8); + // 0 1 2 3 4 2 3 4 + CPPUNIT_ASSERT(numbers[0]==0); + CPPUNIT_ASSERT(numbers[1]==1); + CPPUNIT_ASSERT(numbers[2]==2); + CPPUNIT_ASSERT(numbers[3]==3); + CPPUNIT_ASSERT(numbers[4]==4); + CPPUNIT_ASSERT(numbers[5]==2); + CPPUNIT_ASSERT(numbers[6]==3); + CPPUNIT_ASSERT(numbers[7]==4); +} + +void UniqueTest::unique2() +{ + const char* labels[] = {"Q", "Q", "W", "W", "E", "E", "R", "T", "T", "Y", "Y"}; + + const unsigned count = sizeof(labels) / sizeof(labels[0]); + + unique((const char**)labels, (const char**)labels + count, str_equal); + + // QWERTY + CPPUNIT_ASSERT(*labels[0] == 'Q'); + CPPUNIT_ASSERT(*labels[1] == 'W'); + CPPUNIT_ASSERT(*labels[2] == 'E'); + CPPUNIT_ASSERT(*labels[3] == 'R'); + CPPUNIT_ASSERT(*labels[4] == 'T'); + CPPUNIT_ASSERT(*labels[5] == 'Y'); + +} + +void UniqueTest::uniqcpy1() +{ + int numbers[8] = { 0, 1, 1, 2, 2, 2, 3, 4 }; + int result[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + unique_copy((int*)numbers, (int*)numbers + 8, (int*)result); + + // 0 1 2 3 4 0 0 0 + CPPUNIT_ASSERT(result[0]==0); + CPPUNIT_ASSERT(result[1]==1); + CPPUNIT_ASSERT(result[2]==2); + CPPUNIT_ASSERT(result[3]==3); + CPPUNIT_ASSERT(result[4]==4); + CPPUNIT_ASSERT(result[5]==0); + CPPUNIT_ASSERT(result[6]==0); + CPPUNIT_ASSERT(result[7]==0); +} + +void UniqueTest::uniqcpy2() +{ + const char* labels[] = {"Q", "Q", "W", "W", "E", "E", "R", "T", "T", "Y", "Y"}; + const char **plabels = (const char**)labels; + + const size_t count = sizeof(labels) / sizeof(labels[0]); + const char* uCopy[count]; + const char **puCopy = &uCopy[0]; + fill(puCopy, puCopy + count, ""); + + unique_copy(plabels, plabels + count, puCopy, str_equal); + + //QWERTY + CPPUNIT_ASSERT(*uCopy[0] == 'Q'); + CPPUNIT_ASSERT(*uCopy[1] == 'W'); + CPPUNIT_ASSERT(*uCopy[2] == 'E'); + CPPUNIT_ASSERT(*uCopy[3] == 'R'); + CPPUNIT_ASSERT(*uCopy[4] == 'T'); + CPPUNIT_ASSERT(*uCopy[5] == 'Y'); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/unordered_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/unordered_test.cpp new file mode 100644 index 00000000000..8d47ca71e03 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/unordered_test.cpp @@ -0,0 +1,676 @@ +#include +#include +#include +#if defined (STLPORT) +# include +# include +#endif + +//#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +# if defined (STLPORT) +using namespace std::tr1; +# endif +#endif + +// +// TestCase class +// +class UnorderedTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(UnorderedTest); +#if !defined (STLPORT) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(uset); + CPPUNIT_TEST(umultiset); + CPPUNIT_TEST(umap); + CPPUNIT_TEST(umultimap); + CPPUNIT_TEST(user_case); + CPPUNIT_TEST(hash_policy); + CPPUNIT_TEST(buckets); + CPPUNIT_TEST(equal_range); + CPPUNIT_EXPLICIT_TEST(benchmark1); + CPPUNIT_EXPLICIT_TEST(benchmark2); +#if !defined (_STLP_USE_CONTAINERS_EXTENSION) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(template_methods); + CPPUNIT_TEST_SUITE_END(); + +protected: + void uset(); + void umultiset(); + void umap(); + void umultimap(); + void user_case(); + void hash_policy(); + void buckets(); + void equal_range(); + void benchmark1(); + void benchmark2(); + void template_methods(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(UnorderedTest); + +const int NB_ELEMS = 2000; + +// +// tests implementation +// +void UnorderedTest::uset() +{ +#if defined (STLPORT) + typedef unordered_set, equal_to > usettype; + usettype us; + + //Small compilation check of the copy constructor: + usettype us2(us); + //And assignment operator + us = us2; + + int i; + pair ret; + for (i = 0; i < NB_ELEMS; ++i) { + ret = us.insert(i); + CPPUNIT_ASSERT( ret.second ); + CPPUNIT_ASSERT( *ret.first == i ); + + ret = us.insert(i); + CPPUNIT_ASSERT( !ret.second ); + CPPUNIT_ASSERT( *ret.first == i ); + } + + vector us_val; + + usettype::local_iterator lit, litEnd; + for (i = 0; i < NB_ELEMS; ++i) { + lit = us.begin(us.bucket(i)); + litEnd = us.end(us.bucket(i)); + + usettype::size_type bucket_pos = us.bucket(*lit); + for (; lit != litEnd; ++lit) { + CPPUNIT_ASSERT( us.bucket(*lit) == bucket_pos ); + us_val.push_back(*lit); + } + } + + //A compilation time check to uncomment from time to time + { + //usettype::iterator it; + //CPPUNIT_ASSERT( it != lit ); + } + + sort(us_val.begin(), us_val.end()); + for (i = 0; i < NB_ELEMS; ++i) { + CPPUNIT_ASSERT( us_val[i] == i ); + } +#endif +} + +void UnorderedTest::umultiset() +{ +#if defined (STLPORT) + typedef unordered_multiset, equal_to > usettype; + usettype us; + + int i; + usettype::iterator ret; + for (i = 0; i < NB_ELEMS; ++i) { + ret = us.insert(i); + CPPUNIT_ASSERT( *ret == i ); + + ret = us.insert(i); + CPPUNIT_ASSERT( *ret == i ); + } + + CPPUNIT_ASSERT( us.size() == 2 * NB_ELEMS ); + vector us_val; + + usettype::local_iterator lit, litEnd; + for (i = 0; i < NB_ELEMS; ++i) { + lit = us.begin(us.bucket(i)); + litEnd = us.end(us.bucket(i)); + + usettype::size_type bucket_pos = us.bucket(*lit); + for (; lit != litEnd; ++lit) { + CPPUNIT_ASSERT( us.bucket(*lit) == bucket_pos ); + us_val.push_back(*lit); + } + } + + sort(us_val.begin(), us_val.end()); + for (i = 0; i < NB_ELEMS; ++i) { + CPPUNIT_ASSERT( us_val[2 * i] == i ); + CPPUNIT_ASSERT( us_val[2 * i + 1] == i ); + } +#endif +} + +void UnorderedTest::umap() +{ +#if defined (STLPORT) + typedef unordered_map, equal_to > umaptype; + umaptype us; + + //Compilation check of the [] operator: + umaptype us2; + us[0] = us2[0]; + us.clear(); + + { + //An other compilation check + typedef unordered_map uumaptype; + uumaptype uus; + umaptype const& uref = uus[0]; + umaptype ucopy = uus[0]; + ucopy = uref; + //Avoids warning: + //(void*)&uref; + } + + int i; + pair ret; + for (i = 0; i < NB_ELEMS; ++i) { + umaptype::value_type p1(i, i); + ret = us.insert(p1); + CPPUNIT_ASSERT( ret.second ); + CPPUNIT_ASSERT( *ret.first == p1 ); + + umaptype::value_type p2(i, i + 1); + ret = us.insert(p2); + CPPUNIT_ASSERT( !ret.second ); + CPPUNIT_ASSERT( *ret.first == p1 ); + } + + { + //Lets look for some values to see if everything is normal: + umaptype::iterator umit; + for (int j = 0; j < NB_ELEMS; j += NB_ELEMS / 100) { + umit = us.find(j); + + CPPUNIT_ASSERT( umit != us.end() ); + CPPUNIT_ASSERT( (*umit).second == j ); + } + } + + CPPUNIT_ASSERT( us.size() == (size_t)NB_ELEMS ); + vector > us_val; + + umaptype::local_iterator lit, litEnd; + for (i = 0; i < NB_ELEMS; ++i) { + lit = us.begin(us.bucket(i)); + litEnd = us.end(us.bucket(i)); + + umaptype::size_type bucket_pos = us.bucket((*lit).first); + for (; lit != litEnd; ++lit) { + CPPUNIT_ASSERT( us.bucket((*lit).first) == bucket_pos ); + us_val.push_back(make_pair((*lit).first, (*lit).second)); + } + } + + sort(us_val.begin(), us_val.end()); + for (i = 0; i < NB_ELEMS; ++i) { + CPPUNIT_ASSERT( us_val[i] == make_pair(i, i) ); + } +#endif +} + +void UnorderedTest::umultimap() +{ +#if defined (STLPORT) + typedef unordered_multimap, equal_to > umaptype; + umaptype us; + + int i; + umaptype::iterator ret; + for (i = 0; i < NB_ELEMS; ++i) { + umaptype::value_type p(i, i); + ret = us.insert(p); + CPPUNIT_ASSERT( *ret == p ); + + ret = us.insert(p); + CPPUNIT_ASSERT( *ret == p ); + } + + CPPUNIT_ASSERT( us.size() == 2 * NB_ELEMS ); + typedef pair ptype; + vector us_val; + + umaptype::local_iterator lit, litEnd; + for (i = 0; i < NB_ELEMS; ++i) { + lit = us.begin(us.bucket(i)); + litEnd = us.end(us.bucket(i)); + + umaptype::size_type bucket_pos = us.bucket((*lit).first); + for (; lit != litEnd; ++lit) { + CPPUNIT_ASSERT( us.bucket((*lit).first) == bucket_pos ); + us_val.push_back(ptype((*lit).first, (*lit).second)); + } + } + + sort(us_val.begin(), us_val.end()); + for (i = 0; i < NB_ELEMS; ++i) { + ptype p(i, i); + CPPUNIT_ASSERT( us_val[i * 2] == p ); + CPPUNIT_ASSERT( us_val[i * 2 + 1] == p ); + } +#endif +} + +void UnorderedTest::user_case() +{ +#if defined (STLPORT) + typedef unordered_map UnorderedMap1; + typedef unordered_map UnorderedMap2; + + UnorderedMap1 foo; + UnorderedMap2 bar; + + foo.insert(UnorderedMap1::value_type(1, string("test1"))); + foo.insert(UnorderedMap1::value_type(2, string("test2"))); + foo.insert(UnorderedMap1::value_type(3, string("test3"))); + foo.insert(UnorderedMap1::value_type(4, string("test4"))); + foo.insert(UnorderedMap1::value_type(5, string("test5"))); + + bar.insert(UnorderedMap2::value_type(0, foo)); + UnorderedMap2::iterator it = bar.find(0); + CPPUNIT_ASSERT( it != bar.end() ); + + UnorderedMap1 &body = it->second; + UnorderedMap1::iterator cur = body.find(3); + CPPUNIT_ASSERT( cur != body.end() ); + + body.erase(body.begin(), body.end()); + CPPUNIT_ASSERT( body.empty() ); +#endif +} + +void UnorderedTest::hash_policy() +{ +#if defined (STLPORT) + unordered_set int_uset; + + CPPUNIT_ASSERT( int_uset.max_load_factor() == 1.0f ); + CPPUNIT_ASSERT( int_uset.load_factor() == 0.0f ); + + size_t nbInserts = int_uset.bucket_count() - 1; + for (int i = 0; (size_t)i < nbInserts; ++i) { + int_uset.insert(i); + } + CPPUNIT_ASSERT( int_uset.size() == nbInserts ); + + int_uset.max_load_factor(0.5f); + int_uset.rehash(0); + CPPUNIT_ASSERT( int_uset.load_factor() < int_uset.max_load_factor() ); + + size_t bucketsHint = int_uset.bucket_count() + 1; + int_uset.rehash(bucketsHint); + CPPUNIT_ASSERT( int_uset.bucket_count() >= bucketsHint ); + + CPPUNIT_ASSERT( int_uset.key_eq()(10, 10) ); + CPPUNIT_ASSERT( int_uset.hash_function()(10) == 10 ); +#endif +} + +void UnorderedTest::buckets() +{ +#if defined (STLPORT) + unordered_set int_uset; + + CPPUNIT_ASSERT( int_uset.bucket_count() < int_uset.max_bucket_count() ); + + int i; + size_t nbBuckets = int_uset.bucket_count(); + size_t nbInserts = int_uset.bucket_count() - 1; + for (i = 0; (size_t)i < nbInserts; ++i) { + int_uset.insert(i); + } + CPPUNIT_ASSERT( nbBuckets == int_uset.bucket_count() ); + + size_t bucketSizes = 0; + for (i = 0; (size_t)i < nbBuckets; ++i) { + bucketSizes += int_uset.bucket_size(i); + } + CPPUNIT_ASSERT( bucketSizes == int_uset.size() ); +#endif +} + +void UnorderedTest::equal_range() +{ +#if defined (STLPORT) + typedef unordered_multiset umset; + { + //General test + umset iumset; + iumset.max_load_factor(10.0f); + + size_t nbBuckets = iumset.bucket_count(); + + for (size_t i = 0; i < nbBuckets; ++i) { + iumset.insert(i); + iumset.insert(i + nbBuckets); + iumset.insert(i + 2 * nbBuckets); + iumset.insert(i + 3 * nbBuckets); + iumset.insert(i + 4 * nbBuckets); + } + + CPPUNIT_ASSERT( nbBuckets == iumset.bucket_count() ); + CPPUNIT_ASSERT( iumset.size() == 5 * nbBuckets ); + + pair p = iumset.equal_range(1); + CPPUNIT_ASSERT( p.first != p.second ); + + size_t nbElems = iumset.size(); + nbElems -= distance(p.first, p.second); + for (umset::iterator j = p.first; j != p.second;) { + iumset.erase(j++); + } + + CPPUNIT_ASSERT( nbElems == iumset.size() ); + + p = iumset.equal_range(2); + CPPUNIT_ASSERT( p.first != p.second ); + nbElems -= distance(p.first, p.second); + iumset.erase(p.first, p.second); + CPPUNIT_ASSERT( nbElems == iumset.size() ); + } + + { + //More specific test that tries to put many values in the same bucket + umset iumset; + + size_t i; + //We are going to add at least 20 values, to get a stable hash container while doing that + //we force a large number of buckets: + iumset.rehash(193); + + size_t nbBuckets = iumset.bucket_count(); + const size_t targetedBucket = nbBuckets / 2; + + //Lets put 10 values in the targeted bucket: + for (i = 0; i < 10; ++i) { + iumset.insert(targetedBucket + (i * nbBuckets)); + } + + //We put again 10 values in the targeted bucket and in reverse order: + for (i = 9; i <= 10; --i) { + iumset.insert(targetedBucket + (i * nbBuckets)); + } + + //Now we put some more elements until hash container is resized: + i = 0; + while (iumset.bucket_count() == nbBuckets) { + iumset.insert(i++); + } + + //CPPUNIT_ASSERT( iumset.bucket_size(targetedBucket) == 21 ); + + pair p = iumset.equal_range(targetedBucket); + CPPUNIT_ASSERT( p.first != p.second ); + CPPUNIT_ASSERT( distance(p.first, p.second) == 3 ); + + // Now we remove some elements until hash container is resized: + nbBuckets = iumset.bucket_count(); + while (iumset.bucket_count() == nbBuckets && + !iumset.empty()) { + iumset.erase(iumset.begin()); + } + CPPUNIT_ASSERT( iumset.load_factor() <= iumset.max_load_factor() ); + + // Adding an element back shouldn't change number of buckets: + nbBuckets = iumset.bucket_count(); + iumset.insert(0); + CPPUNIT_ASSERT( iumset.bucket_count() == nbBuckets ); + } + + { + srand(0); + for (int runs = 0; runs < 2; ++runs) { + size_t magic = rand(); + umset hum; + size_t c = 0; + for (int i = 0; i < 10000; ++i) { + if ((rand() % 500) == 0) { + hum.insert(magic); + ++c; + } + else { + size_t r; + while ((r = rand()) == magic) + ; + hum.insert(r); + } + + /* + if ((float)(hum.size() + 1) / (float)hum.bucket_count() > hum.max_load_factor()) { + cout << "Hash container dump: Nb elems: " << hum.size() << ", Nb buckets: " << hum.bucket_count() << "\n"; + for (size_t b = 0; b < hum.bucket_count(); ++b) { + if (hum.bucket_size(b) != 0) { + umset::local_iterator litBegin(hum.begin(b)), litEnd(hum.end(b)); + cout << "B" << b << ": "; + for (umset::local_iterator lit = litBegin; lit != litEnd; ++lit) { + if (lit != litBegin) { + cout << " - "; + } + cout << *lit; + } + cout << "\n"; + } + } + cout << endl; + } + */ + } + CPPUNIT_ASSERT( hum.count(magic) == c ); + } + } +#endif +} + +void UnorderedTest::benchmark1() +{ +#if defined (STLPORT) + typedef unordered_multiset umset; + + const size_t target = 500000; + umset iumset; + iumset.max_load_factor(10); + size_t i; + for (i = 0; i < target; ++i) { + iumset.insert(i); + } + + for (i = 0; i < target; ++i) { + iumset.erase(i); + } +#endif +} + +void UnorderedTest::benchmark2() +{ +#if defined (STLPORT) + typedef unordered_multiset umset; + + const size_t target = 500000; + umset iumset; + iumset.max_load_factor(10); + size_t i; + for (i = 0; i < target; ++i) { + iumset.insert(target - i); + } + + for (i = 0; i < target; ++i) { + iumset.erase(target - i); + } +#endif +} + +struct Key +{ + Key() : m_data(0) {} + explicit Key(int data) : m_data(data) {} + + int m_data; + +#if defined (__DMC__) // slist<_Tp,_Alloc>::remove error + bool operator==(const Key&) const; +#endif +}; + +struct KeyHash +{ + size_t operator () (Key key) const + { return (size_t)key.m_data; } + + size_t operator () (int data) const + { return (size_t)data; } +}; + +struct KeyEqual +{ + bool operator () (Key lhs, Key rhs) const + { return lhs.m_data == rhs.m_data; } + + bool operator () (Key lhs, int rhs) const + { return lhs.m_data == rhs; } + + bool operator () (int lhs, Key rhs) const + { return lhs == rhs.m_data; } +}; + +struct KeyHashPtr +{ + size_t operator () (Key const volatile *key) const + { return (size_t)key->m_data; } + + size_t operator () (int data) const + { return (size_t)data; } +}; + +struct KeyEqualPtr +{ + bool operator () (Key const volatile *lhs, Key const volatile *rhs) const + { return lhs->m_data == rhs->m_data; } + + bool operator () (Key const volatile *lhs, int rhs) const + { return lhs->m_data == rhs; } + + bool operator () (int lhs, Key const volatile *rhs) const + { return lhs == rhs->m_data; } +}; + +void UnorderedTest::template_methods() +{ +#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION) + { + typedef unordered_set Container; + Container cont; + cont.insert(Key(1)); + cont.insert(Key(2)); + cont.insert(Key(3)); + cont.insert(Key(4)); + + CPPUNIT_ASSERT( cont.count(Key(1)) == 1 ); + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) ); + } + + { + typedef unordered_set Container; + Container cont; + Key key1(1), key2(2), key3(3), key4(4); + cont.insert(&key1); + cont.insert(&key2); + cont.insert(&key3); + cont.insert(&key4); + + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) ); + } + { + typedef unordered_multiset Container; + Container cont; + cont.insert(Key(1)); + cont.insert(Key(2)); + cont.insert(Key(1)); + cont.insert(Key(2)); + + CPPUNIT_ASSERT( cont.count(Key(1)) == 2 ); + CPPUNIT_ASSERT( cont.count(1) == 2 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(1) != make_pair(cont.end(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.end(), ccont.end()) ); + } + + { + typedef unordered_multiset Container; + Container cont; + Key key1(1), key2(2), key3(3), key4(4); + cont.insert(&key1); + cont.insert(&key2); + cont.insert(&key3); + cont.insert(&key4); + + CPPUNIT_ASSERT( cont.count(1) == 1 ); + CPPUNIT_ASSERT( cont.count(5) == 0 ); + + CPPUNIT_ASSERT( cont.find(2) != cont.end() ); + CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) ); + + Container const& ccont = cont; + CPPUNIT_ASSERT( ccont.find(2) != ccont.end() ); + CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) ); + CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) ); + } +#endif +} + +#if defined (STLPORT) && \ + (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)) +# if !defined (__DMC__) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + unordered_set usinstances; + typedef unordered_set::iterator usit; + unordered_multiset usminstances; + typedef unordered_multiset::iterator usmit; + + unordered_map uminstances; + typedef unordered_map::iterator umit; + unordered_multimap umminstances; + typedef unordered_multimap::iterator ummit; +}; +# endif +#endif diff --git a/reactos/lib/3rdparty/stlport/test/unit/utility_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/utility_header_test.cpp new file mode 100644 index 00000000000..78d67fb177e --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/utility_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/valarray_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/valarray_header_test.cpp new file mode 100644 index 00000000000..f736264865a --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/valarray_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/valarray_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/valarray_test.cpp new file mode 100644 index 00000000000..87ee3dc4b08 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/valarray_test.cpp @@ -0,0 +1,121 @@ +#include + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class ValarrayTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(ValarrayTest); + CPPUNIT_TEST(transcendentals); + CPPUNIT_TEST_SUITE_END(); + +protected: + void transcendentals(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ValarrayTest); + +// +// tests implementation +// +// For the moment this test is just a complitation test +// everyone is welcome to do a real good unit test for +// valarray functionality. +void ValarrayTest::transcendentals() +{ +#ifdef __SUNPRO_CC + using std::abs; +#endif + { + valarray darray; + valarray tmp; + tmp = abs(darray); + tmp = acos(darray); + tmp = asin(darray); + tmp = atan(darray); + tmp = atan2(darray, tmp); + tmp = atan2(1.0, darray); + tmp = atan2(darray, 1.0); + tmp = cos(darray); + tmp = cosh(darray); + tmp = sin(darray); + tmp = sinh(darray); + tmp = tan(darray); +#if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64) + tmp = tanh(darray); +#endif + tmp = exp(darray); + tmp = log(darray); + tmp = log10(darray); + tmp = pow(darray, tmp); + tmp = pow(1.0, darray); + tmp = pow(darray, 1.0); + tmp = sqrt(darray); + } + { + valarray farray; + valarray tmp; + tmp = abs(farray); + tmp = acos(farray); + tmp = asin(farray); + tmp = atan(farray); + tmp = atan2(farray, tmp); + tmp = atan2(1.0f, farray); + tmp = atan2(farray, 1.0f); + tmp = cos(farray); + tmp = cosh(farray); + tmp = sin(farray); + tmp = sinh(farray); + tmp = tan(farray); +#if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64) + tmp = tanh(farray); +#endif + tmp = exp(farray); + tmp = log(farray); + tmp = log10(farray); + tmp = pow(farray, tmp); + tmp = pow(1.0f, farray); + tmp = pow(farray, 1.0f); + tmp = sqrt(farray); + } +#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE) + { + valarray ldarray; + valarray tmp; + tmp = abs(ldarray); + tmp = acos(ldarray); + tmp = asin(ldarray); + tmp = atan(ldarray); + tmp = atan2(ldarray, tmp); + tmp = atan2(1.0l, ldarray); + tmp = atan2(ldarray, 1.0l); + tmp = cos(ldarray); + tmp = cosh(ldarray); + tmp = sin(ldarray); + tmp = sinh(ldarray); + tmp = tan(ldarray); +# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64) + tmp = tanh(ldarray); +# endif + tmp = exp(ldarray); + tmp = log(ldarray); + tmp = log10(ldarray); + tmp = pow(ldarray, tmp); + tmp = pow(1.0l, ldarray); + tmp = pow(ldarray, 1.0l); + tmp = sqrt(ldarray); + } +#endif + valarray v0(2, 10); + valarray v1(v0[slice(0, 1, 5)]); + v0[slice(0, 1, 5)] = 5; + valarray v2(v0[gslice()]); + //valarray v3(v0[valarray()]); + valarray v4(v0[valarray()]); +} diff --git a/reactos/lib/3rdparty/stlport/test/unit/vector_header_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/vector_header_test.cpp new file mode 100644 index 00000000000..69d2bfa48ea --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/vector_header_test.cpp @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/vector_test.cpp b/reactos/lib/3rdparty/stlport/test/unit/vector_test.cpp new file mode 100644 index 00000000000..a23ba1d4b7b --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/vector_test.cpp @@ -0,0 +1,553 @@ +//Has to be first for StackAllocator swap overload to be taken +//into account (at least using GCC 4.0.1) +#include "stack_allocator.h" + +#include +#include +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) +# include +#endif + +#include "cppunit/cppunit_proxy.h" + +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) +using namespace std; +#endif + +// +// TestCase class +// +class VectorTest : public CPPUNIT_NS::TestCase +{ + CPPUNIT_TEST_SUITE(VectorTest); + CPPUNIT_TEST(vec_test_1); + CPPUNIT_TEST(vec_test_2); + CPPUNIT_TEST(vec_test_3); + CPPUNIT_TEST(vec_test_4); + CPPUNIT_TEST(vec_test_5); + CPPUNIT_TEST(vec_test_6); + CPPUNIT_TEST(vec_test_7); + CPPUNIT_TEST(capacity); + CPPUNIT_TEST(at); + CPPUNIT_TEST(pointer); + CPPUNIT_TEST(auto_ref); + CPPUNIT_TEST(allocator_with_state); + CPPUNIT_TEST(iterators); +#if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES) + CPPUNIT_IGNORE; +#endif + CPPUNIT_TEST(optimizations_check); + CPPUNIT_TEST(assign_check); + CPPUNIT_STOP_IGNORE; + CPPUNIT_TEST(ebo); + CPPUNIT_TEST_SUITE_END(); + +protected: + void vec_test_1(); + void vec_test_2(); + void vec_test_3(); + void vec_test_4(); + void vec_test_5(); + void vec_test_6(); + void vec_test_7(); + void capacity(); + void at(); + void pointer(); + void auto_ref(); + void allocator_with_state(); + void iterators(); + void optimizations_check(); + void assign_check(); + void ebo(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(VectorTest); + +// +// tests implementation +// +void VectorTest::vec_test_1() +{ + vector v1; // Empty vector of integers. + + CPPUNIT_ASSERT( v1.empty() == true ); + CPPUNIT_ASSERT( v1.size() == 0 ); + + // CPPUNIT_ASSERT( v1.max_size() == INT_MAX / sizeof(int) ); + // cout << "max_size = " << v1.max_size() << endl; + v1.push_back(42); // Add an integer to the vector. + + CPPUNIT_ASSERT( v1.size() == 1 ); + + CPPUNIT_ASSERT( v1[0] == 42 ); + + { + vector > vect(10); + vector >::iterator it(vect.begin()), end(vect.end()); + for (; it != end; ++it) { + CPPUNIT_ASSERT( (*it).empty() ); + CPPUNIT_ASSERT( (*it).size() == 0 ); + CPPUNIT_ASSERT( (*it).capacity() == 0 ); + CPPUNIT_ASSERT( (*it).begin() == (*it).end() ); + } + } +} + +void VectorTest::vec_test_2() +{ + vector v1; // Empty vector of doubles. + v1.push_back(32.1); + v1.push_back(40.5); + vector v2; // Another empty vector of doubles. + v2.push_back(3.56); + + CPPUNIT_ASSERT( v1.size() == 2 ); + CPPUNIT_ASSERT( v1[0] == 32.1 ); + CPPUNIT_ASSERT( v1[1] == 40.5 ); + + CPPUNIT_ASSERT( v2.size() == 1 ); + CPPUNIT_ASSERT( v2[0] == 3.56 ); + size_t v1Cap = v1.capacity(); + size_t v2Cap = v2.capacity(); + + v1.swap(v2); // Swap the vector's contents. + + CPPUNIT_ASSERT( v1.size() == 1 ); + CPPUNIT_ASSERT( v1.capacity() == v2Cap ); + CPPUNIT_ASSERT( v1[0] == 3.56 ); + + CPPUNIT_ASSERT( v2.size() == 2 ); + CPPUNIT_ASSERT( v2.capacity() == v1Cap ); + CPPUNIT_ASSERT( v2[0] == 32.1 ); + CPPUNIT_ASSERT( v2[1] == 40.5 ); + + v2 = v1; // Assign one vector to another. + + CPPUNIT_ASSERT( v2.size() == 1 ); + CPPUNIT_ASSERT( v2[0] == 3.56 ); +} + +void VectorTest::vec_test_3() +{ + typedef vector vec_type; + + vec_type v1; // Empty vector of characters. + v1.push_back('h'); + v1.push_back('i'); + + CPPUNIT_ASSERT( v1.size() == 2 ); + CPPUNIT_ASSERT( v1[0] == 'h' ); + CPPUNIT_ASSERT( v1[1] == 'i' ); + + vec_type v2(v1.begin(), v1.end()); + v2[1] = 'o'; // Replace second character. + + CPPUNIT_ASSERT( v2.size() == 2 ); + CPPUNIT_ASSERT( v2[0] == 'h' ); + CPPUNIT_ASSERT( v2[1] == 'o' ); + + CPPUNIT_ASSERT( (v1 == v2) == false ); + + CPPUNIT_ASSERT( (v1 < v2) == true ); +} + +void VectorTest::vec_test_4() +{ + vector v(4); + + v[0] = 1; + v[1] = 4; + v[2] = 9; + v[3] = 16; + + CPPUNIT_ASSERT( v.front() == 1 ); + CPPUNIT_ASSERT( v.back() == 16 ); + + v.push_back(25); + + CPPUNIT_ASSERT( v.back() == 25 ); + CPPUNIT_ASSERT( v.size() == 5 ); + + v.pop_back(); + + CPPUNIT_ASSERT( v.back() == 16 ); + CPPUNIT_ASSERT( v.size() == 4 ); +} + +void VectorTest::vec_test_5() +{ + int array [] = { 1, 4, 9, 16 }; + + vector v(array, array + 4); + + CPPUNIT_ASSERT( v.size() == 4 ); + + CPPUNIT_ASSERT( v[0] == 1 ); + CPPUNIT_ASSERT( v[1] == 4 ); + CPPUNIT_ASSERT( v[2] == 9 ); + CPPUNIT_ASSERT( v[3] == 16 ); +} + +void VectorTest::vec_test_6() +{ + int array [] = { 1, 4, 9, 16, 25, 36 }; + + vector v(array, array + 6); + vector::iterator vit; + + CPPUNIT_ASSERT( v.size() == 6 ); + CPPUNIT_ASSERT( v[0] == 1 ); + CPPUNIT_ASSERT( v[1] == 4 ); + CPPUNIT_ASSERT( v[2] == 9 ); + CPPUNIT_ASSERT( v[3] == 16 ); + CPPUNIT_ASSERT( v[4] == 25 ); + CPPUNIT_ASSERT( v[5] == 36 ); + + vit = v.erase( v.begin() ); // Erase first element. + CPPUNIT_ASSERT( *vit == 4 ); + + CPPUNIT_ASSERT( v.size() == 5 ); + CPPUNIT_ASSERT( v[0] == 4 ); + CPPUNIT_ASSERT( v[1] == 9 ); + CPPUNIT_ASSERT( v[2] == 16 ); + CPPUNIT_ASSERT( v[3] == 25 ); + CPPUNIT_ASSERT( v[4] == 36 ); + + vit = v.erase(v.end() - 1); // Erase last element. + CPPUNIT_ASSERT( vit == v.end() ); + + CPPUNIT_ASSERT( v.size() == 4 ); + CPPUNIT_ASSERT( v[0] == 4 ); + CPPUNIT_ASSERT( v[1] == 9 ); + CPPUNIT_ASSERT( v[2] == 16 ); + CPPUNIT_ASSERT( v[3] == 25 ); + + + v.erase(v.begin() + 1, v.end() - 1); // Erase all but first and last. + + CPPUNIT_ASSERT( v.size() == 2 ); + CPPUNIT_ASSERT( v[0] == 4 ); + CPPUNIT_ASSERT( v[1] == 25 ); + +} + +void VectorTest::vec_test_7() +{ + int array1 [] = { 1, 4, 25 }; + int array2 [] = { 9, 16 }; + + vector v(array1, array1 + 3); + vector::iterator vit; + vit = v.insert(v.begin(), 0); // Insert before first element. + CPPUNIT_ASSERT( *vit == 0 ); + + vit = v.insert(v.end(), 36); // Insert after last element. + CPPUNIT_ASSERT( *vit == 36 ); + + CPPUNIT_ASSERT( v.size() == 5 ); + CPPUNIT_ASSERT( v[0] == 0 ); + CPPUNIT_ASSERT( v[1] == 1 ); + CPPUNIT_ASSERT( v[2] == 4 ); + CPPUNIT_ASSERT( v[3] == 25 ); + CPPUNIT_ASSERT( v[4] == 36 ); + + // Insert contents of array2 before fourth element. + v.insert(v.begin() + 3, array2, array2 + 2); + + CPPUNIT_ASSERT( v.size() == 7 ); + + CPPUNIT_ASSERT( v[0] == 0 ); + CPPUNIT_ASSERT( v[1] == 1 ); + CPPUNIT_ASSERT( v[2] == 4 ); + CPPUNIT_ASSERT( v[3] == 9 ); + CPPUNIT_ASSERT( v[4] == 16 ); + CPPUNIT_ASSERT( v[5] == 25 ); + CPPUNIT_ASSERT( v[6] == 36 ); + + v.clear(); + CPPUNIT_ASSERT( v.empty() ); + + v.insert(v.begin(), 5, 10); + CPPUNIT_ASSERT( v.size() == 5 ); + CPPUNIT_ASSERT( v[0] == 10 ); + CPPUNIT_ASSERT( v[1] == 10 ); + CPPUNIT_ASSERT( v[2] == 10 ); + CPPUNIT_ASSERT( v[3] == 10 ); + CPPUNIT_ASSERT( v[4] == 10 ); + + /* + { + vector vf(2.0f, 3.0f); + CPPUNIT_ASSERT( vf.size() == 2 ); + CPPUNIT_ASSERT( vf.front() == 3.0f ); + CPPUNIT_ASSERT( vf.back() == 3.0f ); + } + */ +} + +struct TestStruct +{ + unsigned int a[3]; +}; + +void VectorTest::capacity() +{ + { + vector v; + + CPPUNIT_ASSERT( v.capacity() == 0 ); + v.push_back(42); + CPPUNIT_ASSERT( v.capacity() >= 1 ); + v.reserve(5000); + CPPUNIT_ASSERT( v.capacity() >= 5000 ); + } + + { + //Test that used to generate an assertion when using __debug_alloc. + vector va; + va.reserve(1); + va.reserve(2); + } +} + +void VectorTest::at() { + vector v; + vector const& cv = v; + + v.push_back(10); + CPPUNIT_ASSERT( v.at(0) == 10 ); + v.at(0) = 20; + CPPUNIT_ASSERT( cv.at(0) == 20 ); + +#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) + try { + v.at(1) = 20; + CPPUNIT_FAIL; + } + catch (out_of_range const&) { + } + catch (...) { + CPPUNIT_FAIL; + } +#endif +} + +void VectorTest::pointer() +{ + vector v1; + vector v2 = v1; + vector v3; + + v3.insert( v3.end(), v1.begin(), v1.end() ); +} + +void VectorTest::auto_ref() +{ + vector ref; + for (int i = 0; i < 5; ++i) { + ref.push_back(i); + } + + vector > v_v_int(1, ref); + v_v_int.push_back(v_v_int[0]); + v_v_int.push_back(ref); + v_v_int.push_back(v_v_int[0]); + v_v_int.push_back(v_v_int[0]); + v_v_int.push_back(ref); + + vector >::iterator vvit(v_v_int.begin()), vvitEnd(v_v_int.end()); + for (; vvit != vvitEnd; ++vvit) { + CPPUNIT_ASSERT( *vvit == ref ); + } + + /* + * Forbidden by the Standard: + v_v_int.insert(v_v_int.end(), v_v_int.begin(), v_v_int.end()); + for (vvit = v_v_int.begin(), vvitEnd = v_v_int.end(); + vvit != vvitEnd; ++vvit) { + CPPUNIT_ASSERT( *vvit == ref ); + } + */ +} + +void VectorTest::allocator_with_state() + { + char buf1[1024]; + StackAllocator stack1(buf1, buf1 + sizeof(buf1)); + + char buf2[1024]; + StackAllocator stack2(buf2, buf2 + sizeof(buf2)); + + { + typedef vector > VectorInt; + VectorInt vint1(10, 0, stack1); + VectorInt vint1Cpy(vint1); + + VectorInt vint2(10, 1, stack2); + VectorInt vint2Cpy(vint2); + + vint1.swap(vint2); + + CPPUNIT_ASSERT( vint1.get_allocator().swaped() ); + CPPUNIT_ASSERT( vint2.get_allocator().swaped() ); + + CPPUNIT_ASSERT( vint1 == vint2Cpy ); + CPPUNIT_ASSERT( vint2 == vint1Cpy ); + CPPUNIT_ASSERT( vint1.get_allocator() == stack2 ); + CPPUNIT_ASSERT( vint2.get_allocator() == stack1 ); + } + CPPUNIT_ASSERT( stack1.ok() ); + CPPUNIT_ASSERT( stack2.ok() ); + } + +struct Point { + int x, y; +}; + +struct PointEx : public Point { + PointEx() : builtFromBase(false) {} + PointEx(const Point&) : builtFromBase(true) {} + + bool builtFromBase; +}; + +#if defined (STLPORT) +# if defined (_STLP_USE_NAMESPACES) +namespace std { +# endif + _STLP_TEMPLATE_NULL + struct __type_traits { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; + }; +# if defined (_STLP_USE_NAMESPACES) +} +# endif +#endif + +//This test check that vector implementation do not over optimize +//operation as PointEx copy constructor is trivial +void VectorTest::optimizations_check() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + vector v1(1); + CPPUNIT_ASSERT( v1.size() == 1 ); + + vector v2(v1.begin(), v1.end()); + CPPUNIT_ASSERT( v2.size() == 1 ); + CPPUNIT_ASSERT( v2[0].builtFromBase == true ); +#endif +} + +void VectorTest::assign_check() +{ +#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) + vector v(3,1); + int array[] = { 1, 2, 3, 4, 5 }; + + v.assign( array, array + 5 ); + CPPUNIT_CHECK( v[4] == 5 ); + CPPUNIT_CHECK( v[0] == 1 ); + CPPUNIT_CHECK( v[1] == 2 ); +#endif +} + +void VectorTest::iterators() +{ + vector vint(10, 0); + vector const& crvint = vint; + + CPPUNIT_ASSERT( vint.begin() == vint.begin() ); + CPPUNIT_ASSERT( crvint.begin() == vint.begin() ); + CPPUNIT_ASSERT( vint.begin() == crvint.begin() ); + CPPUNIT_ASSERT( crvint.begin() == crvint.begin() ); + + CPPUNIT_ASSERT( vint.begin() != vint.end() ); + CPPUNIT_ASSERT( crvint.begin() != vint.end() ); + CPPUNIT_ASSERT( vint.begin() != crvint.end() ); + CPPUNIT_ASSERT( crvint.begin() != crvint.end() ); + + CPPUNIT_ASSERT( vint.rbegin() == vint.rbegin() ); + // Not Standard: + //CPPUNIT_ASSERT( vint.rbegin() == crvint.rbegin() ); + //CPPUNIT_ASSERT( crvint.rbegin() == vint.rbegin() ); + CPPUNIT_ASSERT( crvint.rbegin() == crvint.rbegin() ); + + CPPUNIT_ASSERT( vint.rbegin() != vint.rend() ); + // Not Standard: + //CPPUNIT_ASSERT( vint.rbegin() != crvint.rend() ); + //CPPUNIT_ASSERT( crvint.rbegin() != vint.rend() ); + CPPUNIT_ASSERT( crvint.rbegin() != crvint.rend() ); +} + + +#if !defined (STLPORT) || \ + !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* Simple compilation test: Check that nested types like iterator + * can be access even if type used to instanciate container is not + * yet completely defined. + */ +class IncompleteClass +{ + vector instances; + typedef vector::iterator it; +}; +#endif + +#if defined (STLPORT) +# define NOTHROW _STLP_NOTHROW +#else +# define NOTHROW throw() +#endif + +/* This allocator implementation purpose is simply to break some + * internal STLport mecanism specific to the STLport own allocator + * implementation. */ +template +struct NotSTLportAllocator : public allocator<_Tp> { +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template struct rebind { + typedef NotSTLportAllocator<_Tp1> other; + }; +#endif + NotSTLportAllocator() NOTHROW {} +#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES) + template NotSTLportAllocator(const NotSTLportAllocator<_Tp1>&) NOTHROW {} +#endif + NotSTLportAllocator(const NotSTLportAllocator<_Tp>&) NOTHROW {} + ~NotSTLportAllocator() NOTHROW {} +}; + +/* This test check a potential issue with empty base class + * optimization. Some compilers (VC6) do not implement it + * correctly resulting ina wrong behavior. */ +void VectorTest::ebo() +{ + // We use heap memory as test failure can corrupt vector internal + // representation making executable crash on vector destructor invocation. + // We prefer a simple memory leak, internal corruption should be reveal + // by size or capacity checks. + typedef vector > V; + V *pv1 = new V(1, 1); + V *pv2 = new V(10, 2); + + size_t v1Capacity = pv1->capacity(); + size_t v2Capacity = pv2->capacity(); + + pv1->swap(*pv2); + + CPPUNIT_ASSERT( pv1->size() == 10 ); + CPPUNIT_ASSERT( pv1->capacity() == v2Capacity ); + CPPUNIT_ASSERT( (*pv1)[5] == 2 ); + + CPPUNIT_ASSERT( pv2->size() == 1 ); + CPPUNIT_ASSERT( pv2->capacity() == v1Capacity ); + CPPUNIT_ASSERT( (*pv2)[0] == 1 ); + + delete pv2; + delete pv1; +} + diff --git a/reactos/lib/3rdparty/stlport/test/unit/wchar_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/wchar_header_test.c new file mode 100644 index 00000000000..36376fee900 --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/wchar_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include diff --git a/reactos/lib/3rdparty/stlport/test/unit/wctype_header_test.c b/reactos/lib/3rdparty/stlport/test/unit/wctype_header_test.c new file mode 100644 index 00000000000..639878c102d --- /dev/null +++ b/reactos/lib/3rdparty/stlport/test/unit/wctype_header_test.c @@ -0,0 +1,8 @@ +/* This test purpose is simply to check Standard header independancy that + * is to say that the header can be included alone without any previous + * include. + * Additionnaly, for C Standard headers that STLport expose, it can also be + * used to check that files included by those headers are compatible with + * pure C compilers. + */ +#include