diff --git a/groups/bsl/bslalg/bslalg_arraydestructionprimitives.t.cpp b/groups/bsl/bslalg/bslalg_arraydestructionprimitives.t.cpp index b2291ace9a..4d3ea2def0 100644 --- a/groups/bsl/bslalg/bslalg_arraydestructionprimitives.t.cpp +++ b/groups/bsl/bslalg/bslalg_arraydestructionprimitives.t.cpp @@ -9,6 +9,7 @@ #include // for testing only #include // for testing only #include // for testing only +#include #include // for testing only #include // for testing only #include // for testing only diff --git a/groups/bsl/bslalg/bslalg_rangecompare.t.cpp b/groups/bsl/bslalg/bslalg_rangecompare.t.cpp index ec35145961..3c309d6d98 100644 --- a/groups/bsl/bslalg/bslalg_rangecompare.t.cpp +++ b/groups/bsl/bslalg/bslalg_rangecompare.t.cpp @@ -2,15 +2,13 @@ #include -#include // for testing only -#include // for testing only -#include // for testing only -#include // for testing only - #include #include #include - +#include // for testing only +#include // for testing only +#include // for testing only +#include // for testing only #include #include @@ -47,8 +45,11 @@ using namespace std; // overloads, we wrap the range pointers into an iterator type that is *not* // convertible to the pointer. //----------------------------------------------------------------------------- +// [ 3] bool equal(start1, end1, start2); +// [ 3] bool equal(start1, end1, start2, end2); // [ 3] bool equal(start1, end1, length1, start2, end2, length2); -// [ 4] bool lexicographical(start1, end1, length1, start2, end2, length2); +// [ 4] bool lexicographical(start1, end1, start2, end2); +// [ 4] bool lexicographical(s1, end1, length1, s2, end2, length2); //----------------------------------------------------------------------------- // [ 1] BREATHING TEST // [ 2] TEST APPARATUS @@ -73,37 +74,26 @@ void aSsErT(int c, const char *s, int i) } // close unnamed namespace -# define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } - //============================================================================= -// STANDARD BDE LOOP-ASSERT TEST MACROS +// STANDARD BDE TEST DRIVER MACROS //----------------------------------------------------------------------------- -// NOTE: This implementation of LOOP_ASSERT macros must use printf since -// cout uses new and must not be called during exception testing. - -#define LOOP_ASSERT(I,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } -#define LOOP2_ASSERT(I,J,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\t"); \ - printf("%s", #J ": "); dbg_print(J); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - -#define LOOP3_ASSERT(I,J,K,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\t"); \ - printf("%s", #J ": "); dbg_print(J); printf("\t"); \ - printf("%s", #K ": "); dbg_print(K); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - -//============================================================================= -// SEMI-STANDARD TEST OUTPUT MACROS -//----------------------------------------------------------------------------- -#define Q(X) printf("<| " #X " |>\n"); // Quote identifier literally. -#define P(X) dbg_print(#X " = ", X, "\n") // Print identifier and value. -#define P_(X) dbg_print(#X " = ", X, ", ") // P(X) without '\n' -#define L_ __LINE__ // current Line number -#define T_ putchar('\t'); // Print a tab (w/o newline). +#define ASSERT BSLS_BSLTESTUTIL_ASSERT +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV + +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // GLOBAL HELPER FUNCTIONS FOR TESTING @@ -2151,7 +2141,7 @@ int main(int argc, char *argv[]) // // Testing: // bool lexicographical(start1, end1, start2, end2); - // bool lexicographical(start1, end1, length1, start2, end2, length2); + // bool lexicographical(s1, end1, length1, s2, end2, length2); // -------------------------------------------------------------------- if (verbose) printf("\nTESTING 'lexicographical'" @@ -2364,8 +2354,7 @@ int main(int argc, char *argv[]) // the first invalid value of the 'spec'. // // Testing: - // int ggg(TYPE *array, const char *spec, int verboseFlag = 1); - // TYPE& gg(TYPE *array, const char *spec); + // TEST APPARATUS // -------------------------------------------------------------------- if (verbose) printf("\nTESTING PRIMITIVE GENERATOR FUNCTIONS" @@ -2395,7 +2384,7 @@ int main(int argc, char *argv[]) // Exercise basic usage of this component. // // Testing: - // This test exercises basic usage but *tests* nothing. + // BREATHING TEST // -------------------------------------------------------------------- if (verbose) printf("\nBREATHING TEST" @@ -2497,6 +2486,7 @@ int main(int argc, char *argv[]) // can be used. Display the resulting times. // // Testing: + // PERFORMANCE TEST // -------------------------------------------------------------------- if (verbose) printf("\nPERFORMANCE TEST" diff --git a/groups/bsl/bslalg/bslalg_scalardestructionprimitives.t.cpp b/groups/bsl/bslalg/bslalg_scalardestructionprimitives.t.cpp index 54faf834b2..5c80146d7a 100644 --- a/groups/bsl/bslalg/bslalg_scalardestructionprimitives.t.cpp +++ b/groups/bsl/bslalg/bslalg_scalardestructionprimitives.t.cpp @@ -1,17 +1,17 @@ // bslalg_scalardestructionprimitives.t.cpp -*-C++-*- #include - #include // for testing only -#include // for testing only -#include // for testing only #include // for testing only #include // for testing only #include // for testing only +#include // for testing only +#include // for testing only #include // for testing only #include // for testing only #include // for testing only +#include #include // for testing only #include // for testing only @@ -42,7 +42,6 @@ using namespace BloombergLP; // [ 2] void destroy(T *dst); //----------------------------------------------------------------------------- // [ 1] BREATHING TEST - //============================================================================= // STANDARD BDE ASSERT TEST MACRO //----------------------------------------------------------------------------- @@ -61,34 +60,27 @@ void aSsErT(int c, const char *s, int i) } // close unnamed namespace # define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } -//============================================================================= -// STANDARD BDE LOOP-ASSERT TEST MACROS -//----------------------------------------------------------------------------- -// NOTE: This implementation of LOOP_ASSERT macros must use printf since -// cout uses new and be called during exception testing. -#define LOOP_ASSERT(I,X) { \ - if (!(X)) { printf("%s: %d\n", #I, I); aSsErT(1, #X, __LINE__); } } - -#define LOOP2_ASSERT(I,J,X) { \ - if (!(X)) { printf("%s: %d\t%s: %d\n", #I, I, #J, J); \ - aSsErT(1, #X, __LINE__); } } - -#define LOOP3_ASSERT(I,J,K,X) { \ - if (!(X)) { printf("%s: %d\t%s: %c\t%s: %c\n", #I, I, #J, J, #K, K); \ - aSsErT(1, #X, __LINE__); } } - -#define LOOP4_ASSERT(I,J,K,L,X) { \ - if (!(X)) { printf("%s: %d\t%s: %d\t%s: %d\t%s: %d\n", \ - #I, I, #J, J, #K, K, #L, L); aSsErT(1, #X, __LINE__); } } //============================================================================= -// SEMI-STANDARD TEST OUTPUT MACROS +// STANDARD BDE TEST DRIVER MACROS //----------------------------------------------------------------------------- -// #define P(X) cout << #X " = " << (X) << endl; // Print identifier and value. -#define Q(X) printf("<| " #X " |>\n"); // Quote identifier literally. -//#define P_(X) cout << #X " = " << (X) << ", " << flush; // P(X) without '\n' -#define L_ __LINE__ // current Line number -#define T_ printf("\t"); // Print a tab (w/o newline) + +#define ASSERT BSLS_BSLTESTUTIL_ASSERT +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV + +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // SEMI-STANDARD NEGATIVE-TESTING MACROS @@ -773,7 +765,7 @@ int main(int argc, char *argv[]) //: them. Make sure all memory is deallocated. // // Testing: - // This test exercises the component but tests nothing. + // BREATHING TEST // -------------------------------------------------------------------- if (verbose) printf("\nBREATHING TEST" diff --git a/groups/bsl/bsls/bsls_alignedbuffer.t.cpp b/groups/bsl/bsls/bsls_alignedbuffer.t.cpp index b055046682..a5b1ab2f36 100644 --- a/groups/bsl/bsls/bsls_alignedbuffer.t.cpp +++ b/groups/bsl/bsls/bsls_alignedbuffer.t.cpp @@ -2,10 +2,10 @@ #include -#include #include +#include #include - +#include #include #include @@ -36,24 +36,37 @@ using namespace std; // FUNCTIONS, INCLUDING IOSTREAMS. static int testStatus = 0; -static void aSsErT(int c, const char *s, int i) { +namespace { +void aSsErT(int c, const char *s, int i) +{ if (c) { printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); if (testStatus >= 0 && testStatus <= 100) ++testStatus; } } -# define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } -//-------------------------------------------------------------------------- +} // close unnamed namespace //============================================================================= -// SEMI-STANDARD TEST OUTPUT MACROS +// STANDARD BDE TEST DRIVER MACROS //----------------------------------------------------------------------------- -// #define P(X) cout << #X " = " << (X) << endl; // Print identifier and value. -#define Q(X) printf("<| " #X " |>\n"); // Quote identifier literally. -//#define P_(X) cout << #X " = " << (X) << ", " << flush; // P(X) without '\n' -#define L_ __LINE__ // current Line number -#define T_ printf("\t"); // Print a tab (w/o newline) + +#define ASSERT BSLS_BSLTESTUTIL_ASSERT +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV + +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // GLOBAL TYPEDEFS/CONSTANTS FOR TESTING @@ -225,7 +238,7 @@ int main(int argc, char *argv[]) // - sizeof(Buff) - SIZE < ALIGNMENT // // Testing: - // Class Invariants + // CLASS INVARIANTS // -------------------------------------------------------------------- if (verbose) printf("\nTESTING CLASS INVARIANTS" diff --git a/groups/bsl/bsls/bsls_ident.t.cpp b/groups/bsl/bsls/bsls_ident.t.cpp index 9747e86e41..6df595347a 100644 --- a/groups/bsl/bsls/bsls_ident.t.cpp +++ b/groups/bsl/bsls/bsls_ident.t.cpp @@ -1,13 +1,12 @@ // bsls_ident.t.cpp -*-C++-*- - - // *** The format of this component test driver is non-standard. *** - // #include // included below in usage example. +#include + #include // 'atoi' +#include #include - // using namespace BloombergLP; //============================================================================= @@ -16,62 +15,47 @@ // This component does not have any easy way to do runtime checks. // //----------------------------------------------------------------------------- -// [ 1] Breathing Test (nothing) +// [ 1] BREATHING TEST //----------------------------------------------------------------------------- //========================================================================== // STANDARD BDE ASSERT TEST MACRO //-------------------------------------------------------------------------- +// NOTE: THIS IS A LOW-LEVEL COMPONENT AND MAY NOT USE ANY C++ LIBRARY +// FUNCTIONS, INCLUDING IOSTREAMS. static int testStatus = 0; -static void aSsErT(int c, const char *s, int i) { +namespace { +void aSsErT(int c, const char *s, int i) +{ if (c) { - std::cout << "Error " << __FILE__ << "(" << i << "): " << s - << " (failed)" << std::endl; + printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); if (testStatus >= 0 && testStatus <= 100) ++testStatus; } } -# define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } -//-------------------------------------------------------------------------- -#define LOOP_ASSERT(I,X) { \ - if (!(X)) { std::cout << #I << ": " << I << "\n"; \ - aSsErT(1, #X, __LINE__); } } - -#define LOOP2_ASSERT(I,J,X) { \ - if (!(X)) { std::cout << #I << ": " << I << "\t" << #J << ": " \ - << J << "\n"; aSsErT(1, #X, __LINE__); } } - -#define LOOP3_ASSERT(I,J,K,X) { \ - if (!(X)) { std::cout << #I << ": " << I << "\t" << #J << ": " << J \ - << "\t" << #K << ": " << K << "\n"; \ - aSsErT(1, #X, __LINE__); } } - -#define LOOP4_ASSERT(I,J,K,L,X) { \ - if (!(X)) { std::cout << #I << ": " << I << "\t" << #J << ": " << J \ - << "\t" << #K << ": " << K << "\t" << #L << ": " \ - << L << "\n"; aSsErT(1, #X, __LINE__); } } - -#define LOOP5_ASSERT(I,J,K,L,M,X) { \ - if (!(X)) { std::cout << #I << ": " << I << "\t" << #J << ": " << J \ - << "\t" << #K << ": " << K << "\t" << #L << ": " \ - << L << "\t" << #M << ": " << M << "\n"; \ - aSsErT(1, #X, __LINE__); } } - -#define LOOP6_ASSERT(I,J,K,L,M,N,X) { \ - if (!(X)) { std::cout << #I << ": " << I << "\t" << #J << ": " << J \ - << "\t" << #K << ": " << K << "\t" << #L << ": " \ - << L << "\t" << #M << ": " << M << "\t" << #N \ - << ": " << N << "\n"; aSsErT(1, #X, __LINE__); } } +} // close unnamed namespace //============================================================================= -// SEMI-STANDARD TEST OUTPUT MACROS +// STANDARD BDE TEST DRIVER MACROS //----------------------------------------------------------------------------- -#define P(X) std::cout << #X " = " << (X) << std::endl; // Print ID and value. -#define Q(X) std::cout << "<| " #X " |>" << std::endl; // Quote ID literally. -#define P_(X) std::cout << #X " = " << (X) << ", " << flush; // P(X) w/o '\n' -#define L_ __LINE__ // current Line number -#define T_ std::cout << "\t" << flush; // Print a tab (w/o newline) + +#define ASSERT BSLS_BSLTESTUTIL_ASSERT +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV + +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // GLOBAL TYPEDEFS/CONSTANTS FOR TESTING @@ -146,11 +130,13 @@ int main(int argc, char *argv[]) case 1: { // -------------------------------------------------------------------- // BREATHING TEST - // - // Concerns: That there is no real runtime test for this component. + // Concerns: That there is no real runtime test for this component. // // Plan: // Do nothing. + // + // Testing: + // BREATHING TEST // -------------------------------------------------------------------- if (verbose) std::cout << "\nBREATHING TEST" diff --git a/groups/bsl/bslstl/bslstl_deque.t.cpp b/groups/bsl/bslstl/bslstl_deque.t.cpp index b1a7845978..82ea42f866 100644 --- a/groups/bsl/bslstl/bslstl_deque.t.cpp +++ b/groups/bsl/bslstl/bslstl_deque.t.cpp @@ -1,12 +1,12 @@ // bslstl_deque.t.cpp -*-C++-*- - +#include #include #include #include #include #include // for testing only #include // for testing only - +#include #include #include #include // for testing only @@ -173,7 +173,8 @@ void aSsErT(int c, const char *s, int i) } // close unnamed namespace -# define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } +#define ASSERT BSLS_BSLTESTUTIL_ASSERT + //============================================================================= // STANDARD BDE LOOP-ASSERT TEST MACROS @@ -181,44 +182,25 @@ void aSsErT(int c, const char *s, int i) // NOTE: This implementation of LOOP_ASSERT macros must use printf since // cout uses new and must not be called during exception testing. -#define LOOP_ASSERT(I,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - -#define LOOP2_ASSERT(I,J,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\t"); \ - printf("%s", #J ": "); dbg_print(J); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - -#define LOOP3_ASSERT(I,J,K,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\t"); \ - printf("%s", #J ": "); dbg_print(J); printf("\t"); \ - printf("%s", #K ": "); dbg_print(K); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - -#define LOOP4_ASSERT(I,J,K,L,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\t"); \ - printf("%s", #J ": "); dbg_print(J); printf("\t"); \ - printf("%s", #K ": "); dbg_print(K); printf("\t"); \ - printf("%s", #L ": "); dbg_print(L); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - -#define LOOP5_ASSERT(I,J,K,L,M,X) { \ - if (!(X)) { printf("%s", #I ": "); dbg_print(I); printf("\t"); \ - printf("%s", #J ": "); dbg_print(J); printf("\t"); \ - printf("%s", #K ": "); dbg_print(K); printf("\t"); \ - printf("%s", #L ": "); dbg_print(L); printf("\t"); \ - printf("%s", #M ": "); dbg_print(M); printf("\n"); \ - fflush(stdout); aSsErT(1, #X, __LINE__); } } - +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV //============================================================================= // SEMI-STANDARD TEST OUTPUT MACROS //----------------------------------------------------------------------------- -#define Q(X) printf("<| " #X " |>\n"); // Quote identifier literally. -#define P(X) dbg_print(#X " = ", X, "\n") // Print identifier and value. -#define P_(X) dbg_print(#X " = ", X, ", ") // P(X) without '\n' -#define L_ __LINE__ // current Line number -#define T_ putchar('\t'); // Print a tab (w/o newline) +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +//#define P(X) debugprint(X, #X " = ", "\n") // Print identifier and value. +//#define P_(X) debugprint(X, #X " = ", ", ") // P(X) without '\n' +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // GLOBAL TYPEDEFS/CONSTANTS FOR TESTING @@ -294,91 +276,118 @@ const int NUM_INTERNAL_STATE_TEST = 10; // Fundamental-type-specific print functions. inline -void dbg_print(char c) +void debugprint(char c) { printf("%c", c); fflush(stdout); } inline -void dbg_print(unsigned char c) +void debugprint(unsigned char c) { printf("%c", c); fflush(stdout); } inline -void dbg_print(signed char c) +void debugprint(signed char c) { printf("%c", c); fflush(stdout); } inline -void dbg_print(short val) +void debugprint(short val) { printf("%d", (int)val); fflush(stdout); } inline -void dbg_print(unsigned short val) +void debugprint(unsigned short val) { printf("%d", (int)val); fflush(stdout); } inline -void dbg_print(int val) +void debugprint(int val) { printf("%d", val); fflush(stdout); } inline -void dbg_print(bsls::Types::Int64 val) +void debugprint(bsls::Types::Int64 val) { printf("%lld", val); fflush(stdout); } #if defined(BSLS_PLATFORM_OS_AIX) inline -void dbg_print(unsigned int val) +void debugprint(unsigned int val) { printf("%d", val); fflush(stdout); } #endif inline -void dbg_print(size_t val) +void debugprint(size_t val) { printf("%llu", (Uint64) val); fflush(stdout); } inline -void dbg_print(float val) +void debugprint(float val) { printf("'%f'", (double)val); fflush(stdout); } inline -void dbg_print(double val) +void debugprint(double val) { printf("'%f'", val); fflush(stdout); } inline -void dbg_print(const char* s) +void debugprint(const char* s) { printf("\"%s\"", s); fflush(stdout); } -// Deque-specific print function. +//// Deque-specific print function. +//template +//void callDebugprint(const bsl::deque& v) +//{ +// +// if (v.empty()) { +// printf(""); +// } +// else { +// for (size_t i = 0; i < v.size(); ++i) { +// debugprint(v[i]); +// } +// } +// fflush(stdout); +//} +// +//// Generic debug print function (3-arguments). +//template +//void callDebugprint(const T& val, const char *s, const char *nl) +//{ +// printf("%s", s); +// debugprint(val); +// printf("%s", nl); +// fflush(stdout); +//} + template -void dbg_print(const bsl::deque& v) +void debugprint(const bsl::deque& v) { + if (v.empty()) { printf(""); } else { for (size_t i = 0; i < v.size(); ++i) { - dbg_print(v[i]); + debugprint(v[i]); } } fflush(stdout); } // Generic debug print function (3-arguments). -template -void dbg_print(const char* s, const T& val, const char* nl) +template class val; +void debugprint(const T& val, const char *s, const char *nl) { - printf("%s", s); dbg_print(val); + printf("%s", s); + debugprint(val); printf("%s", nl); fflush(stdout); } @@ -751,7 +760,7 @@ bool operator<(const TestType& lhs, const TestType& rhs) } // TestType-specific print function. -void dbg_print(const TestType& rhs) +void debugprint(const TestType& rhs) { printf("%c", rhs.value()); fflush(stdout); @@ -833,7 +842,7 @@ bool operator==(const SmallTestTypeNoAlloc& lhs, } // SmallTestType-specific print function. -void dbg_print(const SmallTestTypeNoAlloc& rhs) +void debugprint(const SmallTestTypeNoAlloc& rhs) { printf("%c", rhs.value()); fflush(stdout); @@ -916,7 +925,7 @@ bool operator==(const MediumTestTypeNoAlloc& lhs, } // MediumTestType-specific print function. -void dbg_print(const MediumTestTypeNoAlloc& rhs) +void debugprint(const MediumTestTypeNoAlloc& rhs) { printf("%c", rhs.value()); fflush(stdout); @@ -999,7 +1008,7 @@ bool operator==(const LargeTestTypeNoAlloc& lhs, } // LargeTestType-specific print function. -void dbg_print(const LargeTestTypeNoAlloc& rhs) +void debugprint(const LargeTestTypeNoAlloc& rhs) { printf("%c", rhs.value()); fflush(stdout); @@ -6219,8 +6228,8 @@ void TestDriver::testCase8() gg(&mX, SPEC); const Obj& X = mX; if (veryVerbose) { - printf("\t g = "); dbg_print(g(SPEC)); printf("\n"); - printf("\tgg = "); dbg_print(X); printf("\n"); + printf("\t g = "); debugprint(g(SPEC)); printf("\n"); + printf("\tgg = "); debugprint(X); printf("\n"); } const int TOTAL_BLOCKS_BEFORE = (int) testAllocator.numBlocksTotal(); const int IN_USE_BYTES_BEFORE = (int) testAllocator.numBytesInUse(); @@ -7879,7 +7888,6 @@ void TestDriver::testCase1() int main(int argc, char *argv[]) { int test = argc > 1 ? atoi(argv[1]) : 0; - verbose = argc > 2; veryVerbose = argc > 3; veryVeryVerbose = argc > 4; diff --git a/groups/bsl/bslstl/bslstl_pair.t.cpp b/groups/bsl/bslstl/bslstl_pair.t.cpp index b60b01b438..c6585f5fc4 100644 --- a/groups/bsl/bslstl/bslstl_pair.t.cpp +++ b/groups/bsl/bslstl/bslstl_pair.t.cpp @@ -1,18 +1,18 @@ // bslstl_pair.t.cpp -*-C++-*- - #include +#include -#include -#include -#include -#include -#include #include #include #include #include - +#include +#include +#include #include +#include +#include + #include @@ -81,30 +81,36 @@ using namespace BloombergLP; static int testStatus = 0; namespace { - // Namespace, because of the error on AIX/xlC: - // "Static declarations are not considered for a function call if the - // function is not qualified." - -void aSsErT(int c, const char *s, int i) { +void aSsErT(int c, const char *s, int i) +{ if (c) { - std::printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); + printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); if (testStatus >= 0 && testStatus <= 100) ++testStatus; } } } // close unnamed namespace -# define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } -//-------------------------------------------------------------------------- - //============================================================================= -// SEMI-STANDARD TEST OUTPUT MACROS +// STANDARD BDE TEST DRIVER MACROS //----------------------------------------------------------------------------- -// #define P(X) cout << #X " = " << (X) << endl; // Print identifier and value. -#define Q(X) std::printf("<| " #X " |>\n"); // Quote identifier literally. -//#define P_(X) cout << #X " = " << (X) << ", " << flush; // P(X) without '\n' -#define L_ __LINE__ // current Line number -#define T_ std::printf("\t"); // Print a tab (w/o newline) + +#define ASSERT BSLS_BSLTESTUTIL_ASSERT +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV + +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // GLOBAL TYPEDEFS/CONSTANTS FOR TESTING diff --git a/groups/bsl/bslstl/bslstl_stdexceptutil.t.cpp b/groups/bsl/bslstl/bslstl_stdexceptutil.t.cpp index 4777fff7c0..7f34f81d89 100644 --- a/groups/bsl/bslstl/bslstl_stdexceptutil.t.cpp +++ b/groups/bsl/bslstl/bslstl_stdexceptutil.t.cpp @@ -1,25 +1,47 @@ // bslstl_stdexceptutil.t.cpp -*-C++-*- #include - +#include #include #include // yes, we want the native std here - - #include #include #include + using namespace BloombergLP; using namespace std; -//============================================================================= -// TEST PLAN -//----------------------------------------------------------------------------- +// ============================================================================= +// TEST PLAN +// ----------------------------------------------------------------------------- +// Overview +// -------- +// 'bslstl::StdExceptUtil' is a 'Type only' utility class. To test it, we follow +// the standard order of testing for 'Type only' classes. The approach for +// testing this sort of class is to implement the following // +//: o a BREATHING TEST where we demonstrate the basic functionality of the +// 'bslstl::StdExceptUtil' +//: +//: o an EXHAUSTIVE INPUT TEST for the entire possible range of inputs. In this +//: case, the entire range of inputs is also tested in the BREATHING TEST. +//: +//: o an AREA TEST for the meaningful, primary range of inputs. In this Test +//: Driver, all meaningful ranges of inputs are covered by the BREATHING TEST +//: as well. +//: +//: o an USAGE EXAMPLE to demonstrate a working example of how a programmer +//: might use the component. // -//----------------------------------------------------------------------------- - +// The custom test apparatuses used are 'testFunction()', a templated free +// function which throws various exceptions, and 'callTestFunction()', which +// executes 'testFunction()'. +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// [ 1] BREATHING TEST +// [ 2] USAGE EXAMPLE //========================================================================== // STANDARD BDE ASSERT TEST MACRO //-------------------------------------------------------------------------- @@ -27,24 +49,37 @@ using namespace std; // FUNCTIONS, INCLUDING IOSTREAMS. static int testStatus = 0; -static void aSsErT(int c, const char *s, int i) { +namespace { +void aSsErT(int c, const char *s, int i) +{ if (c) { printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); if (testStatus >= 0 && testStatus <= 100) ++testStatus; } } -# define ASSERT(X) { aSsErT(!(X), #X, __LINE__); } -//-------------------------------------------------------------------------- +} // close unnamed namespace //============================================================================= -// SEMI-STANDARD TEST OUTPUT MACROS +// STANDARD BDE TEST DRIVER MACROS //----------------------------------------------------------------------------- -// #define P(X) cout << #X " = " << (X) << endl; // Print identifier and value. -#define Q(X) printf("<| " #X " |>\n"); // Quote identifier literally. -//#define P_(X) cout << #X " = " << (X) << ", " << flush; // P(X) without '\n' -#define L_ __LINE__ // current Line number -#define T_ printf("\t"); // Print a tab (w/o newline) + +#define ASSERT BSLS_BSLTESTUTIL_ASSERT +#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT +#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT +#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT +#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT +#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT +#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT +#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT +#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT +#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV + +#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. +#define P BSLS_BSLTESTUTIL_P // Print identifier and value. +#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. +#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). +#define L_ BSLS_BSLTESTUTIL_L_ // current Line number //============================================================================= // GLOBAL TYPEDEFS/CONSTANTS FOR TESTING @@ -151,7 +186,7 @@ int main(int argc, char *argv[]) // Plan: // // Testing: - // + // BREATHING TEST // -------------------------------------------------------------------- if (verbose) printf("\nBREATHING TEST" diff --git a/groups/bsl/bslstl/bslstl_string.t.cpp b/groups/bsl/bslstl/bslstl_string.t.cpp index 655d02bd07..b18066274f 100644 --- a/groups/bsl/bslstl/bslstl_string.t.cpp +++ b/groups/bsl/bslstl/bslstl_string.t.cpp @@ -1,7 +1,6 @@ // bslstl_string.t.cpp -*-C++-*- #include - #include #include @@ -12,12 +11,12 @@ #include // for testing only #include // for testing only #include // for testing only -#include -#include // for testing only -#include -#include #include #include +#include +#include +#include +#include // for testing only #include #include @@ -108,8 +107,7 @@ using namespace std; // [12] string(const C *s, n, a = A()); // [12] string(const C *s, a = A()); // [12] string(n, C c, a = A()); -// [12] template -// string(InputIter first, InputIter last, a = A()); +// [12] template string(InputIter,InputIter,a = A()); // [ 7] string(const string& orig, a = A()); // [ 2] ~string(); // @@ -128,24 +126,22 @@ using namespace std; // [14] void resize(size_type n, C c); // [14] void reserve(size_type n); // [ 2] void clear(); -// [15] reference operator[](size_type pos); -// [15] reference at(size_type pos); -// [15] reference front(); -// [15] reference back(); +// [15] T& operator[](size_type pos); +// [15] T& at(size_type pos); +// [15] T& front(); +// [15] T& back(); // [13] void assign(const string& str); // [13] void assign(const string& str, pos, n); // [13] void assign(const C *s, size_type n); // [13] void assign(const C *s); // [13] void assign(size_type n, C c); -// [13] template -// void assign(InputIter first, InputIter last); +// [13] template void assign(IIter,IIter); // [17] string& append(const string& str); // [17] string& append(const string& str, pos, n); // [17] string& append(const C *s, size_type n); // [17] string& append(const C *s); // [17] string& append(size_type n, C c); -// [17] template -// string& append(InputIter first, InputIter last); +// [17] template string& append(IIter,IIter); // [ 2] void push_back(C c); // [18] string& insert(size_type pos1, const string& str); // [18] string& insert(size_type pos1, const string& str, pos2, n); @@ -154,8 +150,7 @@ using namespace std; // [18] string& insert(size_type pos, size_type n, C c); // [18] iterator insert(const_iterator p, C c); // [18] iterator insert(const_iterator p, size_type n, C c); -// [18] template -// iterator insert(const_iterator p, InputIter first, InputIter last); +// [18] template iterator insert(citer,IIter,IIter); // [19] void pop_back(); // [19] iterator erase(size_type pos = 0, size_type n = npos); // [19] iterator erase(const_iterator p); @@ -165,27 +160,26 @@ using namespace std; // [20] string& replace(pos1, n1, const C *s, n2); // [20] string& replace(pos1, n1, const C *s); // [20] string& replace(pos1, n1, size_type n2, C c); -// [20] replace(const_iterator first, const_iterator last, const string& str); -// [20] replace(const_iterator first, const_iterator last, const C *s, n2); -// [20] replace(const_iterator first, const_iterator last, const C *s); -// [20] replace(const_iterator first, const_iterator last, size_type n2, C c); -// [20] template -// replace(const_iterator p, const_iterator q, InputIter f, InputIter l); +// [20] replace(const_iterator p, const_iterator q, const string& str); +// [20] replace(const_iterator p, const_iterator q, const C *s, n2); +// [20] replace(const_iterator p, const_iterator q, const C *s); +// [20] replace(const_iterator p, const_iterator q, size_type n2, C c); +// [20] template replace(citer,citer,IIter,IIter); // [21] void swap(string&); // // ACCESSORS: // [ 4] const_reference operator[](size_type pos) const; // [ 4] const_reference at(size_type pos) const; -// [15] const_reference front() const; -// [15] const_reference back() const; +// [15] const T& front() const; +// [15] const T& back() const; // [ 4] size_type size() const; // [14] size_type max_size() const; // [14] size_type capacity() const; // [14] bool empty() const; -// [16] const_iterator begin(); -// [16] const_iterator end(); -// [16] const_reverse_iterator rbegin(); -// [16] const_reverse_iterator rend(); +// [16] const_iterator begin() const; +// [16] const_iterator end() const; +// [16] const_reverse_iterator rbegin() const; +// [16] const_reverse_iterator rend() const; // [ ] const C *c_str() const; // [ ] const C *data() const; // [22] size_type find(const string& str, pos = 0) const; @@ -228,6 +222,8 @@ using namespace std; // [ 6] bool operator!=(const string&, const string&); // [ 6] bool operator!=(const C *, const string&); // [ 6] bool operator!=(const string&, const C *); +// [17] operator+(const string& lhs, const CHAR_TYPE *rhs); +// [17] operator+(const CHAR_TYPE *lhs, const string& rhs); // [24] bool operator<(const string&, const string&); // [24] bool operator<(const C *, const string&); // [24] bool operator<(const string&, const C *); @@ -240,6 +236,7 @@ using namespace std; // [24] bool operator>=(const string&, const string&); // [24] bool operator>=(const C *, const string&); // [24] bool operator>=(const string&, const C *); +// [21] void swap(string&); // [21] void swap(string&, string&); // [ 5] basic_ostream& operator<<(basic_ostream& stream, // const string& str); @@ -249,6 +246,12 @@ using namespace std; // [ 1] BREATHING TEST // [11] ALLOCATOR-RELATED CONCERNS // [25] CONCERN: 'std::length_error' is used properly +// [26] npos +// [26] operator native_stl::string() const; +// [26] string(const native_stl::basic_string&); +// [27] DRQS 16870796: SEGFAULT IN FIND +// [28] SHORT STRING OPTIMIZATION +// [-1] PERFORMANCE TEST // // TEST APPARATUS: GENERATOR FUNCTIONS // [ 3] int ggg(string *object, const char *spec, int vF = 1); @@ -1296,16 +1299,15 @@ void TestDriver::testCase26() // -------------------------------------------------------------------- // TESTING CONVERSIONS WITH NATIVE STRINGS // - // Testing: - // CONCERNS: - // - A bsl::basic_string is implicitly convertible to a - // native_std::basic_string with the same CHAR_TYPE and - // CHAR_TRAITS. - // - A native_std::basic_string is explicitly convertible to a - // bsl::basic_string with the same CHAR_TYPE and - // CHAR_TRAITS. - // - A bsl::basic_string and a native_std::basic_string with the - // same template parameters will have the same npos value. + // CONCERNS: + // - A bsl::basic_string is implicitly convertible to a + // native_std::basic_string with the same CHAR_TYPE and + // CHAR_TRAITS. + // - A native_std::basic_string is explicitly convertible to a + // bsl::basic_string with the same CHAR_TYPE and + // CHAR_TRAITS. + // - A bsl::basic_string and a native_std::basic_string with the + // same template parameters will have the same npos value. // // Plan: // For a variety of strings of different sizes and different values, test @@ -1316,10 +1318,8 @@ void TestDriver::testCase26() // // Testing: // npos - // operator native_stl::basic_string() const; - // basic_string(const native_stl::basic_string&); + // operator native_stl::string() const; + // string(const native_stl::basic_string&); // ------------------------------------------------------------------------ static const char *SPECS[] = { @@ -1474,7 +1474,7 @@ void TestDriver::testCase25() // in a value exceeding 'max_size()'. // // Testing: - // Proper use of 'std::length_error' + // CONCERN: 'std::length_error' is used properly // ------------------------------------------------------------------------ bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -2407,24 +2407,24 @@ void TestDriver::testCase24() // well. // // Testing: - // int compare(const string& str) const; - // int compare(pos1, n1, const string& str) const; - // int compare(pos1, n1, const string& str, pos2, n2) const; - // int compare(const C* s) const; - // int compare(pos1, n1, const C* s) const; - // int compare(pos1, n1, const C* s, n2) const; - // bool operator<(const string&, const string&); - // bool operator<(const C *, const string&); - // bool operator<(const string&, const C *); - // bool operator>(const string&, const string&); - // bool operator>(const C *, const string&); - // bool operator>(const string&, const C *); - // bool operator<=(const string&, const string&); - // bool operator<=(const C *, const string&); - // bool operator<=(const string&, const C *); - // bool operator>=(const string&, const string&); - // bool operator>=(const C *, const string&); - // bool operator>=(const string&, const C *); + // int compare(const string& str) const; + // int compare(pos1, n1, const string& str) const; + // int compare(pos1, n1, const string& str, pos2, n2) const; + // int compare(const C* s) const; + // int compare(pos1, n1, const C* s) const; + // int compare(pos1, n1, const C* s, n2) const; + // bool operator<(const string&, const string&); + // bool operator<(const C *, const string&); + // bool operator<(const string&, const C *); + // bool operator>(const string&, const string&); + // bool operator>(const C *, const string&); + // bool operator>(const string&, const C *); + // bool operator<=(const string&, const string&); + // bool operator<=(const C *, const string&); + // bool operator<=(const string&, const C *); + // bool operator>=(const string&, const string&); + // bool operator>=(const C *, const string&); + // bool operator>=(const string&, const C *); // ------------------------------------------------------------------------ static const char *SPECS[] = { @@ -2610,17 +2610,15 @@ void TestDriver::testCase24Negative() // 'compare' method. // // Testing: - // int compare(const C* s) const; - // int compare(pos1, n1, const C* s) const; - // int compare(pos1, n1, const C* s, n2) const; - // bool operator<(const C *s, const string& str); - // bool operator<(const string& str, const C *s); - // bool operator>(const C *s, const string& str); - // bool operator>(const string& str, const C *s); - // bool operator<=(const C *s, const string& str); - // bool operator<=(const string& str, const C *s); - // bool operator>=(const C *s, const string& str); - // bool operator>=(const string& str, const C *s); + // int compare(const C* s) const; + // int compare(pos1, n1, const C* s) const; + // int compare(pos1, n1, const C* s, n2) const; + // bool operator<(const C *, const string&) + // bool operator>(const C *, const string&); + // bool operator>(const string&, const C *); + // bool operator<=(const string&, const string&); + // bool operator<=(const C *, const string&); + // bool operator<=(const string&, const C *); // ----------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -5823,11 +5821,9 @@ void TestDriver::testCase18() // - element value at each index position { 0 .. length - 1 }. // // Testing: - // string& insert(size_type pos, size_type n, C c); // iterator insert(const_iterator p, size_type n, C c); + // string& insert(size_type pos, size_type n, C c); // iterator insert(const_iterator p, C c); - // // string& insert(size_type pos, const C *s, n2); - // // string& insert(size_type pos, const C *s); // ----------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -6914,12 +6910,11 @@ void TestDriver::testCase18Negative() // with invalid iterators and verify that it asserts. // // Testing: - // string& insert(size_type pos, const C *s); // string& insert(size_type pos, const C *s, n2); + // string& insert(size_type pos, const C *s); // iterator insert(const_iterator p, C c); // iterator insert(const_iterator p, size_type n, C c); - // template - // iterator insert(const_iterator p, InputIter first, InputIter last); + // template iterator insert(citer,IIter,IIter); // ----------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -7026,7 +7021,6 @@ void TestDriver::testCase17() // // Testing: // string& append(size_type n, C c); - // // operator+=(c); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -7247,14 +7241,11 @@ void TestDriver::testCase17Range(const CONTAINER&) // - element value at each index position { 0 .. length - 1 }. // // Testing: - // string& append(const string& str); - // string& append(const string& str, pos, n); + // string& append(const string& str); + // string& append(const string& str, pos, n); // string& append(const C *s, size_type n); // string& append(const C *s); - // template - // append(InputIter first, InputIter last); - // // operator+=(const string& rhs); - // // operator+=(const C *s); + // template string& append(IIter,IIter); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -7873,7 +7864,7 @@ void TestDriver::testCase17Negative() // Testing: // string& append(const C *s, size_type n); // string& append(const C *s); - // template append(InputIter first, InputIter last); + // template string& append(IIter,IIter); // operator+=(const string& rhs); // operator+(const string& lhs, const CHAR_TYPE *rhs); // operator+(const CHAR_TYPE *lhs, const string& rhs); @@ -8098,8 +8089,8 @@ void TestDriver::testCase15() // 'std::out_of_range' when accessing the past-the-end element. // // Testing: - // T& operator[](size_type position); - // T& at(size_type n); + // T& operator[](size_type pos); + // T& at(size_type pos); // T& front(); // T& back(); // const T& front() const; @@ -8220,8 +8211,8 @@ void TestDriver::testCase15Negative() // index is out of range. // // Testing: - // T& operator[](size_type position); - // const T& operator[](size_type position) const; + // T& operator[](size_type pos); + // const T& operator[](size_type pos) const; // T& front(); // T& back(); // const T& front() const; @@ -8334,7 +8325,7 @@ void TestDriver::testCase14() // each test in the standard 'bslma' exception-testing macro block. // // Testing: - // void string::reserve(size_type n); + // void reserve(size_type n); // void resize(size_type n); // void resize(size_type n, C c); // size_type max_size() const; @@ -8617,8 +8608,8 @@ void TestDriver::testCase13() // be tested more completely in test case 25. // // Testing: - // void assign(const string& str); - // void assign(const string& str, pos, n); + // void assign(const string& str); + // void assign(const string& str, pos, n); // void assign(const C *s, size_type n); // void assign(const C *s); // void assign(size_type n, C c); @@ -8799,8 +8790,7 @@ void TestDriver::testCase13Range(const CONTAINER&) // completely in test case 17. // // Testing: - // template - // assign(InputIter first, InputIter last, const A& a = A()); + // template void assign(IIter,IIter); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -9000,8 +8990,7 @@ void TestDriver::testCase13Negative() // Testing: // void assign(const C *s, size_type n); // void assign(const C *s); - // template - // assign(InputIter first, InputIter last, const A& a = A()); + // template void assign(IIter,IIter); // -------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -9070,11 +9059,10 @@ void TestDriver::testCase12() // expected, and that no allocation was performed. // // Testing: - // string(const string& str, pos, n = npos, a = A()); - // string(const C *s, n, a = A()); - // string(const C *s, a = A()); - // string(n, C c, a = A()); - // string(const string& original, a = A()); + // string(const string& str, pos, n = npos, a = A()); + // string(const C *s, n, a = A()); + // string(const C *s, a = A()); + // string(n, C c, a = A()); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -9656,8 +9644,7 @@ void TestDriver::testCase12Range(const CONTAINER&) // - element value at each index position { 0 .. length - 1 }. // // Testing: - // template - // string(InputIter first, InputIter last, a = A()); + // template string(InputIter,InputIter,a = A()); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -9856,10 +9843,9 @@ void TestDriver::testCase12Negative() // iterator range ('first > last') and verify that it asserts. // // Testing: - // string(const C *s, n, a = A()); - // string(const C *s, a = A()); - // template - // string(InputIter first, InputIter last, a = A()); + // string(const C *s, n, a = A()); + // string(const C *s, a = A()); + // template string(InputIter,InputIter,a = A()); // -------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -9894,9 +9880,6 @@ void TestDriver::testCase11() // We verify that the 'string' class has the traits, and // that allocator is not used for creating empty strings. // - // Testing: - // TRAITS - // // TBD When a new string object Y is created from an old string object // X, then the standard states that Y should get its allocator by // copying X's allocator (23.1, Point 8). The STLport string @@ -9904,6 +9887,9 @@ void TestDriver::testCase11() // based allocators. To verify this behavior for non // bslma::Allocator, should test, copy constructor using one // and verify standard is followed. + // + // Testing: + // TRAITS // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -9979,9 +9965,9 @@ void TestDriver::testCase9() // With allocator, not moveable // // Testing: - // string& operator=(const string& rhs); - // string& operator=(const C *s); - // string& operator=(c); + // operator=(const string& rhs); + // operator=(const C *s); + // operator=(c); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -10296,7 +10282,7 @@ void TestDriver::testCase9Negative() // that it succeeds. // // Testing: - // string& operator=(const CHAR_TYPE *); + // operator=(const C *s); // -------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -10468,7 +10454,7 @@ void TestDriver::testCase7() // 'bslma::TestAllocator' and varying its *allocation* *limit*. // // Testing: - // string(const string& original, a = A()); + // string(const string& orig, a = A()); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -10785,12 +10771,12 @@ void TestDriver::testCase6() // trait or not. // // Testing: - // operator==(const string&, const string&); - // operator==(const C *, const string&); - // operator==(const string&, const C *); - // operator!=(const string&, const string&); - // operator!=(const C *, const string&); - // operator!=(const string&, const C *); + // bool operator==(const string&, const string&); + // bool operator==(const C *, const string&); + // bool operator==(const string&, const C *); + // bool operator!=(const string&, const string&); + // bool operator!=(const C *, const string&); + // bool operator!=(const string&, const C *); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator1(veryVeryVerbose); @@ -10970,10 +10956,10 @@ void TestDriver::testCase6Negative() // C-string pointer parameters. // // Testing: - // operator==(const C *s, const string& str); - // operator==(const string& str, const C *s); - // operator!=(const C *s, const string& str); - // operator!=(const string& str, const C *s); + // bool operator==(const C *, const string&); + // bool operator==(const string&, const C *); + // bool operator!=(const C *, const string&); + // bool operator!=(const string&, const C *); // ----------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -11056,10 +11042,9 @@ void TestDriver::testCase4() // Note - Using untested resize(int). // // Testing: - // reference operator[](size_type pos); // const_reference operator[](size_type pos) const; - // reference at(size_type pos); // const_reference at(size_type pos) const; + // size_type size() const; // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -11390,8 +11375,8 @@ void TestDriver::testCase3() // parser only; the primary manipulators are already assumed to work. // // Testing: - // string& gg(string *object, const char *spec); - // int ggg(string *object, const char *spec, int vF = 1); + // int ggg(string *object, const char *spec, int vF = 1); + // string& gg(string *object, const char *spec); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -11632,9 +11617,9 @@ void TestDriver::testCase2() // constants. // // Testing: - // string(const A& a = A()); - // ~string(); - // void push_back(const T&); + // string(a = A()); + // ~string(); + // void push_back(C c); // void clear(); // -------------------------------------------------------------------- @@ -12017,7 +12002,7 @@ void TestDriver::testCase1() // 11) Assign x4 = x4 (aliasing). { x1: x2: x3:AB x4:AB } // // Testing: - // This "test" *exercises* basic functionality. + // BREATHING TEST // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -12281,11 +12266,9 @@ void TestDriver::testCaseM1(const int NITER, // // Also note, that this is spaghetti code but we make no attempt at // shortening it with helper functions or macros, since we feel that - // - // Testing: // This "test" measures performance of basic operations, for performance // regression. - // + // // // RESULTS: Native SunProSTL on sundev13 as of Tue Jun 24 16:48:36 EDT 2008 // ------------------------------------------------------------------------ @@ -12460,8 +12443,9 @@ void TestDriver::testCaseM1(const int NITER, // M2 Substring: 2.23025s 6.25982s 8.490068s // // RESULTS: bslstl 1.11 on ibm1 as of Mon Jun 30 14:24:46 EDT 2008 - // -------------------------------------------------------------------- - // + // + // Testing: + // PERFORMANCE TEST // -------------------------------------------------------------------- bsls::Stopwatch t; @@ -13866,6 +13850,9 @@ int main(int argc, char *argv[]) // - It should work with the NULL-terminator different from '\0' to // make sure that the implementation always uses char_type() default // constructor to terminate the string rather than a null literal. + // + // Testing: + // SHORT STRING OPTIMIZATION // -------------------------------------------------------------------- if (verbose) printf("\nTesting the short string optimization" "\n=====================================\n"); @@ -13890,14 +13877,15 @@ int main(int argc, char *argv[]) case 27: { // -------------------------------------------------------------------- // REPRODUCING KNOWN BUG CAUSING SEGFAULT IN FIND + // This is a problem with the native library, being pursued in DRQS + // 16870796. This test will do nothing unless run in verbose mode. // // Concerns: // That a known bug in string::find on Sun cc is reproduced in this // test suite. // // Testing: - // This is a problem with the native library, being pursued in DRQS - // 16870796. This test will do nothing unless run in verbose mode. + // DRQS 16870796: SEGFAULT IN FIND // -------------------------------------------------------------------- if (verbose) printf("\nReproducing known segfault in string::find" @@ -13922,16 +13910,20 @@ int main(int argc, char *argv[]) // -------------------------------------------------------------------- // TESTING CONVERSIONS WITH NATIVE STRINGS // + // CONCERNS: + // - A bsl::basic_string is implicitly convertible to a + // native_std::basic_string with the same CHAR_TYPE and + // CHAR_TRAITS. + // - A native_std::basic_string is implicitly convertible to a + // bsl::basic_string with the same CHAR_TYPE and + // CHAR_TRAITS. + // - A bsl::basic_string and a native_std::basic_string with the + // same template parameters will have the same npos value. + // // Testing: - // CONCERNS: - // - A bsl::basic_string is implicitly convertible to a - // native_std::basic_string with the same CHAR_TYPE and - // CHAR_TRAITS. - // - A native_std::basic_string is implicitly convertible to a - // bsl::basic_string with the same CHAR_TYPE and - // CHAR_TRAITS. - // - A bsl::basic_string and a native_std::basic_string with the - // same template parameters will have the same npos value. + // npos + // operator native_stl::string() const; + // string(const native_stl::basic_string&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting conversions to/from native string" @@ -13973,10 +13965,10 @@ int main(int argc, char *argv[]) // int compare(const C* s) const; // int compare(pos1, n1, const C* s) const; // int compare(pos1, n1, const C* s, n2) const; - // bool operator<(const string&, const string&); - // bool operator>(const string&, const string&); - // bool operator<=(const string&, const string&); - // bool operator>=(const string&, const string&); + // bool operator<(const string&, const string&); + // bool operator>(const string&, const string&); + // bool operator<=(const string&, const string&); + // bool operator>=(const string&, const string&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting comparisons" @@ -14088,7 +14080,7 @@ int main(int argc, char *argv[]) // // Testing: // void swap(string&); - // void swap(string& lhs, string& rhs); + // void swap(string&, string&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting 'swap'" @@ -14115,8 +14107,7 @@ int main(int argc, char *argv[]) // replace(const_iterator p, const_iterator q, const C *s, n2); // replace(const_iterator p, const_iterator q, const C *s); // replace(const_iterator p, const_iterator q, size_type n2, C c); - // template - // replace(const_iterator p, const_iterator q, InputIter f, l); + // template replace(citer,citer,IIter,IIter); // -------------------------------------------------------------------- if (verbose) printf("\nTesting 'replace' with value" @@ -14164,10 +14155,10 @@ int main(int argc, char *argv[]) // TESTING ERASE // // Testing: - // iterator erase(size_type pos, n); - // iterator erase(const_iterator position); - // iterator erase(const_iterator first, iterator last); // void pop_back(); + // iterator erase(size_type pos = 0, size_type n = npos); + // iterator erase(const_iterator p); + // iterator erase(const_iterator first, iterator last); // -------------------------------------------------------------------- if (verbose) printf("\nTesting 'erase' and 'pop_back'" @@ -14196,11 +14187,14 @@ int main(int argc, char *argv[]) // TESTING INSERTION // // Testing: - // iterator insert(const_iterator position, const T& value); - // iterator insert(const_iterator pos, size_type n, const T& val); - // template - // iterator - // insert(const_iterator pos, InputIter first, InputIter last); + // string& insert(size_type pos1, const string& str); + // string& insert(size_type pos1, const string& str, pos2, n); + // string& insert(size_type pos, const C *s, n2); + // string& insert(size_type pos, const C *s); + // string& insert(size_type pos, size_type n, C c); + // iterator insert(const_iterator p, C c); + // iterator insert(const_iterator p, size_type n, C c); + // template iterator insert(citer,IIter,IIter); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Value Insertion" @@ -14248,8 +14242,12 @@ int main(int argc, char *argv[]) // TESTING APPEND // // Testing: - // template - // void append(InputIter first, InputIter last); + // string& append(const string& str); + // string& append(const string& str, pos, n); + // string& append(const C *s, size_type n); + // string& append(const C *s); + // string& append(size_type n, C c); + // template string& append(IIter,IIter); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Value Append" @@ -14322,8 +14320,8 @@ int main(int argc, char *argv[]) // TESTING ELEMENT ACCESS // // Testing: - // T& operator[](size_type position); - // T& at(size_type n); + // T& operator[](size_type pos); + // T& at(size_type pos); // T& front(); // T& back(); // const T& front() const; @@ -14356,8 +14354,9 @@ int main(int argc, char *argv[]) // TESTING CAPACITY // // Testing: + // void resize(size_type n); + // void resize(size_type n, C c); // void reserve(size_type n); - // void resize(size_type n, T val); // size_type max_size() const; // size_type capacity() const; // bool empty() const; @@ -14378,9 +14377,12 @@ int main(int argc, char *argv[]) // TESTING ASSIGNMENT // // Testing: - // void assign(size_t n, const T& val); - // template - // void assign(InputIter first, InputIter last); + // void assign(const string& str); + // void assign(const string& str, pos, n); + // void assign(const C *s, size_type n); + // void assign(const C *s); + // void assign(size_type n, C c); + // template void assign(IIter,IIter); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Initial-Length Assignment" @@ -14428,9 +14430,11 @@ int main(int argc, char *argv[]) // TESTING CONSTRUCTORS // // Testing: - // string(size_type n, const T& val = T(), a = A()); - // template - // string(InputIter first, InputIter last, a = A()); + // string(const string& str, pos, n = npos, a = A()); + // string(const C *s, n, a = A()); + // string(const C *s, a = A()); + // string(n, C c, a = A()); + // template string(InputIter,InputIter,a = A()); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Initial-Length Constructor" @@ -14478,7 +14482,7 @@ int main(int argc, char *argv[]) // TESTING ALLOCATOR-RELATED CONCERNS // // Testing: - // Allocator TRAITS + // ALLOCATOR-RELATED CONCERNS // -------------------------------------------------------------------- if (verbose) printf("\nTesting Allocator concerns" @@ -14513,7 +14517,9 @@ int main(int argc, char *argv[]) // See that function for a list of concerns and a test plan. // // Testing: - // Obj& operator=(const Obj& rhs); + // operator=(const string& rhs); + // operator=(const C *s); + // operator=(c); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Assignment Operator" @@ -14550,7 +14556,8 @@ int main(int argc, char *argv[]) // that function for a list of concerns and a test plan. // // Testing: - // Obj g(const char *spec); + // string g(const char *spec); + // string g(size_t len, TYPE seed); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Generator Function g" @@ -14573,8 +14580,7 @@ int main(int argc, char *argv[]) // that function for a list of concerns and a test plan. // // Testing: - // string(const string& original); - // string(const string& original, alloc); + // string(const string& orig, a = A()); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Copy Constructors" @@ -14603,7 +14609,12 @@ int main(int argc, char *argv[]) // plan. // // Testing: - // operator==(const Obj&, const Obj&); + // bool operator==(const string&, const string&); + // bool operator==(const C *, const string&); + // bool operator==(const string&, const C *); + // bool operator!=(const string&, const string&); + // bool operator!=(const C *, const string&); + // bool operator!=(const string&, const C *); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Equality Operators" @@ -14653,8 +14664,9 @@ int main(int argc, char *argv[]) // for a list of concerns and a test plan. // // Testing: - // int size() const; - // const int& operator[](int index) const; + // const_reference operator[](size_type pos) const; + // const_reference at(size_type pos) const; + // size_type size() const; // -------------------------------------------------------------------- if (verbose) printf("\nTesting Basic Accessors" @@ -14675,8 +14687,8 @@ int main(int argc, char *argv[]) // function for a list of concerns and a test plan. // // Testing: - // void ggg(Obj *object, const char *spec); - // Obj& gg(Obj *object, const char *spec, ); + // int ggg(string *object, const char *spec, int vF = 1); + // string& gg(string *object, const char *spec); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Generator Functions" @@ -14701,7 +14713,7 @@ int main(int argc, char *argv[]) // plan. // // Testing: - // void push_back(T const& v); + // void push_back(C c); // void clear(); // -------------------------------------------------------------------- @@ -14728,7 +14740,7 @@ int main(int argc, char *argv[]) // work as expected in normal operation. // // Testing: - // This "test" *exercises* basic functionality. + // BREATHING TEST // -------------------------------------------------------------------- if (verbose) printf("\nBREATHING TEST" @@ -14853,8 +14865,7 @@ int main(int argc, char *argv[]) // access patterns, function call frequencies, etc. // // Testing: - // This "test" measures performance of basic operations, for - // performance regression. + // PERFORMANCE TEST // -------------------------------------------------------------------- if (verbose) printf("\nTesting Performance" diff --git a/groups/bsl/bslstl/bslstl_vector.t.cpp b/groups/bsl/bslstl/bslstl_vector.t.cpp index 626f1e3d2e..1149e6783c 100644 --- a/groups/bsl/bslstl/bslstl_vector.t.cpp +++ b/groups/bsl/bslstl/bslstl_vector.t.cpp @@ -1,10 +1,9 @@ // bslstl_vector.t.cpp -*-C++-*- #include - #include -#include #include +#include #include #include @@ -13,13 +12,13 @@ #include // for testing only #include // for testing only #include // for testing only -#include #include #include #include +#include #include -#include #include // for testing only +#include #include #include @@ -84,19 +83,17 @@ using namespace bsl; // [ 2] vector(const A& a = A()); // [12] vector(size_type n, const A& a = A()); // [12] vector(size_type n, const T& val, const A& a = A()); -// [12] template -// vector(InputIter first, InputIter last, const A& a = A()); +// [12] template vector(IIter,IIter,const A& a = A()); // [ 7] vector(const vector& orig, const A& = A()); // [12] vector(vector&& original); // [ 2] ~vector(); // /// MANIPULATORS: -// [13] template -// void assign(InputIter first, InputIter last); +// [13] template void assign(IIter,IIter); // [13] void assign(size_type numElements, const T& val); // [ 9] operator=(vector&); -// [15] reference operator[](size_type pos); -// [15] reference at(size_type pos); +// [15] T& operator[](size_type pos); +// [15] T& at(size_type pos); // [16] iterator begin(); // [16] iterator end(); // [16] reverse_iterator rbegin(); @@ -105,36 +102,33 @@ using namespace bsl; // [14] void resize(size_type n, const T& val); // [14] void reserve(size_type n); // [ 2] void clear(); -// [15] reference front(); -// [15] reference back(); -// [ ] VALUE_TYPE *data(); -// [20] template -// iterator emplace(const_iterator pos, Args...); +// [15] T& front(); +// [15] T& back(); +// [15] VALUE_TYPE *data(); // [ 2] void push_back(const T&); // [17] void push_back(T&&); // [18] void pop_back(); // [17] iterator insert(const_iterator pos, const T& val); // [17] iterator insert(const_iterator pos, size_type n, const T& val); -// [17] template -// void insert(const_iterator pos, InputIter first, InputIter last); +// [17] template void insert(constIter,IIter,IIter); // [18] iterator erase(const_iterator pos); // [18] iterator erase(const_iterator first, const_iterator last); // [19] void swap(vector&); // // ACCESSORS: -// [ 4] const_reference operator[](size_type pos) const; -// [ 4] const_reference at(size_type pos) const; -// [15] const_reference front() const; -// [15] const_reference back() const; -// [ ] const VALUE_TYPE *data() const; +// [15] const T& operator[](size_type pos) const; +// [15] const T& at(size_type pos) const; +// [15] const T& front() const; +// [15] const T& back() const; +// [15] const VALUE_TYPE *data() const; // [ 4] size_type size() const; // [14] size_type max_size() const; // [14] size_type capacity() const; // [14] bool empty() const; -// [16] const_iterator begin(); -// [16] const_iterator end(); -// [16] const_reverse_iterator rbegin(); -// [16] const_reverse_iterator rend(); +// [16] const_iterator begin() const; +// [16] const_iterator end() const; +// [16] const_reverse_iterator rbegin() const; +// [16] const_reverse_iterator rend() const; // // FREE OPERATORS: // [ 6] bool operator==(const vector&, const vector&); @@ -151,6 +145,7 @@ using namespace bsl; // [11] ALLOCATOR-RELATED CONCERNS // [18] USAGE EXAMPLE // [21] CONCERN: 'std::length_error' is used properly +// [22] CONCERN: Vector support types with overloaded new/delete // // TEST APPARATUS: GENERATOR FUNCTIONS // [ 3] int ggg(vector *object, const char *spec, int vF = 1); @@ -1851,7 +1846,7 @@ void TestDriver::testCase22() //: 4 Destroy any vecto5rs that was created. // // Testing: - // CONCERN: Vector support types with overloaded new/delete + // CONCERN: Vector support types with overloaded new/delete // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -1917,7 +1912,7 @@ void TestDriver::testCase21() // size that is guaranteed to result in a value exceeding 'max_size()'. // // Testing: - // Proper use of 'std::length_error' + // CONCERN: 'std::length_error' is used properly // ------------------------------------------------------------------------ bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -2456,7 +2451,7 @@ void TestDriver::testCase19() // Verify that memory was returned to allocator. // // Testing: - // swap(vector& lhs, vector& rhs); + // void swap(vector&, vector&); // ------------------------------------------------------------------------ if (verbose) printf("\nSWAP TEST" @@ -2998,7 +2993,7 @@ void TestDriver::testCase18Negative() // // Testing: // void pop_back(); - // iterator erase(const_iterator p); + // iterator erase(const_iterator pos); // iterator erase(const_iterator first, iterator last); // ----------------------------------------------------------------------- @@ -3123,10 +3118,10 @@ void TestDriver::testCase17() // identical to t it would be if the value had not been aliased. // // Testing: - // iterator insert(const_iterator pos, const T& value); - // void insert(const_iterator pos, size_type n, const T& value); - // void push_back(T&& value); - // void insert(const_iterator pos, size_type n, T&& value); + // void push_back(T&&); + // iterator insert(const_iterator pos, const T& val); + // iterator insert(const_iterator pos, size_type n, const T& val); + // template void insert(constIter,IIter,IIter); // ----------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -3887,10 +3882,10 @@ void TestDriver::testCase17Negative() // with invalid iterators and verify that it asserts. // // Testing: + // void push_back(T&&); // iterator insert(const_iterator pos, const T& val); // iterator insert(const_iterator pos, size_type n, const T& val); - // template - // void insert(const_iterator pos, InputIter first, InputIter last); + // template void insert(constIter,IIter,IIter); // ----------------------------------------------------------------------- const typename Obj::const_iterator badIterator = @@ -4013,10 +4008,10 @@ void TestDriver::testCase16() // iterator end(); // reverse_iterator rbegin(); // reverse_iterator rend(); - // const_iterator begin(); - // const_iterator end(); - // const_reverse_iterator rbegin(); - // const_reverse_iterator rend(); + // const_iterator begin() const; + // const_iterator end() const; + // const_reverse_iterator rbegin() const; + // const_reverse_iterator rend() const; // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -4149,16 +4144,16 @@ void TestDriver::testCase15() // specified index to the pointer returned by 'data()'. // // Testing: - // T& operator[](size_type position); - // T& at(size_type n); + // T& operator[](size_type pos); + // T& at(size_type pos); // T& front(); // T& back(); - // T *data(); - // const T& operator[](size_type position) const; - // const T& at(size_type n) const; + // VALUE_TYPE *data(); + // const T& operator[](size_type pos) const; + // const T& at(size_type pos) const; // const T& front() const; // const T& back() const; - // const T *data() const; + // const VALUE_TYPE *data() const; // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -4281,10 +4276,10 @@ void TestDriver::testCase15Negative() // index is out of range. // // Testing: - // T& operator[](size_type position); - // const T& operator[](size_type position) const; + // T& operator[](size_type pos); // T& front(); // T& back(); + // const T& operator[](size_type pos) const; // const T& front() const; // const T& back() const; // -------------------------------------------------------------------- @@ -4390,8 +4385,8 @@ void TestDriver::testCase14() // each test in the standard 'bslma' exception-testing macro block. // // Testing: - // void Vector_Imp::reserve(size_type n); - // void resize(size_type n, T val = T()); + // void resize(size_type n, const T& val); + // void reserve(size_type n); // size_type max_size() const; // size_type capacity() const; // bool empty() const; @@ -4672,7 +4667,7 @@ void TestDriver::testCase13() // completely in test case 17. // // Testing: - // assign(size_type n, const T& value); + // void assign(size_type numElements, const T& val); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -4848,8 +4843,7 @@ void TestDriver::testCase13Range(const CONTAINER&) // completely in test case 17. // // Testing: - // template - // assign(InputIter first, InputIter last); + // template void assign(IIter,IIter); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -5037,8 +5031,7 @@ void TestDriver::testCase13Negative(const CONTAINER&) // where the specified iterators are in the reversed order. // // Testing: - // template - // assign(InputIter first, InputIter last); + // template void assign(IIter,IIter); // -------------------------------------------------------------------- bsls::AssertFailureHandlerGuard guard(&bsls::AssertTest::failTestDriver); @@ -5110,9 +5103,9 @@ void TestDriver::testCase12() // expected, and that no allocation was performed. // // Testing: - // Vector_Imp(size_type n, const A& a = A()); - // Vector_Imp(size_type n, const T& value, const A& a = A()); - // Vector_Imp(vector&& original); + // vector(size_type n, const A& a = A()); + // vector(size_type n, const T& val, const A& a = A()); + // vector(vector&& original); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -5529,8 +5522,7 @@ void TestDriver::testCase12Range(const CONTAINER&) // reverse-ordered ranges. // // Testing: - // template - // Vector_Imp(InputIter first, InputIter last, const A& a = A()); + // template vector(IIter,IIter,const A& a = A()); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -5813,15 +5805,16 @@ void TestDriver::testCase11() // We first verify that the 'Vector_Imp' class has the traits, and // that allocator // - // Testing: - // TRAITS - // // TBD When a new vector object Y is created from an old vector object // X, then the standard states that Y should get its allocator by // copying X's allocator (23.1, Point 8). Our vector implementation // does not follow this rule for 'bslma::Allocator'-based allocators. // To verify this behavior for non-'bslma::Allocator', should test // copy constructor using one and verify standard is followed. + // + // Testing: + // TRAITS + // ALLOCATOR-RELATED CONCERNS // -------------------------------------------------------------------- if (verbose) printf("\nALLOCATOR TEST" @@ -5917,7 +5910,7 @@ void TestDriver::testCase9() // With allocator, not moveable // // Testing: - // vector& operator=(const vector& rhs); + // operator=(vector&); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -6215,7 +6208,7 @@ void TestDriver::testCase8() // returned by 'g' differs in size from that returned by 'gg'. // // Testing: - // Vector_Imp g(const char *spec); + // vector g(const char *spec); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -6322,7 +6315,7 @@ void TestDriver::testCase7() // 'bslma::TestAllocator' and varying its *allocation* *limit*. // // Testing: - // vector(const vector& original); + // vector(const vector& orig, const A& = A()); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -6654,8 +6647,8 @@ void TestDriver::testCase6() // trait or not. // // Testing: - // operator==(const vector&, const vector&); - // operator!=(const vector&, const vector&); + // bool operator==(const vector&, const vector&); + // bool operator!=(const vector&, const vector&); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator1(veryVeryVerbose); @@ -6839,10 +6832,10 @@ void TestDriver::testCase4() // Note - Using untested resize(int). // // Testing: - // reference operator[](size_type pos); - // const_reference operator[](size_type pos) const; - // reference at(size_type pos); - // const_reference at(size_type pos) const; + // T& operator[](size_type pos); + // const T& operator[](size_type pos) const; + // T& at(size_type pos); + // const T& at(size_type pos) const; // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -7166,8 +7159,8 @@ void TestDriver::testCase3() // parser only; the primary manipulators are already assumed to work. // // Testing: - // vector& gg(vector *object, const char *spec); // int ggg(vector *object, const char *spec, int vF = 1); + // vector& gg(vector *object, const char *spec); // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -7818,7 +7811,7 @@ void TestDriver::testCase1() // 11) Assign x4 = x4 (aliasing). { x1: x2: x3:AB x4:AB } // // Testing: - // This "test" *exercises* basic functionality. + // BREATHING TEST // -------------------------------------------------------------------- bslma::TestAllocator testAllocator(veryVeryVerbose); @@ -8479,7 +8472,7 @@ int main(int argc, char *argv[]) // TESTING COMPARISON FREE OPERATORS // // Testing: - // bool operator<(const vector& lhs, const vector& rhs); + // bool operator<(const vector&, const vector&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting comparison free operators" @@ -8497,10 +8490,10 @@ int main(int argc, char *argv[]) // TESTING SWAP // // Testing: - // void swap(Vector_Imp&); - // void swap(vector& lhs, vector& rhs); - // void swap(vector&& lhs, vector& rhs); - // void swap(vector& lhs, vector&& rhs); + // void swap(vector&); + // void swap(vector&, vector&); + // void swap(vector&, vector&&); + // void swap(vector&&, vector&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting 'swap'" @@ -8514,7 +8507,7 @@ int main(int argc, char *argv[]) // TESTING ERASE // // Testing: - // iterator erase(const_iterator position); + // iterator erase(const_iterator pos); // iterator erase(const_iterator first, const_iterator last); // void pop_back(); // -------------------------------------------------------------------- @@ -8561,11 +8554,10 @@ int main(int argc, char *argv[]) // TESTING INSERTION // // Testing: - // void push_back(T&& value); - // iterator insert(const_iterator position, const T& value); - // void insert(const_iterator pos, size_type n, const T& val); - // template - // void insert(const_iterator pos, InputIter first, InputIter last); + // void push_back(T&&); + // iterator insert(const_iterator pos, const T& val); + // iterator insert(const_iterator pos, size_type n, const T& val); + // template void insert(constIter,IIter,IIter); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Value Insertion" @@ -8666,8 +8658,8 @@ int main(int argc, char *argv[]) // TESTING ELEMENT ACCESS // // Testing: - // T& operator[](size_type position); - // T& at(size_type n); + // T& operator[](size_type pos); + // T& at(size_type pos); // T& front(); // T& back(); // const T& front() const; @@ -8699,8 +8691,9 @@ int main(int argc, char *argv[]) // TESTING CAPACITY // // Testing: + // void resize(size_type n); + // void resize(size_type n, const T& val); // void reserve(size_type n); - // void resize(size_type n, T val); // size_type max_size() const; // size_type capacity() const; // bool empty() const; @@ -8721,9 +8714,8 @@ int main(int argc, char *argv[]) // TESTING ASSIGNMENT // // Testing: - // void assign(size_t n, const T& val); - // template - // void assign(InputIter first, InputIter last); + // template void assign(IIter,IIter); + // void assign(size_type numElements, const T& val); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Initial-Length Assignment" @@ -8848,10 +8840,10 @@ int main(int argc, char *argv[]) // correct overload was called should suffice. // // Testing: - // vector(size_type n, const T& val = T(), const A& a = A()); - // template - // vector(InputIter first, InputIter last, const A& a = A()); - // vector(vector&& original); + // [12] vector(size_type n, const A& a = A()); + // [12] vector(size_type n, const T& val, const A& a = A()); + // [12] template vector(IIter,IIter,const A& a = A()); + // [12] vector(vector&& original); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Initial-Length Constructor" @@ -8924,6 +8916,8 @@ int main(int argc, char *argv[]) // TESTING ALLOCATOR-RELATED CONCERNS // // Testing: + // TRAITS + // ALLOCATOR-RELATED CONCERNS // -------------------------------------------------------------------- if (verbose) printf("\nTesting Allocator concerns" @@ -8935,6 +8929,10 @@ int main(int argc, char *argv[]) case 10: { // -------------------------------------------------------------------- // TESTING STREAMING FUNCTIONALITY: + // + // + // Testing: + // // -------------------------------------------------------------------- if (verbose) printf("\nTesting Streaming Functionality" @@ -8954,7 +8952,7 @@ int main(int argc, char *argv[]) // See that function for a list of concerns and a test plan. // // Testing: - // Obj& operator=(const Obj& rhs); + // operator=(vector&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Assignment Operator" @@ -8980,7 +8978,7 @@ int main(int argc, char *argv[]) // that function for a list of concerns and a test plan. // // Testing: - // Obj g(const char *spec); + // vector g(const char *spec); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Generator Function g" @@ -9012,8 +9010,7 @@ int main(int argc, char *argv[]) // that function for a list of concerns and a test plan. // // Testing: - // Vector_Imp(const Vector_Imp& original); - // Vector_Imp(const Vector_Imp& original, alloc); + // vector(const vector& orig, const A& = A()); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Copy Constructors" @@ -9051,7 +9048,8 @@ int main(int argc, char *argv[]) // plan. // // Testing: - // operator==(const Obj&, const Obj&); + // bool operator==(const vector&, const vector&); + // bool operator!=(const vector&, const vector&); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Equality Operators" @@ -9093,8 +9091,9 @@ int main(int argc, char *argv[]) // for a list of concerns and a test plan. // // Testing: - // int size() const; - // const int& operator[](int index) const; + // const T& operator[](size_type pos) const; + // const T& at(size_type pos) const; + // size_type size() const; // -------------------------------------------------------------------- if (verbose) printf("\nTesting Basic Accessors" @@ -9124,8 +9123,8 @@ int main(int argc, char *argv[]) // function for a list of concerns and a test plan. // // Testing: - // void ggg(Obj *object, const char *spec); - // Obj& gg(Obj *object, const char *spec, ); + // int ggg(vector *object, const char *spec, int vF = 1); + // vector& gg(vector *object, const char *spec); // -------------------------------------------------------------------- if (verbose) printf("\nTesting Generator Functions" @@ -9159,7 +9158,7 @@ int main(int argc, char *argv[]) // plan. // // Testing: - // void push_back(T const& v); + // void push_back(const T&); // void clear(); // -------------------------------------------------------------------- @@ -9195,7 +9194,7 @@ int main(int argc, char *argv[]) // work as expected in normal operation. // // Testing: - // This "test" *exercises* basic functionality. + // BREATHING TEST // -------------------------------------------------------------------- if (verbose) printf("\nBREATHING TEST" diff --git a/targetFiles b/targetFiles new file mode 100644 index 0000000000..c1d5c93ea8 --- /dev/null +++ b/targetFiles @@ -0,0 +1,11 @@ +./groups/bsl/bslstl/bslstl_stringbuf.t.cpp +./groups/bsl/bslstl/bslstl_deque.t.cpp +./groups/bsl/bslstl/bslstl_stdexceptutil.t.cpp +./groups/bsl/bslstl/bslstl_pair.t.cpp +./groups/bsl/bslstl/bslstl_string.t.cpp +./groups/bsl/bslstl/bslstl_vector.t.cpp +./groups/bsl/bslalg/bslalg_rangecompare.t.cpp +./groups/bsl/bslalg/bslalg_scalardestructionprimitives.t.cpp +./groups/bsl/bslalg/bslalg_arraydestructionprimitives.t.cpp +./groups/bsl/bsls/bsls_alignedbuffer.t.cpp +./groups/bsl/bsls/bsls_ident.t.cpp