DevOps Automation

 View Only
Expand all | Collapse all

How to develop a test case for the following C code

  • 1.  How to develop a test case for the following C code

    Posted Fri March 19, 2021 01:58 PM

    -> Turn_Dir[2][ 2] = &TURN_DIRC;

    Turn_Dir[2][ 2] is declared as ' Bool (*Turn_Dir[2][ 2]) (void); '

    TURN_DIRC is a function declared as ' int TURN_DIRC (void); '

    function pointer of type 2d array is assigning with address of a function.

    Please answer if you know how to wite a test.ptu for this part of C source code.

    Thanks in advance,

    Lokesh.


    #SupportMigration
    #Support
    #RationalTestRealTime


  • 2.  RE: How to develop a test case for the following C code
    Best Answer

    Posted Sat March 20, 2021 05:20 PM

    You have to write a test case to verify that Turn_Dir[2][2] is assigned with NONIL value.


    #RationalTestRealTime
    #SupportMigration
    #Support


  • 3.  RE: How to develop a test case for the following C code
    Best Answer

    Posted Mon March 22, 2021 06:07 AM

    Thank you Rangareddy, Yes it worked when initialized with NULL and checking expected value as &TURN_DIRC.


    #Support
    #RationalTestRealTime
    #SupportMigration