Exemplo n.º 1
0
/*******************************************************************************
* Function Name: UART_1_Sleep
********************************************************************************
*
* Summary:
*  Stops and saves the user configuration. Should be called 
*  just prior to entering sleep.
*  
*
* Parameters:
*  None.
*
* Return:
*  None.
*
* Global Variables:
*  UART_1_backup - modified when non-retention registers are saved.
*
* Reentrant:
*  No.
*
*******************************************************************************/
void UART_1_Sleep(void)
{

    #if(UART_1_RX_ENABLED || UART_1_HD_ENABLED)
        if((UART_1_RXSTATUS_ACTL_REG  & UART_1_INT_ENABLE) != 0u) 
        {
            UART_1_backup.enableState = 1u;
        }
        else
        {
            UART_1_backup.enableState = 0u;
        }
    #else
        if((UART_1_TXSTATUS_ACTL_REG  & UART_1_INT_ENABLE) !=0u)
        {
            UART_1_backup.enableState = 1u;
        }
        else
        {
            UART_1_backup.enableState = 0u;
        }
    #endif /* End UART_1_RX_ENABLED || UART_1_HD_ENABLED*/

    UART_1_Stop();
    UART_1_SaveConfig();
}
Exemplo n.º 2
0
/****************************************************************************
 *  Exported Functions
 ****************************************************************************/
uint8 ert_test_1(void)
{
    DE_LIST deque_1 = {0};
    DE_LIST deque_2 = {0};
    ER_LOCATION *location_0;
    char *message_0;
    ER_OBJECT *object_0;
    uint8 result = ERT_SUCCESS;
    char string_0[80];
    uint16 tag_0;
    RT_DATA *timestamp_0;
    
    UART_1_Start();
    
    UART_1_PutString("\x1b\x5b\x32\x4a");
    UART_1_PutString("ERROR MANAGEMENT LIBRARY TEST\r\n");
    UART_1_PutString("\r\n");
    UART_1_PutString("Test\tFunction\t\tResult\r\n");
    UART_1_PutString("----\t--------\t\t------\r\n");
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(NULL, E00900, ER_OPTIONS_NONE,
            NULL, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("   1\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   1\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(NULL, E00900, ER_OPTIONS_NONE,
            __FILE__, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("   2\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   2\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(&deque_1, E00900, ER_OPTIONS_NONE,
            NULL, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("   3\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   3\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(&deque_1, E00900, ER_OPTIONS_NONE,
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("   4\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   4\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_standard() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {
        if (object_0->error_type == ER_STANDARD_TYPE)
        {
            UART_1_PutString("   5\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   5\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->error.number == E00900)
        {
            UART_1_PutString("   6\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   6\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(&deque_1, E00900, ER_OPTIONS_TIMESTAMP,
            __FILE__, __LINE__) == ER_FAILURE)
        {
            UART_1_PutString("   7\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   7\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_standard() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (rt_start() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {   
        if (_add_standard(&deque_1, E00900, ER_OPTIONS_TIMESTAMP,
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("   8\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   8\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_standard() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {
        if (object_0->timestamp->Year == 1918)
        {
            UART_1_PutString("   9\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   9\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(&deque_1, E00900, ER_OPTIONS_LOCATION,
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("  10\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  10\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_standard() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {
        if (strcmp(object_0->location->file, ".\\error_test.c") == 0)
        {
            UART_1_PutString("  11\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  11\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(&deque_1, E00900,
            (ER_OPTIONS_TIMESTAMP | ER_OPTIONS_LOCATION),
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("  12\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  12\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_standard() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {
        if (object_0->timestamp->Month == 11)
        {
            UART_1_PutString("  13\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  13\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->location->line == 333)
        {
            UART_1_PutString("  14\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  14\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_standard() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_set_limit(&deque_1, 4) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_standard().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_standard(&deque_1, E00900,
            (ER_OPTIONS_TIMESTAMP | ER_OPTIONS_LOCATION),
            __FILE__, __LINE__) == ER_FULL)
        {
            UART_1_PutString("  15\ter_add_standard()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  15\ter_add_standard()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_set_limit(&deque_1, 0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_special(NULL, NULL, ER_OPTIONS_NONE,
            NULL, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  16\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  16\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(NULL, NULL, ER_OPTIONS_NONE,
            __FILE__, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  17\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  17\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(NULL, "Special message.", ER_OPTIONS_NONE,
            NULL, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  18\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  18\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(NULL, "Special message.", ER_OPTIONS_NONE,
            __FILE__, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  19\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  19\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, NULL, ER_OPTIONS_NONE,
            NULL, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  20\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  20\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, NULL, ER_OPTIONS_NONE,
            __FILE__, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  21\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  21\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.", ER_OPTIONS_NONE,
            NULL, __LINE__) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  22\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  22\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.", ER_OPTIONS_NONE,
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("  23\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  23\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (object_0->error_type == ER_SPECIAL_TYPE)
        {
            UART_1_PutString("  24\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  24\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (strcmp(object_0->error.message, "Special message.") == 0)
        {
            UART_1_PutString("  25\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  25\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (rt_stop() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.", ER_OPTIONS_TIMESTAMP,
            __FILE__, __LINE__) == ER_FAILURE)
        {
            UART_1_PutString("  26\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  26\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (rt_start() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.", ER_OPTIONS_TIMESTAMP,
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("  27\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  27\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (object_0->timestamp->DayOfMonth == 11)
        {
            UART_1_PutString("  28\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  28\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.", ER_OPTIONS_LOCATION,
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("  29\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  29\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (strcmp(object_0->location->file, ".\\error_test.c") == 0)
        {
            UART_1_PutString("  30\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  30\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.",
            (ER_OPTIONS_TIMESTAMP | ER_OPTIONS_LOCATION),
            __FILE__, __LINE__) == ER_SUCCESS)
        {
            UART_1_PutString("  31\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  31\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_get_last_object(&deque_1, &tag_0,
            (void **)&object_0) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (object_0->timestamp->Hour == 11)
        {
            UART_1_PutString("  32\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  32\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->location->line == 754)
        {
            UART_1_PutString("  33\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  33\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise _add_special() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (de_set_limit(&deque_1, 8) == DE_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test _add_special().
     */
    if (result == ERT_SUCCESS)
    {
        if (_add_special(&deque_1, "Special message.",
            (ER_OPTIONS_TIMESTAMP | ER_OPTIONS_LOCATION),
            __FILE__, __LINE__) == ER_FULL)
        {
            UART_1_PutString("  34\ter_add_special()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  34\ter_add_special()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_first_object().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_first_object(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  35\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  35\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_first_object(NULL, &object_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  36\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  36\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_first_object(&deque_1, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  37\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  37\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_first_object(&deque_1, &object_0) == ER_SUCCESS)
        {
            UART_1_PutString("  38\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  38\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->error_type == ER_STANDARD_TYPE)
        {
            UART_1_PutString("  39\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  39\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->timestamp == NULL)
        {
            UART_1_PutString("  40\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  40\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->location == NULL)
        {
            UART_1_PutString("  41\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  41\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_first_object(&deque_2, &object_0) == ER_EMPTY)
        {
            UART_1_PutString("  42\ter_get_first_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  42\ter_get_first_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
     
    /*
     *  Test er_get_last_object().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_last_object(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  43\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  43\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_last_object(NULL, &object_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  44\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  44\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_last_object(&deque_1, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  45\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  45\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_last_object(&deque_1, &object_0) == ER_SUCCESS)
        {
            UART_1_PutString("  46\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  46\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->error_type == ER_SPECIAL_TYPE)
        {
            UART_1_PutString("  47\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  47\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->timestamp != NULL)
        {
            UART_1_PutString("  48\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  48\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->location != NULL)
        {
            UART_1_PutString("  49\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  49\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_last_object(&deque_2, &object_0) == ER_EMPTY)
        {
            UART_1_PutString("  50\ter_get_last_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  50\ter_get_last_object()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_message().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_message(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  51\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  51\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_message(NULL, &message_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  52\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  52\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_message(object_0, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  53\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  53\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }

    if (result == ERT_SUCCESS)
    {
        if (er_get_message(object_0, &message_0) == ER_SUCCESS)
        {
            UART_1_PutString("  54\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  54\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->error_type == ER_SPECIAL_TYPE)
        {
            UART_1_PutString("  55\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  55\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (strcmp(message_0, "Special message.") == 0)
        {
            UART_1_PutString("  56\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  56\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise er_get_message() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_first_object(&deque_1, &object_0) == ER_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_message().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_message(object_0, &message_0) == ER_SUCCESS)
        {
            UART_1_PutString("  57\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  57\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (object_0->error_type == ER_STANDARD_TYPE)
        {
            UART_1_PutString("  58\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  58\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (strcmp(message_0, "E00900: Start of error management library error message block.") == 0)
        {
            UART_1_PutString("  59\ter_get_message()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  59\ter_get_message()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_remove().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_remove(NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  60\ter_remove()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  60\ter_remove()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_remove(&deque_1) == ER_SUCCESS)
        {
            UART_1_PutString("  61\ter_remove()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  61\ter_remove()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (deque_1.count == 7)
        {
            UART_1_PutString("  62\ter_remove()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  62\ter_remove()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_remove(&deque_2) == ER_EMPTY)
        {
            UART_1_PutString("  63\ter_remove()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  63\ter_remove()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_count().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_count(NULL) == 0)
        {
            UART_1_PutString("  64\ter_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  64\ter_get_count()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_count(&deque_1) == 7)
        {
            UART_1_PutString("  65\ter_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  65\ter_get_count()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_count(&deque_2) == 0)
        {
            UART_1_PutString("  66\ter_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  66\ter_get_count()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_timestamp().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_timestamp(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  67\ter_get_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  67\ter_get_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_timestamp(NULL, &timestamp_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  68\ter_get_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  68\ter_get_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_timestamp(object_0, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  69\ter_get_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  69\ter_get_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_timestamp(object_0, &timestamp_0) == ER_SUCCESS)
        {
            UART_1_PutString("  70\ter_get_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  70\ter_get_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (timestamp_0 == NULL)
        {
            UART_1_PutString("  71\ter_get_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  71\ter_get_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_location().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_location(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  72\ter_get_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  72\ter_get_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_location(NULL, &location_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  73\ter_get_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  73\ter_get_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_location(object_0, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  74\ter_get_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  74\ter_get_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_location(object_0, &location_0) == ER_SUCCESS)
        {
            UART_1_PutString("  75\ter_get_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  75\ter_get_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (location_0 == NULL)
        {
            UART_1_PutString("  76\ter_get_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  76\ter_get_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise er_convert_timestamp() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_last_object(&deque_1, &object_0) == ER_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_timestamp(object_0, &timestamp_0) == ER_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_convert_timestamp().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_convert_timestamp(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  77\ter_convert_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  77\ter_convert_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_convert_timestamp(NULL, string_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  78\ter_convert_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  78\ter_convert_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_convert_timestamp(timestamp_0, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  79\ter_convert_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  79\ter_convert_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_convert_timestamp().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_convert_timestamp(timestamp_0, string_0) == ER_SUCCESS)
        {
            UART_1_PutString("  80\ter_convert_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  80\ter_convert_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (strcmp(string_0, "11/11/1918 11:00:00") == ER_SUCCESS)
        {
            UART_1_PutString("  81\ter_convert_timestamp()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  81\ter_convert_timestamp()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Initialise er_convert_location() test.
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_location(object_0, &location_0) == ER_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_convert_location().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_convert_location(NULL, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  82\ter_convert_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  82\ter_convert_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_convert_location(NULL, string_0) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  83\ter_convert_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  83\ter_convert_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_convert_location(location_0, NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  84\ter_convert_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  84\ter_convert_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_convert_location(location_0, string_0) == ER_SUCCESS)
        {
            UART_1_PutString("  85\ter_convert_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  85\ter_convert_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (strcmp(string_0, "file .\\error_test.c line 754") == ER_SUCCESS)
        {
            UART_1_PutString("  86\ter_convert_location()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  86\ter_convert_location()\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_get_limit().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_get_limit(NULL) == 0)
        {
            UART_1_PutString("  87\ter_get_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  87\ter_get_limit()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_get_limit(&deque_1) == 8)
        {
            UART_1_PutString("  88\ter_get_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  88\ter_get_limit()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }

    /*
     *  Test er_set_limit().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_set_limit(&deque_1, 2) == ER_FAILURE)
        {
            UART_1_PutString("  89\ter_set_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  89\ter_set_limit()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_set_limit(&deque_1, 0) == ER_SUCCESS)
        {
            UART_1_PutString("  90\ter_set_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  90\ter_set_limit()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Test er_destroy().
     */
    if (result == ERT_SUCCESS)
    {
        if (er_destroy(NULL) == ER_BAD_ARGUMENT)
        {
            UART_1_PutString("  91\ter_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  91\ter_destroy()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    if (result == ERT_SUCCESS)
    {
        if (er_destroy(&deque_1) == ER_SUCCESS)
        {
            UART_1_PutString("  92\ter_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  92\ter_destroy()\t\tFAIL\r\n");
            result = ERT_FAILURE;
        }
    }
    
    /*
     *  Report test result.
     */
    if (result == ERT_SUCCESS)
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST PASSED\r\n");
    }
    else
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST FAILED\r\n");
    }
    
    /*
     *  Clean-up test.
     */
    while ((UART_1_ReadTxStatus() & UART_1_TX_STS_FIFO_EMPTY) !=
        UART_1_TX_STS_FIFO_EMPTY)
    {
        CyDelay(1);
    }
    
    UART_1_Stop();
    
    return result;
}
Exemplo n.º 3
0
/****************************************************************************
 *  Exported Functions
 ****************************************************************************/
uint8 clt_test_1(void)
{
    CL_LIST list_1 = {0};
    CL_LIST list_2 = {0};
    CL_LIST list_3 = {0};
    CLT_OBJECT *object_0;
    CLT_OBJECT *object_1;
    CLT_OBJECT *object_2;
    CLT_OBJECT *object_3;
    CLT_OBJECT *object_4;
    uint8 result = CLT_SUCCESS;
    uint16 tag_0;
    
    UART_1_Start();
    
    UART_1_PutString("\x1b\x5b\x32\x4a");
    UART_1_PutString("CIRCULAR LINKED LIBRARY LIBRARY TEST\r\n");
    UART_1_PutString("\r\n");
    UART_1_PutString("Test\tFunction\t\tResult\r\n");
    UART_1_PutString("----\t--------\t\t------\r\n");
    
    /*
     *  Initialise cl_add_after() test.
     */
    if (result == CLT_SUCCESS)
    {
        if (_create_object("three", 3, &object_3) == CLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (_create_object("four", 4, &object_4) == CLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_add_after().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(NULL, _TAG, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("   1\tcl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   1\tcl_add_after()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
     
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(NULL, _TAG, object_3) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("   2\tcl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   2\tcl_add_after()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_1, _TAG, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("   3\tcl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   3\tcl_add_after()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_1, _TAG, object_3) == CL_SUCCESS)
        {
            UART_1_PutString("   4\tcl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   4\tcl_add_after()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_1, _TAG, object_4) == CL_SUCCESS)
        {
            UART_1_PutString("   5\tcl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   5\tcl_add_after()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (list_1.count == 2)
        {
            UART_1_PutString("   6\tcl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   6\tcl_add_after()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Initialise cl_add_before() test.
     */
    if (result == CLT_SUCCESS)
    {
        if (_create_object("one", 1, &object_1) == CLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (_create_object("two", 2, &object_2) == CLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_add_before().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_add_before(NULL, _TAG, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("   7\tcl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   7\tcl_add_before()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
     
    if (result == CLT_SUCCESS)
    {
        if (cl_add_before(NULL, _TAG, object_1) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("   8\tcl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   8\tcl_add_before()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_before(&list_2, _TAG, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("   9\tcl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   9\tcl_add_before()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_before(&list_2, _TAG, object_1) == CL_SUCCESS)
        {
            UART_1_PutString("  10\tcl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  10\tcl_add_before()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_before(&list_2, _TAG, object_2) == CL_SUCCESS)
        {
            UART_1_PutString("  11\tcl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  11\tcl_add_before()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (list_2.count == 2)
        {
            UART_1_PutString("  12\tcl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  12\tcl_add_before()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_remove_current().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_remove_current(NULL, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  13\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  13\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_remove_current(NULL, (void **)&object_0) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  14\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  14\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_remove_current(&list_3, NULL) == CL_EMPTY)
        {
            UART_1_PutString("  15\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  15\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_remove_current(&list_2, NULL) == CL_SUCCESS)
        {
            UART_1_PutString("  16\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  16\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (list_2.count == 1)
        {
            UART_1_PutString("  17\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  17\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_remove_current(&list_2, (void **)&object_0) == CL_SUCCESS)
        {
            UART_1_PutString("  18\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  18\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (object_0->number == 2)
        {
            UART_1_PutString("  19\tcl_remove_current()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  19\tcl_remove_current()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Initialise cl_move_forward() test.
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_2, _TAG, object_1) == CL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_2, _TAG, object_4) == CL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_2, _TAG, object_3) == CL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_add_after(&list_2, _TAG, object_2) == CL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
        
    /*
     *  Test cl_move_forward().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_move_forward(NULL, 0) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  20\tcl_move_forward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  20\tcl_move_forward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
        
    if (result == CLT_SUCCESS)
    {
        if (cl_move_forward(&list_2, 0) == CL_SUCCESS)
        {
            UART_1_PutString("  21\tcl_move_forward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  21\tcl_move_forward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_move_forward(&list_2, 1) == CL_SUCCESS)
        {
            UART_1_PutString("  22\tcl_move_forward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  22\tcl_move_forward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }

    if (result == CLT_SUCCESS)
    {
        if (cl_move_forward(&list_2, 3) == CL_SUCCESS)
        {
            UART_1_PutString("  23\tcl_move_forward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  23\tcl_move_forward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        object_0 = (CLT_OBJECT *)list_2.list->object;
    
        if (object_0->number == 1)
        {
            UART_1_PutString("  24\tcl_move_forward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  24\tcl_move_forward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_move_backward().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_move_backward(NULL, 0) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  25\tcl_move_backward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  25\tcl_move_backward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
        
    if (result == CLT_SUCCESS)
    {
        if (cl_move_backward(&list_2, 0) == CL_SUCCESS)
        {
            UART_1_PutString("  26\tcl_move_backward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  26\tcl_move_backward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_move_backward(&list_2, 1) == CL_SUCCESS)
        {
            UART_1_PutString("  27\tcl_move_backward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  27\tcl_move_backward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }

    if (result == CLT_SUCCESS)
    {
        if (cl_move_backward(&list_2, 3) == CL_SUCCESS)
        {
            UART_1_PutString("  28\tcl_move_backward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  28\tcl_move_backward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        object_0 = (CLT_OBJECT *)list_2.list->object;
    
        if (object_0->number == 1)
        {
            UART_1_PutString("  29\tcl_move_backward()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  29\tcl_move_backward()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_get_current_object().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_get_current_object(NULL, NULL, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  30\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  30\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_get_current_object(NULL, NULL,
            (void **)&object_0) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  31\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  31\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_get_current_object(&list_2, NULL, NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  32\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  32\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_get_current_object(&list_2, NULL,
            (void **)&object_0) == CL_SUCCESS)
        {
            UART_1_PutString("  33\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  33\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (object_0->number == 1)
        {
            UART_1_PutString("  34\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  34\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_get_current_object(&list_2, &tag_0,
            (void **)&object_0) == CL_SUCCESS)
        {
            UART_1_PutString("  35\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  35\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (tag_0 == 500)
        {
            UART_1_PutString("  36\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  36\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_get_current_object(&list_3, &tag_0,
            (void **)&object_0) == CL_EMPTY)
        {
            UART_1_PutString("  37\tcl_get_current_object()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  37\tcl_get_current_object()\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_get_count().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_get_count(NULL) == 0)
        {
            UART_1_PutString("  38\tcl_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  38\tcl_get_count()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_get_count(&list_2) == 4)
        {
            UART_1_PutString("  39\tcl_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  39tcl_get_count()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Test cl_destroy().
     */
    if (result == CLT_SUCCESS)
    {
        if (cl_destroy(NULL) == CL_BAD_ARGUMENT)
        {
            UART_1_PutString("  40\tcl_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  40\tcl_destroy()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (cl_destroy(&list_2) == CL_SUCCESS)
        {
            UART_1_PutString("  41\tcl_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  41\tcl_destroy()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    if (result == CLT_SUCCESS)
    {
        if (list_2.count == 0)
        {
            UART_1_PutString("  42\tcl_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  42\tcl_destroy()\t\tFAIL\r\n");
            result = CLT_FAILURE;
        }
    }
    
    /*
     *  Report test result.
     */
    if (result == CLT_SUCCESS)
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST PASSED\r\n");
    }
    else
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST FAILED\r\n");
    }
        
    /*
     *  Clean-up test.
     */
    _destroy_object(object_1);
    _destroy_object(object_2);
    _destroy_object(object_3);
    _destroy_object(object_4);
    
    while ((UART_1_ReadTxStatus() & UART_1_TX_STS_FIFO_EMPTY) !=
        UART_1_TX_STS_FIFO_EMPTY)
    {
        CyDelay(1);
    }
    
    UART_1_Stop();
    
    return result;
}
Exemplo n.º 4
0
/*******************************************************************************
* Function Name: UART_1_Sleep
********************************************************************************
*
* Summary:
*  Prepares the component to enter Deep Sleep.
*  The "Enable wakeup from Sleep Mode" selection has an influence on
*  this function implementation.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void UART_1_Sleep(void)
{
#if(UART_1_SCB_MODE_UNCONFIG_CONST_CFG)

    if(UART_1_SCB_WAKE_ENABLE_CHECK)
    {
        if(UART_1_SCB_MODE_I2C_RUNTM_CFG)
        {
            UART_1_I2CSaveConfig();
        }
        else if(UART_1_SCB_MODE_EZI2C_RUNTM_CFG)
        {
            UART_1_EzI2CSaveConfig();
        }
    #if(!UART_1_CY_SCBIP_V1)
        else if(UART_1_SCB_MODE_SPI_RUNTM_CFG)
        {
            UART_1_SpiSaveConfig();
        }
        else if(UART_1_SCB_MODE_UART_RUNTM_CFG)
        {
            UART_1_UartSaveConfig();
        }
    #endif /* (!UART_1_CY_SCBIP_V1) */
        else
        {
            /* Unknown mode */
        }
    }
    else
    {
        UART_1_backup.enableState = (uint8) UART_1_GET_CTRL_ENABLED;

        if(0u != UART_1_backup.enableState)
        {
            UART_1_Stop();
        }
    }

#else

    #if (UART_1_SCB_MODE_I2C_CONST_CFG && UART_1_I2C_WAKE_ENABLE_CONST)
        UART_1_I2CSaveConfig();

    #elif (UART_1_SCB_MODE_EZI2C_CONST_CFG && UART_1_EZI2C_WAKE_ENABLE_CONST)
        UART_1_EzI2CSaveConfig();

    #elif (UART_1_SCB_MODE_SPI_CONST_CFG && UART_1_SPI_WAKE_ENABLE_CONST)
        UART_1_SpiSaveConfig();

    #elif (UART_1_SCB_MODE_UART_CONST_CFG && UART_1_UART_WAKE_ENABLE_CONST)
        UART_1_UartSaveConfig();

    #else

        UART_1_backup.enableState = (uint8) UART_1_GET_CTRL_ENABLED;

        if(0u != UART_1_backup.enableState)
        {
            UART_1_Stop();
        }

    #endif /* defined (UART_1_SCB_MODE_I2C_CONST_CFG) && (UART_1_I2C_WAKE_ENABLE_CONST) */

#endif /* (UART_1_SCB_MODE_UNCONFIG_CONST_CFG) */
}
Exemplo n.º 5
0
/****************************************************************************
 *  Exported Functions
 ****************************************************************************/
uint8 rtt_test_1(void)
{
    RT_DATA data_0;
    uint8 result = RTT_SUCCESS;
    char string[20] = {0};
        
    UART_1_Start();
    
    UART_1_PutString("\x1b\x5b\x32\x4a");
    UART_1_PutString("REAL-TIME CLOCK LIBRARY TEST\r\n");
    UART_1_PutString("\r\n");
    UART_1_PutString("Test\tFunction\t\tResult\r\n");
    UART_1_PutString("----\t--------\t\t------\r\n");
        
    /*
     *  Test rt_set_date().
     */
    if (result == RTT_SUCCESS)
    {   
        if (rt_set_date(27, 8, 2013) == RT_FAILURE)
        {
            UART_1_PutString("   1\trt_set_date()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   1\trt_set_date()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_set_date() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_start() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_set_date().
     */
    if (result == RTT_SUCCESS)
    {   
        if (rt_set_date(27, 8, 0) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("   2\trt_set_date()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   2\trt_set_date()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {    
        if (rt_set_date(27, 0, 2013) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("   3\trt_set_date()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   3\trt_set_date()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {    
        if (rt_set_date(0, 8, 2013) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("   4\trt_set_date()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   4\trt_set_date()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {   
        if (rt_set_date(27, 8, 2013) == RT_SUCCESS)
        {
            UART_1_PutString("   5\trt_set_date()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   5\trt_set_date()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_set_time() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_stop() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_set_time().
     */
    if (result == RTT_SUCCESS)
    {   
        if (rt_set_time(8, 24, 44) == RT_FAILURE)
        {
            UART_1_PutString("   6\trt_set_time()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   6\trt_set_time()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_set_time() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_start() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_set_time().
     */
    if (result == RTT_SUCCESS)
    {        
        if (rt_set_time(8, 24, 255) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("   7\trt_set_time()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   7\trt_set_time()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {    
        if (rt_set_time(8, 255, 44) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("   8\trt_set_time()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   8\trt_set_time()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {    
        if (rt_set_time(255, 24, 44) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("   9\trt_set_time()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   9\trt_set_time()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {    
        if (rt_set_time(8, 24, 44) == RT_SUCCESS)
        {
            UART_1_PutString("  10\trt_set_time()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  10\trt_set_time()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_write() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_stop() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_write().
     */
    if (result == RTT_SUCCESS)
    {   
        if (rt_write() == RT_FAILURE)
        {
            UART_1_PutString("  11\trt_write()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  11\trt_write()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_write() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_start() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_write().
     */
    if (result == RTT_SUCCESS)
    {   
        if (rt_write() == RT_SUCCESS)
        {
            UART_1_PutString("  12\trt_write()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  12\trt_write()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_read() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_stop() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_read().
     */
    if (result == RTT_SUCCESS)
    {   
        if (rt_read(&data_0) == RT_FAILURE)
        {
            UART_1_PutString("  13\trt_read()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  13\trt_read()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_read() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_start() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_read().
     */
    if (result == RTT_SUCCESS)
    {        
        if (rt_read(NULL) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("  14\trt_read()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  14\trt_read()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_read(&data_0) == RT_SUCCESS)
        {
            UART_1_PutString("  15\trt_read()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  15\trt_read()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (data_0.Year == 1918)
        {
            UART_1_PutString("  16\trt_read()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  16\trt_read()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_convert().
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_convert(NULL, NULL) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("  17\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  17\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_convert(NULL, string) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("  18\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  18\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_convert(&data_0, NULL) == RT_BAD_ARGUMENT)
        {
            UART_1_PutString("  19\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  19\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_convert() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_set_date(1, 2, 2013) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_set_time(3, 4, 5) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_write() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_read(&data_0) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_convert().
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_convert(&data_0, string) == RT_SUCCESS)
        {
            UART_1_PutString("  20\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  20\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
        
    if (result == RTT_SUCCESS)
    {   
        if (strcmp(string, "01/02/2013 03:04:05") == 0)
        {
            UART_1_PutString("  21\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  21\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_convert() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_set_date(11, 12, 2013) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_set_time(12, 13, 14) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_write() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_read(&data_0) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_convert().
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_convert(&data_0, string) == RT_SUCCESS)
        {
            UART_1_PutString("  22\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  22\trt_convert()\t\tPASS\r\n");
            result = RTT_FAILURE;
        }
    }
        
    if (result == RTT_SUCCESS)
    {   
        if (strcmp(string, "11/12/2013 12:13:14") == 0)
        {
            UART_1_PutString("  23\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  23\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Initialise rt_convert() test.
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_set_time(0, 0, 0) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_write() == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {
        if (rt_read(&data_0) == RT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
    
    /*
     *  Test rt_convert().
     */
    if (result == RTT_SUCCESS)
    {
        if (rt_convert(&data_0, string) == RT_SUCCESS)
        {
            UART_1_PutString("  24\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  24\trt_convert()\t\tPASS\r\n");
            result = RTT_FAILURE;
        }
    }
    
    if (result == RTT_SUCCESS)
    {   
        if (strcmp(string, "11/12/2013 00:00:00") == 0)
        {
            UART_1_PutString("  25\trt_convert()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  25\trt_convert()\t\tFAIL\r\n");
            result = RTT_FAILURE;
        }
    }
     
    /*
     *  Report test result.
     */
    if (result == RTT_SUCCESS)
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST PASSED\r\n");
    }
    else
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST FAILED\r\n");
    }
    
    /*
     *  Clean-up test.
     */
    while ((UART_1_ReadTxStatus() & UART_1_TX_STS_FIFO_EMPTY) !=
        UART_1_TX_STS_FIFO_EMPTY)
    {
        CyDelay(1);
    }
    
    UART_1_Stop();
    rt_stop();
    
    return result;
}
Exemplo n.º 6
0
/****************************************************************************
 *  Exported Functions
 ****************************************************************************/
uint8 dlt_test_1(void)
{
    DL_LIST *list_1 = NULL;
    DL_LIST *list_2 = NULL;
    DL_LIST *list_3 = NULL;
    DL_LIST *list_4 = NULL;
    DL_LIST *node_1;
    DL_LIST *node_2;
    DL_LIST *node_3;
    DL_LIST *node_4;
    DL_LIST *node_5;
    DLT_OBJECT *object_0;
    DLT_OBJECT *object_1;
    DLT_OBJECT *object_2;
    DLT_OBJECT *object_3;
    DLT_OBJECT *object_4;
    DLT_OBJECT *object_5;
    DLT_OBJECT *object_6;
    DLT_OBJECT *object_7;
    DLT_OBJECT *object_8;
    DLT_OBJECT *object_9;
    uint8 result = DLT_SUCCESS;
    uint16 tag_0;
    
    UART_1_Start();
    
    UART_1_PutString("\x1b\x5b\x32\x4a");
    UART_1_PutString("DOUBLY LINKED LIST LIBRARY TEST\r\n");
    UART_1_PutString("\r\n");
    UART_1_PutString("Test\tFunction\t\tResult\r\n");
    UART_1_PutString("----\t--------\t\t------\r\n");
    
    /*
     *  Initialise dl_create() test.
     */
    if (result == DLT_SUCCESS)
    {
        if (_create_object("one", 1, &object_1) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_create().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_create(NULL, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("   1\tdl_create()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   1\tdl_create()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }    
    
    if (result == DLT_SUCCESS)
    {
        if (dl_create(NULL, _TAG, object_1) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("   2\tdl_create()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   2\tdl_create()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {    
        if (dl_create(&node_1, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("   3\tdl_create()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   3\tdl_create()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_create(&node_1, _TAG, object_1) == DL_SUCCESS)
        {
            UART_1_PutString("   4\tdl_create()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   4\tdl_create()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Initialise dl_insert_before() test.
     */
    if (result == DLT_SUCCESS)
    {
        if (_create_object("two", 2, &object_2) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
        
    if (result == DLT_SUCCESS)
    {
        if (_create_object("three", 3, &object_3) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_create(&node_2, _TAG, object_2) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_create(&node_3, _TAG, object_3) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
        
    /*
     *  Test dl_insert_before().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_before(NULL, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("   5\tdl_insert_before()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   5\tdl_insert_before()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_before(NULL, node_1) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("   6\tdl_insert_before()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   6\tdl_insert_before()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_before(node_3, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("   7\tdl_insert_before()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   7\tdl_insert_before()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_before(node_3, node_1) == DL_SUCCESS)
        {
            UART_1_PutString("   8\tdl_insert_before()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   8\tdl_insert_before()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_before(node_3, node_2) == DL_SUCCESS)
        {
            UART_1_PutString("   9\tdl_insert_before()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   9\tdl_insert_before()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Initialise dl_insert_after() test.
     */
    if (result == DLT_SUCCESS)
    {
        if (_create_object("four", 4, &object_4) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
        
    if (result == DLT_SUCCESS)
    {
        if (_create_object("five", 5, &object_5) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_create(&node_4, _TAG, object_4) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_create(&node_5, _TAG, object_5) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
        
    /*
     *  Test dl_insert_after().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_after(NULL, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  10\tdl_insert_after()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  10\tdl_insert_after()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_after(NULL, node_5) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  11\tdl_insert_after()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  11\tdl_insert_after()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_after(node_3, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  12\tdl_insert_after()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  12\tdl_insert_after()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_after(node_3, node_5) == DL_SUCCESS)
        {
            UART_1_PutString("  13\tdl_insert_after()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  13\tdl_insert_after()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_insert_after(node_3, node_4) == DL_SUCCESS)
        {
            UART_1_PutString("  14\tdl_insert_after()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  14\tdl_insert_after()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_get_first().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_get_first(NULL) == NULL)
        {
            UART_1_PutString("  15\tdl_get_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  15\tdl_get_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_first(node_3) == node_1)
        {
            UART_1_PutString("  16\tdl_get_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  16\tdl_get_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Initialise dl_add_first() test.
     */
    if (result == DLT_SUCCESS)
    {
        if (_create_object("six", 6, &object_6) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (_create_object("seven", 7, &object_7) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_add_first().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_add_first(NULL, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  17\tdl_add_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  17\tdl_add_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_first(NULL, _TAG, object_7) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  18\tdl_add_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  18\tdl_add_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_first(&list_1, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  19\tdl_add_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  19\tdl_add_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_first(&list_1, _TAG, object_7) == DL_SUCCESS)
        {
            UART_1_PutString("  20\tdl_add_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  20\tdl_add_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_first(&list_1, _TAG, object_6) == DL_SUCCESS)
        {
            UART_1_PutString("  21\tdl_add_first()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  21\tdl_add_first()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_get_last().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_get_last(NULL) == NULL)
        {
            UART_1_PutString("  22\tdl_get_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  22\tdl_get_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_last(node_3) == node_5)
        {
            UART_1_PutString("  23\tdl_get_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  23\tdl_get_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Initialise dl_add_last() test.
     */
    if (result == DLT_SUCCESS)
    {
        if (_create_object("eight", 8, &object_8) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (_create_object("nine", 9, &object_9) == DLT_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_add_last().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_add_last(NULL, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  24\tdl_add_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  24\tdl_add_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_last(NULL, _TAG, object_8) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  25\tdl_add_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  25\tdl_add_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_last(&list_2, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  26\tdl_add_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  26\tdl_add_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_last(&list_2, _TAG, object_8) == DL_SUCCESS)
        {
            UART_1_PutString("  27\tdl_add_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  27\tdl_add_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_last(&list_2, _TAG, object_9) == DL_SUCCESS)
        {
            UART_1_PutString("  28\tdl_add_last()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  28\tdl_add_last()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_get_previous().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_get_previous(NULL) == NULL)
        {
            UART_1_PutString("  29\tdl_get_previous()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  29\tdl_get_previous()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_previous(node_3) == node_2)
        {
            UART_1_PutString("  30\tdl_get_previous()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  30\tdl_get_previous()\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_add_before().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_add_before(NULL, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  31\tdl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  31\tdl_add_before()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_before(NULL, _TAG, object_2) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  32\tdl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  32\tdl_add_before()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_before(&list_3, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  33\tdl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  33\tdl_add_before()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_before(&list_3, _TAG, object_2) == DL_SUCCESS)
        {
            UART_1_PutString("  34\tdl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  34\tdl_add_before()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_before(&list_3, _TAG, object_1) == DL_SUCCESS)
        {
            UART_1_PutString("  35\tdl_add_before()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  35\tdl_add_before()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_get_next().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_get_next(NULL) == NULL)
        {
            UART_1_PutString("  36\tdl_get_next()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  36\tdl_get_next()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_next(node_3) == node_4)
        {
            UART_1_PutString("  37\tdl_get_next()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  37\tdl_get_next()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_add_after().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_add_after(NULL, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  38\tdl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  38\tdl_add_after()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_after(NULL, _TAG, object_3) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  39\tdl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  39\tdl_add_after()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_after(&list_4, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  40\tdl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  40\tdl_add_after()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_after(&list_4, _TAG, object_3) == DL_SUCCESS)
        {
            UART_1_PutString("  41\tdl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  41\tdl_add_after()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_after(&list_4, _TAG, object_4) == DL_SUCCESS)
        {
            UART_1_PutString("  42\tdl_add_after()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  42\tdl_add_after()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_get_count().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_get_count(NULL) == 0)
        {
            UART_1_PutString("  43\tdl_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  43\tdl_get_count()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_count(node_3) == 5)
        {
            UART_1_PutString("  44\tdl_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  44\tdl_get_count()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_get_object().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_get_object(NULL, NULL, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  45\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  45\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_object(NULL, NULL, (void **)&object_0) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  46\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  46\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_object(node_3, NULL, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  47\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  47\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_object(node_3, NULL, (void **)&object_0) == DL_SUCCESS)
        {
            UART_1_PutString("  48\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  48\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (object_0->number == 3)
        {
            UART_1_PutString("  49\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  49\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_get_object(node_3, &tag_0, (void **)&object_0) == DL_SUCCESS)
        {
            UART_1_PutString("  50\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  50\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (tag_0 == 200)
        {
            UART_1_PutString("  51\tdl_get_object()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  51\tdl_get_object()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_extract().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_extract(NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  52\tdl_extract()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  52\tdl_extract()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_extract(node_4) == DL_SUCCESS)
        {
            UART_1_PutString("  53\tdl_extract()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  53\tdl_extract()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_delete().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_delete(NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  54\tdl_delete()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  54\tdl_delete()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_delete(node_5) == DL_SUCCESS)
        {
            UART_1_PutString("  55\tdl_delete()\t\tPASS\r\n");
            node_5 = NULL;
        }
        else
        {
            UART_1_PutString("  55\tdl_delete()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_destroy().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_destroy(NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  56\tdl_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  56\tdl_destroy()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_destroy(&node_2) == DL_SUCCESS)
        {
            UART_1_PutString("  57\tdl_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  57\tdl_destroy()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (node_2 == NULL)
        {
            UART_1_PutString("  58\tdl_destroy()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  58\tdl_destroy()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_join().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_join(NULL, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  59\tdl_join()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  59\tdl_join()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_join(NULL, list_2) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  60\tdl_join()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  60\tdl_join()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_join(list_1, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  61\tdl_join()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  61\tdl_join()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_join(list_1, list_2) == DL_SUCCESS)
        {
            UART_1_PutString("  62\tdl_join()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  62\tdl_join()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Initialise dl_exchange() test.
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_join(list_3, list_4) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_add_last(&list_4, _TAG, object_5) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_join(list_4, list_1) == DL_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        node_1 = dl_get_first(list_1);
        node_2 = list_3;
        node_3 = list_4;
    }
        
    /*
     *  Test dl_exchange().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(NULL, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  63\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  63\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(NULL, node_2) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  64\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  64\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(node_1, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  65\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  65\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(node_1, node_2) == DL_SUCCESS)
        {
            UART_1_PutString("  66\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  66\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(node_1, node_2) == DL_SUCCESS)
        {
            UART_1_PutString("  67\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  67\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(node_1, node_3) == DL_SUCCESS)
        {
            UART_1_PutString("  68\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  68\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_exchange(node_1, node_3) == DL_SUCCESS)
        {
            UART_1_PutString("  69\tdl_exchange()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  69\tdl_exchange()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Test dl_update().
     */
    if (result == DLT_SUCCESS)
    {
        if (dl_update(NULL, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  70\tdl_update()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  70\tdl_update()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_update(NULL, _TAG, object_1) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  71\tdl_update()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  71\tdl_update()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_update(&node_5, _TAG, NULL) == DL_BAD_ARGUMENT)
        {
            UART_1_PutString("  72\tdl_update()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  72\tdl_update()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        if (dl_update(&node_5, _TAG, object_1) == DL_SUCCESS)
        {
            UART_1_PutString("  73\tdl_update()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  73\tdl_update()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    if (result == DLT_SUCCESS)
    {
        object_0 = node_5->object;
        
        if (object_0->number == 1)
        {
            UART_1_PutString("  74\tdl_update()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  74\tdl_update()\t\tFAIL\r\n");
            result = DLT_FAILURE;
        }
    }
    
    /*
     *  Report test result.
     */
    if (result == DLT_SUCCESS)
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST PASSED\r\n");
    }
    else
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST FAILED\r\n");
    }
        
    /*
     *  Clean-up test.
     */
    _destroy_object(object_1);
    _destroy_object(object_2);
    _destroy_object(object_3);
    _destroy_object(object_4);
    _destroy_object(object_5);
    _destroy_object(object_6);
    _destroy_object(object_7);
    _destroy_object(object_8);
    _destroy_object(object_9);
    
    dl_delete(node_4);
    dl_destroy(&list_1);
    
    while ((UART_1_ReadTxStatus() & UART_1_TX_STS_FIFO_EMPTY) !=
        UART_1_TX_STS_FIFO_EMPTY)
    {
        CyDelay(1);
    }
    
    UART_1_Stop();
    
    return result;
}
Exemplo n.º 7
0
/****************************************************************************
 *  Exported Functions
 ****************************************************************************/
uint8 stt_test_1(void)
{
    uint8 result = STT_SUCCESS;
    char string_0[ST_NODE_LIMIT] = {0};
    
    UART_1_Start();
    
    UART_1_PutString("\x1b\x5b\x32\x4a");
    UART_1_PutString("FINITE STATE MACHINE LIBRARY TEST\r\n");
    UART_1_PutString("\r\n");
    UART_1_PutString("Test\tFunction\t\tResult\r\n");
    UART_1_PutString("----\t--------\t\t------\r\n");
    
    /*
     *  Initialise test.
     */
    if (result == STT_SUCCESS)
    {
        st_start();
        
        UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
    }
    
    /*
     *  Test st_add_key().
     */
    if (result == STT_SUCCESS)
    {
        if (st_add_key(NULL) == ST_BAD_ARGUMENT)
        {
            UART_1_PutString("   1\tst_add_key()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   1\tst_add_key()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {
        if (st_add_key("A") == ST_SUCCESS)
        {
            UART_1_PutString("   2\tst_add_key()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   2\tst_add_key()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
        
    /*
     *  Test st_get_limit().
     */
    if (result == STT_SUCCESS)
    {
        if (st_get_limit() == ST_NODE_LIMIT)
        {
            UART_1_PutString("   3\tst_get_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   3\tst_get_limit()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Initialise st_set_limit() test.
     */
    if (result == STT_SUCCESS)
    {
        if (st_add_key("B") == ST_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {
        if (st_add_key("C") == ST_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_set_limit().
     */
    if (result == STT_SUCCESS)
    {
        if (st_set_limit(1) == ST_FAILURE)
        {
            UART_1_PutString("   4\tst_set_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   4\tst_set_limit()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {
        if (st_set_limit(0) == ST_SUCCESS)
        {
            UART_1_PutString("   5\tst_set_limit()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   5\tst_set_limit()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_copy_buffer().
     */
    if (result == STT_SUCCESS)
    {
        if (st_copy_buffer(NULL) == ST_BAD_ARGUMENT)
        {
            UART_1_PutString("   6\tst_copy_buffer()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   6\tst_copy_buffer()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {
        if (st_copy_buffer(string_0) == ST_SUCCESS)
        {
            UART_1_PutString("   7\tst_copy_buffer()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   7\tst_copy_buffer()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {
        if (strcmp(string_0, "ABC") == ST_SUCCESS)
        {
            UART_1_PutString("   8\tst_copy_buffer()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   8\tst_copy_buffer()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
        
    /*
     *  Test st_get_count().
     */
    if (result == STT_SUCCESS)
    {
        if (st_get_count() == 3)
        {
            UART_1_PutString("   9\tst_get_count()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   9\tst_get_count()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
        
    /*
     *  Test st_empty_buffer().
     */
    if (result == STT_SUCCESS)
    {
        st_empty_buffer();
        
        if (st_get_count() == 0)
        {
            UART_1_PutString("  10\tst_empty_buffer()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  10\tst_empty_buffer()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_copy_buffer().
     */
    if (result == STT_SUCCESS)
    {
        if (st_copy_buffer(string_0) == ST_EMPTY)
        {
            UART_1_PutString("  11\tst_copy_buffer()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  11\tst_copy_buffer()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_is_valid_input().
     */
    if (result == STT_SUCCESS)
    {
        if (st_is_valid_input() == ST_FAILURE)
        {
            UART_1_PutString("  12\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  12\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Initialise st_is_valid_input() test.
     */
    if (result == STT_SUCCESS)
    {
        if (st_add_key("C") == ST_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_is_valid_input().
     */
    if (result == STT_SUCCESS)
    {
        if (st_is_valid_input() == ST_SUCCESS)
        {
            UART_1_PutString("  13\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  13\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {   
        if (st_get_count() == 0)
        {
            UART_1_PutString("  14\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  14\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_set_state().
     */
    if (result == STT_SUCCESS)
    {
        if (st_set_state(ST_STATE_MAXIMUM) == ST_BAD_ARGUMENT)
        {
            UART_1_PutString("  15\tst_set_state()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  15\tst_set_state()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
     
    if (result == STT_SUCCESS)
    {
        if (st_set_state(ST_STATE_4) == ST_SUCCESS)
        {
            UART_1_PutString("  16\tst_set_state()\t\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  16\tst_set_state()\t\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Initialise st_is_valid_input() test.
     */
    if (result == STT_SUCCESS)
    {
        if (st_add_key("\r") == ST_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_is_valid_input().
     */
    if (result == STT_SUCCESS)
    {
        if (st_is_valid_input() == ST_SUCCESS)
        {
            UART_1_PutString("  17\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  17\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {   
        if (st_get_count() == 1)
        {
            UART_1_PutString("  18\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  18\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Initialise st_is_valid_input() test.
     */
    if (result == STT_SUCCESS)
    {
        if (st_set_state(ST_STATE_2) == ST_SUCCESS)
        {
            UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("   -\tInitialise test...\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Test st_is_valid_input().
     */
    if (result == STT_SUCCESS)
    {   
        if (st_is_valid_input() == ST_FAILURE)
        {
            UART_1_PutString("  19\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  19\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    if (result == STT_SUCCESS)
    {
        st_set_bit(ST_HARDWARE_EVENT);
        
        if (st_is_valid_input() == ST_SUCCESS)
        {
            UART_1_PutString("  20\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  20\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
    
    /*
     *  Initialise st_is_valid_input() test.
     */
    if (result == STT_SUCCESS)
    {
        st_clear_bit(ST_CARRIAGE_RETURN);
        
        UART_1_PutString("   -\tInitialise test...\tPASS\r\n");
    }
    
    /*
     *  Test st_is_valid_input().
     */
    if (result == STT_SUCCESS)
    {   
        if (st_is_valid_input() == ST_FAILURE)
        {
            UART_1_PutString("  21\tst_is_valid_input()\tPASS\r\n");
        }
        else
        {
            UART_1_PutString("  21\tst_is_valid_input()\tFAIL\r\n");
            result = STT_FAILURE;
        }
    }
        
    /*
     *  Report test result.
     */
    if (result == STT_SUCCESS)
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST PASSED\r\n");
    }
    else
    {
        UART_1_PutString("\r\n");
        UART_1_PutString("TEST FAILED\r\n");
    }
    
    /*
     *  Clean-up test.
     */
    while (UART_1_ReadTxStatus() != UART_1_TX_STS_FIFO_EMPTY)
    {
        CyDelay(1);
    }
    
    UART_1_Stop();
    
    st_stop();
    
    return result;
}
/*******************************************************************************
* Function Name: UART_1_UartCyBtldrCommStop
****************************************************************************//**
*
*  Disables the UART component.
*
*******************************************************************************/
void UART_1_UartCyBtldrCommStop(void)
{
    UART_1_Stop();
}