• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CMock_Guts_MemChain函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CMock_Guts_MemChain函数的典型用法代码示例。如果您正苦于以下问题:C++ CMock_Guts_MemChain函数的具体用法?C++ CMock_Guts_MemChain怎么用?C++ CMock_Guts_MemChain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CMock_Guts_MemChain函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: qeo_remote_registration_update_registration_status_CMockExpectAndReturn

void qeo_remote_registration_update_registration_status_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, qeo_remote_registration_hndl_t remote_reg, qeo_remote_registration_status_t status, qeo_remote_registration_failure_reason_t reason, qeo_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_remote_registration_update_registration_status_CALL_INSTANCE));
  CMOCK_qeo_remote_registration_update_registration_status_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_remote_registration_update_registration_status_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.qeo_remote_registration_update_registration_status_CallInstance = CMock_Guts_MemChain(Mock.qeo_remote_registration_update_registration_status_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_qeo_remote_registration_update_registration_status(cmock_call_instance, remote_reg, status, reason);
  memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_retcode_t));
}
开发者ID:FlavioFalcao,项目名称:tinq-core,代码行数:10,代码来源:Mockremote_registration.c


示例2: evaluate3_CMockExpect

void evaluate3_CMockExpect(UNITY_LINE_TYPE cmock_line, char* expression)
{
    CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_evaluate3_CALL_INSTANCE));
    CMOCK_evaluate3_CALL_INSTANCE* cmock_call_instance = (CMOCK_evaluate3_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
    UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
    Mock.evaluate3_CallInstance = CMock_Guts_MemChain(Mock.evaluate3_CallInstance, cmock_guts_index);
    cmock_call_instance->LineNumber = cmock_line;
    cmock_call_instance->CallOrder = ++GlobalExpectCount;
    CMockExpectParameters_evaluate3(cmock_call_instance, expression);
}
开发者ID:jasonchuah93,项目名称:ShuntingYard,代码行数:10,代码来源:mock_ShuntingYard.c


示例3: qeo_remote_registration_update_registration_status_CMockIgnoreAndReturn

void qeo_remote_registration_update_registration_status_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, qeo_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_remote_registration_update_registration_status_CALL_INSTANCE));
  CMOCK_qeo_remote_registration_update_registration_status_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_remote_registration_update_registration_status_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.qeo_remote_registration_update_registration_status_CallInstance = CMock_Guts_MemChain(Mock.qeo_remote_registration_update_registration_status_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->ReturnVal = cmock_to_return;
  Mock.qeo_remote_registration_update_registration_status_IgnoreBool = (int)1;
}
开发者ID:FlavioFalcao,项目名称:tinq-core,代码行数:10,代码来源:Mockremote_registration.c


示例4: operatorEvaluate_CMockExpect

void operatorEvaluate_CMockExpect(UNITY_LINE_TYPE cmock_line, Stack* numberStack, Stack* operatorStack)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_operatorEvaluate_CALL_INSTANCE));
  CMOCK_operatorEvaluate_CALL_INSTANCE* cmock_call_instance = (CMOCK_operatorEvaluate_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.operatorEvaluate_CallInstance = CMock_Guts_MemChain(Mock.operatorEvaluate_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  CMockExpectParameters_operatorEvaluate(cmock_call_instance, numberStack, operatorStack);
}
开发者ID:jasonchuah93,项目名称:JasonShuntingYard,代码行数:10,代码来源:mock_operatorEvaluate.c


示例5: calculate_CMockExpectAndReturn

void calculate_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, Operator* opeToken, Number* first, Number* second, Token* cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_calculate_CALL_INSTANCE));
  CMOCK_calculate_CALL_INSTANCE* cmock_call_instance = (CMOCK_calculate_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.calculate_CallInstance = CMock_Guts_MemChain(Mock.calculate_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  CMockExpectParameters_calculate(cmock_call_instance, opeToken, first, second);
  cmock_call_instance->ReturnVal = cmock_to_return;
}
开发者ID:jasonchuah93,项目名称:JasonShuntingYard,代码行数:11,代码来源:mock_calculateToken.c


示例6: Draw_Int_CMockExpect

void Draw_Int_CMockExpect(UNITY_LINE_TYPE cmock_line, int cmock_arg1)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Draw_Int_CALL_INSTANCE));
  CMOCK_Draw_Int_CALL_INSTANCE* cmock_call_instance = (CMOCK_Draw_Int_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.Draw_Int_CallInstance = CMock_Guts_MemChain(Mock.Draw_Int_CallInstance, cmock_guts_index);
  Mock.Draw_Int_IgnoreBool = (int)0;
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  CMockExpectParameters_Draw_Int(cmock_call_instance, cmock_arg1);
}
开发者ID:bbstar,项目名称:Continuous-Integration-Pilot,代码行数:11,代码来源:mock_display.c


示例7: getWordAndUpdate_CMockIgnoreAndReturn

void getWordAndUpdate_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, String* cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_getWordAndUpdate_CALL_INSTANCE));
  CMOCK_getWordAndUpdate_CALL_INSTANCE* cmock_call_instance = (CMOCK_getWordAndUpdate_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.getWordAndUpdate_CallInstance = CMock_Guts_MemChain(Mock.getWordAndUpdate_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;
  cmock_call_instance->ReturnVal = cmock_to_return;
  Mock.getWordAndUpdate_IgnoreBool = (int)1;
}
开发者ID:jasonchuah93,项目名称:LatestShuntingYard,代码行数:11,代码来源:mock_StringObject.c


示例8: system_write_CMockExpect

void system_write_CMockExpect(UNITY_LINE_TYPE cmock_line, S_DATA* dest, S_DATA value)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_system_write_CALL_INSTANCE));
  CMOCK_system_write_CALL_INSTANCE* cmock_call_instance = (CMOCK_system_write_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
  memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
  Mock.system_write_CallInstance = CMock_Guts_MemChain(Mock.system_write_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_system_write(cmock_call_instance, dest, value);
  UNITY_CLR_DETAILS();
}
开发者ID:BookProjects,项目名称:main_project,代码行数:11,代码来源:mock_system_memory_internals.c


示例9: stringRightTrim_CMockExpect

void stringRightTrim_CMockExpect(UNITY_LINE_TYPE cmock_line, String* string)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_stringRightTrim_CALL_INSTANCE));
  CMOCK_stringRightTrim_CALL_INSTANCE* cmock_call_instance = (CMOCK_stringRightTrim_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.stringRightTrim_CallInstance = CMock_Guts_MemChain(Mock.stringRightTrim_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;
  CMockExpectParameters_stringRightTrim(cmock_call_instance, string);
}
开发者ID:jasonchuah93,项目名称:LatestShuntingYard,代码行数:11,代码来源:mock_StringObject.c


示例10: Stack_create_CMockExpectAndThrow

void Stack_create_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Stack_create_CALL_INSTANCE));
  CMOCK_Stack_create_CALL_INSTANCE* cmock_call_instance = (CMOCK_Stack_create_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.Stack_create_CallInstance = CMock_Guts_MemChain(Mock.Stack_create_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;
  cmock_call_instance->ExceptionToThrow = cmock_to_throw;
}
开发者ID:Raydivine,项目名称:Insitution,代码行数:11,代码来源:mock_Stack.c


示例11: getWordAndUpdate_CMockExpectAndReturn

void getWordAndUpdate_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, String* line, char* delimiter, String* cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_getWordAndUpdate_CALL_INSTANCE));
  CMOCK_getWordAndUpdate_CALL_INSTANCE* cmock_call_instance = (CMOCK_getWordAndUpdate_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.getWordAndUpdate_CallInstance = CMock_Guts_MemChain(Mock.getWordAndUpdate_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;
  CMockExpectParameters_getWordAndUpdate(cmock_call_instance, line, delimiter);
  cmock_call_instance->ReturnVal = cmock_to_return;
}
开发者ID:jasonchuah93,项目名称:LatestShuntingYard,代码行数:12,代码来源:mock_StringObject.c


示例12: stringCopy_CMockExpectAndThrow

void stringCopy_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, char* source, char* destination, int startLocation, int length, CEXCEPTION_T cmock_to_throw)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_stringCopy_CALL_INSTANCE));
  CMOCK_stringCopy_CALL_INSTANCE* cmock_call_instance = (CMOCK_stringCopy_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.stringCopy_CallInstance = CMock_Guts_MemChain(Mock.stringCopy_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;
  CMockExpectParameters_stringCopy(cmock_call_instance, source, destination, startLocation, length);
  cmock_call_instance->ExceptionToThrow = cmock_to_throw;
}
开发者ID:jasonchuah93,项目名称:LatestShuntingYard,代码行数:12,代码来源:mock_StringObject.c


示例13: isNumber_CMockExpectAndReturn

void isNumber_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, Token* unknownToken, int cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_isNumber_CALL_INSTANCE));
  CMOCK_isNumber_CALL_INSTANCE* cmock_call_instance = (CMOCK_isNumber_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
  Mock.isNumber_CallInstance = CMock_Guts_MemChain(Mock.isNumber_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;
  CMockExpectParameters_isNumber(cmock_call_instance, unknownToken);
  cmock_call_instance->ReturnVal = cmock_to_return;
}
开发者ID:jasonchuah93,项目名称:Calculator,代码行数:12,代码来源:mock_nextToken.c


示例14: system_read_CMockExpectAndReturn

void system_read_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, S_DATA* src, S_DATA cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_system_read_CALL_INSTANCE));
  CMOCK_system_read_CALL_INSTANCE* cmock_call_instance = (CMOCK_system_read_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
  memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
  Mock.system_read_CallInstance = CMock_Guts_MemChain(Mock.system_read_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_system_read(cmock_call_instance, src);
  memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(S_DATA));
  UNITY_CLR_DETAILS();
}
开发者ID:BookProjects,项目名称:main_project,代码行数:12,代码来源:mock_system_memory_internals.c


示例15: system_init_CMockExpectAndReturn

void system_init_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, void* base_address, uint32_t type_size, void* cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_system_init_CALL_INSTANCE));
  CMOCK_system_init_CALL_INSTANCE* cmock_call_instance = (CMOCK_system_init_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);
  memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));
  Mock.system_init_CallInstance = CMock_Guts_MemChain(Mock.system_init_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_system_init(cmock_call_instance, base_address, type_size);
  cmock_call_instance->ReturnVal = cmock_to_return;
  UNITY_CLR_DETAILS();
}
开发者ID:BookProjects,项目名称:main_project,代码行数:12,代码来源:mock_system_memory_internals.c


示例16: test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd

void test_ThatCMockStopsReturningMoreDataWhenAskForMoreThanItHasLeftEvenIfNotAtExactEnd(void)
{
  unsigned int  i;
  CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
  CMOCK_MEM_INDEX_TYPE next;

  //we're asking for 12 bytes each time now (4 for index, 8 for data).
  //10 requests will give us 120 bytes used, which isn't enough for another 12 bytes if total memory is 128
  for (i = 0; i < 10; i++)
  {
    TEST_ASSERT_EQUAL(i*12, CMock_Guts_MemBytesUsed());
    TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*12, CMock_Guts_MemBytesFree());

    next = CMock_Guts_MemNew(8);
    TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");

    first = CMock_Guts_MemChain(first, next);
    TEST_ASSERT_MESSAGE(first != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");

    //verify writing data won't screw us up
    *((unsigned int*)CMock_Guts_GetAddressFor(next)) = i;
  }

  //verify we're at top of memory
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree());

  //The very next call will return a NONE, and any after that
  TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(8));
  TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, CMock_Guts_MemNew(5));

  //verify nothing has changed
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 8, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(8, CMock_Guts_MemBytesFree());

  //verify we can still walk through the elements allocated
  next = first;
  for (i = 0; i < 10; i++)
  {
    TEST_ASSERT_MESSAGE(next != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
    TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(next)));
    next = CMock_Guts_MemNext(next);
  }

  //there aren't any after that
  TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next);
}
开发者ID:samchen2009,项目名称:CMock,代码行数:47,代码来源:TestCMockC.c


示例17: test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory

void test_ThatCMockStopsReturningMoreDataWhenItRunsOutOfMemory(void)
{
  unsigned int  i;
  unsigned int* first = NULL;
  unsigned int* next;

  //even though we are asking for one byte, we've told it to align to closest 4 bytes, therefore it will waste a byte each time
  //so each call will use 8 bytes (4 for the index, 1 for the data, and 3 wasted).
  //therefore we can safely allocated total/8 times.
  for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++)
  {
    TEST_ASSERT_EQUAL(i*8, CMock_Guts_MemBytesUsed());
    TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - i*8, CMock_Guts_MemBytesFree());

    next = CMock_Guts_MemNew(1);
    TEST_ASSERT_NOT_NULL(next);

    first = CMock_Guts_MemChain(first, next);
    TEST_ASSERT_NOT_NULL(first);
  }

  //verify we're at top of memory
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());

  //The very next call will return a NULL, and any after that
  TEST_ASSERT_NULL(CMock_Guts_MemNew(1));
  TEST_ASSERT_NULL(CMock_Guts_MemNew(1));
  TEST_ASSERT_NULL(CMock_Guts_MemNew(1));

  //verify nothing has changed
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());

  //verify we can still walk through the elements allocated
  next = first;
  for (i = 0; i < (CMOCK_MEM_SIZE / 8); i++)
  {
    TEST_ASSERT_NOT_NULL(next);
    next = CMock_Guts_MemNext(next);
  }

  //there aren't any after that
  TEST_ASSERT_NULL(next);
}
开发者ID:Cuixiaoxia198106,项目名称:nfc,代码行数:45,代码来源:TestCMockC.c


示例18: qeo_platform_security_remote_registration_confirmation_needed_CMockExpectAndReturn

void qeo_platform_security_remote_registration_confirmation_needed_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, qeo_platform_security_context_t context, const qeo_platform_security_remote_registration_credentials_t* rrcred, qeo_platform_security_remote_registration_credentials_feedback_cb cb, qeo_util_retcode_t cmock_to_return)
{
    CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_platform_security_remote_registration_confirmation_needed_CALL_INSTANCE));
    CMOCK_qeo_platform_security_remote_registration_confirmation_needed_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_platform_security_remote_registration_confirmation_needed_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);
    UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, "CMock has run out of memory. Please allocate more.");
    Mock.qeo_platform_security_remote_registration_confirmation_needed_CallInstance = CMock_Guts_MemChain(Mock.qeo_platform_security_remote_registration_confirmation_needed_CallInstance, cmock_guts_index);
    cmock_call_instance->LineNumber = cmock_line;
    CMockExpectParameters_qeo_platform_security_remote_registration_confirmation_needed(cmock_call_instance, context, rrcred, cb);
    memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_util_retcode_t));
}
开发者ID:wjwwood,项目名称:tinq-core,代码行数:10,代码来源:Mockplatform_security.c


示例19: test_ThatWeCanClaimAndChainAFewElementsTogether

void test_ThatWeCanClaimAndChainAFewElementsTogether(void)
{
  unsigned int  i;
  unsigned int* first = NULL;
  unsigned int* next;
  unsigned int* element[4];

  //verify we're cleared first
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());

  //first element
  element[0] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_NOT_NULL(element[0]);
  first = CMock_Guts_MemChain(first, element[0]);
  TEST_ASSERT_EQUAL(element[0], first);
  *element[0] = 0;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //second element
  element[1] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_NOT_NULL(element[1]);
  TEST_ASSERT_NOT_EQUAL(element[0], element[1]);
  TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1]));
  *element[1] = 1;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //third element
  element[2] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_NOT_NULL(element[2]);
  TEST_ASSERT_NOT_EQUAL(element[0], element[2]);
  TEST_ASSERT_NOT_EQUAL(element[1], element[2]);
  TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2]));
  *element[2] = 2;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //fourth element
  element[3] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_NOT_NULL(element[3]);
  TEST_ASSERT_NOT_EQUAL(element[0], element[3]);
  TEST_ASSERT_NOT_EQUAL(element[1], element[3]);
  TEST_ASSERT_NOT_EQUAL(element[2], element[3]);
  TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3]));
  *element[3] = 3;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //traverse list
  next = first;
  for (i = 0; i < 4; i++)
  {
    TEST_ASSERT_EQUAL(element[i], next);
    TEST_ASSERT_EQUAL(i, *next);
    next = CMock_Guts_MemNext(next);
  }

  //verify we get a null at the end of the list
  TEST_ASSERT_NULL(next);

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //Free it all
  CMock_Guts_MemFreeAll();

  //verify we're cleared
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());
}
开发者ID:Cuixiaoxia198106,项目名称:nfc,代码行数:81,代码来源:TestCMockC.c


示例20: test_ThatWeCanClaimAndChainAFewElementsTogether

void test_ThatWeCanClaimAndChainAFewElementsTogether(void)
{
  unsigned int  i;
  CMOCK_MEM_INDEX_TYPE next;
  CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
  CMOCK_MEM_INDEX_TYPE element[4];

  //verify we're cleared first
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());

  //first element
  element[0] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_MESSAGE(element[0] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
  first = CMock_Guts_MemChain(first, element[0]);
  TEST_ASSERT_EQUAL(element[0], first);
  *((unsigned int*)CMock_Guts_GetAddressFor(element[0])) = 0;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 1 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //second element
  element[1] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_MESSAGE(element[1] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
  TEST_ASSERT_NOT_EQUAL(element[0], element[1]);
  TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[1]));
  *((unsigned int*)CMock_Guts_GetAddressFor(element[1])) = 1;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 2 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //third element
  element[2] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_MESSAGE(element[2] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
  TEST_ASSERT_NOT_EQUAL(element[0], element[2]);
  TEST_ASSERT_NOT_EQUAL(element[1], element[2]);
  TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[2]));
  *((unsigned int*)CMock_Guts_GetAddressFor(element[2])) = 2;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 3 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //fourth element
  element[3] = CMock_Guts_MemNew(sizeof(unsigned int));
  TEST_ASSERT_MESSAGE(element[3] != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");
  TEST_ASSERT_NOT_EQUAL(element[0], element[3]);
  TEST_ASSERT_NOT_EQUAL(element[1], element[3]);
  TEST_ASSERT_NOT_EQUAL(element[2], element[3]);
  TEST_ASSERT_EQUAL(first, CMock_Guts_MemChain(first, element[3]));
  *((unsigned int*)CMock_Guts_GetAddressFor(element[3])) = 3;

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //traverse list
  next = first;
  for (i = 0; i < 4; i++)
  {
    TEST_ASSERT_EQUAL(element[i], next);
    TEST_ASSERT_EQUAL(i, *((unsigned int*)CMock_Guts_GetAddressFor(element[i])));
    next = CMock_Guts_MemNext(next);
  }

  //verify we get a null at the end of the list
  TEST_ASSERT_EQUAL_HEX(CMOCK_GUTS_NONE, next);

  //verify we're using the right amount of memory
  TEST_ASSERT_EQUAL(4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - 4 * (TEST_MEM_INDEX_SIZE + 4), CMock_Guts_MemBytesFree());

  //Free it all
  CMock_Guts_MemFreeAll();

  //verify we're cleared
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());
}
开发者ID:samchen2009,项目名称:CMock,代码行数:81,代码来源:TestCMockC.c



注:本文中的CMock_Guts_MemChain函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CMock_Guts_MemNew函数代码示例发布时间:2022-05-30
下一篇:
C++ CMmsgPrint函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap