diff --git a/include/string b/include/string index 85eb463d..89f75cd2 100644 --- a/include/string +++ b/include/string @@ -100,8 +100,8 @@ public: noexcept(is_nothrow_move_constructible::value); basic_string(const basic_string& str, size_type pos, size_type n = npos, const allocator_type& a = allocator_type()); - basic_string(const_pointer s, const allocator_type& a = allocator_type()); - basic_string(const_pointer s, size_type n, const allocator_type& a = allocator_type()); + basic_string(const value_type* s, const allocator_type& a = allocator_type()); + basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type()); basic_string(size_type n, value_type c, const allocator_type& a = allocator_type()); template basic_string(InputIterator begin, InputIterator end, @@ -117,7 +117,7 @@ public: noexcept( allocator_type::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value); - basic_string& operator=(const_pointer s); + basic_string& operator=(const value_type* s); basic_string& operator=(value_type c); basic_string& operator=(initializer_list); @@ -156,14 +156,14 @@ public: reference at(size_type n); basic_string& operator+=(const basic_string& str); - basic_string& operator+=(const_pointer s); + basic_string& operator+=(const value_type* s); basic_string& operator+=(value_type c); basic_string& operator+=(initializer_list); basic_string& append(const basic_string& str); basic_string& append(const basic_string& str, size_type pos, size_type n); - basic_string& append(const_pointer s, size_type n); - basic_string& append(const_pointer s); + basic_string& append(const value_type* s, size_type n); + basic_string& append(const value_type* s); basic_string& append(size_type n, value_type c); template basic_string& append(InputIterator first, InputIterator last); @@ -179,8 +179,8 @@ public: basic_string& assign(const basic_string& str); basic_string& assign(basic_string&& str); basic_string& assign(const basic_string& str, size_type pos, size_type n); - basic_string& assign(const_pointer s, size_type n); - basic_string& assign(const_pointer s); + basic_string& assign(const value_type* s, size_type n); + basic_string& assign(const value_type* s); basic_string& assign(size_type n, value_type c); template basic_string& assign(InputIterator first, InputIterator last); @@ -189,8 +189,8 @@ public: basic_string& insert(size_type pos1, const basic_string& str); basic_string& insert(size_type pos1, const basic_string& str, size_type pos2, size_type n); - basic_string& insert(size_type pos, const_pointer s, size_type n); - basic_string& insert(size_type pos, const_pointer s); + basic_string& insert(size_type pos, const value_type* s, size_type n); + basic_string& insert(size_type pos, const value_type* s); basic_string& insert(size_type pos, size_type n, value_type c); iterator insert(const_iterator p, value_type c); iterator insert(const_iterator p, size_type n, value_type c); @@ -205,66 +205,66 @@ public: basic_string& replace(size_type pos1, size_type n1, const basic_string& str); basic_string& replace(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2); - basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2); - basic_string& replace(size_type pos, size_type n1, const_pointer s); + basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2); + basic_string& replace(size_type pos, size_type n1, const value_type* s); basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c); basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str); - basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n); - basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s); + basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n); + basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s); basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c); template basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2); basic_string& replace(const_iterator i1, const_iterator i2, initializer_list); - size_type copy(pointer s, size_type n, size_type pos = 0) const; + size_type copy(value_type* s, size_type n, size_type pos = 0) const; basic_string substr(size_type pos = 0, size_type n = npos) const; void swap(basic_string& str) noexcept(!allocator_type::propagate_on_container_swap::value || __is_nothrow_swappable::value) - const_pointer c_str() const noexcept; - const_pointer data() const noexcept; + const value_type* c_str() const noexcept; + const value_type* data() const noexcept; allocator_type get_allocator() const noexcept; size_type find(const basic_string& str, size_type pos = 0) const noexcept; - size_type find(const_pointer s, size_type pos, size_type n) const noexcept; - size_type find(const_pointer s, size_type pos = 0) const noexcept; + size_type find(const value_type* s, size_type pos, size_type n) const noexcept; + size_type find(const value_type* s, size_type pos = 0) const noexcept; size_type find(value_type c, size_type pos = 0) const noexcept; size_type rfind(const basic_string& str, size_type pos = npos) const noexcept; - size_type rfind(const_pointer s, size_type pos, size_type n) const noexcept; - size_type rfind(const_pointer s, size_type pos = npos) const noexcept; + size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept; + size_type rfind(const value_type* s, size_type pos = npos) const noexcept; size_type rfind(value_type c, size_type pos = npos) const noexcept; size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept; - size_type find_first_of(const_pointer s, size_type pos, size_type n) const noexcept; - size_type find_first_of(const_pointer s, size_type pos = 0) const noexcept; + size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept; + size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept; size_type find_first_of(value_type c, size_type pos = 0) const noexcept; size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept; - size_type find_last_of(const_pointer s, size_type pos, size_type n) const noexcept; - size_type find_last_of(const_pointer s, size_type pos = npos) const noexcept; + size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept; + size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept; size_type find_last_of(value_type c, size_type pos = npos) const noexcept; size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept; - size_type find_first_not_of(const_pointer s, size_type pos, size_type n) const noexcept; - size_type find_first_not_of(const_pointer s, size_type pos = 0) const noexcept; + size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept; + size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept; size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept; size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept; - size_type find_last_not_of(const_pointer s, size_type pos, size_type n) const noexcept; - size_type find_last_not_of(const_pointer s, size_type pos = npos) const noexcept; + size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept; + size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept; size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept; int compare(const basic_string& str) const noexcept; int compare(size_type pos1, size_type n1, const basic_string& str) const; int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2) const; - int compare(const_pointer s) const noexcept; - int compare(size_type pos1, size_type n1, const_pointer s) const; - int compare(size_type pos1, size_type n1, const_pointer s, size_type n2) const; + int compare(const value_type* s) const noexcept; + int compare(size_type pos1, size_type n1, const value_type* s) const; + int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const; bool __invariants() const; }; @@ -1192,13 +1192,13 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str, const allocator_type& __a); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s); + _LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s); _LIBCPP_INLINE_VISIBILITY - basic_string(const_pointer __s, const allocator_type& __a); + basic_string(const value_type* __s, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY - basic_string(const_pointer __s, size_type __n); + basic_string(const value_type* __s, size_type __n); _LIBCPP_INLINE_VISIBILITY - basic_string(const_pointer __s, size_type __n, const allocator_type& __a); + basic_string(const value_type* __s, size_type __n, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY basic_string(size_type __n, value_type __c); _LIBCPP_INLINE_VISIBILITY @@ -1227,7 +1227,7 @@ public: _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value); #endif - _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);} + _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);} basic_string& operator=(value_type __c); #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY @@ -1240,13 +1240,13 @@ public: {return iterator(__get_pointer());} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT - {return const_iterator(data());} + {return const_iterator(__get_pointer());} _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return iterator(__get_pointer() + size());} _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT - {return const_iterator(data() + size());} + {return const_iterator(__get_pointer() + size());} #else // _LIBCPP_DEBUG _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(this, __get_pointer());} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(this, data());} @@ -1303,7 +1303,7 @@ public: reference at(size_type __n); _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);} - _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const_pointer __s) {return append(__s);} + _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;} #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list __il) {return append(__il);} @@ -1312,8 +1312,8 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& append(const basic_string& __str); basic_string& append(const basic_string& __str, size_type __pos, size_type __n); - basic_string& append(const_pointer __s, size_type __n); - basic_string& append(const_pointer __s); + basic_string& append(const value_type* __s, size_type __n); + basic_string& append(const value_type* __s); basic_string& append(size_type __n, value_type __c); template typename enable_if @@ -1351,8 +1351,8 @@ public: {*this = _VSTD::move(str); return *this;} #endif basic_string& assign(const basic_string& __str, size_type __pos, size_type __n); - basic_string& assign(const_pointer __s, size_type __n); - basic_string& assign(const_pointer __s); + basic_string& assign(const value_type* __s, size_type __n); + basic_string& assign(const value_type* __s); basic_string& assign(size_type __n, value_type __c); template typename enable_if @@ -1377,8 +1377,8 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& insert(size_type __pos1, const basic_string& __str); basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n); - basic_string& insert(size_type __pos, const_pointer __s, size_type __n); - basic_string& insert(size_type __pos, const_pointer __s); + basic_string& insert(size_type __pos, const value_type* __s, size_type __n); + basic_string& insert(size_type __pos, const value_type* __s); basic_string& insert(size_type __pos, size_type __n, value_type __c); iterator insert(const_iterator __pos, value_type __c); _LIBCPP_INLINE_VISIBILITY @@ -1413,15 +1413,15 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str); basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2); - basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2); - basic_string& replace(size_type __pos, size_type __n1, const_pointer __s); + basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2); + basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str); _LIBCPP_INLINE_VISIBILITY - basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n); + basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n); _LIBCPP_INLINE_VISIBILITY - basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s); + basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s); _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c); template @@ -1437,7 +1437,7 @@ public: {return replace(__i1, __i2, __il.begin(), __il.end());} #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - size_type copy(pointer __s, size_type __n, size_type __pos = 0) const; + size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; _LIBCPP_INLINE_VISIBILITY basic_string substr(size_type __pos = 0, size_type __n = npos) const; @@ -1447,56 +1447,56 @@ public: __is_nothrow_swappable::value); _LIBCPP_INLINE_VISIBILITY - const_pointer c_str() const _NOEXCEPT {return data();} + const value_type* c_str() const _NOEXCEPT {return data();} _LIBCPP_INLINE_VISIBILITY - const_pointer data() const _NOEXCEPT {return __get_pointer();} + const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());} _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT {return __alloc();} _LIBCPP_INLINE_VISIBILITY size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; - size_type find(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT; + size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find(const_pointer __s, size_type __pos = 0) const _NOEXCEPT; + size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; - size_type rfind(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT; + size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type rfind(const_pointer __s, size_type __pos = npos) const _NOEXCEPT; + size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; - size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT; + size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find_first_of(const_pointer __s, size_type __pos = 0) const _NOEXCEPT; + size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; - size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT; + size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find_last_of(const_pointer __s, size_type __pos = npos) const _NOEXCEPT; + size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; - size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT; + size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const _NOEXCEPT; + size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; - size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT; + size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const _NOEXCEPT; + size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT; @@ -1505,9 +1505,9 @@ public: _LIBCPP_INLINE_VISIBILITY int compare(size_type __pos1, size_type __n1, const basic_string& __str) const; int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const; - int compare(const_pointer __s) const _NOEXCEPT; - int compare(size_type __pos1, size_type __n1, const_pointer __s) const; - int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const; + int compare(const value_type* __s) const _NOEXCEPT; + int compare(size_type __pos1, size_type __n1, const value_type* __s) const; + int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const; _LIBCPP_INLINE_VISIBILITY bool __invariants() const; @@ -1589,10 +1589,10 @@ private: {return __r_.first().__l.__data_;} _LIBCPP_INLINE_VISIBILITY pointer __get_short_pointer() _NOEXCEPT - {return __r_.first().__s.__data_;} + {return pointer_traits::pointer_to(__r_.first().__s.__data_[0]);} _LIBCPP_INLINE_VISIBILITY const_pointer __get_short_pointer() const _NOEXCEPT - {return __r_.first().__s.__data_;} + {return pointer_traits::pointer_to(__r_.first().__s.__data_[0]);} _LIBCPP_INLINE_VISIBILITY pointer __get_pointer() _NOEXCEPT {return __is_long() ? __get_long_pointer() : __get_short_pointer();} @@ -1619,8 +1619,8 @@ private: __align (__s+1)) - 1;} - void __init(const_pointer __s, size_type __sz, size_type __reserve); - void __init(const_pointer __s, size_type __sz); + void __init(const value_type* __s, size_type __sz, size_type __reserve); + void __init(const value_type* __s, size_type __sz); void __init(size_type __n, value_type __c); template @@ -1644,7 +1644,7 @@ private: size_type __n_copy, size_type __n_del, size_type __n_add = 0); void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, - size_type __n_add, const_pointer __p_new_stuff); + size_type __n_add, const value_type* __p_new_stuff); _LIBCPP_INLINE_VISIBILITY void __erase_to_end(size_type __pos); @@ -1801,7 +1801,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ template void -basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type __sz, size_type __reserve) +basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) { if (__reserve > max_size()) this->__throw_length_error(); @@ -1819,13 +1819,13 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _ __set_long_cap(__cap+1); __set_long_size(__sz); } - traits_type::copy(__p, __s, __sz); + traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz); traits_type::assign(__p[__sz], value_type()); } template void -basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type __sz) +basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) { if (__sz > max_size()) this->__throw_length_error(); @@ -1843,13 +1843,13 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _ __set_long_cap(__cap+1); __set_long_size(__sz); } - traits_type::copy(__p, __s, __sz); + traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz); traits_type::assign(__p[__sz], value_type()); } template _LIBCPP_INLINE_VISIBILITY inline -basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s) +basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -1859,7 +1859,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s) template _LIBCPP_INLINE_VISIBILITY inline -basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, const allocator_type& __a) +basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a) : __r_(__a) { #ifdef _LIBCPP_DEBUG @@ -1870,7 +1870,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, const template _LIBCPP_INLINE_VISIBILITY inline -basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_type __n) +basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -1880,7 +1880,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_ template _LIBCPP_INLINE_VISIBILITY inline -basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_type __n, const allocator_type& __a) +basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a) : __r_(__a) { #ifdef _LIBCPP_DEBUG @@ -1896,7 +1896,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; else - __init(__str.__get_long_pointer(), __str.__get_long_size()); + __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); } template @@ -1906,7 +1906,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; else - __init(__str.__get_long_pointer(), __str.__get_long_size()); + __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1931,7 +1931,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co if (__a == __str.__alloc() || !__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; else - __init(__str.__get_long_pointer(), __str.__get_long_size()); + __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); __str.__zero(); #ifdef _LIBCPP_DEBUG __str.__invalidate_all_iterators(); @@ -1960,7 +1960,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) __set_long_cap(__cap+1); __set_long_size(__n); } - traits_type::assign(__p, __n, __c); + traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c); traits_type::assign(__p[__n], value_type()); } @@ -2098,7 +2098,7 @@ template void basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace (size_type __old_cap, size_type __delta_cap, size_type __old_sz, - size_type __n_copy, size_type __n_del, size_type __n_add, const_pointer __p_new_stuff) + size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff) { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap - 1) @@ -2110,12 +2110,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); __invalidate_all_iterators(); if (__n_copy != 0) - traits_type::copy(__p, __old_p, __n_copy); + traits_type::copy(_VSTD::__to_raw_pointer(__p), + _VSTD::__to_raw_pointer(__old_p), __n_copy); if (__n_add != 0) - traits_type::copy(__p + __n_copy, __p_new_stuff, __n_add); + traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add); size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; if (__sec_cp_sz != 0) - traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz); + traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add, + _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz); if (__old_cap+1 != __min_cap) __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); __set_long_pointer(__p); @@ -2140,10 +2142,13 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); __invalidate_all_iterators(); if (__n_copy != 0) - traits_type::copy(__p, __old_p, __n_copy); + traits_type::copy(_VSTD::__to_raw_pointer(__p), + _VSTD::__to_raw_pointer(__old_p), __n_copy); size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; if (__sec_cp_sz != 0) - traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz); + traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add, + _VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, + __sec_cp_sz); if (__old_cap+1 != __min_cap) __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); __set_long_pointer(__p); @@ -2154,7 +2159,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s, size_type __n) +basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2162,7 +2167,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s, size_type _ size_type __cap = capacity(); if (__cap >= __n) { - pointer __p = __get_pointer(); + value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); traits_type::move(__p, __s, __n); traits_type::assign(__p[__n], value_type()); __set_size(__n); @@ -2188,7 +2193,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) } else __invalidate_iterators_past(__n); - pointer __p = __get_pointer(); + value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); traits_type::assign(__p, __n, __c); traits_type::assign(__p[__n], value_type()); __set_size(__n); @@ -2330,7 +2335,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s) +basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2342,7 +2347,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s) template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s, size_type __n) +basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2353,7 +2358,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s, size_type _ { if (__n) { - pointer __p = __get_pointer(); + value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); traits_type::copy(__p + __sz, __s, __n); __sz += __n; __set_size(__sz); @@ -2376,7 +2381,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) if (__cap - __sz < __n) __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0); pointer __p = __get_pointer(); - traits_type::assign(__p + __sz, __n, __c); + traits_type::assign(_VSTD::__to_raw_pointer(__p) + __sz, __n, __c); __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); @@ -2481,7 +2486,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s) +basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2493,7 +2498,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s) template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer __s, size_type __n) +basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2506,7 +2511,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer { if (__n) { - pointer __p = __get_pointer(); + value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __pos; if (__n_move != 0) { @@ -2535,10 +2540,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n if (__n) { size_type __cap = capacity(); - pointer __p; + value_type* __p; if (__cap - __sz >= __n) { - __p = __get_pointer(); + __p = _VSTD::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __pos; if (__n_move != 0) traits_type::move(__p + __pos + __n, __p + __pos, __n_move); @@ -2546,7 +2551,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n else { __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n); - __p = __get_long_pointer(); + __p = _VSTD::__to_raw_pointer(__get_long_pointer()); } traits_type::assign(__p + __pos, __n, __c); __sz += __n; @@ -2590,10 +2595,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward size_type __n = static_cast(_VSTD::distance(__first, __last)); if (__n) { - pointer __p; + value_type* __p; if (__cap - __sz >= __n) { - __p = __get_pointer(); + __p = _VSTD::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __ip; if (__n_move != 0) traits_type::move(__p + __ip + __n, __p + __ip, __n_move); @@ -2601,7 +2606,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward else { __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n); - __p = __get_long_pointer(); + __p = _VSTD::__to_raw_pointer(__get_long_pointer()); } __sz += __n; __set_size(__sz); @@ -2633,7 +2638,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_ template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer __s) +basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2648,15 +2653,15 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty size_type __ip = static_cast(__pos - begin()); size_type __sz = size(); size_type __cap = capacity(); - pointer __p; + value_type* __p; if (__cap == __sz) { __grow_by(__cap, 1, __sz, __ip, 0, 1); - __p = __get_long_pointer(); + __p = _VSTD::__to_raw_pointer(__get_long_pointer()); } else { - __p = __get_pointer(); + __p = _VSTD::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __ip; if (__n_move != 0) traits_type::move(__p + __ip + 1, __p + __ip, __n_move); @@ -2681,7 +2686,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2) +basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2693,7 +2698,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ size_type __cap = capacity(); if (__cap - __sz + __n1 >= __n2) { - pointer __p = __get_pointer(); + value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); if (__n1 != __n2) { size_type __n_move = __sz - __pos - __n1; @@ -2742,10 +2747,10 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ this->__throw_out_of_range(); __n1 = _VSTD::min(__n1, __sz - __pos); size_type __cap = capacity(); - pointer __p; + value_type* __p; if (__cap - __sz + __n1 >= __n2) { - __p = __get_pointer(); + __p = _VSTD::__to_raw_pointer(__get_pointer()); if (__n1 != __n2) { size_type __n_move = __sz - __pos - __n1; @@ -2756,7 +2761,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __ else { __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2); - __p = __get_long_pointer(); + __p = _VSTD::__to_raw_pointer(__get_long_pointer()); } traits_type::assign(__p + __pos, __n2, __c); __sz += __n2 - __n1; @@ -2815,7 +2820,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _ template basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const_pointer __s) +basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -2835,7 +2840,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it template _LIBCPP_INLINE_VISIBILITY inline basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n) +basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) { return replace(static_cast(__i1 - begin()), static_cast(__i2 - __i1), __s, __n); } @@ -2843,7 +2848,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it template _LIBCPP_INLINE_VISIBILITY inline basic_string<_CharT, _Traits, _Allocator>& -basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s) +basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s) { return replace(static_cast(__i1 - begin()), static_cast(__i2 - __i1), __s); } @@ -2867,7 +2872,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) this->__throw_out_of_range(); if (__n) { - pointer __p = __get_pointer(); + value_type* __p = _VSTD::__to_raw_pointer(__get_pointer()); __n = _VSTD::min(__n, __sz - __pos); size_type __n_move = __sz - __pos - __n; if (__n_move != 0) @@ -3025,7 +3030,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg) return; } #else // _LIBCPP_NO_EXCEPTIONS - if (__new_data == 0) + if (__new_data == nullptr) return; #endif // _LIBCPP_NO_EXCEPTIONS } @@ -3033,7 +3038,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg) __was_long = __is_long(); __p = __get_pointer(); } - traits_type::copy(__new_data, __p, size()+1); + traits_type::copy(_VSTD::__to_raw_pointer(__new_data), + _VSTD::__to_raw_pointer(__p), size()+1); if (__was_long) __alloc_traits::deallocate(__alloc(), __p, __cap+1); if (__now_long) @@ -3134,7 +3140,7 @@ basic_string<_CharT, _Traits, _Allocator>::back() const template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::copy(pointer __s, size_type __n, size_type __pos) const +basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const { size_type __sz = size(); if (__pos > __sz) @@ -3180,7 +3186,7 @@ struct _LIBCPP_HIDDEN __traits_eq template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3192,8 +3198,8 @@ basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s, return npos; if (__n == 0) return __pos; - const_pointer __p = data(); - const_pointer __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, + const value_type* __p = data(); + const value_type* __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, __traits_eq()); if (__r == __p + __sz) return npos; @@ -3212,7 +3218,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, template _LIBCPP_INLINE_VISIBILITY inline typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG @@ -3229,8 +3235,8 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, size_type __sz = size(); if (__pos >= __sz) return npos; - const_pointer __p = data(); - const_pointer __r = traits_type::find(__p + __pos, __sz - __pos, __c); + const value_type* __p = data(); + const value_type* __r = traits_type::find(__p + __pos, __sz - __pos, __c); if (__r == 0) return npos; return static_cast(__r - __p); @@ -3240,7 +3246,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3253,8 +3259,8 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s, __pos += __n; else __pos = __sz; - const_pointer __p = data(); - const_pointer __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, + const value_type* __p = data(); + const value_type* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, __traits_eq()); if (__n > 0 && __r == __p + __pos) return npos; @@ -3273,7 +3279,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, template _LIBCPP_INLINE_VISIBILITY inline typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG @@ -3294,8 +3300,8 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, ++__pos; else __pos = __sz; - const_pointer __p = data(); - for (const_pointer __ps = __p + __pos; __ps != __p;) + const value_type* __p = data(); + for (const value_type* __ps = __p + __pos; __ps != __p;) { if (traits_type::eq(*--__ps, __c)) return static_cast(__ps - __p); @@ -3308,7 +3314,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3318,8 +3324,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s, size_type __sz = size(); if (__pos >= __sz || __n == 0) return npos; - const_pointer __p = data(); - const_pointer __r = _VSTD::find_first_of(__p + __pos, __p + __sz, __s, + const value_type* __p = data(); + const value_type* __r = _VSTD::find_first_of(__p + __pos, __p + __sz, __s, __s + __n, __traits_eq()); if (__r == __p + __sz) return npos; @@ -3338,7 +3344,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __s template _LIBCPP_INLINE_VISIBILITY inline typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG @@ -3360,7 +3366,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c, template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3374,10 +3380,10 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s, ++__pos; else __pos = __sz; - const_pointer __p = data(); - for (const_pointer __ps = __p + __pos; __ps != __p;) + const value_type* __p = data(); + for (const value_type* __ps = __p + __pos; __ps != __p;) { - const_pointer __r = traits_type::find(__s, __n, *--__ps); + const value_type* __r = traits_type::find(__s, __n, *--__ps); if (__r) return static_cast(__ps - __p); } @@ -3397,7 +3403,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __st template _LIBCPP_INLINE_VISIBILITY inline typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG @@ -3419,7 +3425,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c, template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3429,9 +3435,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s, size_type __sz = size(); if (__pos < __sz) { - const_pointer __p = data(); - const_pointer __pe = __p + __sz; - for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps) + const value_type* __p = data(); + const value_type* __pe = __p + __sz; + for (const value_type* __ps = __p + __pos; __ps != __pe; ++__ps) if (traits_type::find(__s, __n, *__ps) == 0) return static_cast(__ps - __p); } @@ -3450,7 +3456,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& template _LIBCPP_INLINE_VISIBILITY inline typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG @@ -3468,9 +3474,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, size_type __sz = size(); if (__pos < __sz) { - const_pointer __p = data(); - const_pointer __pe = __p + __sz; - for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps) + const value_type* __p = data(); + const value_type* __pe = __p + __sz; + for (const value_type* __ps = __p + __pos; __ps != __pe; ++__ps) if (!traits_type::eq(*__ps, __c)) return static_cast(__ps - __p); } @@ -3481,7 +3487,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, template typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { @@ -3493,8 +3499,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s, ++__pos; else __pos = __sz; - const_pointer __p = data(); - for (const_pointer __ps = __p + __pos; __ps != __p;) + const value_type* __p = data(); + for (const value_type* __ps = __p + __pos; __ps != __p;) if (traits_type::find(__s, __n, *--__ps) == 0) return static_cast(__ps - __p); return npos; @@ -3512,7 +3518,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& template _LIBCPP_INLINE_VISIBILITY inline typename basic_string<_CharT, _Traits, _Allocator>::size_type -basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s, +basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG @@ -3532,8 +3538,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c, ++__pos; else __pos = __sz; - const_pointer __p = data(); - for (const_pointer __ps = __p + __pos; __ps != __p;) + const value_type* __p = data(); + for (const value_type* __ps = __p + __pos; __ps != __p;) if (!traits_type::eq(*--__ps, __c)) return static_cast(__ps - __p); return npos; @@ -3586,7 +3592,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, template int -basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT +basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -3598,7 +3604,7 @@ template int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, - const_pointer __s) const + const value_type* __s) const { #ifdef _LIBCPP_DEBUG assert(__s != 0); @@ -3610,7 +3616,7 @@ template int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, - const_pointer __s, + const value_type* __s, size_type __n2) const { #ifdef _LIBCPP_DEBUG diff --git a/test/strings/basic.string/min_allocator.h b/test/strings/basic.string/min_allocator.h new file mode 100644 index 00000000..c0d28e5f --- /dev/null +++ b/test/strings/basic.string/min_allocator.h @@ -0,0 +1,252 @@ +#ifndef MIN_ALLOCATOR_H +#define MIN_ALLOCATOR_H + +#if __cplusplus >= 201103L + +#include + +template class min_pointer; +template class min_pointer; +template <> class min_pointer; +template <> class min_pointer; +template class min_allocator; + +template <> +class min_pointer +{ + const void* ptr_; +public: + min_pointer() noexcept = default; + min_pointer(std::nullptr_t) : ptr_(nullptr) {} + template + min_pointer(min_pointer p) : ptr_(p.ptr_) {} + + explicit operator bool() const {return ptr_ != nullptr;} + + friend bool operator==(min_pointer x, min_pointer y) {return x.ptr_ == y.ptr_;} + friend bool operator!=(min_pointer x, min_pointer y) {return !(x == y);} + template friend class min_pointer; +}; + +template <> +class min_pointer +{ + void* ptr_; +public: + min_pointer() noexcept = default; + min_pointer(std::nullptr_t) : ptr_(nullptr) {} + template ::value + >::type + > + min_pointer(min_pointer p) : ptr_(p.ptr_) {} + + explicit operator bool() const {return ptr_ != nullptr;} + + friend bool operator==(min_pointer x, min_pointer y) {return x.ptr_ == y.ptr_;} + friend bool operator!=(min_pointer x, min_pointer y) {return !(x == y);} + template friend class min_pointer; +}; + +template +class min_pointer +{ + T* ptr_; + + explicit min_pointer(T* p) : ptr_(p) {} +public: + min_pointer() noexcept = default; + min_pointer(std::nullptr_t) : ptr_(nullptr) {} + explicit min_pointer(min_pointer p) : ptr_(static_cast(p.ptr_)) {} + + explicit operator bool() const {return ptr_ != nullptr;} + + typedef std::ptrdiff_t difference_type; + typedef T& reference; + typedef T* pointer; + typedef T value_type; + typedef std::random_access_iterator_tag iterator_category; + + reference operator*() const {return *ptr_;} + pointer operator->() const {return ptr_;} + + min_pointer& operator++() {++ptr_; return *this;} + min_pointer operator++(int) {min_pointer tmp(*this); ++ptr_; return tmp;} + + min_pointer& operator--() {--ptr_; return *this;} + min_pointer operator--(int) {min_pointer tmp(*this); --ptr_; return tmp;} + + min_pointer& operator+=(difference_type n) {ptr_ += n; return *this;} + min_pointer& operator-=(difference_type n) {ptr_ -= n; return *this;} + + min_pointer operator+(difference_type n) const + { + min_pointer tmp(*this); + tmp += n; + return tmp; + } + + friend min_pointer operator+(difference_type n, min_pointer x) + { + return x + n; + } + + min_pointer operator-(difference_type n) const + { + min_pointer tmp(*this); + tmp -= n; + return tmp; + } + + friend difference_type operator-(min_pointer x, min_pointer y) + { + return x.ptr_ - y.ptr_; + } + + reference operator[](difference_type n) const {return ptr_[n];} + + friend bool operator< (min_pointer x, min_pointer y) {return x.ptr_ < y.ptr_;} + friend bool operator> (min_pointer x, min_pointer y) {return y < x;} + friend bool operator<=(min_pointer x, min_pointer y) {return !(y < x);} + friend bool operator>=(min_pointer x, min_pointer y) {return !(x < y);} + + static min_pointer pointer_to(T& t) {return min_pointer(std::addressof(t));} + + friend bool operator==(min_pointer x, min_pointer y) {return x.ptr_ == y.ptr_;} + friend bool operator!=(min_pointer x, min_pointer y) {return !(x == y);} + template friend class min_pointer; + template friend class min_allocator; +}; + +template +class min_pointer +{ + const T* ptr_; + + explicit min_pointer(const T* p) : ptr_(p) {} +public: + min_pointer() noexcept = default; + min_pointer(std::nullptr_t) : ptr_(nullptr) {} + min_pointer(min_pointer p) : ptr_(p.ptr_) {} + explicit min_pointer(min_pointer p) : ptr_(static_cast(p.ptr_)) {} + + explicit operator bool() const {return ptr_ != nullptr;} + + typedef std::ptrdiff_t difference_type; + typedef const T& reference; + typedef const T* pointer; + typedef const T value_type; + typedef std::random_access_iterator_tag iterator_category; + + reference operator*() const {return *ptr_;} + pointer operator->() const {return ptr_;} + + min_pointer& operator++() {++ptr_; return *this;} + min_pointer operator++(int) {min_pointer tmp(*this); ++ptr_; return tmp;} + + min_pointer& operator--() {--ptr_; return *this;} + min_pointer operator--(int) {min_pointer tmp(*this); --ptr_; return tmp;} + + min_pointer& operator+=(difference_type n) {ptr_ += n; return *this;} + min_pointer& operator-=(difference_type n) {ptr_ -= n; return *this;} + + min_pointer operator+(difference_type n) const + { + min_pointer tmp(*this); + tmp += n; + return tmp; + } + + friend min_pointer operator+(difference_type n, min_pointer x) + { + return x + n; + } + + min_pointer operator-(difference_type n) const + { + min_pointer tmp(*this); + tmp -= n; + return tmp; + } + + friend difference_type operator-(min_pointer x, min_pointer y) + { + return x.ptr_ - y.ptr_; + } + + reference operator[](difference_type n) const {return ptr_[n];} + + friend bool operator< (min_pointer x, min_pointer y) {return x.ptr_ < y.ptr_;} + friend bool operator> (min_pointer x, min_pointer y) {return y < x;} + friend bool operator<=(min_pointer x, min_pointer y) {return !(y < x);} + friend bool operator>=(min_pointer x, min_pointer y) {return !(x < y);} + + static min_pointer pointer_to(const T& t) {return min_pointer(std::addressof(t));} + + friend bool operator==(min_pointer x, min_pointer y) {return x.ptr_ == y.ptr_;} + friend bool operator!=(min_pointer x, min_pointer y) {return !(x == y);} + template friend class min_pointer; +}; + +template +inline +bool +operator==(min_pointer x, std::nullptr_t) +{ + return !static_cast(x); +} + +template +inline +bool +operator==(std::nullptr_t, min_pointer x) +{ + return !static_cast(x); +} + +template +inline +bool +operator!=(min_pointer x, std::nullptr_t) +{ + return static_cast(x); +} + +template +inline +bool +operator!=(std::nullptr_t, min_pointer x) +{ + return static_cast(x); +} + +template +class min_allocator +{ +public: + typedef T value_type; + typedef min_pointer pointer; + + min_allocator() = default; + template + min_allocator(min_allocator) {} + + pointer allocate(std::ptrdiff_t n) + { + return pointer(static_cast(::operator new(n*sizeof(T)))); + } + + void deallocate(pointer p, std::ptrdiff_t) + { + return ::operator delete(p.ptr_); + } + + friend bool operator==(min_allocator, min_allocator) {return true;} + friend bool operator!=(min_allocator x, min_allocator y) {return !(x == y);} +}; + +#endif // __cplusplus >= 201103L + +#endif // MIN_ALLOCATOR_H diff --git a/test/strings/basic.string/string.access/at.pass.cpp b/test/strings/basic.string/string.access/at.pass.cpp index 5be117b4..e24b560d 100644 --- a/test/strings/basic.string/string.access/at.pass.cpp +++ b/test/strings/basic.string/string.access/at.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s, typename S::size_type pos) @@ -35,10 +37,22 @@ test(S s, typename S::size_type pos) int main() { + { typedef std::string S; test(S(), 0); test(S("123"), 0); test(S("123"), 1); test(S("123"), 2); test(S("123"), 3); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 0); + test(S("123"), 0); + test(S("123"), 1); + test(S("123"), 2); + test(S("123"), 3); + } +#endif } diff --git a/test/strings/basic.string/string.access/back.pass.cpp b/test/strings/basic.string/string.access/back.pass.cpp index 1f70b445..f241d4d9 100644 --- a/test/strings/basic.string/string.access/back.pass.cpp +++ b/test/strings/basic.string/string.access/back.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -28,7 +30,16 @@ test(S s) int main() { + { typedef std::string S; test(S("1")); test(S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S("1")); + test(S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.access/front.pass.cpp b/test/strings/basic.string/string.access/front.pass.cpp index e49ed691..ecfafb54 100644 --- a/test/strings/basic.string/string.access/front.pass.cpp +++ b/test/strings/basic.string/string.access/front.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -28,7 +30,16 @@ test(S s) int main() { + { typedef std::string S; test(S("1")); test(S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S("1")); + test(S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.access/index.pass.cpp b/test/strings/basic.string/string.access/index.pass.cpp index 50ee6fe0..b5643533 100644 --- a/test/strings/basic.string/string.access/index.pass.cpp +++ b/test/strings/basic.string/string.access/index.pass.cpp @@ -15,8 +15,11 @@ #include #include +#include "../min_allocator.h" + int main() { + { typedef std::string S; S s("0123456789"); const S& cs = s; @@ -28,4 +31,20 @@ int main() assert(cs[cs.size()] == '\0'); const S s2 = S(); assert(s2[0] == '\0'); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("0123456789"); + const S& cs = s; + for (S::size_type i = 0; i < cs.size(); ++i) + { + assert(s[i] == '0' + i); + assert(cs[i] == s[i]); + } + assert(cs[cs.size()] == '\0'); + const S s2 = S(); + assert(s2[0] == '\0'); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/capacity.pass.cpp b/test/strings/basic.string/string.capacity/capacity.pass.cpp index 67ef152a..22ca1f3b 100644 --- a/test/strings/basic.string/string.capacity/capacity.pass.cpp +++ b/test/strings/basic.string/string.capacity/capacity.pass.cpp @@ -15,6 +15,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -36,6 +37,7 @@ test(S s) int main() { + { typedef std::basic_string, test_allocator > S; S s; test(s); @@ -45,4 +47,12 @@ int main() s.assign(100, 'a'); s.erase(50); test(s); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s; + assert(s.capacity() > 0); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/clear.pass.cpp b/test/strings/basic.string/string.capacity/clear.pass.cpp index 5f8cf6f0..ba8ba245 100644 --- a/test/strings/basic.string/string.capacity/clear.pass.cpp +++ b/test/strings/basic.string/string.capacity/clear.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -24,6 +26,7 @@ test(S s) int main() { + { typedef std::string S; S s; test(s); @@ -35,4 +38,20 @@ int main() s.assign(100, 'a'); s.erase(50); test(s); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s; + test(s); + + s.assign(10, 'a'); + s.erase(5); + test(s); + + s.assign(100, 'a'); + s.erase(50); + test(s); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/empty.pass.cpp b/test/strings/basic.string/string.capacity/empty.pass.cpp index c79ac777..29f62cdf 100644 --- a/test/strings/basic.string/string.capacity/empty.pass.cpp +++ b/test/strings/basic.string/string.capacity/empty.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -23,8 +25,18 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); test(S("12345678901234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + test(S("12345678901234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/length.pass.cpp b/test/strings/basic.string/string.capacity/length.pass.cpp index 756c1412..5ddb5c1e 100644 --- a/test/strings/basic.string/string.capacity/length.pass.cpp +++ b/test/strings/basic.string/string.capacity/length.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -23,8 +25,18 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); test(S("12345678901234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + test(S("12345678901234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/max_size.pass.cpp b/test/strings/basic.string/string.capacity/max_size.pass.cpp index 59387c63..e016bba5 100644 --- a/test/strings/basic.string/string.capacity/max_size.pass.cpp +++ b/test/strings/basic.string/string.capacity/max_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -23,8 +25,18 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); test(S("12345678901234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + test(S("12345678901234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/reserve.pass.cpp b/test/strings/basic.string/string.capacity/reserve.pass.cpp index 0689a8b4..6fdb457e 100644 --- a/test/strings/basic.string/string.capacity/reserve.pass.cpp +++ b/test/strings/basic.string/string.capacity/reserve.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -50,6 +52,7 @@ test(S s, typename S::size_type res_arg) int main() { + { typedef std::string S; { S s; @@ -78,4 +81,37 @@ int main() test(s, 100); test(s, S::npos); } + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + { + S s; + test(s); + + s.assign(10, 'a'); + s.erase(5); + test(s); + + s.assign(100, 'a'); + s.erase(50); + test(s); + } + { + S s; + test(s, 5); + test(s, 10); + test(s, 50); + } + { + S s(100, 'a'); + s.erase(50); + test(s, 5); + test(s, 10); + test(s, 50); + test(s, 100); + test(s, S::npos); + } + } +#endif } diff --git a/test/strings/basic.string/string.capacity/resize_size.pass.cpp b/test/strings/basic.string/string.capacity/resize_size.pass.cpp index 723c1256..d1b66a41 100644 --- a/test/strings/basic.string/string.capacity/resize_size.pass.cpp +++ b/test/strings/basic.string/string.capacity/resize_size.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s, typename S::size_type n, S expected) @@ -34,6 +36,7 @@ test(S s, typename S::size_type n, S expected) int main() { + { typedef std::string S; test(S(), 0, S()); test(S(), 1, S(1, '\0')); @@ -51,4 +54,26 @@ int main() test(S("12345678901234567890123456789012345678901234567890"), 60, S("12345678901234567890123456789012345678901234567890\0\0\0\0\0\0\0\0\0\0", 60)); test(S(), S::npos, S("not going to happen")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 0, S()); + test(S(), 1, S(1, '\0')); + test(S(), 10, S(10, '\0')); + test(S(), 100, S(100, '\0')); + test(S("12345"), 0, S()); + test(S("12345"), 2, S("12")); + test(S("12345"), 5, S("12345")); + test(S("12345"), 15, S("12345\0\0\0\0\0\0\0\0\0\0", 15)); + test(S("12345678901234567890123456789012345678901234567890"), 0, S()); + test(S("12345678901234567890123456789012345678901234567890"), 10, + S("1234567890")); + test(S("12345678901234567890123456789012345678901234567890"), 50, + S("12345678901234567890123456789012345678901234567890")); + test(S("12345678901234567890123456789012345678901234567890"), 60, + S("12345678901234567890123456789012345678901234567890\0\0\0\0\0\0\0\0\0\0", 60)); + test(S(), S::npos, S("not going to happen")); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp index f2177656..9fb0c8cc 100644 --- a/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp +++ b/test/strings/basic.string/string.capacity/resize_size_char.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s, typename S::size_type n, typename S::value_type c, S expected) @@ -34,6 +36,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected) int main() { + { typedef std::string S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S("a")); @@ -51,4 +54,26 @@ int main() test(S("12345678901234567890123456789012345678901234567890"), 60, 'a', S("12345678901234567890123456789012345678901234567890aaaaaaaaaa")); test(S(), S::npos, 'a', S("not going to happen")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 0, 'a', S()); + test(S(), 1, 'a', S("a")); + test(S(), 10, 'a', S(10, 'a')); + test(S(), 100, 'a', S(100, 'a')); + test(S("12345"), 0, 'a', S()); + test(S("12345"), 2, 'a', S("12")); + test(S("12345"), 5, 'a', S("12345")); + test(S("12345"), 15, 'a', S("12345aaaaaaaaaa")); + test(S("12345678901234567890123456789012345678901234567890"), 0, 'a', S()); + test(S("12345678901234567890123456789012345678901234567890"), 10, 'a', + S("1234567890")); + test(S("12345678901234567890123456789012345678901234567890"), 50, 'a', + S("12345678901234567890123456789012345678901234567890")); + test(S("12345678901234567890123456789012345678901234567890"), 60, 'a', + S("12345678901234567890123456789012345678901234567890aaaaaaaaaa")); + test(S(), S::npos, 'a', S("not going to happen")); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp index e756f3c1..310cceca 100644 --- a/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp +++ b/test/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -29,6 +31,7 @@ test(S s) int main() { + { typedef std::string S; S s; test(s); @@ -40,4 +43,20 @@ int main() s.assign(100, 'a'); s.erase(50); test(s); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s; + test(s); + + s.assign(10, 'a'); + s.erase(5); + test(s); + + s.assign(100, 'a'); + s.erase(50); + test(s); + } +#endif } diff --git a/test/strings/basic.string/string.capacity/size.pass.cpp b/test/strings/basic.string/string.capacity/size.pass.cpp index 0acbefba..9d51ca17 100644 --- a/test/strings/basic.string/string.capacity/size.pass.cpp +++ b/test/strings/basic.string/string.capacity/size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s, typename S::size_type c) @@ -23,8 +25,18 @@ test(const S& s, typename S::size_type c) int main() { + { typedef std::string S; test(S(), 0); test(S("123"), 3); test(S("12345678901234567890123456789012345678901234567890"), 50); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 0); + test(S("123"), 3); + test(S("12345678901234567890123456789012345678901234567890"), 50); + } +#endif } diff --git a/test/strings/basic.string/string.cons/alloc.pass.cpp b/test/strings/basic.string/string.cons/alloc.pass.cpp index 8eb9c844..3a8c5713 100644 --- a/test/strings/basic.string/string.cons/alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -38,7 +39,36 @@ test() } } +#if __cplusplus >= 201103L + +template +void +test2() +{ + { + S s; + assert(s.__invariants()); + assert(s.data()); + assert(s.size() == 0); + assert(s.capacity() >= s.size()); + assert(s.get_allocator() == typename S::allocator_type()); + } + { + S s(typename S::allocator_type{}); + assert(s.__invariants()); + assert(s.data()); + assert(s.size() == 0); + assert(s.capacity() >= s.size()); + assert(s.get_allocator() == typename S::allocator_type()); + } +} + +#endif + int main() { test, test_allocator > >(); +#if __cplusplus >= 201103L + test2, min_allocator > >(); +#endif } diff --git a/test/strings/basic.string/string.cons/char_assignment.pass.cpp b/test/strings/basic.string/string.cons/char_assignment.pass.cpp index 2a5afa2a..4d750d85 100644 --- a/test/strings/basic.string/string.cons/char_assignment.pass.cpp +++ b/test/strings/basic.string/string.cons/char_assignment.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s1, typename S::value_type s2) @@ -28,9 +30,20 @@ test(S s1, typename S::value_type s2) int main() { + { typedef std::string S; test(S(), 'a'); test(S("1"), 'a'); test(S("123456789"), 'a'); test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), 'a'); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 'a'); + test(S("1"), 'a'); + test(S("123456789"), 'a'); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), 'a'); + } +#endif } diff --git a/test/strings/basic.string/string.cons/copy.pass.cpp b/test/strings/basic.string/string.cons/copy.pass.cpp index c34658f4..3ebb2286 100644 --- a/test/strings/basic.string/string.cons/copy.pass.cpp +++ b/test/strings/basic.string/string.cons/copy.pass.cpp @@ -15,6 +15,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -29,9 +30,20 @@ test(S s1) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; test(S(A(3))); test(S("1", A(5))); test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7))); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + test(S(A{})); + test(S("1", A())); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A())); + } +#endif } diff --git a/test/strings/basic.string/string.cons/copy_alloc.pass.cpp b/test/strings/basic.string/string.cons/copy_alloc.pass.cpp index 951330c5..693ecf38 100644 --- a/test/strings/basic.string/string.cons/copy_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/copy_alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -29,9 +30,20 @@ test(S s1, const typename S::allocator_type& a) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; test(S(), A(3)); test(S("1"), A(5)); test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + test(S(), A()); + test(S("1"), A()); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A()); + } +#endif } diff --git a/test/strings/basic.string/string.cons/copy_assignment.pass.cpp b/test/strings/basic.string/string.cons/copy_assignment.pass.cpp index f15f2796..10c49e55 100644 --- a/test/strings/basic.string/string.cons/copy_assignment.pass.cpp +++ b/test/strings/basic.string/string.cons/copy_assignment.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s1, const S& s2) @@ -27,6 +29,7 @@ test(S s1, const S& s2) int main() { + { typedef std::string S; test(S(), S()); test(S("1"), S()); @@ -43,4 +46,25 @@ int main() test(S("1234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890"), S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S()); + test(S("1"), S()); + test(S(), S("1")); + test(S("1"), S("2")); + test(S("1"), S("2")); + + test(S(), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + test(S("123456789"), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890123456789012345678901234567890"), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + } +#endif } diff --git a/test/strings/basic.string/string.cons/initializer_list.pass.cpp b/test/strings/basic.string/string.cons/initializer_list.pass.cpp index 430c2acf..7654901b 100644 --- a/test/strings/basic.string/string.cons/initializer_list.pass.cpp +++ b/test/strings/basic.string/string.cons/initializer_list.pass.cpp @@ -15,6 +15,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" int main() { @@ -28,5 +29,18 @@ int main() s = {L'a', L'b', L'c'}; assert(s == L"abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s = {'a', 'b', 'c'}; + assert(s == "abc"); + } + { + typedef std::basic_string, min_allocator> S; + S s; + s = {L'a', L'b', L'c'}; + assert(s == L"abc"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp b/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp index f7ac16f1..6bbf51a8 100644 --- a/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp +++ b/test/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -22,5 +24,13 @@ int main() s = {'a', 'b', 'c'}; assert(s == "abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s; + s = {'a', 'b', 'c'}; + assert(s == "abc"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/strings/basic.string/string.cons/iter_alloc.pass.cpp index c902531a..ebd0974c 100644 --- a/test/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -19,6 +19,7 @@ #include "../test_allocator.h" #include "../input_iterator.h" +#include "../min_allocator.h" template void @@ -38,14 +39,13 @@ test(It first, It last) assert(s2.capacity() >= s2.size()); } -template +template void -test(It first, It last, const test_allocator::value_type>& a) +test(It first, It last, const A& a) { typedef typename std::iterator_traits::value_type charT; - typedef std::basic_string, test_allocator > S; + typedef std::basic_string, A> S; typedef typename S::traits_type T; - typedef typename S::allocator_type A; S s2(first, last, a); assert(s2.__invariants()); assert(s2.size() == std::distance(first, last)); @@ -58,6 +58,7 @@ test(It first, It last, const test_allocator:: int main() { + { typedef test_allocator A; const char* s = "12345678901234567890123456789012345678901234567890"; @@ -84,4 +85,35 @@ int main() test(input_iterator(s), input_iterator(s+50)); test(input_iterator(s), input_iterator(s+50), A(2)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + const char* s = "12345678901234567890123456789012345678901234567890"; + + test(s, s); + test(s, s, A()); + + test(s, s+1); + test(s, s+1, A()); + + test(s, s+10); + test(s, s+10, A()); + + test(s, s+50); + test(s, s+50, A()); + + test(input_iterator(s), input_iterator(s)); + test(input_iterator(s), input_iterator(s), A()); + + test(input_iterator(s), input_iterator(s+1)); + test(input_iterator(s), input_iterator(s+1), A()); + + test(input_iterator(s), input_iterator(s+10)); + test(input_iterator(s), input_iterator(s+10), A()); + + test(input_iterator(s), input_iterator(s+50)); + test(input_iterator(s), input_iterator(s+50), A()); + } +#endif } diff --git a/test/strings/basic.string/string.cons/move.pass.cpp b/test/strings/basic.string/string.cons/move.pass.cpp index 2d33937d..ba68087a 100644 --- a/test/strings/basic.string/string.cons/move.pass.cpp +++ b/test/strings/basic.string/string.cons/move.pass.cpp @@ -17,6 +17,7 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -36,10 +37,21 @@ test(S s0) int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + { typedef test_allocator A; typedef std::basic_string, A> S; test(S(A(3))); test(S("1", A(5))); test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7))); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + test(S(A{})); + test(S("1", A())); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A())); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/strings/basic.string/string.cons/move_alloc.pass.cpp b/test/strings/basic.string/string.cons/move_alloc.pass.cpp index 60d132f2..80aadcb3 100644 --- a/test/strings/basic.string/string.cons/move_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/move_alloc.pass.cpp @@ -17,6 +17,8 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include "../test_allocator.h" +#include "../min_allocator.h" + template void @@ -36,10 +38,21 @@ test(S s0, const typename S::allocator_type& a) int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + { typedef test_allocator A; typedef std::basic_string, A> S; test(S(), A(3)); test(S("1"), A(5)); test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + test(S(), A()); + test(S("1"), A()); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A()); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/strings/basic.string/string.cons/move_assignment.pass.cpp b/test/strings/basic.string/string.cons/move_assignment.pass.cpp index 739f09d1..3e6626b6 100644 --- a/test/strings/basic.string/string.cons/move_assignment.pass.cpp +++ b/test/strings/basic.string/string.cons/move_assignment.pass.cpp @@ -18,6 +18,7 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -36,6 +37,7 @@ test(S s1, S s2) int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + { typedef std::string S; test(S(), S()); test(S("1"), S()); @@ -52,5 +54,26 @@ int main() test(S("1234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890"), S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S()); + test(S("1"), S()); + test(S(), S("1")); + test(S("1"), S("2")); + test(S("1"), S("2")); + + test(S(), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + test(S("123456789"), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890123456789012345678901234567890"), + S("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp index db2f7333..befb143d 100644 --- a/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/pointer_alloc.pass.cpp @@ -17,6 +17,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -34,13 +35,12 @@ test(const charT* s) assert(s2.capacity() >= s2.size()); } -template +template void -test(const charT* s, const test_allocator& a) +test(const charT* s, const A& a) { - typedef std::basic_string, test_allocator > S; + typedef std::basic_string, A> S; typedef typename S::traits_type T; - typedef typename S::allocator_type A; unsigned n = T::length(s); S s2(s, a); assert(s2.__invariants()); @@ -52,6 +52,7 @@ test(const charT* s, const test_allocator& a) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; @@ -66,4 +67,23 @@ int main() test("123456798012345679801234567980123456798012345679801234567980"); test("123456798012345679801234567980123456798012345679801234567980", A(2)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + + test(""); + test("", A()); + + test("1"); + test("1", A()); + + test("1234567980"); + test("1234567980", A()); + + test("123456798012345679801234567980123456798012345679801234567980"); + test("123456798012345679801234567980123456798012345679801234567980", A()); + } +#endif } diff --git a/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp b/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp index 660e1cf1..d035837c 100644 --- a/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp +++ b/test/strings/basic.string/string.cons/pointer_assignment.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s1, const typename S::value_type* s2) @@ -29,6 +31,7 @@ test(S s1, const typename S::value_type* s2) int main() { + { typedef std::string S; test(S(), ""); test(S("1"), ""); @@ -45,4 +48,25 @@ int main() test(S("1234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890"), "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), ""); + test(S("1"), ""); + test(S(), "1"); + test(S("1"), "2"); + test(S("1"), "2"); + + test(S(), + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + test(S("123456789"), + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890123456789012345678901234567890"), + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + } +#endif } diff --git a/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp b/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp index 169e1128..dbfcec7e 100644 --- a/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp @@ -17,6 +17,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -33,13 +34,12 @@ test(const charT* s, unsigned n) assert(s2.capacity() >= s2.size()); } -template +template void -test(const charT* s, unsigned n, const test_allocator& a) +test(const charT* s, unsigned n, const A& a) { - typedef std::basic_string, test_allocator > S; + typedef std::basic_string, A> S; typedef typename S::traits_type T; - typedef typename S::allocator_type A; S s2(s, n, a); assert(s2.__invariants()); assert(s2.size() == n); @@ -50,6 +50,7 @@ test(const charT* s, unsigned n, const test_allocator& a) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; @@ -64,4 +65,23 @@ int main() test("123456798012345679801234567980123456798012345679801234567980", 60); test("123456798012345679801234567980123456798012345679801234567980", 60, A(2)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + + test("", 0); + test("", 0, A()); + + test("1", 1); + test("1", 1, A()); + + test("1234567980", 10); + test("1234567980", 10, A()); + + test("123456798012345679801234567980123456798012345679801234567980", 60); + test("123456798012345679801234567980123456798012345679801234567980", 60, A()); + } +#endif } diff --git a/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp index 6ed5f047..a427d72b 100644 --- a/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/size_char_alloc.pass.cpp @@ -17,6 +17,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -34,13 +35,12 @@ test(unsigned n, charT c) assert(s2.capacity() >= s2.size()); } -template +template void -test(unsigned n, charT c, const test_allocator& a) +test(unsigned n, charT c, const A& a) { - typedef std::basic_string, test_allocator > S; + typedef std::basic_string, A> S; typedef typename S::traits_type T; - typedef typename S::allocator_type A; S s2(n, c, a); assert(s2.__invariants()); assert(s2.size() == n); @@ -67,14 +67,13 @@ test(Tp n, Tp c) assert(s2.capacity() >= s2.size()); } -template +template void -test(Tp n, Tp c, const test_allocator& a) +test(Tp n, Tp c, const A& a) { typedef char charT; - typedef std::basic_string, test_allocator > S; + typedef std::basic_string, A> S; typedef typename S::traits_type T; - typedef typename S::allocator_type A; S s2(n, c, a); assert(s2.__invariants()); assert(s2.size() == n); @@ -86,6 +85,7 @@ test(Tp n, Tp c, const test_allocator& a) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; @@ -103,4 +103,26 @@ int main() test(100, 65); test(100, 65, A(3)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + + test(0, 'a'); + test(0, 'a', A()); + + test(1, 'a'); + test(1, 'a', A()); + + test(10, 'a'); + test(10, 'a', A()); + + test(100, 'a'); + test(100, 'a', A()); + + test(100, 65); + test(100, 65, A()); + } +#endif } diff --git a/test/strings/basic.string/string.cons/substr.pass.cpp b/test/strings/basic.string/string.cons/substr.pass.cpp index 65fbfbd1..16072111 100644 --- a/test/strings/basic.string/string.cons/substr.pass.cpp +++ b/test/strings/basic.string/string.cons/substr.pass.cpp @@ -19,6 +19,7 @@ #include #include "../test_allocator.h" +#include "../min_allocator.h" template void @@ -54,7 +55,7 @@ test(S str, unsigned pos, unsigned n) S s2(str, pos, n); assert(s2.__invariants()); assert(pos <= str.size()); - unsigned rlen = std::min(str.size() - pos, n); + unsigned rlen = std::min(str.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), str.data() + pos, rlen) == 0); assert(s2.get_allocator() == A()); @@ -77,7 +78,7 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a) S s2(str, pos, n, a); assert(s2.__invariants()); assert(pos <= str.size()); - unsigned rlen = std::min(str.size() - pos, n); + unsigned rlen = std::min(str.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), str.data() + pos, rlen) == 0); assert(s2.get_allocator() == a); @@ -91,6 +92,7 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; @@ -127,4 +129,45 @@ int main() test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 1, A(8)); test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 10, A(8)); test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7)), 50, 100, A(8)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + + test(S(A()), 0); + test(S(A()), 1); + test(S("1", A()), 0); + test(S("1", A()), 1); + test(S("1", A()), 2); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 0); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 5); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 500); + + test(S(A()), 0, 0); + test(S(A()), 0, 1); + test(S(A()), 1, 0); + test(S(A()), 1, 1); + test(S(A()), 1, 2); + test(S("1", A()), 0, 0); + test(S("1", A()), 0, 1); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 0); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 1); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 10); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 100); + + test(S(A()), 0, 0, A()); + test(S(A()), 0, 1, A()); + test(S(A()), 1, 0, A()); + test(S(A()), 1, 1, A()); + test(S(A()), 1, 2, A()); + test(S("1", A()), 0, 0, A()); + test(S("1", A()), 0, 1, A()); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 0, A()); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 1, A()); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 10, A()); + test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 100, A()); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/begin.pass.cpp b/test/strings/basic.string/string.iterators/begin.pass.cpp index 10670526..fddd6e67 100644 --- a/test/strings/basic.string/string.iterators/begin.pass.cpp +++ b/test/strings/basic.string/string.iterators/begin.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -31,7 +33,16 @@ test(S s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/cbegin.pass.cpp b/test/strings/basic.string/string.iterators/cbegin.pass.cpp index 5f170de8..9a9f042d 100644 --- a/test/strings/basic.string/string.iterators/cbegin.pass.cpp +++ b/test/strings/basic.string/string.iterators/cbegin.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -28,7 +30,16 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/cend.pass.cpp b/test/strings/basic.string/string.iterators/cend.pass.cpp index fb145d6a..cca6ff62 100644 --- a/test/strings/basic.string/string.iterators/cend.pass.cpp +++ b/test/strings/basic.string/string.iterators/cend.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -24,7 +26,16 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/crbegin.pass.cpp b/test/strings/basic.string/string.iterators/crbegin.pass.cpp index d8b42945..dbff2a57 100644 --- a/test/strings/basic.string/string.iterators/crbegin.pass.cpp +++ b/test/strings/basic.string/string.iterators/crbegin.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -28,7 +30,16 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/crend.pass.cpp b/test/strings/basic.string/string.iterators/crend.pass.cpp index 8413bbe8..109c583f 100644 --- a/test/strings/basic.string/string.iterators/crend.pass.cpp +++ b/test/strings/basic.string/string.iterators/crend.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../min_allocator.h" + template void test(const S& s) @@ -24,7 +26,16 @@ test(const S& s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/end.pass.cpp b/test/strings/basic.string/string.iterators/end.pass.cpp index fc36ba9e..b3732da3 100644 --- a/test/strings/basic.string/string.iterators/end.pass.cpp +++ b/test/strings/basic.string/string.iterators/end.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -33,7 +35,16 @@ test(S s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/rbegin.pass.cpp b/test/strings/basic.string/string.iterators/rbegin.pass.cpp index 7f8c3423..edb02d71 100644 --- a/test/strings/basic.string/string.iterators/rbegin.pass.cpp +++ b/test/strings/basic.string/string.iterators/rbegin.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -31,7 +33,16 @@ test(S s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.iterators/rend.pass.cpp b/test/strings/basic.string/string.iterators/rend.pass.cpp index c0c1070f..630565b7 100644 --- a/test/strings/basic.string/string.iterators/rend.pass.cpp +++ b/test/strings/basic.string/string.iterators/rend.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../min_allocator.h" + template void test(S s) @@ -33,7 +35,16 @@ test(S s) int main() { + { typedef std::string S; test(S()); test(S("123")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S()); + test(S("123")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp index 765e6c3d..0a1a4129 100644 --- a/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -22,5 +24,13 @@ int main() s.append({'a', 'b', 'c'}); assert(s == "123abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("123"); + s.append({'a', 'b', 'c'}); + assert(s == "123abc"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp index e0fc4487..1e5307b2 100644 --- a/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -16,6 +16,7 @@ #include #include "../../input_iterator.h" +#include "../../min_allocator.h" template void @@ -28,6 +29,7 @@ test(S s, It first, It last, S expected) int main() { + { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); @@ -84,4 +86,65 @@ int main() S("12345678901234567890""ABCDEFGHIJ")); test(S("12345678901234567890"), input_iterator(s), input_iterator(s+52), S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + test(S(), s, s, S()); + test(S(), s, s+1, S("A")); + test(S(), s, s+10, S("ABCDEFGHIJ")); + test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), s, s, S("12345")); + test(S("12345"), s, s+1, S("12345A")); + test(S("12345"), s, s+10, S("12345ABCDEFGHIJ")); + test(S("12345"), s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), s, s, S("1234567890")); + test(S("1234567890"), s, s+1, S("1234567890A")); + test(S("1234567890"), s, s+10, S("1234567890ABCDEFGHIJ")); + test(S("1234567890"), s, s+52, S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345678901234567890"), s, s, S("12345678901234567890")); + test(S("12345678901234567890"), s, s+1, S("12345678901234567890""A")); + test(S("12345678901234567890"), s, s+10, S("12345678901234567890""ABCDEFGHIJ")); + test(S("12345678901234567890"), s, s+52, + S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S(), input_iterator(s), input_iterator(s), S()); + test(S(), input_iterator(s), input_iterator(s+1), S("A")); + test(S(), input_iterator(s), input_iterator(s+10), + S("ABCDEFGHIJ")); + test(S(), input_iterator(s), input_iterator(s+52), + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), input_iterator(s), input_iterator(s), + S("12345")); + test(S("12345"), input_iterator(s), input_iterator(s+1), + S("12345A")); + test(S("12345"), input_iterator(s), input_iterator(s+10), + S("12345ABCDEFGHIJ")); + test(S("12345"), input_iterator(s), input_iterator(s+52), + S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), input_iterator(s), input_iterator(s), + S("1234567890")); + test(S("1234567890"), input_iterator(s), input_iterator(s+1), + S("1234567890A")); + test(S("1234567890"), input_iterator(s), input_iterator(s+10), + S("1234567890ABCDEFGHIJ")); + test(S("1234567890"), input_iterator(s), input_iterator(s+52), + S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345678901234567890"), input_iterator(s), input_iterator(s), + S("12345678901234567890")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+1), + S("12345678901234567890""A")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+10), + S("12345678901234567890""ABCDEFGHIJ")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+52), + S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp index 5767d62a..ab813612 100644 --- a/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, const typename S::value_type* str, S expected) @@ -26,6 +28,7 @@ test(S s, const typename S::value_type* str, S expected) int main() { + { typedef std::string S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -39,4 +42,22 @@ int main() test(S("12345678901234567890"), "12345", S("1234567890123456789012345")); test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), "", S()); + test(S(), "12345", S("12345")); + test(S(), "12345678901234567890", S("12345678901234567890")); + + test(S("12345"), "", S("12345")); + test(S("12345"), "12345", S("1234512345")); + test(S("12345"), "1234567890", S("123451234567890")); + + test(S("12345678901234567890"), "", S("12345678901234567890")); + test(S("12345678901234567890"), "12345", S("1234567890123456789012345")); + test(S("12345678901234567890"), "12345678901234567890", + S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp index a9feb567..64f7bb6f 100644 --- a/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, const typename S::value_type* str, typename S::size_type n, S expected) @@ -27,6 +29,7 @@ test(S s, const typename S::value_type* str, typename S::size_type n, S expected int main() { + { typedef std::string S; test(S(), "", 0, S()); test(S(), "12345", 3, S("123")); @@ -44,4 +47,26 @@ int main() test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345")); test(S("12345678901234567890"), "12345678901234567890", 20, S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), "", 0, S()); + test(S(), "12345", 3, S("123")); + test(S(), "12345", 4, S("1234")); + test(S(), "12345678901234567890", 0, S()); + test(S(), "12345678901234567890", 1, S("1")); + test(S(), "12345678901234567890", 3, S("123")); + test(S(), "12345678901234567890", 20, S("12345678901234567890")); + + test(S("12345"), "", 0, S("12345")); + test(S("12345"), "12345", 5, S("1234512345")); + test(S("12345"), "1234567890", 10, S("123451234567890")); + + test(S("12345678901234567890"), "", 0, S("12345678901234567890")); + test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345")); + test(S("12345678901234567890"), "12345678901234567890", 20, + S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp index 84e24699..7a6a276f 100644 --- a/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::value_type c, S expected) @@ -25,8 +27,18 @@ test(S s, typename S::value_type c, S expected) int main() { + { typedef std::string S; test(S(), 'a', S(1, 'a')); test(S("12345"), 'a', S("12345a")); test(S("12345678901234567890"), 'a', S("12345678901234567890a")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 'a', S(1, 'a')); + test(S("12345"), 'a', S("12345a")); + test(S("12345678901234567890"), 'a', S("12345678901234567890a")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp index 347eb09e..920a0bc7 100644 --- a/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type n, typename S::value_type c, S expected) @@ -26,6 +28,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected) int main() { + { typedef std::string S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S(1, 'a')); @@ -39,4 +42,22 @@ int main() test(S("12345678901234567890"), 0, 'a', S("12345678901234567890")); test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a")); test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 0, 'a', S()); + test(S(), 1, 'a', S(1, 'a')); + test(S(), 10, 'a', S(10, 'a')); + test(S(), 100, 'a', S(100, 'a')); + + test(S("12345"), 0, 'a', S("12345")); + test(S("12345"), 1, 'a', S("12345a")); + test(S("12345"), 10, 'a', S("12345aaaaaaaaaa")); + + test(S("12345678901234567890"), 0, 'a', S("12345678901234567890")); + test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a")); + test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp index 1f321e0e..2568af4e 100644 --- a/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S str, S expected) @@ -26,6 +28,7 @@ test(S s, S str, S expected) int main() { + { typedef std::string S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -47,4 +50,30 @@ int main() test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S(), S()); + test(S(), S("12345"), S("12345")); + test(S(), S("1234567890"), S("1234567890")); + test(S(), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345"), S(), S("12345")); + test(S("12345"), S("12345"), S("1234512345")); + test(S("12345"), S("1234567890"), S("123451234567890")); + test(S("12345"), S("12345678901234567890"), S("1234512345678901234567890")); + + test(S("1234567890"), S(), S("1234567890")); + test(S("1234567890"), S("12345"), S("123456789012345")); + test(S("1234567890"), S("1234567890"), S("12345678901234567890")); + test(S("1234567890"), S("12345678901234567890"), S("123456789012345678901234567890")); + + test(S("12345678901234567890"), S(), S("12345678901234567890")); + test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345")); + test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); + test(S("12345678901234567890"), S("12345678901234567890"), + S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp index effb5ee3..9f4081f4 100644 --- a/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) @@ -35,6 +37,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) int main() { + { typedef std::string S; test(S(), S(), 0, 0, S()); test(S(), S(), 1, 0, S()); @@ -57,4 +60,31 @@ int main() test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234")); test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("123456789012345678906789012345")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S(), 0, 0, S()); + test(S(), S(), 1, 0, S()); + test(S(), S("12345"), 0, 3, S("123")); + test(S(), S("12345"), 1, 4, S("2345")); + test(S(), S("12345"), 3, 15, S("45")); + test(S(), S("12345"), 5, 15, S("")); + test(S(), S("12345"), 6, 15, S("not happening")); + test(S(), S("12345678901234567890"), 0, 0, S()); + test(S(), S("12345678901234567890"), 1, 1, S("2")); + test(S(), S("12345678901234567890"), 2, 3, S("345")); + test(S(), S("12345678901234567890"), 12, 13, S("34567890")); + test(S(), S("12345678901234567890"), 21, 13, S("not happening")); + + test(S("12345"), S(), 0, 0, S("12345")); + test(S("12345"), S("12345"), 2, 2, S("1234534")); + test(S("12345"), S("1234567890"), 0, 100, S("123451234567890")); + + test(S("12345678901234567890"), S(), 0, 0, S("12345678901234567890")); + test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234")); + test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, + S("123456789012345678906789012345")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp index e27f714a..b2c08341 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -22,5 +24,13 @@ int main() s.assign({'a', 'b', 'c'}); assert(s == "abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("123"); + s.assign({'a', 'b', 'c'}); + assert(s == "abc"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp index 12d994cb..3eefb7b8 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp @@ -16,6 +16,7 @@ #include #include "../../input_iterator.h" +#include "../../min_allocator.h" template void @@ -28,6 +29,7 @@ test(S s, It first, It last, S expected) int main() { + { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), s, s, S()); @@ -84,4 +86,65 @@ int main() S("ABCDEFGHIJ")); test(S("12345678901234567890"), input_iterator(s), input_iterator(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + test(S(), s, s, S()); + test(S(), s, s+1, S("A")); + test(S(), s, s+10, S("ABCDEFGHIJ")); + test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), s, s, S()); + test(S("12345"), s, s+1, S("A")); + test(S("12345"), s, s+10, S("ABCDEFGHIJ")); + test(S("12345"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), s, s, S()); + test(S("1234567890"), s, s+1, S("A")); + test(S("1234567890"), s, s+10, S("ABCDEFGHIJ")); + test(S("1234567890"), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345678901234567890"), s, s, S()); + test(S("12345678901234567890"), s, s+1, S("A")); + test(S("12345678901234567890"), s, s+10, S("ABCDEFGHIJ")); + test(S("12345678901234567890"), s, s+52, + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S(), input_iterator(s), input_iterator(s), S()); + test(S(), input_iterator(s), input_iterator(s+1), S("A")); + test(S(), input_iterator(s), input_iterator(s+10), + S("ABCDEFGHIJ")); + test(S(), input_iterator(s), input_iterator(s+52), + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), input_iterator(s), input_iterator(s), + S()); + test(S("12345"), input_iterator(s), input_iterator(s+1), + S("A")); + test(S("12345"), input_iterator(s), input_iterator(s+10), + S("ABCDEFGHIJ")); + test(S("12345"), input_iterator(s), input_iterator(s+52), + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), input_iterator(s), input_iterator(s), + S()); + test(S("1234567890"), input_iterator(s), input_iterator(s+1), + S("A")); + test(S("1234567890"), input_iterator(s), input_iterator(s+10), + S("ABCDEFGHIJ")); + test(S("1234567890"), input_iterator(s), input_iterator(s+52), + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345678901234567890"), input_iterator(s), input_iterator(s), + S()); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+1), + S("A")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+10), + S("ABCDEFGHIJ")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+52), + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp index 9370666a..f9d06141 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, const typename S::value_type* str, S expected) @@ -26,6 +28,7 @@ test(S s, const typename S::value_type* str, S expected) int main() { + { typedef std::string S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -39,4 +42,22 @@ int main() test(S("12345678901234567890"), "12345", S("12345")); test(S("12345678901234567890"), "12345678901234567890", S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), "", S()); + test(S(), "12345", S("12345")); + test(S(), "12345678901234567890", S("12345678901234567890")); + + test(S("12345"), "", S()); + test(S("12345"), "12345", S("12345")); + test(S("12345"), "1234567890", S("1234567890")); + + test(S("12345678901234567890"), "", S()); + test(S("12345678901234567890"), "12345", S("12345")); + test(S("12345678901234567890"), "12345678901234567890", + S("12345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp index 52020ec9..5a8f9ce0 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, const typename S::value_type* str, typename S::size_type n, S expected) @@ -27,6 +29,7 @@ test(S s, const typename S::value_type* str, typename S::size_type n, S expected int main() { + { typedef std::string S; test(S(), "", 0, S()); test(S(), "12345", 3, S("123")); @@ -44,4 +47,26 @@ int main() test(S("12345678901234567890"), "12345", 5, S("12345")); test(S("12345678901234567890"), "12345678901234567890", 20, S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), "", 0, S()); + test(S(), "12345", 3, S("123")); + test(S(), "12345", 4, S("1234")); + test(S(), "12345678901234567890", 0, S()); + test(S(), "12345678901234567890", 1, S("1")); + test(S(), "12345678901234567890", 3, S("123")); + test(S(), "12345678901234567890", 20, S("12345678901234567890")); + + test(S("12345"), "", 0, S()); + test(S("12345"), "12345", 5, S("12345")); + test(S("12345"), "1234567890", 10, S("1234567890")); + + test(S("12345678901234567890"), "", 0, S()); + test(S("12345678901234567890"), "12345", 5, S("12345")); + test(S("12345678901234567890"), "12345678901234567890", 20, + S("12345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp index 59390e0c..8c8dc622 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/rv_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S str, S expected) @@ -26,6 +28,7 @@ test(S s, S str, S expected) int main() { + { typedef std::string S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -47,4 +50,30 @@ int main() test(S("12345678901234567890"), S("1234567890"), S("1234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S(), S()); + test(S(), S("12345"), S("12345")); + test(S(), S("1234567890"), S("1234567890")); + test(S(), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345"), S(), S()); + test(S("12345"), S("12345"), S("12345")); + test(S("12345"), S("1234567890"), S("1234567890")); + test(S("12345"), S("12345678901234567890"), S("12345678901234567890")); + + test(S("1234567890"), S(), S()); + test(S("1234567890"), S("12345"), S("12345")); + test(S("1234567890"), S("1234567890"), S("1234567890")); + test(S("1234567890"), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345678901234567890"), S(), S()); + test(S("12345678901234567890"), S("12345"), S("12345")); + test(S("12345678901234567890"), S("1234567890"), S("1234567890")); + test(S("12345678901234567890"), S("12345678901234567890"), + S("12345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp index 4bec69bf..48616125 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type n, typename S::value_type c, S expected) @@ -26,6 +28,7 @@ test(S s, typename S::size_type n, typename S::value_type c, S expected) int main() { + { typedef std::string S; test(S(), 0, 'a', S()); test(S(), 1, 'a', S(1, 'a')); @@ -39,4 +42,22 @@ int main() test(S("12345678901234567890"), 0, 'a', S()); test(S("12345678901234567890"), 1, 'a', S(1, 'a')); test(S("12345678901234567890"), 10, 'a', S(10, 'a')); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 0, 'a', S()); + test(S(), 1, 'a', S(1, 'a')); + test(S(), 10, 'a', S(10, 'a')); + test(S(), 100, 'a', S(100, 'a')); + + test(S("12345"), 0, 'a', S()); + test(S("12345"), 1, 'a', S(1, 'a')); + test(S("12345"), 10, 'a', S(10, 'a')); + + test(S("12345678901234567890"), 0, 'a', S()); + test(S("12345678901234567890"), 1, 'a', S(1, 'a')); + test(S("12345678901234567890"), 10, 'a', S(10, 'a')); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/string.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/string.pass.cpp index f38f2ccf..f58a8a49 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S str, S expected) @@ -26,6 +28,7 @@ test(S s, S str, S expected) int main() { + { typedef std::string S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -47,4 +50,30 @@ int main() test(S("12345678901234567890"), S("1234567890"), S("1234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S(), S()); + test(S(), S("12345"), S("12345")); + test(S(), S("1234567890"), S("1234567890")); + test(S(), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345"), S(), S()); + test(S("12345"), S("12345"), S("12345")); + test(S("12345"), S("1234567890"), S("1234567890")); + test(S("12345"), S("12345678901234567890"), S("12345678901234567890")); + + test(S("1234567890"), S(), S()); + test(S("1234567890"), S("12345"), S("12345")); + test(S("1234567890"), S("1234567890"), S("1234567890")); + test(S("1234567890"), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345678901234567890"), S(), S()); + test(S("12345678901234567890"), S("12345"), S("12345")); + test(S("12345678901234567890"), S("1234567890"), S("1234567890")); + test(S("12345678901234567890"), S("12345678901234567890"), + S("12345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp index 18138bfd..5430be32 100644 --- a/test/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) @@ -35,6 +37,7 @@ test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) int main() { + { typedef std::string S; test(S(), S(), 0, 0, S()); test(S(), S(), 1, 0, S()); @@ -57,4 +60,31 @@ int main() test(S("12345678901234567890"), S("12345"), 1, 3, S("234")); test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, S("6789012345")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S(), 0, 0, S()); + test(S(), S(), 1, 0, S()); + test(S(), S("12345"), 0, 3, S("123")); + test(S(), S("12345"), 1, 4, S("2345")); + test(S(), S("12345"), 3, 15, S("45")); + test(S(), S("12345"), 5, 15, S("")); + test(S(), S("12345"), 6, 15, S("not happening")); + test(S(), S("12345678901234567890"), 0, 0, S()); + test(S(), S("12345678901234567890"), 1, 1, S("2")); + test(S(), S("12345678901234567890"), 2, 3, S("345")); + test(S(), S("12345678901234567890"), 12, 13, S("34567890")); + test(S(), S("12345678901234567890"), 21, 13, S("not happening")); + + test(S("12345"), S(), 0, 0, S()); + test(S("12345"), S("12345"), 2, 2, S("34")); + test(S("12345"), S("1234567890"), 0, 100, S("1234567890")); + + test(S("12345678901234567890"), S(), 0, 0, S()); + test(S("12345678901234567890"), S("12345"), 1, 3, S("234")); + test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, + S("6789012345")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/test/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp index 7cce8480..f1e5a4ba 100644 --- a/test/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S str, typename S::value_type* s, typename S::size_type n, @@ -39,6 +41,7 @@ test(S str, typename S::value_type* s, typename S::size_type n, int main() { + { typedef std::string S; char s[50]; test(S(""), s, 0, 0); @@ -99,4 +102,69 @@ int main() test(S("abcdefghijklmnopqrst"), s, 20, 0); test(S("abcdefghijklmnopqrst"), s, 20, 1); test(S("abcdefghijklmnopqrst"), s, 21, 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + char s[50]; + test(S(""), s, 0, 0); + test(S(""), s, 0, 1); + test(S(""), s, 1, 0); + test(S("abcde"), s, 0, 0); + test(S("abcde"), s, 0, 1); + test(S("abcde"), s, 0, 2); + test(S("abcde"), s, 0, 4); + test(S("abcde"), s, 0, 5); + test(S("abcde"), s, 0, 6); + test(S("abcde"), s, 1, 0); + test(S("abcde"), s, 1, 1); + test(S("abcde"), s, 1, 2); + test(S("abcde"), s, 1, 4); + test(S("abcde"), s, 1, 5); + test(S("abcde"), s, 2, 0); + test(S("abcde"), s, 2, 1); + test(S("abcde"), s, 2, 2); + test(S("abcde"), s, 2, 4); + test(S("abcde"), s, 4, 0); + test(S("abcde"), s, 4, 1); + test(S("abcde"), s, 4, 2); + test(S("abcde"), s, 5, 0); + test(S("abcde"), s, 5, 1); + test(S("abcde"), s, 6, 0); + test(S("abcdefghijklmnopqrst"), s, 0, 0); + test(S("abcdefghijklmnopqrst"), s, 0, 1); + test(S("abcdefghijklmnopqrst"), s, 0, 2); + test(S("abcdefghijklmnopqrst"), s, 0, 10); + test(S("abcdefghijklmnopqrst"), s, 0, 19); + test(S("abcdefghijklmnopqrst"), s, 0, 20); + test(S("abcdefghijklmnopqrst"), s, 0, 21); + test(S("abcdefghijklmnopqrst"), s, 1, 0); + test(S("abcdefghijklmnopqrst"), s, 1, 1); + test(S("abcdefghijklmnopqrst"), s, 1, 2); + test(S("abcdefghijklmnopqrst"), s, 1, 9); + test(S("abcdefghijklmnopqrst"), s, 1, 18); + test(S("abcdefghijklmnopqrst"), s, 1, 19); + test(S("abcdefghijklmnopqrst"), s, 1, 20); + test(S("abcdefghijklmnopqrst"), s, 2, 0); + test(S("abcdefghijklmnopqrst"), s, 2, 1); + test(S("abcdefghijklmnopqrst"), s, 2, 2); + test(S("abcdefghijklmnopqrst"), s, 2, 9); + test(S("abcdefghijklmnopqrst"), s, 2, 17); + test(S("abcdefghijklmnopqrst"), s, 2, 18); + test(S("abcdefghijklmnopqrst"), s, 2, 19); + test(S("abcdefghijklmnopqrst"), s, 10, 0); + test(S("abcdefghijklmnopqrst"), s, 10, 1); + test(S("abcdefghijklmnopqrst"), s, 10, 2); + test(S("abcdefghijklmnopqrst"), s, 10, 5); + test(S("abcdefghijklmnopqrst"), s, 10, 9); + test(S("abcdefghijklmnopqrst"), s, 10, 10); + test(S("abcdefghijklmnopqrst"), s, 10, 11); + test(S("abcdefghijklmnopqrst"), s, 19, 0); + test(S("abcdefghijklmnopqrst"), s, 19, 1); + test(S("abcdefghijklmnopqrst"), s, 19, 2); + test(S("abcdefghijklmnopqrst"), s, 20, 0); + test(S("abcdefghijklmnopqrst"), s, 20, 1); + test(S("abcdefghijklmnopqrst"), s, 21, 0); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/test/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp index e59c21de..60d54965 100644 --- a/test/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::difference_type pos, S expected) @@ -27,6 +29,7 @@ test(S s, typename S::difference_type pos, S expected) int main() { + { typedef std::string S; test(S("abcde"), 0, S("bcde")); test(S("abcde"), 1, S("acde")); @@ -40,4 +43,22 @@ int main() test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S("abcde"), 0, S("bcde")); + test(S("abcde"), 1, S("acde")); + test(S("abcde"), 2, S("abde")); + test(S("abcde"), 4, S("abcd")); + test(S("abcdefghij"), 0, S("bcdefghij")); + test(S("abcdefghij"), 1, S("acdefghij")); + test(S("abcdefghij"), 5, S("abcdeghij")); + test(S("abcdefghij"), 9, S("abcdefghi")); + test(S("abcdefghijklmnopqrst"), 0, S("bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, S("acdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, S("abcdefghijlmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/test/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp index ddc31083..b9bc6ca1 100644 --- a/test/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::difference_type pos, typename S::difference_type n, S expected) @@ -28,6 +30,7 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe int main() { + { typedef std::string S; test(S(""), 0, 0, S("")); test(S("abcde"), 0, 0, S("abcde")); @@ -83,4 +86,64 @@ int main() test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst")); test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs")); test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, 0, S("")); + test(S("abcde"), 0, 0, S("abcde")); + test(S("abcde"), 0, 1, S("bcde")); + test(S("abcde"), 0, 2, S("cde")); + test(S("abcde"), 0, 4, S("e")); + test(S("abcde"), 0, 5, S("")); + test(S("abcde"), 1, 0, S("abcde")); + test(S("abcde"), 1, 1, S("acde")); + test(S("abcde"), 1, 2, S("ade")); + test(S("abcde"), 1, 3, S("ae")); + test(S("abcde"), 1, 4, S("a")); + test(S("abcde"), 2, 0, S("abcde")); + test(S("abcde"), 2, 1, S("abde")); + test(S("abcde"), 2, 2, S("abe")); + test(S("abcde"), 2, 3, S("ab")); + test(S("abcde"), 4, 0, S("abcde")); + test(S("abcde"), 4, 1, S("abcd")); + test(S("abcde"), 5, 0, S("abcde")); + test(S("abcdefghij"), 0, 0, S("abcdefghij")); + test(S("abcdefghij"), 0, 1, S("bcdefghij")); + test(S("abcdefghij"), 0, 5, S("fghij")); + test(S("abcdefghij"), 0, 9, S("j")); + test(S("abcdefghij"), 0, 10, S("")); + test(S("abcdefghij"), 1, 0, S("abcdefghij")); + test(S("abcdefghij"), 1, 1, S("acdefghij")); + test(S("abcdefghij"), 1, 4, S("afghij")); + test(S("abcdefghij"), 1, 8, S("aj")); + test(S("abcdefghij"), 1, 9, S("a")); + test(S("abcdefghij"), 5, 0, S("abcdefghij")); + test(S("abcdefghij"), 5, 1, S("abcdeghij")); + test(S("abcdefghij"), 5, 2, S("abcdehij")); + test(S("abcdefghij"), 5, 4, S("abcdej")); + test(S("abcdefghij"), 5, 5, S("abcde")); + test(S("abcdefghij"), 9, 0, S("abcdefghij")); + test(S("abcdefghij"), 9, 1, S("abcdefghi")); + test(S("abcdefghij"), 10, 0, S("abcdefghij")); + test(S("abcdefghijklmnopqrst"), 0, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 1, S("bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 10, S("klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 19, S("t")); + test(S("abcdefghijklmnopqrst"), 0, 20, S("")); + test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 1, S("acdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 9, S("aklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 18, S("at")); + test(S("abcdefghijklmnopqrst"), 1, 19, S("a")); + test(S("abcdefghijklmnopqrst"), 10, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghijlmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijpqrst")); + test(S("abcdefghijklmnopqrst"), 10, 9, S("abcdefghijt")); + test(S("abcdefghijklmnopqrst"), 10, 10, S("abcdefghij")); + test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs")); + test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/test/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp index b140b390..aaff5b6d 100644 --- a/test/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S expected) @@ -25,8 +27,18 @@ test(S s, S expected) int main() { + { typedef std::string S; test(S("abcde"), S("abcd")); test(S("abcdefghij"), S("abcdefghi")); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S("abcde"), S("abcd")); + test(S("abcdefghij"), S("abcdefghi")); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrs")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp index 2af55d97..a1c37a90 100644 --- a/test/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type pos, typename S::size_type n, S expected) @@ -67,6 +69,7 @@ test(S s, S expected) int main() { + { typedef std::string S; test(S(""), 0, 0, S("")); test(S(""), 0, 1, S("")); @@ -168,4 +171,110 @@ int main() test(S("abcde"), S("")); test(S("abcdefghij"), S("")); test(S("abcdefghijklmnopqrst"), S("")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, 0, S("")); + test(S(""), 0, 1, S("")); + test(S(""), 1, 0, S("can't happen")); + test(S("abcde"), 0, 0, S("abcde")); + test(S("abcde"), 0, 1, S("bcde")); + test(S("abcde"), 0, 2, S("cde")); + test(S("abcde"), 0, 4, S("e")); + test(S("abcde"), 0, 5, S("")); + test(S("abcde"), 0, 6, S("")); + test(S("abcde"), 1, 0, S("abcde")); + test(S("abcde"), 1, 1, S("acde")); + test(S("abcde"), 1, 2, S("ade")); + test(S("abcde"), 1, 3, S("ae")); + test(S("abcde"), 1, 4, S("a")); + test(S("abcde"), 1, 5, S("a")); + test(S("abcde"), 2, 0, S("abcde")); + test(S("abcde"), 2, 1, S("abde")); + test(S("abcde"), 2, 2, S("abe")); + test(S("abcde"), 2, 3, S("ab")); + test(S("abcde"), 2, 4, S("ab")); + test(S("abcde"), 4, 0, S("abcde")); + test(S("abcde"), 4, 1, S("abcd")); + test(S("abcde"), 4, 2, S("abcd")); + test(S("abcde"), 5, 0, S("abcde")); + test(S("abcde"), 5, 1, S("abcde")); + test(S("abcde"), 6, 0, S("can't happen")); + test(S("abcdefghij"), 0, 0, S("abcdefghij")); + test(S("abcdefghij"), 0, 1, S("bcdefghij")); + test(S("abcdefghij"), 0, 5, S("fghij")); + test(S("abcdefghij"), 0, 9, S("j")); + test(S("abcdefghij"), 0, 10, S("")); + test(S("abcdefghij"), 0, 11, S("")); + test(S("abcdefghij"), 1, 0, S("abcdefghij")); + test(S("abcdefghij"), 1, 1, S("acdefghij")); + test(S("abcdefghij"), 1, 4, S("afghij")); + test(S("abcdefghij"), 1, 8, S("aj")); + test(S("abcdefghij"), 1, 9, S("a")); + test(S("abcdefghij"), 1, 10, S("a")); + test(S("abcdefghij"), 5, 0, S("abcdefghij")); + test(S("abcdefghij"), 5, 1, S("abcdeghij")); + test(S("abcdefghij"), 5, 2, S("abcdehij")); + test(S("abcdefghij"), 5, 4, S("abcdej")); + test(S("abcdefghij"), 5, 5, S("abcde")); + test(S("abcdefghij"), 5, 6, S("abcde")); + test(S("abcdefghij"), 9, 0, S("abcdefghij")); + test(S("abcdefghij"), 9, 1, S("abcdefghi")); + test(S("abcdefghij"), 9, 2, S("abcdefghi")); + test(S("abcdefghij"), 10, 0, S("abcdefghij")); + test(S("abcdefghij"), 10, 1, S("abcdefghij")); + test(S("abcdefghij"), 11, 0, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 0, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 1, S("bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 10, S("klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 19, S("t")); + test(S("abcdefghijklmnopqrst"), 0, 20, S("")); + test(S("abcdefghijklmnopqrst"), 0, 21, S("")); + test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 1, S("acdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 9, S("aklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 18, S("at")); + test(S("abcdefghijklmnopqrst"), 1, 19, S("a")); + test(S("abcdefghijklmnopqrst"), 1, 20, S("a")); + test(S("abcdefghijklmnopqrst"), 10, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghijlmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijpqrst")); + test(S("abcdefghijklmnopqrst"), 10, 9, S("abcdefghijt")); + test(S("abcdefghijklmnopqrst"), 10, 10, S("abcdefghij")); + test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij")); + test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, 1, S("abcdefghijklmnopqrs")); + test(S("abcdefghijklmnopqrst"), 19, 2, S("abcdefghijklmnopqrs")); + test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 21, 0, S("can't happen")); + + test(S(""), 0, S("")); + test(S(""), 1, S("can't happen")); + test(S("abcde"), 0, S("")); + test(S("abcde"), 1, S("a")); + test(S("abcde"), 2, S("ab")); + test(S("abcde"), 4, S("abcd")); + test(S("abcde"), 5, S("abcde")); + test(S("abcde"), 6, S("can't happen")); + test(S("abcdefghij"), 0, S("")); + test(S("abcdefghij"), 1, S("a")); + test(S("abcdefghij"), 5, S("abcde")); + test(S("abcdefghij"), 9, S("abcdefghi")); + test(S("abcdefghij"), 10, S("abcdefghij")); + test(S("abcdefghij"), 11, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 0, S("")); + test(S("abcdefghijklmnopqrst"), 1, S("a")); + test(S("abcdefghijklmnopqrst"), 10, S("abcdefghij")); + test(S("abcdefghijklmnopqrst"), 19, S("abcdefghijklmnopqrs")); + test(S("abcdefghijklmnopqrst"), 20, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 21, S("can't happen")); + + test(S(""), S("")); + test(S("abcde"), S("")); + test(S("abcdefghij"), S("")); + test(S("abcdefghijklmnopqrst"), S("")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp index 4c156727..ec696fee 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S& s, typename S::const_iterator p, typename S::value_type c, S expected) @@ -32,6 +34,7 @@ test(S& s, typename S::const_iterator p, typename S::value_type c, S expected) int main() { + { typedef std::string S; S s; test(s, s.begin(), '1', S("1")); @@ -48,4 +51,25 @@ int main() test(s, s.begin()+4, 'A', S("a567A1432dcb")); test(s, s.begin()+5, 'B', S("a567AB1432dcb")); test(s, s.begin()+6, 'C', S("a567ABC1432dcb")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s; + test(s, s.begin(), '1', S("1")); + test(s, s.begin(), 'a', S("a1")); + test(s, s.end(), 'b', S("a1b")); + test(s, s.end()-1, 'c', S("a1cb")); + test(s, s.end()-2, 'd', S("a1dcb")); + test(s, s.end()-3, '2', S("a12dcb")); + test(s, s.end()-4, '3', S("a132dcb")); + test(s, s.end()-5, '4', S("a1432dcb")); + test(s, s.begin()+1, '5', S("a51432dcb")); + test(s, s.begin()+2, '6', S("a561432dcb")); + test(s, s.begin()+3, '7', S("a5671432dcb")); + test(s, s.begin()+4, 'A', S("a567A1432dcb")); + test(s, s.begin()+5, 'B', S("a567AB1432dcb")); + test(s, s.begin()+6, 'C', S("a567ABC1432dcb")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp index 1db86ece..4e249357 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -23,5 +25,14 @@ int main() assert(i - s.begin() == 3); assert(s == "123abc456"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("123456"); + S::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); + assert(i - s.begin() == 3); + assert(s == "123abc456"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp index cae3af2a..0eb3216e 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp @@ -16,6 +16,7 @@ #include #include "../../input_iterator.h" +#include "../../min_allocator.h" template void @@ -30,6 +31,7 @@ test(S s, typename S::difference_type pos, It first, It last, S expected) int main() { + { typedef std::string S; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; test(S(), 0, s, s, S()); @@ -73,4 +75,52 @@ int main() test(S("12345678901234567890"), 15, input_iterator(s), input_iterator(s+10), S("123456789012345ABCDEFGHIJ67890")); test(S("12345678901234567890"), 20, input_iterator(s), input_iterator(s+52), S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + test(S(), 0, s, s, S()); + test(S(), 0, s, s+1, S("A")); + test(S(), 0, s, s+10, S("ABCDEFGHIJ")); + test(S(), 0, s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), 0, s, s, S("12345")); + test(S("12345"), 1, s, s+1, S("1A2345")); + test(S("12345"), 4, s, s+10, S("1234ABCDEFGHIJ5")); + test(S("12345"), 5, s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), 0, s, s, S("1234567890")); + test(S("1234567890"), 1, s, s+1, S("1A234567890")); + test(S("1234567890"), 10, s, s+10, S("1234567890ABCDEFGHIJ")); + test(S("1234567890"), 8, s, s+52, S("12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz90")); + + test(S("12345678901234567890"), 3, s, s, S("12345678901234567890")); + test(S("12345678901234567890"), 3, s, s+1, S("123A45678901234567890")); + test(S("12345678901234567890"), 15, s, s+10, S("123456789012345ABCDEFGHIJ67890")); + test(S("12345678901234567890"), 20, s, s+52, + S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S(), 0, input_iterator(s), input_iterator(s), S()); + test(S(), 0, input_iterator(s), input_iterator(s+1), S("A")); + test(S(), 0, input_iterator(s), input_iterator(s+10), S("ABCDEFGHIJ")); + test(S(), 0, input_iterator(s), input_iterator(s+52), S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), 0, input_iterator(s), input_iterator(s), S("12345")); + test(S("12345"), 1, input_iterator(s), input_iterator(s+1), S("1A2345")); + test(S("12345"), 4, input_iterator(s), input_iterator(s+10), S("1234ABCDEFGHIJ5")); + test(S("12345"), 5, input_iterator(s), input_iterator(s+52), S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), 0, input_iterator(s), input_iterator(s), S("1234567890")); + test(S("1234567890"), 1, input_iterator(s), input_iterator(s+1), S("1A234567890")); + test(S("1234567890"), 10, input_iterator(s), input_iterator(s+10), S("1234567890ABCDEFGHIJ")); + test(S("1234567890"), 8, input_iterator(s), input_iterator(s+52), S("12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz90")); + + test(S("12345678901234567890"), 3, input_iterator(s), input_iterator(s), S("12345678901234567890")); + test(S("12345678901234567890"), 3, input_iterator(s), input_iterator(s+1), S("123A45678901234567890")); + test(S("12345678901234567890"), 15, input_iterator(s), input_iterator(s+10), S("123456789012345ABCDEFGHIJ67890")); + test(S("12345678901234567890"), 20, input_iterator(s), input_iterator(s+52), + S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp index ba30e156..a3e5d29e 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::difference_type pos, typename S::size_type n, @@ -28,6 +30,7 @@ test(S s, typename S::difference_type pos, typename S::size_type n, int main() { + { typedef std::string S; test(S(""), 0, 0, '1', S("")); test(S(""), 0, 5, '1', S("11111")); @@ -93,4 +96,74 @@ int main() test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111")); test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111")); test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, 0, '1', S("")); + test(S(""), 0, 5, '1', S("11111")); + test(S(""), 0, 10, '1', S("1111111111")); + test(S(""), 0, 20, '1', S("11111111111111111111")); + test(S("abcde"), 0, 0, '1', S("abcde")); + test(S("abcde"), 0, 5, '1', S("11111abcde")); + test(S("abcde"), 0, 10, '1', S("1111111111abcde")); + test(S("abcde"), 0, 20, '1', S("11111111111111111111abcde")); + test(S("abcde"), 1, 0, '1', S("abcde")); + test(S("abcde"), 1, 5, '1', S("a11111bcde")); + test(S("abcde"), 1, 10, '1', S("a1111111111bcde")); + test(S("abcde"), 1, 20, '1', S("a11111111111111111111bcde")); + test(S("abcde"), 2, 0, '1', S("abcde")); + test(S("abcde"), 2, 5, '1', S("ab11111cde")); + test(S("abcde"), 2, 10, '1', S("ab1111111111cde")); + test(S("abcde"), 2, 20, '1', S("ab11111111111111111111cde")); + test(S("abcde"), 4, 0, '1', S("abcde")); + test(S("abcde"), 4, 5, '1', S("abcd11111e")); + test(S("abcde"), 4, 10, '1', S("abcd1111111111e")); + test(S("abcde"), 4, 20, '1', S("abcd11111111111111111111e")); + test(S("abcde"), 5, 0, '1', S("abcde")); + test(S("abcde"), 5, 5, '1', S("abcde11111")); + test(S("abcde"), 5, 10, '1', S("abcde1111111111")); + test(S("abcde"), 5, 20, '1', S("abcde11111111111111111111")); + test(S("abcdefghij"), 0, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 0, 5, '1', S("11111abcdefghij")); + test(S("abcdefghij"), 0, 10, '1', S("1111111111abcdefghij")); + test(S("abcdefghij"), 0, 20, '1', S("11111111111111111111abcdefghij")); + test(S("abcdefghij"), 1, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 1, 5, '1', S("a11111bcdefghij")); + test(S("abcdefghij"), 1, 10, '1', S("a1111111111bcdefghij")); + test(S("abcdefghij"), 1, 20, '1', S("a11111111111111111111bcdefghij")); + test(S("abcdefghij"), 5, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 5, 5, '1', S("abcde11111fghij")); + test(S("abcdefghij"), 5, 10, '1', S("abcde1111111111fghij")); + test(S("abcdefghij"), 5, 20, '1', S("abcde11111111111111111111fghij")); + test(S("abcdefghij"), 9, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 9, 5, '1', S("abcdefghi11111j")); + test(S("abcdefghij"), 9, 10, '1', S("abcdefghi1111111111j")); + test(S("abcdefghij"), 9, 20, '1', S("abcdefghi11111111111111111111j")); + test(S("abcdefghij"), 10, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 10, 5, '1', S("abcdefghij11111")); + test(S("abcdefghij"), 10, 10, '1', S("abcdefghij1111111111")); + test(S("abcdefghij"), 10, 20, '1', S("abcdefghij11111111111111111111")); + test(S("abcdefghijklmnopqrst"), 0, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 5, '1', S("11111abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 10, '1', S("1111111111abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 20, '1', S("11111111111111111111abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 5, '1', S("a11111bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 10, '1', S("a1111111111bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 20, '1', S("a11111111111111111111bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 5, '1', S("abcdefghij11111klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 10, '1', S("abcdefghij1111111111klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 20, '1', S("abcdefghij11111111111111111111klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, 5, '1', S("abcdefghijklmnopqrs11111t")); + test(S("abcdefghijklmnopqrst"), 19, 10, '1', S("abcdefghijklmnopqrs1111111111t")); + test(S("abcdefghijklmnopqrst"), 19, 20, '1', S("abcdefghijklmnopqrs11111111111111111111t")); + test(S("abcdefghijklmnopqrst"), 20, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111")); + test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111")); + test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp index 68b351d5..25016ae4 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type pos, const typename S::value_type* str, S expected) @@ -38,6 +40,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, S expect int main() { + { typedef std::string S; test(S(""), 0, "", S("")); test(S(""), 0, "12345", S("12345")); @@ -119,4 +122,90 @@ int main() test(S("abcdefghijklmnopqrst"), 21, "12345", S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, "", S("")); + test(S(""), 0, "12345", S("12345")); + test(S(""), 0, "1234567890", S("1234567890")); + test(S(""), 0, "12345678901234567890", S("12345678901234567890")); + test(S(""), 1, "", S("can't happen")); + test(S(""), 1, "12345", S("can't happen")); + test(S(""), 1, "1234567890", S("can't happen")); + test(S(""), 1, "12345678901234567890", S("can't happen")); + test(S("abcde"), 0, "", S("abcde")); + test(S("abcde"), 0, "12345", S("12345abcde")); + test(S("abcde"), 0, "1234567890", S("1234567890abcde")); + test(S("abcde"), 0, "12345678901234567890", S("12345678901234567890abcde")); + test(S("abcde"), 1, "", S("abcde")); + test(S("abcde"), 1, "12345", S("a12345bcde")); + test(S("abcde"), 1, "1234567890", S("a1234567890bcde")); + test(S("abcde"), 1, "12345678901234567890", S("a12345678901234567890bcde")); + test(S("abcde"), 2, "", S("abcde")); + test(S("abcde"), 2, "12345", S("ab12345cde")); + test(S("abcde"), 2, "1234567890", S("ab1234567890cde")); + test(S("abcde"), 2, "12345678901234567890", S("ab12345678901234567890cde")); + test(S("abcde"), 4, "", S("abcde")); + test(S("abcde"), 4, "12345", S("abcd12345e")); + test(S("abcde"), 4, "1234567890", S("abcd1234567890e")); + test(S("abcde"), 4, "12345678901234567890", S("abcd12345678901234567890e")); + test(S("abcde"), 5, "", S("abcde")); + test(S("abcde"), 5, "12345", S("abcde12345")); + test(S("abcde"), 5, "1234567890", S("abcde1234567890")); + test(S("abcde"), 5, "12345678901234567890", S("abcde12345678901234567890")); + test(S("abcde"), 6, "", S("can't happen")); + test(S("abcde"), 6, "12345", S("can't happen")); + test(S("abcde"), 6, "1234567890", S("can't happen")); + test(S("abcde"), 6, "12345678901234567890", S("can't happen")); + test(S("abcdefghij"), 0, "", S("abcdefghij")); + test(S("abcdefghij"), 0, "12345", S("12345abcdefghij")); + test(S("abcdefghij"), 0, "1234567890", S("1234567890abcdefghij")); + test(S("abcdefghij"), 0, "12345678901234567890", S("12345678901234567890abcdefghij")); + test(S("abcdefghij"), 1, "", S("abcdefghij")); + test(S("abcdefghij"), 1, "12345", S("a12345bcdefghij")); + test(S("abcdefghij"), 1, "1234567890", S("a1234567890bcdefghij")); + test(S("abcdefghij"), 1, "12345678901234567890", S("a12345678901234567890bcdefghij")); + test(S("abcdefghij"), 5, "", S("abcdefghij")); + test(S("abcdefghij"), 5, "12345", S("abcde12345fghij")); + test(S("abcdefghij"), 5, "1234567890", S("abcde1234567890fghij")); + test(S("abcdefghij"), 5, "12345678901234567890", S("abcde12345678901234567890fghij")); + test(S("abcdefghij"), 9, "", S("abcdefghij")); + test(S("abcdefghij"), 9, "12345", S("abcdefghi12345j")); + test(S("abcdefghij"), 9, "1234567890", S("abcdefghi1234567890j")); + test(S("abcdefghij"), 9, "12345678901234567890", S("abcdefghi12345678901234567890j")); + test(S("abcdefghij"), 10, "", S("abcdefghij")); + test(S("abcdefghij"), 10, "12345", S("abcdefghij12345")); + test(S("abcdefghij"), 10, "1234567890", S("abcdefghij1234567890")); + test(S("abcdefghij"), 10, "12345678901234567890", S("abcdefghij12345678901234567890")); + test(S("abcdefghij"), 11, "", S("can't happen")); + test(S("abcdefghij"), 11, "12345", S("can't happen")); + test(S("abcdefghij"), 11, "1234567890", S("can't happen")); + test(S("abcdefghij"), 11, "12345678901234567890", S("can't happen")); + test(S("abcdefghijklmnopqrst"), 0, "", S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345", S("12345abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "1234567890", S("1234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", S("12345678901234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "", S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345", S("a12345bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "1234567890", S("a1234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", S("a12345678901234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "", S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345", S("abcdefghij12345klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "1234567890", S("abcdefghij1234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", S("abcdefghij12345678901234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "", S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "12345", S("abcdefghijklmnopqrs12345t")); + test(S("abcdefghijklmnopqrst"), 19, "1234567890", S("abcdefghijklmnopqrs1234567890t")); + test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", S("abcdefghijklmnopqrs12345678901234567890t")); + test(S("abcdefghijklmnopqrst"), 20, "", S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, "12345", S("abcdefghijklmnopqrst12345")); + test(S("abcdefghijklmnopqrst"), 20, "1234567890", S("abcdefghijklmnopqrst1234567890")); + test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + test(S("abcdefghijklmnopqrst"), 21, "", S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345", S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp index e975ebf7..7f360993 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type pos, const typename S::value_type* str, @@ -39,6 +41,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, int main() { + { typedef std::string S; test(S(""), 0, "", 0, S("")); test(S(""), 0, "12345", 0, S("")); @@ -360,4 +363,330 @@ int main() test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, "", 0, S("")); + test(S(""), 0, "12345", 0, S("")); + test(S(""), 0, "12345", 1, S("1")); + test(S(""), 0, "12345", 2, S("12")); + test(S(""), 0, "12345", 4, S("1234")); + test(S(""), 0, "12345", 5, S("12345")); + test(S(""), 0, "1234567890", 0, S("")); + test(S(""), 0, "1234567890", 1, S("1")); + test(S(""), 0, "1234567890", 5, S("12345")); + test(S(""), 0, "1234567890", 9, S("123456789")); + test(S(""), 0, "1234567890", 10, S("1234567890")); + test(S(""), 0, "12345678901234567890", 0, S("")); + test(S(""), 0, "12345678901234567890", 1, S("1")); + test(S(""), 0, "12345678901234567890", 10, S("1234567890")); + test(S(""), 0, "12345678901234567890", 19, S("1234567890123456789")); + test(S(""), 0, "12345678901234567890", 20, S("12345678901234567890")); + test(S(""), 1, "", 0, S("can't happen")); + test(S(""), 1, "12345", 0, S("can't happen")); + test(S(""), 1, "12345", 1, S("can't happen")); + test(S(""), 1, "12345", 2, S("can't happen")); + test(S(""), 1, "12345", 4, S("can't happen")); + test(S(""), 1, "12345", 5, S("can't happen")); + test(S(""), 1, "1234567890", 0, S("can't happen")); + test(S(""), 1, "1234567890", 1, S("can't happen")); + test(S(""), 1, "1234567890", 5, S("can't happen")); + test(S(""), 1, "1234567890", 9, S("can't happen")); + test(S(""), 1, "1234567890", 10, S("can't happen")); + test(S(""), 1, "12345678901234567890", 0, S("can't happen")); + test(S(""), 1, "12345678901234567890", 1, S("can't happen")); + test(S(""), 1, "12345678901234567890", 10, S("can't happen")); + test(S(""), 1, "12345678901234567890", 19, S("can't happen")); + test(S(""), 1, "12345678901234567890", 20, S("can't happen")); + test(S("abcde"), 0, "", 0, S("abcde")); + test(S("abcde"), 0, "12345", 0, S("abcde")); + test(S("abcde"), 0, "12345", 1, S("1abcde")); + test(S("abcde"), 0, "12345", 2, S("12abcde")); + test(S("abcde"), 0, "12345", 4, S("1234abcde")); + test(S("abcde"), 0, "12345", 5, S("12345abcde")); + test(S("abcde"), 0, "1234567890", 0, S("abcde")); + test(S("abcde"), 0, "1234567890", 1, S("1abcde")); + test(S("abcde"), 0, "1234567890", 5, S("12345abcde")); + test(S("abcde"), 0, "1234567890", 9, S("123456789abcde")); + test(S("abcde"), 0, "1234567890", 10, S("1234567890abcde")); + test(S("abcde"), 0, "12345678901234567890", 0, S("abcde")); + test(S("abcde"), 0, "12345678901234567890", 1, S("1abcde")); + test(S("abcde"), 0, "12345678901234567890", 10, S("1234567890abcde")); + test(S("abcde"), 0, "12345678901234567890", 19, S("1234567890123456789abcde")); + test(S("abcde"), 0, "12345678901234567890", 20, S("12345678901234567890abcde")); + test(S("abcde"), 1, "", 0, S("abcde")); + test(S("abcde"), 1, "12345", 0, S("abcde")); + test(S("abcde"), 1, "12345", 1, S("a1bcde")); + test(S("abcde"), 1, "12345", 2, S("a12bcde")); + test(S("abcde"), 1, "12345", 4, S("a1234bcde")); + test(S("abcde"), 1, "12345", 5, S("a12345bcde")); + test(S("abcde"), 1, "1234567890", 0, S("abcde")); + test(S("abcde"), 1, "1234567890", 1, S("a1bcde")); + test(S("abcde"), 1, "1234567890", 5, S("a12345bcde")); + test(S("abcde"), 1, "1234567890", 9, S("a123456789bcde")); + test(S("abcde"), 1, "1234567890", 10, S("a1234567890bcde")); + test(S("abcde"), 1, "12345678901234567890", 0, S("abcde")); + test(S("abcde"), 1, "12345678901234567890", 1, S("a1bcde")); + test(S("abcde"), 1, "12345678901234567890", 10, S("a1234567890bcde")); + test(S("abcde"), 1, "12345678901234567890", 19, S("a1234567890123456789bcde")); + test(S("abcde"), 1, "12345678901234567890", 20, S("a12345678901234567890bcde")); + test(S("abcde"), 2, "", 0, S("abcde")); + test(S("abcde"), 2, "12345", 0, S("abcde")); + test(S("abcde"), 2, "12345", 1, S("ab1cde")); + test(S("abcde"), 2, "12345", 2, S("ab12cde")); + test(S("abcde"), 2, "12345", 4, S("ab1234cde")); + test(S("abcde"), 2, "12345", 5, S("ab12345cde")); + test(S("abcde"), 2, "1234567890", 0, S("abcde")); + test(S("abcde"), 2, "1234567890", 1, S("ab1cde")); + test(S("abcde"), 2, "1234567890", 5, S("ab12345cde")); + test(S("abcde"), 2, "1234567890", 9, S("ab123456789cde")); + test(S("abcde"), 2, "1234567890", 10, S("ab1234567890cde")); + test(S("abcde"), 2, "12345678901234567890", 0, S("abcde")); + test(S("abcde"), 2, "12345678901234567890", 1, S("ab1cde")); + test(S("abcde"), 2, "12345678901234567890", 10, S("ab1234567890cde")); + test(S("abcde"), 2, "12345678901234567890", 19, S("ab1234567890123456789cde")); + test(S("abcde"), 2, "12345678901234567890", 20, S("ab12345678901234567890cde")); + test(S("abcde"), 4, "", 0, S("abcde")); + test(S("abcde"), 4, "12345", 0, S("abcde")); + test(S("abcde"), 4, "12345", 1, S("abcd1e")); + test(S("abcde"), 4, "12345", 2, S("abcd12e")); + test(S("abcde"), 4, "12345", 4, S("abcd1234e")); + test(S("abcde"), 4, "12345", 5, S("abcd12345e")); + test(S("abcde"), 4, "1234567890", 0, S("abcde")); + test(S("abcde"), 4, "1234567890", 1, S("abcd1e")); + test(S("abcde"), 4, "1234567890", 5, S("abcd12345e")); + test(S("abcde"), 4, "1234567890", 9, S("abcd123456789e")); + test(S("abcde"), 4, "1234567890", 10, S("abcd1234567890e")); + test(S("abcde"), 4, "12345678901234567890", 0, S("abcde")); + test(S("abcde"), 4, "12345678901234567890", 1, S("abcd1e")); + test(S("abcde"), 4, "12345678901234567890", 10, S("abcd1234567890e")); + test(S("abcde"), 4, "12345678901234567890", 19, S("abcd1234567890123456789e")); + test(S("abcde"), 4, "12345678901234567890", 20, S("abcd12345678901234567890e")); + test(S("abcde"), 5, "", 0, S("abcde")); + test(S("abcde"), 5, "12345", 0, S("abcde")); + test(S("abcde"), 5, "12345", 1, S("abcde1")); + test(S("abcde"), 5, "12345", 2, S("abcde12")); + test(S("abcde"), 5, "12345", 4, S("abcde1234")); + test(S("abcde"), 5, "12345", 5, S("abcde12345")); + test(S("abcde"), 5, "1234567890", 0, S("abcde")); + test(S("abcde"), 5, "1234567890", 1, S("abcde1")); + test(S("abcde"), 5, "1234567890", 5, S("abcde12345")); + test(S("abcde"), 5, "1234567890", 9, S("abcde123456789")); + test(S("abcde"), 5, "1234567890", 10, S("abcde1234567890")); + test(S("abcde"), 5, "12345678901234567890", 0, S("abcde")); + test(S("abcde"), 5, "12345678901234567890", 1, S("abcde1")); + test(S("abcde"), 5, "12345678901234567890", 10, S("abcde1234567890")); + test(S("abcde"), 5, "12345678901234567890", 19, S("abcde1234567890123456789")); + test(S("abcde"), 5, "12345678901234567890", 20, S("abcde12345678901234567890")); + test(S("abcde"), 6, "", 0, S("can't happen")); + test(S("abcde"), 6, "12345", 0, S("can't happen")); + test(S("abcde"), 6, "12345", 1, S("can't happen")); + test(S("abcde"), 6, "12345", 2, S("can't happen")); + test(S("abcde"), 6, "12345", 4, S("can't happen")); + test(S("abcde"), 6, "12345", 5, S("can't happen")); + test(S("abcde"), 6, "1234567890", 0, S("can't happen")); + test(S("abcde"), 6, "1234567890", 1, S("can't happen")); + test(S("abcde"), 6, "1234567890", 5, S("can't happen")); + test(S("abcde"), 6, "1234567890", 9, S("can't happen")); + test(S("abcde"), 6, "1234567890", 10, S("can't happen")); + test(S("abcde"), 6, "12345678901234567890", 0, S("can't happen")); + test(S("abcde"), 6, "12345678901234567890", 1, S("can't happen")); + test(S("abcde"), 6, "12345678901234567890", 10, S("can't happen")); + test(S("abcde"), 6, "12345678901234567890", 19, S("can't happen")); + test(S("abcde"), 6, "12345678901234567890", 20, S("can't happen")); + test(S("abcdefghij"), 0, "", 0, S("abcdefghij")); + test(S("abcdefghij"), 0, "12345", 0, S("abcdefghij")); + test(S("abcdefghij"), 0, "12345", 1, S("1abcdefghij")); + test(S("abcdefghij"), 0, "12345", 2, S("12abcdefghij")); + test(S("abcdefghij"), 0, "12345", 4, S("1234abcdefghij")); + test(S("abcdefghij"), 0, "12345", 5, S("12345abcdefghij")); + test(S("abcdefghij"), 0, "1234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 0, "1234567890", 1, S("1abcdefghij")); + test(S("abcdefghij"), 0, "1234567890", 5, S("12345abcdefghij")); + test(S("abcdefghij"), 0, "1234567890", 9, S("123456789abcdefghij")); + test(S("abcdefghij"), 0, "1234567890", 10, S("1234567890abcdefghij")); + test(S("abcdefghij"), 0, "12345678901234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 0, "12345678901234567890", 1, S("1abcdefghij")); + test(S("abcdefghij"), 0, "12345678901234567890", 10, S("1234567890abcdefghij")); + test(S("abcdefghij"), 0, "12345678901234567890", 19, S("1234567890123456789abcdefghij")); + test(S("abcdefghij"), 0, "12345678901234567890", 20, S("12345678901234567890abcdefghij")); + test(S("abcdefghij"), 1, "", 0, S("abcdefghij")); + test(S("abcdefghij"), 1, "12345", 0, S("abcdefghij")); + test(S("abcdefghij"), 1, "12345", 1, S("a1bcdefghij")); + test(S("abcdefghij"), 1, "12345", 2, S("a12bcdefghij")); + test(S("abcdefghij"), 1, "12345", 4, S("a1234bcdefghij")); + test(S("abcdefghij"), 1, "12345", 5, S("a12345bcdefghij")); + test(S("abcdefghij"), 1, "1234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 1, "1234567890", 1, S("a1bcdefghij")); + test(S("abcdefghij"), 1, "1234567890", 5, S("a12345bcdefghij")); + test(S("abcdefghij"), 1, "1234567890", 9, S("a123456789bcdefghij")); + test(S("abcdefghij"), 1, "1234567890", 10, S("a1234567890bcdefghij")); + test(S("abcdefghij"), 1, "12345678901234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 1, "12345678901234567890", 1, S("a1bcdefghij")); + test(S("abcdefghij"), 1, "12345678901234567890", 10, S("a1234567890bcdefghij")); + test(S("abcdefghij"), 1, "12345678901234567890", 19, S("a1234567890123456789bcdefghij")); + test(S("abcdefghij"), 1, "12345678901234567890", 20, S("a12345678901234567890bcdefghij")); + test(S("abcdefghij"), 5, "", 0, S("abcdefghij")); + test(S("abcdefghij"), 5, "12345", 0, S("abcdefghij")); + test(S("abcdefghij"), 5, "12345", 1, S("abcde1fghij")); + test(S("abcdefghij"), 5, "12345", 2, S("abcde12fghij")); + test(S("abcdefghij"), 5, "12345", 4, S("abcde1234fghij")); + test(S("abcdefghij"), 5, "12345", 5, S("abcde12345fghij")); + test(S("abcdefghij"), 5, "1234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 5, "1234567890", 1, S("abcde1fghij")); + test(S("abcdefghij"), 5, "1234567890", 5, S("abcde12345fghij")); + test(S("abcdefghij"), 5, "1234567890", 9, S("abcde123456789fghij")); + test(S("abcdefghij"), 5, "1234567890", 10, S("abcde1234567890fghij")); + test(S("abcdefghij"), 5, "12345678901234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 5, "12345678901234567890", 1, S("abcde1fghij")); + test(S("abcdefghij"), 5, "12345678901234567890", 10, S("abcde1234567890fghij")); + test(S("abcdefghij"), 5, "12345678901234567890", 19, S("abcde1234567890123456789fghij")); + test(S("abcdefghij"), 5, "12345678901234567890", 20, S("abcde12345678901234567890fghij")); + test(S("abcdefghij"), 9, "", 0, S("abcdefghij")); + test(S("abcdefghij"), 9, "12345", 0, S("abcdefghij")); + test(S("abcdefghij"), 9, "12345", 1, S("abcdefghi1j")); + test(S("abcdefghij"), 9, "12345", 2, S("abcdefghi12j")); + test(S("abcdefghij"), 9, "12345", 4, S("abcdefghi1234j")); + test(S("abcdefghij"), 9, "12345", 5, S("abcdefghi12345j")); + test(S("abcdefghij"), 9, "1234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 9, "1234567890", 1, S("abcdefghi1j")); + test(S("abcdefghij"), 9, "1234567890", 5, S("abcdefghi12345j")); + test(S("abcdefghij"), 9, "1234567890", 9, S("abcdefghi123456789j")); + test(S("abcdefghij"), 9, "1234567890", 10, S("abcdefghi1234567890j")); + test(S("abcdefghij"), 9, "12345678901234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 9, "12345678901234567890", 1, S("abcdefghi1j")); + test(S("abcdefghij"), 9, "12345678901234567890", 10, S("abcdefghi1234567890j")); + test(S("abcdefghij"), 9, "12345678901234567890", 19, S("abcdefghi1234567890123456789j")); + test(S("abcdefghij"), 9, "12345678901234567890", 20, S("abcdefghi12345678901234567890j")); + test(S("abcdefghij"), 10, "", 0, S("abcdefghij")); + test(S("abcdefghij"), 10, "12345", 0, S("abcdefghij")); + test(S("abcdefghij"), 10, "12345", 1, S("abcdefghij1")); + test(S("abcdefghij"), 10, "12345", 2, S("abcdefghij12")); + test(S("abcdefghij"), 10, "12345", 4, S("abcdefghij1234")); + test(S("abcdefghij"), 10, "12345", 5, S("abcdefghij12345")); + test(S("abcdefghij"), 10, "1234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 10, "1234567890", 1, S("abcdefghij1")); + test(S("abcdefghij"), 10, "1234567890", 5, S("abcdefghij12345")); + test(S("abcdefghij"), 10, "1234567890", 9, S("abcdefghij123456789")); + test(S("abcdefghij"), 10, "1234567890", 10, S("abcdefghij1234567890")); + test(S("abcdefghij"), 10, "12345678901234567890", 0, S("abcdefghij")); + test(S("abcdefghij"), 10, "12345678901234567890", 1, S("abcdefghij1")); + test(S("abcdefghij"), 10, "12345678901234567890", 10, S("abcdefghij1234567890")); + test(S("abcdefghij"), 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789")); + test(S("abcdefghij"), 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890")); + test(S("abcdefghij"), 11, "", 0, S("can't happen")); + test(S("abcdefghij"), 11, "12345", 0, S("can't happen")); + test(S("abcdefghij"), 11, "12345", 1, S("can't happen")); + test(S("abcdefghij"), 11, "12345", 2, S("can't happen")); + test(S("abcdefghij"), 11, "12345", 4, S("can't happen")); + test(S("abcdefghij"), 11, "12345", 5, S("can't happen")); + test(S("abcdefghij"), 11, "1234567890", 0, S("can't happen")); + test(S("abcdefghij"), 11, "1234567890", 1, S("can't happen")); + test(S("abcdefghij"), 11, "1234567890", 5, S("can't happen")); + test(S("abcdefghij"), 11, "1234567890", 9, S("can't happen")); + test(S("abcdefghij"), 11, "1234567890", 10, S("can't happen")); + test(S("abcdefghij"), 11, "12345678901234567890", 0, S("can't happen")); + test(S("abcdefghij"), 11, "12345678901234567890", 1, S("can't happen")); + test(S("abcdefghij"), 11, "12345678901234567890", 10, S("can't happen")); + test(S("abcdefghij"), 11, "12345678901234567890", 19, S("can't happen")); + test(S("abcdefghij"), 11, "12345678901234567890", 20, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 0, "", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345", 1, S("1abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345", 2, S("12abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345", 4, S("1234abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345", 5, S("12345abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "1234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "1234567890", 1, S("1abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "1234567890", 5, S("12345abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "1234567890", 9, S("123456789abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "1234567890", 10, S("1234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 1, S("1abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 10, S("1234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 19, S("1234567890123456789abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 20, S("12345678901234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345", 1, S("a1bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345", 2, S("a12bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345", 4, S("a1234bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345", 5, S("a12345bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "1234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "1234567890", 1, S("a1bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "1234567890", 5, S("a12345bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "1234567890", 9, S("a123456789bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "1234567890", 10, S("a1234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 1, S("a1bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 10, S("a1234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 19, S("a1234567890123456789bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 20, S("a12345678901234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345", 1, S("abcdefghij1klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345", 2, S("abcdefghij12klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345", 4, S("abcdefghij1234klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345", 5, S("abcdefghij12345klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "1234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "1234567890", 1, S("abcdefghij1klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "1234567890", 5, S("abcdefghij12345klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "1234567890", 9, S("abcdefghij123456789klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "1234567890", 10, S("abcdefghij1234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 1, S("abcdefghij1klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 10, S("abcdefghij1234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "12345", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "12345", 1, S("abcdefghijklmnopqrs1t")); + test(S("abcdefghijklmnopqrst"), 19, "12345", 2, S("abcdefghijklmnopqrs12t")); + test(S("abcdefghijklmnopqrst"), 19, "12345", 4, S("abcdefghijklmnopqrs1234t")); + test(S("abcdefghijklmnopqrst"), 19, "12345", 5, S("abcdefghijklmnopqrs12345t")); + test(S("abcdefghijklmnopqrst"), 19, "1234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "1234567890", 1, S("abcdefghijklmnopqrs1t")); + test(S("abcdefghijklmnopqrst"), 19, "1234567890", 5, S("abcdefghijklmnopqrs12345t")); + test(S("abcdefghijklmnopqrst"), 19, "1234567890", 9, S("abcdefghijklmnopqrs123456789t")); + test(S("abcdefghijklmnopqrst"), 19, "1234567890", 10, S("abcdefghijklmnopqrs1234567890t")); + test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t")); + test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890t")); + test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 19, S("abcdefghijklmnopqrs1234567890123456789t")); + test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 20, S("abcdefghijklmnopqrs12345678901234567890t")); + test(S("abcdefghijklmnopqrst"), 20, "", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, "12345", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, "12345", 1, S("abcdefghijklmnopqrst1")); + test(S("abcdefghijklmnopqrst"), 20, "12345", 2, S("abcdefghijklmnopqrst12")); + test(S("abcdefghijklmnopqrst"), 20, "12345", 4, S("abcdefghijklmnopqrst1234")); + test(S("abcdefghijklmnopqrst"), 20, "12345", 5, S("abcdefghijklmnopqrst12345")); + test(S("abcdefghijklmnopqrst"), 20, "1234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, "1234567890", 1, S("abcdefghijklmnopqrst1")); + test(S("abcdefghijklmnopqrst"), 20, "1234567890", 5, S("abcdefghijklmnopqrst12345")); + test(S("abcdefghijklmnopqrst"), 20, "1234567890", 9, S("abcdefghijklmnopqrst123456789")); + test(S("abcdefghijklmnopqrst"), 20, "1234567890", 10, S("abcdefghijklmnopqrst1234567890")); + test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 1, S("abcdefghijklmnopqrst1")); + test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890")); + test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789")); + test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890")); + test(S("abcdefghijklmnopqrst"), 21, "", 0, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345", 0, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345", 1, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345", 2, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345", 4, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345", 5, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "1234567890", 0, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "1234567890", 1, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "1234567890", 5, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "1234567890", 9, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "1234567890", 10, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 0, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 1, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp index ad78a4f6..5fad9b70 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type pos, typename S::size_type n, @@ -39,6 +41,7 @@ test(S s, typename S::size_type pos, typename S::size_type n, int main() { + { typedef std::string S; test(S(""), 0, 0, '1', S("")); test(S(""), 0, 5, '1', S("11111")); @@ -120,4 +123,90 @@ int main() test(S("abcdefghijklmnopqrst"), 21, 5, '1', S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, 0, '1', S("")); + test(S(""), 0, 5, '1', S("11111")); + test(S(""), 0, 10, '1', S("1111111111")); + test(S(""), 0, 20, '1', S("11111111111111111111")); + test(S(""), 1, 0, '1', S("can't happen")); + test(S(""), 1, 5, '1', S("can't happen")); + test(S(""), 1, 10, '1', S("can't happen")); + test(S(""), 1, 20, '1', S("can't happen")); + test(S("abcde"), 0, 0, '1', S("abcde")); + test(S("abcde"), 0, 5, '1', S("11111abcde")); + test(S("abcde"), 0, 10, '1', S("1111111111abcde")); + test(S("abcde"), 0, 20, '1', S("11111111111111111111abcde")); + test(S("abcde"), 1, 0, '1', S("abcde")); + test(S("abcde"), 1, 5, '1', S("a11111bcde")); + test(S("abcde"), 1, 10, '1', S("a1111111111bcde")); + test(S("abcde"), 1, 20, '1', S("a11111111111111111111bcde")); + test(S("abcde"), 2, 0, '1', S("abcde")); + test(S("abcde"), 2, 5, '1', S("ab11111cde")); + test(S("abcde"), 2, 10, '1', S("ab1111111111cde")); + test(S("abcde"), 2, 20, '1', S("ab11111111111111111111cde")); + test(S("abcde"), 4, 0, '1', S("abcde")); + test(S("abcde"), 4, 5, '1', S("abcd11111e")); + test(S("abcde"), 4, 10, '1', S("abcd1111111111e")); + test(S("abcde"), 4, 20, '1', S("abcd11111111111111111111e")); + test(S("abcde"), 5, 0, '1', S("abcde")); + test(S("abcde"), 5, 5, '1', S("abcde11111")); + test(S("abcde"), 5, 10, '1', S("abcde1111111111")); + test(S("abcde"), 5, 20, '1', S("abcde11111111111111111111")); + test(S("abcde"), 6, 0, '1', S("can't happen")); + test(S("abcde"), 6, 5, '1', S("can't happen")); + test(S("abcde"), 6, 10, '1', S("can't happen")); + test(S("abcde"), 6, 20, '1', S("can't happen")); + test(S("abcdefghij"), 0, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 0, 5, '1', S("11111abcdefghij")); + test(S("abcdefghij"), 0, 10, '1', S("1111111111abcdefghij")); + test(S("abcdefghij"), 0, 20, '1', S("11111111111111111111abcdefghij")); + test(S("abcdefghij"), 1, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 1, 5, '1', S("a11111bcdefghij")); + test(S("abcdefghij"), 1, 10, '1', S("a1111111111bcdefghij")); + test(S("abcdefghij"), 1, 20, '1', S("a11111111111111111111bcdefghij")); + test(S("abcdefghij"), 5, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 5, 5, '1', S("abcde11111fghij")); + test(S("abcdefghij"), 5, 10, '1', S("abcde1111111111fghij")); + test(S("abcdefghij"), 5, 20, '1', S("abcde11111111111111111111fghij")); + test(S("abcdefghij"), 9, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 9, 5, '1', S("abcdefghi11111j")); + test(S("abcdefghij"), 9, 10, '1', S("abcdefghi1111111111j")); + test(S("abcdefghij"), 9, 20, '1', S("abcdefghi11111111111111111111j")); + test(S("abcdefghij"), 10, 0, '1', S("abcdefghij")); + test(S("abcdefghij"), 10, 5, '1', S("abcdefghij11111")); + test(S("abcdefghij"), 10, 10, '1', S("abcdefghij1111111111")); + test(S("abcdefghij"), 10, 20, '1', S("abcdefghij11111111111111111111")); + test(S("abcdefghij"), 11, 0, '1', S("can't happen")); + test(S("abcdefghij"), 11, 5, '1', S("can't happen")); + test(S("abcdefghij"), 11, 10, '1', S("can't happen")); + test(S("abcdefghij"), 11, 20, '1', S("can't happen")); + test(S("abcdefghijklmnopqrst"), 0, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 5, '1', S("11111abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 10, '1', S("1111111111abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, 20, '1', S("11111111111111111111abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 5, '1', S("a11111bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 10, '1', S("a1111111111bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, 20, '1', S("a11111111111111111111bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 5, '1', S("abcdefghij11111klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 10, '1', S("abcdefghij1111111111klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, 20, '1', S("abcdefghij11111111111111111111klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, 5, '1', S("abcdefghijklmnopqrs11111t")); + test(S("abcdefghijklmnopqrst"), 19, 10, '1', S("abcdefghijklmnopqrs1111111111t")); + test(S("abcdefghijklmnopqrst"), 19, 20, '1', S("abcdefghijklmnopqrs11111111111111111111t")); + test(S("abcdefghijklmnopqrst"), 20, 0, '1', S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, 5, '1', S("abcdefghijklmnopqrst11111")); + test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111")); + test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111")); + test(S("abcdefghijklmnopqrst"), 21, 0, '1', S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, 5, '1', S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp index ae70e17f..37ac686f 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::size_type pos, S str, S expected) @@ -38,6 +40,7 @@ test(S s, typename S::size_type pos, S str, S expected) int main() { + { typedef std::string S; test(S(""), 0, S(""), S("")); test(S(""), 0, S("12345"), S("12345")); @@ -119,4 +122,90 @@ int main() test(S("abcdefghijklmnopqrst"), 21, S("12345"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen")); test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, S(""), S("")); + test(S(""), 0, S("12345"), S("12345")); + test(S(""), 0, S("1234567890"), S("1234567890")); + test(S(""), 0, S("12345678901234567890"), S("12345678901234567890")); + test(S(""), 1, S(""), S("can't happen")); + test(S(""), 1, S("12345"), S("can't happen")); + test(S(""), 1, S("1234567890"), S("can't happen")); + test(S(""), 1, S("12345678901234567890"), S("can't happen")); + test(S("abcde"), 0, S(""), S("abcde")); + test(S("abcde"), 0, S("12345"), S("12345abcde")); + test(S("abcde"), 0, S("1234567890"), S("1234567890abcde")); + test(S("abcde"), 0, S("12345678901234567890"), S("12345678901234567890abcde")); + test(S("abcde"), 1, S(""), S("abcde")); + test(S("abcde"), 1, S("12345"), S("a12345bcde")); + test(S("abcde"), 1, S("1234567890"), S("a1234567890bcde")); + test(S("abcde"), 1, S("12345678901234567890"), S("a12345678901234567890bcde")); + test(S("abcde"), 2, S(""), S("abcde")); + test(S("abcde"), 2, S("12345"), S("ab12345cde")); + test(S("abcde"), 2, S("1234567890"), S("ab1234567890cde")); + test(S("abcde"), 2, S("12345678901234567890"), S("ab12345678901234567890cde")); + test(S("abcde"), 4, S(""), S("abcde")); + test(S("abcde"), 4, S("12345"), S("abcd12345e")); + test(S("abcde"), 4, S("1234567890"), S("abcd1234567890e")); + test(S("abcde"), 4, S("12345678901234567890"), S("abcd12345678901234567890e")); + test(S("abcde"), 5, S(""), S("abcde")); + test(S("abcde"), 5, S("12345"), S("abcde12345")); + test(S("abcde"), 5, S("1234567890"), S("abcde1234567890")); + test(S("abcde"), 5, S("12345678901234567890"), S("abcde12345678901234567890")); + test(S("abcde"), 6, S(""), S("can't happen")); + test(S("abcde"), 6, S("12345"), S("can't happen")); + test(S("abcde"), 6, S("1234567890"), S("can't happen")); + test(S("abcde"), 6, S("12345678901234567890"), S("can't happen")); + test(S("abcdefghij"), 0, S(""), S("abcdefghij")); + test(S("abcdefghij"), 0, S("12345"), S("12345abcdefghij")); + test(S("abcdefghij"), 0, S("1234567890"), S("1234567890abcdefghij")); + test(S("abcdefghij"), 0, S("12345678901234567890"), S("12345678901234567890abcdefghij")); + test(S("abcdefghij"), 1, S(""), S("abcdefghij")); + test(S("abcdefghij"), 1, S("12345"), S("a12345bcdefghij")); + test(S("abcdefghij"), 1, S("1234567890"), S("a1234567890bcdefghij")); + test(S("abcdefghij"), 1, S("12345678901234567890"), S("a12345678901234567890bcdefghij")); + test(S("abcdefghij"), 5, S(""), S("abcdefghij")); + test(S("abcdefghij"), 5, S("12345"), S("abcde12345fghij")); + test(S("abcdefghij"), 5, S("1234567890"), S("abcde1234567890fghij")); + test(S("abcdefghij"), 5, S("12345678901234567890"), S("abcde12345678901234567890fghij")); + test(S("abcdefghij"), 9, S(""), S("abcdefghij")); + test(S("abcdefghij"), 9, S("12345"), S("abcdefghi12345j")); + test(S("abcdefghij"), 9, S("1234567890"), S("abcdefghi1234567890j")); + test(S("abcdefghij"), 9, S("12345678901234567890"), S("abcdefghi12345678901234567890j")); + test(S("abcdefghij"), 10, S(""), S("abcdefghij")); + test(S("abcdefghij"), 10, S("12345"), S("abcdefghij12345")); + test(S("abcdefghij"), 10, S("1234567890"), S("abcdefghij1234567890")); + test(S("abcdefghij"), 10, S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test(S("abcdefghij"), 11, S(""), S("can't happen")); + test(S("abcdefghij"), 11, S("12345"), S("can't happen")); + test(S("abcdefghij"), 11, S("1234567890"), S("can't happen")); + test(S("abcdefghij"), 11, S("12345678901234567890"), S("can't happen")); + test(S("abcdefghijklmnopqrst"), 0, S(""), S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, S("12345"), S("12345abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, S("1234567890"), S("1234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, S(""), S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, S("12345"), S("a12345bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), S("a1234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 1, S("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, S(""), S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, S("12345"), S("abcdefghij12345klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, S("1234567890"), S("abcdefghij1234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, S(""), S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 19, S("12345"), S("abcdefghijklmnopqrs12345t")); + test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), S("abcdefghijklmnopqrs1234567890t")); + test(S("abcdefghijklmnopqrst"), 19, S("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t")); + test(S("abcdefghijklmnopqrst"), 20, S(""), S("abcdefghijklmnopqrst")); + test(S("abcdefghijklmnopqrst"), 20, S("12345"), S("abcdefghijklmnopqrst12345")); + test(S("abcdefghijklmnopqrst"), 20, S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test(S("abcdefghijklmnopqrst"), 21, S(""), S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, S("12345"), S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen")); + test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp index 4e3baf48..b1c4f4bc 100644 --- a/test/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp @@ -17,13 +17,14 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S str, S::size_type pos2, - S::size_type n, S expected) +test(S s, typename S::size_type pos1, S str, typename S::size_type pos2, + typename S::size_type n, S expected) { - S::size_type old_size = s.size(); + typename S::size_type old_size = s.size(); S s0 = s; try { @@ -39,6 +40,7 @@ test(S s, S::size_type pos1, S str, S::size_type pos2, } } +template void test0() { test(S(""), 0, S(""), 0, 0, S("")); @@ -93,6 +95,7 @@ void test0() test(S(""), 0, S("1234567890"), 11, 0, S("can't happen")); } +template void test1() { test(S(""), 0, S("12345678901234567890"), 0, 0, S("")); @@ -147,6 +150,7 @@ void test1() test(S(""), 1, S("12345"), 6, 0, S("can't happen")); } +template void test2() { test(S(""), 1, S("1234567890"), 0, 0, S("can't happen")); @@ -201,6 +205,7 @@ void test2() test(S("abcde"), 0, S(""), 0, 1, S("abcde")); } +template void test3() { test(S("abcde"), 0, S(""), 1, 0, S("can't happen")); @@ -255,6 +260,7 @@ void test3() test(S("abcde"), 0, S("12345678901234567890"), 0, 1, S("1abcde")); } +template void test4() { test(S("abcde"), 0, S("12345678901234567890"), 0, 10, S("1234567890abcde")); @@ -309,6 +315,7 @@ void test4() test(S("abcde"), 1, S("1234567890"), 0, 1, S("a1bcde")); } +template void test5() { test(S("abcde"), 1, S("1234567890"), 0, 5, S("a12345bcde")); @@ -363,6 +370,7 @@ void test5() test(S("abcde"), 2, S("12345"), 0, 0, S("abcde")); } +template void test6() { test(S("abcde"), 2, S("12345"), 0, 1, S("ab1cde")); @@ -417,6 +425,7 @@ void test6() test(S("abcde"), 2, S("12345678901234567890"), 0, 19, S("ab1234567890123456789cde")); } +template void test7() { test(S("abcde"), 2, S("12345678901234567890"), 0, 20, S("ab12345678901234567890cde")); @@ -471,6 +480,7 @@ void test7() test(S("abcde"), 4, S("1234567890"), 0, 9, S("abcd123456789e")); } +template void test8() { test(S("abcde"), 4, S("1234567890"), 0, 10, S("abcd1234567890e")); @@ -525,6 +535,7 @@ void test8() test(S("abcde"), 5, S("12345"), 0, 2, S("abcde12")); } +template void test9() { test(S("abcde"), 5, S("12345"), 0, 4, S("abcde1234")); @@ -579,6 +590,7 @@ void test9() test(S("abcde"), 5, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890")); } +template void test10() { test(S("abcde"), 5, S("12345678901234567890"), 1, 0, S("abcde")); @@ -633,6 +645,7 @@ void test10() test(S("abcde"), 6, S("1234567890"), 0, 11, S("can't happen")); } +template void test11() { test(S("abcde"), 6, S("1234567890"), 1, 0, S("can't happen")); @@ -687,6 +700,7 @@ void test11() test(S("abcdefghij"), 0, S("12345"), 0, 5, S("12345abcdefghij")); } +template void test12() { test(S("abcdefghij"), 0, S("12345"), 0, 6, S("12345abcdefghij")); @@ -741,6 +755,7 @@ void test12() test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 1, S("2abcdefghij")); } +template void test13() { test(S("abcdefghij"), 0, S("12345678901234567890"), 1, 9, S("234567890abcdefghij")); @@ -795,6 +810,7 @@ void test13() test(S("abcdefghij"), 1, S("1234567890"), 1, 1, S("a2bcdefghij")); } +template void test14() { test(S("abcdefghij"), 1, S("1234567890"), 1, 4, S("a2345bcdefghij")); @@ -849,6 +865,7 @@ void test14() test(S("abcdefghij"), 5, S("12345"), 1, 0, S("abcdefghij")); } +template void test15() { test(S("abcdefghij"), 5, S("12345"), 1, 1, S("abcde2fghij")); @@ -903,6 +920,7 @@ void test15() test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij")); } +template void test16() { test(S("abcdefghij"), 5, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij")); @@ -957,6 +975,7 @@ void test16() test(S("abcdefghij"), 9, S("1234567890"), 1, 8, S("abcdefghi23456789j")); } +template void test17() { test(S("abcdefghij"), 9, S("1234567890"), 1, 9, S("abcdefghi234567890j")); @@ -1011,6 +1030,7 @@ void test17() test(S("abcdefghij"), 10, S("12345"), 1, 2, S("abcdefghij23")); } +template void test18() { test(S("abcdefghij"), 10, S("12345"), 1, 3, S("abcdefghij234")); @@ -1065,6 +1085,7 @@ void test18() test(S("abcdefghij"), 10, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890")); } +template void test19() { test(S("abcdefghij"), 10, S("12345678901234567890"), 10, 0, S("abcdefghij")); @@ -1119,6 +1140,7 @@ void test19() test(S("abcdefghij"), 11, S("1234567890"), 1, 10, S("can't happen")); } +template void test20() { test(S("abcdefghij"), 11, S("1234567890"), 5, 0, S("can't happen")); @@ -1173,6 +1195,7 @@ void test20() test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 4, S("2345abcdefghijklmnopqrst")); } +template void test21() { test(S("abcdefghijklmnopqrst"), 0, S("12345"), 1, 5, S("2345abcdefghijklmnopqrst")); @@ -1227,6 +1250,7 @@ void test21() test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst")); } +template void test22() { test(S("abcdefghijklmnopqrst"), 0, S("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst")); @@ -1281,6 +1305,7 @@ void test22() test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst")); } +template void test23() { test(S("abcdefghijklmnopqrst"), 1, S("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst")); @@ -1335,6 +1360,7 @@ void test23() test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 0, S("abcdefghijklmnopqrst")); } +template void test24() { test(S("abcdefghijklmnopqrst"), 10, S("12345"), 2, 1, S("abcdefghij3klmnopqrst")); @@ -1389,6 +1415,7 @@ void test24() test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst")); } +template void test25() { test(S("abcdefghijklmnopqrst"), 10, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst")); @@ -1443,6 +1470,7 @@ void test25() test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t")); } +template void test26() { test(S("abcdefghijklmnopqrst"), 19, S("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t")); @@ -1497,6 +1525,7 @@ void test26() test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 2, S("abcdefghijklmnopqrst34")); } +template void test27() { test(S("abcdefghijklmnopqrst"), 20, S("12345"), 2, 3, S("abcdefghijklmnopqrst345")); @@ -1551,6 +1580,7 @@ void test27() test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890")); } +template void test28() { test(S("abcdefghijklmnopqrst"), 20, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst")); @@ -1605,6 +1635,7 @@ void test28() test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 5, 6, S("can't happen")); } +template void test29() { test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), 9, 0, S("can't happen")); @@ -1641,34 +1672,72 @@ void test29() int main() { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp index 8c27f3b8..bea51ea3 100644 --- a/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, typename S::value_type str, S expected) @@ -25,9 +27,20 @@ test(S s, typename S::value_type str, S expected) int main() { + { typedef std::string S; test(S(), 'a', S("a")); test(S("12345"), 'a', S("12345a")); test(S("1234567890"), 'a', S("1234567890a")); test(S("12345678901234567890"), 'a', S("12345678901234567890a")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), 'a', S("a")); + test(S("12345"), 'a', S("12345a")); + test(S("1234567890"), 'a', S("1234567890a")); + test(S("12345678901234567890"), 'a', S("12345678901234567890a")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp b/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp index cc3a4880..04d58832 100644 --- a/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -22,5 +24,13 @@ int main() s += {'a', 'b', 'c'}; assert(s == "123abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("123"); + s += {'a', 'b', 'c'}; + assert(s == "123abc"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp index 8760a481..9bdd2aa2 100644 --- a/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, const typename S::value_type* str, S expected) @@ -25,6 +27,7 @@ test(S s, const typename S::value_type* str, S expected) int main() { + { typedef std::string S; test(S(), "", S()); test(S(), "12345", S("12345")); @@ -46,4 +49,30 @@ int main() test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890")); test(S("12345678901234567890"), "12345678901234567890", S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), "", S()); + test(S(), "12345", S("12345")); + test(S(), "1234567890", S("1234567890")); + test(S(), "12345678901234567890", S("12345678901234567890")); + + test(S("12345"), "", S("12345")); + test(S("12345"), "12345", S("1234512345")); + test(S("12345"), "1234567890", S("123451234567890")); + test(S("12345"), "12345678901234567890", S("1234512345678901234567890")); + + test(S("1234567890"), "", S("1234567890")); + test(S("1234567890"), "12345", S("123456789012345")); + test(S("1234567890"), "1234567890", S("12345678901234567890")); + test(S("1234567890"), "12345678901234567890", S("123456789012345678901234567890")); + + test(S("12345678901234567890"), "", S("12345678901234567890")); + test(S("12345678901234567890"), "12345", S("1234567890123456789012345")); + test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890")); + test(S("12345678901234567890"), "12345678901234567890", + S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp index e5f5fa2b..8d5a949f 100644 --- a/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s, S str, S expected) @@ -26,6 +28,7 @@ test(S s, S str, S expected) int main() { + { typedef std::string S; test(S(), S(), S()); test(S(), S("12345"), S("12345")); @@ -47,4 +50,30 @@ int main() test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); test(S("12345678901234567890"), S("12345678901234567890"), S("1234567890123456789012345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(), S(), S()); + test(S(), S("12345"), S("12345")); + test(S(), S("1234567890"), S("1234567890")); + test(S(), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345"), S(), S("12345")); + test(S("12345"), S("12345"), S("1234512345")); + test(S("12345"), S("1234567890"), S("123451234567890")); + test(S("12345"), S("12345678901234567890"), S("1234512345678901234567890")); + + test(S("1234567890"), S(), S("1234567890")); + test(S("1234567890"), S("12345"), S("123456789012345")); + test(S("1234567890"), S("1234567890"), S("12345678901234567890")); + test(S("1234567890"), S("12345678901234567890"), S("123456789012345678901234567890")); + + test(S("12345678901234567890"), S(), S("12345678901234567890")); + test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345")); + test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); + test(S("12345678901234567890"), S("12345678901234567890"), + S("1234567890123456789012345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp index def2629f..6bc7148b 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -22,5 +24,13 @@ int main() s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("123def456"); + s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); + assert(s == "123abc456"); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp index be89f60f..37262f13 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include "../../min_allocator.h" template void @@ -34,10 +34,9 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, It f, It l, S ex assert(s.size() == old_size - xlen + rlen); } -typedef std::string S; - const char* str = "12345678901234567890"; +template void test0() { test(S(""), 0, 0, str, str+0, S("")); @@ -119,29 +118,30 @@ void test0() test(S("abcde"), 0, 4, str, str+1, S("1e")); test(S("abcde"), 0, 4, str, str+10, S("1234567890e")); test(S("abcde"), 0, 4, str, str+19, S("1234567890123456789e")); -// test(S("abcde"), 0, 4, str, str+20, S("12345678901234567890e")); -// test(S("abcde"), 0, 5, str, str+0, S("")); -// test(S("abcde"), 0, 5, str, str+0, S("")); -// test(S("abcde"), 0, 5, str, str+1, S("1")); -// test(S("abcde"), 0, 5, str, str+2, S("12")); -// test(S("abcde"), 0, 5, str, str+4, S("1234")); -// test(S("abcde"), 0, 5, str, str+5, S("12345")); -// test(S("abcde"), 0, 5, str, str+0, S("")); -// test(S("abcde"), 0, 5, str, str+1, S("1")); -// test(S("abcde"), 0, 5, str, str+5, S("12345")); -// test(S("abcde"), 0, 5, str, str+9, S("123456789")); -// test(S("abcde"), 0, 5, str, str+10, S("1234567890")); -// test(S("abcde"), 0, 5, str, str+0, S("")); -// test(S("abcde"), 0, 5, str, str+1, S("1")); -// test(S("abcde"), 0, 5, str, str+10, S("1234567890")); -// test(S("abcde"), 0, 5, str, str+19, S("1234567890123456789")); -// test(S("abcde"), 0, 5, str, str+20, S("12345678901234567890")); -// test(S("abcde"), 1, 0, str, str+0, S("abcde")); -// test(S("abcde"), 1, 0, str, str+0, S("abcde")); -// test(S("abcde"), 1, 0, str, str+1, S("a1bcde")); -// test(S("abcde"), 1, 0, str, str+2, S("a12bcde")); + test(S("abcde"), 0, 4, str, str+20, S("12345678901234567890e")); + test(S("abcde"), 0, 5, str, str+0, S("")); + test(S("abcde"), 0, 5, str, str+0, S("")); + test(S("abcde"), 0, 5, str, str+1, S("1")); + test(S("abcde"), 0, 5, str, str+2, S("12")); + test(S("abcde"), 0, 5, str, str+4, S("1234")); + test(S("abcde"), 0, 5, str, str+5, S("12345")); + test(S("abcde"), 0, 5, str, str+0, S("")); + test(S("abcde"), 0, 5, str, str+1, S("1")); + test(S("abcde"), 0, 5, str, str+5, S("12345")); + test(S("abcde"), 0, 5, str, str+9, S("123456789")); + test(S("abcde"), 0, 5, str, str+10, S("1234567890")); + test(S("abcde"), 0, 5, str, str+0, S("")); + test(S("abcde"), 0, 5, str, str+1, S("1")); + test(S("abcde"), 0, 5, str, str+10, S("1234567890")); + test(S("abcde"), 0, 5, str, str+19, S("1234567890123456789")); + test(S("abcde"), 0, 5, str, str+20, S("12345678901234567890")); + test(S("abcde"), 1, 0, str, str+0, S("abcde")); + test(S("abcde"), 1, 0, str, str+0, S("abcde")); + test(S("abcde"), 1, 0, str, str+1, S("a1bcde")); + test(S("abcde"), 1, 0, str, str+2, S("a12bcde")); } -/* + +template void test1() { test(S("abcde"), 1, 0, str, str+4, S("a1234bcde")); @@ -246,6 +246,7 @@ void test1() test(S("abcde"), 2, 1, str, str+1, S("ab1de")); } +template void test2() { test(S("abcde"), 2, 1, str, str+5, S("ab12345de")); @@ -350,6 +351,7 @@ void test2() test(S("abcdefghij"), 0, 0, str, str+0, S("abcdefghij")); } +template void test3() { test(S("abcdefghij"), 0, 0, str, str+1, S("1abcdefghij")); @@ -454,6 +456,7 @@ void test3() test(S("abcdefghij"), 1, 1, str, str+20, S("a12345678901234567890cdefghij")); } +template void test4() { test(S("abcdefghij"), 1, 4, str, str+0, S("afghij")); @@ -558,6 +561,7 @@ void test4() test(S("abcdefghij"), 5, 4, str, str+2, S("abcde12j")); } +template void test5() { test(S("abcdefghij"), 5, 4, str, str+4, S("abcde1234j")); @@ -662,6 +666,7 @@ void test5() test(S("abcdefghijklmnopqrst"), 0, 1, str, str+1, S("1bcdefghijklmnopqrst")); } +template void test6() { test(S("abcdefghijklmnopqrst"), 0, 1, str, str+5, S("12345bcdefghijklmnopqrst")); @@ -766,6 +771,7 @@ void test6() test(S("abcdefghijklmnopqrst"), 1, 9, str, str+0, S("aklmnopqrst")); } +template void test7() { test(S("abcdefghijklmnopqrst"), 1, 9, str, str+1, S("a1klmnopqrst")); @@ -870,6 +876,7 @@ void test7() test(S("abcdefghijklmnopqrst"), 10, 9, str, str+20, S("abcdefghij12345678901234567890t")); } +template void test8() { test(S("abcdefghijklmnopqrst"), 10, 10, str, str+0, S("abcdefghij")); @@ -937,16 +944,33 @@ void test8() test(S("abcdefghijklmnopqrst"), 20, 0, str, str+19, S("abcdefghijklmnopqrst1234567890123456789")); test(S("abcdefghijklmnopqrst"), 20, 0, str, str+20, S("abcdefghijklmnopqrst12345678901234567890")); } -*/ + int main() { - test0(); -// test1(); -// test2(); -// test3(); -// test4(); -// test5(); -// test6(); -// test7(); -// test8(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp index c1faafc9..58a4b20c 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp @@ -18,22 +18,24 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S::size_type n1, const S::value_type* str, S expected) +test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, S expected) { - S::size_type old_size = s.size(); - S::const_iterator first = s.begin() + pos1; - S::const_iterator last = s.begin() + pos1 + n1; + typename S::size_type old_size = s.size(); + typename S::const_iterator first = s.begin() + pos1; + typename S::const_iterator last = s.begin() + pos1 + n1; s.replace(first, last, str); assert(s.__invariants()); assert(s == expected); - S::size_type xlen = last - first; - S::size_type rlen = S::traits_type::length(str); + typename S::size_type xlen = last - first; + typename S::size_type rlen = S::traits_type::length(str); assert(s.size() == old_size - xlen + rlen); } +template void test0() { test(S(""), 0, 0, "", S("")); @@ -138,6 +140,7 @@ void test0() test(S("abcdefghij"), 1, 1, "12345678901234567890", S("a12345678901234567890cdefghij")); } +template void test1() { test(S("abcdefghij"), 1, 4, "", S("afghij")); @@ -242,6 +245,7 @@ void test1() test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", S("abcdefghij12345678901234567890t")); } +template void test2() { test(S("abcdefghijklmnopqrst"), 10, 10, "", S("abcdefghij")); @@ -264,7 +268,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp index 24beb4c4..0ef59ed7 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp @@ -18,23 +18,25 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S::size_type n1, const S::value_type* str, - S::size_type n2, S expected) +test(S s, typename S::size_type pos1, typename S::size_type n1, const typename S::value_type* str, + typename S::size_type n2, S expected) { - S::size_type old_size = s.size(); - S::const_iterator first = s.begin() + pos1; - S::const_iterator last = s.begin() + pos1 + n1; + typename S::size_type old_size = s.size(); + typename S::const_iterator first = s.begin() + pos1; + typename S::const_iterator last = s.begin() + pos1 + n1; s.replace(first, last, str, n2); assert(s.__invariants()); assert(s == expected); - S::size_type xlen = last - first; - S::size_type rlen = n2; + typename S::size_type xlen = last - first; + typename S::size_type rlen = n2; assert(s.size() == old_size - xlen + rlen); } +template void test0() { test(S(""), 0, 0, "", 0, S("")); @@ -139,6 +141,7 @@ void test0() test(S("abcde"), 1, 0, "12345", 2, S("a12bcde")); } +template void test1() { test(S("abcde"), 1, 0, "12345", 4, S("a1234bcde")); @@ -243,6 +246,7 @@ void test1() test(S("abcde"), 2, 1, "1234567890", 1, S("ab1de")); } +template void test2() { test(S("abcde"), 2, 1, "1234567890", 5, S("ab12345de")); @@ -347,6 +351,7 @@ void test2() test(S("abcdefghij"), 0, 0, "12345678901234567890", 0, S("abcdefghij")); } +template void test3() { test(S("abcdefghij"), 0, 0, "12345678901234567890", 1, S("1abcdefghij")); @@ -451,6 +456,7 @@ void test3() test(S("abcdefghij"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cdefghij")); } +template void test4() { test(S("abcdefghij"), 1, 4, "", 0, S("afghij")); @@ -555,6 +561,7 @@ void test4() test(S("abcdefghij"), 5, 4, "12345", 2, S("abcde12j")); } +template void test5() { test(S("abcdefghij"), 5, 4, "12345", 4, S("abcde1234j")); @@ -659,6 +666,7 @@ void test5() test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 1, S("1bcdefghijklmnopqrst")); } +template void test6() { test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 5, S("12345bcdefghijklmnopqrst")); @@ -763,6 +771,7 @@ void test6() test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 0, S("aklmnopqrst")); } +template void test7() { test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 1, S("a1klmnopqrst")); @@ -867,6 +876,7 @@ void test7() test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 20, S("abcdefghij12345678901234567890t")); } +template void test8() { test(S("abcdefghijklmnopqrst"), 10, 10, "", 0, S("abcdefghij")); @@ -937,13 +947,30 @@ void test8() int main() { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp index 05b7d4b5..6525607d 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_size_char.pass.cpp @@ -18,23 +18,25 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S::size_type n1, S::size_type n2, - S::value_type c, S expected) +test(S s, typename S::size_type pos1, typename S::size_type n1, typename S::size_type n2, + typename S::value_type c, S expected) { - S::size_type old_size = s.size(); - S::const_iterator first = s.begin() + pos1; - S::const_iterator last = s.begin() + pos1 + n1; + typename S::size_type old_size = s.size(); + typename S::const_iterator first = s.begin() + pos1; + typename S::const_iterator last = s.begin() + pos1 + n1; s.replace(first, last, n2, c); assert(s.__invariants()); assert(s == expected); - S::size_type xlen = last - first; - S::size_type rlen = n2; + typename S::size_type xlen = last - first; + typename S::size_type rlen = n2; assert(s.size() == old_size - xlen + rlen); } +template void test0() { test(S(""), 0, 0, 0, '3', S("")); @@ -139,6 +141,7 @@ void test0() test(S("abcdefghij"), 1, 1, 20, '3', S("a33333333333333333333cdefghij")); } +template void test1() { test(S("abcdefghij"), 1, 4, 0, '3', S("afghij")); @@ -243,6 +246,7 @@ void test1() test(S("abcdefghijklmnopqrst"), 10, 9, 20, '3', S("abcdefghij33333333333333333333t")); } +template void test2() { test(S("abcdefghijklmnopqrst"), 10, 10, 0, '3', S("abcdefghij")); @@ -265,7 +269,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp index 12df0115..76db558c 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp @@ -18,22 +18,24 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S::size_type n1, S str, S expected) +test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) { - S::size_type old_size = s.size(); - S::const_iterator first = s.begin() + pos1; - S::const_iterator last = s.begin() + pos1 + n1; + typename S::size_type old_size = s.size(); + typename S::const_iterator first = s.begin() + pos1; + typename S::const_iterator last = s.begin() + pos1 + n1; s.replace(first, last, str); assert(s.__invariants()); assert(s == expected); - S::size_type xlen = last - first; - S::size_type rlen = str.size(); + typename S::size_type xlen = last - first; + typename S::size_type rlen = str.size(); assert(s.size() == old_size - xlen + rlen); } +template void test0() { test(S(""), 0, 0, S(""), S("")); @@ -138,6 +140,7 @@ void test0() test(S("abcdefghij"), 1, 1, S("12345678901234567890"), S("a12345678901234567890cdefghij")); } +template void test1() { test(S("abcdefghij"), 1, 4, S(""), S("afghij")); @@ -242,6 +245,7 @@ void test1() test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), S("abcdefghij12345678901234567890t")); } +template void test2() { test(S("abcdefghijklmnopqrst"), 10, 10, S(""), S("abcdefghij")); @@ -264,7 +268,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp index 99d7d995..4dd1a828 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp @@ -19,13 +19,14 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos, S::size_type n1, - const S::value_type* str, S expected) +test(S s, typename S::size_type pos, typename S::size_type n1, + const typename S::value_type* str, S expected) { - S::size_type old_size = s.size(); + typename S::size_type old_size = s.size(); S s0 = s; try { @@ -33,8 +34,8 @@ test(S s, S::size_type pos, S::size_type n1, assert(s.__invariants()); assert(pos <= old_size); assert(s == expected); - S::size_type xlen = std::min(n1, old_size - pos); - S::size_type rlen = S::traits_type::length(str); + typename S::size_type xlen = std::min(n1, old_size - pos); + typename S::size_type rlen = S::traits_type::length(str); assert(s.size() == old_size - xlen + rlen); } catch (std::out_of_range&) @@ -44,6 +45,7 @@ test(S s, S::size_type pos, S::size_type n1, } } +template void test0() { test(S(""), 0, 0, "", S("")); @@ -148,6 +150,7 @@ void test0() test(S("abcde"), 5, 1, "12345678901234567890", S("abcde12345678901234567890")); } +template void test1() { test(S("abcde"), 6, 0, "", S("can't happen")); @@ -252,6 +255,7 @@ void test1() test(S("abcdefghij"), 11, 0, "12345678901234567890", S("can't happen")); } +template void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, "", S("abcdefghijklmnopqrst")); @@ -354,7 +358,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp index 3f581838..0b4aeafd 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp @@ -19,14 +19,15 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos, S::size_type n1, - const S::value_type* str, S::size_type n2, +test(S s, typename S::size_type pos, typename S::size_type n1, + const typename S::value_type* str, typename S::size_type n2, S expected) { - S::size_type old_size = s.size(); + typename S::size_type old_size = s.size(); S s0 = s; try { @@ -34,8 +35,8 @@ test(S s, S::size_type pos, S::size_type n1, assert(s.__invariants()); assert(pos <= old_size); assert(s == expected); - S::size_type xlen = std::min(n1, old_size - pos); - S::size_type rlen = n2; + typename S::size_type xlen = std::min(n1, old_size - pos); + typename S::size_type rlen = n2; assert(s.size() == old_size - xlen + rlen); } catch (std::out_of_range&) @@ -45,6 +46,7 @@ test(S s, S::size_type pos, S::size_type n1, } } +template void test0() { test(S(""), 0, 0, "", 0, S("")); @@ -149,6 +151,7 @@ void test0() test(S("abcde"), 0, 4, "12345", 2, S("12e")); } +template void test1() { test(S("abcde"), 0, 4, "12345", 4, S("1234e")); @@ -253,6 +256,7 @@ void test1() test(S("abcde"), 1, 3, "1234567890", 1, S("a1e")); } +template void test2() { test(S("abcde"), 1, 3, "1234567890", 5, S("a12345e")); @@ -357,6 +361,7 @@ void test2() test(S("abcde"), 2, 3, "12345678901234567890", 0, S("ab")); } +template void test3() { test(S("abcde"), 2, 3, "12345678901234567890", 1, S("ab1")); @@ -461,6 +466,7 @@ void test3() test(S("abcde"), 5, 1, "12345678901234567890", 20, S("abcde12345678901234567890")); } +template void test4() { test(S("abcde"), 6, 0, "", 0, S("can't happen")); @@ -565,6 +571,7 @@ void test4() test(S("abcdefghij"), 0, 11, "12345", 2, S("12")); } +template void test5() { test(S("abcdefghij"), 0, 11, "12345", 4, S("1234")); @@ -669,6 +676,7 @@ void test5() test(S("abcdefghij"), 1, 10, "1234567890", 1, S("a1")); } +template void test6() { test(S("abcdefghij"), 1, 10, "1234567890", 5, S("a12345")); @@ -773,6 +781,7 @@ void test6() test(S("abcdefghij"), 5, 6, "12345678901234567890", 0, S("abcde")); } +template void test7() { test(S("abcdefghij"), 5, 6, "12345678901234567890", 1, S("abcde1")); @@ -877,6 +886,7 @@ void test7() test(S("abcdefghij"), 11, 0, "12345678901234567890", 20, S("can't happen")); } +template void test8() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, S("abcdefghijklmnopqrst")); @@ -981,6 +991,7 @@ void test8() test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 2, S("a12bcdefghijklmnopqrst")); } +template void test9() { test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 4, S("a1234bcdefghijklmnopqrst")); @@ -1085,6 +1096,7 @@ void test9() test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 1, S("abcdefghij1klmnopqrst")); } +template void test10() { test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 5, S("abcdefghij12345klmnopqrst")); @@ -1189,6 +1201,7 @@ void test10() test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); } +template void test11() { test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t")); @@ -1279,16 +1292,36 @@ void test11() int main() { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp index b41dc2bc..f8e13b83 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp @@ -17,14 +17,15 @@ #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos, S::size_type n1, - S::size_type n2, S::value_type c, +test(S s, typename S::size_type pos, typename S::size_type n1, + typename S::size_type n2, typename S::value_type c, S expected) { - S::size_type old_size = s.size(); + typename S::size_type old_size = s.size(); S s0 = s; try { @@ -32,8 +33,8 @@ test(S s, S::size_type pos, S::size_type n1, assert(s.__invariants()); assert(pos <= old_size); assert(s == expected); - S::size_type xlen = std::min(n1, old_size - pos); - S::size_type rlen = n2; + typename S::size_type xlen = std::min(n1, old_size - pos); + typename S::size_type rlen = n2; assert(s.size() == old_size - xlen + rlen); } catch (std::out_of_range&) @@ -43,6 +44,7 @@ test(S s, S::size_type pos, S::size_type n1, } } +template void test0() { test(S(""), 0, 0, 0, '2', S("")); @@ -147,6 +149,7 @@ void test0() test(S("abcde"), 5, 1, 20, '2', S("abcde22222222222222222222")); } +template void test1() { test(S("abcde"), 6, 0, 0, '2', S("can't happen")); @@ -251,6 +254,7 @@ void test1() test(S("abcdefghij"), 11, 0, 20, '2', S("can't happen")); } +template void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, 0, '2', S("abcdefghijklmnopqrst")); @@ -353,7 +357,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp index b64aa123..08e90688 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp @@ -12,19 +12,18 @@ // basic_string& // replace(size_type pos1, size_type n1, const basic_string& str); -#include - #include #include #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S::size_type n1, S str, S expected) +test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) { - S::size_type old_size = s.size(); + typename S::size_type old_size = s.size(); S s0 = s; try { @@ -32,8 +31,8 @@ test(S s, S::size_type pos1, S::size_type n1, S str, S expected) assert(s.__invariants()); assert(pos1 <= old_size); assert(s == expected); - S::size_type xlen = std::min(n1, old_size - pos1); - S::size_type rlen = str.size(); + typename S::size_type xlen = std::min(n1, old_size - pos1); + typename S::size_type rlen = str.size(); assert(s.size() == old_size - xlen + rlen); } catch (std::out_of_range&) @@ -43,6 +42,7 @@ test(S s, S::size_type pos1, S::size_type n1, S str, S expected) } } +template void test0() { test(S(""), 0, 0, S(""), S("")); @@ -147,6 +147,7 @@ void test0() test(S("abcde"), 5, 1, S("12345678901234567890"), S("abcde12345678901234567890")); } +template void test1() { test(S("abcde"), 6, 0, S(""), S("can't happen")); @@ -251,6 +252,7 @@ void test1() test(S("abcdefghij"), 11, 0, S("12345678901234567890"), S("can't happen")); } +template void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), S("abcdefghijklmnopqrst")); @@ -353,7 +355,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp index e7bc351b..09998001 100644 --- a/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp @@ -13,21 +13,20 @@ // replace(size_type pos1, size_type n1, const basic_string& str, // size_type pos2, size_type n2); -#include - #include #include #include #include -typedef std::string S; +#include "../../min_allocator.h" +template void -test(S s, S::size_type pos1, S::size_type n1, - S str, S::size_type pos2, S::size_type n2, +test(S s, typename S::size_type pos1, typename S::size_type n1, + S str, typename S::size_type pos2, typename S::size_type n2, S expected) { - S::size_type old_size = s.size(); + typename S::size_type old_size = s.size(); S s0 = s; try { @@ -35,8 +34,8 @@ test(S s, S::size_type pos1, S::size_type n1, assert(s.__invariants()); assert(pos1 <= old_size && pos2 <= str.size()); assert(s == expected); - S::size_type xlen = std::min(n1, old_size - pos1); - S::size_type rlen = std::min(n2, str.size() - pos2); + typename S::size_type xlen = std::min(n1, old_size - pos1); + typename S::size_type rlen = std::min(n2, str.size() - pos2); assert(s.size() == old_size - xlen + rlen); } catch (std::out_of_range&) @@ -46,6 +45,7 @@ test(S s, S::size_type pos1, S::size_type n1, } } +template void test0() { test(S(""), 0, 0, S(""), 0, 0, S("")); @@ -150,6 +150,7 @@ void test0() test(S(""), 0, 1, S("12345"), 6, 0, S("can't happen")); } +template void test1() { test(S(""), 0, 1, S("1234567890"), 0, 0, S("")); @@ -254,6 +255,7 @@ void test1() test(S(""), 1, 0, S("12345678901234567890"), 0, 1, S("can't happen")); } +template void test2() { test(S(""), 1, 0, S("12345678901234567890"), 0, 10, S("can't happen")); @@ -358,6 +360,7 @@ void test2() test(S("abcde"), 0, 1, S("12345"), 0, 0, S("bcde")); } +template void test3() { test(S("abcde"), 0, 1, S("12345"), 0, 1, S("1bcde")); @@ -462,6 +465,7 @@ void test3() test(S("abcde"), 0, 2, S("1234567890"), 0, 9, S("123456789cde")); } +template void test4() { test(S("abcde"), 0, 2, S("1234567890"), 0, 10, S("1234567890cde")); @@ -566,6 +570,7 @@ void test4() test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 21, S("12345678901234567890e")); } +template void test5() { test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 0, S("e")); @@ -670,6 +675,7 @@ void test5() test(S("abcde"), 0, 6, S("12345"), 0, 5, S("12345")); } +template void test6() { test(S("abcde"), 0, 6, S("12345"), 0, 6, S("12345")); @@ -774,6 +780,7 @@ void test6() test(S("abcde"), 1, 0, S("1234567890"), 1, 1, S("a2bcde")); } +template void test7() { test(S("abcde"), 1, 0, S("1234567890"), 1, 4, S("a2345bcde")); @@ -878,6 +885,7 @@ void test7() test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cde")); } +template void test8() { test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cde")); @@ -982,6 +990,7 @@ void test8() test(S("abcde"), 1, 3, S("12345"), 1, 2, S("a23e")); } +template void test9() { test(S("abcde"), 1, 3, S("12345"), 1, 3, S("a234e")); @@ -1086,6 +1095,7 @@ void test9() test(S("abcde"), 1, 4, S("1234567890"), 1, 10, S("a234567890")); } +template void test10() { test(S("abcde"), 1, 4, S("1234567890"), 5, 0, S("a")); @@ -1190,6 +1200,7 @@ void test10() test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 1, S("a1")); } +template void test11() { test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 5, S("a12345")); @@ -1294,6 +1305,7 @@ void test11() test(S("abcde"), 2, 1, S("12345"), 2, 0, S("abde")); } +template void test12() { test(S("abcde"), 2, 1, S("12345"), 2, 1, S("ab3de")); @@ -1398,6 +1410,7 @@ void test12() test(S("abcde"), 2, 2, S("1234567890"), 5, 4, S("ab6789e")); } +template void test13() { test(S("abcde"), 2, 2, S("1234567890"), 5, 5, S("ab67890e")); @@ -1502,6 +1515,7 @@ void test13() test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 11, S("ab1234567890")); } +template void test14() { test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 0, S("ab")); @@ -1606,6 +1620,7 @@ void test14() test(S("abcde"), 4, 0, S("12345"), 2, 4, S("abcd345e")); } +template void test15() { test(S("abcde"), 4, 0, S("12345"), 4, 0, S("abcde")); @@ -1710,6 +1725,7 @@ void test15() test(S("abcde"), 4, 1, S("1234567890"), 9, 1, S("abcd0")); } +template void test16() { test(S("abcde"), 4, 1, S("1234567890"), 9, 2, S("abcd0")); @@ -1814,6 +1830,7 @@ void test16() test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 0, S("abcd")); } +template void test17() { test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 1, S("abcd")); @@ -1918,6 +1935,7 @@ void test17() test(S("abcde"), 5, 1, S("12345"), 5, 0, S("abcde")); } +template void test18() { test(S("abcde"), 5, 1, S("12345"), 5, 1, S("abcde")); @@ -2022,6 +2040,7 @@ void test18() test(S("abcde"), 6, 0, S("1234567890"), 11, 0, S("can't happen")); } +template void test19() { test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 0, S("can't happen")); @@ -2126,6 +2145,7 @@ void test19() test(S("abcdefghij"), 0, 1, S(""), 0, 1, S("bcdefghij")); } +template void test20() { test(S("abcdefghij"), 0, 1, S(""), 1, 0, S("can't happen")); @@ -2230,6 +2250,7 @@ void test20() test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 1, S("1fghij")); } +template void test21() { test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 5, S("12345fghij")); @@ -2334,6 +2355,7 @@ void test21() test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 19, S("1234567890123456789j")); } +template void test22() { test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 20, S("12345678901234567890j")); @@ -2438,6 +2460,7 @@ void test22() test(S("abcdefghij"), 0, 11, S("12345"), 0, 2, S("12")); } +template void test23() { test(S("abcdefghij"), 0, 11, S("12345"), 0, 4, S("1234")); @@ -2542,6 +2565,7 @@ void test23() test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcdefghij")); } +template void test24() { test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 0, S("abcdefghij")); @@ -2646,6 +2670,7 @@ void test24() test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cdefghij")); } +template void test25() { test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cdefghij")); @@ -2750,6 +2775,7 @@ void test25() test(S("abcdefghij"), 1, 8, S("12345"), 1, 0, S("aj")); } +template void test26() { test(S("abcdefghij"), 1, 8, S("12345"), 1, 1, S("a2j")); @@ -2854,6 +2880,7 @@ void test26() test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 8, S("a23456789")); } +template void test27() { test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 9, S("a234567890")); @@ -2958,6 +2985,7 @@ void test27() test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 20, S("a2345678901234567890")); } +template void test28() { test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 0, S("a")); @@ -3062,6 +3090,7 @@ void test28() test(S("abcdefghij"), 5, 1, S("12345"), 1, 4, S("abcde2345ghij")); } +template void test29() { test(S("abcdefghij"), 5, 1, S("12345"), 1, 5, S("abcde2345ghij")); @@ -3166,6 +3195,7 @@ void test29() test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 1, S("abcde6hij")); } +template void test30() { test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 2, S("abcde67hij")); @@ -3270,6 +3300,7 @@ void test30() test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 9, S("abcde123456789j")); } +template void test31() { test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 10, S("abcde1234567890j")); @@ -3374,6 +3405,7 @@ void test31() test(S("abcdefghij"), 5, 6, S("12345"), 2, 2, S("abcde34")); } +template void test32() { test(S("abcdefghij"), 5, 6, S("12345"), 2, 3, S("abcde345")); @@ -3478,6 +3510,7 @@ void test32() test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 6, S("abcdefghi67890j")); } +template void test33() { test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 0, S("abcdefghij")); @@ -3582,6 +3615,7 @@ void test33() test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 1, S("abcdefghi0")); } +template void test34() { test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 2, S("abcdefghi0")); @@ -3686,6 +3720,7 @@ void test34() test(S("abcdefghij"), 10, 0, S("12345"), 4, 1, S("abcdefghij5")); } +template void test35() { test(S("abcdefghij"), 10, 0, S("12345"), 4, 2, S("abcdefghij5")); @@ -3790,6 +3825,7 @@ void test35() test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 0, S("abcdefghij")); } +template void test36() { test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 1, S("abcdefghij")); @@ -3894,6 +3930,7 @@ void test36() test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 21, 0, S("can't happen")); } +template void test37() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, S("abcdefghijklmnopqrst")); @@ -3998,6 +4035,7 @@ void test37() test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 6, 0, S("can't happen")); } +template void test38() { test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 0, S("bcdefghijklmnopqrst")); @@ -4102,6 +4140,7 @@ void test38() test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 1, S("1klmnopqrst")); } +template void test39() { test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 10, S("1234567890klmnopqrst")); @@ -4206,6 +4245,7 @@ void test39() test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 0, S("")); } +template void test40() { test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 1, S("1")); @@ -4310,6 +4350,7 @@ void test40() test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 9, S("123456789")); } +template void test41() { test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 10, S("1234567890")); @@ -4414,6 +4455,7 @@ void test41() test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst")); } +template void test42() { test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst")); @@ -4518,6 +4560,7 @@ void test42() test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 5, S("a12345klmnopqrst")); } +template void test43() { test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 6, S("a12345klmnopqrst")); @@ -4622,6 +4665,7 @@ void test43() test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 1, S("a2t")); } +template void test44() { test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 4, S("a2345t")); @@ -4726,6 +4770,7 @@ void test44() test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 18, S("a234567890123456789")); } +template void test45() { test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 19, S("a2345678901234567890")); @@ -4830,6 +4875,7 @@ void test45() test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 2, S("abcdefghij23klmnopqrst")); } +template void test46() { test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 3, S("abcdefghij234klmnopqrst")); @@ -4934,6 +4980,7 @@ void test46() test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst")); } +template void test47() { test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 0, S("abcdefghijlmnopqrst")); @@ -5038,6 +5085,7 @@ void test47() test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 1, S("abcdefghij1pqrst")); } +template void test48() { test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst")); @@ -5142,6 +5190,7 @@ void test48() test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 0, S("abcdefghij")); } +template void test49() { test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 1, S("abcdefghij3")); @@ -5246,6 +5295,7 @@ void test49() test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 4, S("abcdefghij6789")); } +template void test50() { test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 5, S("abcdefghij67890")); @@ -5350,6 +5400,7 @@ void test50() test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t")); } +template void test51() { test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst")); @@ -5454,6 +5505,7 @@ void test51() test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 4, S("abcdefghijklmnopqrs345")); } +template void test52() { test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 0, S("abcdefghijklmnopqrs")); @@ -5558,6 +5610,7 @@ void test52() test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 1, S("abcdefghijklmnopqrst0")); } +template void test53() { test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 2, S("abcdefghijklmnopqrst0")); @@ -5662,6 +5715,7 @@ void test53() test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst")); } +template void test54() { test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst")); @@ -5744,59 +5798,122 @@ void test54() int main() { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + } +#endif } diff --git a/test/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp b/test/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp index 0eeaf3f8..adc65cc5 100644 --- a/test/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp +++ b/test/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s1, S s2) @@ -31,6 +33,7 @@ test(S s1, S s2) int main() { + { typedef std::string S; test(S(""), S("")); test(S(""), S("12345")); @@ -48,4 +51,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("12345")); test(S("abcdefghijklmnopqrst"), S("1234567890")); test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S("")); + test(S(""), S("12345")); + test(S(""), S("1234567890")); + test(S(""), S("12345678901234567890")); + test(S("abcde"), S("")); + test(S("abcde"), S("12345")); + test(S("abcde"), S("1234567890")); + test(S("abcde"), S("12345678901234567890")); + test(S("abcdefghij"), S("")); + test(S("abcdefghij"), S("12345")); + test(S("abcdefghij"), S("1234567890")); + test(S("abcdefghij"), S("12345678901234567890")); + test(S("abcdefghijklmnopqrst"), S("")); + test(S("abcdefghijklmnopqrst"), S("12345")); + test(S("abcdefghijklmnopqrst"), S("1234567890")); + test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp b/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp index 44aa73c9..2a3b03df 100644 --- a/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.io/get_line.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + int main() { { @@ -46,4 +48,34 @@ int main() assert(in.eof()); assert(s == L" ghij"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + std::istringstream in(" abc\n def\n ghij"); + S s("initial text"); + getline(in, s); + assert(in.good()); + assert(s == " abc"); + getline(in, s); + assert(in.good()); + assert(s == " def"); + getline(in, s); + assert(in.eof()); + assert(s == " ghij"); + } + { + typedef std::basic_string, min_allocator> S; + std::wistringstream in(L" abc\n def\n ghij"); + S s(L"initial text"); + getline(in, s); + assert(in.good()); + assert(s == L" abc"); + getline(in, s); + assert(in.good()); + assert(s == L" def"); + getline(in, s); + assert(in.eof()); + assert(s == L" ghij"); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp b/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp index d8e2fec5..a1ca8ce6 100644 --- a/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.io/get_line_delim.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + int main() { { @@ -52,4 +54,40 @@ int main() assert(in.eof()); assert(s == L" ghij"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + std::istringstream in(" abc* def** ghij"); + S s("initial text"); + getline(in, s, '*'); + assert(in.good()); + assert(s == " abc"); + getline(in, s, '*'); + assert(in.good()); + assert(s == " def"); + getline(in, s, '*'); + assert(in.good()); + assert(s == ""); + getline(in, s, '*'); + assert(in.eof()); + assert(s == " ghij"); + } + { + typedef std::basic_string, min_allocator> S; + std::wistringstream in(L" abc* def** ghij"); + S s(L"initial text"); + getline(in, s, L'*'); + assert(in.good()); + assert(s == L" abc"); + getline(in, s, L'*'); + assert(in.good()); + assert(s == L" def"); + getline(in, s, L'*'); + assert(in.good()); + assert(s == L""); + getline(in, s, L'*'); + assert(in.eof()); + assert(s == L" ghij"); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp index 7be2958b..47e66efd 100644 --- a/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -31,5 +33,19 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("initial text"); + getline(std::istringstream(" abc* def* ghij"), s, '*'); + assert(s == " abc"); + } + { + typedef std::basic_string, min_allocator> S; + S s(L"initial text"); + getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); + assert(s == L" abc"); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp index 7e46ad50..0565b37e 100644 --- a/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + int main() { #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -31,5 +33,19 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + S s("initial text"); + getline(std::istringstream(" abc\n def\n ghij"), s); + assert(s == " abc"); + } + { + typedef std::basic_string, min_allocator> S; + S s(L"initial text"); + getline(std::wistringstream(L" abc\n def\n ghij"), s); + assert(s == L" abc"); + } +#endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp b/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp index f0173706..689fb728 100644 --- a/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.io/stream_extract.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + int main() { { @@ -64,4 +66,52 @@ int main() in >> s; assert(in.fail()); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + std::istringstream in("a bc defghij"); + S s("initial text"); + in >> s; + assert(in.good()); + assert(s == "a"); + assert(in.peek() == ' '); + in >> s; + assert(in.good()); + assert(s == "bc"); + assert(in.peek() == ' '); + in.width(3); + in >> s; + assert(in.good()); + assert(s == "def"); + assert(in.peek() == 'g'); + in >> s; + assert(in.eof()); + assert(s == "ghij"); + in >> s; + assert(in.fail()); + } + { + typedef std::basic_string, min_allocator> S; + std::wistringstream in(L"a bc defghij"); + S s(L"initial text"); + in >> s; + assert(in.good()); + assert(s == L"a"); + assert(in.peek() == L' '); + in >> s; + assert(in.good()); + assert(s == L"bc"); + assert(in.peek() == L' '); + in.width(3); + in >> s; + assert(in.good()); + assert(s == L"def"); + assert(in.peek() == L'g'); + in >> s; + assert(in.eof()); + assert(s == L"ghij"); + in >> s; + assert(in.fail()); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp b/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp index 61760996..5f777ba1 100644 --- a/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.io/stream_insert.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + int main() { { @@ -50,4 +52,40 @@ int main() assert(out.good()); assert(L" " + s == out.str()); } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + std::basic_ostringstream out; + S s("some text"); + out << s; + assert(out.good()); + assert(s == out.str()); + } + { + typedef std::basic_string, min_allocator> S; + std::basic_ostringstream out; + S s("some text"); + out.width(12); + out << s; + assert(out.good()); + assert(" " + s == out.str()); + } + { + typedef std::basic_string, min_allocator> S; + std::basic_ostringstream out; + S s(L"some text"); + out << s; + assert(out.good()); + assert(s == out.str()); + } + { + typedef std::basic_string, min_allocator> S; + std::basic_ostringstream out; + S s(L"some text"); + out.width(12); + out << s; + assert(out.good()); + assert(L" " + s == out.str()); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp b/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp index 7b34a7a4..264494cb 100644 --- a/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "../../min_allocator.h" + template void test(S s1, S s2) @@ -33,6 +35,7 @@ test(S s1, S s2) int main() { + { typedef std::string S; test(S(""), S("")); test(S(""), S("12345")); @@ -50,4 +53,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("12345")); test(S("abcdefghijklmnopqrst"), S("1234567890")); test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S("")); + test(S(""), S("12345")); + test(S(""), S("1234567890")); + test(S(""), S("12345678901234567890")); + test(S("abcde"), S("")); + test(S("abcde"), S("12345")); + test(S("abcde"), S("1234567890")); + test(S("abcde"), S("12345678901234567890")); + test(S("abcdefghij"), S("")); + test(S("abcdefghij"), S("12345")); + test(S("abcdefghij"), S("1234567890")); + test(S("abcdefghij"), S("12345678901234567890")); + test(S("abcdefghijklmnopqrst"), S("")); + test(S("abcdefghijklmnopqrst"), S("12345")); + test(S("abcdefghijklmnopqrst"), S("1234567890")); + test(S("abcdefghijklmnopqrst"), S("12345678901234567890")); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp index 7c5fb30b..6810c4f7 100644 --- a/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op!=/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,10 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs != rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test("", S(""), false); test("", S("abcde"), true); test("", S("abcdefghij"), true); @@ -42,4 +44,26 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), true); test("abcdefghijklmnopqrst", S("abcdefghij"), true); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test("", S(""), false); + test("", S("abcde"), true); + test("", S("abcdefghij"), true); + test("", S("abcdefghijklmnopqrst"), true); + test("abcde", S(""), true); + test("abcde", S("abcde"), false); + test("abcde", S("abcdefghij"), true); + test("abcde", S("abcdefghijklmnopqrst"), true); + test("abcdefghij", S(""), true); + test("abcdefghij", S("abcde"), true); + test("abcdefghij", S("abcdefghij"), false); + test("abcdefghij", S("abcdefghijklmnopqrst"), true); + test("abcdefghijklmnopqrst", S(""), true); + test("abcdefghijklmnopqrst", S("abcde"), true); + test("abcdefghijklmnopqrst", S("abcdefghij"), true); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp index 8fcc0c55..e47214e6 100644 --- a/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op!=/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs != rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", false); test(S(""), "abcde", true); test(S(""), "abcdefghij", true); @@ -42,4 +44,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", true); test(S("abcdefghijklmnopqrst"), "abcdefghij", true); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", false); + test(S(""), "abcde", true); + test(S(""), "abcdefghij", true); + test(S(""), "abcdefghijklmnopqrst", true); + test(S("abcde"), "", true); + test(S("abcde"), "abcde", false); + test(S("abcde"), "abcdefghij", true); + test(S("abcde"), "abcdefghijklmnopqrst", true); + test(S("abcdefghij"), "", true); + test(S("abcdefghij"), "abcde", true); + test(S("abcdefghij"), "abcdefghij", false); + test(S("abcdefghij"), "abcdefghijklmnopqrst", true); + test(S("abcdefghijklmnopqrst"), "", true); + test(S("abcdefghijklmnopqrst"), "abcde", true); + test(S("abcdefghijklmnopqrst"), "abcdefghij", true); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp index 18639972..864da89d 100644 --- a/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op!=/string_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,10 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs != rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), false); test(S(""), S("abcde"), true); test(S(""), S("abcdefghij"), true); @@ -43,4 +45,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), false); + test(S(""), S("abcde"), true); + test(S(""), S("abcdefghij"), true); + test(S(""), S("abcdefghijklmnopqrst"), true); + test(S("abcde"), S(""), true); + test(S("abcde"), S("abcde"), false); + test(S("abcde"), S("abcdefghij"), true); + test(S("abcde"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghij"), S(""), true); + test(S("abcdefghij"), S("abcde"), true); + test(S("abcdefghij"), S("abcdefghij"), false); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghijklmnopqrst"), S(""), true); + test(S("abcdefghijklmnopqrst"), S("abcde"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp index 65662f0d..2d095a2b 100644 --- a/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp @@ -20,6 +20,8 @@ #include #include +#include "../../min_allocator.h" + template void test0(typename S::value_type lhs, const S& rhs, const S& x) @@ -38,15 +40,15 @@ test1(typename S::value_type lhs, S&& rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); - + #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test1('a', S(""), S("a")); @@ -55,4 +57,23 @@ int main() test1('a', S("12345678901234567890"), S("a12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0('a', S(""), S("a")); + test0('a', S("12345"), S("a12345")); + test0('a', S("1234567890"), S("a1234567890")); + test0('a', S("12345678901234567890"), S("a12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1('a', S(""), S("a")); + test1('a', S("12345"), S("a12345")); + test1('a', S("1234567890"), S("a1234567890")); + test1('a', S("12345678901234567890"), S("a12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp index 00d12d4b..a06157de 100644 --- a/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp @@ -20,6 +20,8 @@ #include #include +#include "../../min_allocator.h" + template void test0(const typename S::value_type* lhs, const S& rhs, const S& x) @@ -38,10 +40,10 @@ test1(const typename S::value_type* lhs, S&& rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); test0("", S("1234567890"), S("1234567890")); @@ -79,4 +81,47 @@ int main() test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0("", S(""), S("")); + test0("", S("12345"), S("12345")); + test0("", S("1234567890"), S("1234567890")); + test0("", S("12345678901234567890"), S("12345678901234567890")); + test0("abcde", S(""), S("abcde")); + test0("abcde", S("12345"), S("abcde12345")); + test0("abcde", S("1234567890"), S("abcde1234567890")); + test0("abcde", S("12345678901234567890"), S("abcde12345678901234567890")); + test0("abcdefghij", S(""), S("abcdefghij")); + test0("abcdefghij", S("12345"), S("abcdefghij12345")); + test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); + test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); + test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); + test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1("", S(""), S("")); + test1("", S("12345"), S("12345")); + test1("", S("1234567890"), S("1234567890")); + test1("", S("12345678901234567890"), S("12345678901234567890")); + test1("abcde", S(""), S("abcde")); + test1("abcde", S("12345"), S("abcde12345")); + test1("abcde", S("1234567890"), S("abcde1234567890")); + test1("abcde", S("12345678901234567890"), S("abcde12345678901234567890")); + test1("abcdefghij", S(""), S("abcdefghij")); + test1("abcdefghij", S("12345"), S("abcdefghij12345")); + test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); + test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); + test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); + test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp index 6136d555..fa5d0bec 100644 --- a/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp @@ -20,6 +20,8 @@ #include #include +#include "../../min_allocator.h" + template void test0(const S& lhs, typename S::value_type rhs, const S& x) @@ -38,10 +40,10 @@ test1(S&& lhs, typename S::value_type rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); @@ -55,4 +57,23 @@ int main() test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(S(""), '1', S("1")); + test0(S("abcde"), '1', S("abcde1")); + test0(S("abcdefghij"), '1', S("abcdefghij1")); + test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), '1', S("1")); + test1(S("abcde"), '1', S("abcde1")); + test1(S("abcdefghij"), '1', S("abcdefghij1")); + test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp index db8f4d68..0be44c75 100644 --- a/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp @@ -20,6 +20,8 @@ #include #include +#include "../../min_allocator.h" + template void test0(const S& lhs, const typename S::value_type* rhs, const S& x) @@ -38,10 +40,10 @@ test1(S&& lhs, const typename S::value_type* rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); test0(S(""), "1234567890", S("1234567890")); @@ -79,4 +81,47 @@ int main() test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(S(""), "", S("")); + test0(S(""), "12345", S("12345")); + test0(S(""), "1234567890", S("1234567890")); + test0(S(""), "12345678901234567890", S("12345678901234567890")); + test0(S("abcde"), "", S("abcde")); + test0(S("abcde"), "12345", S("abcde12345")); + test0(S("abcde"), "1234567890", S("abcde1234567890")); + test0(S("abcde"), "12345678901234567890", S("abcde12345678901234567890")); + test0(S("abcdefghij"), "", S("abcdefghij")); + test0(S("abcdefghij"), "12345", S("abcdefghij12345")); + test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); + test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); + test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), "", S("")); + test1(S(""), "12345", S("12345")); + test1(S(""), "1234567890", S("1234567890")); + test1(S(""), "12345678901234567890", S("12345678901234567890")); + test1(S("abcde"), "", S("abcde")); + test1(S("abcde"), "12345", S("abcde12345")); + test1(S("abcde"), "1234567890", S("abcde1234567890")); + test1(S("abcde"), "12345678901234567890", S("abcde12345678901234567890")); + test1(S("abcdefghij"), "", S("abcdefghij")); + test1(S("abcdefghij"), "12345", S("abcdefghij12345")); + test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); + test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp index 1ffcf922..4a9fabe3 100644 --- a/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp @@ -32,6 +32,8 @@ #include #include +#include "../../min_allocator.h" + template void test0(const S& lhs, const S& rhs, const S& x) @@ -64,10 +66,10 @@ test3(S&& lhs, S&& rhs, const S& x) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -typedef std::string S; - int main() { + { + typedef std::string S; test0(S(""), S(""), S("")); test0(S(""), S("12345"), S("12345")); test0(S(""), S("1234567890"), S("1234567890")); @@ -139,4 +141,81 @@ int main() test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(S(""), S(""), S("")); + test0(S(""), S("12345"), S("12345")); + test0(S(""), S("1234567890"), S("1234567890")); + test0(S(""), S("12345678901234567890"), S("12345678901234567890")); + test0(S("abcde"), S(""), S("abcde")); + test0(S("abcde"), S("12345"), S("abcde12345")); + test0(S("abcde"), S("1234567890"), S("abcde1234567890")); + test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcdefghij"), S(""), S("abcdefghij")); + test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), S(""), S("")); + test1(S(""), S("12345"), S("12345")); + test1(S(""), S("1234567890"), S("1234567890")); + test1(S(""), S("12345678901234567890"), S("12345678901234567890")); + test1(S("abcde"), S(""), S("abcde")); + test1(S("abcde"), S("12345"), S("abcde12345")); + test1(S("abcde"), S("1234567890"), S("abcde1234567890")); + test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcdefghij"), S(""), S("abcdefghij")); + test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test2(S(""), S(""), S("")); + test2(S(""), S("12345"), S("12345")); + test2(S(""), S("1234567890"), S("1234567890")); + test2(S(""), S("12345678901234567890"), S("12345678901234567890")); + test2(S("abcde"), S(""), S("abcde")); + test2(S("abcde"), S("12345"), S("abcde12345")); + test2(S("abcde"), S("1234567890"), S("abcde1234567890")); + test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcdefghij"), S(""), S("abcdefghij")); + test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test3(S(""), S(""), S("")); + test3(S(""), S("12345"), S("12345")); + test3(S(""), S("1234567890"), S("1234567890")); + test3(S(""), S("12345678901234567890"), S("12345678901234567890")); + test3(S("abcde"), S(""), S("abcde")); + test3(S("abcde"), S("12345"), S("abcde12345")); + test3(S("abcde"), S("1234567890"), S("abcde1234567890")); + test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcdefghij"), S(""), S("abcdefghij")); + test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp index 249cd45e..a64881cf 100644 --- a/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_operator==/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,10 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs == rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test("", S(""), true); test("", S("abcde"), false); test("", S("abcdefghij"), false); @@ -42,4 +44,26 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), false); test("abcdefghijklmnopqrst", S("abcdefghij"), false); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test("", S(""), true); + test("", S("abcde"), false); + test("", S("abcdefghij"), false); + test("", S("abcdefghijklmnopqrst"), false); + test("abcde", S(""), false); + test("abcde", S("abcde"), true); + test("abcde", S("abcdefghij"), false); + test("abcde", S("abcdefghijklmnopqrst"), false); + test("abcdefghij", S(""), false); + test("abcdefghij", S("abcde"), false); + test("abcdefghij", S("abcdefghij"), true); + test("abcdefghij", S("abcdefghijklmnopqrst"), false); + test("abcdefghijklmnopqrst", S(""), false); + test("abcdefghijklmnopqrst", S("abcde"), false); + test("abcdefghijklmnopqrst", S("abcdefghij"), false); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp index 94039ff6..77ebe081 100644 --- a/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_operator==/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs == rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", true); test(S(""), "abcde", false); test(S(""), "abcdefghij", false); @@ -42,4 +44,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", false); test(S("abcdefghijklmnopqrst"), "abcdefghij", false); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", true); + test(S(""), "abcde", false); + test(S(""), "abcdefghij", false); + test(S(""), "abcdefghijklmnopqrst", false); + test(S("abcde"), "", false); + test(S("abcde"), "abcde", true); + test(S("abcde"), "abcdefghij", false); + test(S("abcde"), "abcdefghijklmnopqrst", false); + test(S("abcdefghij"), "", false); + test(S("abcdefghij"), "abcde", false); + test(S("abcdefghij"), "abcdefghij", true); + test(S("abcdefghij"), "abcdefghijklmnopqrst", false); + test(S("abcdefghijklmnopqrst"), "", false); + test(S("abcdefghijklmnopqrst"), "abcde", false); + test(S("abcdefghijklmnopqrst"), "abcdefghij", false); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp index ed9df5a3..5946839b 100644 --- a/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_operator==/string_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,10 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs == rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), true); test(S(""), S("abcde"), false); test(S(""), S("abcdefghij"), false); @@ -43,4 +45,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), true); + test(S(""), S("abcde"), false); + test(S(""), S("abcdefghij"), false); + test(S(""), S("abcdefghijklmnopqrst"), false); + test(S("abcde"), S(""), false); + test(S("abcde"), S("abcde"), true); + test(S("abcde"), S("abcdefghij"), false); + test(S("abcde"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghij"), S(""), false); + test(S("abcdefghij"), S("abcde"), false); + test(S("abcdefghij"), S("abcdefghij"), true); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghijklmnopqrst"), S(""), false); + test(S("abcdefghijklmnopqrst"), S("abcde"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp index 32b4de40..56af158e 100644 --- a/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_opgt/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,10 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs > rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test("", S(""), false); test("", S("abcde"), false); test("", S("abcdefghij"), false); @@ -42,4 +44,26 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), true); test("abcdefghijklmnopqrst", S("abcdefghij"), true); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test("", S(""), false); + test("", S("abcde"), false); + test("", S("abcdefghij"), false); + test("", S("abcdefghijklmnopqrst"), false); + test("abcde", S(""), true); + test("abcde", S("abcde"), false); + test("abcde", S("abcdefghij"), false); + test("abcde", S("abcdefghijklmnopqrst"), false); + test("abcdefghij", S(""), true); + test("abcdefghij", S("abcde"), true); + test("abcdefghij", S("abcdefghij"), false); + test("abcdefghij", S("abcdefghijklmnopqrst"), false); + test("abcdefghijklmnopqrst", S(""), true); + test("abcdefghijklmnopqrst", S("abcde"), true); + test("abcdefghijklmnopqrst", S("abcdefghij"), true); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp index c216a43f..0577ed0e 100644 --- a/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_opgt/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs > rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", false); test(S(""), "abcde", false); test(S(""), "abcdefghij", false); @@ -42,4 +44,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", true); test(S("abcdefghijklmnopqrst"), "abcdefghij", true); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", false); + test(S(""), "abcde", false); + test(S(""), "abcdefghij", false); + test(S(""), "abcdefghijklmnopqrst", false); + test(S("abcde"), "", true); + test(S("abcde"), "abcde", false); + test(S("abcde"), "abcdefghij", false); + test(S("abcde"), "abcdefghijklmnopqrst", false); + test(S("abcdefghij"), "", true); + test(S("abcdefghij"), "abcde", true); + test(S("abcdefghij"), "abcdefghij", false); + test(S("abcdefghij"), "abcdefghijklmnopqrst", false); + test(S("abcdefghijklmnopqrst"), "", true); + test(S("abcdefghijklmnopqrst"), "abcde", true); + test(S("abcdefghijklmnopqrst"), "abcdefghij", true); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp index 88e83b3a..3074bc93 100644 --- a/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_opgt/string_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,10 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs > rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), false); test(S(""), S("abcde"), false); test(S(""), S("abcdefghij"), false); @@ -43,4 +45,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), false); + test(S(""), S("abcde"), false); + test(S(""), S("abcdefghij"), false); + test(S(""), S("abcdefghijklmnopqrst"), false); + test(S("abcde"), S(""), true); + test(S("abcde"), S("abcde"), false); + test(S("abcde"), S("abcdefghij"), false); + test(S("abcde"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghij"), S(""), true); + test(S("abcdefghij"), S("abcde"), true); + test(S("abcdefghij"), S("abcdefghij"), false); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghijklmnopqrst"), S(""), true); + test(S("abcdefghijklmnopqrst"), S("abcde"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp index 6e6208bb..2105af04 100644 --- a/test/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_opgt=/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,10 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs >= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test("", S(""), true); test("", S("abcde"), false); test("", S("abcdefghij"), false); @@ -42,4 +44,26 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), true); test("abcdefghijklmnopqrst", S("abcdefghij"), true); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test("", S(""), true); + test("", S("abcde"), false); + test("", S("abcdefghij"), false); + test("", S("abcdefghijklmnopqrst"), false); + test("abcde", S(""), true); + test("abcde", S("abcde"), true); + test("abcde", S("abcdefghij"), false); + test("abcde", S("abcdefghijklmnopqrst"), false); + test("abcdefghij", S(""), true); + test("abcdefghij", S("abcde"), true); + test("abcdefghij", S("abcdefghij"), true); + test("abcdefghij", S("abcdefghijklmnopqrst"), false); + test("abcdefghijklmnopqrst", S(""), true); + test("abcdefghijklmnopqrst", S("abcde"), true); + test("abcdefghijklmnopqrst", S("abcdefghij"), true); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp index 9a496f7f..69359f76 100644 --- a/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_opgt=/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs >= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", true); test(S(""), "abcde", false); test(S(""), "abcdefghij", false); @@ -42,4 +44,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", true); test(S("abcdefghijklmnopqrst"), "abcdefghij", true); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", true); + test(S(""), "abcde", false); + test(S(""), "abcdefghij", false); + test(S(""), "abcdefghijklmnopqrst", false); + test(S("abcde"), "", true); + test(S("abcde"), "abcde", true); + test(S("abcde"), "abcdefghij", false); + test(S("abcde"), "abcdefghijklmnopqrst", false); + test(S("abcdefghij"), "", true); + test(S("abcdefghij"), "abcde", true); + test(S("abcdefghij"), "abcdefghij", true); + test(S("abcdefghij"), "abcdefghijklmnopqrst", false); + test(S("abcdefghijklmnopqrst"), "", true); + test(S("abcdefghijklmnopqrst"), "abcde", true); + test(S("abcdefghijklmnopqrst"), "abcdefghij", true); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp index c6bb659e..32c34068 100644 --- a/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_opgt=/string_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,10 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs >= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), true); test(S(""), S("abcde"), false); test(S(""), S("abcdefghij"), false); @@ -43,4 +45,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), true); + test(S(""), S("abcde"), false); + test(S(""), S("abcdefghij"), false); + test(S(""), S("abcdefghijklmnopqrst"), false); + test(S("abcde"), S(""), true); + test(S("abcde"), S("abcde"), true); + test(S("abcde"), S("abcdefghij"), false); + test(S("abcde"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghij"), S(""), true); + test(S("abcdefghij"), S("abcde"), true); + test(S("abcdefghij"), S("abcdefghij"), true); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false); + test(S("abcdefghijklmnopqrst"), S(""), true); + test(S("abcdefghijklmnopqrst"), S("abcde"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp index 8c6270e0..28e8db93 100644 --- a/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_oplt/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,10 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs < rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test("", S(""), false); test("", S("abcde"), true); test("", S("abcdefghij"), true); @@ -42,4 +44,26 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), false); test("abcdefghijklmnopqrst", S("abcdefghij"), false); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test("", S(""), false); + test("", S("abcde"), true); + test("", S("abcdefghij"), true); + test("", S("abcdefghijklmnopqrst"), true); + test("abcde", S(""), false); + test("abcde", S("abcde"), false); + test("abcde", S("abcdefghij"), true); + test("abcde", S("abcdefghijklmnopqrst"), true); + test("abcdefghij", S(""), false); + test("abcdefghij", S("abcde"), false); + test("abcdefghij", S("abcdefghij"), false); + test("abcdefghij", S("abcdefghijklmnopqrst"), true); + test("abcdefghijklmnopqrst", S(""), false); + test("abcdefghijklmnopqrst", S("abcde"), false); + test("abcdefghijklmnopqrst", S("abcdefghij"), false); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp index 9791d914..66063bb2 100644 --- a/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_oplt/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs < rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", false); test(S(""), "abcde", true); test(S(""), "abcdefghij", true); @@ -42,4 +44,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", false); test(S("abcdefghijklmnopqrst"), "abcdefghij", false); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", false); + test(S(""), "abcde", true); + test(S(""), "abcdefghij", true); + test(S(""), "abcdefghijklmnopqrst", true); + test(S("abcde"), "", false); + test(S("abcde"), "abcde", false); + test(S("abcde"), "abcdefghij", true); + test(S("abcde"), "abcdefghijklmnopqrst", true); + test(S("abcdefghij"), "", false); + test(S("abcdefghij"), "abcde", false); + test(S("abcdefghij"), "abcdefghij", false); + test(S("abcdefghij"), "abcdefghijklmnopqrst", true); + test(S("abcdefghijklmnopqrst"), "", false); + test(S("abcdefghijklmnopqrst"), "abcde", false); + test(S("abcdefghijklmnopqrst"), "abcdefghij", false); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp index 726f70bb..3c5d1155 100644 --- a/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_oplt/string_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,10 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs < rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), false); test(S(""), S("abcde"), true); test(S(""), S("abcdefghij"), true); @@ -43,4 +45,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), false); + test(S(""), S("abcde"), true); + test(S(""), S("abcdefghij"), true); + test(S(""), S("abcdefghijklmnopqrst"), true); + test(S("abcde"), S(""), false); + test(S("abcde"), S("abcde"), false); + test(S("abcde"), S("abcdefghij"), true); + test(S("abcde"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghij"), S(""), false); + test(S("abcdefghij"), S("abcde"), false); + test(S("abcdefghij"), S("abcdefghij"), false); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghijklmnopqrst"), S(""), false); + test(S("abcdefghijklmnopqrst"), S("abcde"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp index d206bf30..05ab3196 100644 --- a/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_oplt=/pointer_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const typename S::value_type* lhs, const S& rhs, bool x) @@ -22,10 +24,10 @@ test(const typename S::value_type* lhs, const S& rhs, bool x) assert((lhs <= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test("", S(""), true); test("", S("abcde"), true); test("", S("abcdefghij"), true); @@ -42,4 +44,26 @@ int main() test("abcdefghijklmnopqrst", S("abcde"), false); test("abcdefghijklmnopqrst", S("abcdefghij"), false); test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test("", S(""), true); + test("", S("abcde"), true); + test("", S("abcdefghij"), true); + test("", S("abcdefghijklmnopqrst"), true); + test("abcde", S(""), false); + test("abcde", S("abcde"), true); + test("abcde", S("abcdefghij"), true); + test("abcde", S("abcdefghijklmnopqrst"), true); + test("abcdefghij", S(""), false); + test("abcdefghij", S("abcde"), false); + test("abcdefghij", S("abcdefghij"), true); + test("abcdefghij", S("abcdefghijklmnopqrst"), true); + test("abcdefghijklmnopqrst", S(""), false); + test("abcdefghijklmnopqrst", S("abcde"), false); + test("abcdefghijklmnopqrst", S("abcdefghij"), false); + test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp b/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp index aad4694d..964d71c5 100644 --- a/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_oplt=/string_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const typename S::value_type* rhs, bool x) @@ -22,10 +24,10 @@ test(const S& lhs, const typename S::value_type* rhs, bool x) assert((lhs <= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", true); test(S(""), "abcde", true); test(S(""), "abcdefghij", true); @@ -42,4 +44,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", false); test(S("abcdefghijklmnopqrst"), "abcdefghij", false); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", true); + test(S(""), "abcde", true); + test(S(""), "abcdefghij", true); + test(S(""), "abcdefghijklmnopqrst", true); + test(S("abcde"), "", false); + test(S("abcde"), "abcde", true); + test(S("abcde"), "abcdefghij", true); + test(S("abcde"), "abcdefghijklmnopqrst", true); + test(S("abcdefghij"), "", false); + test(S("abcdefghij"), "abcde", false); + test(S("abcdefghij"), "abcdefghij", true); + test(S("abcdefghij"), "abcdefghijklmnopqrst", true); + test(S("abcdefghijklmnopqrst"), "", false); + test(S("abcdefghijklmnopqrst"), "abcde", false); + test(S("abcdefghijklmnopqrst"), "abcdefghij", false); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true); + } +#endif } diff --git a/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp b/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp index 470878af..5758ae3c 100644 --- a/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp +++ b/test/strings/basic.string/string.nonmembers/string_oplt=/string_string.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& lhs, const S& rhs, bool x) @@ -23,10 +25,10 @@ test(const S& lhs, const S& rhs, bool x) assert((lhs <= rhs) == x); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), true); test(S(""), S("abcde"), true); test(S(""), S("abcdefghij"), true); @@ -43,4 +45,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), true); + test(S(""), S("abcde"), true); + test(S(""), S("abcdefghij"), true); + test(S(""), S("abcdefghijklmnopqrst"), true); + test(S("abcde"), S(""), false); + test(S("abcde"), S("abcde"), true); + test(S("abcde"), S("abcdefghij"), true); + test(S("abcde"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghij"), S(""), false); + test(S("abcdefghij"), S("abcde"), false); + test(S("abcdefghij"), S("abcdefghij"), true); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true); + test(S("abcdefghijklmnopqrst"), S(""), false); + test(S("abcdefghijklmnopqrst"), S("abcde"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp b/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp index 0ab92526..3326b35a 100644 --- a/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp +++ b/test/strings/basic.string/string.ops/string.accessors/c_str.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s) @@ -31,9 +33,20 @@ test(const S& s) int main() { + { typedef std::string S; test(S("")); test(S("abcde")); test(S("abcdefghij")); test(S("abcdefghijklmnopqrst")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S("")); + test(S("abcde")); + test(S("abcdefghij")); + test(S("abcdefghijklmnopqrst")); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp b/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp index 26459b7c..c2c57f6f 100644 --- a/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp +++ b/test/strings/basic.string/string.ops/string.accessors/data.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s) @@ -31,9 +33,20 @@ test(const S& s) int main() { + { typedef std::string S; test(S("")); test(S("abcde")); test(S("abcdefghij")); test(S("abcdefghijklmnopqrst")); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S("")); + test(S("abcde")); + test(S("abcdefghij")); + test(S("abcdefghijklmnopqrst")); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp b/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp index 5223f3bb..8d998171 100644 --- a/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp +++ b/test/strings/basic.string/string.ops/string.accessors/get_allocator.pass.cpp @@ -15,6 +15,7 @@ #include #include "../../test_allocator.h" +#include "../../min_allocator.h" template void @@ -25,10 +26,22 @@ test(const S& s, const typename S::allocator_type& a) int main() { + { typedef test_allocator A; typedef std::basic_string, A> S; test(S(""), A()); test(S("abcde", A(1)), A(1)); test(S("abcdefghij", A(2)), A(2)); test(S("abcdefghijklmnopqrst", A(3)), A(3)); + } +#if __cplusplus >= 201103L + { + typedef min_allocator A; + typedef std::basic_string, A> S; + test(S(""), A()); + test(S("abcde", A()), A()); + test(S("abcdefghij", A()), A()); + test(S("abcdefghijklmnopqrst", A()), A()); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp b/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp index 14f999d1..c13905e2 100644 --- a/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp +++ b/test/strings/basic.string/string.ops/string_compare/pointer.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -30,10 +32,10 @@ test(const S& s, const typename S::value_type* str, int x) assert(sign(s.compare(str)) == sign(x)); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), "", 0); test(S(""), "abcde", -5); test(S(""), "abcdefghij", -10); @@ -50,4 +52,26 @@ int main() test(S("abcdefghijklmnopqrst"), "abcde", 15); test(S("abcdefghijklmnopqrst"), "abcdefghij", 10); test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), "", 0); + test(S(""), "abcde", -5); + test(S(""), "abcdefghij", -10); + test(S(""), "abcdefghijklmnopqrst", -20); + test(S("abcde"), "", 5); + test(S("abcde"), "abcde", 0); + test(S("abcde"), "abcdefghij", -5); + test(S("abcde"), "abcdefghijklmnopqrst", -15); + test(S("abcdefghij"), "", 10); + test(S("abcdefghij"), "abcde", 5); + test(S("abcdefghij"), "abcdefghij", 0); + test(S("abcdefghij"), "abcdefghijklmnopqrst", -10); + test(S("abcdefghijklmnopqrst"), "", 20); + test(S("abcdefghijklmnopqrst"), "abcde", 15); + test(S("abcdefghijklmnopqrst"), "abcdefghij", 10); + test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", 0); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp index d955652d..ca4b067a 100644 --- a/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp +++ b/test/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -40,8 +42,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1, } } -typedef std::string S; - +template void test0() { test(S(""), 0, 0, "", 0); @@ -146,6 +147,7 @@ void test0() test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", -20); } +template void test1() { test(S("abcde"), 6, 0, "", 0); @@ -250,6 +252,7 @@ void test1() test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 0); } +template void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0); @@ -352,7 +355,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp index 8373ca41..c94eaef3 100644 --- a/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -40,8 +42,7 @@ test(const S& s, typename S::size_type pos, typename S::size_type n1, } } -typedef std::string S; - +template void test0() { test(S(""), 0, 0, "", 0, 0); @@ -146,6 +147,7 @@ void test0() test(S("abcde"), 0, 4, "abcde", 2, 2); } +template void test1() { test(S("abcde"), 0, 4, "abcde", 4, 0); @@ -250,6 +252,7 @@ void test1() test(S("abcde"), 1, 3, "abcdefghij", 1, 1); } +template void test2() { test(S("abcde"), 1, 3, "abcdefghij", 5, 1); @@ -354,6 +357,7 @@ void test2() test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 0, 3); } +template void test3() { test(S("abcde"), 2, 3, "abcdefghijklmnopqrst", 1, 2); @@ -458,6 +462,7 @@ void test3() test(S("abcde"), 5, 1, "abcdefghijklmnopqrst", 20, -20); } +template void test4() { test(S("abcde"), 6, 0, "", 0, 0); @@ -562,6 +567,7 @@ void test4() test(S("abcdefghij"), 0, 11, "abcde", 2, 8); } +template void test5() { test(S("abcdefghij"), 0, 11, "abcde", 4, 6); @@ -666,6 +672,7 @@ void test5() test(S("abcdefghij"), 1, 10, "abcdefghij", 1, 1); } +template void test6() { test(S("abcdefghij"), 1, 10, "abcdefghij", 5, 1); @@ -770,6 +777,7 @@ void test6() test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 0, 5); } +template void test7() { test(S("abcdefghij"), 5, 6, "abcdefghijklmnopqrst", 1, 5); @@ -874,6 +882,7 @@ void test7() test(S("abcdefghij"), 11, 0, "abcdefghijklmnopqrst", 20, 0); } +template void test8() { test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, 0); @@ -978,6 +987,7 @@ void test8() test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 2, -2); } +template void test9() { test(S("abcdefghijklmnopqrst"), 1, 0, "abcde", 4, -4); @@ -1082,6 +1092,7 @@ void test9() test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 1, -1); } +template void test10() { test(S("abcdefghijklmnopqrst"), 10, 0, "abcdefghij", 5, -5); @@ -1186,6 +1197,7 @@ void test10() test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 0, 0); } +template void test11() { test(S("abcdefghijklmnopqrst"), 19, 0, "abcdefghijklmnopqrst", 1, -1); @@ -1276,16 +1288,36 @@ void test11() int main() { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp b/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp index a572ebcd..4312e276 100644 --- a/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp +++ b/test/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp @@ -15,6 +15,8 @@ #include #include +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -40,8 +42,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1, } } -typedef std::string S; - +template void test0() { test(S(""), 0, 0, S(""), 0); @@ -146,6 +147,7 @@ void test0() test(S("abcde"), 5, 1, S("abcdefghijklmnopqrst"), -20); } +template void test1() { test(S("abcde"), 6, 0, S(""), 0); @@ -250,6 +252,7 @@ void test1() test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 0); } +template void test2() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0); @@ -352,7 +355,18 @@ void test2() int main() { - test0(); - test1(); - test2(); + { + typedef std::string S; + test0(); + test1(); + test2(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp index 401fbe32..8fa23b7e 100644 --- a/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -42,8 +44,7 @@ test(const S& s, typename S::size_type pos1, typename S::size_type n1, } } -typedef std::string S; - +template void test0() { test(S(""), 0, 0, S(""), 0, 0, 0); @@ -148,6 +149,7 @@ void test0() test(S(""), 0, 1, S("abcde"), 6, 0, 0); } +template void test1() { test(S(""), 0, 1, S("abcdefghij"), 0, 0, 0); @@ -252,6 +254,7 @@ void test1() test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 1, 0); } +template void test2() { test(S(""), 1, 0, S("abcdefghijklmnopqrst"), 0, 10, 0); @@ -356,6 +359,7 @@ void test2() test(S("abcde"), 0, 1, S("abcde"), 0, 0, 1); } +template void test3() { test(S("abcde"), 0, 1, S("abcde"), 0, 1, 0); @@ -460,6 +464,7 @@ void test3() test(S("abcde"), 0, 2, S("abcdefghij"), 0, 9, -7); } +template void test4() { test(S("abcde"), 0, 2, S("abcdefghij"), 0, 10, -8); @@ -564,6 +569,7 @@ void test4() test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 0, 21, -16); } +template void test5() { test(S("abcde"), 0, 4, S("abcdefghijklmnopqrst"), 1, 0, 4); @@ -668,6 +674,7 @@ void test5() test(S("abcde"), 0, 6, S("abcde"), 0, 5, 0); } +template void test6() { test(S("abcde"), 0, 6, S("abcde"), 0, 6, 0); @@ -772,6 +779,7 @@ void test6() test(S("abcde"), 1, 0, S("abcdefghij"), 1, 1, -1); } +template void test7() { test(S("abcde"), 1, 0, S("abcdefghij"), 1, 4, -4); @@ -876,6 +884,7 @@ void test7() test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 18, -17); } +template void test8() { test(S("abcde"), 1, 1, S("abcdefghijklmnopqrst"), 1, 19, -18); @@ -980,6 +989,7 @@ void test8() test(S("abcde"), 1, 3, S("abcde"), 1, 2, 1); } +template void test9() { test(S("abcde"), 1, 3, S("abcde"), 1, 3, 0); @@ -1084,6 +1094,7 @@ void test9() test(S("abcde"), 1, 4, S("abcdefghij"), 1, 10, -5); } +template void test10() { test(S("abcde"), 1, 4, S("abcdefghij"), 5, 0, 4); @@ -1188,6 +1199,7 @@ void test10() test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 1, -9); } +template void test11() { test(S("abcde"), 1, 5, S("abcdefghijklmnopqrst"), 10, 5, -9); @@ -1292,6 +1304,7 @@ void test11() test(S("abcde"), 2, 1, S("abcde"), 2, 0, 1); } +template void test12() { test(S("abcde"), 2, 1, S("abcde"), 2, 1, 0); @@ -1396,6 +1409,7 @@ void test12() test(S("abcde"), 2, 2, S("abcdefghij"), 5, 4, -3); } +template void test13() { test(S("abcde"), 2, 2, S("abcdefghij"), 5, 5, -3); @@ -1500,6 +1514,7 @@ void test13() test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 10, 11, -8); } +template void test14() { test(S("abcde"), 2, 3, S("abcdefghijklmnopqrst"), 19, 0, 3); @@ -1604,6 +1619,7 @@ void test14() test(S("abcde"), 4, 0, S("abcde"), 2, 4, -3); } +template void test15() { test(S("abcde"), 4, 0, S("abcde"), 4, 0, 0); @@ -1708,6 +1724,7 @@ void test15() test(S("abcde"), 4, 1, S("abcdefghij"), 9, 1, -5); } +template void test16() { test(S("abcde"), 4, 1, S("abcdefghij"), 9, 2, -5); @@ -1812,6 +1829,7 @@ void test16() test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 20, 0, 1); } +template void test17() { test(S("abcde"), 4, 2, S("abcdefghijklmnopqrst"), 20, 1, 1); @@ -1916,6 +1934,7 @@ void test17() test(S("abcde"), 5, 1, S("abcde"), 5, 0, 0); } +template void test18() { test(S("abcde"), 5, 1, S("abcde"), 5, 1, 0); @@ -2020,6 +2039,7 @@ void test18() test(S("abcde"), 6, 0, S("abcdefghij"), 11, 0, 0); } +template void test19() { test(S("abcde"), 6, 0, S("abcdefghijklmnopqrst"), 0, 0, 0); @@ -2124,6 +2144,7 @@ void test19() test(S("abcdefghij"), 0, 1, S(""), 0, 1, 1); } +template void test20() { test(S("abcdefghij"), 0, 1, S(""), 1, 0, 0); @@ -2228,6 +2249,7 @@ void test20() test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 1, 4); } +template void test21() { test(S("abcdefghij"), 0, 5, S("abcdefghij"), 0, 5, 0); @@ -2332,6 +2354,7 @@ void test21() test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 19, -10); } +template void test22() { test(S("abcdefghij"), 0, 9, S("abcdefghijklmnopqrst"), 0, 20, -11); @@ -2436,6 +2459,7 @@ void test22() test(S("abcdefghij"), 0, 11, S("abcde"), 0, 2, 8); } +template void test23() { test(S("abcdefghij"), 0, 11, S("abcde"), 0, 4, 6); @@ -2540,6 +2564,7 @@ void test23() test(S("abcdefghij"), 1, 0, S("abcdefghij"), 0, 11, -10); } +template void test24() { test(S("abcdefghij"), 1, 0, S("abcdefghij"), 1, 0, 0); @@ -2644,6 +2669,7 @@ void test24() test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 1, 0); } +template void test25() { test(S("abcdefghij"), 1, 1, S("abcdefghijklmnopqrst"), 1, 9, -8); @@ -2748,6 +2774,7 @@ void test25() test(S("abcdefghij"), 1, 8, S("abcde"), 1, 0, 8); } +template void test26() { test(S("abcdefghij"), 1, 8, S("abcde"), 1, 1, 7); @@ -2852,6 +2879,7 @@ void test26() test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 8, 1); } +template void test27() { test(S("abcdefghij"), 1, 9, S("abcdefghij"), 1, 9, 0); @@ -2956,6 +2984,7 @@ void test27() test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 1, 20, -10); } +template void test28() { test(S("abcdefghij"), 1, 10, S("abcdefghijklmnopqrst"), 10, 0, 9); @@ -3060,6 +3089,7 @@ void test28() test(S("abcdefghij"), 5, 1, S("abcde"), 1, 4, 4); } +template void test29() { test(S("abcdefghij"), 5, 1, S("abcde"), 1, 5, 4); @@ -3164,6 +3194,7 @@ void test29() test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 1, 1); } +template void test30() { test(S("abcdefghij"), 5, 2, S("abcdefghij"), 5, 2, 0); @@ -3268,6 +3299,7 @@ void test30() test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 9, -5); } +template void test31() { test(S("abcdefghij"), 5, 4, S("abcdefghijklmnopqrst"), 10, 10, -5); @@ -3372,6 +3404,7 @@ void test31() test(S("abcdefghij"), 5, 6, S("abcde"), 2, 2, 3); } +template void test32() { test(S("abcdefghij"), 5, 6, S("abcde"), 2, 3, 3); @@ -3476,6 +3509,7 @@ void test32() test(S("abcdefghij"), 9, 0, S("abcdefghij"), 5, 6, -5); } +template void test33() { test(S("abcdefghij"), 9, 0, S("abcdefghij"), 9, 0, 0); @@ -3580,6 +3614,7 @@ void test33() test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 1, -10); } +template void test34() { test(S("abcdefghij"), 9, 1, S("abcdefghijklmnopqrst"), 19, 2, -10); @@ -3684,6 +3719,7 @@ void test34() test(S("abcdefghij"), 10, 0, S("abcde"), 4, 1, -1); } +template void test35() { test(S("abcdefghij"), 10, 0, S("abcde"), 4, 2, -1); @@ -3788,6 +3824,7 @@ void test35() test(S("abcdefghij"), 10, 1, S("abcdefghij"), 10, 0, 0); } +template void test36() { test(S("abcdefghij"), 10, 1, S("abcdefghij"), 10, 1, 0); @@ -3892,6 +3929,7 @@ void test36() test(S("abcdefghij"), 11, 0, S("abcdefghijklmnopqrst"), 21, 0, 0); } +template void test37() { test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, 0); @@ -3996,6 +4034,7 @@ void test37() test(S("abcdefghijklmnopqrst"), 0, 1, S("abcde"), 6, 0, 0); } +template void test38() { test(S("abcdefghijklmnopqrst"), 0, 1, S("abcdefghij"), 0, 0, 1); @@ -4100,6 +4139,7 @@ void test38() test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 1, 9); } +template void test39() { test(S("abcdefghijklmnopqrst"), 0, 10, S("abcdefghijklmnopqrst"), 0, 10, 0); @@ -4204,6 +4244,7 @@ void test39() test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 0, 20); } +template void test40() { test(S("abcdefghijklmnopqrst"), 0, 20, S("abcde"), 0, 1, 19); @@ -4308,6 +4349,7 @@ void test40() test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 9, 11); } +template void test41() { test(S("abcdefghijklmnopqrst"), 0, 21, S("abcdefghij"), 0, 10, 10); @@ -4412,6 +4454,7 @@ void test41() test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 0, 21, -20); } +template void test42() { test(S("abcdefghijklmnopqrst"), 1, 0, S("abcdefghijklmnopqrst"), 1, 0, 0); @@ -4516,6 +4559,7 @@ void test42() test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 5, 1); } +template void test43() { test(S("abcdefghijklmnopqrst"), 1, 9, S("abcde"), 0, 6, 1); @@ -4620,6 +4664,7 @@ void test43() test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 1, 17); } +template void test44() { test(S("abcdefghijklmnopqrst"), 1, 18, S("abcdefghij"), 1, 4, 14); @@ -4724,6 +4769,7 @@ void test44() test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 18, 1); } +template void test45() { test(S("abcdefghijklmnopqrst"), 1, 19, S("abcdefghijklmnopqrst"), 1, 19, 0); @@ -4828,6 +4874,7 @@ void test45() test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 2, -2); } +template void test46() { test(S("abcdefghijklmnopqrst"), 10, 0, S("abcde"), 1, 3, -3); @@ -4932,6 +4979,7 @@ void test46() test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 1, 10, 9); } +template void test47() { test(S("abcdefghijklmnopqrst"), 10, 1, S("abcdefghij"), 5, 0, 1); @@ -5036,6 +5084,7 @@ void test47() test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 1, 4); } +template void test48() { test(S("abcdefghijklmnopqrst"), 10, 5, S("abcdefghijklmnopqrst"), 10, 5, 0); @@ -5140,6 +5189,7 @@ void test48() test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 0, 10); } +template void test49() { test(S("abcdefghijklmnopqrst"), 10, 10, S("abcde"), 2, 1, 8); @@ -5244,6 +5294,7 @@ void test49() test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 4, 5); } +template void test50() { test(S("abcdefghijklmnopqrst"), 10, 11, S("abcdefghij"), 5, 5, 5); @@ -5348,6 +5399,7 @@ void test50() test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 10, 11, -10); } +template void test51() { test(S("abcdefghijklmnopqrst"), 19, 0, S("abcdefghijklmnopqrst"), 19, 0, 0); @@ -5452,6 +5504,7 @@ void test51() test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 2, 4, 17); } +template void test52() { test(S("abcdefghijklmnopqrst"), 19, 2, S("abcde"), 4, 0, 1); @@ -5556,6 +5609,7 @@ void test52() test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 1, -1); } +template void test53() { test(S("abcdefghijklmnopqrst"), 20, 0, S("abcdefghij"), 9, 2, -1); @@ -5660,6 +5714,7 @@ void test53() test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 20, 0, 0); } +template void test54() { test(S("abcdefghijklmnopqrst"), 20, 1, S("abcdefghijklmnopqrst"), 20, 1, 0); @@ -5742,59 +5797,122 @@ void test54() int main() { - test0(); - test1(); - test2(); - test3(); - test4(); - test5(); - test6(); - test7(); - test8(); - test9(); - test10(); - test11(); - test12(); - test13(); - test14(); - test15(); - test16(); - test17(); - test18(); - test19(); - test20(); - test21(); - test22(); - test23(); - test24(); - test25(); - test26(); - test27(); - test28(); - test29(); - test30(); - test31(); - test32(); - test33(); - test34(); - test35(); - test36(); - test37(); - test38(); - test39(); - test40(); - test41(); - test42(); - test43(); - test44(); - test45(); - test46(); - test47(); - test48(); - test49(); - test50(); - test51(); - test52(); - test53(); - test54(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + test9(); + test10(); + test11(); + test12(); + test13(); + test14(); + test15(); + test16(); + test17(); + test18(); + test19(); + test20(); + test21(); + test22(); + test23(); + test24(); + test25(); + test26(); + test27(); + test28(); + test29(); + test30(); + test31(); + test32(); + test33(); + test34(); + test35(); + test36(); + test37(); + test38(); + test39(); + test40(); + test41(); + test42(); + test43(); + test44(); + test45(); + test46(); + test47(); + test48(); + test49(); + test50(); + test51(); + test52(); + test53(); + test54(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_compare/string.pass.cpp b/test/strings/basic.string/string.ops/string_compare/string.pass.cpp index 6632cf74..58f57608 100644 --- a/test/strings/basic.string/string.ops/string_compare/string.pass.cpp +++ b/test/strings/basic.string/string.ops/string_compare/string.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + int sign(int x) { if (x == 0) @@ -30,10 +32,10 @@ test(const S& s, const S& str, int x) assert(sign(s.compare(str)) == sign(x)); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), S(""), 0); test(S(""), S("abcde"), -5); test(S(""), S("abcdefghij"), -10); @@ -50,4 +52,26 @@ int main() test(S("abcdefghijklmnopqrst"), S("abcde"), 15); test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10); test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), S(""), 0); + test(S(""), S("abcde"), -5); + test(S(""), S("abcdefghij"), -10); + test(S(""), S("abcdefghijklmnopqrst"), -20); + test(S("abcde"), S(""), 5); + test(S("abcde"), S("abcde"), 0); + test(S("abcde"), S("abcdefghij"), -5); + test(S("abcde"), S("abcdefghijklmnopqrst"), -15); + test(S("abcdefghij"), S(""), 10); + test(S("abcdefghij"), S("abcde"), 5); + test(S("abcdefghij"), S("abcdefghij"), 0); + test(S("abcdefghij"), S("abcdefghijklmnopqrst"), -10); + test(S("abcdefghijklmnopqrst"), S(""), 20); + test(S("abcdefghijklmnopqrst"), S("abcde"), 15); + test(S("abcdefghijklmnopqrst"), S("abcdefghij"), 10); + test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), 0); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp index 3be9e92d..302f725d 100644 --- a/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.not.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,10 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 'q', 0, S::npos); test(S(""), 'q', 1, S::npos); test(S("kitcj"), 'q', 0, 0); @@ -64,4 +66,37 @@ int main() test(S("csope"), 'q', 0); test(S("gfsmthlkon"), 'q', 0); test(S("laenfsbridchgotmkqpj"), 'q', 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 'q', 0, S::npos); + test(S(""), 'q', 1, S::npos); + test(S("kitcj"), 'q', 0, 0); + test(S("qkamf"), 'q', 1, 1); + test(S("nhmko"), 'q', 2, 2); + test(S("tpsaf"), 'q', 4, 4); + test(S("lahfb"), 'q', 5, S::npos); + test(S("irkhs"), 'q', 6, S::npos); + test(S("gmfhdaipsr"), 'q', 0, 0); + test(S("kantesmpgj"), 'q', 1, 1); + test(S("odaftiegpm"), 'q', 5, 5); + test(S("oknlrstdpi"), 'q', 9, 9); + test(S("eolhfgpjqk"), 'q', 10, S::npos); + test(S("pcdrofikas"), 'q', 11, S::npos); + test(S("nbatdlmekrgcfqsophij"), 'q', 0, 0); + test(S("bnrpehidofmqtcksjgla"), 'q', 1, 1); + test(S("jdmciepkaqgotsrfnhlb"), 'q', 10, 10); + test(S("jtdaefblsokrmhpgcnqi"), 'q', 19, 19); + test(S("hkbgspofltajcnedqmri"), 'q', 20, S::npos); + test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos); + + test(S(""), 'q', S::npos); + test(S("q"), 'q', S::npos); + test(S("qqq"), 'q', S::npos); + test(S("csope"), 'q', 0); + test(S("gfsmthlkon"), 'q', 0); + test(S("laenfsbridchgotmkqpj"), 'q', 0); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp index 13f3931f..66b21aea 100644 --- a/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); } +template void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp index 93eb4f30..4416b826 100644 --- a/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.not.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(pos <= x && x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, S::npos); } +template void test1() { test(S("gbhqo"), "skqne", 5, 4, S::npos); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos); } +template void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); } +template void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp index a6c59bda..3d28c247 100644 --- a/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.not.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); } +template void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp index dc620488..fd64fdf7 100644 --- a/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,10 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 'e', 0, S::npos); test(S(""), 'e', 1, S::npos); test(S("kitcj"), 'e', 0, S::npos); @@ -62,4 +64,35 @@ int main() test(S("csope"), 'e', 4); test(S("gfsmthlkon"), 'e', S::npos); test(S("laenfsbridchgotmkqpj"), 'e', 2); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 'e', 0, S::npos); + test(S(""), 'e', 1, S::npos); + test(S("kitcj"), 'e', 0, S::npos); + test(S("qkamf"), 'e', 1, S::npos); + test(S("nhmko"), 'e', 2, S::npos); + test(S("tpsaf"), 'e', 4, S::npos); + test(S("lahfb"), 'e', 5, S::npos); + test(S("irkhs"), 'e', 6, S::npos); + test(S("gmfhdaipsr"), 'e', 0, S::npos); + test(S("kantesmpgj"), 'e', 1, 4); + test(S("odaftiegpm"), 'e', 5, 6); + test(S("oknlrstdpi"), 'e', 9, S::npos); + test(S("eolhfgpjqk"), 'e', 10, S::npos); + test(S("pcdrofikas"), 'e', 11, S::npos); + test(S("nbatdlmekrgcfqsophij"), 'e', 0, 7); + test(S("bnrpehidofmqtcksjgla"), 'e', 1, 4); + test(S("jdmciepkaqgotsrfnhlb"), 'e', 10, S::npos); + test(S("jtdaefblsokrmhpgcnqi"), 'e', 19, S::npos); + test(S("hkbgspofltajcnedqmri"), 'e', 20, S::npos); + test(S("oselktgbcapndfjihrmq"), 'e', 21, S::npos); + + test(S(""), 'e', S::npos); + test(S("csope"), 'e', 4); + test(S("gfsmthlkon"), 'e', S::npos); + test(S("laenfsbridchgotmkqpj"), 'e', 2); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp index fb731ec9..59e00de3 100644 --- a/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); } +template void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp index 02006b2a..0c21a02f 100644 --- a/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(pos <= x && x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, S::npos); } +template void test1() { test(S("gbhqo"), "skqne", 5, 4, S::npos); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos); } +template void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); } +template void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp index 083000ab..d7db16f6 100644 --- a/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.first.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); } +template void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp index 33c83122..f6ce46ac 100644 --- a/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.not.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,10 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 'i', 0, S::npos); test(S(""), 'i', 1, S::npos); test(S("kitcj"), 'i', 0, 0); @@ -62,4 +64,35 @@ int main() test(S("csope"), 'i', 4); test(S("gfsmthlkon"), 'i', 9); test(S("laenfsbridchgotmkqpj"), 'i', 19); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 'i', 0, S::npos); + test(S(""), 'i', 1, S::npos); + test(S("kitcj"), 'i', 0, 0); + test(S("qkamf"), 'i', 1, 1); + test(S("nhmko"), 'i', 2, 2); + test(S("tpsaf"), 'i', 4, 4); + test(S("lahfb"), 'i', 5, 4); + test(S("irkhs"), 'i', 6, 4); + test(S("gmfhdaipsr"), 'i', 0, 0); + test(S("kantesmpgj"), 'i', 1, 1); + test(S("odaftiegpm"), 'i', 5, 4); + test(S("oknlrstdpi"), 'i', 9, 8); + test(S("eolhfgpjqk"), 'i', 10, 9); + test(S("pcdrofikas"), 'i', 11, 9); + test(S("nbatdlmekrgcfqsophij"), 'i', 0, 0); + test(S("bnrpehidofmqtcksjgla"), 'i', 1, 1); + test(S("jdmciepkaqgotsrfnhlb"), 'i', 10, 10); + test(S("jtdaefblsokrmhpgcnqi"), 'i', 19, 18); + test(S("hkbgspofltajcnedqmri"), 'i', 20, 18); + test(S("oselktgbcapndfjihrmq"), 'i', 21, 19); + + test(S(""), 'i', S::npos); + test(S("csope"), 'i', 4); + test(S("gfsmthlkon"), 'i', 9); + test(S("laenfsbridchgotmkqpj"), 'i', 19); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp index e20bed71..47c6d7ff 100644 --- a/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos); } +template void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp index 314821ec..f131b962 100644 --- a/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.not.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(x <= pos && x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, 4); } +template void test1() { test(S("gbhqo"), "skqne", 5, 4, 4); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 9); } +template void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 8); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, 19); } +template void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 19); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp index a2415ff0..6de63267 100644 --- a/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.not.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos); } +template void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp index 6337cb3e..32aa77d5 100644 --- a/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.of/char_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,10 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 'm', 0, S::npos); test(S(""), 'm', 1, S::npos); test(S("kitcj"), 'm', 0, S::npos); @@ -62,4 +64,35 @@ int main() test(S("csope"), 'm', S::npos); test(S("gfsmthlkon"), 'm', 3); test(S("laenfsbridchgotmkqpj"), 'm', 15); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 'm', 0, S::npos); + test(S(""), 'm', 1, S::npos); + test(S("kitcj"), 'm', 0, S::npos); + test(S("qkamf"), 'm', 1, S::npos); + test(S("nhmko"), 'm', 2, 2); + test(S("tpsaf"), 'm', 4, S::npos); + test(S("lahfb"), 'm', 5, S::npos); + test(S("irkhs"), 'm', 6, S::npos); + test(S("gmfhdaipsr"), 'm', 0, S::npos); + test(S("kantesmpgj"), 'm', 1, S::npos); + test(S("odaftiegpm"), 'm', 5, S::npos); + test(S("oknlrstdpi"), 'm', 9, S::npos); + test(S("eolhfgpjqk"), 'm', 10, S::npos); + test(S("pcdrofikas"), 'm', 11, S::npos); + test(S("nbatdlmekrgcfqsophij"), 'm', 0, S::npos); + test(S("bnrpehidofmqtcksjgla"), 'm', 1, S::npos); + test(S("jdmciepkaqgotsrfnhlb"), 'm', 10, 2); + test(S("jtdaefblsokrmhpgcnqi"), 'm', 19, 12); + test(S("hkbgspofltajcnedqmri"), 'm', 20, 17); + test(S("oselktgbcapndfjihrmq"), 'm', 21, 18); + + test(S(""), 'm', S::npos); + test(S("csope"), 'm', S::npos); + test(S("gfsmthlkon"), 'm', 3); + test(S("laenfsbridchgotmkqpj"), 'm', 15); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp index b542a1cb..cfe71d2e 100644 --- a/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.of/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -33,8 +35,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, S::npos); @@ -119,6 +120,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, 19); } +template void test1() { test(S(""), "", S::npos); @@ -141,6 +143,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp index 5c5ac104..7d82dc0f 100644 --- a/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.of/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(x <= pos && x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0, S::npos); @@ -130,6 +131,7 @@ void test0() test(S("hkjae"), "dfsmk", 5, 2, S::npos); } +template void test1() { test(S("gbhqo"), "skqne", 5, 4, 3); @@ -234,6 +236,7 @@ void test1() test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 1); } +template void test2() { test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 9); @@ -338,6 +341,7 @@ void test2() test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos); } +template void test3() { test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 4); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp b/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp index 7307599a..98f78f80 100644 --- a/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find.last.of/string_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(x < s.size()); } -typedef std::string S; - +template void test0() { test(S(""), S(""), 0, S::npos); @@ -118,6 +119,7 @@ void test0() test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, 19); } +template void test1() { test(S(""), S(""), S::npos); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp b/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp index c08ee53c..3c48a770 100644 --- a/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find/char_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,10 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(0 <= x && x + 1 <= s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 'c', 0, S::npos); test(S(""), 'c', 1, S::npos); test(S("abcde"), 'c', 0, 2); @@ -62,4 +64,35 @@ int main() test(S("abcde"), 'c', 2); test(S("abcdeabcde"), 'c', 2); test(S("abcdeabcdeabcdeabcde"), 'c', 2); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 'c', 0, S::npos); + test(S(""), 'c', 1, S::npos); + test(S("abcde"), 'c', 0, 2); + test(S("abcde"), 'c', 1, 2); + test(S("abcde"), 'c', 2, 2); + test(S("abcde"), 'c', 4, S::npos); + test(S("abcde"), 'c', 5, S::npos); + test(S("abcde"), 'c', 6, S::npos); + test(S("abcdeabcde"), 'c', 0, 2); + test(S("abcdeabcde"), 'c', 1, 2); + test(S("abcdeabcde"), 'c', 5, 7); + test(S("abcdeabcde"), 'c', 9, S::npos); + test(S("abcdeabcde"), 'c', 10, S::npos); + test(S("abcdeabcde"), 'c', 11, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'c', 0, 2); + test(S("abcdeabcdeabcdeabcde"), 'c', 1, 2); + test(S("abcdeabcdeabcdeabcde"), 'c', 10, 12); + test(S("abcdeabcdeabcdeabcde"), 'c', 19, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'c', 20, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'c', 21, S::npos); + + test(S(""), 'c', S::npos); + test(S("abcde"), 'c', 2); + test(S("abcdeabcde"), 'c', 2); + test(S("abcdeabcdeabcdeabcde"), 'c', 2); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp index dde0f501..c3ea0797 100644 --- a/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -39,8 +41,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) } } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0); @@ -125,6 +126,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, S::npos); } +template void test1() { test(S(""), "", 0); @@ -147,6 +149,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp index 14db59ea..f936651e 100644 --- a/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(pos <= x && x + n <= s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0, 0); @@ -130,6 +131,7 @@ void test0() test(S("abcde"), "abcde", 5, 2, S::npos); } +template void test1() { test(S("abcde"), "abcde", 5, 4, S::npos); @@ -234,6 +236,7 @@ void test1() test(S("abcdeabcde"), "abcdeabcde", 10, 1, S::npos); } +template void test2() { test(S("abcdeabcde"), "abcdeabcde", 10, 5, S::npos); @@ -338,6 +341,7 @@ void test2() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20); } +template void test3() { test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, S::npos); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp b/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp index 375a6f39..dc280d0a 100644 --- a/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_find/string_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(0 <= x && x + str.size() <= s.size()); } -typedef std::string S; - +template void test0() { test(S(""), S(""), 0, 0); @@ -118,6 +119,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, S::npos); } +template void test1() { test(S(""), S(""), 0); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp b/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp index 932e3530..8db67d9f 100644 --- a/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_rfind/char_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::value_type c, typename S::size_type pos, @@ -33,10 +35,10 @@ test(const S& s, typename S::value_type c, typename S::size_type x) assert(x + 1 <= s.size()); } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 'b', 0, S::npos); test(S(""), 'b', 1, S::npos); test(S("abcde"), 'b', 0, S::npos); @@ -62,4 +64,35 @@ int main() test(S("abcde"), 'b', 1); test(S("abcdeabcde"), 'b', 6); test(S("abcdeabcdeabcdeabcde"), 'b', 16); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 'b', 0, S::npos); + test(S(""), 'b', 1, S::npos); + test(S("abcde"), 'b', 0, S::npos); + test(S("abcde"), 'b', 1, 1); + test(S("abcde"), 'b', 2, 1); + test(S("abcde"), 'b', 4, 1); + test(S("abcde"), 'b', 5, 1); + test(S("abcde"), 'b', 6, 1); + test(S("abcdeabcde"), 'b', 0, S::npos); + test(S("abcdeabcde"), 'b', 1, 1); + test(S("abcdeabcde"), 'b', 5, 1); + test(S("abcdeabcde"), 'b', 9, 6); + test(S("abcdeabcde"), 'b', 10, 6); + test(S("abcdeabcde"), 'b', 11, 6); + test(S("abcdeabcdeabcdeabcde"), 'b', 0, S::npos); + test(S("abcdeabcdeabcdeabcde"), 'b', 1, 1); + test(S("abcdeabcdeabcdeabcde"), 'b', 10, 6); + test(S("abcdeabcdeabcdeabcde"), 'b', 19, 16); + test(S("abcdeabcdeabcdeabcde"), 'b', 20, 16); + test(S("abcdeabcdeabcdeabcde"), 'b', 21, 16); + + test(S(""), 'b', S::npos); + test(S("abcde"), 'b', 1); + test(S("abcdeabcde"), 'b', 6); + test(S("abcdeabcdeabcdeabcde"), 'b', 16); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp b/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp index 4424fdf4..2b1efd33 100644 --- a/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_rfind/pointer_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -40,8 +42,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type x) } } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0); @@ -126,6 +127,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0); } +template void test1() { test(S(""), "", 0); @@ -148,6 +150,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp b/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp index 8ba26f12..5699cabf 100644 --- a/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_rfind/pointer_size_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const typename S::value_type* str, typename S::size_type pos, @@ -24,8 +26,7 @@ test(const S& s, const typename S::value_type* str, typename S::size_type pos, assert(x <= pos && x + n <= s.size()); } -typedef std::string S; - +template void test0() { test(S(""), "", 0, 0, 0); @@ -130,6 +131,7 @@ void test0() test(S("abcde"), "abcde", 5, 2, 0); } +template void test1() { test(S("abcde"), "abcde", 5, 4, 0); @@ -234,6 +236,7 @@ void test1() test(S("abcdeabcde"), "abcdeabcde", 10, 1, 5); } +template void test2() { test(S("abcdeabcde"), "abcdeabcde", 10, 5, 5); @@ -338,6 +341,7 @@ void test2() test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20); } +template void test3() { test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, 15); @@ -364,8 +368,20 @@ void test3() int main() { - test0(); - test1(); - test2(); - test3(); + { + typedef std::string S; + test0(); + test1(); + test2(); + test3(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + test2(); + test3(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp b/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp index 0c69f3c0..d7c2e850 100644 --- a/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp +++ b/test/strings/basic.string/string.ops/string_rfind/string_size.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x) @@ -32,8 +34,7 @@ test(const S& s, const S& str, typename S::size_type x) assert(0 <= x && x + str.size() <= s.size()); } -typedef std::string S; - +template void test0() { test(S(""), S(""), 0, 0); @@ -118,6 +119,7 @@ void test0() test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, 0); } +template void test1() { test(S(""), S(""), 0); @@ -140,6 +142,16 @@ void test1() int main() { - test0(); - test1(); + { + typedef std::string S; + test0(); + test1(); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test0(); + test1(); + } +#endif } diff --git a/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp index 9b112b0f..9612b583 100644 --- a/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp +++ b/test/strings/basic.string/string.ops/string_substr/substr.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "../../min_allocator.h" + template void test(const S& s, typename S::size_type pos, typename S::size_type n) @@ -35,10 +37,10 @@ test(const S& s, typename S::size_type pos, typename S::size_type n) } } -typedef std::string S; - int main() { + { + typedef std::string S; test(S(""), 0, 0); test(S(""), 1, 0); test(S("pniot"), 0, 0); @@ -97,4 +99,68 @@ int main() test(S("ktsrmnqagdecfhijpobl"), 19, 1); test(S("lsaijeqhtrbgcdmpfkno"), 20, 0); test(S("dplqartnfgejichmoskb"), 21, 0); + } +#if __cplusplus >= 201103L + { + typedef std::basic_string, min_allocator> S; + test(S(""), 0, 0); + test(S(""), 1, 0); + test(S("pniot"), 0, 0); + test(S("htaob"), 0, 1); + test(S("fodgq"), 0, 2); + test(S("hpqia"), 0, 4); + test(S("qanej"), 0, 5); + test(S("dfkap"), 1, 0); + test(S("clbao"), 1, 1); + test(S("ihqrf"), 1, 2); + test(S("mekdn"), 1, 3); + test(S("ngtjf"), 1, 4); + test(S("srdfq"), 2, 0); + test(S("qkdrs"), 2, 1); + test(S("ikcrq"), 2, 2); + test(S("cdaih"), 2, 3); + test(S("dmajb"), 4, 0); + test(S("karth"), 4, 1); + test(S("lhcdo"), 5, 0); + test(S("acbsj"), 6, 0); + test(S("pbsjikaole"), 0, 0); + test(S("pcbahntsje"), 0, 1); + test(S("mprdjbeiak"), 0, 5); + test(S("fhepcrntko"), 0, 9); + test(S("eqmpaidtls"), 0, 10); + test(S("joidhalcmq"), 1, 0); + test(S("omigsphflj"), 1, 1); + test(S("kocgbphfji"), 1, 4); + test(S("onmjekafbi"), 1, 8); + test(S("fbslrjiqkm"), 1, 9); + test(S("oqmrjahnkg"), 5, 0); + test(S("jeidpcmalh"), 5, 1); + test(S("schfalibje"), 5, 2); + test(S("crliponbqe"), 5, 4); + test(S("igdscopqtm"), 5, 5); + test(S("qngpdkimlc"), 9, 0); + test(S("thdjgafrlb"), 9, 1); + test(S("hcjitbfapl"), 10, 0); + test(S("mgojkldsqh"), 11, 0); + test(S("gfshlcmdjreqipbontak"), 0, 0); + test(S("nadkhpfemgclosibtjrq"), 0, 1); + test(S("nkodajteqplrbifhmcgs"), 0, 10); + test(S("ofdrqmkeblthacpgijsn"), 0, 19); + test(S("gbmetiprqdoasckjfhln"), 0, 20); + test(S("bdfjqgatlksriohemnpc"), 1, 0); + test(S("crnklpmegdqfiashtojb"), 1, 1); + test(S("ejqcnahdrkfsmptilgbo"), 1, 9); + test(S("jsbtafedocnirgpmkhql"), 1, 18); + test(S("prqgnlbaejsmkhdctoif"), 1, 19); + test(S("qnmodrtkebhpasifgcjl"), 10, 0); + test(S("pejafmnokrqhtisbcdgl"), 10, 1); + test(S("cpebqsfmnjdolhkratgi"), 10, 5); + test(S("odnqkgijrhabfmcestlp"), 10, 9); + test(S("lmofqdhpkibagnrcjste"), 10, 10); + test(S("lgjqketopbfahrmnsicd"), 19, 0); + test(S("ktsrmnqagdecfhijpobl"), 19, 1); + test(S("lsaijeqhtrbgcdmpfkno"), 20, 0); + test(S("dplqartnfgejichmoskb"), 21, 0); + } +#endif } diff --git a/test/strings/basic.string/types.pass.cpp b/test/strings/basic.string/types.pass.cpp index a1a17a5e..dcb3bbc3 100644 --- a/test/strings/basic.string/types.pass.cpp +++ b/test/strings/basic.string/types.pass.cpp @@ -38,6 +38,7 @@ #include "test_traits.h" #include "test_allocator.h" +#include "min_allocator.h" template void @@ -49,12 +50,12 @@ test() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); + static_assert((std::is_same::size_type>::value), ""); + static_assert((std::is_same::difference_type>::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::pointer>::value), ""); + static_assert((std::is_same::const_pointer>::value), ""); static_assert((std::is_same< typename std::iterator_traits::iterator_category, std::random_access_iterator_tag>::value), ""); @@ -78,4 +79,7 @@ int main() std::char_traits >::value), ""); static_assert((std::is_same::allocator_type, std::allocator >::value), ""); +#if __cplusplus >= 201103L + test, min_allocator >(); +#endif }