text
stringlengths
0
2.2M
text.initialize_free_space();
std::fill(text.data(), text.data() + text.max_size() - 1, STR('A'));
text.trim_to_terminator();
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(!text.is_truncated());
#endif
CHECK_EQUAL(text.max_size() - 1, text.size());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_update_after_c_string_greater_size)
{
TextBuffer buffer1;
Text text(buffer1.data(), buffer1.size());
text.initialize_free_space();
std::fill(text.data(), text.data() + text.max_size() + 1, STR('A')); // Overwrites to terminating null.
text.trim_to_terminator();
#if ETL_STRING_TRUNCATION_CHECKS_ENABLED
CHECK(text.is_truncated());
#endif
CHECK_EQUAL(text.max_size(), text.size());
}
};
}
// baltzo_datafileloader.t.cpp -*-C++-*-
#include <baltzo_datafileloader.h>
#include <baltzo_zoneinfo.h>
#include <baltzo_errorcode.h>
#include <bdlsb_fixedmemoutstreambuf.h>
#include <bdls_filesystemutil.h>
#include <bdls_pathutil.h>
#include <bdls_processutil.h>
#include <bslmt_threadutil.h>
#include <bslim_testutil.h>
#include <bslma_default.h>
#include <bslma_defaultallocatorguard.h>
#include <bslma_testallocator.h>
#include <bslmf_assert.h>
#include <bslmf_usesallocator.h>
#include <bsla_maybeunused.h>
#include <bsls_assert.h>
#include <bsls_asserttest.h>
#include <bsls_platform.h>
#include <bsl_cstdlib.h>
#include <bsl_cstring.h>
#include <bsl_fstream.h>
#include <bsl_iostream.h>
#include <bsl_ostream.h> // for 'operator<<'
#if BSLS_PLATFORM_OS_UNIX
# include <unistd.h> // sleep
#else
# include <windows.h> // Sleep
#endif
using namespace BloombergLP;
using bsl::cout;
using bsl::cerr;
using bsl::endl;
using bsl::flush;
using bsl::ends;
// ============================================================================
// TEST PLAN
// ----------------------------------------------------------------------------
// Overview
// --------
// The component under test implements a mechanism for reading a Zoneinfo
// binary data file. Each method of the component will be tested with
// different configurations for root path.
// ----------------------------------------------------------------------------
// CLASS METHODS
// [ 3] bool isPlausibleZoneinfoRootPath(const char *path);
//
// CREATORS
// [ 2] baltzo::DataFileLoader();
// [ 2] baltzo::DataFileLoader(const allocator_type& a);
// [ 2] ~baltzo::DataFileLoader();
//
// MANIPULATORS
// [ 6] int loadTimeZone(Zoneinfo *result, const char *timeZoneId);
// [ 2] void configureRootPath(const char *path);
// [ 3] int configureRootPathIfPlausible(const char *path);
//