text
stringlengths 0
2.2M
|
|---|
// bslmt_condition.t.cpp -*-C++-*-
|
// ----------------------------------------------------------------------------
|
// NOTICE
|
//
|
// This component is not up to date with current BDE coding standards, and
|
// should not be used as an example for new development.
|
// ----------------------------------------------------------------------------
|
#include <bslmt_condition.h>
|
#include <bslmt_mutex.h>
|
#include <bslim_testutil.h>
|
#include <bsls_atomic.h>
|
#include <bsls_stopwatch.h>
|
#include <bsls_systemtime.h>
|
#include <bsl_cerrno.h>
|
#include <bsl_cstdlib.h>
|
#include <bsl_iostream.h>
|
using namespace BloombergLP;
|
using namespace bsl;
|
// ============================================================================
|
// STANDARD BDE ASSERT TEST FUNCTION
|
// ----------------------------------------------------------------------------
|
namespace {
|
int testStatus = 0;
|
void aSsErT(bool condition, const char *message, int line)
|
{
|
if (condition) {
|
cout << "Error " __FILE__ "(" << line << "): " << message
|
<< " (failed)" << endl;
|
if (0 <= testStatus && testStatus <= 100) {
|
++testStatus;
|
}
|
}
|
}
|
} // close unnamed namespace
|
// ============================================================================
|
// STANDARD BDE TEST DRIVER MACRO ABBREVIATIONS
|
// ----------------------------------------------------------------------------
|
#define ASSERT BSLIM_TESTUTIL_ASSERT
|
#define ASSERTV BSLIM_TESTUTIL_ASSERTV
|
#define LOOP_ASSERT BSLIM_TESTUTIL_LOOP_ASSERT
|
#define LOOP0_ASSERT BSLIM_TESTUTIL_LOOP0_ASSERT
|
#define LOOP1_ASSERT BSLIM_TESTUTIL_LOOP1_ASSERT
|
#define LOOP2_ASSERT BSLIM_TESTUTIL_LOOP2_ASSERT
|
#define LOOP3_ASSERT BSLIM_TESTUTIL_LOOP3_ASSERT
|
#define LOOP4_ASSERT BSLIM_TESTUTIL_LOOP4_ASSERT
|
#define LOOP5_ASSERT BSLIM_TESTUTIL_LOOP5_ASSERT
|
#define LOOP6_ASSERT BSLIM_TESTUTIL_LOOP6_ASSERT
|
#define Q BSLIM_TESTUTIL_Q // Quote identifier literally.
|
#define P BSLIM_TESTUTIL_P // Print identifier and value.
|
#define P_ BSLIM_TESTUTIL_P_ // P(X) without '\n'.
|
#define T_ BSLIM_TESTUTIL_T_ // Print a tab (w/o newline).
|
#define L_ BSLIM_TESTUTIL_L_ // current Line number
|
///Usage
|
///-----
|
// Suppose we have a 'bslmt::Condition' object, 'condition', and a boolean
|
// predicate associated with 'condition' (represented here as a free function
|
// that returns a 'bool' value):
|
//..
|
bool predicate()
|
// Return 'true' if the invariant holds for 'condition', and 'false'
|
// otherwise.
|
{
|
return true;
|
}
|
//..
|
// ============================================================================
|
// GLOBAL TYPEDEFS/CONSTANTS FOR TESTING
|
// ----------------------------------------------------------------------------
|
int verbose;
|
int veryVerbose;
|
typedef bslmt::Condition Obj;
|
#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
|
// BDE_VERIFY pragma: push
|
// BDE_VERIFY pragma: -MN03
|
// ==================
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.