text
stringlengths 0
2.2M
|
|---|
// You may obtain a copy of the License at
|
//
|
// http://www.apache.org/licenses/LICENSE-2.0
|
//
|
// Unless required by applicable law or agreed to in writing, software
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// See the License for the specific language governing permissions and
|
// limitations under the License.
|
// ----------------------------- END-OF-FILE ----------------------------------
|
// bdlsb_fixedmemoutput.t.cpp -*-C++-*-
|
#include <bdlsb_fixedmemoutput.h>
|
#include <bslim_testutil.h>
|
#include <bsls_asserttest.h>
|
#include <bsls_review.h>
|
#include <bslx_genericoutstream.h>
|
#include <bsl_algorithm.h>
|
#include <bsl_cctype.h>
|
#include <bsl_cstddef.h>
|
#include <bsl_iomanip.h>
|
#include <bsl_iostream.h>
|
#include <bsl_ostream.h>
|
#include <bsl_sstream.h>
|
#include <bsl_string.h>
|
using namespace BloombergLP;
|
using namespace bsl;
|
// ============================================================================
|
// TEST PLAN
|
// ----------------------------------------------------------------------------
|
// Overview
|
// --------
|
// This test driver exercises all the public methods from the 'basic_streambuf'
|
// protocol that are implemented by the class 'bdlsb::FixedMemOutput', as well
|
// as each public method in the 'bdlsb::FixedMemOutput' class that is not part
|
// of the 'basic_streambuf' protocol.
|
//
|
// Our goal here is to ensure that the implementations comply exactly with the
|
// IOStreams portion of the C++ standard where the standard explicitly defines
|
// behavior, and that they conform to a feasible interpretation of the standard
|
// as described in the function documentation, where the standard defined
|
// behavior only loosely. For those methods that are not protocol defined, we
|
// check only compliance with the behavior as described in the function
|
// documentation.
|
//
|
// Note that output operator used for test tracing purposes is tested in test
|
// case 3.
|
//
|
// Primary Constructors:
|
//: o FixedMemOutput(char *buffer, bsl::streamsize length);
|
//
|
// Primary Manipulators:
|
//: o int_type sputc(char_type);
|
//
|
// Basic Accessors:
|
//: o const char_type *data();
|
//: o streamsize length();
|
//: o streamsize capacity();
|
//
|
//-----------------------------------------------------------------------------
|
// CREATORS
|
// [ 2] FixedMemOutput(char *buffer, bsl::streamsize length);
|
// [ 2] ~FixedMemOutput();
|
//
|
// MANIPULATORS
|
// [ 8] char *data();
|
// [ 7] FixedMemOutput *pubsetbuf(char *buffer, streamsize length);
|
// [ 6] pos_type pubseekpos(pos_type, openmode);
|
// [ 6] pos_type pubseekoff(off_type, seekdir, openmode);
|
// [ 2] int_type sputc(char_type);
|
// [ 5] streamsize sputn(const char_type, streamsize);
|
// [ 9] locale pubimbue(const locale& loc);
|
// [ 9] int pubsync();
|
//
|
// ACCESSORS
|
// [ 4] streamsize capacity() const;
|
// [ 4] const char_type *data() const;
|
// [ 4] streamsize length() const;
|
// [ 9] bsl::locale getloc() const;
|
//
|
// ----------------------------------------------------------------------------
|
// [ 1] BREATHING TEST
|
// [ 3] ostream& operator<<(ostream&, const FixedMemOutput&);
|
// [10] USAGE EXAMPLE
|
//-----------------------------------------------------------------------------
|
// ============================================================================
|
// STANDARD BDE ASSERT TEST FUNCTION
|
// ----------------------------------------------------------------------------
|
namespace {
|
int testStatus = 0;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.