コード例 #1
0
ファイル: TestCMockC.c プロジェクト: Cuixiaoxia198106/nfc
void test_MemNewWillReturnNullIfGivenIllegalSizes(void)
{
  TEST_ASSERT_NULL( CMock_Guts_MemNew(0) );
  TEST_ASSERT_NULL( CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) );

  //verify we're cleared still
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());
}
コード例 #2
0
ファイル: TestCMockC.c プロジェクト: Cuixiaoxia198106/nfc
void test_ThatWeCanAskForAllSortsOfSizes(void)
{
  unsigned int  i;
  unsigned int* first = NULL;
  unsigned int* next;
  unsigned int  sizes[5] = {3, 1, 80, 5, 4};
  unsigned int  sizes_buffered[5] = {4, 4, 80, 8, 4};
  unsigned int  sum = 0;

  for (i = 0; i < 5; i++)
  {
    next = CMock_Guts_MemNew(sizes[i]);
    TEST_ASSERT_NOT_NULL(next);

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

    sum += sizes_buffered[i] + 4;
    TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed());
    TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE - sum, CMock_Guts_MemBytesFree());
  }

  //show that we can't ask for too much memory
  TEST_ASSERT_NULL(CMock_Guts_MemNew(12));
  TEST_ASSERT_NULL(CMock_Guts_MemNew(5));

  //but we CAN ask for something that will still fit
  next = CMock_Guts_MemNew(4);
  TEST_ASSERT_NOT_NULL(next);

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

  //verify we're used up now
  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 < 6; i++)
  {
    TEST_ASSERT_NOT_NULL(next);
    next = CMock_Guts_MemNext(next);
  }

  //there aren't any after that
  TEST_ASSERT_NULL(next);
}
コード例 #3
0
ファイル: TestCMockCDynamic.c プロジェクト: legenddcr/Sonata
void test_ThatWeCanAskForAllSortsOfSizes(void)
{
  unsigned int  i;
  CMOCK_MEM_INDEX_TYPE first = CMOCK_GUTS_NONE;
  CMOCK_MEM_INDEX_TYPE next;
  unsigned int  sizes[10]          = {3,  1,  80,  5,  8,  31, 7,  911, 2,  80};
  unsigned int  sizes_buffered[10] = {16, 16, 88,  16, 16, 40, 16, 920, 16, 88}; //includes counter
  unsigned int  sum = 0;
  unsigned int  cap;

  for (i = 0; i < 10; i++)
  {
    next = CMock_Guts_MemNew(sizes[i]);
    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");

    sum += sizes_buffered[i];
    cap = (StartingSize > (sum + CMOCK_MEM_SIZE)) ? StartingSize : (sum + CMOCK_MEM_SIZE);
    TEST_ASSERT_EQUAL(sum, CMock_Guts_MemBytesUsed());
    TEST_ASSERT(cap >= 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");
    next = CMock_Guts_MemNext(next);
  }

  //there aren't any after that
  TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, next);
}
コード例 #4
0
ファイル: TestCMockC.c プロジェクト: samchen2009/CMock
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);
}
コード例 #5
0
ファイル: TestCMockCDynamic.c プロジェクト: legenddcr/Sonata
void test_MemNewWillReturnNullIfGivenIllegalSizes(void)
{
  TEST_ASSERT_EQUAL_HEX( CMOCK_GUTS_NONE, CMock_Guts_MemNew(0) );

  //verify we're cleared still
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesUsed());
  TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());
}
コード例 #6
0
void qeocore_remote_registration_init_cond_CMockExpect(UNITY_LINE_TYPE cmock_line)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeocore_remote_registration_init_cond_CALL_INSTANCE));
  CMOCK_qeocore_remote_registration_init_cond_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeocore_remote_registration_init_cond_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.qeocore_remote_registration_init_cond_CallInstance = CMock_Guts_MemChain(Mock.qeocore_remote_registration_init_cond_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
}
コード例 #7
0
void Adc_StartTemperatureSensorConversion_CMockExpect(UNITY_LINE_TYPE cmock_line)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Adc_StartTemperatureSensorConversion_CALL_INSTANCE));
  CMOCK_Adc_StartTemperatureSensorConversion_CALL_INSTANCE* cmock_call_instance = (CMOCK_Adc_StartTemperatureSensorConversion_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.Adc_StartTemperatureSensorConversion_CallInstance = CMock_Guts_MemChain(Mock.Adc_StartTemperatureSensorConversion_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
}
コード例 #8
0
ファイル: TestCMockC.c プロジェクト: Cuixiaoxia198106/nfc
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);
}
コード例 #9
0
void getFileSystemsInfo_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, diskSpaceStatParce* cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_getFileSystemsInfo_CALL_INSTANCE));
  CMOCK_getFileSystemsInfo_CALL_INSTANCE* cmock_call_instance = (CMOCK_getFileSystemsInfo_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.getFileSystemsInfo_CallInstance = CMock_Guts_MemChain(Mock.getFileSystemsInfo_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->ReturnVal = cmock_to_return;
}
コード例 #10
0
void qeo_deviceinfo_destruct_CMockExpect(UNITY_LINE_TYPE cmock_line, qeo_factory_t* factory)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_deviceinfo_destruct_CALL_INSTANCE));
  CMOCK_qeo_deviceinfo_destruct_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_deviceinfo_destruct_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_deviceinfo_destruct_CallInstance = CMock_Guts_MemChain(Mock.qeo_deviceinfo_destruct_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_qeo_deviceinfo_destruct(cmock_call_instance, factory);
}
コード例 #11
0
ファイル: TestCMockCDynamic.c プロジェクト: legenddcr/Sonata
void test_MemNewWillNowSupportSizesGreaterThanTheDefinesCMockSize(void)
{
    TEST_ASSERT_EQUAL(0, CMock_Guts_MemBytesFree());
	
    TEST_ASSERT_MESSAGE(CMock_Guts_MemNew(CMOCK_MEM_SIZE - TEST_MEM_INDEX_SIZE + 1) != CMOCK_GUTS_NONE, "Should Not Have Returned CMOCK_GUTS_NONE");

    TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE + TEST_MEM_INDEX_PAD, CMock_Guts_MemBytesUsed());
    TEST_ASSERT_EQUAL(CMOCK_MEM_SIZE, CMock_Guts_MemBytesFree());
}
コード例 #12
0
void qeo_platform_security_update_state_CMockExpect(UNITY_LINE_TYPE cmock_line, qeo_platform_security_context_t context, qeo_platform_security_state state, qeo_platform_security_state_reason state_reason)
{
    CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_platform_security_update_state_CALL_INSTANCE));
    CMOCK_qeo_platform_security_update_state_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_platform_security_update_state_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_update_state_CallInstance = CMock_Guts_MemChain(Mock.qeo_platform_security_update_state_CallInstance, cmock_guts_index);
    cmock_call_instance->LineNumber = cmock_line;
    CMockExpectParameters_qeo_platform_security_update_state(cmock_call_instance, context, state, state_reason);
}
コード例 #13
0
ファイル: mock_i2c.c プロジェクト: donghee/ossi_obc_spike
void I2CWriteInit_CMockExpect(UNITY_LINE_TYPE cmock_line)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_I2CWriteInit_CALL_INSTANCE));
  CMOCK_I2CWriteInit_CALL_INSTANCE* cmock_call_instance = (CMOCK_I2CWriteInit_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.I2CWriteInit_CallInstance = CMock_Guts_MemChain(Mock.I2CWriteInit_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
}
コード例 #14
0
void Adc_TemperatureSensorSampleReady_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, bool cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_Adc_TemperatureSensorSampleReady_CALL_INSTANCE));
  CMOCK_Adc_TemperatureSensorSampleReady_CALL_INSTANCE* cmock_call_instance = (CMOCK_Adc_TemperatureSensorSampleReady_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.Adc_TemperatureSensorSampleReady_CallInstance = CMock_Guts_MemChain(Mock.Adc_TemperatureSensorSampleReady_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->ReturnVal = cmock_to_return;
}
コード例 #15
0
ファイル: Mockpolicy.c プロジェクト: wjwwood/tinq-core
void qeo_security_policy_destroy_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, qeo_retcode_t cmock_to_return)
{
    CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_security_policy_destroy_CALL_INSTANCE));
    CMOCK_qeo_security_policy_destroy_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_security_policy_destroy_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_security_policy_destroy_CallInstance = CMock_Guts_MemChain(Mock.qeo_security_policy_destroy_CallInstance, cmock_guts_index);
    cmock_call_instance->LineNumber = cmock_line;
    memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_retcode_t));
}
コード例 #16
0
void operatorPush_CMockExpect(UNITY_LINE_TYPE cmock_line, Token* token)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_operatorPush_CALL_INSTANCE));
  CMOCK_operatorPush_CALL_INSTANCE* cmock_call_instance = (CMOCK_operatorPush_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.operatorPush_CallInstance = CMock_Guts_MemChain(Mock.operatorPush_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  CMockExpectParameters_operatorPush(cmock_call_instance, token);
}
コード例 #17
0
ファイル: Mockplatform.c プロジェクト: bq/qeo-core
void qeo_platform_get_key_value_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, qeo_util_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_platform_get_key_value_CALL_INSTANCE));
  CMOCK_qeo_platform_get_key_value_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_platform_get_key_value_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_get_key_value_CallInstance = CMock_Guts_MemChain(Mock.qeo_platform_get_key_value_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->ReturnVal = cmock_to_return;
  Mock.qeo_platform_get_key_value_IgnoreBool = (int)1;
}
コード例 #18
0
ファイル: Mockpolicy.c プロジェクト: wjwwood/tinq-core
void qeo_security_policy_get_fine_grained_rules_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, qeo_security_policy_hndl qeoSecPol, uintptr_t cookie, const char* topic_name, unsigned int selector_mask, qeo_security_policy_update_fine_grained_rules_cb update_cb, qeo_retcode_t cmock_to_return)
{
    CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_security_policy_get_fine_grained_rules_CALL_INSTANCE));
    CMOCK_qeo_security_policy_get_fine_grained_rules_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_security_policy_get_fine_grained_rules_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_security_policy_get_fine_grained_rules_CallInstance = CMock_Guts_MemChain(Mock.qeo_security_policy_get_fine_grained_rules_CallInstance, cmock_guts_index);
    cmock_call_instance->LineNumber = cmock_line;
    CMockExpectParameters_qeo_security_policy_get_fine_grained_rules(cmock_call_instance, qeoSecPol, cookie, topic_name, selector_mask, update_cb);
    memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_retcode_t));
}
コード例 #19
0
void sequence_member_accessor_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, qeocore_data_t* data, int index, qeocore_data_t** value, int get, qeo_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_sequence_member_accessor_CALL_INSTANCE));
  CMOCK_sequence_member_accessor_CALL_INSTANCE* cmock_call_instance = (CMOCK_sequence_member_accessor_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.sequence_member_accessor_CallInstance = CMock_Guts_MemChain(Mock.sequence_member_accessor_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_sequence_member_accessor(cmock_call_instance, data, index, value, get);
  memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_retcode_t));
}
コード例 #20
0
void data_alloc_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, DDS_DynamicType type, int prep_data, qeocore_data_t* cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_data_alloc_CALL_INSTANCE));
  CMOCK_data_alloc_CALL_INSTANCE* cmock_call_instance = (CMOCK_data_alloc_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.data_alloc_CallInstance = CMock_Guts_MemChain(Mock.data_alloc_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_data_alloc(cmock_call_instance, type, prep_data);
  cmock_call_instance->ReturnVal = cmock_to_return;
}
コード例 #21
0
ファイル: Mockuser_data.c プロジェクト: bq/qeo-core
void writer_user_data_update_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, const qeocore_writer_t* writer, qeo_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_writer_user_data_update_CALL_INSTANCE));
  CMOCK_writer_user_data_update_CALL_INSTANCE* cmock_call_instance = (CMOCK_writer_user_data_update_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.writer_user_data_update_CallInstance = CMock_Guts_MemChain(Mock.writer_user_data_update_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_writer_user_data_update(cmock_call_instance, writer);
  memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_retcode_t));
}
コード例 #22
0
ファイル: MockSystem.c プロジェクト: ThrowTheSwitch/blinky
void System_AbortRequested_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, int cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_System_AbortRequested_CALL_INSTANCE));
  CMOCK_System_AbortRequested_CALL_INSTANCE* cmock_call_instance = (CMOCK_System_AbortRequested_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.System_AbortRequested_CallInstance = CMock_Guts_MemChain(Mock.System_AbortRequested_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  cmock_call_instance->ReturnVal = cmock_to_return;
}
コード例 #23
0
ファイル: Mockplatform.c プロジェクト: bq/qeo-core
void qeo_platform_get_key_value_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, const char* key, char** value, qeo_util_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_platform_get_key_value_CALL_INSTANCE));
  CMOCK_qeo_platform_get_key_value_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_platform_get_key_value_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_get_key_value_CallInstance = CMock_Guts_MemChain(Mock.qeo_platform_get_key_value_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_qeo_platform_get_key_value(cmock_call_instance, key, value);
  memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_util_retcode_t));
}
コード例 #24
0
void PCA9548A_SetChannel_CMockExpect(UNITY_LINE_TYPE cmock_line, uint8_t channel)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_PCA9548A_SetChannel_CALL_INSTANCE));
  CMOCK_PCA9548A_SetChannel_CALL_INSTANCE* cmock_call_instance = (CMOCK_PCA9548A_SetChannel_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.PCA9548A_SetChannel_CallInstance = CMock_Guts_MemChain(Mock.PCA9548A_SetChannel_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->CallOrder = ++GlobalExpectCount;
  CMockExpectParameters_PCA9548A_SetChannel(cmock_call_instance, channel);
}
コード例 #25
0
void qeo_remote_registration_enable_using_new_registration_credentials_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, qeo_remote_registration_hndl_t remote_reg, qeo_retcode_t cmock_to_return)
{
  CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_qeo_remote_registration_enable_using_new_registration_credentials_CALL_INSTANCE));
  CMOCK_qeo_remote_registration_enable_using_new_registration_credentials_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_remote_registration_enable_using_new_registration_credentials_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_enable_using_new_registration_credentials_CallInstance = CMock_Guts_MemChain(Mock.qeo_remote_registration_enable_using_new_registration_credentials_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  CMockExpectParameters_qeo_remote_registration_enable_using_new_registration_credentials(cmock_call_instance, remote_reg);
  memcpy(&cmock_call_instance->ReturnVal, &cmock_to_return, sizeof(qeo_retcode_t));
}
コード例 #26
0
void qeo_remote_registration_enable_using_new_registration_credentials_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_enable_using_new_registration_credentials_CALL_INSTANCE));
  CMOCK_qeo_remote_registration_enable_using_new_registration_credentials_CALL_INSTANCE* cmock_call_instance = (CMOCK_qeo_remote_registration_enable_using_new_registration_credentials_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_enable_using_new_registration_credentials_CallInstance = CMock_Guts_MemChain(Mock.qeo_remote_registration_enable_using_new_registration_credentials_CallInstance, cmock_guts_index);
  cmock_call_instance->LineNumber = cmock_line;
  cmock_call_instance->ReturnVal = cmock_to_return;
  Mock.qeo_remote_registration_enable_using_new_registration_credentials_IgnoreBool = (int)1;
}
コード例 #27
0
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));
}
コード例 #28
0
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);
}
コード例 #29
0
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;
}
コード例 #30
0
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);
}