Skip to main content

Table 5 An example test case showing the unit test of the CRC generation function

From: Development and validation of a safe communication protocol compliant to railway standards

Test case ID crc_ch1
Priority Medium
Description CRC generation function
Module Safety layer
Prepared by   Date prepared  
Reviewed/updated   Date reviewed  
Tested by   Date tested  
Software version    
Test activities
Sl. no. Step description Expected results
 1 Definition of the input data  
 2 if the input data are plausibles:
 • Computation of the CRC using an external tool and comparation with the result obtained using the internal function
 • Verification of the correct error handling and report
The code obtained using the external tool and the internal function must be equals
Test data sets
Data type Data set 1 Data set 2 Data set 3
 uint8_t input[]; input ={0,0,0,0,0,0,0,0} input = {0xffff, 0xffff, 0xffff, 0xffff} input = {‘C’,’o’,’n’,’t’,’r’,’o’,’l’ }
 uint16_t size; size = 8 size = 4 size = 0
Actual results    
Data type Data set 4 Data set 5 Data set 6
 uint8_t input[]; input = NULL input = {0,0,0,0,0,0,0,0}  
 uint16_t size; size=0 size = − 1
Actual results    
Test case result  
  1. Data sets 2 and 4 are robustness tests that invoke the function with values bigger than expected (using 16-bit unsigned integers in place of the 8-bit requested) and with NULL parameters