Doxygen Documentation |
||||||
Package: |
PBI |
|||||
Version: |
V0-0-4 |
Marked: |
(not marked) |
|||
Constituent: |
test_unions |
Tag: |
sun-gcc |
#include <stdio.h>
#include "PBI/Endianness.h"
#include "PBI/Unions.h"
Include dependency graph for test_unions.c:
Data Structures | |
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... | |
struct | A_short |
Union an unsigned short against 2 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 "%4.4x" |
Internal formatting symbol. | |
#define | X_8_8X "%8.8x" |
Internal formatting symbol. | |
#define | X_16_16XLL____ "%16.16llx" |
Internal formatting symbol. | |
#define | X22 "%2.2x %2.2x" |
Internal formatting symbol. | |
#define | S4 "%4s" |
Internal formatting symbol. | |
#define | S9_____ "%9s" |
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.2 2004/02/17 01:30:09 russell Exp $
To run the program type
On Unix platforms:
$
test_unions
On VxWorks
>
test_unions()
The program returns 0 if successful, else -1.
|
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. |
|
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"
|
|
Value: "\n" \ " WARNING\n" \ " The long long test failed. This may be due to a compiler error. It is\n" \ " known that version 2.7 of the PPC compiler had problems with long longs.\n" \ " In particular, printf will not correctly format a long long.\n" \ "\n" \ " An early version of the test had a kludge in the one to get around this.\n" \ " However, now that the compiler has been upgraded, this is no longer a\n" \ " a problem. However, given that this test failed, looking at the version\n" \ " of might be a good place to look.\n" \ "\n" \ " Compiler Version => "COMPILER_VERSION"\n"
|
|
Value: " |Int | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |Lo Short | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |Hi Short | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |As Shorts | "X4" "X4" | "X4" "X4" | "S4" |\n"\ " |As Bytes | "X22" "X22" | "X22" "X22" | "S4" |\n"\ " +----------+-------------------------+-------------------------+--------+\n"
|
|
Value: " |Long Long | 0x"X_16_16XLL____" | 0x"X_16_16XLL____" | "S4" |\n"\ " |Lo Int | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |Hi Int | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |As Ints | "X_8_8X" "X_8_8X" | "X_8_8X" "X_8_8X" | "S4" |\n"\ " |As Shorts | "X4" "X4" "X4" "X4" | "X4" "X4" "X4" "X4" | "S4" |\n"\ " |As Bytes | "X22" "X22" "X22" "X22" | "X22" "X22" "X22" "X22" | "S4" |\n"\ " +----------+-------------------------+-------------------------+--------+\n"
|
|
Value: " |Short | 0x"X4" | 0x"X4" | "S4" |\n"\ " |Lo Byte | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |Hi Byte | 0x"X_8_8X" | 0x"X_8_8X" | "S4" |\n"\ " |As Bytes | "X22" | "X22" | "S4" |\n"\ " +----------+-------------------------+-------------------------+--------+\n"
|
|
Value: " |This "S9_____" matches the expected results on this "ENAME" |\n"\ " |endian machine, therefore the overall result of Test Unions is "S4" |\n"\ " +-----------------------------------------------------------------------+\n"\ "\n"
|
|
Value: " +-----------------------------------------------------------------------+\n"\ " | Test Results |\n"\ " +----------+-------------------------+-------------------------+--------+\n"\ " |What | Expected | Got | Result |\n"\ " +----------+-------------------------+-------------------------+--------+"
|
|
Standard main entry point for Unix platforms. It merely calls the testing routine test_unions ().
|
Here is the call graph for this function:
|
The test program itself and also the entry point for running this test on VxWork's platforms.
|