42 using namespace basis;
51 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
62 virtual int execute();
65 int test_entity::execute()
75 "the blank entity was not seen as empty.");
79 "the non-blank entity was seen as empty.");
90 if (blank_ent != filled_ent)
92 "failed to resolve to same id");
93 astring text1 = filled_ent.to_text();
96 deadly_error(class_name(),
"to_text test",
"strings are different");
100 if (georgio != filled_ent)
102 "entity is different after from_text");
105 astring text3 = fudnix.to_text();
109 "request id is different after from_text");
112 blank_ent =
octopus_entity(filled_ent.hostname(), filled_ent.process_id(),
113 filled_ent.sequencer(), filled_ent.add_in());
114 if (blank_ent != filled_ent)
116 "failed to resolve to same id");
120 filled_ent.pack(chunk1);
123 if (unpacked1 != filled_ent)
125 "failed to return same values");
133 int packed_estimate = bobo.packed_size();
135 bobo.pack(packed_bobo);
136 if (packed_bobo.
length() != packed_estimate)
138 "calculated incorrect packed size");
142 LOG(
astring(class_name()) +
":: works for those functions tested.");
The application_shell is a base object for console programs.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
a platform-independent way to acquire random numbers in a specific range.
int inclusive(int low, int high) const
< Returns a pseudo-random number r, such that "low" <= r <= "high".
Provides a way of identifying users of an octopus object.
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
basis::astring to_text() const
conversion to text format for display.
bool blank() const
true if the entity is blank, as constructed by default constructor.
Identifies requests made on an octopus by users.
Helpful functions for interacting with TCP/IP stacks.
basis::astring hostname() const
#define deadly_error(c, f, i)
#define MAXINT32
Maximum 32-bit integer value.
#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.
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.
Useful support functions for unit testing, especially within hoople.
const int ITERATE_EACH_TEST