text
stringlengths 0
2.2M
|
---|
static void aSsErT(int c, const char *s, int i)
|
{
|
if (c) {
|
cout << "Error " << __FILE__ << "(" << i << "): " << s
|
<< " (failed)" << endl;
|
if (testStatus >= 0 && testStatus <= 100) ++testStatus;
|
}
|
}
|
// ============================================================================
|
// STANDARD BDE TEST DRIVER MACROS
|
// ----------------------------------------------------------------------------
|
#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
|
// ============================================================================
|
// NEGATIVE-TEST MACRO ABBREVIATIONS
|
// ----------------------------------------------------------------------------
|
#define ASSERT_SAFE_PASS(EXPR) BSLS_ASSERTTEST_ASSERT_SAFE_PASS(EXPR)
|
#define ASSERT_SAFE_FAIL(EXPR) BSLS_ASSERTTEST_ASSERT_SAFE_FAIL(EXPR)
|
#define ASSERT_PASS(EXPR) BSLS_ASSERTTEST_ASSERT_PASS(EXPR)
|
#define ASSERT_FAIL(EXPR) BSLS_ASSERTTEST_ASSERT_FAIL(EXPR)
|
#define ASSERT_OPT_PASS(EXPR) BSLS_ASSERTTEST_ASSERT_OPT_PASS(EXPR)
|
#define ASSERT_OPT_FAIL(EXPR) BSLS_ASSERTTEST_ASSERT_OPT_FAIL(EXPR)
|
// ============================================================================
|
// GLOBAL TYPEDEFS/CONSTANTS FOR TESTING
|
// ----------------------------------------------------------------------------
|
const int VERSION_SELECTOR = 20131127;
|
// ============================================================================
|
// MAIN PROGRAM
|
// ----------------------------------------------------------------------------
|
int main(int argc, char *argv[])
|
{
|
int test = argc > 1 ? atoi(argv[1]) : 0;
|
int verbose = argc > 2;
|
int veryVerbose = argc > 3;
|
int veryVeryVeryVerbose = argc > 5;
|
cout << "TEST " << __FILE__ << " CASE " << test << endl;
|
// CONCERN: In no case does memory come from the global allocator.
|
bslma::TestAllocator globalAllocator("global", veryVeryVeryVerbose);
|
bslma::Default::setGlobalAllocator(&globalAllocator);
|
bslma::TestAllocator defaultAllocator("default", veryVeryVeryVerbose);
|
ASSERT(0 == bslma::Default::setDefaultAllocator(&defaultAllocator));
|
switch (test) { case 0:
|
case 2: {
|
// --------------------------------------------------------------------
|
// USAGE EXAMPLE
|
//
|
// Concerns:
|
//: 1 The usage example provided in the component header file must
|
//: compile, link, and run as shown.
|
//
|
// Plan:
|
//: 1 Incorporate usage example from header into test driver, replace
|
//: leading comment characters with spaces, replace 'assert' with
|
//: 'ASSERT', and insert 'if (veryVerbose)' before all output
|
//: operations. (C-1)
|
//
|
// Testing:
|
// USAGE EXAMPLE
|
// --------------------------------------------------------------------
|
if (verbose) cout << endl << "USAGE EXAMPLE" << endl
|
<< "=============" << endl;
|
///Usage
|
///-----
|
// This section illustrates intended use of this component.
|
//
|
///Example 1: Basic Externalization
|
///- - - - - - - - - - - - - - - -
|
// A 'bslx::StreambufOutStream' can be used to externalize values in a
|
// platform-neutral way. Writing out fundamental C++ types and 'bsl::string'
|
// requires no additional work on the part of the client; the client can simply
|
// use the stream directly. The following code serializes a few representative
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.