HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Functions | Variables
test_client_pack.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <hipc/client.h>
Include dependency graph for test_client_pack.c:

Go to the source code of this file.

Data Structures

struct  log
 

Macros

#define IMG_SIZE   256U
 

Functions

static void loggerInit ()
 
static void loggerAdd (void *const scur_p, void *const ccur_p, const size_t n)
 
static int loggerCmp (const struct log l[], const unsigned int nl)
 
static void test_logger (void)
 
static int routine_hipcClientEachMbr (const size_t offset, const size_t size, const struct log l[], const unsigned int nl)
 
static void test_hipcClientEachMbr (void)
 
static void test_hipcClientEachMbr_err (void)
 
static void test_hipcClientPack (void)
 
static void test_hipcClientPack_NULLarg (void)
 
static void test_hipcClientUnpack (void)
 
static void test_hipcClientUnpack_NULLarg (void)
 
static void test_hipcClientCheckMbrSize (void)
 
int main (int argc, char *argv[])
 

Variables

const struct HIPC_cl_indp_mbr Mock_indp_member_s0 []
 
const struct HIPC_cl_indp_mbr Mock_indp_member_s1 []
 
const size_t Mock_indp_member_idxs_ary [] = { 3, 2 }
 
const size_t Mock_indp_member_idxs_as [] = { 2 }
 
const struct HIPC_cl_indp_mbr Mock_indp_member_base []
 
const struct HIPC_cl_indp_stru Mock_indp_struct []
 
const struct HIPC_cl_indp Mock_indp
 
unsigned char Mock_smdp_s0_offset [] = { 0,1,2,3 }
 
unsigned char Mock_smdp_s0_size [] = { 1,1,1,1 }
 
unsigned char Mock_cmdp_s0_offset [] = { 0,1,2,3 }
 
unsigned char Mock_cmdp_s0_size [] = { 1,1,1,1 }
 
unsigned char Mock_smdp_s1_offset [] = { 0,2 }
 
unsigned char Mock_smdp_s1_size [] = { 2,1 }
 
unsigned char Mock_cmdp_s1_offset [] = { 0,4 }
 
unsigned char Mock_cmdp_s1_size [] = { 4,1 }
 
unsigned char Mock_smdp_base_offset [] = { 0,1,2, 6, 12,26 }
 
unsigned char Mock_smdp_base_size [] = { 1,1,4,1*6,6*2, 4 }
 
unsigned char Mock_cmdp_base_offset [] = { 0,4,8, 12, 24,44 }
 
unsigned char Mock_cmdp_base_size [] = { 1,4,4,1*6,8*2, 4 }
 
unsigned char Mock_lstructsizes [] = { 4,8,48 }
 
unsigned char Mock_rstructsizes [] = { 4,6,30 }
 
struct HIPC_cl_dp_stru Mock_cmdp_struct []
 
struct HIPC_cl_dp_stru Mock_smdp_struct []
 
struct HIPC_cl_dp Mock_cmdp
 
struct HIPC_cl_dp Mock_smdp
 
struct HIPC_client mock = { 0, &Mock_indp, &Mock_cmdp, &Mock_smdp }
 
struct {
   unsigned int   nl
 
   struct log   l [256]
 
lgr
 
const size_t Invmock_indp_member_idxs_ary [] = { 3 }
 
const struct HIPC_cl_indp_mbr Invmock_indp_member_base []
 
const struct HIPC_cl_indp_stru Invmock_indp_struct []
 
const struct HIPC_cl_indp Invmock_indp
 
unsigned char Invmock_cmdp_base_offset [] = { 0, 1, 4, 8 }
 
unsigned char Invmock_cmdp_base_size [] = { 1,1*3, 2, 3 }
 
unsigned char Invmock_smdp_base_offset [] = { 0, 1, 4, 8 }
 
unsigned char Invmock_smdp_base_size [] = { 1, 2,1*3, 3 }
 
unsigned char Invmock_lstructsizes [] = { 12 }
 
unsigned char Invmock_rstructsizes [] = { 12 }
 
struct HIPC_cl_dp_stru Invmock_cmdp_struct []
 
struct HIPC_cl_dp_stru Invmock_smdp_struct []
 
struct HIPC_cl_dp Invmock_cmdp
 
struct HIPC_cl_dp Invmock_smdp
 
struct HIPC_client invmock
 

Macro Definition Documentation

#define IMG_SIZE   256U

Function Documentation

static void loggerInit ( )
static

Definition at line 90 of file test_client_pack.c.

References lgr.

Referenced by routine_hipcClientEachMbr(), and test_logger().

Here is the caller graph for this function:

static void loggerAdd ( void *const  scur_p,
void *const  ccur_p,
const size_t  n 
)
static

Definition at line 96 of file test_client_pack.c.

References lgr, and log::n.

Referenced by routine_hipcClientEachMbr(), test_hipcClientEachMbr_err(), and test_logger().

Here is the caller graph for this function:

static int loggerCmp ( const struct log  l[],
const unsigned int  nl 
)
static

Definition at line 112 of file test_client_pack.c.

References log::ccur_p, lgr, log::n, nl, and log::scur_p.

Referenced by routine_hipcClientEachMbr(), and test_logger().

Here is the caller graph for this function:

static void test_logger ( void  )
static

Definition at line 148 of file test_client_pack.c.

References loggerAdd(), loggerCmp(), and loggerInit().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static int routine_hipcClientEachMbr ( const size_t  offset,
const size_t  size,
const struct log  l[],
const unsigned int  nl 
)
static

Definition at line 189 of file test_client_pack.c.

References HIPC_MBR_STRUCT, HIPC_SUCCESS, hipcClientEachMbr(), hipcClientInit(), hipcClientTerminate(), loggerAdd(), loggerCmp(), loggerInit(), HIPC_cl_indp_mbr::struno, and HIPC_cl_indp_mbr::type.

Referenced by test_hipcClientEachMbr().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientEachMbr ( void  )
static

Definition at line 214 of file test_client_pack.c.

References routine_hipcClientEachMbr().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientEachMbr_err ( void  )
static

Definition at line 324 of file test_client_pack.c.

References HIPC_ERR_INTERNAL_ERROR, HIPC_MBR_STRUCT, HIPC_SUCCESS, hipcClientEachMbr(), hipcClientInit(), hipcClientTerminate(), loggerAdd(), HIPC_cl_indp_mbr::struno, and HIPC_cl_indp_mbr::type.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientPack ( void  )
static

Definition at line 380 of file test_client_pack.c.

References HIPC_client::endian_convert, HIPC_SUCCESS, hipcClientPack(), IMG_SIZE, and mock.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientPack_NULLarg ( void  )
static

Definition at line 481 of file test_client_pack.c.

References HIPC_client::cimg_pp, HIPC_client::endian_convert, HIPC_ERR_PROTOCOL_VIOLATION, HIPC_SUCCESS, hipcClientPack(), hipcClientSetCimg(), IMG_SIZE, mock, and HIPC_client::simg_pp.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientUnpack ( void  )
static

Definition at line 566 of file test_client_pack.c.

References HIPC_client::endian_convert, HIPC_ERR_PROTOCOL_VIOLATION, HIPC_SUCCESS, hipcClientUnpack(), IMG_SIZE, and mock.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientUnpack_NULLarg ( void  )
static

Definition at line 670 of file test_client_pack.c.

References HIPC_client::cimg_pp, HIPC_client::endian_convert, HIPC_SUCCESS, hipcClientSetCimg(), hipcClientUnpack(), IMG_SIZE, mock, and HIPC_client::simg_pp.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void test_hipcClientCheckMbrSize ( void  )
static

Definition at line 748 of file test_client_pack.c.

References HIPC_client::cmdp_p, HIPC_ERR_MBR_SIZE_MISMATCH, HIPC_SUCCESS, hipcClientCheckMbrSize(), hipcClientGetErrDtlStr(), mock, HIPC_cl_dp_stru::size_p, HIPC_client::smdp_p, and HIPC_cl_dp::struct_p.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Variable Documentation

const struct HIPC_cl_indp_mbr Mock_indp_member_s0[]
Initial value:
= {
{HIPC_MBR_SIMPLE, "m0"},
{HIPC_MBR_SIMPLE, "m1"},
{HIPC_MBR_SIMPLE, "m2"},
{HIPC_MBR_SIMPLE, "m3"},
}

Definition at line 13 of file test_client_pack.c.

const struct HIPC_cl_indp_mbr Mock_indp_member_s1[]
Initial value:
= {
{HIPC_MBR_SIMPLE, "m0"},
{HIPC_MBR_SIMPLE, "m1"},
}

Definition at line 19 of file test_client_pack.c.

const size_t Mock_indp_member_idxs_ary[] = { 3, 2 }

Definition at line 23 of file test_client_pack.c.

const size_t Mock_indp_member_idxs_as[] = { 2 }

Definition at line 24 of file test_client_pack.c.

const struct HIPC_cl_indp_mbr Mock_indp_member_base[]
Initial value:
= {
{HIPC_MBR_SIMPLE, "m0"},
{HIPC_MBR_SIMPLE, "m1"},
{HIPC_MBR_STRUCT, "stru", 0},
{HIPC_MBR_SIMPLE, "m5"},
}
const size_t Mock_indp_member_idxs_ary[]
const size_t Mock_indp_member_idxs_as[]

Definition at line 27 of file test_client_pack.c.

const struct HIPC_cl_indp_stru Mock_indp_struct[]
Initial value:
= {
{4, "s0", Mock_indp_member_s0},
{2, "s1", Mock_indp_member_s1},
{6, "base", Mock_indp_member_base},
}
const struct HIPC_cl_indp_mbr Mock_indp_member_base[]
const struct HIPC_cl_indp_mbr Mock_indp_member_s0[]
const struct HIPC_cl_indp_mbr Mock_indp_member_s1[]

Definition at line 36 of file test_client_pack.c.

const struct HIPC_cl_indp Mock_indp
Initial value:
= {
NULL, 0, 7, 3, Mock_indp_struct
}
const struct HIPC_cl_indp_stru Mock_indp_struct[]

Definition at line 42 of file test_client_pack.c.

unsigned char Mock_smdp_s0_offset[] = { 0,1,2,3 }

Definition at line 46 of file test_client_pack.c.

unsigned char Mock_smdp_s0_size[] = { 1,1,1,1 }

Definition at line 47 of file test_client_pack.c.

unsigned char Mock_cmdp_s0_offset[] = { 0,1,2,3 }

Definition at line 48 of file test_client_pack.c.

unsigned char Mock_cmdp_s0_size[] = { 1,1,1,1 }

Definition at line 49 of file test_client_pack.c.

unsigned char Mock_smdp_s1_offset[] = { 0,2 }

Definition at line 50 of file test_client_pack.c.

unsigned char Mock_smdp_s1_size[] = { 2,1 }

Definition at line 51 of file test_client_pack.c.

unsigned char Mock_cmdp_s1_offset[] = { 0,4 }

Definition at line 52 of file test_client_pack.c.

unsigned char Mock_cmdp_s1_size[] = { 4,1 }

Definition at line 53 of file test_client_pack.c.

unsigned char Mock_smdp_base_offset[] = { 0,1,2, 6, 12,26 }

Definition at line 54 of file test_client_pack.c.

unsigned char Mock_smdp_base_size[] = { 1,1,4,1*6,6*2, 4 }

Definition at line 55 of file test_client_pack.c.

unsigned char Mock_cmdp_base_offset[] = { 0,4,8, 12, 24,44 }

Definition at line 56 of file test_client_pack.c.

unsigned char Mock_cmdp_base_size[] = { 1,4,4,1*6,8*2, 4 }

Definition at line 57 of file test_client_pack.c.

unsigned char Mock_lstructsizes[] = { 4,8,48 }

Definition at line 59 of file test_client_pack.c.

unsigned char Mock_rstructsizes[] = { 4,6,30 }

Definition at line 60 of file test_client_pack.c.

struct HIPC_cl_dp_stru Mock_cmdp_struct[]
Initial value:
= {
}
unsigned char Mock_cmdp_s0_size[]
unsigned char Mock_cmdp_s0_offset[]
unsigned char Mock_cmdp_s1_offset[]
unsigned char Mock_cmdp_s1_size[]
unsigned char Mock_cmdp_base_size[]
unsigned char Mock_cmdp_base_offset[]

Definition at line 62 of file test_client_pack.c.

struct HIPC_cl_dp_stru Mock_smdp_struct[]
Initial value:
= {
}
unsigned char Mock_smdp_base_offset[]
unsigned char Mock_smdp_base_size[]
unsigned char Mock_smdp_s0_size[]
unsigned char Mock_smdp_s1_offset[]
unsigned char Mock_smdp_s1_size[]
unsigned char Mock_smdp_s0_offset[]

Definition at line 67 of file test_client_pack.c.

struct HIPC_cl_dp Mock_cmdp
Initial value:
=
unsigned char Mock_lstructsizes[]
struct HIPC_cl_dp_stru Mock_cmdp_struct[]

Definition at line 72 of file test_client_pack.c.

struct HIPC_cl_dp Mock_smdp
Initial value:
=
struct HIPC_cl_dp_stru Mock_smdp_struct[]
unsigned char Mock_rstructsizes[]

Definition at line 74 of file test_client_pack.c.

struct HIPC_client mock = { 0, &Mock_indp, &Mock_cmdp, &Mock_smdp }
unsigned int nl

Definition at line 86 of file test_client_pack.c.

Referenced by loggerCmp().

struct log l[256]

Definition at line 87 of file test_client_pack.c.

struct { ... } lgr

Referenced by loggerAdd(), loggerCmp(), and loggerInit().

const size_t Invmock_indp_member_idxs_ary[] = { 3 }

Definition at line 285 of file test_client_pack.c.

const struct HIPC_cl_indp_mbr Invmock_indp_member_base[]
Initial value:

Definition at line 288 of file test_client_pack.c.

const struct HIPC_cl_indp_stru Invmock_indp_struct[]
Initial value:
= {
}
const struct HIPC_cl_indp_mbr Invmock_indp_member_base[]

Definition at line 295 of file test_client_pack.c.

const struct HIPC_cl_indp Invmock_indp
Initial value:
= {
NULL, 0, 3, 1, Invmock_indp_struct
}
const struct HIPC_cl_indp_stru Invmock_indp_struct[]

Definition at line 299 of file test_client_pack.c.

unsigned char Invmock_cmdp_base_offset[] = { 0, 1, 4, 8 }

Definition at line 303 of file test_client_pack.c.

unsigned char Invmock_cmdp_base_size[] = { 1,1*3, 2, 3 }

Definition at line 304 of file test_client_pack.c.

unsigned char Invmock_smdp_base_offset[] = { 0, 1, 4, 8 }

Definition at line 305 of file test_client_pack.c.

unsigned char Invmock_smdp_base_size[] = { 1, 2,1*3, 3 }

Definition at line 306 of file test_client_pack.c.

unsigned char Invmock_lstructsizes[] = { 12 }

Definition at line 307 of file test_client_pack.c.

unsigned char Invmock_rstructsizes[] = { 12 }

Definition at line 308 of file test_client_pack.c.

struct HIPC_cl_dp_stru Invmock_cmdp_struct[]
Initial value:
= {
}
unsigned char Invmock_cmdp_base_size[]
unsigned char Invmock_cmdp_base_offset[]

Definition at line 310 of file test_client_pack.c.

struct HIPC_cl_dp_stru Invmock_smdp_struct[]
Initial value:
= {
}
unsigned char Invmock_smdp_base_offset[]
unsigned char Invmock_smdp_base_size[]

Definition at line 313 of file test_client_pack.c.

struct HIPC_cl_dp Invmock_cmdp
Initial value:
=
struct HIPC_cl_dp_stru Invmock_cmdp_struct[]
unsigned char Invmock_lstructsizes[]

Definition at line 316 of file test_client_pack.c.

struct HIPC_cl_dp Invmock_smdp
Initial value:
=
struct HIPC_cl_dp_stru Invmock_smdp_struct[]
unsigned char Invmock_rstructsizes[]

Definition at line 318 of file test_client_pack.c.

struct HIPC_client invmock
Initial value:
=
const struct HIPC_cl_indp Invmock_indp
struct HIPC_cl_dp Invmock_cmdp
struct HIPC_cl_dp Invmock_smdp

Definition at line 320 of file test_client_pack.c.