Example #1
0
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);



}
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);

}
Example #3
0
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);

}
Example #4
0
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);;};

}
Example #5
0
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);

}
Example #6
0
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))));};

}
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);

}
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);

}
Example #9
0
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);

}
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);

}
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);

}
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);

}
Example #13
0
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);



}
Example #14
0
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);

}
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);

}
void test_compareAndSwap_should_not_swap_if_in_order()

{

 int array[]={1,2};

 compareAndSwap(&array[0],&array[1]);

 UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((array[0])), (((void *)0)), (_U_UINT)11, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((array[1])), (((void *)0)), (_U_UINT)12, UNITY_DISPLAY_STYLE_INT);

}
void test_singleintegerswap_given_3_and_0_should_return_0_3(void)

{

 int number[] = {3,0};

 singleintegerbubblesort(number,2,2);

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((number[0])), (((void *)0)), (_U_UINT)58, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((3)), (_U_SINT)((number[1])), (((void *)0)), (_U_UINT)59, UNITY_DISPLAY_STYLE_INT);

}
void test_readButton(void){

  int buttonStateTable[] = {LOW,HIGH,LOW};

  setButtonPointerTable(buttonStateTable);

  UnityAssertEqualNumber((_U_SINT)((OFF)), (_U_SINT)((readButton())), (((void *)0)), (_U_UINT)62, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((ON)), (_U_SINT)((readButton())), (((void *)0)), (_U_UINT)63, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((OFF)), (_U_SINT)((readButton())), (((void *)0)), (_U_UINT)64, UNITY_DISPLAY_STYLE_INT);

}
void test_turnLED_Function_when_LED1_is_turned_ON_and_OFF(void){

  LED_t* LED1 = createLED();

  turnLED(LED1,ON);

  UnityAssertEqualNumber((_U_SINT)((ON)), (_U_SINT)((LED1->state)), (((void *)0)), (_U_UINT)20, UNITY_DISPLAY_STYLE_INT);

  turnLED(LED1,OFF);

  UnityAssertEqualNumber((_U_SINT)((OFF)), (_U_SINT)((LED1->state)), (((void *)0)), (_U_UINT)22, UNITY_DISPLAY_STYLE_INT);

}
void test_sortLargestToRightMost_should_move_largest_to_the_end()

{

 int array[]={13,9};

 sortLargestToRightMost(array,2);

 UnityAssertEqualNumber((_U_SINT)((9)), (_U_SINT)((array[0])), (((void *)0)), (_U_UINT)43, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((13)), (_U_SINT)((array[1])), (((void *)0)), (_U_UINT)44, UNITY_DISPLAY_STYLE_INT);

}
void test_compareAndSwap_should_swap_if_not_in_order_for_negative_numbers()

{

 int array[]={-11,-22};

 compareAndSwap(&array[0],&array[1]);

 UnityAssertEqualNumber((_U_SINT)((-22)), (_U_SINT)((array[0])), (((void *)0)), (_U_UINT)35, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((-11)), (_U_SINT)((array[1])), (((void *)0)), (_U_UINT)36, UNITY_DISPLAY_STYLE_INT);

}
void test_integerbubbleSort_give_size_smaller_than_actual_size_should_do_nothing(void)

{

 int number[]= {3,2};

 integerbubblesort(number,1);

 UnityAssertEqualNumber((_U_SINT)((3)), (_U_SINT)((number[0])), (((void *)0)), (_U_UINT)143, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((number[1])), (((void *)0)), (_U_UINT)144, UNITY_DISPLAY_STYLE_INT);

}
void test_compareAndSwap_should_swap_if_not_in_order()

{

 int array[]={8,4};

 compareAndSwap(&array[0],&array[1]);

 UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((array[0])), (((void *)0)), (_U_UINT)19, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((8)), (_U_SINT)((array[1])), (((void *)0)), (_U_UINT)20, UNITY_DISPLAY_STYLE_INT);

}
Example #24
0
void test_stackNew_should_setup_the_new_stack(void)

{

 if ((((&stack)) != ((void *)0))) {} else {UnityFail( (" Expected Non-NULL"), (_U_UINT)(_U_UINT)(_U_UINT)24);;};

 if ((((stack.buffer)) != ((void *)0))) {} else {UnityFail( (" Expected Non-NULL"), (_U_UINT)(_U_UINT)(_U_UINT)25);;};

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((stack.size)), (((void *)0)), (_U_UINT)26, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((4)), (_U_SINT)((stack.length)), (((void *)0)), (_U_UINT)27, UNITY_DISPLAY_STYLE_INT);

}
Example #25
0
void test_state_RELEASE_when_button_not_pressed_should_do_nothing(void)

{

  buttonA=NOT_PRESSED;

  TaskState tempA={RELEASED,0,0,LED_RED,BUTTON_A};



  UnityAssertEqualNumber((_U_SINT)((RELEASED)), (_U_SINT)((tempA.state)), (((void *)0)), (_U_UINT)65, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((tempA.recordTime)), (((void *)0)), (_U_UINT)66, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((tempA.interval)), (((void *)0)), (_U_UINT)67, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((LED_RED)), (_U_SINT)((tempA.whichLED)), (((void *)0)), (_U_UINT)68, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((BUTTON_A)), (_U_SINT)((tempA.whichButton)), (((void *)0)), (_U_UINT)69, UNITY_DISPLAY_STYLE_INT);



  buttonAndLed(&tempA);



  UnityAssertEqualNumber((_U_SINT)((LED_OFF)), (_U_SINT)((ledRed)), (((void *)0)), (_U_UINT)73, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((LED_OFF)), (_U_SINT)((ledGreen)), (((void *)0)), (_U_UINT)74, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((RELEASED)), (_U_SINT)((tempA.state)), (((void *)0)), (_U_UINT)75, UNITY_DISPLAY_STYLE_INT);

}
Example #26
0
void test_state_RELEASE_when_button_pressed_should_on_LED_and_change_state(void)

{

  buttonA=IS_PRESSED;

  TaskState tempA={RELEASED,0,0,LED_RED,BUTTON_A};



  UnityAssertEqualNumber((_U_SINT)((RELEASED)), (_U_SINT)((tempA.state)), (((void *)0)), (_U_UINT)47, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((tempA.recordTime)), (((void *)0)), (_U_UINT)48, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((tempA.interval)), (((void *)0)), (_U_UINT)49, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((LED_RED)), (_U_SINT)((tempA.whichLED)), (((void *)0)), (_U_UINT)50, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((BUTTON_A)), (_U_SINT)((tempA.whichButton)), (((void *)0)), (_U_UINT)51, UNITY_DISPLAY_STYLE_INT);



  buttonAndLed(&tempA);



  UnityAssertEqualNumber((_U_SINT)((LED_ON)), (_U_SINT)((ledRed)), (((void *)0)), (_U_UINT)55, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((LED_OFF)), (_U_SINT)((ledGreen)), (((void *)0)), (_U_UINT)56, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((IS_PRESSED)), (_U_SINT)((tempA.state)), (((void *)0)), (_U_UINT)57, UNITY_DISPLAY_STYLE_INT);

}
void test_integerbubblesort_given_2_1_should_return_1_2(void)

{

 int number[] = {2,1};

 integerbubblesort(number,2);

 UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((number[0])), (((void *)0)), (_U_UINT)94, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((2)), (_U_SINT)((number[1])), (((void *)0)), (_U_UINT)95, UNITY_DISPLAY_STYLE_INT);



}
void test_integerbubblesort_given_66_33_11_should_return_11_33_66(void)

{

 int number[] = {66,33,11};

 integerbubblesort(number,3);

 UnityAssertEqualNumber((_U_SINT)((11)), (_U_SINT)((number[0])), (((void *)0)), (_U_UINT)103, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((33)), (_U_SINT)((number[1])), (((void *)0)), (_U_UINT)104, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((66)), (_U_SINT)((number[2])), (((void *)0)), (_U_UINT)105, UNITY_DISPLAY_STYLE_INT);

}
Example #29
0
void test_module_generator_needs_to_be_implemented(void)

{

 UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((try_call())), (((void *)0)), (_U_UINT)14, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((try_call())), (((void *)0)), (_U_UINT)15, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((try_call())), (((void *)0)), (_U_UINT)16, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((try_call())), (((void *)0)), (_U_UINT)17, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((try_call())), (((void *)0)), (_U_UINT)18, UNITY_DISPLAY_STYLE_INT);

}
Example #30
0
void test_listRemove_given_11_12_should_remove_11_and_remain_1_size(void)

{

 listAdd(list , 11);

 listAdd(list , 12);

 UnityAssertEqualNumber((_U_SINT)((11)), (_U_SINT)((listRemove(list))), (((void *)0)), (_U_UINT)61, UNITY_DISPLAY_STYLE_INT);

 UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((list->size)), (((void *)0)), (_U_UINT)62, UNITY_DISPLAY_STYLE_INT);

 ListDel(list);

}