Library: replace usages of rand() in the whole code base
* most usages are drop-in replacements * occasionally the other convenience functions can be used * verify call-paths from core code to identify usages * ensure reseeding for all tests involving some kind of randomness... __Note__: some tests were not yet converted, since their usage of randomness is actually not thread-safe. This problem existed previously, since also `rand()` is not thread safe, albeit in most cases it is possible to ignore this problem, as ''garbled internal state'' is also somehow „random“
This commit is contained in:
parent
064484450e
commit
0b9e184fa3
99 changed files with 454 additions and 295 deletions
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "lib/format-string.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -43,6 +44,7 @@
|
|||
|
||||
|
||||
|
||||
using lib::rani;
|
||||
using util::_Fmt;
|
||||
using util::isnil;
|
||||
using Gtk::Widget;
|
||||
|
|
@ -136,8 +138,8 @@ namespace demo {
|
|||
|
||||
ChildEx* chld = makeChld();
|
||||
childz_.push_back(chld);
|
||||
uint x = rand() % 1000;
|
||||
uint y = rand() % 500;
|
||||
uint x = rani (1000);
|
||||
uint y = rani (500);
|
||||
canvas_.put(*chld, x, y);
|
||||
chld->show();
|
||||
canvas_.adjustSize();
|
||||
|
|
@ -152,8 +154,8 @@ namespace demo {
|
|||
{
|
||||
uint x = canvas_.child_property_x(*chld);
|
||||
uint y = canvas_.child_property_y(*chld);
|
||||
int deltaX = -20 + rand() % 41;
|
||||
int deltaY = -15 + rand() % 31;
|
||||
int deltaX = -20 + rani(41);
|
||||
int deltaY = -15 + rani(31);
|
||||
x = uint(max (0, int(x) + deltaX));
|
||||
y = uint(max (0, int(y) + deltaY));
|
||||
|
||||
|
|
@ -170,7 +172,7 @@ namespace demo {
|
|||
uint pos=0;
|
||||
for (Widget* chld : childz_)
|
||||
{
|
||||
uint y = rand() % 30;
|
||||
uint y = rani(30);
|
||||
canvas_.move (*chld, pos, y);
|
||||
|
||||
int width = chld->get_allocated_width();
|
||||
|
|
@ -189,7 +191,7 @@ namespace demo {
|
|||
ERROR (test, "need to fabricate more childz before you can grow 'em...");
|
||||
return;
|
||||
}
|
||||
uint selector = rand() % childz_.size();
|
||||
uint selector = rani(childz_.size());
|
||||
ChildEx& toGrow = *childz_[selector];
|
||||
toGrow.set_label ("***"+toGrow.get_label()+"***");
|
||||
}
|
||||
|
|
@ -204,7 +206,7 @@ namespace demo {
|
|||
WARN (test, "no children to kill. so sad.");
|
||||
return;
|
||||
}
|
||||
uint killPos = rand() % childz_.size();
|
||||
uint killPos = rani (childz_.size());
|
||||
ChildV::iterator killThat(&childz_[killPos]);
|
||||
ChildEx* victim = *killThat;
|
||||
childz_.erase (killThat);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ lumiera_uid_gen (lumiera_uid* luid)
|
|||
if (fd >= 0)
|
||||
fcntl (fd, F_SETFD, FD_CLOEXEC);
|
||||
else
|
||||
srand (getpid () + time (NULL));
|
||||
srand (getpid () + time (NULL)); //////////////////////////////////////////////////////////////////TICKET #1381 : entropy source should be configurable
|
||||
}
|
||||
|
||||
do
|
||||
|
|
@ -80,7 +80,7 @@ lumiera_uid_gen (lumiera_uid* luid)
|
|||
if (fd < 0)
|
||||
{
|
||||
for (int i = 0; i < 16; ++i)
|
||||
((unsigned char*)luid)[i] = (unsigned char)(rand()>>7);
|
||||
((unsigned char*)luid)[i] = (unsigned char)(rand()>>7); ///////////////////////////////////////TICKET #1381 : this fallback should certainly not happen silently
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
|
||||
#include "lib/format-string.hpp"
|
||||
#include "lib/random.hpp"
|
||||
|
||||
using util::_Fmt;
|
||||
using std::string;
|
||||
|
|
@ -44,8 +45,8 @@ namespace test {
|
|||
|
||||
namespace {// implementation constants
|
||||
|
||||
_Fmt predicatePattern ("%s_%02i( %s )");
|
||||
const string garbage ("asanisimasabibeddiboom");
|
||||
_Fmt predicatePattern{"%s_%02i( %s )"};
|
||||
const string garbage {"asanisimasasmicksmaggtutti"};
|
||||
|
||||
const uint MAX_DEGREE_RAND = 9;
|
||||
|
||||
|
|
@ -57,9 +58,9 @@ namespace test {
|
|||
garbage_term () ///< yields a random string of 3 letters
|
||||
{
|
||||
return predicatePattern
|
||||
% char ('a'+ rand() % 26)
|
||||
% (rand() % 100)
|
||||
% garbage.substr(rand() % 19 , 3);
|
||||
% char ('a'+ rani(26))
|
||||
% rani (100)
|
||||
% garbage.substr (rani(23) , 3);
|
||||
}
|
||||
|
||||
inline string
|
||||
|
|
@ -67,7 +68,7 @@ namespace test {
|
|||
{
|
||||
string fake;
|
||||
if (!degree)
|
||||
degree = 1 + rand() % MAX_DEGREE_RAND;
|
||||
degree = 1 + rani(MAX_DEGREE_RAND);
|
||||
while (0 < --degree)
|
||||
fake += garbage_term() + ", ";
|
||||
fake += garbage_term() + ".";
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
** ## Copy inhibition
|
||||
** The configuration of the RandomDraw processing pipeline makes heavy use of function composition
|
||||
** and adaptation to handle a wide selection of input types and usage patterns. Unfortunately this
|
||||
** requires to like the generated configuration-λ to the object instance (capturing by reference);
|
||||
** requires to link the generated configuration-λ to the object instance (capturing by reference);
|
||||
** not allowing this would severely limit the possible configurations. This implies that an object
|
||||
** instance must not be moved anymore, once the processing pipeline has been configured. And this
|
||||
** in turn would severely limit it's usage in a DSL. As a compromise, RandomDraw relies on
|
||||
|
|
@ -96,6 +96,7 @@
|
|||
|
||||
|
||||
#include "lib/error.h"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/lazy-init.hpp"
|
||||
#include "lib/meta/function.hpp"
|
||||
#include "lib/meta/function-closure.hpp"
|
||||
|
|
@ -163,7 +164,7 @@ namespace lib {
|
|||
struct LimitedRandomGenerate
|
||||
: function<Limited<uint, max>(void)>
|
||||
{
|
||||
static double defaultSrc() { return rand()/double(RAND_MAX); }
|
||||
static double defaultSrc() { return lib::defaultGen.uni(); }
|
||||
};
|
||||
|
||||
}//(End)Policy definitions
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@
|
|||
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "lib/test/tracking-dummy.hpp"
|
||||
#include "lib/unique-malloc-owner.hpp"
|
||||
#include "lib/format-string.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
#include "lib/unique-malloc-owner.hpp"
|
||||
#include "lib/random.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -68,13 +69,13 @@ namespace test{
|
|||
string
|
||||
randStr (size_t len)
|
||||
{
|
||||
static const string alpha ("aaaabbccddeeeeffgghiiiijjkkllmmnnooooppqqrrssttuuuuvvwwxxyyyyzz0123456789");
|
||||
static const size_t MAXAL (alpha.size());
|
||||
static const string alpha{"aaaabbccddeeeeffgghiiiijjkkllmmnnooooppqqrrssttuuuuvvwwxxyyyyzz0123456789"};
|
||||
static const size_t MAXAL{alpha.size()};
|
||||
|
||||
string garbage(len,'\0');
|
||||
size_t p = len;
|
||||
while (p)
|
||||
garbage[--p] = alpha[rand() % MAXAL];
|
||||
garbage[--p] = alpha[rani (MAXAL)];
|
||||
return garbage;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "lib/time/timevalue.hpp"
|
||||
#include "lib/test/transiently.hpp"
|
||||
#include "lib/format-obj.hpp"
|
||||
#include "lib/random.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <typeinfo>
|
||||
|
|
@ -60,7 +61,7 @@ namespace test{
|
|||
|
||||
using lib::Literal;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
using lib::rani;
|
||||
using lib::meta::demangleCxx;
|
||||
|
||||
|
||||
|
|
@ -308,7 +309,7 @@ namespace test{
|
|||
inline lib::time::Time
|
||||
randTime ()
|
||||
{
|
||||
return lib::time::Time (500 * (rand() % 2), (rand() % 600) + 1);
|
||||
return lib::time::Time (500 * rani(2), 1 + rani(600));
|
||||
}
|
||||
|
||||
/** create garbage string of given length
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "lib/nocopy.hpp"
|
||||
#include "lib/test/event-log.hpp"
|
||||
#include "lib/format-string.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -67,7 +68,7 @@ namespace test{
|
|||
}
|
||||
|
||||
Dummy ()
|
||||
: val_(1 + (rand() % 100'000'000))
|
||||
: val_{1 + rani (100'000'000)}
|
||||
{ init(); }
|
||||
|
||||
Dummy (int v)
|
||||
|
|
@ -165,7 +166,7 @@ namespace test{
|
|||
}
|
||||
|
||||
Tracker()
|
||||
: val{rand() % 1000}
|
||||
: val{rani (1000)}
|
||||
{
|
||||
log.call (this,"ctor");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ namespace dialog {
|
|||
pickDummyID()
|
||||
{
|
||||
string dummyID = sanitise (dummy_.get_text());
|
||||
dummy_.set_text (string{_Fmt{"d%s%02d"} % lib::test::randStr(2) % (1 + rand() % 99)});
|
||||
dummy_.set_text (string{_Fmt{"d%s%02d"} % lib::test::randStr(2) % (1 + lib::rani(99))});
|
||||
return dummyID;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ namespace steam {
|
|||
namespace mobject {
|
||||
namespace test {
|
||||
|
||||
using lib::rani;
|
||||
using lib::Symbol;
|
||||
using builder::BuilderTool;
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ namespace test {
|
|||
int id_;
|
||||
|
||||
public:
|
||||
DummyMO() : id_(rand() % 1000) {}
|
||||
DummyMO() : id_{rani(1000)} {}
|
||||
DummyMO(int i) : id_(i) {}
|
||||
|
||||
DEFINE_PROCESSABLE_BY (BuilderTool);
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ namespace test{
|
|||
Worker(CallQueue& queue, SyncBarrier& commonTrigger)
|
||||
: ThreadJoinable{"CallQueue_test: concurrent dispatch"
|
||||
, [&]() {
|
||||
uint cnt = rand() % MAX_RAND_STEPS;
|
||||
uint cnt = rand() % MAX_RAND_STEPS; //////////////////////////////OOO brauche rani auf lokalem Generator!
|
||||
uint delay = rand() % MAX_RAND_DELAY;
|
||||
|
||||
trigger_.sync(); // block until all threads are ready
|
||||
|
|
@ -227,6 +227,7 @@ namespace test{
|
|||
void
|
||||
verify_ThreadSafety()
|
||||
{
|
||||
////////////////////////////////////////////////OOO seedRandom()
|
||||
CallQueue queue;
|
||||
SyncBarrier trigger{NUM_OF_THREADS + 1};
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
#include "lib/depend-inject.hpp"
|
||||
#include "test-target-obj.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -106,6 +104,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_defaultSingletonCreation();
|
||||
verify_SubclassCreation();
|
||||
verify_FactoryDefinition_is_sticky();
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ namespace test{
|
|||
static VecI
|
||||
verifyDiagnosticStack()
|
||||
{
|
||||
uint seed (1 + rand() % MAX_RAND);
|
||||
uint seed (1 + rand() % MAX_RAND); /////////////////////////OOO brauche rani() auf lokalem Generator
|
||||
return descend (seed);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace test{
|
|||
DependInject<TestSingO>::Local<Mock_2> mock_2 ([&]{ return new Mock_2{"Mock", instanceID}; });
|
||||
|
||||
// NOTE: the ctor call for the Mock really happens delayed...
|
||||
instanceID = rand() % 10;
|
||||
instanceID = rani(10);
|
||||
sing().doIt(); // ctor invoked on first access
|
||||
CHECK (sing().getCnt() == 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,15 +30,13 @@
|
|||
#include "lib/format-string.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "lib/time/digxel.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <time.h>
|
||||
#include <cstdlib>
|
||||
|
||||
using lumiera::error::LUMIERA_ERROR_ASSERTION;
|
||||
using util::isSameObject;
|
||||
using util::isnil;
|
||||
using std::rand;
|
||||
using lib::rani;
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -55,8 +53,8 @@ namespace test{
|
|||
inline double
|
||||
randomFrac()
|
||||
{
|
||||
double arbitrary = (1 + rand() % RAND_RANGE);
|
||||
arbitrary /= (1 + rand() % RAND_DENOM);
|
||||
double arbitrary = 1 + rani(RAND_RANGE);
|
||||
arbitrary /= 1 + rani(RAND_DENOM);
|
||||
|
||||
static double prevVal;
|
||||
if (arbitrary != prevVal)
|
||||
|
|
@ -150,6 +148,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
checkSimpleUsage();
|
||||
checkMutation ();
|
||||
verifyMutatorInfluence();
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
#include "lib/test/run.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "lib/time/quantiser.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
#include <cstdlib>
|
||||
|
||||
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
|
||||
using util::isnil;
|
||||
using std::rand;
|
||||
using lib::rani;
|
||||
|
||||
|
||||
|
||||
|
|
@ -80,7 +80,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
checkSimpleQuantisation ();
|
||||
seedRand();
|
||||
checkSimpleQuantisation();
|
||||
coverQuantisationStandardCases();
|
||||
coverQuantisationCornerCases();
|
||||
}
|
||||
|
|
@ -91,8 +92,8 @@ namespace test{
|
|||
{
|
||||
FixedFrameQuantiser fixQ(25);
|
||||
|
||||
int frames = (rand() % MAX_FRAMES);
|
||||
FSecs dirt = (F25 / (2 + rand() % DIRT_GRAIN));
|
||||
int frames = rani(MAX_FRAMES);
|
||||
FSecs dirt = (F25 / (2 + rani(DIRT_GRAIN)));
|
||||
|
||||
Time rawTime = Time(frames*F25) + Duration(dirt);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,13 @@
|
|||
#include "lib/time/timevalue.hpp"
|
||||
#include "lib/time/diagnostics.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
using boost::lexical_cast;
|
||||
using util::isnil;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -131,10 +130,11 @@ namespace test{
|
|||
void
|
||||
checkComponentDiagnostics()
|
||||
{
|
||||
int millis = rand() % 1000;
|
||||
int secs = rand() % 60;
|
||||
int mins = rand() % 60;
|
||||
int hours = rand() % 100;
|
||||
seedRand();
|
||||
int millis = rani(1000);
|
||||
int secs = rani (60);
|
||||
int mins = rani (60);
|
||||
int hours = rani (100);
|
||||
|
||||
Time time(millis,secs,mins,hours);
|
||||
CHECK (Time() < time);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace test{
|
|||
random_or_get (string arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
return gavl_time_t (1 + (rand() % 100000)) * TimeValue::SCALE;
|
||||
return gavl_time_t(1 + rani (100000)) * TimeValue::SCALE;
|
||||
else
|
||||
return lexical_cast<gavl_time_t> (arg);
|
||||
}
|
||||
|
|
@ -145,6 +145,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
seedRand();
|
||||
TimeValue o (random_or_get (pop(arg)));
|
||||
TimeValue c (random_or_get (pop(arg)));
|
||||
CHECK (c!=Time::ZERO && o != c, "unsuitable testdata");
|
||||
|
|
|
|||
|
|
@ -35,11 +35,9 @@
|
|||
#include "lib/util.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
using boost::lexical_cast;
|
||||
using util::isnil;
|
||||
using std::rand;
|
||||
using std::string;
|
||||
|
||||
|
||||
|
|
@ -60,7 +58,7 @@ namespace test{
|
|||
{
|
||||
FrameCnt frameNr(0);
|
||||
while (!frameNr)
|
||||
frameNr = rand() % (2*MAX_FRAME) - MAX_FRAME;
|
||||
frameNr = rani(2*MAX_FRAME) - MAX_FRAME;
|
||||
|
||||
return toString(frameNr)+"#";
|
||||
}
|
||||
|
|
@ -80,6 +78,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
TimeGrid::build("pal0", FrameRate::PAL);
|
||||
|
||||
checkTimecodeUsageCycle ();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace test{
|
|||
random_or_get (string arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
return gavl_time_t (1 + (rand() % 100000)) * TimeValue::SCALE;
|
||||
return gavl_time_t(1 + rani (100000)) * TimeValue::SCALE;
|
||||
else
|
||||
return lexical_cast<gavl_time_t> (arg);
|
||||
}
|
||||
|
|
@ -98,6 +98,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
seedRand();
|
||||
TimeValue o (random_or_get (pop(arg)));
|
||||
TimeValue c (random_or_get (pop(arg)));
|
||||
CHECK (o != c, "unsuitable testdata");
|
||||
|
|
|
|||
|
|
@ -33,12 +33,10 @@
|
|||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
using boost::lexical_cast;
|
||||
using util::isnil;
|
||||
using util::contains;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -63,7 +61,10 @@ namespace test{
|
|||
random_or_get (Arg arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
return 1 + (rand() % 10000);
|
||||
{// use random time value for all tests
|
||||
seedRand();
|
||||
return 1 + rani(10000);
|
||||
}
|
||||
else
|
||||
return lexical_cast<int> (arg[1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ namespace test{
|
|||
random_or_get (Arg arg)
|
||||
{
|
||||
if (isnil(arg))
|
||||
return 1 + (rand() % 10000);
|
||||
{// use random time value for all tests
|
||||
seedRand();
|
||||
return 1 + rani(10000);
|
||||
}
|
||||
else
|
||||
return lexical_cast<gavl_time_t> (arg[1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@
|
|||
#include "lib/test/run.hpp"
|
||||
#include "lib/typed-counter.hpp"
|
||||
#include "lib/test/microbenchmark.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#include <array>
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ namespace lib {
|
|||
namespace test{
|
||||
|
||||
using util::isnil;
|
||||
using std::rand;
|
||||
using lib::rani;
|
||||
|
||||
|
||||
namespace { // test parametrisation...
|
||||
|
|
@ -176,16 +176,16 @@ namespace test{
|
|||
void
|
||||
tortureTest()
|
||||
{
|
||||
std::srand (::time (NULL));
|
||||
seedRand();
|
||||
|
||||
using IDX = std::make_index_sequence<MAX_INDEX>;
|
||||
auto operators = buildOperatorsTable(IDX{});
|
||||
|
||||
TypedCounter testCounter;
|
||||
|
||||
auto testSubject = [&](size_t) -> size_t
|
||||
auto testSubject = [&, i = rani(MAX_INDEX)]
|
||||
(size_t) -> size_t
|
||||
{
|
||||
uint i = rand() % MAX_INDEX;
|
||||
operators[i](testCounter);
|
||||
return 1;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,6 +69,13 @@ namespace test {
|
|||
const uint MAX_RUNNING_TIME_ms = 80;
|
||||
const uint MIN_RUNNING_TIME_ms = 20;
|
||||
|
||||
inline int
|
||||
draw_rand_runtime()
|
||||
{
|
||||
return MIN_RUNNING_TIME_ms
|
||||
+ rani (MAX_RUNNING_TIME_ms - MIN_RUNNING_TIME_ms);
|
||||
}
|
||||
|
||||
/** the "running" subsystem checks for a
|
||||
* shutdown request every XX milliseconds */
|
||||
const uint TICK_DURATION_ms = 5;
|
||||
|
|
@ -110,6 +117,7 @@ namespace test {
|
|||
atomic_bool started_{false};
|
||||
atomic_bool termRequest_{false};
|
||||
int running_duration_{0};
|
||||
const int TIME_GOAL{draw_rand_runtime()};
|
||||
|
||||
lib::SyncBarrier barrier_{};
|
||||
unique_ptr<Thread> thread_{};
|
||||
|
|
@ -193,8 +201,7 @@ namespace test {
|
|||
|
||||
if (isUp_) //-------------actually enter running state for some time
|
||||
{
|
||||
running_duration_ = MIN_RUNNING_TIME_ms;
|
||||
running_duration_ += (rand() % (MAX_RUNNING_TIME_ms - MIN_RUNNING_TIME_ms));
|
||||
running_duration_ = TIME_GOAL; // prepared when creating instance
|
||||
|
||||
INFO (test, "thread %s now running....", cStr(*this));
|
||||
|
||||
|
|
@ -275,6 +282,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
singleSubsys_complete_cycle();
|
||||
singleSubsys_start_failure();
|
||||
singleSubsys_emegency_exit();
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
createGrid_fullProcedure();
|
||||
createGrid_simplified();
|
||||
}
|
||||
|
|
@ -98,12 +99,12 @@ namespace test {
|
|||
|
||||
// now verify the grid
|
||||
// by performing some conversions...
|
||||
int randomFrame = (rand() % MAX_FRAMES);
|
||||
int randomFrame = rani(MAX_FRAMES);
|
||||
|
||||
Time point (myGrid->timeOf (randomFrame));
|
||||
CHECK (point == TEST_ORIGIN + randomFrame * TEST_FPS.duration());
|
||||
|
||||
int fract = 2 + rand() % DIRT_GRAIN;
|
||||
int fract = 2 + rani(DIRT_GRAIN);
|
||||
FSecs dirt = (1/TEST_FPS) / fract;
|
||||
ASSERT (Time(dirt) < TEST_FPS.duration());
|
||||
ASSERT (0 < dirt);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ namespace test {
|
|||
|
||||
/// another dummy-UNDO function
|
||||
void dummyU (int,int,int) { }
|
||||
int dummyC (int u,int o) { return u + rand() % (o-u+1); }
|
||||
int dummyC (int u,int o) { return u + rani(o-u+1); }
|
||||
|
||||
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ namespace test {
|
|||
int
|
||||
twoRandomDigits()
|
||||
{
|
||||
return 10 + rand() % 90;
|
||||
return 10 + rani(90);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -206,6 +206,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
ArgTuples testTuples;
|
||||
prepareEmptyMemento();
|
||||
Tracker<TimeVar>::instanceCnt = 0;
|
||||
|
|
@ -256,9 +257,9 @@ namespace test {
|
|||
for_each (tup, showIt);
|
||||
|
||||
arg1->storeTuple (std::tuple<>());
|
||||
arg2->storeTuple (make_tuple (rand() % 10));
|
||||
arg3->storeTuple (make_tuple (rand() % 10, TimeVar(randTime())));
|
||||
arg4->storeTuple (make_tuple (rand() % 10, TimeVar(randTime())));
|
||||
arg2->storeTuple (make_tuple (rani(10)));
|
||||
arg3->storeTuple (make_tuple (rani(10), TimeVar(randTime())));
|
||||
arg4->storeTuple (make_tuple (rani(10), TimeVar(randTime())));
|
||||
|
||||
arg5->storeTuple (make_tuple (TTime (randTime()), Tstr("glorious"), twoRandomDigits() ));
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@
|
|||
#include "lib/time/timevalue.hpp"
|
||||
#include "lib/p.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace steam {
|
||||
namespace control {
|
||||
|
|
@ -96,7 +92,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
int randVal ((rand() % 10) - 5);
|
||||
seedRand();
|
||||
int randVal{rani(10) - 5};
|
||||
Time five(TimeValue(5));
|
||||
TimeValue randomTime(randVal);
|
||||
auto obj = makeP<TimeVar>(five);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
CommandRegistry& registry = CommandRegistry::instance();
|
||||
CHECK (®istry);
|
||||
uint cnt_inst = registry.instance_count();
|
||||
|
|
@ -120,7 +121,7 @@ namespace test {
|
|||
bindRandArgument (CommandImpl& cmd)
|
||||
{
|
||||
typedef Types<int> ArgType;
|
||||
TypedArguments<Tuple<ArgType>> arg (std::make_tuple (rand() % 10000));
|
||||
TypedArguments<Tuple<ArgType>> arg (std::make_tuple (rani (10000)));
|
||||
cmd.setArguments (arg);
|
||||
CHECK (cmd.canExec());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include "lib/util.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
|
@ -48,7 +47,6 @@ namespace test {
|
|||
using std::string;
|
||||
using util::_Fmt;
|
||||
using std::move;
|
||||
using std::rand;
|
||||
|
||||
using LERR_(LIFECYCLE);
|
||||
using LERR_(INVALID_COMMAND);
|
||||
|
|
@ -119,6 +117,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_simpleUsage();
|
||||
verify_extendedUsage();
|
||||
verify_instanceIdentity();
|
||||
|
|
@ -145,7 +144,7 @@ namespace test {
|
|||
CommandInstanceManager iManager{fixture};
|
||||
CHECK (not iManager.contains (COMMAND_PROTOTYPE));
|
||||
|
||||
int r1{rand()%1000}, r2{rand()%2000};
|
||||
int r1{rani(1000)}, r2{rani(2000)};
|
||||
command1::check_ = 0; // commands will add to this on invocation
|
||||
|
||||
iManager.bindAndDispatch (COMMAND_PROTOTYPE, Rec{r1});
|
||||
|
|
@ -230,7 +229,7 @@ namespace test {
|
|||
CHECK (c11.isValid());
|
||||
CHECK (not c11.canExec());
|
||||
|
||||
int r1{rand()%100}, r2{rand()%200}, r3{rand()%300};
|
||||
int r1{rani(100)}, r2{rani(200)}, r3{rani(300)};
|
||||
command1::check_ = 0; // commands will add to this on invocation
|
||||
|
||||
c11.bind (r1);
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
checkMutation();
|
||||
checkUndoMutation();
|
||||
checkStateCapturingMechanism();
|
||||
|
|
@ -203,7 +205,7 @@ namespace test {
|
|||
function<void()> bound_cap_func = mementoHolder.tieCaptureFunc();
|
||||
|
||||
|
||||
int rr (rand() % 100);
|
||||
int rr{rani (100)};
|
||||
testVal = rr;
|
||||
bound_cap_func(); // invoke state capturing
|
||||
CHECK (rr == mementoHolder.getState());
|
||||
|
|
|
|||
|
|
@ -60,13 +60,14 @@ namespace test {
|
|||
{
|
||||
|
||||
int randVal;
|
||||
int random() { return randVal = 10 + (rand() % 40); }
|
||||
int random() { return randVal = 10 + rani(40); }
|
||||
|
||||
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
command1::check_ = 0;
|
||||
uint cnt_defs = Command::definition_count();
|
||||
uint cnt_inst = Command::instance_count();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace test {
|
|||
{
|
||||
_Fmt fmt ("invoked( %2d )");
|
||||
|
||||
randVal_ = rand() % 100;
|
||||
randVal_ = rani (100);
|
||||
return fmt % randVal_;
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +107,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
command2::check_.seekp(0);
|
||||
uint cnt_defs = Command::definition_count();
|
||||
uint cnt_inst = Command::instance_count();
|
||||
|
|
|
|||
|
|
@ -35,17 +35,12 @@
|
|||
|
||||
#include "steam/control/test-dummy-commands.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace steam {
|
||||
namespace control {
|
||||
namespace test {
|
||||
|
||||
namespace steam {
|
||||
namespace control{
|
||||
namespace test {
|
||||
|
||||
using std::function;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace { // test fixture...
|
||||
|
||||
|
|
@ -128,6 +123,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
CommandRegistry& registry = CommandRegistry::instance();
|
||||
CHECK (®istry);
|
||||
|
||||
|
|
@ -182,7 +178,7 @@ namespace test {
|
|||
CHECK (!com->canExec());
|
||||
|
||||
typedef Types<int> ArgType;
|
||||
const int ARGR (1 + rand() % 1000);
|
||||
const int ARGR{1 + rani (1000)};
|
||||
Tuple<ArgType> tuple(ARGR);
|
||||
TypedArguments<Tuple<ArgType>> arg(tuple);
|
||||
com->setArguments(arg);
|
||||
|
|
|
|||
|
|
@ -30,11 +30,9 @@
|
|||
#include "steam/control/memento-tie.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <cstdlib>
|
||||
|
||||
using std::function;
|
||||
using std::bind;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace steam {
|
||||
|
|
@ -85,6 +83,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
checkStateCapturingMechanism();
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +111,7 @@ namespace test {
|
|||
VERIFY_ERROR (MISSING_MEMENTO, bound_undo_func(123) );
|
||||
VERIFY_ERROR (MISSING_MEMENTO, mementoHolder.getState() );
|
||||
|
||||
short rr (rand() %100);
|
||||
short rr (rani (100));
|
||||
testVal = 0;
|
||||
bound_cap_func(rr); // invoke state capturing
|
||||
|
||||
|
|
@ -123,7 +122,7 @@ namespace test {
|
|||
CHECK (testVal == 10-rr);
|
||||
|
||||
// this cycle can be repeated with different state values
|
||||
rr = (rand() %100);
|
||||
rr = rani (100);
|
||||
testVal = rr;
|
||||
bound_cap_func(5); // capture new state
|
||||
CHECK (5+rr == mementoHolder.getState());
|
||||
|
|
|
|||
|
|
@ -47,9 +47,6 @@ namespace test {
|
|||
|
||||
const size_t TEST_MAX_SIZE = 1024 * 1024;
|
||||
|
||||
const size_t SIZE_A = 1 + rand() % TEST_MAX_SIZE;
|
||||
const size_t SIZE_B = 1 + rand() % TEST_MAX_SIZE;
|
||||
|
||||
|
||||
/**
|
||||
* Test Mock to verify the attachment of objects to the buffer.
|
||||
|
|
@ -166,10 +163,17 @@ namespace test {
|
|||
*/
|
||||
class BufferMetadataKey_test : public Test
|
||||
{
|
||||
size_t SIZE_A{0};
|
||||
size_t SIZE_B{0};
|
||||
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
SIZE_A = 1 + rani(TEST_MAX_SIZE);
|
||||
SIZE_B = 1 + rani(TEST_MAX_SIZE);
|
||||
|
||||
CHECK (ensure_proper_fixture());
|
||||
buildSimpleKeys();
|
||||
verifyChainedHashes();
|
||||
|
|
@ -190,7 +194,7 @@ namespace test {
|
|||
{
|
||||
HashVal family(123);
|
||||
Key k1(family, SIZE_A);
|
||||
Key k12(k1, SIZE_B);
|
||||
Key k12(k1, SIZE_B);
|
||||
Key k123(k12, LocalTag(56));
|
||||
|
||||
CHECK (HashVal (k1));
|
||||
|
|
@ -213,7 +217,7 @@ namespace test {
|
|||
CHECK (HashVal(k1) == HashVal(Key(family, SIZE_A)));
|
||||
|
||||
// differentiate on buffer size
|
||||
Key k12(k1, SIZE_B);
|
||||
Key k12(k1, SIZE_B);
|
||||
Key k121(k12, SIZE_A);
|
||||
Key k2(family, SIZE_B);
|
||||
|
||||
|
|
@ -257,8 +261,8 @@ namespace test {
|
|||
TypeHandler placeMarker = TypeHandler::create<Marker>();
|
||||
TypeHandler noHandler;
|
||||
|
||||
LocalTag opaque1 (rand() % 1000);
|
||||
LocalTag opaque2 (1000 + rand() % 1000);
|
||||
LocalTag opaque1 (rani(1000));
|
||||
LocalTag opaque2 (1000 + rani(1000));
|
||||
|
||||
Key k_siz (kb, SIZE_B); // sub-key to "root": use a different buffer size
|
||||
Key k_han0(kb, noHandler); // sub-key to "root": use a locally defined type functor
|
||||
|
|
|
|||
|
|
@ -71,9 +71,6 @@ namespace test {
|
|||
|
||||
const size_t TEST_MAX_SIZE = 1024 * 1024;
|
||||
|
||||
const size_t SIZE_A = 1 + rand() % TEST_MAX_SIZE;
|
||||
const size_t SIZE_B = 1 + rand() % TEST_MAX_SIZE;
|
||||
|
||||
HashVal JUST_SOMETHING = 123;
|
||||
auto SOME_POINTER = mark_as_Buffer(JUST_SOMETHING);
|
||||
|
||||
|
|
@ -91,12 +88,19 @@ namespace test {
|
|||
*/
|
||||
class BufferMetadata_test : public Test
|
||||
{
|
||||
size_t SIZE_A{0};
|
||||
size_t SIZE_B{0};
|
||||
|
||||
/** common Metadata table to be tested */
|
||||
unique_ptr<BufferMetadata> meta_;
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
SIZE_A = 1 + rani(TEST_MAX_SIZE);
|
||||
SIZE_B = 1 + rani(TEST_MAX_SIZE);
|
||||
|
||||
CHECK (ensure_proper_fixture());
|
||||
verifyBasicProperties();
|
||||
verifyStandardCase();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
resolveModelPort();
|
||||
accessJobTicket();
|
||||
pipelineBuilder();
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ namespace test {
|
|||
|
||||
MockSizeRequest()
|
||||
: Connectivity(dummy1,dummy2,0,NodeID()),
|
||||
ii(rand() % CHUNK_MAX),
|
||||
oo(rand() % CHUNK_MAX)
|
||||
ii(rani (CHUNK_MAX)),
|
||||
oo(rani (CHUNK_MAX))
|
||||
{ }
|
||||
|
||||
virtual uint getNrI() const { return ii; }
|
||||
|
|
@ -141,8 +141,10 @@ namespace test {
|
|||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #852
|
||||
ulong counter;
|
||||
|
||||
virtual void run(Arg)
|
||||
void
|
||||
run(Arg) override
|
||||
{
|
||||
seedRand(); ////////////////TODO RLY?
|
||||
counter = 0;
|
||||
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #852
|
||||
|
|
@ -173,7 +175,7 @@ namespace test {
|
|||
BuffTableChunk thisChunk (numbers, *pStorage);
|
||||
CHECK (consistencyCheck (thisChunk, numbers, lastLevel));
|
||||
|
||||
uint nrBranches ( 1 + (rand() % WIDTH_MAX));
|
||||
uint nrBranches ( 1 + rani(WIDTH_MAX));
|
||||
while (nrBranches--)
|
||||
invocation (consumed, first_behind (thisChunk,numbers.getNrI()));
|
||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #833
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_simple_job_properties();
|
||||
verify_job_identity();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
demonstrateScaffolding();
|
||||
buildBaseTickGenerator();
|
||||
accessTopLevelJobTicket();
|
||||
|
|
@ -105,7 +106,7 @@ namespace test {
|
|||
demonstrateScaffolding()
|
||||
{
|
||||
Time nominalTime = lib::test::randTime();
|
||||
int additionalKey = rand() % 5000;
|
||||
int additionalKey = rani(5000);
|
||||
|
||||
// (1) mocked render Job
|
||||
MockJob mockJob{nominalTime, additionalKey};
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUsage();
|
||||
calculateDeadline();
|
||||
setupDependentJob();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
#include "lib/depend.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
@ -60,6 +59,7 @@ namespace test {
|
|||
|
||||
namespace { // MockJob and DummyClosure implementation details...
|
||||
|
||||
using lib::rani;
|
||||
using lib::HashVal;
|
||||
using lib::NullValue;
|
||||
using lib::time::TimeVar;
|
||||
|
|
@ -185,8 +185,8 @@ namespace test {
|
|||
MockJob::build()
|
||||
{
|
||||
InvocationInstanceID invoKey;
|
||||
invoKey.part.a = rand() % MAX_PARAM_A;
|
||||
invoKey.part.b = rand() % (2*MAX_PARAM_B) - MAX_PARAM_B;
|
||||
invoKey.part.a = rani (MAX_PARAM_A);
|
||||
invoKey.part.b = rani (2*MAX_PARAM_B - MAX_PARAM_B);
|
||||
|
||||
Time nominalTime = lib::test::randTime();
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ namespace test {
|
|||
{
|
||||
InvocationInstanceID invoKey;
|
||||
invoKey.part.a = additionalKey;
|
||||
invoKey.part.b = rand() % (2*MAX_PARAM_B) - MAX_PARAM_B;
|
||||
invoKey.part.b = rani (2*MAX_PARAM_B - MAX_PARAM_B);
|
||||
|
||||
return Job(dummyClosure, invoKey, nominalTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ namespace test {
|
|||
using lib::time::TimeValue;
|
||||
using lib::time::Time;
|
||||
using lib::HashVal;
|
||||
using lib::ranHash;
|
||||
using lib::rani;
|
||||
using util::isnil;
|
||||
using util::isSameObject;
|
||||
using fixture::Segmentation;
|
||||
|
|
@ -152,7 +154,7 @@ namespace test {
|
|||
|
||||
/** provide a test specification wired to MockJob */
|
||||
static ExitNode
|
||||
defineSimpleSpec (HashVal seed = 1+rand())
|
||||
defineSimpleSpec (HashVal seed =ranHash())
|
||||
{
|
||||
return ExitNode{seed, DUMMY_JOB_RUNTIME
|
||||
,ExitNodes{}
|
||||
|
|
@ -239,7 +241,7 @@ namespace test {
|
|||
buildSeed (GenNode const& spec)
|
||||
{
|
||||
auto seed = spec.retrieveAttribute<int> ("mark");
|
||||
return seed? HashVal(*seed) : HashVal(rand() % 1000);
|
||||
return seed? HashVal(*seed) : HashVal(1 +rani(1000));
|
||||
}
|
||||
|
||||
Duration
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUsage();
|
||||
verify_MockJob();
|
||||
verify_MockJobTicket();
|
||||
|
|
@ -103,7 +105,7 @@ namespace test {
|
|||
verify_MockJob()
|
||||
{
|
||||
Time nominalTime = lib::test::randTime();
|
||||
int additionalKey = rand() % 5000;
|
||||
int additionalKey = rani(5000);
|
||||
MockJob mockJob{nominalTime, additionalKey};
|
||||
CHECK (mockJob.getNominalTime() == nominalTime);
|
||||
CHECK (not MockJob::was_invoked (mockJob));
|
||||
|
|
@ -188,7 +190,7 @@ namespace test {
|
|||
//-----------------------------------------------------------------/// Segmentation with a segment spanning part of the timeline > 10s
|
||||
{
|
||||
// Marker to verify the job calls back into the right segment
|
||||
int marker = rand() % 1000;
|
||||
int marker = rani(1000);
|
||||
//
|
||||
// Build a Segmentation partitioned at 10s
|
||||
MockSegmentation mockSegs{MakeRec()
|
||||
|
|
@ -224,7 +226,7 @@ namespace test {
|
|||
}
|
||||
//-----------------------------------------------------------------/// Segmentation with one delineated segment, and otherwise empty
|
||||
{
|
||||
int marker = rand() % 1000;
|
||||
int marker = rani(1000);
|
||||
// Build Segmentation with one fully defined segment
|
||||
MockSegmentation mockSegs{MakeRec()
|
||||
.attrib ("start", Time{0,10}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
SchedulerFrontend& scheduler = SchedulerFrontend::instance();
|
||||
|
||||
verify_simple_job_specification (scheduler);
|
||||
|
|
|
|||
|
|
@ -29,12 +29,10 @@
|
|||
#include "steam/engine/testframe.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <memory>
|
||||
|
||||
using test::Test;
|
||||
using std::rand;
|
||||
using util::isSameObject;
|
||||
using std::unique_ptr;
|
||||
|
||||
|
|
@ -54,7 +52,7 @@ namespace test {
|
|||
{
|
||||
char* accessor = reinterpret_cast<char*> (base);
|
||||
while (count--)
|
||||
accessor[offset+count] = rand() % CHAR_MAX;
|
||||
accessor[offset+count] = rani(CHAR_MAX);
|
||||
}
|
||||
} // (End) internal defs
|
||||
|
||||
|
|
@ -80,6 +78,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verifyBasicProperties();
|
||||
verifyFrameLifecycle();
|
||||
verifyFrameSeries();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "steam/engine/testframe.hpp"
|
||||
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
|
|
@ -42,6 +43,7 @@ namespace test {
|
|||
|
||||
using std::vector;
|
||||
using std::memcpy;
|
||||
using lib::rani;
|
||||
|
||||
typedef boost::rand48 PseudoRandom;
|
||||
|
||||
|
|
@ -62,7 +64,7 @@ namespace test {
|
|||
generateDistinction(uint seq, uint family)
|
||||
{
|
||||
// random offset, but fixed per executable run
|
||||
static uint base(10 + rand() % 990);
|
||||
static uint base(10 + rani(990)); /////////////////////////////////////////////////////////////////////TICKET #1372 this is not reproducible!!
|
||||
|
||||
// use the family as stepping
|
||||
return (seq+1) * (base+family);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ using test::Test;
|
|||
using util::isnil;
|
||||
//using std::vector;
|
||||
//using std::function;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace steam {
|
||||
|
|
@ -70,7 +69,7 @@ namespace test {
|
|||
FSecs
|
||||
randTicks()
|
||||
{
|
||||
return FSecs{1 + rand() % 600, 1 + rand() % 600};
|
||||
return FSecs{1 + rani(600), 1 + rani(600)};
|
||||
}
|
||||
|
||||
} // (End) Test fixture
|
||||
|
|
@ -90,6 +89,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_simpleFrameStep();
|
||||
verify_next_startPoint();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,8 @@
|
|||
#include "steam/engine/buffhandle-attach.hpp"
|
||||
#include "steam/engine/testframe.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace steam {
|
||||
namespace engine{
|
||||
|
|
@ -82,6 +79,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleExample();
|
||||
verifyStandardCase();
|
||||
verifyTestProtocol();
|
||||
|
|
@ -97,7 +96,7 @@ namespace test {
|
|||
CHECK (testBuff);
|
||||
CHECK (testBuff.accessAs<TestFrame>().isSane());
|
||||
|
||||
uint dataID = 1 + rand() % 29;
|
||||
uint dataID = 1 + rani(29);
|
||||
testBuff.accessAs<TestFrame>() = testData(dataID);
|
||||
|
||||
provider.emitBuffer (testBuff);
|
||||
|
|
@ -121,7 +120,7 @@ namespace test {
|
|||
for (uint i=0; i<numElms; ++i)
|
||||
{
|
||||
BuffHandle buff = provider.lockBuffer(buffType);
|
||||
buff.accessAs<uint>() = testNumbers[i] = rand() % 100000;
|
||||
buff.accessAs<uint>() = testNumbers[i] = rani(100000);
|
||||
provider.emitBuffer (buff);
|
||||
provider.releaseBuffer(buff);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
fabricate_MockSegment();
|
||||
retrieve_JobTicket();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
access_ExitNodeTree();
|
||||
fabricate_MockExitNode();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace test {
|
|||
string
|
||||
newID (Symbol prefix)
|
||||
{
|
||||
return pattern % prefix % std::rand();
|
||||
return pattern % prefix % rani(10'000);
|
||||
}
|
||||
}//(end)test fixture
|
||||
|
||||
|
|
@ -96,6 +96,8 @@ namespace test {
|
|||
virtual void
|
||||
run(Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
define_and_search();
|
||||
string pipeID = create();
|
||||
forget(pipeID);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
seedRand();
|
||||
string pipeID = isnil(arg)? "Black Hole" : arg[1];
|
||||
string streamID = 2>arg.size()? "teststream" : arg[2];
|
||||
|
||||
|
|
@ -149,7 +150,7 @@ namespace test {
|
|||
|
||||
string new_pID = _Fmt{"dummy_%s_%i"}
|
||||
% pipe1->getPipeID()
|
||||
% std::rand()
|
||||
% rani(10'000)
|
||||
; // make random new pipeID
|
||||
Query<Pipe> query_for_new{"pipe("+new_pID+")"};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ using lib::P;
|
|||
|
||||
using std::unique_ptr;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
using std::map;
|
||||
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ namespace test {
|
|||
string
|
||||
newID (string prefix)
|
||||
{
|
||||
return instancePatt % prefix % rand();
|
||||
return instancePatt % prefix % rani(10'000);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -139,6 +138,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
this->reg_.reset (new DefsRegistry);
|
||||
|
||||
fill_table ();
|
||||
|
|
|
|||
|
|
@ -28,11 +28,6 @@
|
|||
#include "lib/test/run.hpp"
|
||||
#include "common/advice.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
using std::rand;
|
||||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace advice {
|
||||
|
|
@ -116,6 +111,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleExchange();
|
||||
createCollaboration();
|
||||
overwriting_and_retracting();
|
||||
|
|
@ -133,7 +130,7 @@ namespace test {
|
|||
TheAdvisor server; // implicitly prepares an advice provision
|
||||
CHECK (client.got (0)); // but as no advice was provided yet, nothing happens
|
||||
|
||||
int rr (1 + (rand() % 1000));
|
||||
int rr{ 1 + rani(1000)};
|
||||
|
||||
server.publish (rr); // now an match is detected, creating an advice channel
|
||||
CHECK (client.got (rr)); // ..so the client can pick up the provided advice value
|
||||
|
|
@ -147,8 +144,8 @@ namespace test {
|
|||
TheAdvised client1 ("topic1()");
|
||||
TheAdvisor server2 ("topic2()");
|
||||
|
||||
int r1 (1 + (rand() % 1000));
|
||||
int r2 (1 + (rand() % 1000));
|
||||
int r1{ 1 + rani(1000)};
|
||||
int r2{ 1 + rani(1000)};
|
||||
|
||||
server2.publish (r2);
|
||||
CHECK (client1.got(0));
|
||||
|
|
@ -186,8 +183,8 @@ namespace test {
|
|||
CHECK (client1.got(0));
|
||||
CHECK (client2.got(0));
|
||||
|
||||
int r1 (1 + (rand() % 1000));
|
||||
int r2 (1 + (rand() % 1000));
|
||||
int r1{ 1 + rani(1000)};
|
||||
int r2{ 1 + rani(1000)};
|
||||
|
||||
{
|
||||
TheAdvisor server("slot1()");
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ namespace test {
|
|||
{
|
||||
auto invoker = buildTrampoline();
|
||||
for (uint i=0; i<NUM_OBJECTS; ++i)
|
||||
invoker[rand() % NUM_TYPES] (clu, uchar(i));
|
||||
invoker[rani (NUM_TYPES)] (clu, uchar(i));
|
||||
}
|
||||
|
||||
inline uint
|
||||
|
|
@ -150,6 +150,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUsage();
|
||||
checkLifecycle();
|
||||
verifyInternals();
|
||||
|
|
@ -236,7 +238,7 @@ namespace test {
|
|||
CHECK ( 0 == clu.storage_.rest);
|
||||
|
||||
// build a simple object
|
||||
auto& i1 = clu.create<uint16_t> (1 + uint16_t(rand()));
|
||||
auto& i1 = clu.create<uint16_t> (1 + uint16_t(rani()));
|
||||
CHECK (i1 > 0);
|
||||
CHECK (1 == clu.numExtents());
|
||||
CHECK (2 == clu.numBytes());
|
||||
|
|
|
|||
|
|
@ -28,17 +28,11 @@
|
|||
#include "lib/test/run.hpp"
|
||||
#include "lib/del-stash.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
using std::rand;
|
||||
|
||||
|
||||
|
||||
namespace { // probe victims
|
||||
|
||||
ulong MAX_MASS = 200; // number of victims to kill at once
|
||||
|
|
@ -59,7 +53,7 @@ namespace test{
|
|||
REQUIRE (siz);
|
||||
for (uint i=0; i<siz; ++i)
|
||||
{
|
||||
char c (rand() % 256);
|
||||
char c (rani(256));
|
||||
checksum += c;
|
||||
myCrap_[i] = c;
|
||||
}
|
||||
|
|
@ -110,7 +104,9 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
checksum = 0;
|
||||
|
||||
checkSingleKill();
|
||||
checkCustomKill();
|
||||
checkMassKill();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
using boost::lexical_cast;
|
||||
using std::cout;
|
||||
|
|
@ -94,7 +93,7 @@ namespace test {
|
|||
string formatString = "%p %|20T_| %u";
|
||||
_Fmt formatter (formatString);
|
||||
|
||||
uint val = rand() % 100;
|
||||
uint val = rani (100);
|
||||
void *pt = &val;
|
||||
|
||||
formatter % pt;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
demonstrate_boost_hash_weakness();
|
||||
verify_Knuth_workaround();
|
||||
}
|
||||
|
|
@ -133,7 +134,7 @@ namespace test{
|
|||
{
|
||||
StringsTable hashValues;
|
||||
string prefix = "Entry.";
|
||||
const size_t seed = rand();
|
||||
const size_t seed = rani();
|
||||
|
||||
const size_t KNUTH_MAGIC = 2654435761;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,14 @@
|
|||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include "lib/wrapper.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -55,9 +56,6 @@ namespace test{
|
|||
using std::shared_ptr;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
||||
|
||||
|
|
@ -69,9 +67,9 @@ namespace test{
|
|||
{
|
||||
uint i_;
|
||||
|
||||
Tracker() : i_(rand() % 500) { ++cntTracker; }
|
||||
Tracker(Tracker const& ot) : i_(ot.i_) { ++cntTracker; }
|
||||
~Tracker() { --cntTracker; }
|
||||
Tracker() : i_(rani(500)) { ++cntTracker; }
|
||||
Tracker(Tracker const& ot) : i_(ot.i_) { ++cntTracker; }
|
||||
~Tracker() { --cntTracker; }
|
||||
};
|
||||
|
||||
bool operator== (Tracker const& t1, Tracker const& t2) { return t1.i_ == t2.i_; }
|
||||
|
|
@ -112,8 +110,10 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
ulong l1 (rand() % 1000);
|
||||
ulong l2 (rand() % 1000);
|
||||
seedRand();
|
||||
|
||||
ulong l1 (rani (1000));
|
||||
ulong l2 (rani (1000));
|
||||
string s1 (randStr(50));
|
||||
string s2 (randStr(50));
|
||||
const char* cp (s1.c_str());
|
||||
|
|
@ -304,15 +304,17 @@ namespace test{
|
|||
}
|
||||
|
||||
|
||||
static auto produceResult() { return rani(); }
|
||||
|
||||
/** @test verify an extension built on top of the ItemWrapper:
|
||||
* a function which remembers the last result. As a simple test,
|
||||
* we bind the \c rand() standard lib function and remember the
|
||||
* last returned random value.
|
||||
* we bind a static helper function to produce a random value
|
||||
* and remember the result returned last.
|
||||
*/
|
||||
void
|
||||
verifyFunctionResult()
|
||||
{
|
||||
FunctionResult<int(void)> randomVal (std::rand);
|
||||
FunctionResult<int(void)> randomVal (produceResult);
|
||||
|
||||
// function was never invoked, thus the remembered result is NIL
|
||||
CHECK (!randomVal);
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ namespace test{
|
|||
static char
|
||||
rndLetter()
|
||||
{
|
||||
return 'A' + rand() % 26;
|
||||
return 'A' + rani(26);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -274,6 +274,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
verify_wrappedState();
|
||||
verify_wrappedIterator();
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <unordered_map>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
|
@ -47,15 +46,14 @@ namespace lib {
|
|||
namespace test{
|
||||
|
||||
using ::Test;
|
||||
using util::isnil;
|
||||
using boost::lexical_cast;
|
||||
using lib::time::TimeVar;
|
||||
using lib::test::randStr;
|
||||
using lib::test::randTime;
|
||||
using util::isnil;
|
||||
using std::make_pair;
|
||||
using std::string;
|
||||
using std::list;
|
||||
using std::rand;
|
||||
|
||||
using LERR_(ITER_EXHAUST);
|
||||
|
||||
|
|
@ -186,6 +184,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
seedRand();
|
||||
if (0 < arg.size()) NUM_ELMS = lexical_cast<uint> (arg[1]);
|
||||
|
||||
verify_simpleIters();
|
||||
|
|
@ -329,7 +328,7 @@ namespace test{
|
|||
MAP testMap;
|
||||
for (uint i=0; i<NUM_ELMS; ++i)
|
||||
{
|
||||
uint n = 1 + rand() % 100;
|
||||
uint n = 1 + rani(100);
|
||||
do testMap.insert (make_pair (i,n));
|
||||
while (--n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include "lib/itertools.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
|
@ -48,7 +47,6 @@ namespace test{
|
|||
using util::for_each;
|
||||
using util::isnil;
|
||||
using std::vector;
|
||||
using std::rand;
|
||||
|
||||
using LERR_(ITER_EXHAUST);
|
||||
|
||||
|
|
@ -246,7 +244,7 @@ namespace test{
|
|||
vector<uint> numberz;
|
||||
for (uint i=0; i<NUM_ELMS; ++i)
|
||||
{
|
||||
uint n = 1 + rand() % 100;
|
||||
uint n = 1 + rani (100);
|
||||
do numberz.push_back(i);
|
||||
while (--n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ namespace test{
|
|||
void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
verify_trojanLambda();
|
||||
verify_inlineStorage();
|
||||
verify_TargetRelocation();
|
||||
|
|
@ -91,7 +93,7 @@ namespace test{
|
|||
using Sig = size_t(uint);
|
||||
CHECK (isFunMember<Sig> (&fun));
|
||||
|
||||
beacon = rand();
|
||||
beacon = rani();
|
||||
uint c = beacon % 42;
|
||||
// verify we can invoke the target function
|
||||
CHECK (beacon+c == fun(c));
|
||||
|
|
@ -130,7 +132,7 @@ namespace test{
|
|||
|
||||
// repeat same with a copy, and changed beacon value
|
||||
auto trojanClone = trojanLambda;
|
||||
beacon = rand();
|
||||
beacon = rani();
|
||||
c = beacon % 55;
|
||||
CHECK (beacon+c == trojanClone(c));
|
||||
CHECK (location == &trojanClone);
|
||||
|
|
@ -193,8 +195,8 @@ namespace test{
|
|||
{
|
||||
struct Nested
|
||||
{
|
||||
int unrelated{rand()};
|
||||
int anchor{rand()};
|
||||
int unrelated{rani()};
|
||||
int anchor{rani()};
|
||||
};
|
||||
struct Demo
|
||||
{
|
||||
|
|
@ -262,7 +264,7 @@ namespace test{
|
|||
CHECK (0 == report);
|
||||
|
||||
// invoke function
|
||||
int feed{1+rand()%100};
|
||||
int feed{1 + rani (100)};
|
||||
float res = theFun (feed);
|
||||
|
||||
// delegate *and* realFun were invoked
|
||||
|
|
@ -271,7 +273,7 @@ namespace test{
|
|||
|
||||
// again...
|
||||
report = 0;
|
||||
feed = -1-rand()%20;
|
||||
feed = -1-rani(20);
|
||||
res = theFun (feed);
|
||||
|
||||
// this time the delegate was *not* invoked,
|
||||
|
|
@ -307,7 +309,7 @@ namespace test{
|
|||
CHECK (not init);
|
||||
CHECK (funny);
|
||||
|
||||
int feed = 1 + rand()%99;
|
||||
int feed = 1 + rani(99);
|
||||
CHECK (feed*0.555f == funny(feed));
|
||||
CHECK (1 == invoked);
|
||||
CHECK (init);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -44,7 +43,6 @@ namespace meta {
|
|||
namespace test {
|
||||
|
||||
using std::move;
|
||||
using std::rand;
|
||||
using std::tuple;
|
||||
using std::string;
|
||||
using lib::meta::dump;
|
||||
|
|
@ -68,6 +66,7 @@ namespace test {
|
|||
void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
demonstrateUsage();
|
||||
verify_forwarding();
|
||||
verify_cornerCases();
|
||||
|
|
@ -84,7 +83,7 @@ namespace test {
|
|||
void
|
||||
demonstrateUsage()
|
||||
{
|
||||
uint randomLimit = 2 + rand() % 98;
|
||||
uint randomLimit = 2 + rani(98);
|
||||
|
||||
auto plannedArgs
|
||||
= tuple{InstancePlaceholder<LateBindInstance_test>{}
|
||||
|
|
@ -104,7 +103,7 @@ namespace test {
|
|||
uint
|
||||
theMember (uint limit)
|
||||
{
|
||||
return rand() % limit;
|
||||
return rani (limit);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace test {
|
|||
uint i_;
|
||||
static int instanceCnt;
|
||||
|
||||
N (uint x = rand() % (abs(n)+1))
|
||||
N (uint x = rani(1 + abs(n)))
|
||||
: i_{x}
|
||||
{
|
||||
++instanceCnt;
|
||||
|
|
@ -136,6 +136,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_fixture();
|
||||
check_pickArg ();
|
||||
check_pickInit();
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace test {
|
|||
}
|
||||
Sub()
|
||||
{
|
||||
access() = 'A' + rand() % 23;
|
||||
access() = 'A' + rani(23);
|
||||
_CheckSum_ += access();
|
||||
}
|
||||
Sub (Sub const& osub)
|
||||
|
|
@ -253,6 +253,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
CHECK(0 == _CheckSum_);
|
||||
|
||||
verify_TestFixture();
|
||||
|
|
|
|||
|
|
@ -31,15 +31,11 @@
|
|||
#include "lib/null-value.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
using util::isSameObject;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace { // test data and helpers...
|
||||
|
||||
|
|
@ -52,7 +48,7 @@ namespace test{
|
|||
uint id_;
|
||||
|
||||
DummyType()
|
||||
: id_(1 + (rand() % 100))
|
||||
: id_(1 + rani(100))
|
||||
{
|
||||
created = true;
|
||||
}
|
||||
|
|
@ -78,6 +74,7 @@ namespace test{
|
|||
void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
CHECK (long() == NullValue<long>::get());
|
||||
CHECK (short() == NullValue<short>::get());
|
||||
CHECK (isSameObject(NullValue<short>::get(), NullValue<short>::get()));
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace test{
|
|||
virtual long
|
||||
apiFunc()
|
||||
{
|
||||
long rr = ii * (1 + rand() % MAX_RAND);
|
||||
long rr = ii * (1 + rani(MAX_RAND));
|
||||
mark (rr);
|
||||
_callSum += rr;
|
||||
return rr;
|
||||
|
|
@ -180,6 +180,7 @@ namespace test{
|
|||
_checkSum = 0;
|
||||
_callSum = 0;
|
||||
_created = 0;
|
||||
seedRand();
|
||||
|
||||
verifyBasics();
|
||||
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ namespace test {
|
|||
array<uint64_t, 1000> numz;
|
||||
for (auto& n : numz)
|
||||
{
|
||||
n = rand() * uint64_t(1 << 31);
|
||||
n = rani() * uint64_t(1 << 31);
|
||||
CHECK (ilog2(n) == floatLog(n));
|
||||
CHECK (ilog2(n) == bitshift(n));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,11 @@
|
|||
|
||||
using ::test::Test;
|
||||
using std::vector;
|
||||
using std::rand;
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
|
||||
namespace { // test types
|
||||
|
||||
struct I
|
||||
|
|
@ -118,6 +116,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
checkWrapper();
|
||||
checkVector();
|
||||
checkTable();
|
||||
|
|
@ -216,7 +216,7 @@ namespace test{
|
|||
for (uint i=0; i<500; ++i)
|
||||
{
|
||||
Sub3::sum = 0;
|
||||
Sub3::trigger = (rand() % 50); // when hitting the trigger Sub3 throws
|
||||
Sub3::trigger = rani(50); // when hitting the trigger Sub3 throws
|
||||
try
|
||||
{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ namespace test{
|
|||
using time::Time;
|
||||
using time::Duration;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
using std::swap;
|
||||
|
||||
|
||||
|
|
@ -57,10 +56,10 @@ namespace test{
|
|||
{
|
||||
uint i_;
|
||||
|
||||
Tracker() : i_(rand() % 500) { ++cntTracker; }
|
||||
Tracker(Tracker const& ot) : i_(ot.i_) { ++cntTracker; }
|
||||
Tracker(uint i) : i_(i) { ++cntTracker; }
|
||||
~Tracker() { --cntTracker; }
|
||||
Tracker() : i_(rani(500)) { ++cntTracker; }
|
||||
Tracker(Tracker const& ot) : i_(ot.i_) { ++cntTracker; }
|
||||
Tracker(uint i) : i_(i) { ++cntTracker; }
|
||||
~Tracker() { --cntTracker; }
|
||||
};
|
||||
|
||||
struct NonAssign
|
||||
|
|
@ -101,8 +100,9 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
ulong l1 (1 + rand() % 1000);
|
||||
ulong l2 (1 + rand() % 1000);
|
||||
seedRand();
|
||||
ulong l1 (1 + rani(1000));
|
||||
ulong l2 (1 + rani(1000));
|
||||
string s1 (randStr(50));
|
||||
string s2 (randStr(50));
|
||||
const char* cp (s1.c_str());
|
||||
|
|
@ -239,7 +239,7 @@ namespace test{
|
|||
{
|
||||
struct Wrap
|
||||
{
|
||||
int i = -10 + rand() % 21;
|
||||
int i = -10 + rani(21);
|
||||
};
|
||||
|
||||
ReplaceableItem<Wrap> w1 =Wrap{},
|
||||
|
|
@ -268,7 +268,7 @@ namespace test{
|
|||
{
|
||||
struct Cagey
|
||||
{
|
||||
int i = -10 + rand() % 21;
|
||||
int i = -10 + rani(21);
|
||||
|
||||
Cagey(Cagey && privy)
|
||||
: i(55)
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@
|
|||
#include "lib/scoped-collection.hpp"
|
||||
#include "lib/test/tracking-dummy.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
|
@ -109,6 +107,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
simpleUsage();
|
||||
building_RAII_Style();
|
||||
building_StackStyle();
|
||||
|
|
@ -229,7 +228,7 @@ namespace test{
|
|||
CHECK (0 == Dummy::checksum());
|
||||
{
|
||||
|
||||
int rr = rand() % 100;
|
||||
int rr = rani(100);
|
||||
|
||||
CollD coll(3);
|
||||
CHECK (0 == coll.size());
|
||||
|
|
@ -308,7 +307,7 @@ namespace test{
|
|||
{
|
||||
CHECK (0 == Dummy::checksum());
|
||||
{
|
||||
int rr = rand() % 100;
|
||||
int rr = rani(100);
|
||||
int trigger = 100 + 5 + 1; // prevents the bomb from exploding (since rr < 100)
|
||||
|
||||
CollD coll (6, Populator(rr, trigger));
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
using ::test::Test;
|
||||
using std::array;
|
||||
using std::rand;
|
||||
|
||||
using lib::explore;
|
||||
using util::isSameObject;
|
||||
|
|
@ -125,7 +124,7 @@ namespace test{
|
|||
{
|
||||
int16_t val;
|
||||
|
||||
ShortBlocker (short r = 1 + (rand() % 1'000))
|
||||
ShortBlocker (short r = 1 + rani(1'000))
|
||||
: val(r)
|
||||
{ };
|
||||
};
|
||||
|
|
@ -152,6 +151,8 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUsage();
|
||||
check_Builder();
|
||||
check_ErrorHandling();
|
||||
|
|
|
|||
|
|
@ -29,17 +29,14 @@
|
|||
#include "lib/simple-allocator.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
|
||||
using util::isSameObject;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
|
||||
|
||||
|
||||
|
|
@ -60,7 +57,7 @@ namespace test{
|
|||
{
|
||||
REQUIRE (siz);
|
||||
for (uint i=0; i<siz; ++i)
|
||||
checksum_ += (crap_[i] = rand() % 128);
|
||||
checksum_ += (crap_[i] = rani(128));
|
||||
}
|
||||
|
||||
DummyObj (DummyObj const& o)
|
||||
|
|
@ -102,6 +99,7 @@ namespace test{
|
|||
run (Arg)
|
||||
{
|
||||
CHECK (0 == checksum_);
|
||||
seedRand();
|
||||
|
||||
TestAllocator allocator;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
checkHashFunction();
|
||||
|
||||
HTable table;
|
||||
|
|
@ -114,10 +115,10 @@ namespace test{
|
|||
copy1[5] = '\0'; // truncate the c-String to 5 chars
|
||||
|
||||
string copy2(random);
|
||||
copy2[rand() % STRING_MAX_RELEVANT] = '*'; // modify a random position
|
||||
copy2[rani (STRING_MAX_RELEVANT)] = '*'; // modify a random position
|
||||
|
||||
string copy3(copy2);
|
||||
copy3[STRING_MAX_RELEVANT] = '*'; // modify behind observation limit
|
||||
copy3[STRING_MAX_RELEVANT] = '*'; // modify behind observation limit
|
||||
|
||||
Symbol l0;
|
||||
Literal l51 (copy1.c_str());
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace test{
|
|||
uint
|
||||
createVal() ///< generating test values, remembering the control sum
|
||||
{
|
||||
uint val{rand() % MAX_RAND_SUMMAND};
|
||||
uint val = rani (MAX_RAND_SUMMAND);
|
||||
control_sum_ += val;
|
||||
return val;
|
||||
}
|
||||
|
|
@ -111,6 +111,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
CHECK (can_calc_without_Error<NonrecursiveLock_NoWait>());
|
||||
CHECK (can_calc_without_Error<RecursiveLock_NoWait>());
|
||||
CHECK (not can_calc_without_Error<sync::NoLocking>());
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
SyncOnBool token;
|
||||
|
||||
ThreadJoinable ping ("SyncWaiting ping", [&]{ token.getIt(); });
|
||||
|
|
@ -105,7 +106,7 @@ namespace test{
|
|||
sleep_for (100ms); // if the threads don't block correctly, they've missed their chance by now...
|
||||
|
||||
// kick off the notification cascade...
|
||||
uint val = (rand() % 1000);
|
||||
uint val = rani(1000);
|
||||
token.provide (val);
|
||||
|
||||
// wait for the two Threads to finish their handshake
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUse();
|
||||
returnValue();
|
||||
detectFailure();
|
||||
|
|
@ -100,7 +102,7 @@ namespace test {
|
|||
void
|
||||
returnValue()
|
||||
{
|
||||
int mySecret = rand() % 1000;
|
||||
int mySecret = rani(1000);
|
||||
|
||||
ThreadJoinable theThread{"test join-2"
|
||||
,&ThreadWrapperJoin_test::theAction
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
demonstrateSimpleUsage();
|
||||
verifyConcurrentExecution();
|
||||
}
|
||||
|
|
@ -122,7 +123,7 @@ namespace test{
|
|||
{
|
||||
for (uint i=1; i<=NUM_THREADS; ++i)
|
||||
{
|
||||
uint x = rand() % 1000;
|
||||
uint x = rani(1000);
|
||||
globalSum += (i + x);
|
||||
threads.emplace (&TestThread::doIt, i, x);
|
||||
} // Note: bind to member function, copying arguments
|
||||
|
|
|
|||
|
|
@ -29,18 +29,14 @@
|
|||
#include "lib/typed-allocation-manager.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
|
||||
#include <memory>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
|
||||
using util::isSameObject;
|
||||
using std::shared_ptr;
|
||||
using std::rand;
|
||||
|
||||
|
||||
|
||||
|
|
@ -61,7 +57,7 @@ namespace test{
|
|||
{
|
||||
REQUIRE (siz);
|
||||
for (uint i=0; i<siz; ++i)
|
||||
checksum_ += (crap_[i] = rand() % 128);
|
||||
checksum_ += (crap_[i] = rani(128));
|
||||
}
|
||||
|
||||
~DummyObj()
|
||||
|
|
@ -91,6 +87,7 @@ namespace test{
|
|||
run (Arg)
|
||||
{
|
||||
CHECK (0 == checksum_);
|
||||
seedRand();
|
||||
|
||||
TypedAllocationManager allocator;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include <vector>
|
||||
|
||||
using ::Test;
|
||||
using std::rand;
|
||||
using util::isnil;
|
||||
using util::_Fmt;
|
||||
|
||||
|
|
@ -60,8 +59,8 @@ namespace test {
|
|||
VecI data;
|
||||
for (uint i=0; i<cnt; ++i)
|
||||
{
|
||||
int someNumber (rand() % (2*NUMBER_LIMIT) -NUMBER_LIMIT);
|
||||
if (!someNumber) someNumber -=(1 +rand() % NUMBER_LIMIT);
|
||||
int someNumber { rani (2*NUMBER_LIMIT) - NUMBER_LIMIT};
|
||||
if (!someNumber) someNumber -= 1 + rani (NUMBER_LIMIT);
|
||||
|
||||
data.push_back (someNumber);
|
||||
}
|
||||
|
|
@ -116,6 +115,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
verifyBehaviour ();
|
||||
|
||||
verifyIntegerTypes<int>();
|
||||
|
|
|
|||
|
|
@ -33,11 +33,9 @@
|
|||
#include "lib/variant.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
|
|
@ -78,6 +76,7 @@ namespace test{
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
createVariant();
|
||||
accessVariant();
|
||||
acceptPredicate();
|
||||
|
|
@ -123,7 +122,7 @@ namespace test{
|
|||
void
|
||||
accessVariant()
|
||||
{
|
||||
int someVal = rand() % 10000;
|
||||
int someVal = rani(10000);
|
||||
string someStr = randStr(55);
|
||||
Time someTime = randTime();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
#include "lib/scoped-holder-transfer.hpp"
|
||||
#include "lib/test/tracking-dummy.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
|
@ -40,7 +40,6 @@ namespace test {
|
|||
|
||||
using ::Test;
|
||||
using std::vector;
|
||||
using std::cout;
|
||||
|
||||
namespace { // extending the Dummy for our special purpose....
|
||||
|
||||
|
|
@ -84,7 +83,7 @@ namespace test {
|
|||
void
|
||||
setup (int x=0)
|
||||
{
|
||||
setVal (x? x : (rand() % 10000));
|
||||
setVal (x? x : rani (10000));
|
||||
TRACE (test, "CREATE val=%d ---> this=%p", getVal(),this);
|
||||
}
|
||||
|
||||
|
|
@ -131,6 +130,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
cout << "\n..setup table space for 2 elements\n";
|
||||
TransDummyVector table;
|
||||
table.reserve(2);
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
verify_mockManipulation();
|
||||
invokeCommand();
|
||||
markState();
|
||||
|
|
@ -327,7 +329,7 @@ namespace test {
|
|||
MockElm mock("uiElm");
|
||||
|
||||
int prevState = dummyState;
|
||||
int concreteParam = 1 +rand() % 100;
|
||||
int concreteParam = 1 + rani(100);
|
||||
|
||||
// on bus no traces from this command yet...
|
||||
CHECK (nexusLog.ensureNot(string(DUMMY_CMD_ID)));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace test {
|
|||
|
||||
struct DummyWidget
|
||||
{
|
||||
int i = rand(); // "identity"
|
||||
int i = rani(); // "identity"
|
||||
|
||||
friend bool
|
||||
operator== (DummyWidget const& wa, DummyWidget const& wb)
|
||||
|
|
@ -180,6 +180,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
attach2canvas();
|
||||
relocateWidget();
|
||||
}
|
||||
|
|
@ -219,12 +220,12 @@ namespace test {
|
|||
void
|
||||
relocateWidget()
|
||||
{
|
||||
int x1 = rand() % 100;
|
||||
int y1 = rand() % 100;
|
||||
int x2 = rand() % 100;
|
||||
int y2 = rand() % 100;
|
||||
int x3 = rand() % 100;
|
||||
int y3 = rand() % 100;
|
||||
int x1 = rani (100);
|
||||
int y1 = rani (100);
|
||||
int x2 = rani (100);
|
||||
int y2 = rani (100);
|
||||
int x3 = rani (100);
|
||||
int y3 = rani (100);
|
||||
|
||||
FakeCanvas canvas;
|
||||
HookedWidget w1{canvas.hookedAt(x1,y1)};
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace test {
|
|||
|
||||
struct DummyWidget
|
||||
{
|
||||
int i = rand(); // "identity"
|
||||
int i = rani(); // "identity"
|
||||
|
||||
friend bool
|
||||
operator== (DummyWidget const& wa, DummyWidget const& wb)
|
||||
|
|
@ -167,6 +167,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_standardUsage();
|
||||
verify_multiplicity();
|
||||
reOrderHooked();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace test {
|
|||
struct DummyWidget
|
||||
: public sigc::trackable
|
||||
{
|
||||
X val = 1 + rand() % 100;
|
||||
X val = 1 + rani(100);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +67,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
verify_standardUsage();
|
||||
verify_reconnect();
|
||||
verify_copy();
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUsage();
|
||||
|
||||
verifyMockInvocation();
|
||||
|
|
@ -101,7 +103,7 @@ namespace test {
|
|||
{
|
||||
ActivityDetector detector;
|
||||
auto fun = detector.buildDiagnosticFun<void(uint)> ("funny");
|
||||
uint rnd = rand() % 10000;
|
||||
uint rnd = rani(10000);
|
||||
|
||||
detector.incrementSeq();
|
||||
CHECK (1 == detector.currSeq());
|
||||
|
|
@ -147,7 +149,7 @@ namespace test {
|
|||
{
|
||||
ActivityDetector detector;
|
||||
auto fun = detector.buildDiagnosticFun<int(uint)> ("fakeFun");
|
||||
uint rnd = rand() % 10000;
|
||||
uint rnd = rani(10000);
|
||||
|
||||
CHECK (0 == fun (rnd));
|
||||
|
||||
|
|
@ -219,7 +221,7 @@ namespace test {
|
|||
|
||||
Time t = randTime();
|
||||
Time td{t+Time(0,1)};
|
||||
size_t x = rand();
|
||||
size_t x = rani();
|
||||
Activity a;
|
||||
|
||||
CHECK (detector.ensureNoInvocation(CTX_WORK));
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@
|
|||
#include "lib/meta/function.hpp"
|
||||
#include "lib/wrapper.hpp"
|
||||
#include "lib/format-util.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
|
@ -104,6 +105,7 @@ namespace test {
|
|||
using lib::meta::RebindVariadic;
|
||||
using util::unConst;
|
||||
using util::isnil;
|
||||
using lib::rani;
|
||||
using std::forward;
|
||||
using std::move;
|
||||
|
||||
|
|
@ -531,7 +533,7 @@ namespace test {
|
|||
Job
|
||||
buildMockJob (string id =""
|
||||
,Time nominal = lib::test::randTime()
|
||||
,size_t extra = rand())
|
||||
,size_t extra = rani())
|
||||
{
|
||||
InvocationInstanceID invoKey;
|
||||
invoKey.part.a = extra;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
simpleUsage();
|
||||
handleEpoch();
|
||||
placeActivity();
|
||||
|
|
@ -425,7 +426,7 @@ namespace test {
|
|||
const size_t MIN_DEAD = _raw(BASE_DEADLINE) - _raw(SPREAD_DEAD);
|
||||
|
||||
auto&[t,r] = testData[i];
|
||||
r = rand() % SPREAD;
|
||||
r = rani (SPREAD);
|
||||
t = TimeValue(i*STP + MIN_DEAD + r);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
|
||||
simpleUsage();
|
||||
|
||||
verifyActivity_Post();
|
||||
|
|
@ -140,7 +142,7 @@ namespace test {
|
|||
{
|
||||
ActivityDetector detector;
|
||||
|
||||
uint64_t x1=rand(), x2=rand();
|
||||
uint64_t x1=rani(), x2=rani();
|
||||
Time nomTime = lib::test::randTime();
|
||||
Activity feed{x1,x2};
|
||||
Activity feed2{x1+1,x1+2};
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
demonstrateSimpleUsage();
|
||||
verify_GroomingToken();
|
||||
verify_GroomingGuard();
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
simpleUsage();
|
||||
verify_StartStop();
|
||||
verify_LoadFactor();
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
smokeTest();
|
||||
setup_systematicSchedule();
|
||||
verify_instrumentation();
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@
|
|||
#include "lib/gnuplot-gen.hpp"
|
||||
#include "lib/stat/statistic.hpp"
|
||||
#include "lib/stat/data.hpp"
|
||||
#include "lib/random.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -529,7 +530,7 @@ namespace test {
|
|||
Param minP{upper}, maxP{lower};
|
||||
for (uint i=0; i<cnt; ++i)
|
||||
{
|
||||
auto random = double(rand())/RAND_MAX;
|
||||
auto random = lib::defaultGen.uni(); // [0 .. 1.0[
|
||||
Param pos = lower + Param(floor (random*dist + 0.5));
|
||||
points.push_back(pos);
|
||||
minP = min (pos, minP);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
usageExample();
|
||||
verify_Node();
|
||||
verify_Topology();
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ namespace test {
|
|||
* @note does not propagate seed to consecutive start nodes
|
||||
*/
|
||||
TestChainLoad&&
|
||||
setSeed (size_t seed = rand())
|
||||
setSeed (size_t seed = rani())
|
||||
{
|
||||
frontNode()->hash = seed;
|
||||
return move(*this);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ namespace test {
|
|||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
seedRand();
|
||||
simpleUsage();
|
||||
use_and_drop();
|
||||
iteration();
|
||||
|
|
@ -78,7 +79,7 @@ namespace test {
|
|||
Extent& extent = *extents.begin();
|
||||
CHECK (10 == extent.size());
|
||||
|
||||
int num = rand() % 1000;
|
||||
int num = rani(1000);
|
||||
extent[2] = num;
|
||||
extent[5] = num+5;
|
||||
CHECK (num == extent[2]);
|
||||
|
|
|
|||
|
|
@ -16105,9 +16105,7 @@
|
|||
</node>
|
||||
<node CREATED="1523224898647" ID="ID_1600596253" MODIFIED="1576282358107" TEXT="zwei nicht-kongruente Fälle">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<ul>
|
||||
<li>
|
||||
|
|
@ -16856,9 +16854,7 @@
|
|||
<node CREATED="1485457325724" ID="ID_1954589768" MODIFIED="1557498707221" TEXT="nur für die Hauptfenster zuständig"/>
|
||||
<node CREATED="1485457328043" ID="ID_1787642462" MODIFIED="1576282358104" TEXT="wir haben kein ApplicationWindow">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...denn das ist das vereinfachte Setup für "einfache" Applikationen
|
||||
|
|
@ -17291,9 +17287,7 @@
|
|||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<node COLOR="#338800" CREATED="1678459444870" ID="ID_546190730" MODIFIED="1678459579081" TEXT="UI-top-Level wird direkt verdrahtet">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...d.h. „konventionell“, per ctor-Parameter
|
||||
|
|
@ -17824,9 +17818,7 @@
|
|||
<node CREATED="1664546823853" ID="ID_1235252109" MODIFIED="1664546831232" TEXT="dann verdrahtet mit Tangible"/>
|
||||
<node CREATED="1664546831980" ID="ID_1813900014" MODIFIED="1664547929394">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
das <i>verdrängt lediglich </i>das Kontext-Menü
|
||||
|
|
@ -18988,9 +18980,7 @@
|
|||
</node>
|
||||
<node COLOR="#33565a" CREATED="1664725557464" ID="ID_827509447" MODIFIED="1664727540443" TEXT="reduce(Menu)? ⟹ ▣">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
BEDINGUNG: ΔMenu > goal
|
||||
|
|
@ -46330,9 +46320,7 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1523019770144" ID="ID_253563802" MODIFIED="1557498707235">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
(GlobalCtx)-><b>WindowLocator</b>
|
||||
|
|
@ -46714,9 +46702,7 @@
|
|||
<node CREATED="1455236781242" ID="ID_674694140" MODIFIED="1518487921086" TEXT="könnte interessant sein für Diff"/>
|
||||
<node CREATED="1455236788424" ID="ID_1507269502" MODIFIED="1576282358013" TEXT="aber gegen das Grundkonzept">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
ich wollte explizit kein generisch-introspektives UI,
|
||||
|
|
@ -47097,9 +47083,7 @@
|
|||
<node CREATED="1455421549347" ID="ID_744479545" MODIFIED="1518487921086" TEXT="separates UI-Bus API"/>
|
||||
<node CREATED="1455421557026" ID="ID_655863988" MODIFIED="1576282358010">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
nach Broadcast von "reset"
|
||||
|
|
@ -47433,9 +47417,7 @@
|
|||
</node>
|
||||
<node CREATED="1455843336405" ID="ID_1210482014" MODIFIED="1561827465436">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
Nein
|
||||
|
|
@ -47696,9 +47678,7 @@
|
|||
</node>
|
||||
<node CREATED="1470772440180" ID="ID_1241607377" MODIFIED="1575133326608" TEXT="can not match by itself">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
...because it is also used to discard garbage after a findSrc operation.
|
||||
|
|
@ -57426,7 +57406,14 @@
|
|||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1731424690509" ID="ID_1222355432" MODIFIED="1731424715317" TEXT="test::randStr()"/>
|
||||
<node CREATED="1731424716055" ID="ID_1693891146" MODIFIED="1731431008272" TEXT="test::randTime()"/>
|
||||
<node CREATED="1731424784952" ID="ID_1485935359" MODIFIED="1731424795595" TEXT="woot! luid.c verwendet rand()"/>
|
||||
<node COLOR="#435e98" CREATED="1731424784952" ID="ID_1485935359" MODIFIED="1731448398180" TEXT="woot?? luid.c verwendet rand()">
|
||||
<node CREATED="1731448399723" ID="ID_347282012" MODIFIED="1731448411213" TEXT="als fall-back falls es kein /dev/urandom gibt"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1731451280474" ID="ID_33616926" MODIFIED="1731451303904" TEXT="#1381configurable entropy source for LUID">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1731451314230" ID="ID_1025715147" MODIFIED="1731451318247" TEXT="das sollte ein Service sein"/>
|
||||
<node CREATED="1731451318519" ID="ID_777978116" MODIFIED="1731451332335" TEXT="und nicht irgendwo clever in einer LIbrary-Funktion versteckt"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1731424872438" ID="ID_512461088" MODIFIED="1731424875680" TEXT="Bereiche">
|
||||
<node CREATED="1731424876772" ID="ID_1889708776" MODIFIED="1731424890390" TEXT="[0 .. 1000 [">
|
||||
<node CREATED="1731425385582" ID="ID_1130852617" MODIFIED="1731425389674" TEXT="auch 10"/>
|
||||
|
|
@ -57518,11 +57505,119 @@
|
|||
<node COLOR="#338800" CREATED="1731434516153" ID="ID_1079673401" MODIFIED="1731447064585" TEXT="bestehende Verwendungen anpassen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1731434530901" ID="ID_81651492" MODIFIED="1731434633527" TEXT="rand() ablösen in Core">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1731434530901" ID="ID_81651492" MODIFIED="1731466843461" TEXT="rand() ablösen in Core">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1731434548714" ID="ID_1401652131" MODIFIED="1731434633527" TEXT="rand() % MAX ablösen in Tests">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1731434548714" ID="ID_1401652131" MODIFIED="1731466845015" TEXT="rand() % MAX ablösen in Tests">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fafe99" COLOR="#fa002a" CREATED="1731466845496" ID="ID_108595980" MODIFIED="1731466860399" TEXT="Tests scheitern nach Umstellung">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
<node CREATED="1731466868785" ID="ID_1204988400" MODIFIED="1731466887399" TEXT="Rational_test">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
0000000515: CHECK: rational-test.cpp:90: thread_1: demonstrate_basics: (util::toString(23_r/55) == "23/55sec")
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1731466941465" ID="ID_1180140959" MODIFIED="1731467103523" TEXT="SchedulerCommutator_test">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
<font size="1">0000000514: INFO: suite.cpp:202: thread_1: invokeTestCase: ++------------------- invoking TEST: vault::gear::test::SchedulerCommutator_test </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">0000000515: NOTICE: suite.cpp:118: thread_1: getSeed:      ++>>> SEED(rand) <<<: 12483615036814281831 </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">0000000598: UNIMPLEMENTED: scheduler-commutator.hpp:204: thread_1: findWork: how to trigger a Scheduler-Emergency from here </font>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1731466991636" ID="ID_1891507132" MODIFIED="1731467127501" TEXT="SchedulerStress_test">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
<font size="1">TEST Scheduler Performance: SchedulerStress_test .. FAILED </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">unexpected return value 152, expected 0 </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">stderr was: </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">0000000514: INFO: suite.cpp:202: thread_1: invokeTestCase: ++------------------- invoking TEST: vault::gear::test::SchedulerStress_test </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">0000000515: NOTICE: suite.cpp:118: thread_1: getSeed:      ++>>> SEED(rand) <<<: 401457506165208591 </font>
|
||||
</p>
|
||||
<p>
|
||||
<font size="1">END </font>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1731467207226" ID="ID_977237610" MODIFIED="1731467207226" TEXT="TrackingHeapBlockProvider_test">
|
||||
<node CREATED="1731467220749" ID="ID_1574698883" MODIFIED="1731467357686" TEXT="ASSERTION">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
0000000516: PRECONDITION: tracking-heap-block-provider.cpp:281: thread_1: detachBuffer: (util::isSameObject(storage, block4buffer->accessMemory()))
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<linktarget COLOR="#73384b" DESTINATION="ID_1574698883" ENDARROW="Default" ENDINCLINATION="-9;41;" ID="Arrow_ID_986253090" SOURCE="ID_844778131" STARTARROW="None" STARTINCLINATION="30;3;"/>
|
||||
<linktarget COLOR="#73384b" DESTINATION="ID_1574698883" ENDARROW="Default" ENDINCLINATION="-9;41;" ID="Arrow_ID_1250752825" SOURCE="ID_74232375" STARTARROW="None" STARTINCLINATION="34;4;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1731467215176" ID="ID_844778131" MODIFIED="1731467314156" TEXT="BufferProviderProtocol_test">
|
||||
<arrowlink COLOR="#73384b" DESTINATION="ID_1574698883" ENDARROW="Default" ENDINCLINATION="-9;41;" ID="Arrow_ID_986253090" STARTARROW="None" STARTINCLINATION="30;3;"/>
|
||||
</node>
|
||||
<node CREATED="1731467215176" ID="ID_74232375" MODIFIED="1731467357686" TEXT="OutputSlotProtocol_test">
|
||||
<arrowlink COLOR="#73384b" DESTINATION="ID_1574698883" ENDARROW="Default" ENDINCLINATION="-9;41;" ID="Arrow_ID_1250752825" STARTARROW="None" STARTINCLINATION="34;4;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1731455444796" ID="ID_784243083" MODIFIED="1731455723202" TEXT="Concurrent Tests umstellen">
|
||||
<icon BUILTIN="bell"/>
|
||||
<node CREATED="1731455475587" ID="ID_1622000187" MODIFIED="1731455475587" TEXT="CallQueue_test"/>
|
||||
<node CREATED="1731455716786" ID="ID_943344715" MODIFIED="1731455716786" TEXT="DiagnosticContext_test"/>
|
||||
<node CREATED="1731458234804" ID="ID_1185469440" MODIFIED="1731458234804" TEXT="SessionCommandFunction_test"/>
|
||||
<node CREATED="1731461928260" ID="ID_396786983" MODIFIED="1731461928260" TEXT="IncidenceCount_test"/>
|
||||
<node CREATED="1731464404973" ID="ID_1534599775" MODIFIED="1731464404973" TEXT="SyncBarrier_test"/>
|
||||
<node CREATED="1731464450346" ID="ID_1959292193" MODIFIED="1731464450346" TEXT="SyncClasslock_test"/>
|
||||
<node COLOR="#5b280f" CREATED="1731464565589" ID="ID_864840738" MODIFIED="1731464568650" TEXT="SyncLocking_test">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node COLOR="#435e98" CREATED="1731464569588" HGAP="21" ID="ID_473912166" MODIFIED="1731464596488" TEXT="nein: der ist sauber" VSHIFT="1">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head/>
|
||||
<body>
|
||||
<p>
|
||||
erzeugt die zufälligen Summanden vorher im Haupt-Thread
|
||||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1731464938112" ID="ID_1716753475" MODIFIED="1731465014240" TEXT="ebenso...">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1731464931774" ID="ID_1756220645" MODIFIED="1731464933696" TEXT="SyncWaiting_test"/>
|
||||
<node CREATED="1731465003821" ID="ID_1279056588" MODIFIED="1731465007415" TEXT="ThreadWrapper_test"/>
|
||||
<node CREATED="1731464903922" ID="ID_349618800" MODIFIED="1731464903922" TEXT="ThreadWrapperJoin_test"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1731465663005" MODIFIED="1731465663005" TEXT="BusTerm_test"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue