HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
test_hipc.c
Go to the documentation of this file.
1 #include <assert.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 
5 #include <hipc.h>
6 
7 static void test_hipcMsghdrBdysize(void)
8 {
9  unsigned char header[HIPC_MSGHDR_SIZE];
10 
11  header[HIPC_MSGHDR_BYTE_BDYSZ] = 44;
12 
14  assert(44 == hipcMsghdrBdysize(header));
15 
17  assert(0 == hipcMsghdrBdysize(header));
18 
19  return;
20 }
21 
22 static void test_hipcEndian(void)
23 {
24  unsigned char endian;
25 
26  endian = hipcEndian();
27  assert(0x6c /* 'l' */ == endian ||
28  0x42 /* 'B' */ == endian ||
29  0x6f /* 'o' */ == endian);
30 
31  return;
32 }
33 
34 int main(int argc, char *argv[])
35 {
36  if (2 != argc) {
37  fprintf(stderr, "Usage: %s test_id\n", argv[0]);
38  exit(EXIT_FAILURE);
39  }
40 
41  switch (argv[1][0]) {
42  case 'a':
44  break;
45  case 'b':
47  break;
48  default:
49  fprintf(stderr, "Invalid test_id: %s \n", argv[1]);
50  exit(EXIT_FAILURE);
51  }
52 
53  return 0;
54 }
static void test_hipcMsghdrBdysize(void)
Definition: test_hipc.c:7
static void test_hipcEndian(void)
Definition: test_hipc.c:22
unsigned char hipcMsghdrBdysize(unsigned char const *const msghdr)
Returns message size determined by a message header.
Definition: hipc.c:12
int main(int argc, char *argv[])
Definition: test_hipc.c:34
unsigned char hipcEndian(void)
Returns endian of the system.
Definition: hipc.c:25