GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBI / V0-1-5 > test_unions / mv2304
#include <stdio.h>
#include <PBI/Endianness.h>
#include <PBI/Unions.h>
Classes | |
struct | A_short |
Union an unsigned short against 2 unsigned chars. More... | |
struct | A_int |
Union an unsigned int against 2 unsigned shorts and 4 unsigned chars. More... | |
struct | A_longlong |
Union an unsigned long long against 2 unsigned ints, 4 unsigned shorts and 8 unsigned chars. More... | |
Defines | |
#define | ENAME "unknown" |
Defines a string describing the endianness of the machine. | |
#define | COMPILER_VERSION "UNKNOWN" |
If supported by the compiler, a string representing the compiler version. | |
#define | TEST_MISSION |
Symbol representing the string stating the mission of this test. It is purely here to make the code read nicer. | |
#define | TEST_MISSION_WARNING |
Symbol representing the string stating a warning on the limitations of the test implementation. It is purely here to make the code read nicer. | |
#define | X4 |
Internal formatting symbol. | |
#define | X_8_8X |
Internal formatting symbol. | |
#define | X_16_16XLL____ |
Internal formatting symbol. | |
#define | X22 |
Internal formatting symbol. | |
#define | S4 |
Internal formatting symbol. | |
#define | S9_____ |
Internal formatting symbol. | |
#define | TEST_RESULTS_TITLE |
Symbol representing the formatting string for the test results title bar.It is here purely to make the code read nicer. | |
#define | TEST_RESULTS_SHORT |
Symbol representing the formatting string for the test results for shorts.It is here purely to make the code read nicer. | |
#define | TEST_RESULTS_INT |
Symbol representing the formatting string for the test results for ints.It is here purely to make the code read nicer. | |
#define | TEST_RESULTS_LL |
Symbol representing the formatting string for the test results for long long. It is here purely to make the code read nicer. | |
#define | TEST_RESULTS_SUMMARY |
Symbol representing the formatting string for the test results summary. It is here purely to make the code read nicer. | |
Functions | |
int | main (int argc, char **argv) |
Standard main entry point for Unix platforms. It merely calls the testing routine test_unions (). | |
int | test_unions (void) |
The test program itself and also the entry point for running this test on VxWork's platforms. |
CVS $Id: test_unions.c,v 1.5 2011/03/24 20:50:58 apw Exp $
To run the program type
On Unix platforms:
$
test_unions
On VxWorks
>
test_unions()
The program returns 0 if successful, else -1.
#define ENAME "unknown" |
Defines a string describing the endianness of the machine.
Defines a string describing the endianness of the machine as determined by the macros ins PBI/Endianness.h. As such, the success of this program depends on whether the testing of PBI/Endianness.h was successful.
#define S9_____ |
Internal formatting symbol.
\* -------------------------------------------------------------------------
#define TEST_MISSION |
Value:
"\n" \ " Test Unions\n" \ " -----------\n" \ " This tests the ability to interpret various integer types as compositions\n"\ " of narrower integer types. This is used, for example, to correctly select\n"\ " the integer with the 32 numerically most significant bits from a 64 bit\n" \ " long long on different endian machines. It also tests the ability to\n" \ " form wider integer types by packing narrower types.\n" \ "\n" \ " The first row of each type checks that the packing macros produce the\n" \ " anticipated result. The next two rows check the simplified macros which\n" \ " pick out the high and low halves of the type. For example, for an int,\n" \ " U_UNPACK_INT_LO_SHORT returns the numerically least significant short.\n" \ " The subsequent rows then break down the packed integer into narrower\n" \ " types.\n" \ "\n" \ " Compiler Version : "COMPILER_VERSION"\n" \ " ----------------\n" \ " Since this code is so compiler dependent, the compiler version is\n" \ " recorded here.\n"
Referenced by test_unions().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Standard main entry point for Unix platforms. It merely calls the testing routine test_unions ().
0,if | successful | |
-1,if | unsuccessful |
References test_unions().
int test_unions | ( | void | ) |
The test program itself and also the entry point for running this test on VxWork's platforms.
0,if | successful | |
-1,if | unsucceful |
References _U_short::b, _U_longlong_as_ints::hi, _U_int_as_shorts::hi, _U_short_as_bytes::hi, _U_longlong::i, _U_longlong_as_ints::lo, _U_int_as_shorts::lo, _U_short_as_bytes::lo, _U_int::s, TEST_MISSION, TEST_MISSION_WARNING, TEST_RESULTS_INT, TEST_RESULTS_LL, TEST_RESULTS_SHORT, TEST_RESULTS_SUMMARY, TEST_RESULTS_TITLE, U_PACK_INT_WITH_BYTES, U_PACK_LL_WITH_BYTES, U_PACK_SHORT_WITH_BYTES, U_UNPACK_INT_HI_SHORT, U_UNPACK_INT_LO_SHORT, U_UNPACK_LL_HI_INT, U_UNPACK_LL_LO_INT, U_UNPACK_SHORT_HI_BYTE, U_UNPACK_SHORT_LO_BYTE, A_longlong::ub, A_int::ub, _U_byte::ub, A_short::ub, A_longlong::ui, A_int::ui, _U_int::ui, A_longlong::ull, _U_longlong::ull, A_longlong::us, A_int::us, A_short::us, and _U_short::us.
Referenced by main().