t_packable.cpp File Reference

#include <basis/chaos.h>
#include <basis/function.h>
#include <basis/guards.h>
#include <basis/istring.h>
#include <basis/packable.h>
#include <mathematics/float_plus.h>
#include <opsystem/application_shell.h>
#include <data_struct/static_memory_gremlin.h>
#include <math.h>

Include dependency graph for t_packable.cpp:

Go to the source code of this file.

Defines

#define DIE(group, message)   deadly_error("test_packable", group " test group", message)
#define TRY_ON(type, value, group)
#define TRY_ON_OBSCURE(type, value, group)
#define TRY_ON_F(type, value, group)
#define TEST   "first"
#define TEST   "second"
#define TEST   "third"
#define TEST   "fourth"

Functions

int main (int formal(argc), char *formal(argv)[])

Variables

 HOOPLE_STARTUP_CODE


Define Documentation

#define DIE ( group,
message   )     deadly_error("test_packable", group " test group", message)

Definition at line 30 of file t_packable.cpp.

#define TEST   "fourth"

#define TEST   "third"

#define TEST   "second"

#define TEST   "first"

Referenced by TEST().

#define TRY_ON ( type,
value,
group   ) 

Value:

{ \
  byte_array temp_array; \
  attach(temp_array, type(value)); \
  type output; \
/*log(istring(istring::SPRINTF, "parms are: type=%s value=%s group=%s", #type, #value, #group));*/ \
  if (!detach(temp_array, output)) \
    DIE(group, "couldn't unpack " #type); \
  if (output != type(value)) \
    DIE(group, #type " value didn't match " #value); \
  if (temp_array.length()) \
    DIE(group, #type " detach of " #value " had data left"); \
}

Definition at line 33 of file t_packable.cpp.

#define TRY_ON_F ( type,
value,
group   ) 

Value:

{ \
  byte_array temp_array; \
  attach(temp_array, type(value)); \
  type output; \
/*log(istring(istring::SPRINTF, "parms are: type=%s value=%s group=%s", #type, #value, #group));*/ \
  if (!detach(temp_array, output)) \
    DIE(group, "couldn't unpack " #type); \
/*  float_plus<type> a(output); \
  float_plus<type> b(value); */ \
  /*double diff = maximum(output, value) - minimum(output, value);*/ \
  int exponent_1, exponent_2; \
  double mantissa_1 = frexp(output, &exponent_1); \
  double mantissa_2 = frexp(output, &exponent_2); \
  if ( (mantissa_1 != mantissa_2) || (exponent_1 != exponent_2) ) { \
    isprintf error_msg(#type " value didn't match " #value ", %f vs. %f", value, output); \
    DIE(group, error_msg); \
  } \
  if (temp_array.length()) \
    DIE(group, #type " detach of " #value " had data left"); \
}

Definition at line 59 of file t_packable.cpp.

#define TRY_ON_OBSCURE ( type,
value,
group   ) 

Value:

{ \
  byte_array temp_array; \
  obscure_attach(temp_array, type(value)); \
  type output; \
/*log(istring(istring::SPRINTF, "parms are: type=%s value=%s group=%s", #type, #value, #group));*/ \
  if (!obscure_detach(temp_array, output)) \
    DIE(group, "couldn't obscure unpack " #type); \
  if (output != type(value)) \
    DIE(group, #type " value didn't obscure match " #value); \
  if (temp_array.length()) \
    DIE(group, #type " obscure detach of " #value " had data left"); \
}

Definition at line 46 of file t_packable.cpp.


Function Documentation

int main ( int   formal(argc),
char *  formal(argv)[] 
)

Definition at line 245 of file t_packable.cpp.


Variable Documentation

HOOPLE_STARTUP_CODE

Definition at line 28 of file t_packable.cpp.


Generated on Fri Nov 21 04:31:31 2008 for HOOPLE Libraries by  doxygen 1.5.1