text
stringlengths 0
2.2M
|
---|
" verify the RNG was not called, and the supplied"
|
" memory was not written. (C-6)\n");
|
{
|
MockRNG rng;
|
Obj generator(rng);
|
char seed[8];
|
const char maxChar = static_cast<char>(255);
|
fill(seed, 8, maxChar);
|
generator.generateSeed(&seed[4], 0);
|
for (int i = 0; i < 8; ++i) {
|
if (veryVerbose) printf("Asserting seed[%i]: %hhu from"
|
" generated seed is inchanged\n",
|
i ,
|
seed[i]);
|
ASSERT(seed[i] == maxChar);
|
}
|
ASSERT(rng.numberOfCalls() == 0);
|
}
|
if (verbose) printf("Call 'generateSeed' with lengths that are not"
|
" multiples of the size of 'MockRNG::result_type'."
|
" (C-6)\n");
|
{
|
char seed[24];
|
for (int i = 0; i < 24; ++i) {
|
if (veryVerbose) printf("Testing seeds of length %i\n", i);
|
MockRNG rng;
|
Obj generator(rng);
|
generator.generateSeed(seed, i);
|
verifyResultMatchesRNG(seed, i);
|
}
|
}
|
if (verbose) printf("Call 'generateSeed' with combinations of a null"
|
" pointer and a 0 length. (C-7)\n");
|
{
|
char data[5] = { };
|
bsls::AssertTestHandlerGuard guard;
|
ASSERT_FAIL(Obj().generateSeed( 0, 5));
|
ASSERT_PASS(Obj().generateSeed( 0, 0));
|
ASSERT_PASS(Obj().generateSeed(data, 0));
|
ASSERT_PASS(Obj().generateSeed(data, 5));
|
}
|
} break;
|
case 2: {
|
// --------------------------------------------------------------------
|
// TESTING CREATORS
|
// Ensure that the implicitly declared and defined copy constructor
|
// and destructor, as well as the explicitly defined default and
|
// parameterized constructors, are publicly callable. As there is no
|
// observable state to inspect, there is little to verify other than
|
// that the expected expressions all compile.
|
//
|
// Concerns:
|
//: 1 Objects can be created using the user defined default
|
//: constructor.
|
//:
|
//: 2 Objects can be created using the user defined parameterized
|
//: constructor.
|
//:
|
//: 3 Objects can be created using the copy constructor.
|
//:
|
//: 4 The copy constructor is not declared as explicit.
|
//:
|
//: 5 Objects can be copy constructed from constant objects.
|
//:
|
//: 6 Objects can be destroyed.
|
//
|
// Plan:
|
//: 1 Create a default constructed 'SeedGenerator' and allow it to
|
//: leave scope to be destroyed. (C-1,6)
|
//:
|
//: 2 Create a 'SeedGenerator' with the user defined parameterized
|
//: constructor. (C-2)
|
//:
|
//: 3 Use the copy-initialization syntax to create a new instance of
|
//: 'SeedGenerator' from an existing instance. (C-3,4)
|
//:
|
//: 4 Copy the value of the one (const) instance of 'SeedGenerator'
|
//: to a second non-'const' one. (C-5)
|
//
|
// Testing:
|
// SeedGenerator()
|
// SeedGenerator(RNG& randomNumberGenerator)
|
// SeedGenerator(const SeedGenerator)
|
// ~SeedGenerator()
|
// --------------------------------------------------------------------
|
if (verbose)
|
printf("\nTESTING CREATORS"
|
"\n================\n");
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.