本文整理汇总了C++中UnityAssertEqualNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ UnityAssertEqualNumber函数的具体用法?C++ UnityAssertEqualNumber怎么用?C++ UnityAssertEqualNumber使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UnityAssertEqualNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_histogramsEqual
void test_histogramsEqual()
{
int histogram1[26] = {0};
int histogram2[26] = {0};
histogram1[9] = 1;
histogram1[15] = 1;
histogram2[7] = 1;
histogram2[23] = 1;
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((histogramsEqual(histogram1, histogram1))), (((void *)0)), (_U_UINT)39, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((histogramsEqual(histogram1, histogram2))), (((void *)0)), (_U_UINT)40, UNITY_DISPLAY_STYLE_INT);
}
示例2: circularBufferNew
void test_circularBuffer_add_3_4_into_buffer_then_remove_tail_and_add_5_6_then_remove_tail_should_get_head_is_6_and_tail_is_5(void)
{
int value_been_removed ;
CircularBuffer *cb = circularBufferNew(5);
CircularBufferAdd(cb,3);
CircularBufferAdd(cb,4);
value_been_removed = circularBufferRemove(cb);
UnityAssertEqualNumber((_U_SINT)((3)), (_U_SINT)((value_been_removed)), (((void *)0)), (_U_UINT)237, UNITY_DISPLAY_STYLE_INT);
CircularBufferAdd(cb,5);
CircularBufferAdd(cb,6);
value_been_removed = circularBufferRemove(cb);
UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((value_been_removed)), (((void *)0)), (_U_UINT)241, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((cb->size)), (((void *)0)), (_U_UINT)242, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((5)), (_U_SINT)((*(cb->tail))), (((void *)0)), (_U_UINT)243, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((6)), (_U_SINT)((*(cb->head))), (((void *)0)), (_U_UINT)244, UNITY_DISPLAY_STYLE_INT);
}
示例3: test_stackPush_given_3number_push_to_stack_should_alocate
void test_stackPush_given_3number_push_to_stack_should_alocate(void)
{
stackNew(4);
stackPush(&stack , 1);
stackPush(&stack , 2);
stackPush(&stack , 3);
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((buffer[0])), (((void *)0)), (_U_UINT)38, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((buffer[1])), (((void *)0)), (_U_UINT)39, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((3)), (_U_SINT)((buffer[2])), (((void *)0)), (_U_UINT)40, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((3)), (_U_SINT)((stack.size)), (((void *)0)), (_U_UINT)41, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((stack.length)), (((void *)0)), (_U_UINT)42, UNITY_DISPLAY_STYLE_INT);
}
示例4: test_ISR_should_signal_every_500ms
void test_ISR_should_signal_every_500ms(void)
{
ticks = 0;
toggle = (0);
isr();
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((ticks)), (((void *)0)), (_U_UINT)57, UNITY_DISPLAY_STYLE_INT);
if (!(toggle)) {} else {UnityFail( (" Expected FALSE Was TRUE"), (_U_UINT)(_U_UINT)58);;};
ticks = 499;
isr();
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((ticks)), (((void *)0)), (_U_UINT)64, UNITY_DISPLAY_STYLE_INT);
if ((toggle)) {} else {UnityFail( (" Expected TRUE Was FALSE"), (_U_UINT)(_U_UINT)65);;};
}
示例5: test_create_message
void test_create_message(void)
{
cs_init();
char * dummy = "sample_text";
cs * new_message;
new_message = create_message(dummy);
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((strcmp(new_message->message,dummy))), (((void *)0)), (_U_UINT)35, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((new_message->id)), (((void *)0)), (_U_UINT)36, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((((void *)0))), (_U_SINT)((new_message->next)), (((void *)0)), (_U_UINT)37, UNITY_DISPLAY_STYLE_INT);
}
示例6: test_linkListHeadRemove_the_element_of_head_was_removed_and_the_head_point_the_next_of_head
void test_linkListHeadRemove_the_element_of_head_was_removed_and_the_head_point_the_next_of_head(void){
Tcb* temp;
LinkedlistTcb* root = &tcbRoot;
addList(root,&task1Tcb);
addList(root,&task2Tcb);
addList(root,&taskCPU);
temp = linkListHeadRemove(root);
UnityAssertEqualNumber((_U_SINT)(_UP)((&task2Tcb)), (_U_SINT)(_UP)((root->head)), (((void *)0)), (_U_UINT)(75), UNITY_DISPLAY_STYLE_HEX32);
UnityAssertEqualNumber((_U_SINT)(_UP)((&task1Tcb)), (_U_SINT)(_UP)((temp)), (((void *)0)), (_U_UINT)(76), UNITY_DISPLAY_STYLE_HEX32);
if ((((temp->next)) == ((void *)0))) {} else {UnityFail( (((" Expected NULL"))), (_U_UINT)((_U_UINT)((_U_UINT)(77))));};
}
示例7: test_getTime_it_should_return_100_150_250_300
void test_getTime_it_should_return_100_150_250_300(void){
resetTime();
int time = getTime();
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)47, UNITY_DISPLAY_STYLE_INT);
time = getTime();
UnityAssertEqualNumber((_U_SINT)((100)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)49, UNITY_DISPLAY_STYLE_INT);
time = getTime();
UnityAssertEqualNumber((_U_SINT)((150)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)51, UNITY_DISPLAY_STYLE_INT);
time = getTime();
UnityAssertEqualNumber((_U_SINT)((250)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)53, UNITY_DISPLAY_STYLE_INT);
time = getTime();
UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)55, UNITY_DISPLAY_STYLE_INT);
}
示例8: test_buttonFSM_in_Wait_state_prevState_is_Not_equal_curState_the_output_should_be_follow_curState
void test_buttonFSM_in_Wait_state_prevState_is_Not_equal_curState_the_output_should_be_follow_curState(void){
int buttonStateTable[] = {HIGH,LOW};
setButtonPointerTable(buttonStateTable);
resetTime();
ButtonSM *TaskButtonA = malloc(sizeof(ButtonSM));
buttonConfig(TaskButtonA,100);
buttonFSM(TaskButtonA);
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((TaskButtonA->recordedTime)), (((void *)0)), (_U_UINT)113, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((WAIT)), (_U_SINT)((TaskButtonA->state)), (((void *)0)), (_U_UINT)114, UNITY_DISPLAY_STYLE_INT);
buttonFSM(TaskButtonA);
UnityAssertEqualNumber((_U_SINT)((LOW)), (_U_SINT)((TaskButtonA->curState)), (((void *)0)), (_U_UINT)116, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((LOW)), (_U_SINT)((TaskButtonA->prevState)), (((void *)0)), (_U_UINT)117, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((IDLE)), (_U_SINT)((TaskButtonA->state)), (((void *)0)), (_U_UINT)118, UNITY_DISPLAY_STYLE_INT);
}
示例9: test_addList_add_task1Tcb_task2Tcb_and_taskCPU_into_linked_list_The_list_should_contain_three_element
void test_addList_add_task1Tcb_task2Tcb_and_taskCPU_into_linked_list_The_list_should_contain_three_element(void){
LinkedlistTcb* root = &tcbRoot;
initTask1Tcb(taskOne);
initTask2Tcb(taskTwo);
initTaskCPU();
tcbRootInit();
addList(root,&task1Tcb);
addList(root,&task2Tcb);
addList(root,&taskCPU);
UnityAssertEqualNumber((_U_SINT)(_UP)((&task1Tcb)), (_U_SINT)(_UP)((root->head)), (((void *)0)), (_U_UINT)(59), UNITY_DISPLAY_STYLE_HEX32);
UnityAssertEqualNumber((_U_SINT)(_UP)((&task2Tcb)), (_U_SINT)(_UP)((root->head->next)), (((void *)0)), (_U_UINT)(60), UNITY_DISPLAY_STYLE_HEX32);
UnityAssertEqualNumber((_U_SINT)(_UP)((&taskCPU)), (_U_SINT)(_UP)((root->head->next->next)), (((void *)0)), (_U_UINT)(61), UNITY_DISPLAY_STYLE_HEX32);
}
示例10: test_circularBufferRemove_given_3_4_5_remove_twice_should_get_5
void test_circularBufferRemove_given_3_4_5_remove_twice_should_get_5(void)
{
int value_been_removed ;
CircularBuffer *cb = circularBufferNew(5);
CircularBufferAdd(cb,3);
CircularBufferAdd(cb,4);
CircularBufferAdd(cb,5);
value_been_removed = circularBufferRemove(cb);
UnityAssertEqualNumber((_U_SINT)((3)), (_U_SINT)((value_been_removed)), (((void *)0)), (_U_UINT)221, UNITY_DISPLAY_STYLE_INT);
value_been_removed = circularBufferRemove(cb);
UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((value_been_removed)), (((void *)0)), (_U_UINT)223, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((cb->size)), (((void *)0)), (_U_UINT)224, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((5)), (_U_SINT)((*(cb->tail))), (((void *)0)), (_U_UINT)225, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((5)), (_U_SINT)((*(cb->head))), (((void *)0)), (_U_UINT)226, UNITY_DISPLAY_STYLE_INT);
}
示例11: test_circularBufferRemove_given_13_should_return_13
void test_circularBufferRemove_given_13_should_return_13(void)
{
unsigned int err;
CircularBuffer *cb = circularBufferNew(5);
int value_been_removed ;
{ jmp_buf *PrevFrame, NewFrame; unsigned int MY_ID = (0); PrevFrame = CExceptionFrames[(0)].pFrame; CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); CExceptionFrames[MY_ID].Exception = (0x5A5A5A5A); if (_setjmp(NewFrame) == 0) { if (&PrevFrame)
{
CircularBufferAdd(cb,13);
value_been_removed = circularBufferRemove(cb);
UnityAssertEqualNumber((_U_SINT)((13)), (_U_SINT)((value_been_removed)), (((void *)0)), (_U_UINT)180, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((cb->size)), (((void *)0)), (_U_UINT)181, UNITY_DISPLAY_STYLE_INT);
}else { } CExceptionFrames[MY_ID].Exception = (0x5A5A5A5A); } else { err = CExceptionFrames[MY_ID].Exception; err=err; } CExceptionFrames[MY_ID].pFrame = PrevFrame; } if (CExceptionFrames[(0)].Exception != (0x5A5A5A5A)){
UnityAssertEqualNumber((_U_SINT)((ERR_BUFFER_IS_EMPTY)), (_U_SINT)((err)), (((void *)0)), (_U_UINT)183, UNITY_DISPLAY_STYLE_INT);
printf("Caught a ERR_BUFFER_IS_EMPTY exception! Error code is: %i" , err);
}
circularBufferDel(cb);
}
示例12: test_configureAES_testing_configuration_in_AES128_AES192_AES256
void test_configureAES_testing_configuration_in_AES128_AES192_AES256(void) {
printf("No6.0 - configureAES\n");
int wordofSize;
int round;
int keySize;
configureAES(1,&keySize,&wordofSize,&round);
UnityAssertEqualNumber((_U_SINT)((10)), (_U_SINT)((round)), (((void *)0)), (_U_UINT)150, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((44)), (_U_SINT)((wordofSize)), (((void *)0)), (_U_UINT)151, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((keySize)), (((void *)0)), (_U_UINT)152, UNITY_DISPLAY_STYLE_INT);
configureAES(2,&keySize,&wordofSize,&round);
UnityAssertEqualNumber((_U_SINT)((12)), (_U_SINT)((round)), (((void *)0)), (_U_UINT)154, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((52)), (_U_SINT)((wordofSize)), (((void *)0)), (_U_UINT)155, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((6)), (_U_SINT)((keySize)), (((void *)0)), (_U_UINT)156, UNITY_DISPLAY_STYLE_INT);
configureAES(3,&keySize,&wordofSize,&round);
UnityAssertEqualNumber((_U_SINT)((14)), (_U_SINT)((round)), (((void *)0)), (_U_UINT)158, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((60)), (_U_SINT)((wordofSize)), (((void *)0)), (_U_UINT)159, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((8)), (_U_SINT)((keySize)), (((void *)0)), (_U_UINT)160, UNITY_DISPLAY_STYLE_INT);
}
示例13: test_add_message
void test_add_message(void){
cs*aux;
cs_init();
char * dummy1 = "sample_text_one";
char * dummy2 = "sample_text_two";
char * dummy3 = "CRK2X13xXDJl88bgt25l8UUIOTY5gWZVopxuE5FY4ifmK88vWlk3ri8eSenii5B7hP0qOfPa3eONPA65f8kpakXn9r56kN40s8lzQYiKvQZXF8g3ADRGpjPD7QYlxJQKOi4M1iokBGj1wAlBsBbiueX1L3vvTpNpEtJT1WWCtLjOQhWsrPzuS4ir0u7JpHEjFNyGJ9j4NpYRBNavpWbATMCiucJ4AIPOe7x3hwBEAWcMO2uxRkmh041vmYgNbPmcS8CFf1hJc3JJsgLqAjSgaRABytG8c1714JkumAXyO79fwxMquHC8tEe5eTje0ulnezpY6xuzJQgkpzGJIxwt5pX7sJ5gRomLR0WbRC9osgCHtxVn6ZCeppjr6MpUFXxZe6Cm84kDALqrRkogIDxjrEUt6u13TOzqX57z60ancHyGGVHxNV3vujuJPrhENzWm8P3Pr4MxqRUMffR7PW3y3t2vNawXWAERwNRfgjpI9xYvJU7FViEzZ9gHEePXR5bC177vth1bgAGH2z2vxrwzTB65goZ02wOcwV5IivbgOTt0OiW2b5DqMJUzhiHQ9Z1yMYpj01YED0zYRhrnI24WYWpWGbUFxhhBLw8j2mnqb7HnJMh5AYggk7aISWICSGVm7k5NfxKRx8KEvnxnyTcowRmkKo9ucAB0W8hLlBKRLaZSXiXjxpmaO0Av9PwC7PwrJcFXMahqtbjIScwwGCgpTq4UFPH3gDnXEafePkJlBRPKE9iWQYS54W84mh12YDcc69hWILJowQL07ICZ7BVbGJPvbE4EmcHpq7OPe9Krh6qPHtoONIspHEP5hzYIr5ENNrpRyOc5iBBSEHJXokOlI9DOGBS2F5GpHOgCbAPnZe8sKlN76jMP1f1zkfwPBijUgjjDnT6P2XM358WksyXC5FIk6hmmSh1Y1LWgrg9Lygabca292sn9ayfAwhDPwJXBZlADMOKKGLkqpt5uOGoMe48X6rVIgiuRSqPRJgBrrc0DkZ59n6T24sq7AxM3oxhX";
add_message(dummy1);
aux = cs_list->next;
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((strcmp(aux->message,dummy1))), (((void *)0)), (_U_UINT)53, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((aux->id)), (((void *)0)), (_U_UINT)54, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((((void *)0))), (_U_SINT)((aux->next)), (((void *)0)), (_U_UINT)55, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((number_of_messages)), (((void *)0)), (_U_UINT)56, UNITY_DISPLAY_STYLE_INT);
add_message(dummy2);
aux = aux->next;
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((strcmp(aux->message,dummy2))), (((void *)0)), (_U_UINT)61, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((aux->id)), (((void *)0)), (_U_UINT)62, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((((void *)0))), (_U_SINT)((aux->next)), (((void *)0)), (_U_UINT)63, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((number_of_messages)), (((void *)0)), (_U_UINT)64, UNITY_DISPLAY_STYLE_INT);
add_message(dummy3);
UnityAssertEqualNumber((_U_SINT)((((void *)0))), (_U_SINT)((aux->next)), (((void *)0)), (_U_UINT)67, UNITY_DISPLAY_STYLE_INT);
}
示例14: test_ListNew
void test_ListNew(void)
{
if ((((list->buffer)) != ((void *)0))) {} else {UnityFail( (" Expected Non-NULL"), (_U_UINT)(_U_UINT)(_U_UINT)20);;};
UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((list->size)), (((void *)0)), (_U_UINT)21, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((list->length)), (((void *)0)), (_U_UINT)22, UNITY_DISPLAY_STYLE_INT);
}
示例15: test_CircularBufferAdd_given_value_6_7_8_9_should_get_9_8_7_6
void test_CircularBufferAdd_given_value_6_7_8_9_should_get_9_8_7_6(void)
{
unsigned int err;
CircularBuffer *cb = circularBufferNew(5);
int *temp = cb->buffer;
{ jmp_buf *PrevFrame, NewFrame; unsigned int MY_ID = (0); PrevFrame = CExceptionFrames[(0)].pFrame; CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); CExceptionFrames[MY_ID].Exception = (0x5A5A5A5A); if (_setjmp(NewFrame) == 0) { if (&PrevFrame)
{
CircularBufferAdd(cb,6);
CircularBufferAdd(cb,7);
CircularBufferAdd(cb,8);
CircularBufferAdd(cb,9);
if ((((cb)) != ((void *)0))) {} else {UnityFail( (" Expected Non-NULL"), (_U_UINT)(_U_UINT)(_U_UINT)114);;};
if ((((cb->buffer)) != ((void *)0))) {} else {UnityFail( (" Expected Non-NULL"), (_U_UINT)(_U_UINT)(_U_UINT)115);;};
UnityAssertEqualNumber((_U_SINT)((5)), (_U_SINT)((cb->length)), (((void *)0)), (_U_UINT)116, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((cb->size)), (((void *)0)), (_U_UINT)117, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((6)), (_U_SINT)((*(temp))), (((void *)0)), (_U_UINT)118, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((7)), (_U_SINT)((*(temp+1))), (((void *)0)), (_U_UINT)119, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((8)), (_U_SINT)((*(temp+2))), (((void *)0)), (_U_UINT)120, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)((9)), (_U_SINT)((*(temp+3))), (((void *)0)), (_U_UINT)121, UNITY_DISPLAY_STYLE_INT);
UnityAssertEqualNumber((_U_SINT)(_UP)((9)), (_U_SINT)(_UP)((*(cb->head))), (((void *)0)), (_U_UINT)122, UNITY_DISPLAY_STYLE_HEX32);
UnityAssertEqualNumber((_U_SINT)(_UP)((6)), (_U_SINT)(_UP)((*(cb->tail))), (((void *)0)), (_U_UINT)123, UNITY_DISPLAY_STYLE_HEX32);
}else { } CExceptionFrames[MY_ID].Exception = (0x5A5A5A5A); } else { err = CExceptionFrames[MY_ID].Exception; err=err; } CExceptionFrames[MY_ID].pFrame = PrevFrame; } if (CExceptionFrames[(0)].Exception != (0x5A5A5A5A)){
UnityAssertEqualNumber((_U_SINT)((ERR_BUFFER_IS_FULL)), (_U_SINT)((err)), (((void *)0)), (_U_UINT)126, UNITY_DISPLAY_STYLE_INT);
UnityFail( ("Do not expect exception to be generated"), (_U_UINT)127);;
}
circularBufferDel(cb);
}