34#define LOG(to_print) EMERGENCY_LOG(program_wide_logger::get(), astring(to_print))
44int test_byte_format::execute()
50 source += 0x23; source += 0x5f; source += 0xa8; source += 0x2d;
51 source += 0xe2; source += 0x61; source += 0x90; source += 0x2d;
52 source += 0xf2; source += 0x38;
59 ASSERT_EQUAL(source_copy, source,
"A: shifting corrupted the bytes.");
64 for (
int run = 0; run < 100; run++) {
67 for (
int i = 0; i < size; i++) {
76 ASSERT_EQUAL(source_copy, source,
"B: shifting corrupted the bytes.");
81 astring burf(
"alia bodalia petunia");
84 LOG(
"dumped form is:");
89 abyte fodder[] = { 0x83, 0x0d, 0x93, 0x21, 0x82, 0xfe, 0xef, 0xdc, 0xb9,
90 0xa9, 0x21, 0x54, 0x83, 0x38, 0x65, 0x59, 0x99, 0xff, 0x00, 0xa0,
103 ASSERT_EQUAL(fred, convert1,
"first abyte conversion: failed due to inequality");
104 ASSERT_TRUE(fred == convert2,
"second abyte conversion: failed due to inequality");
106 astring as_text3(
"muggulo x83d x93, x21, x82, xfe, xef, xdc, xb9, "
107 "xa9, x21, x54, x83, x38, x65, x59, x99, xff, x00a0, x293");
114 astring as_text4(
"muggulo x83d x93, x21, x82, xfe, xef, xdc, xb9, "
115 "xa9, x21, x54, x83, x38, x65, x59, x99, xff, x00a0, x293gikkor");
121 ASSERT_EQUAL(fred, harder_convert1,
"third abyte conversion: failed due to inequality");
122 ASSERT_EQUAL(fred, harder_convert2,
"fourth abyte conversion: failed due to inequality");
1250x04, 0x00, 0x06, 0x00, 0x0a, 0x02, 0x03, 0x00, 0x06, 0x00, 0x48, 0x01, 0x1c, 0x00, 0x2c, 0x00, 0x04, 0x00, 0x09, 0x00, 0x17, 0x00, 0xff, 0xff, 0x00, 0x00,
1260x00, 0x00, 0x09, 0x00 };
128 astring as_text5(
"040006000a020300060048011c002c00040009001700ffff000000000900");
134 ASSERT_EQUAL(fred, harder_convert3,
"fifth abyte conversion: failed due to inequality");
136#ifndef EMBEDDED_BUILD
144 ASSERT_EQUAL(fred, fred_like,
"parse_dump test: failed due to inequality");
150 LOG(
"0x3c5f in intel:");
153 LOG(
"0x9eaad0cb in intel:");
159 LOG(
"0x3c5f in package:");
163 LOG(
"0x9eaad0cb in package:");
167 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.
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
static void shifted_string_to_bytes(const basis::astring &to_convert, basis::byte_array &as_array)
unshifts a string "to_convert" back into a byte_array.
static void text_dump(basis::astring &output, const basis::abyte *location, basis::un_int length, basis::un_int label=0, const char *eol="\n")
prints out a block of memory in a human readable form.
static void bytes_to_string(const basis::byte_array &to_convert, basis::astring &as_string, bool space_delimited=true)
converts a byte_array into a string.
static void string_to_bytes(const basis::astring &to_convert, basis::byte_array &as_array)
wrangles the string "to_convert" into an equivalent byte form "as_array".
static void parse_dump(const basis::astring &dumped_form, basis::byte_array &bytes_found)
this operation performs the inverse of a text_dump.
static void bytes_to_shifted_string(const basis::byte_array &to_convert, basis::astring &as_string)
this is a special purpose converter from bytes to character strings.
#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...
unsigned int un_int
Abbreviated name for unsigned integers.
unsigned short un_short
Abbreviated name for unsigned short integers.
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.
void attach(byte_array &packed_form, const byte_array &to_attach)
Packs a byte_array "to_attach" into "packed_form".
Useful support functions for unit testing, especially within hoople.
#define ASSERT_EQUAL(a, b, test_name)
#define ASSERT_TRUE(a, test_name)