34#define MAX_RANDOM_BINS 40
35#define MAX_TEST_CYCLES 10008
36#define AVG_EXPECTED_PER_BIN (double(MAX_TEST_CYCLES) / double(MAX_RANDOM_BINS))
37#define VARIATION_ALLOWED (AVG_EXPECTED_PER_BIN * 0.1)
38#define ANOMALIES_ALLOWED (MAX_RANDOM_BINS / 4)
40#define LOG(to_print) EMERGENCY_LOG(program_wide_logger::get(), astring(to_print))
50int test_chaos::execute()
54 LOG(
a_sprintf(
"average expected=%f, variation allowed=%f",
65 "exclusive test should not go out of bounds");
71 "inclusive test should not go out of bounds");
73 results[res - base]++;
78 int failed_any =
false;
89 if (!failed_any)
LOG(
"None")
94 "probability anomalies should be less than the allowed number");
95 return final_report();
The application_shell is a base object for console programs.
virtual int execute()=0
< retrieves the command line from the /proc hierarchy on linux.
application_shell()
constructs an application_shell to serve as the root of the program.
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
a platform-independent way to acquire random numbers in a specific range.
int exclusive(int low, int high) const
< Returns a pseudo-random number r, such that "low" < r < "high".
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
type absolute_value(type a)
Returns a if a is non-negative, and returns -a otherwise.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
A dynamic container class that holds any kind of object via pointers.
Useful support functions for unit testing, especially within hoople.
#define ANOMALIES_ALLOWED
#define AVG_EXPECTED_PER_BIN
#define VARIATION_ALLOWED
#define ASSERT_FALSE(a, test_name)