/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name:  	aifg_m.c
Description:    Test case of AIFG module
Version: 	  	v9.0.0
Author:	  		Roy Jiang
Create Date:    2007-3-12
Remark:			CUnit is used for manageing the test cases

History:
2007-3-12   	v9.0.0  Create
*********************************************************************/
//Header files of CUnit
#ifdef _WINDOWS_
#include "Basic.h"
#include "Console.h"
#include "Automated.h"
#else
#include "/usr/local/include/CUnit/Basic.h"
#include "/usr/local/include/CUnit/Console.h"
#include "/usr/local/include/CUnit/Automated.h"
#endif

//Header files of AIFG module
#include "../src/include/aifg.h"
#include "../src/include/aifg_if.h"
#include "../src/include/aifg_var_ext.h"

/*
All the test cases share the same return value: 0-fail, 1-success
*/
#define TEST_FAIL		0
#define TEST_SUCCESS 	1

//function declearation
int aifg_code_test();
int aifg_unit_test();
//Message process functions declearation---------------------------------------------
int aifg_msg_proc(BYTE *src, aifg_msg_pre_decoded *dst);
int aifg_msg_decode_assignReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_assignComplete(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_assignFailure(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_block(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_blockAck(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HORequest(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HORequired(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HORequestAck(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HOCmd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HOComplete(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HOCandEnq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HOCandResp(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HOFailure(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_resrcReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_resrcInd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_paging(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_clearReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_clearCmd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HOPerformed(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_overload(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_mscTrace(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_bscTrace(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_cmUpdate(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_cipherModeCmd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_cipherModeComp(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_completeL3Info(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_sapi_n_rej(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_HORequiredRej(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_resetCircuit(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_ccGroupBlock(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_ccGroupBlockAck(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_confusion(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_loadInd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_suspend(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_lsaInfo(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_locInfoCmd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_locInfoReport(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_resetCircuitAck(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
/////////////dtap//////////////////////
int aifg_msg_decode_authReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_authResp(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_cmReEstReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_cmRej(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_cmReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_idReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_idResp(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_imsiDetachInd(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_locAccept(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_locReq(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_mmInfo(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_tmsiRealloc(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_alert(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_callConfirm(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_callProceed(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_congestCtrl(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_connect(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_disconnect(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_eSetup(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_facility(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_holdRej(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_modify(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_modifyRej(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_notify(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_progress(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_release(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_releaseComp(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_setup(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_startDTMF(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_status(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_decode_userInfo(BYTE *src, aifg_msg_pre_decoded *dst, BYTE msg_len);
int aifg_msg_sd_assignReq(aifg_msg_t * src, BYTE * dst);

//Test entrance
void aifg_test()
{
	printf("\nStarting Code Test--------------------------------------------\n");
	aifg_code_test();
	printf("\nCode Test Completed-------------------------------------------\n");
	printf("\nStarting Unit Test--------------------------------------------\n");
	aifg_unit_test();
	printf("\nUnit Test Completed-------------------------------------------\n");
	return;
}

aifg_msg_t bm_completeL3;
aifg_msg_t dt_cmAccept;
aifg_msg_t bm_clearReq;
aifg_msg_t bm_clearCmd;
aifg_msg_t bm_clearComplete;
aifg_msg_t bm_paging;
aifg_msg_t bm_setup;
aifg_msg_t rr_pagingResp;
aifg_msg_t dt_callCfm;


static BYTE src[][64]={//source with out iei
///////// BSSMAP ////////////////////////
	   {0x01,0x02},    //CIC
	   {0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x02,0x06,0x00,0x0b}, //resrouce available
	   {0x01,0x09} ,   //cause
	   {0x02,0x89,0x10},	//cause_extent
	   {0x08,0x00,0x13,0x42,0x05,0x00,0x02,0x00,0x11},	   //cellId with discriminator==0x00
	   {0x05,0x01,0x00,0x42,0x01,0x03}, 		//cellId with discriminator==0x01
	   {0x03,0x02,0x00,0x22},	   //cellId with discriminator==0x02
	   {0x01,0x76}, 	//priority
	   {0X02,0X08,0X02},	//L3HeaderInfo
	   {0x04,0xf7,0x03,0x12,0x2a},	  //tmsi redefintion,out of use
	   {0x01,0x01}, 	//encryptInfo with no encryption
	   {0x09,0x12,0x08,0x15,0x34,0x67,0xa2,0x8d,0x46,0x8f},    //encryption with A5
	   {0X04,0X01,0X09,0X83,0X79},	  //channelType with speech indicator
	   {0x04,0x02,0x0a,0xf5,0x07},	  //channelType with data indicator
	   {0x02},	  //extResourceInd
	   {0x03,0x7e,0x67,0x82},	  //cmInfo2
	   {0x04,0x05,0x21,0x3f,0x58,0xe1},    //l3Info
	   {0x08,0x00,0x85,0x47,0x9c,0x67,0x24,0x3d,0x05},	 //cidList with discriminator==0x00
	   {0x05,0x01,0x23,0x07,0x4f,0x39},   //cidList with discriminator==0x01
	   {0x03,0x02,0x77,0x64},	//cidList with discriminator==0x02
	   {0x06,0x04,0x4e,0x39,0x58,0x7c,0x0a},   //cidList with discriminator==0x04
	   {0x03,0x05,0x21,0xf3},	//cidList with discriminator==0x05
	   {0x04,0x32,0x12,0x8d,0x36},	 //cicList
	   {0x04,0x03,0x0a,0x38,0x89},	 //diagnostics
	   {0x56},	  //chosenChannel
	   {0x84,0x62,0xf2,0x7e},	 //totalResrc
	   {0x03,0x9d,0x20,0x81},	 //triggerId
	   {0x02,0x31,0xf2},	//mobileId,type of identity==001(IMSI),odd/even indicator==0(even)
	   {0x05,0x01,0x02,0x03,0x04,0x05},   //circuitPoolList
	   {0x05,0x11,0x83,0x04,0x28,0x75},   //resrcSit,band1 with SDCCH,band2 with Full Rate TCH
	   {0x19},	 //curChannelType1 with speech mode and Half rate TCH
	   {0x05,0x24,0x38,0x56,0x19,0x10},  //groupRef,sf(VGCS),af(required),call_priority(level4),cipher_info(key1)
	   {0x03,0x10,0x39,0xd2},	//lsaId
	   {0x07,0x01,0x22,0xe4,0x31,0x57,0x69,0x83},	//lsaIdList with Ep==1
	   {0x09,0x00,0x00,0x36,0x85,0xef,0x03,0x47,0x87,0x42},  //lsaInfo
	   {0x03,0x15,0x49,0xf5},	//locInfo
	   {0x03,0x39,0xc4,0x08},	//omcId
	   {0X07, 0xdd,0X01,0X02,0xdd ,0X02,0X06,0X01},//bssOldtoNew,UNCOMPLETED !FIELD ELEMENT{ExtraInfo:prec=0,lcs=1;curChanType2:data14.5kb/s,SDCCH}
	   {0Xff},	//periodicity
	   {0Xfe},	//msNum
	   {0x09},	//bandUsed
	   {0X08},	//rrCouse
	   {0XC2},	//dlci,channel is SACCH
	   {0x01},	//dtx, MSC forbids the BSS to activate DTX in the downlink direction
	   {0X01},	//resrcIdMethod,method ii is selected
	   {0X00},	//cipherRespMode,IMEISV must not be included by the Mobile Station
	   {0X02},	//channelNeeded,TCH/F (Full rate)
	   {0xdd},	//traceType
	   {0x34,0x97},  //traceRef
	   {0x02,0x17,0x62},   //transId
	   {0x02},	  //forwardInd,forward to subsequent BSS, and trace at MSC
	   {0X03},	  //chosenEncrypt,GSM A5/2
	   {0X10},	  //circuitPool,Circuit pool number 16
	   {0X11},	  //timeInd,170s
	   {0X21},	  //speechVer,GSM speech full rate version 3
	   {0X02},	  //queuingInd,it is recommended to allow queuing
	   {0X01},	  //assignReq,Immediate
	   {0X06},	  //eMLPP,call priority level B
	   {0x03},	  //configInd,Modification is allowed and maximum number of TCH/F is 3
	   {0X04,0X33,0X79,0X27,0X46},	 //tmsi
/////////////  DTAP	 ///////////////////////////////////////////
	   {0x10,0x34,0x78,0x69,0x20},	  //broadcastRef,vbs,ackRequired,priority4,cipher NO.2
	   {0x11},	 //cmInfo1,Reserved for phase 1,"CECS"implemented in MS,A5/1 available,Class2
	   {0x03,0x33,0x22,0x8d},	//cmInfo2
	   {0x02,0x73,0xf2},   //mobileId,even flag,IMEISV
	   {0x78,0xf3,0x64,0x31,0x02},	 //LocId
	   {0x09},	 //luType,iei=0,Follow-on request pending,Periodic updating
	   {0x03,0x91,0x35,0x64},  //nwName,bit8 set to "0" in octet n,no add letters,UCS2 (16 bit) [72]
	   {0x07,0x04,0x12,0x0a,0x32,0x14,0xdd},   //tzTime
	   {0x02,0xc0,0x82},  //progInd,National standard,User,Destination address in non-PLMN/ISDN
	   {0x03,0x01,0x19,0x83},  //uu,OSI high layer protocols
	   {0x02,0x20,0x02},  //bc with info_trans_cap==0,only octet 3a is extend
	   {0x0d,0xa3,0xca,0x1a,0x00,0xe4,0x21,0x53,0x5b,0x60,0x21,0x5f,0x47,0xc6},  //bc with info_trans_cap!=0
	   {0x04,0x47,0xdd,0x96,0x81},	//cause,National standard,international network,Number changed
	   {0x01,0x03},  //ccCap
	   {0x04,0x28,0xa3,0x89,0x37},	//connNum/callingNum/calledNum/redirNum
	   {0x03,0x88,0x50,0x43},  //connSubAddr/callingSubAddr/calledSubAddr/redirSubAddr
	   {0x01,0xdd},  //ssVer
	   {0x03,0xa8,0x6e,0xb4},  //hiComp
	   {0x02,0xdd,0xde},  //loComp
	   {0xc2},	//callStat
	   {0x01,0x86},  //auxStat
	   {0x03,0x11,0x22,0x33},  //lsaId
	   {0X02},	//rejectCause
	   {0X0B},	//cmType
	   {0X01},	//cipherKey
	   {0X05},	//priority
	   {0X03},	//idType
	   {0X0F},	//congestLevel
	   {0x80},	//notificationInd
	   {0x08},	//signal
	   {0X01,0X07},  //alertPattern
	   {0X0D},	//keypad
	   {0XDD},	//timeZone
	   {0X00,0X11,0X22,0X33,0X44,0X55,0X66,0X77,0X88,0X99,0XAA,0XBB,0XCC,0XDD,0XEE,0XFF},  //authRAND
	   {0X11,0X12,0X13,0X14},  //authSRES
	   {0X01},	//rpInd
		{0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00}//facility
};

static aifg_ie dst;
static int len;
static aifg_msg_protocol protocol;
static aifg_ie_ptr ie;
static BYTE buffer[256];
aifg_msg_predecode_l3msg predecode_l3msg;
aifg_msg_bm_l3msg	l3Info;

void test_aifg_ie_bm_cic()
{
   
   //preconditon
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CIC;
   ie.ptr=src[0];

	   
   //test decode
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CIC,dst.iei);
   //CU_ASSERT_EQUAL(3,len);
   CU_ASSERT_EQUAL(8,dst.param.bm_cic.pcm);
   CU_ASSERT_EQUAL(2,dst.param.bm_cic.timeslot);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CIC,&(dst.param),buffer, 0);
   //check encode result
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CIC,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&(buffer[1]),src[0],2));
   
}
void test_aifg_ie_bm_resrcAvail()
{

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_RESOURCEAVAIL;
   ie.ptr=src[1];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_RESOURCEAVAIL,dst.iei);
   //CU_ASSERT_EQUAL(21,len);
   CU_ASSERT_EQUAL(9,dst.param.bm_resrcAvail.full_rate_channel[0]);
   CU_ASSERT_EQUAL(259,dst.param.bm_resrcAvail.half_rate_channel[0]);
   CU_ASSERT_EQUAL(9,dst.param.bm_resrcAvail.full_rate_channel[1]);
   CU_ASSERT_EQUAL(259,dst.param.bm_resrcAvail.half_rate_channel[1]);
   CU_ASSERT_EQUAL(9,dst.param.bm_resrcAvail.full_rate_channel[2]);
   CU_ASSERT_EQUAL(259,dst.param.bm_resrcAvail.half_rate_channel[2]);
   CU_ASSERT_EQUAL(9,dst.param.bm_resrcAvail.full_rate_channel[3]);
   CU_ASSERT_EQUAL(259,dst.param.bm_resrcAvail.half_rate_channel[3]);
   CU_ASSERT_EQUAL(518,dst.param.bm_resrcAvail.full_rate_channel[4]);
   CU_ASSERT_EQUAL(11,dst.param.bm_resrcAvail.half_rate_channel[4]);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_RESOURCEAVAIL,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_RESOURCEAVAIL,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[1],20));
} 
void test_aifg_ie_bm_cause(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CAUSE;
   ie.ptr=src[2];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CAUSE,dst.iei);
   //CU_ASSERT_EQUAL(3,len);
   CU_ASSERT_EQUAL(9,dst.param.bm_cause.value);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CAUSE,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CAUSE,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[2],2));
   
   }

void test_aifg_ie_bm_cause_ext()
{
   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CAUSE;
   ie.ptr=src[3];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CAUSE,dst.iei);
   //CU_ASSERT_EQUAL(4,len);
   CU_ASSERT_EQUAL(9,dst.param.bm_cause.value);
   CU_ASSERT_EQUAL(1,dst.param.bm_cause.ext_value.flag);
   CU_ASSERT_EQUAL(16,dst.param.bm_cause.ext_value.value);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CAUSE,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CAUSE,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[3],3));
   
}

void test_aifg_ie_bm_cellId_00()
{
   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CELLID;
   ie.ptr=src[4];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(0,dst.param.bm_cellId.discriminator);
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLID,dst.iei);
   //CU_ASSERT_EQUAL(10,len);
   CU_ASSERT_EQUAL(3,dst.param.bm_cellId.mcc[0]);
   CU_ASSERT_EQUAL(1,dst.param.bm_cellId.mcc[1]);
   CU_ASSERT_EQUAL(2,dst.param.bm_cellId.mcc[2]);
   CU_ASSERT_EQUAL(4,dst.param.bm_cellId.mnc[2]);
   CU_ASSERT_EQUAL(0,dst.param.bm_cellId.mnc[1]);
   CU_ASSERT_EQUAL(5,dst.param.bm_cellId.mnc[0]);
   CU_ASSERT_EQUAL(2,dst.param.bm_cellId.LAC);
   CU_ASSERT_EQUAL(17,dst.param.bm_cellId.CI);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLID,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLID,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[4],9));
}

void test_aifg_ie_bm_cellId_01()
{
   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CELLID;
   ie.ptr=src[5];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(1,dst.param.bm_cellId.discriminator);
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLID,dst.iei);
   //CU_ASSERT_EQUAL(7,len);
   CU_ASSERT_EQUAL(66,dst.param.bm_cellId.LAC);
   CU_ASSERT_EQUAL(259,dst.param.bm_cellId.CI);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLID,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLID,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[5],6));
}

void test_aifg_ie_bm_cellId_02(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CELLID;
   ie.ptr=src[6];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(2,dst.param.bm_cellId.discriminator);
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLID,dst.iei);
   //CU_ASSERT_EQUAL(5,len);
   CU_ASSERT_EQUAL(34,dst.param.bm_cellId.CI);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLID,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLID,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[6],4));
   }
void test_aifg_ie_bm_priority(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_PRIORITY;
   ie.ptr=src[7];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_PRIORITY,dst.iei);
   //CU_ASSERT_EQUAL(3,len);
   CU_ASSERT_EQUAL(1,dst.param.bm_priority.pci);
   CU_ASSERT_EQUAL(13,dst.param.bm_priority.level);
   CU_ASSERT_EQUAL(1,dst.param.bm_priority.qa);
   CU_ASSERT_EQUAL(0,dst.param.bm_priority.pvi);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_PRIORITY,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_PRIORITY,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[7],2));
   }
void test_aifg_ie_bm_L3HeaderInfo(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_L3HEADERINFO;
   ie.ptr=src[8];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_L3HEADERINFO,dst.iei);
   //CU_ASSERT_EQUAL(4,len);
   CU_ASSERT_EQUAL(8,dst.param.bm_L3HeaderInfo.pd);
   CU_ASSERT_EQUAL(2,dst.param.bm_L3HeaderInfo.ti);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_L3HEADERINFO,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_L3HEADERINFO,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[8],3));
   }
/*void test_aifg_ie_bm_tmsi(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   iei=AIFG_IE_ID_BM_TMSI;

   //test
   len=aifg_ie_decode(protocol,iei,src[9],&dst,hi_lo_flag);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TMSI,dst.iei);
   CU_ASSERT_EQUAL(6,len);
   CU_ASSERT_EQUAL(0xf7,dst.param.bm_tmsi[0]);
   CU_ASSERT_EQUAL(0x03,dst.param.bm_tmsi[1]);
   CU_ASSERT_EQUAL(0x12,dst.param.bm_tmsi[2]);
   CU_ASSERT_EQUAL(0x2a,dst.param.bm_tmsi[3]);
   }*///redefinition
void test_aifg_ie_bm_encryptInfo_NOencryption(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_ENCRYPTINFO;
   ie.ptr=src[10];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_ENCRYPTINFO,dst.iei);
//CU_ASSERT_EQUAL(3,len);
   CU_ASSERT_EQUAL(0x01,dst.param.bm_encryptInfo.algorithm);
   //test encode
	  aifg_ie_encode(protocol,AIFG_IE_ID_BM_ENCRYPTINFO,&(dst.param),buffer, 0);
	  CU_ASSERT_EQUAL(AIFG_IEI_BM_ENCRYPTINFO,buffer[0]);
	  CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[10],2));

   }
void test_aifg_ie_bm_encryptInfo_A5(){

   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_ENCRYPTINFO;
   ie.ptr=src[11];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_ENCRYPTINFO,dst.iei);
   //CU_ASSERT_EQUAL(11,len);
   CU_ASSERT_EQUAL(0x12,dst.param.bm_encryptInfo.algorithm);
   CU_ASSERT_EQUAL(0x08,dst.param.bm_encryptInfo.key[0]);
   CU_ASSERT_EQUAL(0x15,dst.param.bm_encryptInfo.key[1]);
   CU_ASSERT_EQUAL(0x34,dst.param.bm_encryptInfo.key[2]);
   CU_ASSERT_EQUAL(0x67,dst.param.bm_encryptInfo.key[3]);
   CU_ASSERT_EQUAL(0xa2,dst.param.bm_encryptInfo.key[4]);
   CU_ASSERT_EQUAL(0x8d,dst.param.bm_encryptInfo.key[5]);
   CU_ASSERT_EQUAL(0x46,dst.param.bm_encryptInfo.key[6]);
   CU_ASSERT_EQUAL(0x8f,dst.param.bm_encryptInfo.key[7]);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_ENCRYPTINFO,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_ENCRYPTINFO,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[11],10));
   }

void test_aifg_ie_bm_channelType_speech()
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CHANNELTYPE;
	ie.ptr=src[12];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CHANNELTYPE,dst.iei);
	//CU_ASSERT_EQUAL(6,len);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_channelType.speech_data_ind);
	CU_ASSERT_EQUAL(0x09,dst.param.bm_channelType.channel_rate_type);
	CU_ASSERT_EQUAL(0x03,dst.param.bm_channelType.ext.speech.ver[0]);
	CU_ASSERT_EQUAL(0x79,dst.param.bm_channelType.ext.speech.ver[1]);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CHANNELTYPE,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CHANNELTYPE,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[12],5));
}

void test_aifg_ie_bm_channelType_data()
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CHANNELTYPE;
	ie.ptr=src[13];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CHANNELTYPE,dst.iei);
	//CU_ASSERT_EQUAL(6,len);
	CU_ASSERT_EQUAL(0x02,dst.param.bm_channelType.speech_data_ind);
	CU_ASSERT_EQUAL(0x0a,dst.param.bm_channelType.channel_rate_type);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_channelType.ext.data_cfg.t_nt);
	CU_ASSERT_EQUAL(0x35,dst.param.bm_channelType.ext.data_cfg.rate);
	CU_ASSERT_EQUAL(0x07,dst.param.bm_channelType.ext.data_cfg.allowed_data_rate.value);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CHANNELTYPE,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CHANNELTYPE,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[13],5));
}
void test_aifg_ie_bm_extResourceInd()
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_EXTRESOURCEIND;
	ie.ptr=src[14];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_EXTRESOURCEIND,dst.iei);
	//CU_ASSERT_EQUAL(2,len);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_extResrcInd.sm);
	CU_ASSERT_EQUAL(0x00,dst.param.bm_extResrcInd.tarr);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_EXTRESOURCEIND,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_EXTRESOURCEIND,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[14],1));
}
void test_aifg_ie_bm_cmInfo2()
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CLASSMARKINFO2;
	ie.ptr=src[15];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CLASSMARKINFO2,dst.iei);
	//CU_ASSERT_EQUAL(5,len);
	CU_ASSERT_EQUAL(0x03,dst.param.bm_cmInfo2.rev_level);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.es_ind);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.a5_1);
	CU_ASSERT_EQUAL(0x06,dst.param.bm_cmInfo2.rf_power_cap);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.ps_cap);
	CU_ASSERT_EQUAL(0x02,dst.param.bm_cmInfo2.ss_screen_ind);
	CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.sm_cap);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.vbs);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.vgcs);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.fc);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.cm3);
	CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.lcsva_cap);
	CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.so_lsa);
	CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.cmsp);
	CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.a5_3);
	CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.a5_2);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CLASSMARKINFO2,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CLASSMARKINFO2,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[15],4));
}

/*void test_aifg_ie_bm_l3Info(){ 			  //to resolve
   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_L3INFO;
   ie.ptr=src[16];
   //test
   len=aifg_ie_decode(protocol,&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_L3INFO,dst.iei);
   //CU_ASSERT_EQUAL(6,len);
   CU_ASSERT_EQUAL(AIFG_MSG_T_CM_ACCEPT,dst.param.bm_l3Info.l3_msg->type);
   }*/

void test_aifg_ie_bm_cidList_00()	//discriminator==0x00
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CELLIDLIST;
	ie.ptr=src[17];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLIDLIST,dst.iei);
	//CU_ASSERT_EQUAL(10,len);
	CU_ASSERT_EQUAL(0,dst.param.bm_cellIdList.discriminator);
	CU_ASSERT_EQUAL(5,dst.param.bm_cellIdList.cell_id[0].mcc[0]);
	CU_ASSERT_EQUAL(8,dst.param.bm_cellIdList.cell_id[0].mcc[1]);
	CU_ASSERT_EQUAL(7,dst.param.bm_cellIdList.cell_id[0].mcc[2]);
	CU_ASSERT_EQUAL(12,dst.param.bm_cellIdList.cell_id[0].mnc[0]);
	CU_ASSERT_EQUAL(9,dst.param.bm_cellIdList.cell_id[0].mnc[1]);
	CU_ASSERT_EQUAL(4,dst.param.bm_cellIdList.cell_id[0].mnc[2]);
	CU_ASSERT_EQUAL(0x6724,dst.param.bm_cellIdList.cell_id[0].LAC);
	CU_ASSERT_EQUAL(0x3d05,dst.param.bm_cellIdList.cell_id[0].CI);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLIDLIST,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLIDLIST,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[17],9));
}

void test_aifg_ie_bm_cidList_01()//discriminator==0x01
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CELLIDLIST;
	ie.ptr=src[18];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLIDLIST,dst.iei);
	//CU_ASSERT_EQUAL(7,len);
	CU_ASSERT_EQUAL(1,dst.param.bm_cellIdList.discriminator);
	CU_ASSERT_EQUAL(0x2307,dst.param.bm_cellIdList.cell_id[0].LAC);
	CU_ASSERT_EQUAL(0x4f39,dst.param.bm_cellIdList.cell_id[0].CI);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLIDLIST,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLIDLIST,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[18],6));
}

void test_aifg_ie_bm_cidList_02()//discriminator==0x02
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CELLIDLIST;
	ie.ptr=src[19];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLIDLIST,dst.iei);
	//CU_ASSERT_EQUAL(5,len);
	CU_ASSERT_EQUAL(2,dst.param.bm_cellIdList.discriminator);
	CU_ASSERT_EQUAL(0x7764,dst.param.bm_cellIdList.cell_id[0].CI);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLIDLIST,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLIDLIST,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[19],4));
}

void test_aifg_ie_bm_cidList_04()	//discriminator==0x04
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CELLIDLIST;
	ie.ptr=src[20];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLIDLIST,dst.iei);
	//CU_ASSERT_EQUAL(8,len);
	CU_ASSERT_EQUAL(4,dst.param.bm_cellIdList.discriminator);
	CU_ASSERT_EQUAL(14,dst.param.bm_cellIdList.cell_id[0].mcc[0]);
	CU_ASSERT_EQUAL(4,dst.param.bm_cellIdList.cell_id[0].mcc[1]);
	CU_ASSERT_EQUAL(9,dst.param.bm_cellIdList.cell_id[0].mcc[2]);
	CU_ASSERT_EQUAL(3,dst.param.bm_cellIdList.cell_id[0].mnc[2]);
	CU_ASSERT_EQUAL(5,dst.param.bm_cellIdList.cell_id[0].mnc[1]);
	CU_ASSERT_EQUAL(8,dst.param.bm_cellIdList.cell_id[0].mnc[0]);
	CU_ASSERT_EQUAL(0x7c0a,dst.param.bm_cellIdList.cell_id[0].LAC);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLIDLIST,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLIDLIST,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[20],7));
}

void test_aifg_ie_bm_cidList_05()	//discriminator==0x05
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CELLIDLIST;
	ie.ptr=src[21];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CELLIDLIST,dst.iei);
	//CU_ASSERT_EQUAL(5,len);
	CU_ASSERT_EQUAL(5,dst.param.bm_cellIdList.discriminator);
	CU_ASSERT_EQUAL(0x21f3,dst.param.bm_cellIdList.cell_id[0].LAC);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CELLIDLIST,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CELLIDLIST,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[21],4));
}

void test_aifg_ie_bm_cicList()
{
	//precondition
	protocol=AIFG_MSG_BSSMAP;
	ie.iei=AIFG_IE_ID_BM_CICLIST;
	ie.ptr=src[22];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CICLIST,dst.iei);
	//CU_ASSERT_EQUAL(6,len);
	CU_ASSERT_EQUAL(0x32,dst.param.bm_cicList.range);
	CU_ASSERT_EQUAL(3,dst.param.bm_cicList.status.len);
	CU_ASSERT_EQUAL(0x12,dst.param.bm_cicList.status.content[0]);
	CU_ASSERT_EQUAL(0x8d,dst.param.bm_cicList.status.content[1]);
	CU_ASSERT_EQUAL(0x36,dst.param.bm_cicList.status.content[2]);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_BM_CICLIST,&(dst.param),buffer, 0);
	CU_ASSERT_EQUAL(AIFG_IEI_BM_CICLIST,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[22],5));
}

void test_aifg_ie_bm_diagnostics(){
   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_DIGNOSTIC;
   ie.ptr=src[23];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_DIGNOSTIC,dst.iei);
   //CU_ASSERT_EQUAL(6,len);
   CU_ASSERT_EQUAL(0x03,dst.param.bm_diagnostics.err_pointer);
   CU_ASSERT_EQUAL(0x0a,dst.param.bm_diagnostics.bit_pointer);
   CU_ASSERT_EQUAL(2,dst.param.bm_diagnostics.err_msg.len);
   CU_ASSERT_EQUAL(0x38,dst.param.bm_diagnostics.err_msg.msg[0]);
   CU_ASSERT_EQUAL(0x89,dst.param.bm_diagnostics.err_msg.msg[1]);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_DIGNOSTIC,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_DIGNOSTIC,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[23],5));
   }
void test_aifg_ie_bm_chosenChannel()
{
   //precondition
   protocol=AIFG_MSG_BSSMAP;
   ie.iei=AIFG_IE_ID_BM_CHOSENCHANNEL;
   ie.ptr=src[24];
   //test
   len=aifg_ie_decode(&ie,&dst);

   //check result
   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CHOSENCHANNEL,dst.iei);
   //CU_ASSERT_EQUAL(2,len);
   CU_ASSERT_EQUAL(0x05,dst.param.bm_chosenChannel.mode);
   CU_ASSERT_EQUAL(0x06,dst.param.bm_chosenChannel.channel);
   //test encode
   aifg_ie_encode(protocol,AIFG_IE_ID_BM_CHOSENCHANNEL,&(dst.param),buffer, 0);
   CU_ASSERT_EQUAL(AIFG_IEI_BM_CHOSENCHANNEL,buffer[0]);
   CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[24],1));
}

void test_aifg_ie_bm_totalResrc()
{
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TOTALRESOURCE;
	   ie.ptr=src[25];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TOTALRESOURCE,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0x8462,dst.param.bm_totalResrc.full_rate_channel);
	   CU_ASSERT_EQUAL(0xf27e,dst.param.bm_totalResrc.half_rate_channel);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TOTALRESOURCE,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TOTALRESOURCE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[25],4));
}

void test_aifg_ie_bm_triggerId()
{
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TRIGGERID;
	   ie.ptr=src[26];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TRIGGERID,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(3,dst.param.bm_triggerId.len);
	   CU_ASSERT_EQUAL(0x9d,dst.param.bm_triggerId.content[0]);
	   CU_ASSERT_EQUAL(0x20,dst.param.bm_triggerId.content[1]);
	   CU_ASSERT_EQUAL(0x81,dst.param.bm_triggerId.content[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TRIGGERID,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TRIGGERID,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[26],4));
}

void test_aifg_ie_bm_mobileId(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_MOBILEID;
	   ie.ptr=src[27];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_MOBILEID,dst.iei);
	   //CU_ASSERT_EQUAL(4,len);
	   CU_ASSERT_EQUAL(1,dst.param.mobileId.type);
	   CU_ASSERT_EQUAL(0,dst.param.mobileId.odd_even_flag);
	   CU_ASSERT_EQUAL(2,dst.param.mobileId.id_len);
	   CU_ASSERT_EQUAL(0x03,dst.param.mobileId.id[0]);
	   CU_ASSERT_EQUAL(0x02,dst.param.mobileId.id[1]);
	   CU_ASSERT_EQUAL(0x0f,dst.param.mobileId.id[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_MOBILEID,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_MOBILEID,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[27],3));
	   }
void test_aifg_ie_bm_circuitPoolList(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CIRCUITPOOLLIST;
	   ie.ptr=src[28];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CIRCUITPOOLLIST,dst.iei);
	   //CU_ASSERT_EQUAL(7,len);
	   CU_ASSERT_EQUAL(5,dst.param.bm_circuitPoolList.num);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_circuitPoolList.circuit[0]);
	   CU_ASSERT_EQUAL(0x02,dst.param.bm_circuitPoolList.circuit[1]);
	   CU_ASSERT_EQUAL(0x03,dst.param.bm_circuitPoolList.circuit[2]);
	   CU_ASSERT_EQUAL(0x04,dst.param.bm_circuitPoolList.circuit[3]);
	   CU_ASSERT_EQUAL(0x05,dst.param.bm_circuitPoolList.circuit[4]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CIRCUITPOOLLIST,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CIRCUITPOOLLIST,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[28],6));
	   
	   }
void test_aifg_ie_bm_resrcSit(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_RESOURCESITUATION;
	   ie.ptr=src[29];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_RESOURCESITUATION,dst.iei);
	   //CU_ASSERT_EQUAL(7,len);
	   CU_ASSERT_EQUAL(1,dst.param.bm_resrcSit.band[0].band_ind);
	   CU_ASSERT_EQUAL(1,dst.param.bm_resrcSit.band[0].channel_type);
	   CU_ASSERT_EQUAL(0x0304,dst.param.bm_resrcSit.band[0].channel_num);
	   CU_ASSERT_EQUAL(2,dst.param.bm_resrcSit.band[1].band_ind);
	   CU_ASSERT_EQUAL(8,dst.param.bm_resrcSit.band[1].channel_type);
	   CU_ASSERT_EQUAL(0x75,dst.param.bm_resrcSit.band[1].channel_num);
	   CU_ASSERT_EQUAL(2,dst.param.bm_resrcSit.band_num);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_RESOURCESITUATION,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_RESOURCESITUATION,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[29],6));
	   }
void test_aifg_ie_bm_curChannelType1(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CURCHANNELTYPE1;
	   ie.ptr=src[30];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CURCHANNELTYPE1,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(1,dst.param.bm_curChannelType1.channel_mode);
	   CU_ASSERT_EQUAL(9,dst.param.bm_curChannelType1.channel);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CURCHANNELTYPE1,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CURCHANNELTYPE1,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[30],1));
	   }
void test_aifg_ie_bm_groupRef(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_GROUPCALLREF;
	   ie.ptr=src[31];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_GROUPCALLREF,dst.iei);
	   //CU_ASSERT_EQUAL(7,len);
	   CU_ASSERT_EQUAL(0x121c2b0,dst.param.bm_groupRef.binary_code);
	   CU_ASSERT_EQUAL(1,dst.param.bm_groupRef.sf);
	   CU_ASSERT_EQUAL(1,dst.param.bm_groupRef.af);
	   CU_ASSERT_EQUAL(1,dst.param.bm_groupRef.call_priority);
	   CU_ASSERT_EQUAL(1,dst.param.bm_groupRef.cipher_info);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_GROUPCALLREF,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_GROUPCALLREF,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[31],6));
	   }
void test_aifg_ie_bm_lsaId(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_LSAID;
	   ie.ptr=src[32];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_LSAID,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0x10,dst.param.bm_lsaId.value[0]);
	   CU_ASSERT_EQUAL(0x39,dst.param.bm_lsaId.value[1]);
	   CU_ASSERT_EQUAL(0xd2,dst.param.bm_lsaId.value[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_LSAID,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_LSAID,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[32],4));
	   }
void test_aifg_ie_bm_lsaIdList(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_LSAIDLIST;
	   ie.ptr=src[33];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_LSAIDLIST,dst.iei);
	   //CU_ASSERT_EQUAL(9,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_lsaIdList.ep);
	   CU_ASSERT_EQUAL(0x22,dst.param.bm_lsaIdList.list[0].id[0]);
	   CU_ASSERT_EQUAL(0xe4,dst.param.bm_lsaIdList.list[0].id[1]);
	   CU_ASSERT_EQUAL(0x31,dst.param.bm_lsaIdList.list[0].id[2]);
	   CU_ASSERT_EQUAL(0x57,dst.param.bm_lsaIdList.list[1].id[0]);
	   CU_ASSERT_EQUAL(0x69,dst.param.bm_lsaIdList.list[1].id[1]);
	   CU_ASSERT_EQUAL(0x83,dst.param.bm_lsaIdList.list[1].id[2]);
	   CU_ASSERT_EQUAL(2,dst.param.bm_lsaIdList.lsa_num);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_LSAIDLIST,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_LSAIDLIST,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[33],8));
	   }
void test_aifg_ie_bm_lsaInfo(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_LSAINFO;
	   ie.ptr=src[34];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_LSAINFO,dst.iei);
	   //CU_ASSERT_EQUAL(11,len);
	   CU_ASSERT_EQUAL(0,dst.param.bm_lsaInfo.lsa_only);
	   CU_ASSERT_EQUAL(2,dst.param.bm_lsaInfo.lsa_num);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_lsaInfo.info[0].priority);
	   CU_ASSERT_EQUAL(0x36,dst.param.bm_lsaInfo.info[0].id[0]);
	   CU_ASSERT_EQUAL(0x85,dst.param.bm_lsaInfo.info[0].id[1]);
	   CU_ASSERT_EQUAL(0xef,dst.param.bm_lsaInfo.info[0].id[2]);
	   CU_ASSERT_EQUAL(0x03,dst.param.bm_lsaInfo.info[1].priority);
	   CU_ASSERT_EQUAL(0x47,dst.param.bm_lsaInfo.info[1].id[0]);
	   CU_ASSERT_EQUAL(0x87,dst.param.bm_lsaInfo.info[1].id[1]);
	   CU_ASSERT_EQUAL(0x42,dst.param.bm_lsaInfo.info[1].id[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_LSAINFO,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_LSAINFO,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[34],10));
	   }
void test_aifg_ie_bm_locInfo(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_LOCATIONINFO;
	   ie.ptr=src[35];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_LOCATIONINFO,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(3,dst.param.bm_locInfo.len);
	   CU_ASSERT_EQUAL(0x15,dst.param.bm_locInfo.info[0]);
	   CU_ASSERT_EQUAL(0x49,dst.param.bm_locInfo.info[1]);
	   CU_ASSERT_EQUAL(0xf5,dst.param.bm_locInfo.info[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_LOCATIONINFO,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_LOCATIONINFO,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[35],4));
	   }
void test_aifg_ie_bm_omcId(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_OMCID;
	   ie.ptr=src[36];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_OMCID,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(3,dst.param.bm_omcId.len);
	   CU_ASSERT_EQUAL(0x39,dst.param.bm_omcId.id[0]);
	   CU_ASSERT_EQUAL(0xc4,dst.param.bm_omcId.id[1]);
	   CU_ASSERT_EQUAL(0x08,dst.param.bm_omcId.id[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_OMCID,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_OMCID,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[36],4));
	   }
void test_aifg_ie_bm_bssOldtoNew(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_BSSOLDTONEW;
	   ie.ptr=src[37];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_BSSOLDTONEW,dst.iei);
	   //CU_ASSERT_EQUAL(9,len);
	   CU_ASSERT_EQUAL(7,dst.param.bm_bssOldtoNew.len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.bm_bssOldtoNew.content[0]);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_bssOldtoNew.content[1]);
	   CU_ASSERT_EQUAL(0x02,dst.param.bm_bssOldtoNew.content[2]);
	   CU_ASSERT_EQUAL(0xdd,dst.param.bm_bssOldtoNew.content[3]);
	   CU_ASSERT_EQUAL(0x02,dst.param.bm_bssOldtoNew.content[4]);
	   CU_ASSERT_EQUAL(0x06,dst.param.bm_bssOldtoNew.content[5]);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_bssOldtoNew.content[6]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_BSSOLDTONEW,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_BSSOLDTONEW,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[37],8));
	   }
void test_aifg_ie_bm_periodicity(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_PERIODICITY;
	   ie.ptr=src[38];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_PERIODICITY,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(255,dst.param.bm_periodicity.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_PERIODICITY,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_PERIODICITY,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[38],1));
	   }
void test_aifg_ie_bm_msNum(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_MSNUM;
	   ie.ptr=src[39];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_MSNUM,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(254,dst.param.bm_msNum.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_MSNUM,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_MSNUM,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[39],1));
	   }
void test_aifg_ie_bm_bandUsed(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_BANDUSED;
	   ie.ptr=src[40];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_BANDUSED,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x09,dst.param.bm_bandUsed.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_BANDUSED,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_BANDUSED,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[40],1));
	   }
void test_aifg_ie_bm_rrCause(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_RRCAUSE;
	   ie.ptr=src[41];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_RRCAUSE,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x08,dst.param.bm_rrCause.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_RRCAUSE,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_RRCAUSE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[41],1));
	   }
void test_aifg_ie_bm_dlci(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_DLCI;
	   ie.ptr=src[42];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_DLCI,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0xC2,dst.param.bm_dlci.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_DLCI,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_DLCI,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[42],1));
	   }
void test_aifg_ie_bm_dtx(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_DTXFLAG;
	   ie.ptr=src[43];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_DTXFLAG,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_dtx.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_DTXFLAG,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_DTXFLAG,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[43],1));
	   }
void test_aifg_ie_bm_resrcIndMethod(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_RESOURCEINDMEHTOD;
	   ie.ptr=src[44];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_RESOURCEINDMEHTOD,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_resrcIndMethod.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_RESOURCEINDMEHTOD,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_RESOURCEINDMEHTOD,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[44],1));
	   }
void test_aifg_ie_bm_cipherRespMode(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CIPHERRESPMODE;
	   ie.ptr=src[45];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CIPHERRESPMODE,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cipherRespMode.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CIPHERRESPMODE,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CIPHERRESPMODE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[45],1));
	   }
void test_aifg_ie_bm_channelNeeded(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CHANNELNEEDED;
	   ie.ptr=src[46];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CHANNELNEEDED,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x02,dst.param.bm_channelNeeded.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CHANNELNEEDED,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CHANNELNEEDED,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[46],1));
	   }
void test_aifg_ie_bm_traceType(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TRACETYPE;
	   ie.ptr=src[47];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TRACETYPE,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.bm_traceType.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TRACETYPE,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TRACETYPE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[47],1));
	   }
void test_aifg_ie_bm_traceRef(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TRACEREF;
	   ie.ptr=src[48];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TRACEREF,dst.iei);
	   //CU_ASSERT_EQUAL(3,len);
	   CU_ASSERT_EQUAL(0x3497,dst.param.bm_traceRef.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TRACEREF,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TRACEREF,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[48],1));
	   }
void test_aifg_ie_bm_transId(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TRANSACTIONID;
	   ie.ptr=src[49];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TRANSACTIONID,dst.iei);
	   //CU_ASSERT_EQUAL(4,len);
	   CU_ASSERT_EQUAL(0x1762,dst.param.bm_transId.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TRANSACTIONID,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TRANSACTIONID,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[49],3));
	   }
void test_aifg_ie_bm_fowardInd(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_FORWARDIND;
	   ie.ptr=src[50];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_FORWARDIND,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x02,dst.param.bm_fowardInd.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_FORWARDIND,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_FORWARDIND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[50],1));
	   }
void test_aifg_ie_bm_chosenEncrypt(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CHOSENENCRYPT;
	   ie.ptr=src[51];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CHOSENENCRYPT,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x03,dst.param.bm_chosenEncrypt.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CHOSENENCRYPT,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CHOSENENCRYPT,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[51],1));
	   }
void test_aifg_ie_bm_circuitPool(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CIRCUITPOOL;
	   ie.ptr=src[52];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CIRCUITPOOL,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x10,dst.param.bm_circuitPool.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CIRCUITPOOL,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CIRCUITPOOL,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[52],1));
	   }
void test_aifg_ie_bm_timeInd(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TIMEIND;
	   ie.ptr=src[53];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TIMEIND,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x11,dst.param.bm_timeId.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TIMEIND,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TIMEIND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[53],1));
	   }
void test_aifg_ie_bm_speechVer(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_SPEECHVER;
	   ie.ptr=src[54];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_SPEECHVER,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x21,dst.param.bm_speechVer.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_SPEECHVER,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_SPEECHVER,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[54],1));
	   }
void test_aifg_ie_bm_queuingInd(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_QUEUEIND;
	   ie.ptr=src[55];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_QUEUEIND,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(1,dst.param.bm_queuingInd.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_QUEUEIND,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_QUEUEIND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[55],1));
	   }
void test_aifg_ie_bm_assignReq(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_ASSIGNREQUIREMENT;
	   ie.ptr=src[56];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_ASSIGNREQUIREMENT,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(1,dst.param.bm_assignReq.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_ASSIGNREQUIREMENT,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_ASSIGNREQUIREMENT,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[56],1));
	   }
void test_aifg_ie_bm_eMLPP(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_EMLPP;
	   ie.ptr=src[57];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_EMLPP,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(6,dst.param.bm_eMLPP.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_EMLPP,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_EMLPP,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[57],1));
	   }
void test_aifg_ie_bm_configInd(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_CFGEVOIND;
	   ie.ptr=src[58];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_CFGEVOIND,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(3,dst.param.bm_cfgEvoInd.value);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_CFGEVOIND,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_CFGEVOIND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[58],1));
	   }
void test_aifg_ie_bm_tmsi(){
	   //precondition
	   protocol=AIFG_MSG_BSSMAP;
	   ie.iei=AIFG_IE_ID_BM_TMSI;
	   ie.ptr=src[59];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_BM_TMSI,dst.iei);
	   //CU_ASSERT_EQUAL(6,len);
	   CU_ASSERT_EQUAL(0x33,dst.param.bm_tmsi.value[0]);
	   CU_ASSERT_EQUAL(0x79,dst.param.bm_tmsi.value[1]);
	   CU_ASSERT_EQUAL(0x27,dst.param.bm_tmsi.value[2]);
	   CU_ASSERT_EQUAL(0x46,dst.param.bm_tmsi.value[3]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_BM_TMSI,&(dst.param),buffer, 0);
       CU_ASSERT_EQUAL(AIFG_IEI_BM_TMSI,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[59],5));
	   }

///////////////////////// DTAP ////////////////////////////////

void test_aifg_ie_dt_broadcastRef(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_GROUPREF;
	   ie.ptr=src[60];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_GROUPREF,dst.iei);
	   //CU_ASSERT_EQUAL(6,len);
	   CU_ASSERT_EQUAL(0x81a3c3,dst.param.dt_broadcastRef.binary_code);
	   CU_ASSERT_EQUAL(0,dst.param.dt_broadcastRef.sf);
	   CU_ASSERT_EQUAL(1,dst.param.dt_broadcastRef.af);
	   CU_ASSERT_EQUAL(1,dst.param.dt_broadcastRef.call_priority);
	   CU_ASSERT_EQUAL(2,dst.param.dt_broadcastRef.cipher_info);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_GROUPREF,&(dst.param),buffer, 0);
 //      CU_ASSERT_EQUAL(AIFG_IEI_DT_GROUPREF,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[60],5));
	   }
void test_aifg_ie_dt_cmInfo1(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_MSCM1;
	   ie.ptr=src[61];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_MSCM1,dst.iei);
	   //CU_ASSERT_EQUAL(6,len);
	   CU_ASSERT_EQUAL(0,dst.param.dt_cmInfo1.rev_level);
	   CU_ASSERT_EQUAL(1,dst.param.dt_cmInfo1.es_ind);
	   CU_ASSERT_EQUAL(0,dst.param.dt_cmInfo1.a5_1);
	   CU_ASSERT_EQUAL(1,dst.param.dt_cmInfo1.rf_power_cap);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_MSCM1,&(dst.param),buffer, 0);
 //      CU_ASSERT_EQUAL(AIFG_IEI_DT_MSCM1,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[61],1));
	   
	   }
void test_aifg_ie_dt_cmInfo2(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_MSCM2;
	   ie.ptr=src[62];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_MSCM2,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.rev_level);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.es_ind);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.a5_1);
	   CU_ASSERT_EQUAL(0x03,dst.param.bm_cmInfo2.rf_power_cap);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.ps_cap);
	   CU_ASSERT_EQUAL(0x02,dst.param.bm_cmInfo2.ss_screen_ind);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.sm_cap);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.vbs);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.vgcs);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.fc);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.cm3);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.lcsva_cap);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.so_lsa);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.cmsp);
	   CU_ASSERT_EQUAL(0x00,dst.param.bm_cmInfo2.a5_3);
	   CU_ASSERT_EQUAL(0x01,dst.param.bm_cmInfo2.a5_2);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_MSCM2,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_MSCM2,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[62],4));
	   }
void test_aifg_ie_dt_mobileId()
{
	//precondition
	protocol=AIFG_MSG_DTAP;
	ie.iei=AIFG_IE_ID_DT_MOBILEID;
	ie.ptr=src[63];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_DT_MOBILEID,dst.iei);
	//CU_ASSERT_EQUAL(4,len);
	CU_ASSERT_EQUAL(0x03,dst.param.mobileId.type);
	CU_ASSERT_EQUAL(0,dst.param.mobileId.odd_even_flag);
	CU_ASSERT_EQUAL(0x02,dst.param.mobileId.id_len);
	CU_ASSERT_EQUAL(0x07,dst.param.mobileId.id[0]);
	CU_ASSERT_EQUAL(0x02,dst.param.mobileId.id[1]);
	CU_ASSERT_EQUAL(0x0f,dst.param.mobileId.id[2]);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_DT_MOBILEID,&(dst.param),buffer, 2);
	CU_ASSERT_EQUAL(AIFG_IEI_DT_MOBILEID,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[63],3));
}

void test_aifg_ie_dt_lai()
{
	//precondition
	protocol=AIFG_MSG_DTAP;
	ie.iei=AIFG_IE_ID_DT_LAI;
	ie.ptr=src[64];
	//test
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_DT_LAI,dst.iei);
	//CU_ASSERT_EQUAL(6,len);
	CU_ASSERT_EQUAL(0x08,dst.param.dt_lai.mcc[0]);
	CU_ASSERT_EQUAL(0x07,dst.param.dt_lai.mcc[1]);
	CU_ASSERT_EQUAL(0x03,dst.param.dt_lai.mcc[2]);
	CU_ASSERT_EQUAL(0x0f,dst.param.dt_lai.mnc[2]);
	CU_ASSERT_EQUAL(0x06,dst.param.dt_lai.mnc[1]);
	CU_ASSERT_EQUAL(0x04,dst.param.dt_lai.mnc[0]);
	CU_ASSERT_EQUAL(0x3102,dst.param.dt_lai.LAC);
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_DT_LAI,&(dst.param),buffer, 2);
	CU_ASSERT_EQUAL(AIFG_IEI_DT_LAI,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[64],5));
}

void test_aifg_ie_dt_luType(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_LUTYPE;
	   ie.ptr=src[65];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_LUTYPE,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_luType.fo_req);
	   CU_ASSERT_EQUAL(1,dst.param.dt_luType.lut);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_LUTYPE,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_LUTYPE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[65],1));
	   }
void test_aifg_ie_dt_nwName(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_FULL_NWNAME;
	   ie.ptr=src[66];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_FULL_NWNAME,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_nwName.code_scheme);
	   CU_ASSERT_EQUAL(0,dst.param.dt_nwName.add_ci);
	   CU_ASSERT_EQUAL(1,dst.param.dt_nwName.spare_num);
	   CU_ASSERT_EQUAL(2,dst.param.dt_nwName.text_len);
	   CU_ASSERT_EQUAL(0x35,dst.param.dt_nwName.text[0]);
	   CU_ASSERT_EQUAL(0x64,dst.param.dt_nwName.text[1]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_FULL_NWNAME,&(dst.param),buffer, 2);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_NWNAME,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[66],4));
	   }
void test_aifg_ie_dt_tzTime(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_TZTIME;
	   ie.ptr=src[67];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_TZTIME,dst.iei);
	   //CU_ASSERT_EQUAL(8,len);
	   CU_ASSERT_EQUAL(0x07,dst.param.dt_tzTime.year);
	   CU_ASSERT_EQUAL(0x04,dst.param.dt_tzTime.month);
	   CU_ASSERT_EQUAL(0x12,dst.param.dt_tzTime.day);
	   CU_ASSERT_EQUAL(0x0a,dst.param.dt_tzTime.hour);
	   CU_ASSERT_EQUAL(0x32,dst.param.dt_tzTime.minute);
	   CU_ASSERT_EQUAL(0x14,dst.param.dt_tzTime.second);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_tzTime.time_zone);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_TZTIME,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_TZTIME,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[67],7));
	   }
void test_aifg_ie_dt_progInd(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_PROGIND;
	   ie.ptr=src[68];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_PROGIND,dst.iei);
	   //CU_ASSERT_EQUAL(4,len);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_progInd.coding_standard);
	   CU_ASSERT_EQUAL(0x00,dst.param.dt_progInd.location);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_progInd.desc);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_PROGIND,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_PROGIND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[68],3));
	   }
void test_aifg_ie_dt_uu(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_USERUSER;
	   ie.ptr=src[69];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_USERUSER,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_uu.pd);
	   CU_ASSERT_EQUAL(2,dst.param.dt_uu.info_len);
	   CU_ASSERT_EQUAL(0x19,dst.param.dt_uu.info[0]);
	   CU_ASSERT_EQUAL(0x83,dst.param.dt_uu.info[1]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_USERUSER,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_USERUSER,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[69],4));
	   }
void test_aifg_ie_dt_bc_0(){//info_trans_cap==0,only octet 3a is extend
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_BEARERCAP;
	   ie.ptr=src[70];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_BEARERCAP,dst.iei);
	   //CU_ASSERT_EQUAL(4,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_bc.channel_require);
	   CU_ASSERT_EQUAL(0,dst.param.dt_bc.coding_std);
	   CU_ASSERT_EQUAL(0,dst.param.dt_bc.trans_mode);
	   CU_ASSERT_EQUAL(0,dst.param.dt_bc.info_trans_cap);
	   CU_ASSERT_EQUAL(0,dst.param.dt_bc.coding.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_bc.coding.flag);
	   CU_ASSERT_EQUAL(2,dst.param.dt_bc.speech_ver.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_bc.speech_ver.flag);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_BEARERCAP,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_BEARERCAP,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[70],3));
}

void test_aifg_ie_dt_bc(){
	//precondition
	memset(&dst,0,sizeof(dst));
	protocol=AIFG_MSG_DTAP;
	ie.iei=AIFG_IE_ID_DT_BEARERCAP;
	ie.ptr=src[71];
	//test
	
	len=aifg_ie_decode(&ie,&dst);

	//check result
	CU_ASSERT_EQUAL(AIFG_IE_ID_DT_BEARERCAP,dst.iei);
	//CU_ASSERT_EQUAL(15,len);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.channel_require);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.coding_std);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.trans_mode);
	CU_ASSERT_EQUAL(3,dst.param.dt_bc.info_trans_cap);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.compress.flag);//test flag
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.compress.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.structure.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.dupl_mode.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.confiure.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.nirr.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.establishment.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.access_id.value);
	CU_ASSERT_EQUAL(3,dst.param.dt_bc.rate_adaption.value);
	CU_ASSERT_EQUAL(2,dst.param.dt_bc.signal_protocol.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.o_itc.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.o_rate_adaption.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.hdr_nohdr.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.multi_frame.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.mode.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.lli.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.assign_or_e.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.inb_neg.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.layer1_id.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.user_info1_protocol.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.sync_async.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.num_stop_bits.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.negotiation.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.num_data_bits.value);
	CU_ASSERT_EQUAL(3,dst.param.dt_bc.user_rate.value);
	CU_ASSERT_EQUAL(2,dst.param.dt_bc.intermed_rate.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.nic_on_tx.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.nic_on_rx.value);
	CU_ASSERT_EQUAL(3,dst.param.dt_bc.parity.value);
	CU_ASSERT_EQUAL(3,dst.param.dt_bc.connection_element.value);
	CU_ASSERT_EQUAL(0,dst.param.dt_bc.modem_type.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.o_modem_type.value);
	CU_ASSERT_EQUAL(1,dst.param.dt_bc.fixed_nw_user_rate.value);
	CU_ASSERT_EQUAL(11,dst.param.dt_bc.acceptable_chennel_code.value);
	CU_ASSERT_EQUAL(7,dst.param.dt_bc.max_traffic_channel.value);
	CU_ASSERT_EQUAL(4,dst.param.dt_bc.uimi.value);
	CU_ASSERT_EQUAL(7,dst.param.dt_bc.wanted_air_if_user_rate.value);
	CU_ASSERT_EQUAL(2,dst.param.dt_bc.layer2_id.value);
	CU_ASSERT_EQUAL(6,dst.param.dt_bc.user_info2_protocol.value);  
	//test encode
	aifg_ie_encode(protocol,AIFG_IE_ID_DT_BEARERCAP,&(dst.param),buffer, 2);
	CU_ASSERT_EQUAL(AIFG_IEI_DT_BEARERCAP,buffer[0]);
	CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[71],14));
	int n=1;
	while(n<15){
		printf("%x   ",buffer[n]);
		n++;
	}
}

void test_aifg_ie_dt_cause(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CAUSE;
	   ie.ptr=src[72];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CAUSE,dst.iei);
	   //CU_ASSERT_EQUAL(6,len);
	   CU_ASSERT_EQUAL(2,dst.param.dt_cause.coding_std);
	   CU_ASSERT_EQUAL(7,dst.param.dt_cause.location);
	   CU_ASSERT_EQUAL(1,dst.param.dt_cause.recommendation.flag);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_cause.recommendation.value);
	   CU_ASSERT_EQUAL(0x16,dst.param.dt_cause.cause_value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_cause.diag_len);
	   CU_ASSERT_EQUAL(0x81,dst.param.dt_cause.diagnostic[0]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CAUSE,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_CAUSE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[72],5));
	   }
void test_aifg_ie_dt_ccCap(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CCCAP;
	   ie.ptr=src[73];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CCCAP,dst.iei);
	   //CU_ASSERT_EQUAL(3,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_ccCap.pcp);
	   CU_ASSERT_EQUAL(1,dst.param.dt_ccCap.dtmf);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CCCAP,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_CCCAP,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[73],2));
	   }
void test_aifg_ie_dt_connNum(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CONNNUM;
	   ie.ptr=src[74];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CONNNUM,dst.iei);
	   //CU_ASSERT_EQUAL(6,len);
	   CU_ASSERT_EQUAL(2,dst.param.dt_connNum.type);
	   CU_ASSERT_EQUAL(1,dst.param.dt_connNum.presentation_ind.flag);
	   CU_ASSERT_EQUAL(1,dst.param.dt_connNum.presentation_ind.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_connNum.screen_ind.flag);
	   CU_ASSERT_EQUAL(3,dst.param.dt_connNum.screen_ind.value);
	   CU_ASSERT_EQUAL(8,dst.param.dt_connNum.num_plan);
	   CU_ASSERT_EQUAL(4,dst.param.dt_connNum.num_len);
	   CU_ASSERT_EQUAL(9,dst.param.dt_connNum.number[0]);
	   CU_ASSERT_EQUAL(8,dst.param.dt_connNum.number[1]);
	   CU_ASSERT_EQUAL(7,dst.param.dt_connNum.number[2]);
	   CU_ASSERT_EQUAL(3,dst.param.dt_connNum.number[3]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CONNNUM,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_CONNNUM,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[74],5));
	   }
void test_aifg_ie_dt_connSubAddr(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CONNSUBADDR;
	   ie.ptr=src[75];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CONNSUBADDR,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0,dst.param.dt_connSubAddr.type);
	   CU_ASSERT_EQUAL(1,dst.param.dt_connSubAddr.odd_even_ind);
	   CU_ASSERT_EQUAL(2,dst.param.dt_connSubAddr.info_len);
	   CU_ASSERT_EQUAL(0x50,dst.param.dt_connSubAddr.info[0]);
	   CU_ASSERT_EQUAL(0x43,dst.param.dt_connSubAddr.info[1]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CONNSUBADDR,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_CONNSUBADDR,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[75],4));
}
void test_aifg_ie_dt_ssVer(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_SSVER;
	   ie.ptr=src[76];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_SSVER,dst.iei);
	   //CU_ASSERT_EQUAL(3,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_ssVer.info_len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_ssVer.info[0]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_SSVER,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_SSVER,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[76],2));
}
void test_aifg_ie_dt_hiComp(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_HIGHCOM;
	   ie.ptr=src[77];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_HIGHCOM,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_hiComp.coding_std.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_hiComp.coding_std.flag);
	   CU_ASSERT_EQUAL(2,dst.param.dt_hiComp.interpret.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_hiComp.interpret.flag);
	   CU_ASSERT_EQUAL(0,dst.param.dt_hiComp.presentat_method.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_hiComp.presentat_method.flag);
	   CU_ASSERT_EQUAL(0x6e,dst.param.dt_hiComp.high_layer_id.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_hiComp.high_layer_id.flag);
	   CU_ASSERT_EQUAL(0x34,dst.param.dt_hiComp.ext_high_layer_id.value);
	   CU_ASSERT_EQUAL(1,dst.param.dt_hiComp.ext_high_layer_id.flag);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_HIGHCOM,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_HIGHCOM,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[77],4));
}
void test_aifg_ie_dt_loComp(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_LOWCOM;
	   ie.ptr=src[78];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_LOWCOM,dst.iei);
	   //CU_ASSERT_EQUAL(4,len);
	   CU_ASSERT_EQUAL(2,dst.param.dt_loComp.data_len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_loComp.data[0]);
	   CU_ASSERT_EQUAL(0xde,dst.param.dt_loComp.data[1]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_LOWCOM,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_LOWCOM,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[78],3));
}
void test_aifg_ie_dt_callStat(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CALLSTAT;
	   ie.ptr=src[79];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CALLSTAT,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(3,dst.param.dt_callStat.coding_std);
	   CU_ASSERT_EQUAL(2,dst.param.dt_callStat.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CALLSTAT,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_CALLSTAT,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[79],1));
	   }
void test_aifg_ie_dt_auxStat(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_AUXSTAT;
	   ie.ptr=src[80];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_AUXSTAT,dst.iei);
	   //CU_ASSERT_EQUAL(3,len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_auxStat.hold_stat);
	   CU_ASSERT_EQUAL(2,dst.param.dt_auxStat.mpty_stat);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_AUXSTAT,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_AUXSTAT,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[80],2));
	   }
void test_aifg_ie_dt_lsaId(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_LSAID;
	   ie.ptr=src[81];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_LSAID,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0x11,dst.param.dt_lsaId.value[0]);
	   CU_ASSERT_EQUAL(0x22,dst.param.dt_lsaId.value[1]);
	   CU_ASSERT_EQUAL(0x33,dst.param.dt_lsaId.value[2]);
	   //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_LSAID,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_LSAID,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[81],4));
	   }
void test_aifg_ie_dt_rejectCause(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_REJCAUSE;
	   ie.ptr=src[82];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_REJCAUSE,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_rejectCause.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_REJCAUSE,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_REJCAUSE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[82],1));
	   }
void test_aifg_ie_dt_cmType(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CMTYPE;
	   ie.ptr=src[83];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CMTYPE,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0x0B,dst.param.dt_cmType.value);
	 //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CMTYPE,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_CMTYPE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[83],1));
	   }
void test_aifg_ie_dt_cipherKey(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CIPHERKEY;
	   ie.ptr=src[84];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CIPHERKEY,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_cipherKey.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CIPHERKEY,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_CIPHERKEY,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[84],1));
	   }
void test_aifg_ie_dt_priority()
{
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_PRIORITYLEVEL;
	   ie.ptr=src[85];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_PRIORITYLEVEL,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0x05,dst.param.dt_priority.value);
	 //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_PRIORITYLEVEL,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_PRIORITYLEVEL,buffer[0]&0xF0);
       CU_ASSERT_EQUAL(src[85][0],buffer[0]&0x0F);
}

void test_aifg_ie_dt_idType()
{
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_IDTYPE;
	   ie.ptr=src[86];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_IDTYPE,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0x03,dst.param.dt_idType.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_IDTYPE,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_IDTYPE,buffer[0]);
       CU_ASSERT_EQUAL(src[86][0],buffer[0]&0x0F);
}

void test_aifg_ie_dt_congestLevel()
{
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_CONGESTLEVEL;
	   ie.ptr=src[87];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_CONGESTLEVEL,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0x0F,dst.param.dt_congestLevel.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_CONGESTLEVEL,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_CONGESTLEVEL,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[87],1));
}

void test_aifg_ie_dt_notificationInd()
{
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_NOTIIND;
	   ie.ptr=src[88];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_NOTIIND,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x00,dst.param.dt_notificationInd.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_NOTIIND,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_NOTIIND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[88],1));}
void test_aifg_ie_dt_signal(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_SIGNAL;
	   ie.ptr=src[89];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_SIGNAL,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x08,dst.param.dt_signal.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_SIGNAL,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_SIGNAL,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[89],1));
}

void test_aifg_ie_dt_alertPattern(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_ALERTPATTERN;
	   ie.ptr=src[90];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_ALERTPATTERN,dst.iei);
	   //CU_ASSERT_EQUAL(3,len);
	   CU_ASSERT_EQUAL(0x07,dst.param.dt_alertPattern.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_ALERTPATTERN,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_ALERTPATTERN,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[90],2));
	   }
void test_aifg_ie_dt_keypad(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_KEYPAD;
	   ie.ptr=src[91];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_KEYPAD,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	   CU_ASSERT_EQUAL(0x0D,dst.param.dt_keypad.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_KEYPAD,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_KEYPAD,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[91],1));
	   }
void test_aifg_ie_dt_timeZone(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_TIMEZONE;
	   ie.ptr=src[92];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_TIMEZONE,dst.iei);
	   //CU_ASSERT_EQUAL(2,len);
	 //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_TIMEZONE,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_TIMEZONE,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[92],1));
	   }
void test_aifg_ie_dt_authRAND(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_AUTHRAND;
	   ie.ptr=src[93];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_AUTHRAND,dst.iei);
	   //CU_ASSERT_EQUAL(17,len);
	   CU_ASSERT_EQUAL(0x00,dst.param.dt_authRAND.value[0]);
	   CU_ASSERT_EQUAL(0x11,dst.param.dt_authRAND.value[1]);
	   CU_ASSERT_EQUAL(0x22,dst.param.dt_authRAND.value[2]);
	   CU_ASSERT_EQUAL(0x33,dst.param.dt_authRAND.value[3]);
	   CU_ASSERT_EQUAL(0x44,dst.param.dt_authRAND.value[4]);
	   CU_ASSERT_EQUAL(0x55,dst.param.dt_authRAND.value[5]);
	   CU_ASSERT_EQUAL(0x66,dst.param.dt_authRAND.value[6]);
	   CU_ASSERT_EQUAL(0x77,dst.param.dt_authRAND.value[7]);
	   CU_ASSERT_EQUAL(0x88,dst.param.dt_authRAND.value[8]);
	   CU_ASSERT_EQUAL(0x99,dst.param.dt_authRAND.value[9]);
	   CU_ASSERT_EQUAL(0xAA,dst.param.dt_authRAND.value[10]);
	   CU_ASSERT_EQUAL(0xBB,dst.param.dt_authRAND.value[11]);
	   CU_ASSERT_EQUAL(0xCC,dst.param.dt_authRAND.value[12]);
	   CU_ASSERT_EQUAL(0xDD,dst.param.dt_authRAND.value[13]);
	   CU_ASSERT_EQUAL(0xEE,dst.param.dt_authRAND.value[14]);
	   CU_ASSERT_EQUAL(0xFF,dst.param.dt_authRAND.value[15]);
	 //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_AUTHRAND,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_AUTHRAND,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[93],16));
	   
	   }

void test_aifg_ie_dt_authSRES(){
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_AUTHSRES;
	   ie.ptr=src[94];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_AUTHSRES,dst.iei);
	   //CU_ASSERT_EQUAL(5,len);
	   CU_ASSERT_EQUAL(0x11,dst.param.dt_authSRES.value[0]);
	   CU_ASSERT_EQUAL(0x12,dst.param.dt_authSRES.value[1]);
	   CU_ASSERT_EQUAL(0x13,dst.param.dt_authSRES.value[2]);
	   CU_ASSERT_EQUAL(0x14,dst.param.dt_authSRES.value[3]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_AUTHSRES,&(dst.param),buffer, 0);
//       CU_ASSERT_EQUAL(AIFG_IEI_DT_AUTHSRES,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[0],src[94],4));
}

void test_aifg_ie_dt_rpInd()
{
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_REPEATIND;
	   ie.ptr=src[95];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_REPEATIND,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_rpInd.value);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_REPEATIND,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_REPEATIND,buffer[0]&0xF0);
       CU_ASSERT_EQUAL(src[95][0],buffer[0]&0x0F);
}

void test_aifg_ie_dt_facility()
{
	   //precondition
	   protocol=AIFG_MSG_DTAP;
	   ie.iei=AIFG_IE_ID_DT_FACILITY;
	   ie.ptr=src[96];
	   //test
	   len=aifg_ie_decode(&ie,&dst);
   
	   //check result
	   CU_ASSERT_EQUAL(AIFG_IE_ID_DT_FACILITY,dst.iei);
	   //CU_ASSERT_EQUAL(1,len);
	   CU_ASSERT_EQUAL(0xa1,dst.param.dt_facility.components.invoke.tag);
	   CU_ASSERT_EQUAL(0x0c,dst.param.dt_facility.components.invoke.len);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.invoke.invoke_id.tag);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_facility.components.invoke.invoke_id.len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.invoke.invoke_id.id);
	   CU_ASSERT_EQUAL(0x80,dst.param.dt_facility.components.invoke.linked_id.tag);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_facility.components.invoke.linked_id.len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.invoke.linked_id.id);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.invoke.linked_id.flag);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.invoke.opCode.tag);
	   CU_ASSERT_EQUAL(0x03,dst.param.dt_facility.components.invoke.opCode.len);
	   CU_ASSERT_EQUAL(0x0a,dst.param.dt_facility.components.invoke.opCode.op[0]);
	   CU_ASSERT_EQUAL(0x0b,dst.param.dt_facility.components.invoke.opCode.op[1]);
	   CU_ASSERT_EQUAL(0x0c,dst.param.dt_facility.components.invoke.opCode.op[2]);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.invoke.param.param);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.invoke.param.flag);

	   CU_ASSERT_EQUAL(0xa2,dst.param.dt_facility.components.return_result.tag);
	   CU_ASSERT_EQUAL(0x0d,dst.param.dt_facility.components.return_result.len);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.return_result.invoke_id.tag);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_facility.components.return_result.invoke_id.len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.return_result.invoke_id.id);
	   CU_ASSERT_EQUAL(0x30,dst.param.dt_facility.components.return_result.sequence.tag);
	   CU_ASSERT_EQUAL(0x04,dst.param.dt_facility.components.return_result.sequence.len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.return_result.sequence.flag);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.return_result.opCode.tag);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.return_result.opCode.len);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.return_result.opCode.flag);
	   CU_ASSERT_EQUAL(0x0a,dst.param.dt_facility.components.return_result.opCode.op[0]);
	   CU_ASSERT_EQUAL(0x0b,dst.param.dt_facility.components.return_result.opCode.op[1]);
	   CU_ASSERT_EQUAL(0x11,dst.param.dt_facility.components.return_result.param.param[0]);
	   CU_ASSERT_EQUAL(0x22,dst.param.dt_facility.components.return_result.param.param[1]);
	   CU_ASSERT_EQUAL(0x33,dst.param.dt_facility.components.return_result.param.param[2]);
	   CU_ASSERT_EQUAL(0x44,dst.param.dt_facility.components.return_result.param.param[3]);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.return_result.param.flag);

	   CU_ASSERT_EQUAL(0xa3,dst.param.dt_facility.components.return_error.tag);
	   CU_ASSERT_EQUAL(0x09,dst.param.dt_facility.components.return_error.len);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.return_error.invoke_id.tag);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_facility.components.return_error.invoke_id.len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.return_error.invoke_id.id);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.return_error.error.tag);
	   CU_ASSERT_EQUAL(0x03,dst.param.dt_facility.components.return_error.error.len);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_facility.components.return_error.error.er[0]);
	   CU_ASSERT_EQUAL(0x09,dst.param.dt_facility.components.return_error.error.er[1]);
	   CU_ASSERT_EQUAL(0x0a,dst.param.dt_facility.components.return_error.error.er[2]);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.return_error.param.param);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.return_error.param.flag);

	   CU_ASSERT_EQUAL(0xa4,dst.param.dt_facility.components.reject.tag);
	   CU_ASSERT_EQUAL(0x06,dst.param.dt_facility.components.reject.len);
	   CU_ASSERT_EQUAL(0x02,dst.param.dt_facility.components.reject.invoke_id.tag);
	   CU_ASSERT_EQUAL(0x01,dst.param.dt_facility.components.reject.invoke_id.len);
	   CU_ASSERT_EQUAL(0xdd,dst.param.dt_facility.components.reject.invoke_id.id);
	   CU_ASSERT_EQUAL(0x80,dst.param.dt_facility.components.reject.problem.tag);
	   CU_ASSERT_EQUAL(1,dst.param.dt_facility.components.reject.problem.len);
	   CU_ASSERT_EQUAL(0x00,dst.param.dt_facility.components.reject.problem.pro[0]);
	  //test encode
       aifg_ie_encode(protocol,AIFG_IE_ID_DT_FACILITY,&(dst.param),buffer, 2);
       CU_ASSERT_EQUAL(AIFG_IEI_DT_FACILITY,buffer[0]);
       CU_ASSERT_EQUAL(0,memcmp(&buffer[1],src[96],49));
}

//////////////////////////////////////////msg test//////////////////////////////////////////

aifg_msg_t structed_msg;
aifg_msg_pre_decoded predecoded;
int msg_len;
BYTE msgsrc[][256]=
{
	{0x00,0x0b,0x01,0x0B, 0x05, 0x01, 0x08, 0x91, 0x81, 0x05, 0x01, 0x00, 0x03},//0-assignReq
	{0x00,0x1d,0x02,0x15,0x08,0x01,0x01,0x02,0x05,0x08,0x00,0x13,0x42,0x05,0x00,
	0x02,0x00,0x11,0x21,0x56,0x2c,0x03,0x2d,0x10,0x33,0x21,0x3b,0x03,0x10,0x39,0xd2},//1-assignComplete
	{0x00,0x0f,0x03, 0x04,0x01,0x09, 0x15,0x08, 0x2d,0x10, 0x2e,0x05,0x01,0x02,0x03,0x04,0x05},//2-assignFailure
	{0x00,0x08,0x40, 0x01,0x01,0x02, 0x04,0x01,0x09, 0x36,},//3-block
	{0x00,0x04,0x41, 0x01,0x01,0x02},//4-blockAck
	{0x00,0x04,0x42, 0x01,0x01,0x02},//5-unblock
	{0x00,0x04,0x43, 0x01,0x01,0x02},//6-unblockAck
	{0x00,0x25,0x11, 0x04,0x01,0x09, 0x1b, 0x1a,0x08,0x00,0x85,0x47,0x9c,0x67,0x24,0x3d,0x05,
	0x2e,0x05,0x01,0x02,0x03,0x04,0x05, 0x31,0x19, 0x33,0x21, 0x32,0x02, 
	0x3a,0X07, 0xdd,0X01,0X02,0xdd ,0X02,0X06,0X01},//7-HORequired
	{0x00,0x4c,0x10, 0x0b,0X04,0X01,0X09,0X83,0X79, 0x0a,0x01,0x01, 
	0x12,0x03,0x33,0x22,0x8d, 0x05,0x03,0x02,0x00,0x22, 0x06,0x01,0x76,
	0x01,0x01,0x02, 0x19,0x01, 0x05,0x05,0x01,0x00,0x42,0x01,0x03, 
	0x14,0x09, 0x04,0x01,0x09, 0x31,0x19, 0x33,0x21, 0x37,0x05,0x24,0x38,0x56,0x19,0x10,
	0x35, 0x39,0x03, 0x2c,0x03, 0X3a,0X07,0xdd,0X01,0X02,0xdd,0X02,0X06,0X01, 
	0x3d,0x09,0x00,0x00,0x36,0x85,0xef,0x03,0x47,0x87,0x42},//8-HORequest
	{0x00,0x14,0x12, 0x17,0x05,0x05,0x21,0x3f,0x58,0xe1, 0x21,0x56, 0x2c,0x03, 0x2d,0x10, 0x33,0x21,
	0x01,0x01,0x02, 0x3b,0x03,0x10,0x39,0xd2},//9-HORequestAck
	{0x00,0x0d,0x13, 0x17,0x05,0x05,0x21,0x3f,0x58,0xe1, 0x05,0x03,0x02,0x00,0x22},//10-HOCmd
	{0x00,0x03,0x14, 0x15,0x08},//11-HOComplete
	{0x00,0x12,0x18, 0x0e,0xfe, 0x1a,0x08,0x00,0x85,0x47,0x9c,0x67,0x24,0x3d,0x05, 0x05,0x03,0x02,0x00,0x22},//12-HOCandidtateEnq
	{0x00,0x08,0x19, 0x0e,0xfe, 0x05,0x03,0x02,0x00,0x22},//13-HOCandidateResp
	{0x00,0x0f,0x16, 0x04,0x01,0x09, 0x15,0x08, 0x2d,0x10, 0x2e,0x05,0x01,0x02,0x03,0x04,0x05},//14-HOFailure
	{0x00,0x14,0x17, 0x04,0x01,0x09, 0x05,0x03,0x02,0x00,0x22, 0x21,0x56, 0x2c,0x03,
	0x33,0x21, 0x3b,0x03,0x10,0x39,0xd2}, //15-HOPerformed
	{0x00,0x04,0x1a, 0x04,0x01,0x09},//16-HOReject
	{0x00,0x01,0x15},//17-HOSucceed
	{0x00,0x01,0x1b},//18-HODetect
	{0x00,0x0c,0x50, 0x0c,0xff, 0x1c,0x01, 0x05,0x03,0x02,0x00,0x22,0x0d,0x02},//19-resrcReq
	{0x00,0x22,0x51, 0x1c,0x01, 0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x02,0x06,0x00,0x0b,
	0x05,0x03,0x02,0x00,0x22, 0x22,0x84,0x62,0xf2,0x7e},//20-resrcInd
	{0x00,0x20,0x52, 0x08,0x08,0x49,0x06,0x20,0x12,0x75,0x21,0x07,0x94, 0x09,0X04,0X33,0X79,0X27,0X46,
	0x1a,0x08,0x00,0x85,0x47,0x9c,0x67,0x24,0x3d,0x05, 0x24,0x02, 0x38,0x06},//21-paging
	{0x00,0x04,0x22, 0x04,0x01,0x09},//22-clearReq
	{0x00,0x08,0x20, 0x07,0X02,0X08,0X02, 0x04,0x01,0x09},//23-clearCmd
	{0x00,0x04,0x30, 0x04,0x01,0x09},//24-reset
	{0x00,0x09,0x32, 0x04,0x01,0x09, 0x05,0x03,0x02,0x00,0x22},//25-overload
	{0x00,0x18,0x36, 0x25,0xdd, 0x26,0x03,0x9d,0x20,0x81, 0x27,0x34,0x97,
	0x28,0x02,0x17,0x62, 0x29,0x02,0x31,0xf2, 0x2a,0x03,0x39,0xc4,0x08},//26-mscInvokeTrace
	{0x00,0x16,0x37, 0x25,0xdd, 0x2b,0x02, 0x26,0x03,0x9d,0x20,0x81,
	0x27,0x34,0x97, 0x28,0x02,0x17,0x62, 0x2a,0x03,0x39,0xc4,0x08},//27-bscInvokeTrace
 	{0x00,0x06,0x54, 0x12,0x03,0x7e,0x67,0x82},//28-cmUpdate
 	{0x00,0x0a,0x53, 0x07,0X02,0X08,0X02, 0x0a,0x01,0x01, 0x23,0x00},//29-cipherModeCmd
 	{0x00,0x03,0x55, 0x2c,0x03},//30-cipherModeComplete
 	{0x00,0x04,0x59, 0x04,0x01,0x09},// 31-cipherModeRej
 	{0x00,0x1d,0x57, 0x05,0x03,0x02,0x00,0x22, 0x17,0x0B,0x05,0x24, 0xb1, 0x03,0x33,0x22,0x8d, 0x02,0x73,0xf2, 0x85,	//cm request
 	0x21,0x56, 0x3c,0x07,0x01,0x22,0xe4,0x31,0x57,0x69,0x83, 0x3e,0x03,0x15,0x49,0xf5},//32-completeL3Info
    {0x00,0x06,0x25, 0x18,0xc2, 0x04,0x01,0x09},//33-sapi_n_rej
    {0x00,0x07,0x34, 0x01,0x01,0x02, 0x04,0x01,0x09},//34-resetCircuit
    {0x00,0x04,0x35, 0x01,0x01,0x02},//35-resetCircuitAck
    {0x00,0x0d,0x44, 0x04,0x01,0x09, 0x01,0x01,0x02, 0x1e,0x04,0x32,0x12,0x8d,0x36},//36-circuitGrpBlk
    {0x00,0x0a,0x45, 0x01,0x01,0x02, 0x1e,0x04,0x32,0x12,0x8d,0x36},//37-circuitGrpBlkAck
   	{0x00,0x0a,0x46, 0x01,0x01,0x02, 0x1e,0x04,0x32,0x12,0x8d,0x36},//38-circuitGrpUnblk
   	{0x00,0x0a,0x47, 0x01,0x01,0x02, 0x1e,0x04,0x32,0x12,0x8d,0x36},//39-circuitGrpUnblkAck
   	{0x00,0x0a,0x26, 0x04,0x01,0x09, 0x1f,0x04,0x03,0x0a,0x38,0x89},//40-confusion
   	{0x00,0x0a,0x48, 0x01,0x01,0x02, 0x1e,0x04,0x32,0x12,0x8d,0x36},//41-unequippedCircuit
   	{0x00,0x1d,0x5a, 0x2f,0x11, 0x05,0x03,0x02,0x00,0x22, 0x1a,0x08,0x00,0x85,0x47,0x9c,0x67,0x24,0x3d,0x05,
   	0x30,0x05,0x11,0x83,0x04,0x28,0x75, 0x04,0x02,0x89,0x03},//42-loadIndication
   	{0x00,0x03,0x28, 0x18,0xc2},//43-suspend
   	{0x00,0x03,0x29, 0x18,0xc2},//44-suspend
   	{0x00,0x04,0x4e, 0x04,0x01,0x09},//45-changeCircuit
   	{0x00,0x04,0x4f, 0x01,0x01,0x02},//46-changeCircuitAck
   	{0x00,0x06,0x2a, 0x3e,0x03,0x15,0x49,0xf5},//47-locCmd
   	{0x00,0x06,0x2b, 0x3e,0x03,0x15,0x49,0xf5},//48-locReport
   	{0x00,0x01,0x31},//49-resetAck
   	{0x00,0x01,0x21},//50-clearComplete
   	{0x00,0x01,0x56},//51-queueInd
   	{0x00,0x01,0x58},//52-cmRequest

////////////dtap...............................................

	{0x01,0x00,0x0d,0x05,0x02, 0x78,0xf3,0x64,0x31,0x02, 0x17,0x02,0x73,0xf2, 0xa1, 0xa2},//53-luAccept
	{0x01,0x00,0x03,0x05,0x22, 0x02},//54-cmReject
	{0x01,0x00,0x03,0x05,0x04, 0x02},//55-luReject
 	{0x01,0x00,0x03,0x05,0x29, 0x02},//56-abort
	{0x01,0x00,0x03,0x05,0x31, 0x02},//57-mmStatus
	{0x05,0x08, 0x19, 0x78,0xf3,0x64,0x31,0x02, 0x11, 0x02,0x73,0xf2},//58-LURequest
 	{0x01,0x00,0x13,0x05,0x12, 0x01, 0X00,0X11,0X22,0X33,0X44,0X55,0X66,0X77,0X88,0X99,0XAA,0XBB,0XCC,0XDD,0XEE,0XFF},//59-authRequest
 	{0x01,0x00,0x06,0x05,0x14, 0X11,0X12,0X13,0X14},//60-authResp
 	{0x01,0x00,0x03,0x05,0x18, 0x03},//61-idRequest
 	{0x01,0x00,0x05,0x05,0x19, 0x02,0x73,0xf2},//62-idResp
 	{0x05,0x01, 0x11, 0x02,0x73,0xf2},//63-imsiDetachInd
 	{0x01,0x00,0x0a,0x05,0x1a, 0x78,0xf3,0x64,0x31,0x02, 0x02,0x73,0xf2},//64-tmsiCmd
 	{0x05,0x28, 0x01, 0x03,0x33,0x22,0x8d, 0x02,0x73,0xf2, 0x13,0x78,0xf3,0x64,0x31,0x02},//65-cmReEst_request
 	{0x05,0x24, 0x01, 0x03,0x33,0x22,0x8d, 0x02,0x73,0xf2, 0x85},//66-cmRequest
	{0x01,0x00,0x1b,0x05,0x32, 0x43,0x03,0x91,0x35,0x64, 0x45,0x03,0x91,0x35,0x64, 0x46,0xdd,
	0x47,0x07,0x04,0x12,0x0a,0x32,0x14,0xdd, 0x48,0x03,0x11,0x22,0x33},//67-mmInfo
	{0x01,0x00,0x03d,0x03,0x01, 
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x1e,0x02,0xc0,0x82, 0x7e,0x03,0x01,0x19,0x83},//68-alert
	{0x01,0x00,0x1f,0x03,0x08, 0xd1, 0x04,0x02,0x20,0x02, 0x04,0x0d,0xa3,0xca,0x1a,0x00,0xe4,0x21,0x53,0x5b,0x60,0x21,0x5f,0x47,0xc6,
	0x08,0x04,0x47,0xdd,0x96,0x81, 0x15,0x01,0x03},//69-callConfirm
	{0x01,0x00,0x42,0x03,0x02, 0xd1, 0x04,0x02,0x20,0x02, 0x04,0x02,0x20,0x02,
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x1e,0x02,0xc0,0x82, 0x85},//70-callProceed
	{0x01,0x00,0x48,0x03,0x07,
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x1e,0x02,0xc0,0x82, 0x4c,0x04,0x28,0xa3,0x89,0x37, 0x4d,0x03,0x88,0x50,0x43, 0x7e,0x03,0x01,0x19,0x83},//71-connect
	{0x01,0x00,0x06,0x03,0x0e, 0x04,0x02,0x20,0x02},//72-eSetup
	{0x01,0x00,0x0a,0x03,0x03, 0x02,0xc0,0x82, 0x7e,0x03,0x01,0x19,0x83},//73-progress
	{0x01,0x00,0x81,0x03,0x05, 0xd1, 0x04,0x02,0x20,0x02, 0x04,0x02,0x20,0x02, 
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x1e,0x02,0xc0,0x82, 0x34,0x08, 0x5c,0x04,0x28,0xa3,0x89,0x37, 0x5d,0x03,0x88,0x50,0x43, 
	0x5e,0x04,0x88,0xa3,0x89,0x37, 0x6d,0x03,0x88,0x50,0x43, 0x74,0x04,0x28,0xa3,0x89,0x37,
	0x75,0x03,0x88,0x50,0x43, 0xd1, 0x7c,0x02,0xdd,0xde, 0x7c,0x02,0xdd,0xde, 0xd1, 0x7d,0x03,0xa8,0x6e,0xb4, 
	0x7d,0x03,0xa8,0x6e,0xb4, 0x7e,0x03,0x01,0x19,0x83, 0x85, 0x19,0x01,0x02},//74-setup 
	{0x01,0x00,0x0f,0x03,0x17, 0x02,0x20,0x02, 0x7c,0x02,0xdd,0xde, 0x7d,0x03,0xa8,0x6e,0xb4, 0xa3},//75-modify
	{0x01,0x00,0x0f,0x03,0x1f, 0x02,0x20,0x02, 0x7c,0x02,0xdd,0xde, 0x7d,0x03,0xa8,0x6e,0xb4, 0xa3},//76-modifyCmp
	{0x01,0x00,0x013,0x03,0x13, 0x02,0x20,0x02, 0x04,0x47,0xdd,0x96,0x81, 0x7c,0x02,0xdd,0xde, 0x7d,0x03,0xa8,0x6e,0xb4},//77-modifyRej
	{0x01,0x00,0x07,0x03,0x10, 0x03,0x01,0x19,0x83, 0xa0},//78-userInfo
	{0x01,0x00,0x07,0x03,0x1a, 0x04,0x47,0xdd,0x96,0x81},//79-holdRej
	{0x01,0x00,0x07,0x03,0x1e, 0x04,0x47,0xdd,0x96,0x81},//80-retrieveRej
	{0x01,0x00,0x42,0x03,0x25, 0x04,0x47,0xdd,0x96,0x81, 
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x1e,0x02,0xc0,0x82, 0x7e,0x03,0x01,0x19,0x83},//81-disconnect
	{0x01,0x00,0x45,0x03,0x2d, 0x08,0x04,0x47,0xdd,0x96,0x81, 0x08,0x04,0x47,0xdd,0x96,0x81, 
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x7e,0x03,0x01,0x19,0x83},//82-release
	{0x01,0x00,0x3f,0x03,0x2a, 0x08,0x04,0x47,0xdd,0x96,0x81,  
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	0x7e,0x03,0x01,0x19,0x83},//83-releaseCmp
	{0x01,0x00,0x09,0x03,0x39, 0x0f, 0x08,0x04,0x47,0xdd,0x96,0x81},//84-congestCtrl
	{0x01,0x00,0x03,0x03,0x3e, 0x80},//85-notify
	{0x01,0x00,0x0b,0x03,0x3d, 0x04,0x47,0xdd,0x96,0x81, 0xc2, 0x24,0x01,0x86},//86-status
	{0x01,0x00,0x03,0x03,0x35, 0x0d},//87-startDTMF
	{0x01,0x00,0x03,0x03,0x36, 0x0d},//88-startDTMF_ack
	{0x01,0x00,0x07,0x03,0x37, 0x04,0x47,0xdd,0x96,0x81},//89-startDTMF_rej
	{0x01,0x00,0x02,0x03,0x0f},//90-connectAck
	{0x01,0x00,0x02,0x03,0x18},//91-hold
	{0x01,0x00,0x02,0x03,0x19},//92-holdAck
	{0x01,0x00,0x02,0x03,0x1c},//93-retrieve
	{0x01,0x00,0x02,0x03,0x1d},//94-retrieveAck
	{0x01,0x00,0x02,0x03,0x34},//95-statusEnq
	{0x01,0x00,0x02,0x03,0x31},//96-stopDTMF
	{0x01,0x00,0x02,0x03,0x32},//97-stopDTMF_ack
	{0x01,0x00,0x33,0x03,0x3a,
	0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00},//98-facility
	{0x01,0x00,0x41,0x03,0x25, 0x04,0x47,0xdd,0x96,0x81, 
	0x1c,0x30,0xa1,0x0c,0x02,0x01,0xdd,0x80,0x01,0xdd,0x02,0x03,0x0a,0x0b,0x0c,0xdd,
		0xa2,0x0d,0x02,0x01,0xdd,0x30,0x04,0x02,0x02,0x0a,0x0b,0x11,0x22,0x33,0x44,
		0xa3,0x09,0x02,0x01,0xdd,0x02,0x03,0x01,0x09,0x0a,0xdd,
		0xa4,0x06,0x02,0x01,0xdd,0x80,0x01,0x00,
	 0x7e,0x03,0x01,0x19,0x83, 0x7f,0x01,0xdd},//99-disconnect_mobileToNet
	{0x00,0x1d,0x57, 0x05,0x03,0x02,0x00,0x22, 0x17,0x10,0x06,0x27, 0x02, 0x03,0x23,0x18,0x01, 0x08,0x49,0x06,0x20,0x12,0x75,0x21,0x07,0x94,	//paging response
 	0x21,0x56, 0x3c,0x07,0x01,0x22,0xe4,0x31,0x57,0x69,0x83, 0x3e,0x03,0x15,0x49,0xf5},//100-completeL3Info-paing response
};


//bssmap..................................................

void test_aifg_msg_assignReq()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[0], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_ASSIGN_REQ;
	//channel type
	aifg_ie_decode(&(predecoded.msg.assignReq.channelType),&dst);	
	memcpy(&(structed_msg.msg.assignReq.channelType),&(dst.param.bm_channelType), sizeof(dst.param.bm_channelType));
	structed_msg.msg.assignReq.channelType.flag = 1;
	//cic
	aifg_ie_decode(&(predecoded.msg.assignReq.cic),&dst);	
	memcpy(&(structed_msg.msg.assignReq.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.assignReq.cic.flag = 1;
	
	msg_len = aifg_msg_sd_assignReq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 11);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[0][2], msg_len));		
	
}


void test_aifg_msg_assignComplete()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	

	//test
	aifg_msg_proc(msgsrc[1], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_ASSIGN_CMP;
	//cellId
	aifg_ie_decode(&(predecoded.msg.assignComplete.cellId),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.assignComplete.cellId.flag = 1;
	//chosen channel
	aifg_ie_decode(&(predecoded.msg.assignComplete.chosenChannel),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.chosenChannel),&(dst.param.bm_chosenChannel), sizeof(dst.param.bm_chosenChannel));
	structed_msg.msg.assignComplete.chosenChannel.flag = 1;
	//chosen encrypt
	aifg_ie_decode(&(predecoded.msg.assignComplete.chosenEncrypt),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.chosenEncrypt),&(dst.param.bm_chosenEncrypt), sizeof(dst.param.bm_chosenEncrypt));
	structed_msg.msg.assignComplete.chosenEncrypt.flag = 1;
	//cic
	aifg_ie_decode(&(predecoded.msg.assignComplete.cic),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.assignComplete.cic.flag = 1;
	//circuit pool
	aifg_ie_decode(&(predecoded.msg.assignComplete.circuitPool),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.circuitPool),&(dst.param.bm_circuitPool), sizeof(dst.param.bm_circuitPool));
	structed_msg.msg.assignComplete.circuitPool.flag = 1;
	//LSA id
	aifg_ie_decode(&(predecoded.msg.assignComplete.lsaId),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.lsaId),&(dst.param.bm_lsaId), sizeof(dst.param.bm_lsaId));
	structed_msg.msg.assignComplete.lsaId.flag = 1;
	//rr cause
	aifg_ie_decode(&(predecoded.msg.assignComplete.rrcause),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.rrCause),&(dst.param.bm_rrCause), sizeof(dst.param.bm_rrCause));
	structed_msg.msg.assignComplete.rrCause.flag = 1;
	//speech version
	aifg_ie_decode(&(predecoded.msg.assignComplete.speechVer),&dst);	
	memcpy(&(structed_msg.msg.assignComplete.speechVer),&(dst.param.bm_speechVer), sizeof(dst.param.bm_speechVer));
	structed_msg.msg.assignComplete.speechVer.flag = 1;
	
	msg_len = aifg_msg_sd_assignComplete(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 29);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[1][2], msg_len));	
    	
}


void test_aifg_msg_assignFailure()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[2], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_ASSIGN_FAIL;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.assignFailure.cause),&dst);	
	memcpy(&(structed_msg.msg.assignFailure.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.assignFailure.cause.flag= 1;
	
	//RR cause
	aifg_ie_decode(&(predecoded.msg.assignFailure.rrcause),&dst);	
	memcpy(&(structed_msg.msg.assignFailure.rrCause),&(dst.param.bm_rrCause), sizeof(dst.param.bm_rrCause));
	structed_msg.msg.assignFailure.rrCause.flag= 1;

	//circuit pool
	aifg_ie_decode(&(predecoded.msg.assignFailure.circuitPool),&dst);	
	memcpy(&(structed_msg.msg.assignFailure.circuitPool),&(dst.param.bm_circuitPool), sizeof(dst.param.bm_circuitPool));
	structed_msg.msg.assignFailure.circuitPool.flag= 1;

	//circuit pool list
	aifg_ie_decode(&(predecoded.msg.assignFailure.circuitPoolList),&dst);	
	memcpy(&(structed_msg.msg.assignFailure.circuitPoolList),&(dst.param.bm_circuitPoolList), sizeof(dst.param.bm_circuitPoolList));
	structed_msg.msg.assignFailure.circuitPoolList.flag= 1;
	
	msg_len = aifg_msg_sd_assignFailure(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 15);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[2][2], msg_len));	
}


void test_aifg_msg_block()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[3], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_BLOCK;
	
	//circuit identity code
	aifg_ie_decode(&(predecoded.msg.block.cic),&dst);	
	memcpy(&(structed_msg.msg.block.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.block.cic.flag= 1;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.block.cause),&dst);	
	memcpy(&(structed_msg.msg.block.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.block.cause.flag= 1;
	
	//connection release requested
	aifg_ie_decode(&(predecoded.msg.block.connectionRelReq),&dst);	
	memcpy(&(structed_msg.msg.block.connRelReq),&(dst.param.bm_connRelReq), sizeof(dst.param.bm_connRelReq));
	structed_msg.msg.block.connRelReq.flag= 1;
	
	msg_len = aifg_msg_sd_block(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 8);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[3][2], msg_len));	
}


void test_aifg_msg_blockAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	

	//test
	aifg_msg_proc(msgsrc[4], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_BLOCK_ACK;
	//circuit identity code
	aifg_ie_decode(&(predecoded.msg.blockAck.cic),&dst);	
	memcpy(&(structed_msg.msg.blockAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.blockAck.cic.flag= 1;
	
	
	msg_len = aifg_msg_sd_blockAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[4][2], msg_len));	
    	
}


void test_aifg_msg_unblock()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	

	//test
	aifg_msg_proc(msgsrc[5], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_UNBLOCK;
	//circuit identity code
	aifg_ie_decode(&(predecoded.msg.unblock.cic),&dst);	
	memcpy(&(structed_msg.msg.unblock.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.unblock.cic.flag= 1;
	
	
	msg_len = aifg_msg_sd_unblock(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[5][2], msg_len));	
    	
}


void test_aifg_msg_unblockAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[6], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_UNBLOCK_ACK;
	//circuit identity code
	aifg_ie_decode(&(predecoded.msg.unBlockAck.cic),&dst);	
	memcpy(&(structed_msg.msg.unblockAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.unblockAck.cic.flag= 1;
	
	msg_len = aifg_msg_sd_unblockAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[6][2], msg_len));	
}

void test_aifg_msg_HORequired()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[7], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_HO_REQUIRED;
	//cause
	aifg_ie_decode(&(predecoded.msg.HORequired.cause),&dst);	
	memcpy(&(structed_msg.msg.HORequired.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.HORequired.cause.flag= 1;
	//response request
	aifg_ie_decode(&(predecoded.msg.HORequired.respReq),&dst);	
	memcpy(&(structed_msg.msg.HORequired.respReq),&(dst.param.bm_respReq), sizeof(dst.param.bm_respReq));
	structed_msg.msg.HORequired.respReq.flag= 1;
	//cell identifier list
	aifg_ie_decode(&(predecoded.msg.HORequired.cellIdList),&dst);	
	memcpy(&(structed_msg.msg.HORequired.prefer_cidList),&(dst.param.bm_cellIdList), sizeof(dst.param.bm_cellIdList));
	structed_msg.msg.HORequired.prefer_cidList.flag= 1;
	//circuit pool list
	aifg_ie_decode(&(predecoded.msg.HORequired.circuitPoolList),&dst);	
	memcpy(&(structed_msg.msg.HORequired.circuitPoolList),&(dst.param.bm_circuitPoolList), sizeof(dst.param.bm_circuitPoolList));
	structed_msg.msg.HORequired.circuitPoolList.flag= 1;
	//current channel type 1
	aifg_ie_decode(&(predecoded.msg.HORequired.curChannelType1),&dst);	
	memcpy(&(structed_msg.msg.HORequired.curChannelType1),&(dst.param.bm_curChannelType1), sizeof(dst.param.bm_curChannelType1));
	structed_msg.msg.HORequired.curChannelType1.flag= 1;
	//speech verssion
	aifg_ie_decode(&(predecoded.msg.HORequired.speechVer),&dst);	
	memcpy(&(structed_msg.msg.HORequired.speechVer),&(dst.param.bm_speechVer), sizeof(dst.param.bm_speechVer));
	structed_msg.msg.HORequired.speechVer.flag= 1;
	//queueing indicator
	aifg_ie_decode(&(predecoded.msg.HORequired.queInd),&dst);	
	memcpy(&(structed_msg.msg.HORequired.queuingInd),&(dst.param.bm_queuingInd), sizeof(dst.param.bm_queuingInd));
	structed_msg.msg.HORequired.queuingInd.flag= 1;
	//old bss to new bss infomation
	aifg_ie_decode(&(predecoded.msg.HORequired.oldBssToNew),&dst);	
	memcpy(&(structed_msg.msg.HORequired.bssOldtoNew),&(dst.param.bm_bssOldtoNew), sizeof(dst.param.bm_bssOldtoNew));
	structed_msg.msg.HORequired.bssOldtoNew.flag= 1;

	msg_len = aifg_msg_sd_HORequired(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 37);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[7][2], msg_len));	
}

/*
void test_aifg_msg_HORequest()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	

	//test
	aifg_msg_proc(msgsrc[8], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_HO_REQUEST;
	//channel type 
	aifg_ie_decode(&(predecoded.msg.HORequest.channelType),&dst);	
	memcpy(&(structed_msg.msg.HORequest.channelType),&(dst.param.bm_channelType), sizeof(dst.param.bm_channelType));
	structed_msg.msg.HORequest.channelType.flag= 1;
	//encryption infomation
	aifg_ie_decode(&(predecoded.msg.HORequest.encryptInfo),&dst);	
	memcpy(&(structed_msg.msg.HORequest.encryptInfo),&(dst.param.bm_encryptInfo), sizeof(dst.param.bm_encryptInfo));
	structed_msg.msg.HORequest.encryptInfo.flag= 1;
	//classmark 2
	aifg_ie_decode(&(predecoded.msg.HORequest.cmInfo2),&dst);	
	memcpy(&(structed_msg.msg.HORequest.cmInfo.cm2),&(dst.param.bm_cmInfo2), sizeof(dst.param.bm_cmInfo2));
	structed_msg.msg.HORequest.cmInfo.cm2.flag= 1;
	//cell identifier (serving)
	aifg_ie_decode(&(predecoded.msg.HORequest.serving_cellId),&dst);	
	memcpy(&(structed_msg.msg.HORequest.servingCellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.HORequest.servingCellId.flag= 1;
	//priority
	aifg_ie_decode(&(predecoded.msg.HORequest.priority),&dst);	
	memcpy(&(structed_msg.msg.HORequest.priority),&(dst.param.bm_priority), sizeof(dst.param.bm_priority));
	structed_msg.msg.HORequest.priority.flag= 1;
	//circuit identity code
	aifg_ie_decode(&(predecoded.msg.HORequest.cic),&dst);	
	memcpy(&(structed_msg.msg.HORequest.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.HORequest.cic.flag= 1;
	//dtx flag
	aifg_ie_decode(&(predecoded.msg.HORequest.dtxFlag),&dst);	
	memcpy(&(structed_msg.msg.HORequest.dtxFlag),&(dst.param.bm_dtx), sizeof(dst.param.bm_dtx));
	structed_msg.msg.HORequest.dtxFlag.flag= 1;
	//cell identifier (target) 
	aifg_ie_decode(&(predecoded.msg.HORequest.target_cellId),&dst);	
	memcpy(&(structed_msg.msg.HORequest.targetCellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.HORequest.targetCellId.flag= 1;
	//band to be used
	aifg_ie_decode(&(predecoded.msg.HORequest.bandUsed),&dst);	
	memcpy(&(structed_msg.msg.HORequest.bandUsed),&(dst.param.bm_bandUsed), sizeof(dst.param.bm_bandUsed));
	structed_msg.msg.HORequest.bandUsed.flag= 1;
	//cause 
	aifg_ie_decode(&(predecoded.msg.HORequest.cause),&dst);	
	memcpy(&(structed_msg.msg.HORequest.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.HORequest.cause.flag= 1;
	//current channel type 1
	aifg_ie_decode(&(predecoded.msg.HORequest.curChanneltype1),&dst);	
	memcpy(&(structed_msg.msg.HORequest.curChannelType1),&(dst.param.bm_curChannelType1), sizeof(dst.param.bm_curChannelType1));
	structed_msg.msg.HORequest.curChannelType1.flag= 1;
	//speech version 
	aifg_ie_decode(&(predecoded.msg.HORequest.speechVer),&dst);	
	memcpy(&(structed_msg.msg.HORequest.speechVer),&(dst.param.bm_speechVer), sizeof(dst.param.bm_speechVer));
	structed_msg.msg.HORequest.speechVer.flag= 1;
	//group call reference
	aifg_ie_decode(&(predecoded.msg.HORequest.groupCallRef),&dst);	
	memcpy(&(structed_msg.msg.HORequest.gourpRef),&(dst.param.bm_groupRef), sizeof(dst.param.bm_groupRef));
	structed_msg.msg.HORequest.gourpRef.flag= 1;
	//talker flag 
	aifg_ie_decode(&(predecoded.msg.HORequest.talkerFlag),&dst);	
	memcpy(&(structed_msg.msg.HORequest.talkerFlag),&(dst.param.bm_talkerFlag), sizeof(dst.param.bm_talkerFlag));
	structed_msg.msg.HORequest.talkerFlag.flag= 1;
	//configuration evolution indication
	aifg_ie_decode(&(predecoded.msg.HORequest.cfgEvoInd),&dst);	
	memcpy(&(structed_msg.msg.HORequest.cfgEvoInd),&(dst.param.bm_cfgEvoInd), sizeof(dst.param.bm_cfgEvoInd));
	structed_msg.msg.HORequest.cfgEvoInd.flag= 1;
	//chosen encryption algnorithm 
	aifg_ie_decode(&(predecoded.msg.HORequest.chosenEncrypt),&dst);	
	memcpy(&(structed_msg.msg.HORequest.chosenEncrypt),&(dst.param.bm_chosenEncrypt), sizeof(dst.param.bm_chosenEncrypt));
	structed_msg.msg.HORequest.chosenEncrypt.flag= 1;
	//old bss to new bss
	aifg_ie_decode(&(predecoded.msg.HORequest.oldBssToNew),&dst);	
	memcpy(&(structed_msg.msg.HORequest.bssOldtoNew),&(dst.param.bm_bssOldtoNew), sizeof(dst.param.bm_bssOldtoNew));
	structed_msg.msg.HORequest.bssOldtoNew.flag= 1;
	//LSA infomation
	aifg_ie_decode(&(predecoded.msg.HORequest.lsaInfo),&dst);	
	memcpy(&(structed_msg.msg.HORequest.lsaInfo),&(dst.param.bm_lsaInfo), sizeof(dst.param.bm_lsaInfo));
	structed_msg.msg.HORequest.lsaInfo.flag= 1;
	
	msg_len = aifg_msg_sd_HORequest(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 76);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[8][2], msg_len));	
    	
}

void test_aifg_msg_HORequestAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	

	//test
	aifg_msg_proc(msgsrc[9], &predecoded);
	
	structed_msg.id = AIFG_MSG_ID_HO_REQ_ACK;
	//layer 3 infomation 
//	aifg_ie_decode(&(predecoded.msg.HORequestAck.l3Info),&dst);	
//	memcpy(&(structed_msg.msg.HORequestAck.l3Info),&(dst.param.bm_l3Info), sizeof(dst.param.bm_l3Info));
//	structed_msg.msg.HORequestAck.l3Info.flag= 1;
	//chosen channel
	aifg_ie_decode(&(predecoded.msg.HORequestAck.chosenChannel),&dst);	
	memcpy(&(structed_msg.msg.HORequestAck.chosenChannel),&(dst.param.bm_chosenChannel), sizeof(dst.param.bm_chosenChannel));
	structed_msg.msg.HORequestAck.chosenChannel.flag= 1;
	//chosen encryption algnorithm
	aifg_ie_decode(&(predecoded.msg.HORequestAck.chosenEncrypt),&dst);	
	memcpy(&(structed_msg.msg.HORequestAck.chosenEncrypt),&(dst.param.bm_chosenEncrypt), sizeof(dst.param.bm_chosenEncrypt));
	structed_msg.msg.HORequestAck.chosenEncrypt.flag= 1;
	//circuit pool
	aifg_ie_decode(&(predecoded.msg.HORequestAck.circuitPool),&dst);	
	memcpy(&(structed_msg.msg.HORequestAck.circuitPool),&(dst.param.bm_circuitPool), sizeof(dst.param.bm_circuitPool));
	structed_msg.msg.HORequestAck.circuitPool.flag= 1;
	//speech version
	aifg_ie_decode(&(predecoded.msg.HORequestAck.speechVer),&dst);	
	memcpy(&(structed_msg.msg.HORequestAck.speechVer),&(dst.param.bm_speechVer), sizeof(dst.param.bm_speechVer));
	structed_msg.msg.HORequestAck.speechVer.flag= 1;
	//circuit identity code
	aifg_ie_decode(&(predecoded.msg.HORequestAck.cic),&dst);	
	memcpy(&(structed_msg.msg.HORequestAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.HORequestAck.cic.flag= 1;
	//LSA identity
	aifg_ie_decode(&(predecoded.msg.HORequestAck.lsaId),&dst);	
	memcpy(&(structed_msg.msg.HORequestAck.lsaId),&(dst.param.bm_lsaId), sizeof(dst.param.bm_lsaId));
	structed_msg.msg.HORequestAck.lsaId.flag= 1;
	
	
	msg_len = aifg_msg_sd_HORequestAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 17);
	CU_ASSERT_EQUAL(0, memcmp(&buffer[1], &msgsrc[9][10], msg_len-1));	
    	
}

void test_aifg_msg_HOCmd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[10], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_CMD;

	//l3Info not be test
		
	//cell identifier 
	aifg_ie_decode(&(predecoded.msg.HOCmd.cellId),&dst);	
	memcpy(&(structed_msg.msg.HOCmd.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.HOCmd.cellId.flag= 1;
		
		
	msg_len = aifg_msg_sd_HOCmd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 6);
	CU_ASSERT_EQUAL(0, memcmp(&buffer[1], &msgsrc[10][10], msg_len-1)); 
			
}


void test_aifg_msg_HOComplete()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[11], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_CMP;

		
	//RR cause 
	aifg_ie_decode(&(predecoded.msg.HOComplete.rrcause),&dst);	
	memcpy(&(structed_msg.msg.HOComplete.rrCause),&(dst.param.bm_rrCause), sizeof(dst.param.bm_rrCause));
	structed_msg.msg.HOComplete.rrCause.flag= 1;
		
		
	msg_len = aifg_msg_sd_HOComplete(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 3);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[11][2], msg_len)); 
			
}
*/	
void test_aifg_msg_HOCandidateEnq()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[12], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_CAN_ENQ;

		
	//number of mss 
	aifg_ie_decode(&(predecoded.msg.HOCandEnq.msNum),&dst);	
	memcpy(&(structed_msg.msg.HOCandidateEnq.msNum),&(dst.param.bm_msNum), sizeof(dst.param.bm_msNum));
	structed_msg.msg.HOCandidateEnq.msNum.flag= 1;
	//cell identifier list
	aifg_ie_decode(&(predecoded.msg.HOCandEnq.cellIdList),&dst);	
	memcpy(&(structed_msg.msg.HOCandidateEnq.cidList),&(dst.param.bm_cellIdList), sizeof(dst.param.bm_cellIdList));
	structed_msg.msg.HOCandidateEnq.cidList.flag= 1;
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.HOCandEnq.cellId),&dst);	
	memcpy(&(structed_msg.msg.HOCandidateEnq.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.HOCandidateEnq.cellId.flag= 1;
		
	msg_len = aifg_msg_sd_HOCandEnq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 18);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[12][2], msg_len)); 
			
}


void test_aifg_msg_HOCandidateResp()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[13], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_CAN_RESP;

		
	//number of mss 
	aifg_ie_decode(&(predecoded.msg.HOCandResp.msNum),&dst);	
	memcpy(&(structed_msg.msg.HOCandidateResp.msNum),&(dst.param.bm_msNum), sizeof(dst.param.bm_msNum));
	structed_msg.msg.HOCandidateResp.msNum.flag= 1;
	
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.HOCandResp.cellId),&dst);	
	memcpy(&(structed_msg.msg.HOCandidateResp.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.HOCandidateResp.cellId.flag= 1;
		
	msg_len = aifg_msg_sd_HOCandResp(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 8);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[13][2], msg_len)); 
			
}


void test_aifg_msg_HOFailure()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[14], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_FAIL;

		
	//cause
	aifg_ie_decode(&(predecoded.msg.HOFailure.cause),&dst);	
	memcpy(&(structed_msg.msg.HOFailure.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.HOFailure.cause.flag= 1;
	//RR cause
	aifg_ie_decode(&(predecoded.msg.HOFailure.rrcause),&dst);	
	memcpy(&(structed_msg.msg.HOFailure.rrCause),&(dst.param.bm_rrCause), sizeof(dst.param.bm_rrCause));
	structed_msg.msg.HOFailure.rrCause.flag= 1;
	//circuit pool
	aifg_ie_decode(&(predecoded.msg.HOFailure.circuitPool),&dst);	
	memcpy(&(structed_msg.msg.HOFailure.circuitPool),&(dst.param.bm_circuitPool), sizeof(dst.param.bm_circuitPool));
	structed_msg.msg.HOFailure.circuitPool.flag= 1;
	//circuit pool list
	aifg_ie_decode(&(predecoded.msg.HOFailure.circuitPoolList),&dst);	
	memcpy(&(structed_msg.msg.HOFailure.circuitPoolList),&(dst.param.bm_circuitPoolList), sizeof(dst.param.bm_circuitPoolList));
	structed_msg.msg.HOFailure.circuitPoolList.flag= 1;
	
		
	msg_len = aifg_msg_sd_HOFailure(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 15);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[14][2], msg_len)); 
			
}


void test_aifg_msg_HOPerformed()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[15], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_PERFORMED;

		
	//cause
	aifg_ie_decode(&(predecoded.msg.HOPerformed.cause),&dst);	
	memcpy(&(structed_msg.msg.HOPerformed.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.HOPerformed.cause.flag= 1;
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.HOPerformed.cellId),&dst);	
	memcpy(&(structed_msg.msg.HOPerformed.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.HOPerformed.cellId.flag= 1;
	//chosen channel
	aifg_ie_decode(&(predecoded.msg.HOPerformed.chosenChannel),&dst);	
	memcpy(&(structed_msg.msg.HOPerformed.chosenChannel),&(dst.param.bm_chosenChannel), sizeof(dst.param.bm_chosenChannel));
	structed_msg.msg.HOPerformed.chosenChannel.flag= 1;
	//chosen encryption algnorithm
	aifg_ie_decode(&(predecoded.msg.HOPerformed.chosenEncrypt),&dst);	
	memcpy(&(structed_msg.msg.HOPerformed.chosenEncrypt),&(dst.param.bm_chosenEncrypt), sizeof(dst.param.bm_chosenEncrypt));
	structed_msg.msg.HOPerformed.chosenEncrypt.flag= 1;
	//speech version
	aifg_ie_decode(&(predecoded.msg.HOPerformed.speechVer),&dst);	
	memcpy(&(structed_msg.msg.HOPerformed.speechVer),&(dst.param.bm_speechVer), sizeof(dst.param.bm_speechVer));
	structed_msg.msg.HOPerformed.speechVer.flag= 1;
	//LSA identifier
	aifg_ie_decode(&(predecoded.msg.HOPerformed.lsaId),&dst);	
	memcpy(&(structed_msg.msg.HOPerformed.lsaId),&(dst.param.bm_lsaId), sizeof(dst.param.bm_lsaId));
	structed_msg.msg.HOPerformed.lsaId.flag= 1;
		
	msg_len = aifg_msg_sd_HOPerformed(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 20);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[15][2], msg_len)); 
			
}


void test_aifg_msg_HOReject()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[16], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_REQ_REJ;

		
	//cause
	aifg_ie_decode(&(predecoded.msg.HORequiredRej.cause),&dst);	
	memcpy(&(structed_msg.msg.HOReject.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.HOReject.cause.flag= 1;

	
	msg_len = aifg_msg_sd_HORequiredRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[16][2], msg_len)); 
			
}


void test_aifg_msg_HOSucceed()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[17], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_SUC;
	
	msg_len = aifg_msg_sd_HOSucceed(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[17][2], msg_len)); 
			
}


void test_aifg_msg_HODetect()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[18], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HO_DETECT;

	
	msg_len = aifg_msg_sd_HODetect(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[18][2], msg_len)); 
			
}



void test_aifg_msg_resrcReq()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[19], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESRC_REQ;

		
	//periodicity
	aifg_ie_decode(&(predecoded.msg.resrcReq.periodicity),&dst);	
	memcpy(&(structed_msg.msg.resourceReq.periodicity),&(dst.param.bm_periodicity), sizeof(dst.param.bm_periodicity));
	structed_msg.msg.resourceReq.periodicity.flag= 1;
	//resource indication method
	aifg_ie_decode(&(predecoded.msg.resrcReq.resrcIndMethod),&dst);	
	memcpy(&(structed_msg.msg.resourceReq.resrcIndMethod),&(dst.param.bm_resrcIndMethod), sizeof(dst.param.bm_resrcIndMethod));
	structed_msg.msg.resourceReq.resrcIndMethod.flag= 1;
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.resrcReq.cellId),&dst);	
	memcpy(&(structed_msg.msg.resourceReq.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.resourceReq.cellId.flag= 1;
	//extend resource indicator
	aifg_ie_decode(&(predecoded.msg.resrcReq.extResrcInd),&dst);	
	memcpy(&(structed_msg.msg.resourceReq.extResrcInd),&(dst.param.bm_extResrcInd), sizeof(dst.param.bm_extResrcInd));
	structed_msg.msg.resourceReq.extResrcInd.flag= 1;

	
	msg_len = aifg_msg_sd_resrcReq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 12);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[19][2], msg_len)); 
			
}


void test_aifg_msg_resrcInd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[20], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESRC_IND;
		
	//resource indication method
	aifg_ie_decode(&(predecoded.msg.resrcInd.resrcIndMethod),&dst);	
	memcpy(&(structed_msg.msg.resourceInd.resrcIndMethod),&(dst.param.bm_resrcIndMethod), sizeof(dst.param.bm_resrcIndMethod));
	structed_msg.msg.resourceInd.resrcIndMethod.flag= 1;
	
	//resource available
	aifg_ie_decode(&(predecoded.msg.resrcInd.resrcAvail),&dst);	
	memcpy(&(structed_msg.msg.resourceInd.resrcAvail),&(dst.param.bm_resrcAvail), sizeof(dst.param.bm_resrcAvail));
	structed_msg.msg.resourceInd.resrcAvail.flag= 1;
	
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.resrcInd.cellId),&dst);	
	memcpy(&(structed_msg.msg.resourceInd.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.resourceInd.cellId.flag= 1;
	
	//total resource accessable
	aifg_ie_decode(&(predecoded.msg.resrcInd.totalResrc),&dst);	
	memcpy(&(structed_msg.msg.resourceInd.totalResrc),&(dst.param.bm_totalResrc), sizeof(dst.param.bm_totalResrc));
	structed_msg.msg.resourceInd.totalResrc.flag= 1;	
	
	msg_len = aifg_msg_sd_resrcInd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 34);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[20][2], msg_len)); 			
}


void test_aifg_msg_paging()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));		
	
	//test
	aifg_msg_proc(msgsrc[21], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_PAGING;
		
	//imsi
	aifg_ie_decode(&(predecoded.msg.paging.imsi),&dst);	
	memcpy(&(structed_msg.msg.paging.imsi),&(dst.param.bm_imsi), sizeof(dst.param.bm_imsi));
	structed_msg.msg.paging.imsi.flag= 1;
	
	//tmsi
	aifg_ie_decode(&(predecoded.msg.paging.tmsi),&dst);	
	memcpy(&(structed_msg.msg.paging.tmsi),&(dst.param.bm_tmsi), sizeof(dst.param.bm_tmsi));
	structed_msg.msg.paging.tmsi.flag= 1;
	
	//cell identifier list
	aifg_ie_decode(&(predecoded.msg.paging.cellIdList),&dst);	
	memcpy(&(structed_msg.msg.paging.cidList),&(dst.param.bm_cellIdList), sizeof(dst.param.bm_cellIdList));
	structed_msg.msg.paging.cidList.flag= 1;
	
	//channel needed
	aifg_ie_decode(&(predecoded.msg.paging.channelNeeded),&dst);	
	memcpy(&(structed_msg.msg.paging.channelNeeded),&(dst.param.bm_channelNeeded), sizeof(dst.param.bm_channelNeeded));
	structed_msg.msg.paging.channelNeeded.flag= 1;
	
	//eMLPP priority
	aifg_ie_decode(&(predecoded.msg.paging.eMLPPpri),&dst);	
	memcpy(&(structed_msg.msg.paging.eMLPP),&(dst.param.bm_eMLPP), sizeof(dst.param.bm_eMLPP));
	structed_msg.msg.paging.eMLPP.flag= 1;	
	
	msg_len = aifg_msg_sd_paging(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 31);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[21][2], msg_len));		

	//for unit test
	memcpy(&bm_paging, &structed_msg, sizeof(structed_msg));	
}


void test_aifg_msg_clearReq()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[22], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CLR_REQ;

		
	//cause
	aifg_ie_decode(&(predecoded.msg.clearReq.cause),&dst);	
	memcpy(&(structed_msg.msg.clearReq.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.clearReq.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_clearReq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[22][2], msg_len)); 
				
	//for unit test use
	memcpy(&bm_clearReq, &structed_msg, sizeof(structed_msg));
}


void test_aifg_msg_clearCmd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[23], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CLR_CMD;

		
	//layer 3 header infomation
	aifg_ie_decode(&(predecoded.msg.clearCmd.l3HeaderInfo),&dst);	
	memcpy(&(structed_msg.msg.clearCmd.l3HeaderInfo),&(dst.param.bm_L3HeaderInfo), sizeof(dst.param.bm_L3HeaderInfo));
	structed_msg.msg.clearCmd.l3HeaderInfo.flag= 1;
	//cause
	aifg_ie_decode(&(predecoded.msg.clearCmd.cause),&dst);	
	memcpy(&(structed_msg.msg.clearCmd.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.clearCmd.cause.flag= 1;
	
	msg_len = aifg_msg_sd_clearCmd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 8);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[23][2], msg_len)); 

	//for unit test use
	memcpy(&bm_clearCmd, &structed_msg, sizeof(structed_msg));
}


void test_aifg_msg_reset()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[24], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESET;

		
	//cause
	aifg_ie_decode(&(predecoded.msg.reset.cause),&dst);	
	memcpy(&(structed_msg.msg.reset.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.reset.cause.flag= 1;
	
	msg_len = aifg_msg_sd_reset(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[24][2], msg_len)); 
			
}

void test_aifg_msg_overload()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	//test
	aifg_msg_proc(msgsrc[25], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_OVERLOAD;

		
	//cause
	aifg_ie_decode(&(predecoded.msg.overload.cause),&dst);	
	memcpy(&(structed_msg.msg.overload.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.overload.cause.flag= 1;
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.overload.cellId),&dst);	
	memcpy(&(structed_msg.msg.overload.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.overload.cellId.flag= 1;
	
	msg_len = aifg_msg_sd_overload(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 9);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[25][2], msg_len)); 
			
}

void test_aifg_msg_mscInvokeTrace()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	//test
	aifg_msg_proc(msgsrc[26], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_MSC_INVK_TRACE;

	//trace type
	aifg_ie_decode(&(predecoded.msg.mscTrace.traceType),&dst);	
	memcpy(&(structed_msg.msg.mscInvokeTrace.traceType),&(dst.param.bm_traceType), sizeof(dst.param.bm_traceType));
	structed_msg.msg.mscInvokeTrace.traceType.flag= 1;
	//triggerid
	aifg_ie_decode(&(predecoded.msg.mscTrace.triggerId),&dst);	
	memcpy(&(structed_msg.msg.mscInvokeTrace.tiggerId),&(dst.param.bm_triggerId), sizeof(dst.param.bm_triggerId));
	structed_msg.msg.mscInvokeTrace.tiggerId.flag= 1;
	//trace reference
	aifg_ie_decode(&(predecoded.msg.mscTrace.traceRef),&dst);	
	memcpy(&(structed_msg.msg.mscInvokeTrace.traceRef),&(dst.param.bm_traceRef), sizeof(dst.param.bm_traceRef));
	structed_msg.msg.mscInvokeTrace.traceRef.flag= 1;
	//transactionid
	aifg_ie_decode(&(predecoded.msg.mscTrace.transId),&dst);	
	memcpy(&(structed_msg.msg.mscInvokeTrace.transId),&(dst.param.bm_transId), sizeof(dst.param.bm_transId));
	structed_msg.msg.mscInvokeTrace.transId.flag= 1;
	//mobile identity
	aifg_ie_decode(&(predecoded.msg.mscTrace.mobileId),&dst);	
	memcpy(&(structed_msg.msg.mscInvokeTrace.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	structed_msg.msg.mscInvokeTrace.mobileId.flag= 1;
	//OMCId
	aifg_ie_decode(&(predecoded.msg.mscTrace.omcId),&dst);	
	memcpy(&(structed_msg.msg.mscInvokeTrace.omcId),&(dst.param.bm_omcId), sizeof(dst.param.bm_omcId));
	structed_msg.msg.mscInvokeTrace.omcId.flag= 1;
	
	msg_len = aifg_msg_sd_mscTrace(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 24);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[26][2], msg_len)); 
}

void test_aifg_msg_bscInvokeTrace()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[27], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_BSC_INVK_TRACE;
		
	//trace type
	aifg_ie_decode(&(predecoded.msg.bscTrace.traceType),&dst);	
	memcpy(&(structed_msg.msg.bscInvokeTrace.traceType),&(dst.param.bm_traceType), sizeof(dst.param.bm_traceType));
	structed_msg.msg.bscInvokeTrace.traceType.flag= 1;
	//triggerid
	aifg_ie_decode(&(predecoded.msg.bscTrace.triggerId),&dst);	
	memcpy(&(structed_msg.msg.bscInvokeTrace.tiggerId),&(dst.param.bm_triggerId), sizeof(dst.param.bm_triggerId));
	structed_msg.msg.bscInvokeTrace.tiggerId.flag= 1;
	//trace reference
	aifg_ie_decode(&(predecoded.msg.bscTrace.traceRef),&dst);	
	memcpy(&(structed_msg.msg.bscInvokeTrace.traceRef),&(dst.param.bm_traceRef), sizeof(dst.param.bm_traceRef));
	structed_msg.msg.bscInvokeTrace.traceRef.flag= 1;
	//transactionid
	aifg_ie_decode(&(predecoded.msg.bscTrace.transId),&dst);	
	memcpy(&(structed_msg.msg.bscInvokeTrace.transId),&(dst.param.bm_transId), sizeof(dst.param.bm_transId));
	structed_msg.msg.bscInvokeTrace.transId.flag= 1;
	//forward indicator
	aifg_ie_decode(&(predecoded.msg.bscTrace.forwardInd),&dst);	
	memcpy(&(structed_msg.msg.bscInvokeTrace.forwardInd),&(dst.param.bm_fowardInd), sizeof(dst.param.bm_fowardInd));
	structed_msg.msg.bscInvokeTrace.forwardInd.flag= 1;
	//OMCId
	aifg_ie_decode(&(predecoded.msg.bscTrace.omcId),&dst);	
	memcpy(&(structed_msg.msg.bscInvokeTrace.omcId),&(dst.param.bm_omcId), sizeof(dst.param.bm_omcId));
	structed_msg.msg.bscInvokeTrace.omcId.flag= 1;
	
	msg_len = aifg_msg_sd_bscTrace(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 22);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[27][2], msg_len)); 
}


void test_aifg_msg_cmUpdate()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	//test
	aifg_msg_proc(msgsrc[28], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CM_UPDATE;

	//classmark information type 2
	aifg_ie_decode(&(predecoded.msg.cmUpdate.cmInfo2),&dst);	
	memcpy(&(structed_msg.msg.cmUpdate.cm2),&(dst.param.bm_cmInfo2), sizeof(dst.param.bm_cmInfo2));
	structed_msg.msg.cmUpdate.cm2.flag= 1;
	//classmark information type 3 not be tested
	
	msg_len = aifg_msg_sd_cmUpdate(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[28][2], msg_len)); 
}


void test_aifg_msg_cipherModeCmd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[29], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CIPHER_MODE_CMD;
		
	//layer 3 header infomation
	aifg_ie_decode(&(predecoded.msg.cipherModeCmd.l3HeaderInfo),&dst);	
	memcpy(&(structed_msg.msg.cipherModeCmd.l3HeaderInfo),&(dst.param.bm_L3HeaderInfo), sizeof(dst.param.bm_L3HeaderInfo));
	structed_msg.msg.cipherModeCmd.l3HeaderInfo.flag= 1;
	//encryption information
	aifg_ie_decode(&(predecoded.msg.cipherModeCmd.encryptInfo),&dst);	
	memcpy(&(structed_msg.msg.cipherModeCmd.encryptInfo),&(dst.param.bm_encryptInfo), sizeof(dst.param.bm_encryptInfo));
	structed_msg.msg.cipherModeCmd.encryptInfo.flag= 1;
	//cipher response mode
	aifg_ie_decode(&(predecoded.msg.cipherModeCmd.cipherRespMode),&dst);	
	memcpy(&(structed_msg.msg.cipherModeCmd.cipherRespMode),&(dst.param.bm_cipherRespMode), sizeof(dst.param.bm_cipherRespMode));
	structed_msg.msg.cipherModeCmd.cipherRespMode.flag= 1;
	
	msg_len = aifg_msg_sd_cipherModeCmd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[29][2], msg_len)); 
}


void test_aifg_msg_cipherModeComplete()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[30], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CIPHER_MODE_CMP;

		
	//layer 3 message contents not be tested because not done in the ie_decode&ie_encode
	
	//chosen encryption algorithm
	aifg_ie_decode(&(predecoded.msg.cipherModeComp.chosenEncrypt),&dst);	
	memcpy(&(structed_msg.msg.cipherModeComplete.chosenEncrypt),&(dst.param.bm_chosenEncrypt), sizeof(dst.param.bm_chosenEncrypt));
	structed_msg.msg.cipherModeComplete.chosenEncrypt.flag= 1;
	
	
	msg_len = aifg_msg_sd_cipherModeComplete(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 3);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[30][2], msg_len)); 
			
}


void test_aifg_msg_cipherModeReject()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[31], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CIPHER_MODE_REJ;

	
	//cause
	aifg_ie_decode(&(predecoded.msg.cipherModeRej.cause),&dst);	
	memcpy(&(structed_msg.msg.cipherModeReject.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.cipherModeReject.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_cipherModeRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[31][2], msg_len)); 
			
}

void test_aifg_msg_completeL3Info()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	memset(&l3Info,0,sizeof(l3Info));
	
	//test
	aifg_msg_proc(msgsrc[32], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_L3_INFO;
	
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.completeL3Info.cellId),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.completeL3Info.cellId.flag= 1;
	
	//layer 3 infomation
		//CM service type
		structed_msg.msg.completeL3Info.l3Info.ptr = &msgsrc[32][10];
		structed_msg.msg.completeL3Info.l3Info.len = 11;
/*
		l3Info.id = AIFG_MSG_ID_CM_REQUEST;
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.cmRequest.type),&dst);	
		memcpy(&(l3Info.msg.cmRequest.cmType),&(dst.param.dt_cmType), sizeof(dst.param.dt_cmType));
		l3Info.msg.cmRequest.cmType.flag= 1;
		
		//ciphering key sequence number
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.cmRequest.cipherKeySeq),&dst);	
		memcpy(&(l3Info.msg.cmRequest.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
		l3Info.msg.cmRequest.cipherKey.flag= 1;
		//mobile station classmark 2
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.cmRequest.cm2),&dst);	
		memcpy(&(l3Info.msg.cmRequest.cmInfo2),&(dst.param.dt_cmInfo2), sizeof(dst.param.dt_cmInfo2));
		l3Info.msg.cmRequest.cmInfo2.flag= 1;
		
		//mobile identity
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.cmRequest.mobileId),&dst);	
		memcpy(&(l3Info.msg.cmRequest.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
		l3Info.msg.cmRequest.mobileId.flag= 1;
		
		//priority level
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.cmRequest.priority),&dst);	
		memcpy(&(l3Info.msg.cmRequest.priority),&(dst.param.dt_priority), sizeof(dst.param.dt_priority));
		l3Info.msg.cmRequest.priority.flag= 1;

		memcpy(&(structed_msg.msg.completeL3Info.l3Info), &l3Info, sizeof(l3Info));
*/
	
	//chosen channel
	aifg_ie_decode(&(predecoded.msg.completeL3Info.chosenChannel),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.chosenChannel),&(dst.param.bm_chosenChannel), sizeof(dst.param.bm_chosenChannel));
	structed_msg.msg.completeL3Info.chosenChannel.flag= 1;
	
	//LSA identity list
	aifg_ie_decode(&(predecoded.msg.completeL3Info.lsaIdList),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.lsaIdList),&(dst.param.bm_lsaIdList), sizeof(dst.param.bm_lsaIdList));
	structed_msg.msg.completeL3Info.lsaIdList.flag= 1;
	
	//location information
	aifg_ie_decode(&(predecoded.msg.completeL3Info.locInfo),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.locInfo),&(dst.param.bm_locInfo), sizeof(dst.param.bm_locInfo));
	structed_msg.msg.completeL3Info.locInfo.flag= 1;

	msg_len = aifg_msg_sd_completeL3Info(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 35);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[32][2],35)); 	

	//for unit test use
	memcpy(&bm_completeL3, &structed_msg, sizeof(structed_msg));
}


void test_aifg_msg_SAPI_n_Reject()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[33], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_SAPI_REJ;

	
	//dlci
	aifg_ie_decode(&(predecoded.msg.sapi_n_rej.dlci),&dst);	
	memcpy(&(structed_msg.msg.SAPI_n_Reject.dlci),&(dst.param.bm_dlci), sizeof(dst.param.bm_dlci));
	structed_msg.msg.SAPI_n_Reject.dlci.flag= 1;
	//cause
	aifg_ie_decode(&(predecoded.msg.sapi_n_rej.cause),&dst);	
	memcpy(&(structed_msg.msg.SAPI_n_Reject.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.SAPI_n_Reject.cause.flag= 1;
	
	
	
	msg_len = aifg_msg_sd_sapi_n_rej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[33][2], msg_len)); 
			
}

void test_aifg_msg_resetCircuit()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[34], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESET_CC;

	
	//circuit identifier code
	aifg_ie_decode(&(predecoded.msg.resetCircuit.cic),&dst);
	memcpy(&(structed_msg.msg.resetCircuit.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.resetCircuit.cic.flag= 1;
	//cause
	aifg_ie_decode(&(predecoded.msg.resetCircuit.cause),&dst);
	memcpy(&(structed_msg.msg.resetCircuit.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.resetCircuit.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_resetCircuit(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 7);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[34][2], msg_len)); 
			
}


void test_aifg_msg_resetCircuitAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[35], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESET_CC_ACK;

	//circuit identifier code
	aifg_ie_decode(&(predecoded.msg.resetCircuitAck.cic),&dst);	
	memcpy(&(structed_msg.msg.resetCircuitAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.resetCircuitAck.cic.flag= 1;
	
	msg_len = aifg_msg_sd_resetCircuitAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[35][2], msg_len)); 
}


void test_aifg_msg_circuitGrpBlk()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[36], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CC_GROUP_BLK;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.ccGroupBlock.cause),&dst);	
	memcpy(&(structed_msg.msg.ccGroupBlock.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.ccGroupBlock.cause.flag= 1;
	
	//cic
	aifg_ie_decode(&(predecoded.msg.ccGroupBlock.cic),&dst);	
	memcpy(&(structed_msg.msg.ccGroupBlock.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.ccGroupBlock.cic.flag= 1;
	
	//cic list
	aifg_ie_decode(&(predecoded.msg.ccGroupBlock.cicList),&dst);	
	memcpy(&(structed_msg.msg.ccGroupBlock.cicList),&(dst.param.bm_cicList), sizeof(dst.param.bm_cicList));
	structed_msg.msg.ccGroupBlock.cicList.flag= 1;
	
	msg_len = aifg_msg_sd_ccGrpBlk(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,13);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[36][2], msg_len)); 
}

void test_aifg_msg_circuitGrpBlkAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[37], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CC_GROUP_BLK_ACK;

	
	//cic
	aifg_ie_decode(&(predecoded.msg.ccGroupBlockAck.cic),&dst);	
	memcpy(&(structed_msg.msg.ccGroupBlockAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.ccGroupBlockAck.cic.flag= 1;
	
	//cic list
	aifg_ie_decode(&(predecoded.msg.ccGroupBlockAck.cicList),&dst);	
	memcpy(&(structed_msg.msg.ccGroupBlockAck.cicList),&(dst.param.bm_cicList), sizeof(dst.param.bm_cicList));
	structed_msg.msg.ccGroupBlockAck.cicList.flag= 1;
	
	msg_len = aifg_msg_sd_ccGroupBlockAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[37][2], msg_len)); 
			
}

void test_aifg_msg_circuitGrpUnblk()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[38], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CC_GROUP_UNBLK;

	
	//cic
	aifg_ie_decode(&(predecoded.msg.ccGroupUnblock.cic),&dst);	
	memcpy(&(structed_msg.msg.ccGroupUnblock.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.ccGroupUnblock.cic.flag= 1;
	
	//cic list
	aifg_ie_decode(&(predecoded.msg.ccGroupUnblock.cicList),&dst);	
	memcpy(&(structed_msg.msg.ccGroupUnblock.cicList),&(dst.param.bm_cicList), sizeof(dst.param.bm_cicList));
	structed_msg.msg.ccGroupUnblock.cicList.flag= 1;
	
	msg_len = aifg_msg_sd_ccGroupUnblock(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[38][2], msg_len)); 
			
}

void test_aifg_msg_circuitGrpUnblkAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[39], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CC_GROUP_UNBLK_ACK;

	
	//cic
	aifg_ie_decode(&(predecoded.msg.ccGroupUnblockAck.cic),&dst);	
	memcpy(&(structed_msg.msg.ccGroupUnblockAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.ccGroupUnblockAck.cic.flag= 1;
	
	//cic list
	aifg_ie_decode(&(predecoded.msg.ccGroupUnblockAck.cicList),&dst);	
	memcpy(&(structed_msg.msg.ccGroupUnblockAck.cicList),&(dst.param.bm_cicList), sizeof(dst.param.bm_cicList));
	structed_msg.msg.ccGroupUnblockAck.cicList.flag= 1;
	
	msg_len = aifg_msg_sd_ccGroupUnblockAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[39][2], msg_len)); 
			
}

void test_aifg_msg_confusion()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[40], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CONFUSION;

	
	//cause
	aifg_ie_decode(&(predecoded.msg.confusion.cause),&dst);	
	memcpy(&(structed_msg.msg.confusion.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.confusion.cause.flag= 1;
	
	//diagnostics
	aifg_ie_decode(&(predecoded.msg.confusion.diagnostics),&dst);	
	memcpy(&(structed_msg.msg.confusion.diagnostics),&(dst.param.bm_diagnostics), sizeof(dst.param.bm_diagnostics));
	structed_msg.msg.confusion.diagnostics.flag= 1;
	
	msg_len = aifg_msg_sd_confusion(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[40][2], msg_len)); 
			
}

void test_aifg_msg_unequippedCircuit()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[41], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_UNEQUIP_CC;

	
	//cic
	aifg_ie_decode(&(predecoded.msg.upequipCircuit.cic),&dst);	
	memcpy(&(structed_msg.msg.unequippedCircuit.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.unequippedCircuit.cic.flag= 1;
	
	//cic list
	aifg_ie_decode(&(predecoded.msg.upequipCircuit.cicList),&dst);	
	memcpy(&(structed_msg.msg.unequippedCircuit.cicList),&(dst.param.bm_cicList), sizeof(dst.param.bm_cicList));
	structed_msg.msg.unequippedCircuit.cicList.flag= 1;
	
	msg_len = aifg_msg_sd_unequippedCircuit(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[41][2], msg_len)); 
			
}

void test_aifg_msg_loadIndication()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[42], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_LOAD_IND;

	
	//time indication
	aifg_ie_decode(&(predecoded.msg.loadInd.timeInd),&dst);	
	memcpy(&(structed_msg.msg.loadInd.timeInd),&(dst.param.bm_timeId), sizeof(dst.param.bm_timeId));
	structed_msg.msg.loadInd.timeInd.flag= 1;
	//cell identity
	aifg_ie_decode(&(predecoded.msg.loadInd.cellId),&dst);	
	memcpy(&(structed_msg.msg.loadInd.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.loadInd.cellId.flag= 1;
	//cell identity list
	aifg_ie_decode(&(predecoded.msg.loadInd.cellIdList),&dst);	
	memcpy(&(structed_msg.msg.loadInd.cidList),&(dst.param.bm_cellIdList), sizeof(dst.param.bm_cellIdList));
	structed_msg.msg.loadInd.cidList.flag= 1;
	//resource situation
	aifg_ie_decode(&(predecoded.msg.loadInd.resrcSit),&dst);	
	memcpy(&(structed_msg.msg.loadInd.resrcSit),&(dst.param.bm_resrcSit), sizeof(dst.param.bm_resrcSit));
	structed_msg.msg.loadInd.resrcSit.flag= 1;
	//cause
	aifg_ie_decode(&(predecoded.msg.loadInd.cause),&dst);	
	memcpy(&(structed_msg.msg.loadInd.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.loadInd.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_loadInd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,29);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[42][2], msg_len)); 
			
}

void test_aifg_msg_suspend()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[43], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_SUSPEND;

	
	//dlci
	aifg_ie_decode(&(predecoded.msg.suspend.dlci),&dst);	
	memcpy(&(structed_msg.msg.suspend.dlci),&(dst.param.bm_dlci), sizeof(dst.param.bm_dlci));
	structed_msg.msg.suspend.dlci.flag= 1;
	
	
	msg_len = aifg_msg_sd_suspend(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,3);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[43][2], msg_len)); 
			
}

void test_aifg_msg_resume()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[44], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESUME;

	
	//dlci
	aifg_ie_decode(&(predecoded.msg.resume.dlci),&dst);	
	memcpy(&(structed_msg.msg.resume.dlci),&(dst.param.bm_dlci), sizeof(dst.param.bm_dlci));
	structed_msg.msg.resume.dlci.flag= 1;
	
	
	msg_len = aifg_msg_sd_resume(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,3);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[44][2], msg_len)); 
			
}

void test_aifg_msg_changeCircuit()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[45], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CHANGE_CC;

	
	//cause
	aifg_ie_decode(&(predecoded.msg.changeCC.cause),&dst);	
	memcpy(&(structed_msg.msg.changeCircuit.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.changeCircuit.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_changeCircuit(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[45][2], msg_len)); 
			
}

void test_aifg_msg_changeCCAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[46], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CHANGE_CC_ACK;

	
	//cic
	aifg_ie_decode(&(predecoded.msg.changeCCAck.circuitId),&dst);	
	memcpy(&(structed_msg.msg.changeCircuitAck.cic),&(dst.param.bm_cic), sizeof(dst.param.bm_cic));
	structed_msg.msg.changeCircuitAck.cic.flag= 1;
	
	
	msg_len = aifg_msg_sd_changeCircuitAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[46][2], msg_len)); 
			
}

void test_aifg_msg_locCmd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[47], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_LOC_INFO_CMD;

	
	//location information
	aifg_ie_decode(&(predecoded.msg.locInfoCmd.locInfo),&dst);	
	memcpy(&(structed_msg.msg.locCmd.locInfo),&(dst.param.bm_locInfo), sizeof(dst.param.bm_locInfo));
	structed_msg.msg.locCmd.locInfo.flag= 1;
	
	
	msg_len = aifg_msg_sd_locCmd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[47][2], msg_len)); 
			
}

void test_aifg_msg_locReport()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[48], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_LOC_INFO_RPT;


	//location information
	aifg_ie_decode(&(predecoded.msg.locInfoReport.locInfo),&dst);	
	memcpy(&(structed_msg.msg.locReport.locInfo),&(dst.param.bm_locInfo), sizeof(dst.param.bm_locInfo));
	structed_msg.msg.locReport.locInfo.flag= 1;
	
	/*/cause
	aifg_ie_decode(&(predecoded.msg.locInfoReport.cause),&dst);	
	memcpy(&(structed_msg.msg.locReport.cause),&(dst.param.bm_cause), sizeof(dst.param.bm_cause));
	structed_msg.msg.locReport.cause.flag= 1;*/
	
	msg_len = aifg_msg_sd_locReport(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[48][2], msg_len)); 
			
}

void test_aifg_msg_resetAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[49], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RESET_ACK;
	
	msg_len = aifg_msg_sd_resetAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[49][2], msg_len)); 
			
}

void test_aifg_msg_clearComplete()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[50], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CLR_CMP;
	
	msg_len = aifg_msg_sd_clearComplete(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[50][2], msg_len)); 
			
}

void test_aifg_msg_queueInd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[51], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_QUEUE_IND;
	
	msg_len = aifg_msg_sd_queueInd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[51][2], msg_len)); 
			
}

void test_aifg_msg_cmkRequest()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[52], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CLASSMARK_REQ;
	
	msg_len = aifg_msg_sd_classmarkReq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[52][2], msg_len)); 
			
}

///////////////dtap msg ////////////////////////////////////////////////////////////
void test_aifg_msg_luAccept()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[53], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_LU_ACCEPT;

	//location area identification
	aifg_ie_decode(&(predecoded.msg.luAccept.lai),&dst);	
	memcpy(&(structed_msg.msg.luAccept.lai),&(dst.param.dt_lai), sizeof(dst.param.dt_lai));
	structed_msg.msg.luAccept.lai.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecoded.msg.luAccept.mobileId),&dst);	
	memcpy(&(structed_msg.msg.luAccept.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	structed_msg.msg.luAccept.mobileId.flag= 1;

	//follow on proceed
	aifg_ie_decode(&(predecoded.msg.luAccept.followOnProc),&dst);	
	memcpy(&(structed_msg.msg.luAccept.followOnProceed),&(dst.param.dt_followOnProceed), sizeof(dst.param.dt_followOnProceed));
	structed_msg.msg.luAccept.followOnProceed.flag= 1;

	//CTS permission
	aifg_ie_decode(&(predecoded.msg.luAccept.ctsPerm),&dst);	
	memcpy(&(structed_msg.msg.luAccept.CTSPermission),&(dst.param.dt_CTSPermission), sizeof(dst.param.dt_CTSPermission));
	structed_msg.msg.luAccept.CTSPermission.flag= 1;
	
	msg_len = aifg_msg_sd_luAccept(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,12);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[53][4], msg_len)); 			
}

void test_aifg_msg_cmReject()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[54], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CM_REJECT;


	//reject cause
	aifg_ie_decode(&(predecoded.msg.cmRej.rejCause),&dst);	
	memcpy(&(structed_msg.msg.cmReject.rejectCause),&(dst.param.dt_rejectCause), sizeof(dst.param.dt_rejectCause));
	structed_msg.msg.cmReject.rejectCause.flag= 1;
	
	
	msg_len = aifg_msg_sd_cmRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[54][4], msg_len)); 
			
}

void test_aifg_msg_luReject()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[55], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_LU_REJECT;

	//reject cause
	aifg_ie_decode(&(predecoded.msg.luReject.rejCause),&dst);	
	memcpy(&(structed_msg.msg.luReject.rejectCause),&(dst.param.dt_rejectCause), sizeof(dst.param.dt_rejectCause));
	structed_msg.msg.luReject.rejectCause.flag= 1;
	
	msg_len = aifg_msg_sd_luReject(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[55][4], msg_len)); 		
}

void test_aifg_msg_abort()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[56], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_ABORT;


	//reject cause
	aifg_ie_decode(&(predecoded.msg.abort.rejCause),&dst);	
	memcpy(&(structed_msg.msg.abort.rejectCause),&(dst.param.dt_rejectCause), sizeof(dst.param.dt_rejectCause));
	structed_msg.msg.abort.rejectCause.flag= 1;
	
	
	msg_len = aifg_msg_sd_abort(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[56][4], msg_len)); 
			
}

void test_aifg_msg_mmStatus()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[57], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_MM_STATUS;


	//reject cause
	aifg_ie_decode(&(predecoded.msg.mmStatus.rejCause),&dst);	
	memcpy(&(structed_msg.msg.mmStatus.rejectCause),&(dst.param.dt_rejectCause), sizeof(dst.param.dt_rejectCause));
	structed_msg.msg.mmStatus.rejectCause.flag= 1;
	
	
	msg_len = aifg_msg_sd_mmStatus(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[57][4], msg_len)); 
			
}

void test_aifg_msg_luRequest()
{
	memset(&l3Info,0,sizeof(l3Info));
	memset(&predecode_l3msg,0,sizeof(predecode_l3msg));
		
	//test
	aifg_msg_decode_embeded_l3msg(msgsrc[58], &predecode_l3msg);
		
	l3Info.id = AIFG_MSG_ID_LU_REQUEST;

	//location updating type
	aifg_ie_decode(&(predecode_l3msg.msg.luRequest.type),&dst);	
	memcpy(&(l3Info.msg.luRequest.luType),&(dst.param.dt_luType), sizeof(dst.param.dt_luType));
	l3Info.msg.luRequest.luType.flag= 1;
	
	//ciphering key sequence number
	aifg_ie_decode(&(predecode_l3msg.msg.luRequest.cipherKeySeq),&dst);	
	memcpy(&(l3Info.msg.luRequest.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
	l3Info.msg.luRequest.cipherKey.flag= 1;
	
	//location area identification
	aifg_ie_decode(&(predecode_l3msg.msg.luRequest.lai),&dst);	
	memcpy(&(l3Info.msg.luRequest.lai),&(dst.param.dt_lai), sizeof(dst.param.dt_lai));
	l3Info.msg.luRequest.lai.flag= 1;
	
	//mobile station classmark 1
	aifg_ie_decode(&(predecode_l3msg.msg.luRequest.cm1),&dst);	
	memcpy(&(l3Info.msg.luRequest.cmInfo1),&(dst.param.dt_cmInfo1), sizeof(dst.param.dt_cmInfo1));
	l3Info.msg.luRequest.cmInfo1.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecode_l3msg.msg.luRequest.mobileId),&dst);	
	memcpy(&(l3Info.msg.luRequest.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	l3Info.msg.luRequest.mobileId.flag= 1;
	
	msg_len = aifg_msg_encode_embeded_l3msg(&l3Info, buffer);
	CU_ASSERT_EQUAL(msg_len,12);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[58][0], msg_len)); 
}


void test_aifg_msg_authRequest ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[59], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_AUTH_REQUEST;
 
	//ciphering key sequence number
	aifg_ie_decode(&(predecoded.msg.authReq.cipherKeySeq),&dst);	
	memcpy(&(structed_msg.msg.authRequest.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
	structed_msg.msg.authRequest.cipherKey.flag= 1;
	
	//authentication parameter RAND
	aifg_ie_decode(&(predecoded.msg.authReq.authParamRAND),&dst);	
	memcpy(&(structed_msg.msg.authRequest.authRAND),&(dst.param.dt_authRAND), sizeof(dst.param.dt_authRAND));
	structed_msg.msg.authRequest.authRAND.flag= 1;
	
	msg_len = aifg_msg_sd_authReq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,18);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[59][4], msg_len));  
}

void test_aifg_msg_authResp ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[60], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_AUTH_RESPONSE;


	//authentication parameter SRES
	aifg_ie_decode(&(predecoded.msg.authResp.authParamSRES),&dst);	
	memcpy(&(structed_msg.msg.authResp.authSRES),&(dst.param.dt_authSRES), sizeof(dst.param.dt_authSRES));
	structed_msg.msg.authResp.authSRES.flag= 1;
	
	msg_len = aifg_msg_sd_authResp(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,5);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[60][4], msg_len)); 
			
}

void test_aifg_msg_idRequest ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[61], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_ID_REQUEST;


	//identity type
	aifg_ie_decode(&(predecoded.msg.idReq.type),&dst);	
	memcpy(&(structed_msg.msg.idRequest.idType),&(dst.param.dt_idType), sizeof(dst.param.dt_idType));
	structed_msg.msg.idRequest.idType.flag= 1;
	
	msg_len = aifg_msg_sd_idReq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[61][4], msg_len)); 
			
}

void test_aifg_msg_idResp ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[62], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_ID_RESPONSE;


	//mobile identity
	aifg_ie_decode(&(predecoded.msg.idResp.mobileId),&dst);	
	memcpy(&(structed_msg.msg.idResp.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	structed_msg.msg.idResp.mobileId.flag= 1;
	
	msg_len = aifg_msg_sd_idResp(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,4);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[62][4], msg_len)); 
			
}

void test_aifg_msg_imsiDetachInd ()
{
	memset(&l3Info,0,sizeof(l3Info));
	memset(&predecode_l3msg,0,sizeof(predecode_l3msg));
	
	//test
	aifg_msg_decode_embeded_l3msg(msgsrc[63], &predecode_l3msg);
		
	l3Info.id = AIFG_MSG_ID_IMSI_DETACH_IND;

	//mobile station classmark 1
	aifg_ie_decode(&(predecode_l3msg.msg.imsiDetachInd.cm1),&dst);	
	memcpy(&(l3Info.msg.imsiDetachInd.cmInfo1),&(dst.param.dt_cmInfo1), sizeof(dst.param.dt_cmInfo1));
	l3Info.msg.imsiDetachInd.cmInfo1.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecode_l3msg.msg.imsiDetachInd.mobileId),&dst);	
	memcpy(&(l3Info.msg.imsiDetachInd.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	l3Info.msg.imsiDetachInd.mobileId.flag= 1;
	
	msg_len = aifg_msg_encode_embeded_l3msg(&l3Info, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[63][0], msg_len)); 
}

void test_aifg_msg_tmsiCmd()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	//test
	aifg_msg_proc(msgsrc[64], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_TMSI_REALLOC_CMD;

	//location area identification
	aifg_ie_decode(&(predecoded.msg.tmsiReallocCmd.lai),&dst);	
	memcpy(&(structed_msg.msg.tmsiCmd.lai),&(dst.param.dt_lai), sizeof(dst.param.dt_lai));
	structed_msg.msg.tmsiCmd.lai.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecoded.msg.tmsiReallocCmd.mobileId),&dst);	
	memcpy(&(structed_msg.msg.tmsiCmd.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	structed_msg.msg.tmsiCmd.mobileId.flag= 1;
	
	msg_len = aifg_msg_sd_tmsiReallocCmd(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,9);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[64][4], msg_len)); 
}

void test_aifg_msg_cmReEst_Request ()
{
	memset(&l3Info,0,sizeof(l3Info));
	memset(&predecode_l3msg,0,sizeof(predecode_l3msg));
		
	//test
	aifg_msg_decode_embeded_l3msg(msgsrc[65], &predecode_l3msg);
		
	l3Info.id = AIFG_MSG_ID_CM_REEST_REQUEST;

	//ciphering key sequence number
	aifg_ie_decode(&(predecode_l3msg.msg.cmReEstReq.cipherKeySeq),&dst);	
	memcpy(&(l3Info.msg.cmReEstReq.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
	l3Info.msg.cmReEstReq.cipherKey.flag= 1;
	
	//mobile station classmark 2
	aifg_ie_decode(&(predecode_l3msg.msg.cmReEstReq.cm2),&dst);	
	memcpy(&(l3Info.msg.cmReEstReq.cmInfo2),&(dst.param.dt_cmInfo2), sizeof(dst.param.dt_cmInfo2));
	l3Info.msg.cmReEstReq.cmInfo2.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecode_l3msg.msg.cmReEstReq.mobileId),&dst);	
	memcpy(&(l3Info.msg.cmReEstReq.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	l3Info.msg.cmReEstReq.mobileId.flag= 1;
	
	//location area identification
	aifg_ie_decode(&(predecode_l3msg.msg.cmReEstReq.lai),&dst);	
	memcpy(&(l3Info.msg.cmReEstReq.lai),&(dst.param.dt_lai), sizeof(dst.param.dt_lai));
	l3Info.msg.cmReEstReq.lai.flag= 1;
	
	msg_len = aifg_msg_encode_embeded_l3msg(&l3Info, buffer);
	CU_ASSERT_EQUAL(msg_len,16);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[65][0], msg_len)); 
			
}

void test_aifg_msg_cmRequest()
{
	memset(&l3Info,0,sizeof(l3Info));
	memset(&predecode_l3msg,0,sizeof(predecode_l3msg));

	//test
	aifg_msg_decode_embeded_l3msg(msgsrc[66], &predecode_l3msg);
		
	l3Info.id = AIFG_MSG_ID_CM_REQUEST;
	
	//CM service type
	aifg_ie_decode(&(predecode_l3msg.msg.cmRequest.type),&dst);	
	memcpy(&(l3Info.msg.cmRequest.cmType),&(dst.param.dt_cmType), sizeof(dst.param.dt_cmType));
	l3Info.msg.cmRequest.cmType.flag= 1;
	
	//ciphering key sequence number
	aifg_ie_decode(&(predecode_l3msg.msg.cmRequest.cipherKeySeq),&dst);	
	memcpy(&(l3Info.msg.cmRequest.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
	l3Info.msg.cmRequest.cipherKey.flag= 1;
	//mobile station classmark 2
	aifg_ie_decode(&(predecode_l3msg.msg.cmRequest.cm2),&dst);	
	memcpy(&(l3Info.msg.cmRequest.cmInfo2),&(dst.param.dt_cmInfo2), sizeof(dst.param.dt_cmInfo2));
	l3Info.msg.cmRequest.cmInfo2.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecode_l3msg.msg.cmRequest.mobileId),&dst);	
	memcpy(&(l3Info.msg.cmRequest.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	l3Info.msg.cmRequest.mobileId.flag= 1;
	
	//priority level
	aifg_ie_decode(&(predecode_l3msg.msg.cmRequest.priority),&dst);	
	memcpy(&(l3Info.msg.cmRequest.priority),&(dst.param.dt_priority), sizeof(dst.param.dt_priority));
	l3Info.msg.cmRequest.priority.flag= 1;
	
	msg_len = aifg_msg_encode_embeded_l3msg(&l3Info, buffer);
	CU_ASSERT_EQUAL(msg_len,11);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[66][0], msg_len)); 			
}

void test_aifg_msg_mmInfo ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	
	//test
	aifg_msg_proc(msgsrc[67], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_MM_INFO;

	//full name for network
	aifg_ie_decode(&(predecoded.msg.mmInfo.fullNetworkName),&dst);	
	memcpy(&(structed_msg.msg.mmInfo.fullName),&(dst.param.dt_nwName), sizeof(dst.param.dt_nwName));
	structed_msg.msg.mmInfo.fullName.flag= 1;
	
	//short name for network
	aifg_ie_decode(&(predecoded.msg.mmInfo.shortNetworkName),&dst);	
	memcpy(&(structed_msg.msg.mmInfo.shortName),&(dst.param.dt_nwName), sizeof(dst.param.dt_nwName));
	structed_msg.msg.mmInfo.shortName.flag= 1;
	
	//time zone
	aifg_ie_decode(&(predecoded.msg.mmInfo.timeZone),&dst);	
	memcpy(&(structed_msg.msg.mmInfo.timeZone),&(dst.param.dt_timeZone), sizeof(dst.param.dt_timeZone));
	structed_msg.msg.mmInfo.timeZone.flag= 1;
	
	//time zone and time
	aifg_ie_decode(&(predecoded.msg.mmInfo.timeZoneAndTime),&dst);	
	memcpy(&(structed_msg.msg.mmInfo.tzTime),&(dst.param.dt_tzTime), sizeof(dst.param.dt_tzTime));
	structed_msg.msg.mmInfo.tzTime.flag= 1;
	
	//LSA identifier
	aifg_ie_decode(&(predecoded.msg.mmInfo.lsaId),&dst);	
	memcpy(&(structed_msg.msg.mmInfo.lsaId),&(dst.param.dt_lsaId), sizeof(dst.param.dt_lsaId));
	structed_msg.msg.mmInfo.lsaId.flag= 1;
	
	msg_len = aifg_msg_sd_mmInfo(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,26);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[67][4], msg_len)); 
}

void test_aifg_msg_alert ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[68], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_ALERTING;

	//facility          ..........dt_facility not done
	aifg_ie_decode(&(predecoded.msg.alert.facility),&dst);	
	memcpy(&(structed_msg.msg.alert.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.alert.facility.flag= 1;

	//progress indicator
	aifg_ie_decode(&(predecoded.msg.alert.progressInd),&dst);	
	memcpy(&(structed_msg.msg.alert.progInd),&(dst.param.dt_progInd), sizeof(dst.param.dt_progInd));
	structed_msg.msg.alert.progInd.flag= 1;
	//user-user
	aifg_ie_decode(&(predecoded.msg.alert.user_user),&dst);	
	memcpy(&(structed_msg.msg.alert.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.alert.uu.flag= 1;
	
	
	msg_len = aifg_msg_sd_alert(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,60);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[68][4], msg_len)); 
			
}

void test_aifg_msg_callConfirm ()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	//test
	aifg_msg_proc(msgsrc[69], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CALL_CONFIRMED;

	//repeat  indicator
	aifg_ie_decode(&(predecoded.msg.callConfirm.reptInd),&dst);	
	memcpy(&(structed_msg.msg.callConfirm.rpInd),&(dst.param.dt_rpInd), sizeof(dst.param.dt_rpInd));
	structed_msg.msg.callConfirm.rpInd.flag= 1;
	
	//bearer capability 1
	aifg_ie_decode(&(predecoded.msg.callConfirm.bearCap1),&dst);	
	memcpy(&(structed_msg.msg.callConfirm.bc1),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.callConfirm.bc1.flag= 1;
	
	//bearer capability 2
	aifg_ie_decode(&(predecoded.msg.callConfirm.bearCap2),&dst);	
	memcpy(&(structed_msg.msg.callConfirm.bc2),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.callConfirm.bc2.flag= 1;
	
	//cause 
	aifg_ie_decode(&(predecoded.msg.callConfirm.cause),&dst);	
	memcpy(&(structed_msg.msg.callConfirm.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.callConfirm.cause.flag= 1;
	
	//call control capabilities
	aifg_ie_decode(&(predecoded.msg.callConfirm.ccCap),&dst);	
	memcpy(&(structed_msg.msg.callConfirm.ccCap),&(dst.param.dt_ccCap), sizeof(dst.param.dt_ccCap));
	structed_msg.msg.callConfirm.ccCap.flag= 1;
	
	msg_len = aifg_msg_sd_callConfirm(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,30);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[69][4], msg_len)); 
}

void test_aifg_msg_callProceed()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[70], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CALL_PROCEEDING;


	//repeat  indicator
	aifg_ie_decode(&(predecoded.msg.callProceed.reptInd),&dst);	
	memcpy(&(structed_msg.msg.callProceed.rpInd),&(dst.param.dt_rpInd), sizeof(dst.param.dt_rpInd));
	structed_msg.msg.callProceed.rpInd.flag= 1;
	//bearer capability 1
	aifg_ie_decode(&(predecoded.msg.callProceed.bearCap1),&dst);	
	memcpy(&(structed_msg.msg.callProceed.bc1),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.callProceed.bc1.flag= 1;
	//bearer capability 2
	aifg_ie_decode(&(predecoded.msg.callProceed.bearCap2),&dst);	
	memcpy(&(structed_msg.msg.callProceed.bc2),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.callProceed.bc2.flag= 1;

	//test facility
	aifg_ie_decode(&(predecoded.msg.callProceed.facility),&dst);	
	memcpy(&(structed_msg.msg.callProceed.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.callProceed.facility.flag= 1;
	
	//progress indicator
	aifg_ie_decode(&(predecoded.msg.callProceed.progressInd),&dst);	
	memcpy(&(structed_msg.msg.callProceed.progInd),&(dst.param.dt_progInd), sizeof(dst.param.dt_progInd));
	structed_msg.msg.callProceed.progInd.flag= 1;
	//priority level
	aifg_ie_decode(&(predecoded.msg.callProceed.priority),&dst);	
	memcpy(&(structed_msg.msg.callProceed.priority),&(dst.param.dt_priority), sizeof(dst.param.dt_priority));
	structed_msg.msg.callProceed.priority.flag= 1;
	
	
	msg_len = aifg_msg_sd_callProceed(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,65);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[70][4], msg_len)); 
			
}

void test_aifg_msg_connect()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[71], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CONNECT;


	// test facility
	aifg_ie_decode(&(predecoded.msg.connect.facility),&dst);	
	memcpy(&(structed_msg.msg.connect.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.connect.facility.flag= 1;
	
	//progress indicator
	aifg_ie_decode(&(predecoded.msg.connect.progressInd),&dst);	
	memcpy(&(structed_msg.msg.connect.progInd),&(dst.param.dt_progInd), sizeof(dst.param.dt_progInd));
	structed_msg.msg.connect.progInd.flag= 1;
	//connected number
	aifg_ie_decode(&(predecoded.msg.connect.connNum),&dst);	
	memcpy(&(structed_msg.msg.connect.connNum),&(dst.param.dt_connNum), sizeof(dst.param.dt_connNum));
	structed_msg.msg.connect.connNum.flag= 1;
	//connected subaddress
	aifg_ie_decode(&(predecoded.msg.connect.connSubaddr),&dst);	
	memcpy(&(structed_msg.msg.connect.connSubAddr),&(dst.param.dt_connSubAddr), sizeof(dst.param.dt_connSubAddr));
	structed_msg.msg.connect.connSubAddr.flag= 1;
	//user-user
	aifg_ie_decode(&(predecoded.msg.connect.user_user),&dst);	
	memcpy(&(structed_msg.msg.connect.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.connect.uu.flag= 1;
	
	msg_len = aifg_msg_sd_connect(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x47);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[71][4], msg_len)); 
			
}

void test_aifg_msg_eSetup()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[72], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_EMERGENCY_SETUP;
	
	//bearer capability
	aifg_ie_decode(&(predecoded.msg.eSetup.bearCap),&dst);	
	memcpy(&(structed_msg.msg.eSetup.bc),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.eSetup.bc.flag= 1;
	
	msg_len = aifg_msg_sd_eSetup(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,5);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[72][4], msg_len)); 
			
}

void test_aifg_msg_progress()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[73], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_PROGRESS;
	
	//progress indicator
	aifg_ie_decode(&(predecoded.msg.progress.progressInd),&dst);	
	memcpy(&(structed_msg.msg.progress.progInd),&(dst.param.dt_progInd), sizeof(dst.param.dt_progInd));
	structed_msg.msg.progress.progInd.flag= 1;
	//user-user
	aifg_ie_decode(&(predecoded.msg.progress.user_user),&dst);	
	memcpy(&(structed_msg.msg.progress.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.progress.uu.flag= 1;

	
	msg_len = aifg_msg_sd_progress(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,9);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[73][4], msg_len)); 
			
}

void test_aifg_msg_setup()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[74], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_SETUP;
	
	//BC repeat indicator
	aifg_ie_decode(&(predecoded.msg.setup.reptInd_bc),&dst);	
	memcpy(&(structed_msg.msg.setup.bc_rpInd),&(dst.param.dt_rpInd), sizeof(dst.param.dt_rpInd));
	structed_msg.msg.setup.bc_rpInd.flag= 1;
	
	//bearer capability 1
	aifg_ie_decode(&(predecoded.msg.setup.bearCap1),&dst);	
	memcpy(&(structed_msg.msg.setup.bc1),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.setup.bc1.flag= 1;
	//bearer capability 2
	aifg_ie_decode(&(predecoded.msg.setup.bearCap2),&dst);	
	memcpy(&(structed_msg.msg.setup.bc2),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.setup.bc2.flag= 1;

	//test facility
	aifg_ie_decode(&(predecoded.msg.setup.facility),&dst);	
	memcpy(&(structed_msg.msg.setup.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.setup.facility.flag= 1;
	
	//progress indicator
	aifg_ie_decode(&(predecoded.msg.setup.progressInd),&dst);	
	memcpy(&(structed_msg.msg.setup.progInd),&(dst.param.dt_progInd), sizeof(dst.param.dt_progInd));
	structed_msg.msg.setup.progInd.flag= 1;
	//signal
	aifg_ie_decode(&(predecoded.msg.setup.signal),&dst);	
	memcpy(&(structed_msg.msg.setup.signal),&(dst.param.dt_signal), sizeof(dst.param.dt_signal));
	structed_msg.msg.setup.signal.flag= 1;
	//calling party BCD number
	aifg_ie_decode(&(predecoded.msg.setup.callingBCD),&dst);	
	memcpy(&(structed_msg.msg.setup.callingNum),&(dst.param.dt_callingNum), sizeof(dst.param.dt_callingNum));
	structed_msg.msg.setup.callingNum.flag= 1;
	//calling party subaddress
	aifg_ie_decode(&(predecoded.msg.setup.callingSubaddr),&dst);	
	memcpy(&(structed_msg.msg.setup.callingSubAddr),&(dst.param.dt_callingSubAddr), sizeof(dst.param.dt_callingSubAddr));
	structed_msg.msg.setup.callingSubAddr.flag= 1;
	//called party BCD number
	aifg_ie_decode(&(predecoded.msg.setup.calledBCD),&dst);	
	memcpy(&(structed_msg.msg.setup.calledNum),&(dst.param.dt_calledNum), sizeof(dst.param.dt_calledNum));
	structed_msg.msg.setup.calledNum.flag= 1;
	//called party subaddress 
	aifg_ie_decode(&(predecoded.msg.setup.calledSubaddr),&dst);	
	memcpy(&(structed_msg.msg.setup.calledSubAddr),&(dst.param.dt_calledSubAddr), sizeof(dst.param.dt_calledSubAddr));
	structed_msg.msg.setup.calledSubAddr.flag= 1;
	//redirecting party BCD
	aifg_ie_decode(&(predecoded.msg.setup.redirBCD),&dst);	
	memcpy(&(structed_msg.msg.setup.redirNum),&(dst.param.dt_redirNum), sizeof(dst.param.dt_redirNum));
	structed_msg.msg.setup.redirNum.flag= 1;
	//redirecting party subaddr
	aifg_ie_decode(&(predecoded.msg.setup.redirSubaddr),&dst);	
	memcpy(&(structed_msg.msg.setup.redirSubAddr),&(dst.param.dt_redirSubAddr), sizeof(dst.param.dt_redirSubAddr));
	structed_msg.msg.setup.redirSubAddr.flag= 1;
	//LLC repeat indicator
	aifg_ie_decode(&(predecoded.msg.setup.reptInd_llc),&dst);	
	memcpy(&(structed_msg.msg.setup.llc_rpInd),&(dst.param.dt_rpInd), sizeof(dst.param.dt_rpInd));
	structed_msg.msg.setup.llc_rpInd.flag= 1;
	//low layer compatibility 1
	aifg_ie_decode(&(predecoded.msg.setup.lowLComp1),&dst);	
	memcpy(&(structed_msg.msg.setup.loComp1),&(dst.param.dt_loComp), sizeof(dst.param.dt_loComp));
	structed_msg.msg.setup.loComp1.flag= 1;
	//low layer compatibility 2
	aifg_ie_decode(&(predecoded.msg.setup.lowLComp2),&dst);	
	memcpy(&(structed_msg.msg.setup.loComp2),&(dst.param.dt_loComp), sizeof(dst.param.dt_loComp));
	structed_msg.msg.setup.loComp2.flag= 1;
	//HLC repeat indicator
	aifg_ie_decode(&(predecoded.msg.setup.reptInd_hlc),&dst);	
	memcpy(&(structed_msg.msg.setup.hlc_rpInd),&(dst.param.dt_rpInd), sizeof(dst.param.dt_rpInd));
	structed_msg.msg.setup.hlc_rpInd.flag= 1;
	//high layer compatibility 1
	aifg_ie_decode(&(predecoded.msg.setup.highLComp1),&dst);	
	memcpy(&(structed_msg.msg.setup.hiComp1),&(dst.param.dt_hiComp), sizeof(dst.param.dt_hiComp));
	structed_msg.msg.setup.hiComp1.flag= 1;
	//high layer compatibility 2
	aifg_ie_decode(&(predecoded.msg.setup.highLComp2),&dst);	
	memcpy(&(structed_msg.msg.setup.hiComp2),&(dst.param.dt_hiComp), sizeof(dst.param.dt_hiComp));
	structed_msg.msg.setup.hiComp2.flag= 1;
	//user-user
	aifg_ie_decode(&(predecoded.msg.setup.user_user),&dst);	
	memcpy(&(structed_msg.msg.setup.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.setup.uu.flag= 1;
	//priority
	aifg_ie_decode(&(predecoded.msg.setup.priority),&dst);	
	memcpy(&(structed_msg.msg.setup.priority),&(dst.param.dt_priority), sizeof(dst.param.dt_priority));
	structed_msg.msg.setup.priority.flag= 1;
	//alert
	aifg_ie_decode(&(predecoded.msg.setup.alert),&dst);	
	memcpy(&(structed_msg.msg.setup.alertPattern),&(dst.param.dt_alertPattern), sizeof(dst.param.dt_alertPattern));
	structed_msg.msg.setup.alertPattern.flag= 1;

	
	msg_len = aifg_msg_sd_setup(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x80);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[74][4], msg_len)); 

	//for unit test
	memcpy(&bm_setup, &structed_msg, sizeof(structed_msg));
}

void test_aifg_msg_modify()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[75], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_MODIFY;
	
	//bearer capability
	aifg_ie_decode(&(predecoded.msg.modify.bearCap),&dst);	
	memcpy(&(structed_msg.msg.modify.bc),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.modify.bc.flag= 1;
	//low layer compatibility
	aifg_ie_decode(&(predecoded.msg.modify.lowLComp),&dst);	
	memcpy(&(structed_msg.msg.modify.loComp),&(dst.param.dt_loComp), sizeof(dst.param.dt_loComp));
	structed_msg.msg.modify.loComp.flag= 1;
	//high layer compatibility
	aifg_ie_decode(&(predecoded.msg.modify.highLComp),&dst);	
	memcpy(&(structed_msg.msg.modify.hiComp),&(dst.param.dt_hiComp), sizeof(dst.param.dt_hiComp));
	structed_msg.msg.modify.hiComp.flag= 1;
	//reverse call setup direction
	aifg_ie_decode(&(predecoded.msg.modify.revCallSetDir),&dst);	
	memcpy(&(structed_msg.msg.modify.revCallDir),&(dst.param.dt_revCallDir), sizeof(dst.param.dt_revCallDir));
	structed_msg.msg.modify.revCallDir.flag= 1;
	
	
	msg_len = aifg_msg_sd_modify(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,14);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[75][4], msg_len)); 
			
}

void test_aifg_msg_modifyCmp()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[76], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_MODIFY_CMP;
	
	//bearer capability
	aifg_ie_decode(&(predecoded.msg.modifyComplete.bearCap),&dst);	
	memcpy(&(structed_msg.msg.modifyCmp.bc),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.modifyCmp.bc.flag= 1;
	//low layer compatibility
	aifg_ie_decode(&(predecoded.msg.modifyComplete.lowLComp),&dst);	
	memcpy(&(structed_msg.msg.modifyCmp.loComp),&(dst.param.dt_loComp), sizeof(dst.param.dt_loComp));
	structed_msg.msg.modifyCmp.loComp.flag= 1;
	//high layer compatibility
	aifg_ie_decode(&(predecoded.msg.modifyComplete.highLComp),&dst);	
	memcpy(&(structed_msg.msg.modifyCmp.hiComp),&(dst.param.dt_hiComp), sizeof(dst.param.dt_hiComp));
	structed_msg.msg.modifyCmp.hiComp.flag= 1;
	//reverse call setup direction
	aifg_ie_decode(&(predecoded.msg.modifyComplete.revCallSetDir),&dst);	
	memcpy(&(structed_msg.msg.modifyCmp.revCallDir),&(dst.param.dt_revCallDir), sizeof(dst.param.dt_revCallDir));
	structed_msg.msg.modifyCmp.revCallDir.flag= 1;
	
	
	msg_len = aifg_msg_sd_modifyCmp(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,14);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[76][4], msg_len)); 
			
}

void test_aifg_msg_modifyRej()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[77], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_MODIFY_REJECT;
	
	//bearer capability
	aifg_ie_decode(&(predecoded.msg.modifyRej.bearCap),&dst);	
	memcpy(&(structed_msg.msg.modifyRej.bc),&(dst.param.dt_bc), sizeof(dst.param.dt_bc));
	structed_msg.msg.modifyRej.bc.flag= 1;
	//cause
	aifg_ie_decode(&(predecoded.msg.modifyRej.cause),&dst);	
	memcpy(&(structed_msg.msg.modifyRej.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.modifyRej.cause.flag= 1;
	//low layer compatibility
	aifg_ie_decode(&(predecoded.msg.modifyRej.lowLComp),&dst);	
	memcpy(&(structed_msg.msg.modifyRej.loComp),&(dst.param.dt_loComp), sizeof(dst.param.dt_loComp));
	structed_msg.msg.modifyRej.loComp.flag= 1;
	//high layer compatibility
	aifg_ie_decode(&(predecoded.msg.modifyRej.highLComp),&dst);	
	memcpy(&(structed_msg.msg.modifyRej.hiComp),&(dst.param.dt_hiComp), sizeof(dst.param.dt_hiComp));
	structed_msg.msg.modifyRej.hiComp.flag= 1;
	
	
	msg_len = aifg_msg_sd_modifyRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,18);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[77][4], msg_len)); 
			
}


void test_aifg_msg_userInfo()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[78], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_USER_INFO;
	
	//user-user
	aifg_ie_decode(&(predecoded.msg.userInfo.user_user),&dst);	
	memcpy(&(structed_msg.msg.userInfo.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.userInfo.uu.flag= 1;
	//more data
	aifg_ie_decode(&(predecoded.msg.userInfo.moreDate),&dst);	
	memcpy(&(structed_msg.msg.userInfo.moreData),&(dst.param.dt_moreData), sizeof(dst.param.dt_moreData));
	structed_msg.msg.userInfo.moreData.flag= 1;
	
	
	msg_len = aifg_msg_sd_userInfo(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[78][4], msg_len)); 
			
}

void test_aifg_msg_holdRej()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[79], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HOLD_REJECT;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.holdRej.cause),&dst);	
	memcpy(&(structed_msg.msg.holdRej.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.holdRej.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_holdRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[79][4], msg_len)); 
			
}

void test_aifg_msg_retrieveRej()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[80], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RETRIEVE_REJECT;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.retrieveRej.cause),&dst);	
	memcpy(&(structed_msg.msg.retrieveRej.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.retrieveRej.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_retrieveRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[80][4], msg_len)); 
			
}

void test_aifg_msg_disconnect()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[81], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_DISCONNECT;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.disconnect.cause),&dst);	
	memcpy(&(structed_msg.msg.disconnect.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.disconnect.cause.flag= 1;

	// test facility
	aifg_ie_decode(&(predecoded.msg.disconnect.facility),&dst);	
	memcpy(&(structed_msg.msg.disconnect.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.disconnect.facility.flag= 1;
	
	//progress indicator
	aifg_ie_decode(&(predecoded.msg.disconnect.progressInd),&dst);	
	memcpy(&(structed_msg.msg.disconnect.progInd),&(dst.param.dt_progInd), sizeof(dst.param.dt_progInd));
	structed_msg.msg.disconnect.progInd.flag= 1;
	//user-user
	aifg_ie_decode(&(predecoded.msg.disconnect.user_user),&dst);	
	memcpy(&(structed_msg.msg.disconnect.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.disconnect.uu.flag= 1;
	
	
	msg_len = aifg_msg_sd_disconnect(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x41);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[81][4], msg_len)); 
			
}

void test_aifg_msg_release()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[82], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RELEASE;
	
	//cause 1
	aifg_ie_decode(&(predecoded.msg.release.cause1),&dst);	
	memcpy(&(structed_msg.msg.release.cause1),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.release.cause1.flag= 1;
	//cause 2
	aifg_ie_decode(&(predecoded.msg.release.cause2),&dst);	
	memcpy(&(structed_msg.msg.release.cause2),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.release.cause2.flag= 1;

	// test facility
	aifg_ie_decode(&(predecoded.msg.release.facility),&dst);	
	memcpy(&(structed_msg.msg.release.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.release.facility.flag= 1;
	
	//user-user
	aifg_ie_decode(&(predecoded.msg.release.user_user),&dst);	
	memcpy(&(structed_msg.msg.release.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.release.uu.flag= 1;
	
	
	msg_len = aifg_msg_sd_release(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x44);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[82][4], msg_len)); 
			
}

void test_aifg_msg_releaseCmp()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[83], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RELEASE_CMP;
	
	//cause 
	aifg_ie_decode(&(predecoded.msg.releaseComp.cause),&dst);	
	memcpy(&(structed_msg.msg.releaseCmp.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.releaseCmp.cause.flag= 1;

	//test facility
	aifg_ie_decode(&(predecoded.msg.releaseComp.facility),&dst); 
	memcpy(&(structed_msg.msg.releaseCmp.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.releaseCmp.facility.flag= 1;
	
	//user-user
	aifg_ie_decode(&(predecoded.msg.releaseComp.user_user),&dst); 
	memcpy(&(structed_msg.msg.releaseCmp.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.releaseCmp.uu.flag= 1;
	
	
	msg_len = aifg_msg_sd_releaseCmp(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x3e);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[83][4], msg_len)); 
			
}

void test_aifg_msg_congestCtrl()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[84], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CONGESTION_CTRL;
	
	//congestion level 
	aifg_ie_decode(&(predecoded.msg.congestCtrl.congestLev),&dst);	
	memcpy(&(structed_msg.msg.congestCtrl.congestLevel),&(dst.param.dt_congestLevel), sizeof(dst.param.dt_congestLevel));
	structed_msg.msg.congestCtrl.congestLevel.flag= 1;
	//cause
	aifg_ie_decode(&(predecoded.msg.congestCtrl.cause),&dst);	
	memcpy(&(structed_msg.msg.congestCtrl.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.congestCtrl.cause.flag= 1;
	
	msg_len = aifg_msg_sd_congestCtrl(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,8);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[84][4], msg_len)); 
			
}

void test_aifg_msg_notify()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[85], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_NOTIFY;
	
	//notification indicator
	aifg_ie_decode(&(predecoded.msg.notify.notifyInd),&dst);	
	memcpy(&(structed_msg.msg.notify.notificationInd),&(dst.param.dt_notificationInd), sizeof(dst.param.dt_notificationInd));
	structed_msg.msg.notify.notificationInd.flag= 1;
	
	
	msg_len = aifg_msg_sd_notify(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[85][4], msg_len)); 
			
}

void test_aifg_msg_status()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[86], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_STATUS;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.status.cause),&dst);	
	memcpy(&(structed_msg.msg.status.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.status.cause.flag= 1;
	//call state
	aifg_ie_decode(&(predecoded.msg.status.callState),&dst);	
	memcpy(&(structed_msg.msg.status.callStat),&(dst.param.dt_callStat), sizeof(dst.param.dt_callStat));
	structed_msg.msg.status.callStat.flag= 1;
	//auxiliary states
	aifg_ie_decode(&(predecoded.msg.status.auxState),&dst);	
	memcpy(&(structed_msg.msg.status.auxStat),&(dst.param.dt_auxStat), sizeof(dst.param.dt_auxStat));
	structed_msg.msg.status.auxStat.flag= 1;
	
	
	msg_len = aifg_msg_sd_status(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,10);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[86][4], msg_len)); 
			
}

void test_aifg_msg_startDTMF()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[87], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_START_DTMF;
	
	//keypad facility
	aifg_ie_decode(&(predecoded.msg.startDTMF.keypadFacility),&dst);	
	memcpy(&(structed_msg.msg.startDTMF.keypad),&(dst.param.dt_keypad), sizeof(dst.param.dt_keypad));
	structed_msg.msg.startDTMF.keypad.flag= 1;
	
	
	msg_len = aifg_msg_sd_startDTMF(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[87][4], msg_len)); 
			
}

void test_aifg_msg_startDTMF_ack()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[88], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_START_DTMF_ACK;
	
	//keypad facility
	aifg_ie_decode(&(predecoded.msg.startDTMFAck.keypadFacility),&dst);	
	memcpy(&(structed_msg.msg.startDTMF_ack.keypad),&(dst.param.dt_keypad), sizeof(dst.param.dt_keypad));
	structed_msg.msg.startDTMF_ack.keypad.flag= 1;
	
	
	msg_len = aifg_msg_sd_startDTMFAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,2);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[88][4], msg_len)); 
			
}

void test_aifg_msg_startDTMF_rej()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[89], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_START_DTMF_REJECT;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.startDTMFRej.cause),&dst);	
	memcpy(&(structed_msg.msg.startDTMF_rej.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.startDTMF_rej.cause.flag= 1;
	
	
	msg_len = aifg_msg_sd_startDTMFRej(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,6);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[89][4], msg_len)); 
			
}


////////////////////////////////

void test_aifg_msg_connectAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[90], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_CONNECT_ACK;
	
	
	msg_len = aifg_msg_sd_connectAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[90][4], msg_len)); 
			
}

void test_aifg_msg_hold()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[91], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HOLD;
	
	
	msg_len = aifg_msg_sd_hold(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[91][4], msg_len)); 
			
}

void test_aifg_msg_holdAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[92], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_HOLD_ACK;
	
	
	msg_len = aifg_msg_sd_holdAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[92][4], msg_len)); 
			
}

void test_aifg_msg_retrieve()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[93], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RETRIEVE;
	
	
	msg_len = aifg_msg_sd_retrieve(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[93][4], msg_len)); 
			
}

void test_aifg_msg_retrieveAck()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[94], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_RETRIEVE_ACK;
	
	
	msg_len = aifg_msg_sd_retrieveAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[94][4], msg_len)); 
			
}

void test_aifg_msg_statusEnq()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[95], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_STATUS_ENQ;
	
	
	msg_len = aifg_msg_sd_statusEnq(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[95][4], msg_len)); 
			
}

void test_aifg_msg_stopDTMF()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[96], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_STOP_DTMF;
	
	
	msg_len = aifg_msg_sd_stopDTMF(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[96][4], msg_len)); 
			
}

void test_aifg_msg_stopDTMF_ack()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[97], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_STOP_DTMF_ACK;
	
	
	msg_len = aifg_msg_sd_stopDTMFAck(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,1);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[97][4], msg_len)); 
			
}

void test_aifg_msg_facility()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
		
	
	//test
	aifg_msg_proc(msgsrc[98], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_FACILITY;

	//facility
	aifg_ie_decode(&(predecoded.msg.facility.facility),&dst);	
	memcpy(&(structed_msg.msg.facility.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.facility.facility.flag= 1;	
	
	msg_len = aifg_msg_sd_facility(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x32);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[98][4], msg_len)); 
			
}


void test_aifg_msg_disconnect_mobileToNet()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));

	//test
	aifg_msg_proc(msgsrc[99], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_DISCONNECT;
	
	//cause
	aifg_ie_decode(&(predecoded.msg.disconnect.cause),&dst);	
	memcpy(&(structed_msg.msg.disconnect.cause),&(dst.param.dt_cause), sizeof(dst.param.dt_cause));
	structed_msg.msg.disconnect.cause.flag= 1;

	//facility
	aifg_ie_decode(&(predecoded.msg.disconnect.facility),&dst);	
	memcpy(&(structed_msg.msg.disconnect.facility),&(dst.param.dt_facility), sizeof(dst.param.dt_facility));
	structed_msg.msg.disconnect.facility.flag= 1;
	
	//user-user
	aifg_ie_decode(&(predecoded.msg.disconnect.user_user),&dst);	
	memcpy(&(structed_msg.msg.disconnect.uu),&(dst.param.dt_uu), sizeof(dst.param.dt_uu));
	structed_msg.msg.disconnect.uu.flag= 1;
	
	//SS version
	aifg_ie_decode(&(predecoded.msg.disconnect.ssVer),&dst);	
	memcpy(&(structed_msg.msg.disconnect.ssVer),&(dst.param.dt_ssVer), sizeof(dst.param.dt_ssVer));
	structed_msg.msg.disconnect.ssVer.flag= 1;
	
	msg_len = aifg_msg_sd_disconnect(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len,0x40);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[99][4], msg_len)); 
}
/*
void test_aifg_msg_pagingResp()
{
	memset(&l3Info,0,sizeof(l3Info));
	memset(&predecode_l3msg,0,sizeof(predecode_l3msg));
		
	//test
	aifg_msg_decode_embeded_l3msg(msgsrc[100], &predecode_l3msg);
		
	l3Info.id = AIFG_MSG_ID_PAGING_RESP;
 
	//ciphering key sequence number
	aifg_ie_decode(&(predecode_l3msg.msg.pagingResp.cipherKeySeq),&dst);	
	memcpy(&(l3Info.msg.pagingResp.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
	l3Info.msg.pagingResp.cipherKey.flag= 1;
	
	//Mobile Station Classmark 2
	aifg_ie_decode(&(predecode_l3msg.msg.pagingResp.cm2),&dst);	
	memcpy(&l3Info.msg.pagingResp.cmInfo2,&dst.param.dt_cmInfo2, sizeof(dst.param.dt_cmInfo2));
	l3Info.msg.pagingResp.cmInfo2.flag= 1;
	
	//mobile identity
	aifg_ie_decode(&(predecode_l3msg.msg.pagingResp.mobileId),&dst);	
	memcpy(&(l3Info.msg.pagingResp.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
	l3Info.msg.pagingResp.mobileId.flag= 1;
	
	msg_len = aifg_msg_encode_embeded_l3msg(&l3Info, buffer);
	CU_ASSERT_EQUAL(msg_len,16);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[100][0], msg_len));

	//for unit test
	memcpy(&rr_pagingResp, &structed_msg, sizeof(structed_msg));
}
*/
void test_aifg_msg_pagingResp()
{
	memset(&structed_msg,0,sizeof(structed_msg));
	memset(&predecoded,0,sizeof(predecoded));
	memset(&l3Info,0,sizeof(l3Info));
	
	//test
	aifg_msg_proc(msgsrc[100], &predecoded);
		
	structed_msg.id = AIFG_MSG_ID_L3_INFO;
	
	//cell identifier
	aifg_ie_decode(&(predecoded.msg.completeL3Info.cellId),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.cellId),&(dst.param.bm_cellId), sizeof(dst.param.bm_cellId));
	structed_msg.msg.completeL3Info.cellId.flag= 1;
	
	//layer 3 infomation
		//Paging response
		structed_msg.msg.completeL3Info.l3Info.ptr = &msgsrc[100][10];
		structed_msg.msg.completeL3Info.l3Info.len = 16;
/*		l3Info.id = AIFG_MSG_ID_PAGING_RESP;
		//ciphering key sequence number
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.pagingResp.cipherKeySeq),&dst);	
		memcpy(&(l3Info.msg.pagingResp.cipherKey),&(dst.param.dt_cipherKey), sizeof(dst.param.dt_cipherKey));
		l3Info.msg.pagingResp.cipherKey.flag= 1;
		
		//Mobile Station Classmark 2
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.pagingResp.cm2),&dst);	
		memcpy(&l3Info.msg.pagingResp.cmInfo2,&dst.param.dt_cmInfo2, sizeof(dst.param.dt_cmInfo2));
		l3Info.msg.pagingResp.cmInfo2.flag= 1;
		
		//mobile identity
		aifg_ie_decode(&(predecoded.msg.completeL3Info.l3msg.msg.pagingResp.mobileId),&dst);	
		memcpy(&(l3Info.msg.pagingResp.mobileId),&(dst.param.mobileId), sizeof(dst.param.mobileId));
		l3Info.msg.pagingResp.mobileId.flag= 1;

		memcpy(&(structed_msg.msg.completeL3Info.l3Info), &l3Info, sizeof(l3Info));
*/		
	//chosen channel
	aifg_ie_decode(&(predecoded.msg.completeL3Info.chosenChannel),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.chosenChannel),&(dst.param.bm_chosenChannel), sizeof(dst.param.bm_chosenChannel));
	structed_msg.msg.completeL3Info.chosenChannel.flag= 1;
	
	//LSA identity list
	aifg_ie_decode(&(predecoded.msg.completeL3Info.lsaIdList),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.lsaIdList),&(dst.param.bm_lsaIdList), sizeof(dst.param.bm_lsaIdList));
	structed_msg.msg.completeL3Info.lsaIdList.flag= 1;
	
	//location information
	aifg_ie_decode(&(predecoded.msg.completeL3Info.locInfo),&dst);	
	memcpy(&(structed_msg.msg.completeL3Info.locInfo),&(dst.param.bm_locInfo), sizeof(dst.param.bm_locInfo));
	structed_msg.msg.completeL3Info.locInfo.flag= 1;

	msg_len = aifg_msg_sd_completeL3Info(&structed_msg, buffer);
	CU_ASSERT_EQUAL(msg_len, 40);
	CU_ASSERT_EQUAL(0, memcmp(buffer, &msgsrc[100][2],40)); 	

	//for unit test use
	memcpy(&rr_pagingResp, &structed_msg, sizeof(structed_msg));
}


////////////////////////////////////////////////////////////////////////////
int aifg_code_test()
{
	CU_pSuite pSuite = NULL;
	ie.hi_lo_flag=0;

	aifg_init();
   
	/* initialize the CUnit test registry */
	if (CUE_SUCCESS != CU_initialize_registry())
	   goto ERR_PROC;

	/* add static test suite to the registry */
	pSuite = CU_add_suite("Test ie encode/decode", NULL, NULL);
	if (NULL == pSuite) {
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
   
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cic,src={0x01,0x02}", test_aifg_ie_bm_cic)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_resrcAvail,src={0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x00,0x09,0x01,0x03,0x02,0x06,0x00,0x0b}", test_aifg_ie_bm_resrcAvail)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cause,src={0x01,0x09}", test_aifg_ie_bm_cause)){
		CU_cleanup_registry();
		goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cause_ext,src={0x02,0x89,0x10}", test_aifg_ie_bm_cause_ext)){
		CU_cleanup_registry();
		goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cellId_00,src={0x08,0x00,0x13,0x42,0x05,0x00,0x02,0x00,0x11}", test_aifg_ie_bm_cellId_00)){
		CU_cleanup_registry();
		goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cellId_01,src={0x05,0x01,0x00,0x42,0x01,0x03}", test_aifg_ie_bm_cellId_01)){
		CU_cleanup_registry();
		goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cellId_02,src={0x03,0x02,0x00,0x22}", test_aifg_ie_bm_cellId_02)){
		CU_cleanup_registry();
		goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_priority,src={0x03,0x42,0x00,0x22}", test_aifg_ie_bm_priority)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_tsmi,src={0x04,0xf7,0x03,0x12,0x2a}", test_aifg_ie_bm_tmsi)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_encryptInfo_Noencryption,src={0x01,0x01}", test_aifg_ie_bm_encryptInfo_NOencryption)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_encryptInfo_A5,src={0x09,0x12,0x08,0x15,0x34,0x67,0xa2,0x8d,0x46,0x8f}", test_aifg_ie_bm_encryptInfo_A5)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_channelType_speech,src={0X04,0X01,0X09,0X83,0X79}", test_aifg_ie_bm_channelType_speech)){
			   CU_cleanup_registry();
			   goto ERR_PROC;
		   }
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_channelType_data,src={0x04,0x02,0x0a,0xf5,0x07}", test_aifg_ie_bm_channelType_data)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_extResourceInd,src={0x02}", test_aifg_ie_bm_extResourceInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */	 
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cmInfo2,src={0x03,0x7e,0x67,0x82}", test_aifg_ie_bm_cmInfo2)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */  //to resolve
	/*if (NULL == CU_add_test(pSuite, "aifg_ie_bm_l3Info,src={0x04,0x05,0x21,0x3f,0x58,0xe1}", test_aifg_ie_bm_l3Info)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}*/
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cidList_00,src={0x08,0x00,0x85,0x47,0x9c,0x67,0x24,0x3d,0x05}", test_aifg_ie_bm_cidList_00)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cidList_01,src={0x05,0x01,0x23,0x07,0x4f,0x39}", test_aifg_ie_bm_cidList_01)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cidList_02,src={0x03,0x02,0x77,0x64}", test_aifg_ie_bm_cidList_02)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cidList_04,src={0x06,0x04,0x4e,0x39,0x58,0x7c,0x0a}", test_aifg_ie_bm_cidList_04)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cidList_05,src={0x03,0x05,0x21,0xf3}", test_aifg_ie_bm_cidList_05)){//<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cicList,src={0x04,0x32,0x12,0x8d,0x36}", test_aifg_ie_bm_cicList)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_diagnostics,src={0x04,0x03,0x0Fa,0x38,0x89}", test_aifg_ie_bm_diagnostics)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_chosenChannel,src={0x56}", test_aifg_ie_bm_chosenChannel)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_totalResrc,src={0x84,0x62,0xf2,0x7e}", test_aifg_ie_bm_totalResrc)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_triggerId,src={0x03,0x9d,0x20,0x81}", test_aifg_ie_bm_triggerId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_mobileId,src={0x02,0x31,0xf2}", test_aifg_ie_bm_mobileId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_circuitPoolList,src={0x05,0x01,0x02,0x03,0x04,0x05}", test_aifg_ie_bm_circuitPoolList)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_resrcSit,src={0x05,0x11,0x83,0x04,0x28,0x75}", test_aifg_ie_bm_resrcSit)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_curChannelType1,src={0x19}", test_aifg_ie_bm_curChannelType1)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_groupRef,src={0x05,0x24,0x38,0x56,0x19,0x10}", test_aifg_ie_bm_groupRef)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_lsaId,src={0x03,0x10,0x39,0xd2}", test_aifg_ie_bm_lsaId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_lsaIdList,src={0x07,0x01,0x22,0xe4,0x31,0x57,0x69,0x83}", test_aifg_ie_bm_lsaIdList)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_lsaInfo,src={0x09,0x00,0x00,0x36,0x85,0xef,0x03,0x47,0x87,0x42}", test_aifg_ie_bm_lsaInfo)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_locInfo,src={0x03,0x15,0x49,0xf5}", test_aifg_ie_bm_locInfo)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_omcId,src={0x03,0x39,0xc4,0x08}", test_aifg_ie_bm_omcId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_bssOldtoNew,src={0X07, ,0X01,0X02, ,0X02,0X06,0X01}", test_aifg_ie_bm_bssOldtoNew)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_periodicity,src={0Xff}", test_aifg_ie_bm_periodicity)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_msNum,src={0Xfe}", test_aifg_ie_bm_msNum)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_bandUsed,src={0x09}", test_aifg_ie_bm_bandUsed)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_rrCause,src={0X08}", test_aifg_ie_bm_rrCause)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_dlci,src={0XC2}", test_aifg_ie_bm_dlci)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_dtx,src={0x01}", test_aifg_ie_bm_dtx)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_resrcIndMethod,src={0X01}}", test_aifg_ie_bm_resrcIndMethod)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_cipherRespMode,src={0X00}", test_aifg_ie_bm_cipherRespMode)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_channelNeeded,src={0X02}", test_aifg_ie_bm_channelNeeded)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_traceType,src={0xdd}", test_aifg_ie_bm_traceType)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_traceRef,src={0x34,0x97}", test_aifg_ie_bm_traceRef)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_transId,src={0x02,0x17,0x62}", test_aifg_ie_bm_transId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_forwardInd,src={0x02}", test_aifg_ie_bm_fowardInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_chosenEncrypt,src={0X03}", test_aifg_ie_bm_chosenEncrypt)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_circuitPool,src={0X10}", test_aifg_ie_bm_circuitPool)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_timeInd,src={0X11}", test_aifg_ie_bm_timeInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_speechVer,src={0X21}", test_aifg_ie_bm_speechVer)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_queuingInd,src={0X02}", test_aifg_ie_bm_queuingInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_assignReq,src={0X01}", test_aifg_ie_bm_assignReq)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_eMLPP,src={0X06}", test_aifg_ie_bm_eMLPP)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_configInd,src={0x03}", test_aifg_ie_bm_configInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_bm_tmsi,src={0X04,0X33,0X79,0X27,0X46}", test_aifg_ie_bm_tmsi)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	////////////////////////TEST DTAP////////////////////////////////

	/* add test cases to test suite */
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_broadcastRef,src={0x10,0x34,0x78,0x69,0x20}", test_aifg_ie_dt_broadcastRef)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_cmInfo1,src={0x11}", test_aifg_ie_dt_cmInfo1)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_cmInfo2,src={0x03,0x33,0x22,0x8d}", test_aifg_ie_dt_cmInfo2)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_mobileId,src={0x02,0x73,0xf2}", test_aifg_ie_dt_mobileId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_lai,src={0x78,0xf3,0x64,0x31,0x02}", test_aifg_ie_dt_lai)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_luType,src={0x09}", test_aifg_ie_dt_luType)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_nwName,src={0x03,0x91,0x35,0x64}", test_aifg_ie_dt_nwName)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_tzTime,src={0x07,0x04,0x12,0x0a,0x32,0x14,0xdd}", test_aifg_ie_dt_tzTime)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_progInd,src={0x02,0xc0,0x82}", test_aifg_ie_dt_progInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_uu,src={0x03,0x01,0x19,0x83}", test_aifg_ie_dt_uu)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_bc_0,src={0x02,0x20,0x02}", test_aifg_ie_dt_bc_0)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_bc,src={0x13,0xa3,0xca,0x1a,0x00,0xe4,0x21,0x53,0x5b,0x60,0x21,0x5f,0x47,0xc6}", test_aifg_ie_dt_bc)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_cause,src={0x04,0x47,0xdd,0x96,0x81}", test_aifg_ie_dt_cause)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_ccCap,src={0x01,0x03}", test_aifg_ie_dt_ccCap)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_connNum,src={0x04,0x28,0xa3,0x89,0x37}", test_aifg_ie_dt_connNum)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_connSubAddr,src={0x03,0x88,0x50,0x43}", test_aifg_ie_dt_connSubAddr)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_ssVer,src={0x01,0xdd}", test_aifg_ie_dt_ssVer)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_hiComp,src={0x03,0xa8,0x6e,0xb4}", test_aifg_ie_dt_hiComp)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_loComp,src={0x02,0xdd,0xde}", test_aifg_ie_dt_loComp)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_callStat,src={0xc2}", test_aifg_ie_dt_callStat)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_auxStat,src={0x01,0x86}", test_aifg_ie_dt_auxStat)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_lsaId,src={0x03,0x11,0x22,0x33}", test_aifg_ie_dt_lsaId)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_rejectCause,src={0X02}", test_aifg_ie_dt_rejectCause)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_cmType,src={0X0B}", test_aifg_ie_dt_cmType)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_cipherKey,src={0X01}", test_aifg_ie_dt_cipherKey)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}

	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_priority,src={0X05}", test_aifg_ie_dt_priority)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_idType,src={0X03}", test_aifg_ie_dt_idType)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}if (NULL == CU_add_test(pSuite, "aifg_ie_dt_congestLevel,src={0X0F}", test_aifg_ie_dt_congestLevel)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}if (NULL == CU_add_test(pSuite, "aifg_ie_dt_notificationInd,src={0x80}", test_aifg_ie_dt_notificationInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}if (NULL == CU_add_test(pSuite, "aifg_ie_dt_signal,src={0x08}", test_aifg_ie_dt_signal)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_alertPattern,src={0X01,0X07}", test_aifg_ie_dt_alertPattern)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_keypad,src={0X0D}", test_aifg_ie_dt_keypad)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_timeZone,src={0XDD}", test_aifg_ie_dt_timeZone)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_authRAND,src={0X00,0X11,0X22,0X33,0X44,0X55,0X66,0X77,0X88,0X99,0XAA,0XBB,0XCC,0XDD,0XEE,0XFF}", test_aifg_ie_dt_authRAND)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_authSRES,src={0X11,0X12,0X13,0X14}", test_aifg_ie_dt_authSRES)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_rpInd,src={0X01}", test_aifg_ie_dt_rpInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}   
	if (NULL == CU_add_test(pSuite, "aifg_ie_dt_facility", test_aifg_ie_dt_facility)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}  
	
	//message decode/encode test
	/* add static test suite to the registry */
	pSuite = CU_add_suite("Test message encode/decode", NULL, NULL);
	if (NULL == pSuite) {
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//assign request
	if (NULL == CU_add_test(pSuite, "assign request", test_aifg_msg_assignReq)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//assign complete
	if (NULL == CU_add_test(pSuite, "assign complete", test_aifg_msg_assignComplete)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//assign failure
	if (NULL == CU_add_test(pSuite, "assign failure", test_aifg_msg_assignFailure)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//block
	if (NULL == CU_add_test(pSuite, "block", test_aifg_msg_block)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//blocking  acknowledge
//	if (NULL == CU_add_test(pSuite, "blocking acknowledge", test_aifg_msg_blockAck)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//unblock
	if (NULL == CU_add_test(pSuite, "unblock", test_aifg_msg_unblock)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//unblock Ack
//	if (NULL == CU_add_test(pSuite, "unblock acknowledge", test_aifg_msg_unblockAck)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//handover required
	if (NULL == CU_add_test(pSuite, "handover required", test_aifg_msg_HORequired)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
/*	//handover request
	if (NULL == CU_add_test(pSuite, "handover request", test_aifg_msg_HORequest)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover request ack
	if (NULL == CU_add_test(pSuite, "handover request Ack", test_aifg_msg_HORequestAck)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover command
	if (NULL == CU_add_test(pSuite, "handover command", test_aifg_msg_HOCmd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover complete
	if (NULL == CU_add_test(pSuite, "handover complete", test_aifg_msg_HOComplete)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
*/	//handover candidate enquire
	if (NULL == CU_add_test(pSuite, "handover candidate enquire", test_aifg_msg_HOCandidateEnq)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover candidate response
	if (NULL == CU_add_test(pSuite, "handover candidate response", test_aifg_msg_HOCandidateResp)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover failure
	if (NULL == CU_add_test(pSuite, "handover failure", test_aifg_msg_HOFailure)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover performed
	if (NULL == CU_add_test(pSuite, "handover performed", test_aifg_msg_HOPerformed)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover reject
	if (NULL == CU_add_test(pSuite, "handover reject", test_aifg_msg_HOReject)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover succeed
	if (NULL == CU_add_test(pSuite, "handover succeed", test_aifg_msg_HOSucceed)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//handover detect
	if (NULL == CU_add_test(pSuite, "handover detect", test_aifg_msg_HODetect)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//resource request
	if (NULL == CU_add_test(pSuite, "resource request", test_aifg_msg_resrcReq)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//resource indication
	if (NULL == CU_add_test(pSuite, "resource indication", test_aifg_msg_resrcInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//paging
	if (NULL == CU_add_test(pSuite, "paging", test_aifg_msg_paging)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//clear request
	if (NULL == CU_add_test(pSuite, "clear request", test_aifg_msg_clearReq)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//clear command
	if (NULL == CU_add_test(pSuite, "clear command", test_aifg_msg_clearCmd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//reset
	if (NULL == CU_add_test(pSuite, "reset", test_aifg_msg_reset)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//overload
	if (NULL == CU_add_test(pSuite, "overload", test_aifg_msg_overload)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//MSC invoke trace
	if (NULL == CU_add_test(pSuite, "MSC invoke trace", test_aifg_msg_mscInvokeTrace)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//BSC invoke trace
	if (NULL == CU_add_test(pSuite, "BSC invoke trace", test_aifg_msg_bscInvokeTrace)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//classmark update
	if (NULL == CU_add_test(pSuite, "classmark update", test_aifg_msg_cmUpdate)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//cipher mode command
	if (NULL == CU_add_test(pSuite, "cipher mode command", test_aifg_msg_cipherModeCmd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//cipher mode complete
	if (NULL == CU_add_test(pSuite, "cipher mode complete", test_aifg_msg_cipherModeComplete)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//cipher mode reject
	if (NULL == CU_add_test(pSuite, "cipher mode reject", test_aifg_msg_cipherModeReject)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//complete layer 3 information
	if (NULL == CU_add_test(pSuite, "complete layer 3 information", test_aifg_msg_completeL3Info)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//SAPI_n_reject
	if (NULL == CU_add_test(pSuite, "SAPI_n_Reject", test_aifg_msg_SAPI_n_Reject)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//reset circuit 
	if (NULL == CU_add_test(pSuite, "reset circuit", test_aifg_msg_resetCircuit)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//reset circuit Ack   
//	if (NULL == CU_add_test(pSuite, "reset circuit Ack", test_aifg_msg_resetCircuitAck)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//circuit group block
	if (NULL == CU_add_test(pSuite, "circuit group block", test_aifg_msg_circuitGrpBlk)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//circuit group block Ack
//	if (NULL == CU_add_test(pSuite, "circuit group block Ack", test_aifg_msg_circuitGrpBlkAck)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//circuit group unblock
	if (NULL == CU_add_test(pSuite, "circuit group unblock", test_aifg_msg_circuitGrpUnblk)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//circuit group unblock Ack
//	if (NULL == CU_add_test(pSuite, "circuit group unblock Ack", test_aifg_msg_circuitGrpUnblkAck)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//confusion
	if (NULL == CU_add_test(pSuite, "confusion", test_aifg_msg_confusion)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//unequipped circuit
	if (NULL == CU_add_test(pSuite, "unequipped circuit", test_aifg_msg_unequippedCircuit)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//load indication
	if (NULL == CU_add_test(pSuite, "load indication", test_aifg_msg_loadIndication)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//suspend
	if (NULL == CU_add_test(pSuite, "suspend", test_aifg_msg_suspend)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//resume
	if (NULL == CU_add_test(pSuite, "resume", test_aifg_msg_resume)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//change circuit
//	if (NULL == CU_add_test(pSuite, "change circuit", test_aifg_msg_changeCircuit)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//change circuit Ack
//	if (NULL == CU_add_test(pSuite, "change circuit Ack", test_aifg_msg_changeCCAck)){
//	   CU_cleanup_registry();
//	   goto ERR_PROC;
//	}
	//location information command
	if (NULL == CU_add_test(pSuite, "location information command", test_aifg_msg_locCmd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//location information report
	if (NULL == CU_add_test(pSuite, "location information report", test_aifg_msg_locReport)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//reset Ack
	if (NULL == CU_add_test(pSuite, "reset Ack", test_aifg_msg_resetAck)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//clear complete
	if (NULL == CU_add_test(pSuite, "clear complete", test_aifg_msg_clearComplete)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//queuing indication
	if (NULL == CU_add_test(pSuite, "queuing indication", test_aifg_msg_queueInd)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//classmark request
	if (NULL == CU_add_test(pSuite, "classmark request", test_aifg_msg_cmkRequest)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	
//...................................dtap................................................................

	//location updating accept
	if (NULL == CU_add_test(pSuite, "location updating accept", test_aifg_msg_luAccept)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	//classmark reject
	if (NULL == CU_add_test(pSuite, "classmark reject", test_aifg_msg_cmReject)){
	   CU_cleanup_registry();
	   goto ERR_PROC;
	}
	
	//location updating reject
		if (NULL == CU_add_test(pSuite, "locatin updating reject", test_aifg_msg_luAccept)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//abort
		if (NULL == CU_add_test(pSuite, "abort", test_aifg_msg_abort)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//MM status
		if (NULL == CU_add_test(pSuite, "MM status", test_aifg_msg_mmStatus)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//loaction updating request
		if (NULL == CU_add_test(pSuite, "location updating request", test_aifg_msg_luRequest)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//authentication request
		if (NULL == CU_add_test(pSuite, "authentication request", test_aifg_msg_authRequest)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//authentication response
		if (NULL == CU_add_test(pSuite, "authentication response", test_aifg_msg_authResp)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//identity request
		if (NULL == CU_add_test(pSuite, "identity request", test_aifg_msg_idRequest)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//identity response
		if (NULL == CU_add_test(pSuite, "identity response", test_aifg_msg_idResp)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//IMSI detach indication
		if (NULL == CU_add_test(pSuite, "IMSI detach indication", test_aifg_msg_imsiDetachInd)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//TMSI command
		if (NULL == CU_add_test(pSuite, "TMSI command", test_aifg_msg_tmsiCmd)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//CM re-establishment request
		if (NULL == CU_add_test(pSuite, "CM re-establishment request", test_aifg_msg_cmReEst_Request)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//CM service request
		if (NULL == CU_add_test(pSuite, "CM service request", test_aifg_msg_cmRequest)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//MM information
		if (NULL == CU_add_test(pSuite, "MM information", test_aifg_msg_mmInfo)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//alerting
		if (NULL == CU_add_test(pSuite, "alerting", test_aifg_msg_alert)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//call confirmed
		if (NULL == CU_add_test(pSuite, "call confirmed", test_aifg_msg_callConfirm)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//call proceeding
		if (NULL == CU_add_test(pSuite, "call proceeding", test_aifg_msg_callProceed)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//connect
		if (NULL == CU_add_test(pSuite, "connect", test_aifg_msg_connect)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//emergency setup
		if (NULL == CU_add_test(pSuite, "emergency setup", test_aifg_msg_eSetup)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//progress
		if (NULL == CU_add_test(pSuite, "progress", test_aifg_msg_progress)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//setupu
		if (NULL == CU_add_test(pSuite, "setup", test_aifg_msg_setup)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//modify
		if (NULL == CU_add_test(pSuite, "modify", test_aifg_msg_modify)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//modify complete
		if (NULL == CU_add_test(pSuite, "modify complete", test_aifg_msg_modifyCmp)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//modify reject
		if (NULL == CU_add_test(pSuite, "modify reject", test_aifg_msg_modifyRej)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//user information
		if (NULL == CU_add_test(pSuite, "user information", test_aifg_msg_userInfo)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//hold reject
		if (NULL == CU_add_test(pSuite, "hold reject", test_aifg_msg_holdRej)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//retrieve reject
		if (NULL == CU_add_test(pSuite, "retrieve reject", test_aifg_msg_retrieveRej)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//disconnect
		if (NULL == CU_add_test(pSuite, "disconnect", test_aifg_msg_disconnect)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//release
		if (NULL == CU_add_test(pSuite, "release", test_aifg_msg_release)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//release complete
		if (NULL == CU_add_test(pSuite, "release complete", test_aifg_msg_releaseCmp)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//congestion control
		if (NULL == CU_add_test(pSuite, "congestion control", test_aifg_msg_congestCtrl)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//notify
		if (NULL == CU_add_test(pSuite, "notify", test_aifg_msg_notify)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//status
		if (NULL == CU_add_test(pSuite, "status", test_aifg_msg_status)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//start DTMF
		if (NULL == CU_add_test(pSuite, "start DTMF", test_aifg_msg_startDTMF)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//start DTMF acknowledge
		if (NULL == CU_add_test(pSuite, "start DTMF acknowledge", test_aifg_msg_startDTMF_ack)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//start DTMF reject
		if (NULL == CU_add_test(pSuite, "start DTMF reject", test_aifg_msg_startDTMF_rej)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//connect acknowledge
		if (NULL == CU_add_test(pSuite, "connect acknowledge", test_aifg_msg_connectAck)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//hold
		if (NULL == CU_add_test(pSuite, "hold", test_aifg_msg_hold)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//hold acknowledge
		if (NULL == CU_add_test(pSuite, "hold acknowledge", test_aifg_msg_holdAck)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//retrieve
		if (NULL == CU_add_test(pSuite, "retrieve", test_aifg_msg_retrieve)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//retrieve acknowledge
		if (NULL == CU_add_test(pSuite, "retrieve acknowledge", test_aifg_msg_retrieveAck)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//status enquiry
		if (NULL == CU_add_test(pSuite, "status enquiry", test_aifg_msg_statusEnq)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//stop DTMF
		if (NULL == CU_add_test(pSuite, "stop DTMF", test_aifg_msg_stopDTMF)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//stop DTMF acknowledge
		if (NULL == CU_add_test(pSuite, "stop DTMF acknowledge", test_aifg_msg_stopDTMF_ack)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//facility
		if (NULL == CU_add_test(pSuite, "facility", test_aifg_msg_facility)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//disconnect(mobile station to network)
		if (NULL == CU_add_test(pSuite, "disconnect_mobileToNet", test_aifg_msg_disconnect_mobileToNet)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}
	//paging response
		if (NULL == CU_add_test(pSuite, "paging response", test_aifg_msg_pagingResp)){
		   CU_cleanup_registry();
		   goto ERR_PROC;
		}

	/* Run all tests using the automated interface */
//	CU_basic_set_mode(CU_BRM_VERBOSE);
//	CU_basic_run_tests();
	CU_automated_run_tests();
	CU_list_tests_to_file();
	/* Clean up registry and return */
	CU_cleanup_registry();
	return 1;
   
ERR_PROC:
	return 0;
}

//Dynamic test----------------------------------------------------------------------
//stub function definition
#define MSC_SPC	0
#define BSC_SPC 1
#define MSC_PORT 4321
#define BSC_PORT 1234
#define MSC_LINK 10
#define BSC_LINK 20

int bsc_cg, msc_cg;
SP_UiPriPara msg_buffer[64];
int pMsg_h = 0 ,pMsg_t = 0;
aifg_msg_pre_decoded aifg_msg;

static u8 	ascii[16] = {0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
						 0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46};
void HexToDisplay(u8 *from_hex, u8 from_len)
{
	int	i = 0;
	
	for (i = 0; i < from_len; i++)
	{
		putchar(ascii[from_hex[i] >> 4]);
		putchar(ascii[from_hex[i] & 0x0f]);
		putchar(' ');
	}
	putchar('\n');
}

int PostSp ( SP_UiPriPara * pUiPriParam )
{
	if(pMsg_h != ((pMsg_t+1) & 0x3F)){	
		printf("\nSCCP SD:");
		switch(pUiPriParam->uUiPri){
			case N_UNITDATA_REQ:
				if(pUiPriParam->tPriUnion.tPriNUDataReq.tCDA.DPC == BSC_SPC)
					pUiPriParam->tPriUnion.tPriNUDataReq.tCGA.DPC = MSC_SPC;
				else
					pUiPriParam->tPriUnion.tPriNUDataReq.tCGA.DPC = BSC_SPC;

				msg_buffer[pMsg_t].uUiPri = N_UNITDATA_IND;
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNUDataInd.tCDA,
					&pUiPriParam->tPriUnion.tPriNUDataReq.tCDA,
					sizeof(pUiPriParam->tPriUnion.tPriNUDataReq.tCDA));
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNUDataInd.tCGA,
					&pUiPriParam->tPriUnion.tPriNUDataReq.tCGA,
					sizeof(pUiPriParam->tPriUnion.tPriNUDataReq.tCGA));
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNUDataInd.tUD,
					&pUiPriParam->tPriUnion.tPriNUDataReq.tUD,
					sizeof(pUiPriParam->tPriUnion.tPriNUDataReq.tUD));
					
				printf("TYPE: UDT\n");
				printf("%d => %d\n", 
					pUiPriParam->tPriUnion.tPriNUDataInd.tCGA.DPC,
					pUiPriParam->tPriUnion.tPriNUDataInd.tCDA.DPC);
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNUDataReq.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNUDataReq.tUD.uDataLen);
			break;

			case N_CONNECT_REQ:
				if(MSC_SPC == pUiPriParam->tPriUnion.tPriNConnReq.tCDA.DPC){
					pUiPriParam->wConnId = BSC_LINK;
					msg_buffer[pMsg_t].wConnId = MSC_LINK;
				}
				else{
					pUiPriParam->wConnId = MSC_LINK;
					msg_buffer[pMsg_t].wConnId = BSC_LINK;
				}
				msg_buffer[pMsg_t].uUiPri = N_CONNECT_IND;
				msg_buffer[pMsg_t].tPriUnion.tPriNConnInd.uOptFlag = 0x04;
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNConnInd.tCDA,
					&pUiPriParam->tPriUnion.tPriNConnReq.tCDA,
					sizeof(pUiPriParam->tPriUnion.tPriNConnReq.tCDA));
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNConnInd.tUD,
					&pUiPriParam->tPriUnion.tPriNConnReq.tUD,
					sizeof(pUiPriParam->tPriUnion.tPriNUDataReq.tUD));
					
				printf("TYPE: CR\n");
				printf("CDA: %d\n", pUiPriParam->tPriUnion.tPriNConnReq.tCDA.DPC);
				printf("LINK ID: %d\n", pUiPriParam->wConnId);
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNConnReq.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNConnReq.tUD.uDataLen);
			break;

			case N_CONNECT_RSP:
				if(pUiPriParam->wConnId == MSC_LINK)
					msg_buffer[pMsg_t].wConnId = BSC_LINK;
				else
					msg_buffer[pMsg_t].wConnId = MSC_LINK;

				msg_buffer[pMsg_t].uUiPri = N_CONNECT_CFM;

				if(0x08 == pUiPriParam->tPriUnion.tPriNConnRsp.uOptFlag)
					msg_buffer[pMsg_t].tPriUnion.tPriNConnCfm.uOptFlag = 0x04;
				else
					msg_buffer[pMsg_t].tPriUnion.tPriNConnCfm.uOptFlag = 0;
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNConnCfm.tUD,
					&pUiPriParam->tPriUnion.tPriNConnRsp.tUD,
					sizeof(pUiPriParam->tPriUnion.tPriNConnRsp.tUD));

				printf("TYPE: CC\n");
				printf("LINK ID: %d\n", pUiPriParam->wConnId);
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNConnRsp.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNConnRsp.tUD.uDataLen);
			break;

			case N_DISCONNECT_REQ:
				if(pUiPriParam->wConnId == MSC_LINK)
					msg_buffer[pMsg_t].wConnId = BSC_LINK;
				else
					msg_buffer[pMsg_t].wConnId = MSC_LINK;
				msg_buffer[pMsg_t].uUiPri = N_DISCONNECT_IND;
				printf("TYPE: RLSD\n");
				printf("LINK ID: %d\n", pUiPriParam->wConnId);
			break;

			case N_DATA_REQ:
				if(pUiPriParam->wConnId == MSC_LINK)
					msg_buffer[pMsg_t].wConnId = BSC_LINK;
				else
					msg_buffer[pMsg_t].wConnId = MSC_LINK;

				msg_buffer[pMsg_t].uUiPri = N_DATA_IND;
				memcpy(&msg_buffer[pMsg_t].tPriUnion.tPriNDataInd.tUD,
					&pUiPriParam->tPriUnion.tPriNDataReq.tUD,
					sizeof(pUiPriParam->tPriUnion.tPriNDataReq.tUD));
					
				printf("TYPE: DT1\n");
				printf("LINK ID: %d\n", pUiPriParam->wConnId);	
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNDataReq.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNDataReq.tUD.uDataLen);
			break;

			default:
				assert(0);
			break;
		}
		
		pMsg_t = ((pMsg_t + 1) & 0x3F);
	}
	
	return 0;
}

int SpSubmit ( SP_UiPriPara * pUiPriParam , BYTE uUlSapId )
{
	if(pMsg_h != pMsg_t){
		memcpy(pUiPriParam, &msg_buffer[pMsg_h], sizeof(SP_UiPriPara));
		pMsg_h = ((pMsg_h + 1) & 0x3F);

		//print
		printf("\nSCCP RV:");
		switch(pUiPriParam->uUiPri){
			case N_UNITDATA_IND:
				printf("TYPE: UDT\n");
				printf("%d <= %d\n", 
					pUiPriParam->tPriUnion.tPriNUDataInd.tCDA.DPC,
					pUiPriParam->tPriUnion.tPriNUDataInd.tCGA.DPC);				
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNUDataInd.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNUDataInd.tUD.uDataLen);
			break;

			case N_CONNECT_IND:
				printf("TYPE: CR\n");
				printf("CDA: %d\n", pUiPriParam->tPriUnion.tPriNConnInd.tCDA.DPC);
				printf("LINK ID: %d\n", pUiPriParam->wConnId);	
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNConnInd.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNConnInd.tUD.uDataLen);
			break;

			case N_CONNECT_CFM:
				printf("TYPE: CC\n");
				printf("LINK ID: %d\n", pUiPriParam->wConnId);
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNConnCfm.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNConnCfm.tUD.uDataLen);
			break;

			case N_DISCONNECT_IND:
				printf("TYPE: RLC\n");
				printf("LINK ID: %d\n", pUiPriParam->wConnId);	
			break;

			case N_DATA_IND:
				printf("TYPE: DT1\n");
				printf("LINK ID: %d\n", pUiPriParam->wConnId);	
				printf("CONTENT: ");
				HexToDisplay(pUiPriParam->tPriUnion.tPriNDataInd.tUD.aUserData,
						pUiPriParam->tPriUnion.tPriNDataInd.tUD.uDataLen);
			break;

			default:
				assert(0);
			break;
		}
		
		return 1;
	}
	return 0;
}

int test_call_back_msc(aifg_indication ind, aifg_msg_pre_decoded *msg)
{
	printf("MSC call back called\n");
	memcpy(&aifg_msg, msg, sizeof(aifg_msg));

	if(msg->port == -1){
		msg->port = MSC_PORT;
	}

	return 1;
}


int test_call_back_bsc(aifg_indication ind, aifg_msg_pre_decoded *msg)
{
	printf("BSC call back called\n");
	memcpy(&aifg_msg, msg, sizeof(aifg_msg));

	if(msg->port == -1){
		msg->port = BSC_PORT;		
	}

	return 1;
}

//end of stub function definition

int test_aifg_reset_proc()
{
	int i=0;
	
	//Precondition
	printf("\nTest case: Creating and reseting circuit group\n");
	aifg_bind(AIFG_SAP_MSC, test_call_back_msc);
	aifg_bind(AIFG_SAP_BSC, test_call_back_bsc);
	msc_cg = aifg_createCircuitGroup(AIFG_SAP_MSC, BSC_SPC, AIFG_NI_INTERNATIONAL);
	bsc_cg = aifg_createCircuitGroup(AIFG_SAP_BSC, MSC_SPC, AIFG_NI_INTERNATIONAL);
	aifg_set_running_mode(AIFG_RUN_MODE_SINGLE, 0);

	//waiting reset completed
	while(i++ < 6000){
		aifg_proc();
	}

	//Post condition
	
	printf("\nTest case: Creating and reseting circuit group completed!\n");
	return 1;
}

int test_aifg_sccp_link_setup()
{
	int msc_status = 0;
	int bsc_status = 0;
	
	printf("\nTest case: Sccp link setup and release\n");
	
	while(1){
		switch(bsc_status){
			case 0:	//send complete l3 information
				aifg_send(AIFG_SAP_BSC, bsc_cg, BSC_PORT, &bm_completeL3);
				bsc_status++;
			break;	
			
			case 1:	//wait cm accept
				if(aifg_msg.type == AIFG_MSG_ID_CM_ACCEPT)
					bsc_status++;
			break;
			
			case 2:	//send clear request
				aifg_send(AIFG_SAP_BSC, bsc_cg, BSC_PORT, &bm_clearReq);
				bsc_status++;
			break;
			
			case 3:	//wait clear command
				if(aifg_msg.type == AIFG_MSG_ID_CLR_CMD)
					bsc_status++;
			break;
			
			case 4: //send clear completed
				bm_clearComplete.id = AIFG_MSG_ID_CLR_CMP;
				aifg_send(AIFG_SAP_BSC, bsc_cg, BSC_PORT, &bm_clearComplete);
				bsc_status++;
			break;

			default:
			break;
		}

		switch(msc_status){
			case 0:	//wait complete l3 information 
				if(aifg_msg.type == AIFG_MSG_ID_L3_INFO)
					msc_status++;
			break;
			
			case 1:	//send cm service accept
				dt_cmAccept.id = AIFG_MSG_ID_CM_ACCEPT;
				aifg_send(AIFG_SAP_MSC, msc_cg, MSC_PORT, &dt_cmAccept);
				msc_status++;
			break;

			case 2: //wait clear request
				if(aifg_msg.type == AIFG_MSG_ID_CLR_REQ)
					msc_status++;
			break;

			case 3:	//send clear command
				aifg_send(AIFG_SAP_MSC, msc_cg, MSC_PORT, &bm_clearCmd);
				msc_status++;
			break;
			
			case 4:	//wait clear completed
				if(aifg_msg.type == AIFG_MSG_ID_CLR_CMP)
					msc_status++;
			break;

			default:
				printf("Test case: Sccp link setup and release completed!\n");
				return 1;
			break;
		}
		
		aifg_proc();
	}

	return 0;
}

int test_aifg_paging()
{
	int msc_status = 0;
	int bsc_status = 0;

	printf("\nTest case: Paging procedure\n");

	while(1){
		switch(msc_status){
			case 0:	//send paging request
				aifg_paging(AIFG_SAP_MSC, msc_cg, MSC_PORT, &bm_paging);
				msc_status++;
			break;	
			
			case 1:	//wait paging resp
				if(aifg_msg.type == AIFG_MSG_ID_L3_INFO
					&& aifg_msg.msg.completeL3Info.l3msg.id == AIFG_MSG_ID_PAGING_RESP)
					msc_status++;
			break;
			
			case 2:	//send setup
				aifg_send(AIFG_SAP_MSC, msc_cg, MSC_PORT, &bm_setup);
				msc_status++;
			break;

			case 3: //wait call confirm
				if(aifg_msg.type == AIFG_MSG_ID_CALL_CONFIRMED)
					msc_status++;
			break;

			case 4:	//send clear command
				aifg_send(AIFG_SAP_MSC, msc_cg, MSC_PORT, &bm_clearCmd);
				msc_status++;
			break;
			
			case 5:	//wait clear completed
				if(aifg_msg.type == AIFG_MSG_ID_CLR_CMP)
					msc_status++;
			break;		

			default:
				printf("Test case: Paging procedure completed!\n");
				return 1;
			break;
		}

		switch(bsc_status){
			case 0:	//wait paging request
				if(aifg_msg.type == AIFG_MSG_ID_PAGING){
					bsc_status++;
					memset(&aifg_msg, 0, sizeof(aifg_msg));
				}
			break;
			
			case 1:	//wait a second paging request
				if(aifg_msg.type == AIFG_MSG_ID_PAGING){
					bsc_status++;
				}
			break;

			case 2: //send paging response
				aifg_send(AIFG_SAP_BSC, bsc_cg, BSC_PORT, &rr_pagingResp);
				bsc_status++;
			break;

			case 3:	//wait setup
				if(aifg_msg.type == AIFG_MSG_ID_SETUP){
					bsc_status++;
				}
			break;
			
			case 4: //send call confirm
				dt_callCfm.id = AIFG_MSG_ID_CALL_CONFIRMED;
				dt_callCfm.msg.dtap_msg.ptr = msgsrc[69];
				dt_callCfm.msg.dtap_msg.len = 34;
				aifg_send(AIFG_SAP_BSC, bsc_cg, BSC_PORT, &dt_callCfm);
				bsc_status++;
			break;

			case 5:	//wait clear cmd
				if(aifg_msg.type == AIFG_MSG_ID_CLR_CMD)
					bsc_status++;
			break;

			case 6:	//send clear complete
				bm_clearComplete.id = AIFG_MSG_ID_CLR_CMP;
				aifg_send(AIFG_SAP_BSC, bsc_cg, BSC_PORT, &bm_clearComplete);
				bsc_status++;
			break;
			
			default:
			break;
		}
		
		aifg_proc();
	}
	
	printf("\nTest case: Paging completed\n");
	return 0;
}

int aifg_unit_test()
{
	int status = 0;

	//init
	pMsg_h = pMsg_t = 0;
	aifg_init();

	while(1){
		switch(status){
			case 0:
				//creat sap and circuit group
				if(1 == test_aifg_reset_proc())
					status++;
				break;

			case 1:
				//setup up sccp link
				if(1 == test_aifg_sccp_link_setup())
					status++;
				break;


			case 2:
				//paging
				if(1 == test_aifg_paging())
					status++;
				break;
				
			default:
				goto FINISH;
				break;
		}
	}

FINISH:
	return 0;
}

