int main() { uint8 ch; /* Data sent on the serial port */ uint8 count = 0u; /* Initializing the count value */ uint8 pos = 0u; CyGlobalIntEnable; isr_1_Start(); /* Initializing the ISR */ UART_1_Start(); /* Enabling the UART */ LCD_Char_1_Start(); /* Enabling the LCD */ for(ch = START_CHAR_VALUE; ch <= END_CHAR_VALUE; ch++) { UART_1_WriteTxData(ch); /* Sending the data */ count++; if(count % LCD_NUM_COLUMNS == 0u) /* If the count value reaches the count 16 start from first location */ { pos = 0u; /* resets the count value */ LCD_Char_1_WriteControl(LCD_Char_1_CLEAR_DISPLAY); /* Display will be cleared when reached count value 16 */ } LCD_Char_1_Position(0u, pos++); /* LCD position to the count++ */ LCD_Char_1_PutChar(ch); /* print the value in the LCD */ LCD_Char_1_Position(1u, 0u); LCD_Char_1_PrintInt8(count); /* prints the count in the LCD */ CyDelay(200u); } for(;;) {} }
void main(void) { char LCDBuffer[15]; LCD_1_Start(); // Initialise le buffer d'envoi et de réception UART_1_CmdReset(); // Autorisation des interruptions globales M8C_EnableGInt; //Autorise les interruptions sur RX UART_1_IntCntl(UART_1_ENABLE_RX_INT); // Paramétrage pour aucun bit de parité UART_1_Start(UART_1_PARITY_NONE); // Démarrage du Timer au vu d'ajouter une deuxième caméra Timer32_1_Start(); // Autorisation des interruptions pour le timer Timer32_1_EnableInt(); LED1_PWM_Start(); LED2_PWM_Start(); SPIM_1_Start(SPIM_1_SPIM_MODE_0 | SPIM_1_SPIM_MSB_FIRST); SPIM_2_Start(SPIM_2_SPIM_MODE_0 | SPIM_2_SPIM_MSB_FIRST); while (1){ } }
/******************************************************************************* * 初始化函数 ********************************************************************************/ void init() { CyGlobalIntEnable; //全局中断开启 ADC_DelSig_1_Start(); /* 配置并开启ADC */ ADC_DelSig_1_StartConvert(); /* 开始进行转换 */ Uart_Rx_ISR_StartEx(RxInterruptHandler); /* 开启 Uart Rx 中断 并连接到 RxInterruptHandler */ Uart_Tx_ISR_StartEx(TxInterruptHandler); /* 开启 Uart Tx 并连接到 TxInterruptHandler */ UART_Start(); /* 开启 UART */ Uart_Rx_ISR_1_StartEx(Rx_1_InterruptHandler); /* 开启 Uart Rx 中断 并连接到 RxInterruptHandler */ Uart_Tx_ISR_1_StartEx(Tx_1_InterruptHandler); /* 开启 Uart Tx 并连接到 TxInterruptHandler */ UART_1_Start(); /* 开启 UART1 */ Uart_Rx_ISR_2_StartEx(Rx_1_InterruptHandler); /* 开启 Uart Rx 中断 并连接到 RxInterruptHandler */ Uart_Tx_ISR_2_StartEx(Tx_1_InterruptHandler); /* 开启 Uart Tx 并连接到 TxInterruptHandler */ UART_2_Start(); /* 开启 UART2 */ Timer_ISR_StartEx(TimerInterruptHandler); /* 开启 Timer 中断并连接到 TimerInterruptHandler */ Timer_Start(); /* 开启定时器 */ LCD_Char_1_Start(); /* 初始化并清除LCD */ //LCD_Char_1_PrintString("init"); }
int main() { /*UART initiering*/ UART_1_Start(); UART_1_UartPutString("This is a unit test of accelerometer ADXL345\n\r\n"); /*I2C initiering*/ I2C_1_Start(); I2C_1_I2CMasterClearStatus(); /*Opsætter accellerometer til I2C*/ if(I2C_1_I2CMasterSendStart(ACCEL_ADDRESS, I2C_1_I2C_WRITE_XFER_MODE) == I2C_1_I2C_MSTR_NO_ERROR && I2C_1_I2CMasterWriteByte(PWR_CTRL_REG) == I2C_1_I2C_MSTR_NO_ERROR && I2C_1_I2CMasterWriteByte(PWR_MODE) == I2C_1_I2C_MSTR_NO_ERROR) UART_1_UartPutString("Accelerometer ADXL345 initialized.\n\r\n"); UART_1_UartPutString("10000 reads, from reg DEVID, will now be performed.\n\rPlease wait.\n\r\n"); I2C_1_I2CMasterSendStop(); int errors = 0; //Variabel til at tælle fejl int i; for(i = 0; i < 10000; i++) //Forløkke som løber igennem læsningen 10000 gange. (fra DEVID) { if (I2C_1_I2CMasterSendStart(ACCEL_ADDRESS, I2C_1_I2C_WRITE_XFER_MODE) == I2C_1_I2C_MSTR_NO_ERROR) /* Tjekker om transfer er sket uden fejl */ { if(I2C_1_I2CMasterWriteByte(DEVID) == I2C_1_I2C_MSTR_NO_ERROR) { if(I2C_1_I2CMasterSendRestart(ACCEL_ADDRESS, I2C_1_I2C_READ_XFER_MODE) == I2C_1_I2C_MSTR_NO_ERROR) { rawData = I2C_1_I2CMasterReadByte(I2C_1_I2C_NAK_DATA); //Læser og gemmer læsningen i rawData I2C_1_I2CMasterSendStop(); if(rawData != 0xE5)errors++; //Hvis der læses andet end device ID, inkrementeres fejl. } else { I2C_1_I2CMasterSendStop(); /* Send Stop */ errors++; } } else { errors++; } } else { I2C_1_I2CMasterSendStop(); /* Send Stop */ errors++; } } char errorString[32]; sprintf(errorString, "Finished reading.\n\rErrors: %d\n\r\n", errors); //Gemmer antal errors i en string UART_1_UartPutString(errorString); //Udskriver hvor mange fejl. char readingString[32]; sprintf(readingString, "Data from register: %d\n\r\n", rawData); // Gemmer rawData i som en string UART_1_UartPutString(readingString); //Udskriver hvad der står på rawData i UART while(1); }
int main() { // Enable global interrupts CyGlobalIntEnable; // Enable bootloader button // (need to clear pending interrupt first) isr_1_ClearPending(); isr_1_StartEx(isr_bootloader); // Enable analog multiplexer (chooses thermocouple input) AMux_1_Start(); // Enable op-amp (amplifies thermocouple signal) Opamp_1_Start(); // Enable ADC (reads amplified signal) ADC_SAR_Seq_1_Start(); ADC_SAR_Seq_1_StartConvert(); // Enable serial transmission UART_1_Start(); // To avoid a flash on power-on, the relay pin is configured as a // high impedance input initially // Because some guy on the internet says so: // http://www.cypress.com/forum/psoc-4-architecture/low-initial-drive-state-pwm-components Pin_Relays_Write(1); // HIGH to turn PNP transistor OFF Pin_Relays_SetDriveMode(Pin_Relays_DM_STRONG); for(;;) { // Read thermocouples and send over serial // Note that externally (and over serial communication), // 0 is T1, 1 is T2, and 2 is T3 SendTemperature(0, ADC_OFFSET_0, OPAMP_GAIN_FACTOR_0); SendTemperature(1, ADC_OFFSET_1, OPAMP_GAIN_FACTOR_1); SendTemperature(2, ADC_OFFSET_2, OPAMP_GAIN_FACTOR_2); // Newline for easier debugging UART_1_UartPutString("\r\n"); // Wait a bit, processing serial command input in between delays uint8 i; for (i = 0; i < 5; i++) { ReadSerialInput(); CyDelay(100); } // Safety feature: Ensure that the relays do not stay on for more than // ~30 seconds without communication from the serial control program if (relayState) { if (++relayOnCycles >= 60) { UART_1_UartPutString("R=0 (inactivity)\r\n"); SetRelays(0); } } else { relayOnCycles = 0; } } }
int main() { CyGlobalIntDisable; isr_sw_StartEx(SW_Int); CyGlobalIntEnable; /* Enable global interrupts */ UART_1_Start(); Timer_1_Start(); Timer_2_Start(); for(;;) { if(press == 2){ time_s = abs(seconds_new - seconds_old)/1000; time_ms = (ms_old + 24000 - ms_new); UART_1_UartPutString("\n \r Time Between Presses: "); PrintInt(time_s); UART_1_UartPutString("."); PrintInt(time_ms); UART_1_UartPutString(" s"); press = 0; } } }
int main(){ // allocate buffer size for input char buf[MAX_BUFFER_SIZE]; CyGlobalIntEnable; /* Enable global interrupts */ // start UART UART_1_Start(); // print line strcpy(buf, "Established Communication \n \r"); UART_1_UartPutString(buf); uint v4 = 0x56; // hex representation of the integer uint vv4 = reverseBits(v4); // print result // integer to string to be printed sprintf(buf, "%X", vv4); strcat(buf, "\n \r"); UART_1_UartPutString(buf); for(;;){} }
int main() { char uartBuffer[80]; char lcdBuffer[16]; UART_1_Start(); UART_1_UartPutString("Sequencer Board Test\r\n"); // Sequence Boardをリセット Pin_I2C_Reset_Write(0u); CyDelay(1); Pin_I2C_Reset_Write(1u); /* Init I2C */ I2CM_Start(); CyDelay(1500); CyGlobalIntEnable; LCD_Init(); LCD_Clear(); LCD_Puts("Sequencer Board"); CyDelay(1000); for(;;) { if (readSequencerBoard() == I2C_TRANSFER_CMPLT) { sprintf(uartBuffer, "%d %d %d %d %d %d ", sequencerRdBuffer[0], sequencerRdBuffer[1], sequencerRdBuffer[2], sequencerRdBuffer[3], sequencerRdBuffer[4], sequencerRdBuffer[5] ); UART_1_UartPutString(uartBuffer); } else { UART_1_UartPutString("I2C Master Sequencer Read Error.\r\n"); } if (writeSequencerBoard() == I2C_TRANSFER_CMPLT) { sprintf(uartBuffer, "%d\r\n", sequencerWrBuffer[0]); UART_1_UartPutString(uartBuffer); } else { UART_1_UartPutString("I2C Master Sequencer Write Error.\r\n"); } sprintf(lcdBuffer, "%d", sequencerWrBuffer[0]); LCD_Clear(); LCD_Puts(lcdBuffer); sequencerWrBuffer[0] = inc_within_uint8(sequencerWrBuffer[0], 16, 0); CyDelay(125); } }
void CLI_Configure(void) { #ifdef _USE_CLI_ UART_1_UartInit(); UART_1_Start(); #endif }
int main(){ uint32 rxData; UART_1_Start(); CyGlobalIntDisable; UART_1_UartPutString("Established connection to terminal. \n \r"); UART_1_UartPutString("\n\r Hours: "); hr = ReadInt(); UART_1_UartPutString("\n\r Minutes: "); min = ReadInt(); UART_1_UartPutString("\n\r Seconds: "); sec = ReadInt(); Uart_Int_Start(); Uart_Int_SetVector(uartISR); myTimer_Int_StartEx(timerISR); CyGlobalIntEnable; TIMER_1_Start(); for(;;){ if(tc_count >= 1000) { tc_count = 0; sec++; if(sec > 59){ sec = 0; min++; } if(min > 59){ min = 0; hr++; } char buffer[64]; sprintf(buffer, "%02d:%02d:%02d \n \r",hr,min,sec); UART_1_UartPutString(buffer); } if(resetFlag == 1){ TIMER_1_Stop(); UART_1_UartPutString("\n\r Hours: "); hr = ReadInt(); UART_1_UartPutString("\n\r Minutes: "); min = ReadInt(); UART_1_UartPutString("\n\r Seconds: "); sec = ReadInt(); } TIMER_1_Start(); } }
void main(){ UART_1_Start(); /* choose when we receive interrupts from tx and rx */ UART_1_SetTxInterruptMode(UART_1_TX_STS_COMPLETE); UART_1_SetRxInterruptMode(UART_1_RX_STS_FIFO_NOTEMPTY); CyGlobalIntEnable; UART_1_ClearTxBuffer(); UART_1_ClearRxBuffer(); LCD_Char_1_Start(); LCD_Char_1_Position(0,0); /* initialize our source data to index */ int j; for(j = 0; j < DATA_SIZE; ++j){ sourceData[j] = j; } /* enable our interrupt routines */ isr_1_StartEx(tx_int); isr_2_StartEx(rx_int); /* idle loop until we finish our transmission */ while(!rx_done){} int k; int errors = 0; /* data validation */ for(k = 0; k < DATA_SIZE; ++k) if(sourceData[k] != receiveData[k]) ++errors; /* print errors to lcd */ LCD_Char_1_PrintString("errors: "); LCD_Char_1_PrintNumber(errors); LCD_Char_1_Position(1,0); LCD_Char_1_PrintString("tx:"); LCD_Char_1_PrintNumber(tx_cnt); LCD_Char_1_PrintString(" rx:"); LCD_Char_1_PrintNumber(rx_cnt); for(;;){ } }
int main() { CyGlobalIntEnable; /* Enable global interrupts. */ UART_1_Start(); UART_1_PutString("\n \r"); uint8 v1 = 18; uint8 v2 = rearrange(v1); WriteHex(v2); for(;;) { /* Place your application code here. */ } }
int main() { int blkt = 1000; pressamt = 0; countingup = 1; UART_1_Start(); CyGlobalIntDisable; /* Disable global interrupts. */ SW_Int_StartEx(SW_int); /* Start the ISR. */ CyGlobalIntEnable; /* Enable global interrupts */ for(;;){ switch(pressamt){ case 0: blkt = 500; break; case 1: blkt = 1000; break; case 2: blkt = 1500; break; case 3: blkt = 2000; break; case 4: blkt = 2500; break; } RED_LED_Write(!(RED_LED_Read())); CyDelay(blkt); /* Idle the processor. */ } }
int main() { char ch[1]; /* Data received from the Serial port */ int count = 0; CyGlobalIntEnable; /* Enable all interrupts by the processor. */ TFTSHIELD_1_Start(); UART_1_Start(); TFTSHIELD_1_FillScreen(BLACK); TFTSHIELD_1_SetCursor(0,0); TFTSHIELD_1_SetTextColor(WHITE); TFTSHIELD_1_SetTextSize(2); TFTSHIELD_1_SetRotation(1); //will hold the contents of a tweet plus any extra needed characters char tweet[200]; while(1) { // Check the UART status //get all available chars ch[0] = UART_1_GetChar(); //string has not been initialized if(ch[0] != 0 && count == 0) { strcpy(tweet,ch); count++; } else if(ch[0] != 0)//str cat to string { strcat(tweet,ch); //count++; } //if ch = 0, no chars available. print the string if(ch[0] == 0 && count > 0) { TFTSHIELD_1_PrintString(tweet); //clear the string memset(&tweet[0], 0, sizeof(tweet)); count = 0; } } return 0; }
void main(){ /* initialize UART */ UART_1_Start(); /* disable interrupts */ UART_1_DisableRxInt(); UART_1_DisableTxInt(); UART_1_ClearTxBuffer(); UART_1_ClearRxBuffer(); LCD_Char_1_Start(); LCD_Char_1_Position(0,0); /* initialize or source array */ int j; for(j = 0; j < DATA_SIZE; ++j){ sourceData[j] = j; } /* loop to transmit all 4096 bytes of our source array */ int i; for(i = 0; i < DATA_SIZE; ++i){ UART_1_WriteTxData(sourceData[i]); /* we check the receiver FIFO to see when we get the data */ while(UART_1_ReadRxStatus() != UART_1_RX_STS_FIFO_NOTEMPTY){} /* if FIFO is not empty, save the data */ receiveData[i] = UART_1_ReadRxData(); } int k; int errors = 0; /* loop through received data to verify it */ for(k = 0; k < DATA_SIZE; ++k) if(sourceData[k] != receiveData[k]) ++errors; /* print errors */ LCD_Char_1_PrintString("errors: "); LCD_Char_1_PrintNumber(errors); for(;;){ } }
int main() { uint8 buffer[10] = {0}; int i; /* Place your initialization/startup code here (e.g. MyInst_Start()) */ CyGlobalIntEnable; /* Uncomment this line to enable global interrupts. */ UART_1_Start(); //UART_1_EnableTxInt(); //UART_1_EnableRxInt(); isr_1_StartEx(isr_1_isr); isr_1_Enable(); for(;;) { for(i = 0;i < 4;i++) { buffer[i] = rx_buffer[i]; } } }
int main() { StartupLED_Write(1); CyDelay(500); StartupLED_Write(0); CyDelay(500); StartupLED_Write(1); CyDelay(500); StartupLED_Write(0); CyDelay(500); StartupLED_Write(1); UART_1_Start(); CyGlobalIntEnable; UART_1_LoadTxConfig(); /* Configure UART for transmitting */ for(;;) { UART_1_PutChar('1'); /* Send received byte back */ CyDelay(500); UART_1_PutChar('2'); /* Send received byte back */ CyDelay(500); } }
void prvHardwareSetup( void ) { /* Port layer functions that need to be copied into the vector table. */ extern void xPortPendSVHandler( void ); extern void xPortSysTickHandler( void ); extern void vPortSVCHandler( void ); extern cyisraddress CyRamVectors[]; /* Install the OS Interrupt Handlers. */ CyRamVectors[ 11 ] = ( cyisraddress ) vPortSVCHandler; CyRamVectors[ 14 ] = ( cyisraddress ) xPortPendSVHandler; CyRamVectors[ 15 ] = ( cyisraddress ) xPortSysTickHandler; /* Start-up the peripherals. */ /* Enable and clear the LCD Display. */ LCD_Character_Display_Start(); LCD_Character_Display_ClearDisplay(); LCD_Character_Display_Position( 0, 0 ); LCD_Character_Display_PrintString( "www.FreeRTOS.org " ); LCD_Character_Display_Position( 1, 0 ); LCD_Character_Display_PrintString("CY8C5588AX-060 "); /* Start the UART. */ UART_1_Start(); /* Initialise the LEDs. */ vParTestInitialise(); /* Start the PWM modules that drive the IntQueue tests. */ High_Frequency_PWM_0_Start(); High_Frequency_PWM_1_Start(); /* Start the timers for the Jitter test. */ Timer_20KHz_Start(); Timer_48MHz_Start(); }
/**************************************************************************** * 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, ×tamp_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, ×tamp_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, ×tamp_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; }
/**************************************************************************** * 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; }
/**************************************************************************** * 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; }
/******************************************************************************* * Function Name: UART_1_UartCyBtldrCommStart ****************************************************************************//** * * Starts the UART component. * *******************************************************************************/ void UART_1_UartCyBtldrCommStart(void) { UART_1_Start(); }
/**************************************************************************** * 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; }
/**************************************************************************** * 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; }