29 using namespace basis;
38 #define LOG(to_print) EMERGENCY_LOG(program_wide_logger().get(), astring(to_print))
43 test_sequence_tracker() {}
45 virtual int execute();
48 int test_sequence_tracker::execute()
52 abyte arb1[] = { 127, 0, 0, 1 };
53 abyte arb2[] = { 192, 168, 0, 1 };
54 abyte arb3[] = { 28, 42, 56, 253 };
66 int seq = starter +
randomizer().inclusive(1, 129);
68 chevy.add_pair(eep, seq);
75 int seq = starter +
randomizer().inclusive(1, 129);
77 chevy.add_pair(op, seq);
84 int seq = starter +
randomizer().inclusive(1, 129);
86 chevy.add_pair(ork, seq);
90 for (i = 0; i < eep_set.
elements(); i++) {
92 if (!chevy.have_seen(eep, seq)) {
93 log(
a_sprintf(
"missing sequence is %d", seq));
94 log(chevy.text_form(
true));
95 deadly_error(
"test_sequence_tracker",
"eep check",
"missing sequence");
98 for (i = 0; i < op_set.
elements(); i++) {
100 if (!chevy.have_seen(op, seq)) {
101 log(
a_sprintf(
"missing sequence is %d", seq));
102 log(chevy.text_form(
true));
103 deadly_error(
"test_sequence_tracker",
"op check",
"missing sequence");
106 for (i = 0; i < ork_set.
elements(); i++) {
107 int seq = ork_set[i];
108 if (!chevy.have_seen(ork, seq)) {
109 log(
a_sprintf(
"missing sequence is %d", seq));
110 log(chevy.text_form(
true));
111 deadly_error(
"test_sequence_tracker",
"ork check",
"missing sequence");
115 return final_report();
The application_shell is a base object for console programs.
a_sprintf is a specialization of astring that provides printf style support.
A very common template for a dynamic array of bytes.
this will keep track of sequencing for a communication process on a per host basis.
A simple object that wraps a templated set of ints.
int elements() const
Returns the number of elements in this set.
#define deadly_error(c, f, i)
#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.
unsigned char abyte
A fairly important unit which is seldom defined...
const int MINUTE_ms
Number of milliseconds in a minute.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
Provides access to the operating system's socket methods.
A dynamic container class that holds any kind of object via pointers.
Useful support functions for unit testing, especially within hoople.