Topic
  • 2 replies
  • Latest Post - ‏2013-01-04T08:10:17Z by SystemAdmin
SystemAdmin
SystemAdmin
2260 Posts

Pinned topic Code Coverage with local variables

‏2013-01-02T03:42:08Z |
Hello, everyone.
I have following codes to test, au32LocFlsPage is a local variable in testfunction. FLS_enuRead is a stub. BINVDM_au32SavedDynamicBlockSize is a global variable. Could you do me a favor to give some advice and hints to code coverage of this testing function
void testfunction()
{
uint32 au32LocFlsPage[2];
FLS_enuRead(BINVDM_u32SEG_1_BASEADDR+BINVDM_u32DYNAMIC_DATASIZE_OFFSET, (uint8 *)au32LocFlsPage, BINVDM_u32PAGE_SIZE);
if (au32LocFlsPage[1] == 0)
{
BINVDM_au32SavedDynamicBlockSize[1] = au32LocFlsPage[0];
}
else
{
BINVDM_au32SavedDynamicBlockSize[1] = 0;
}
}
Updated on 2013-01-04T08:10:17Z at 2013-01-04T08:10:17Z by SystemAdmin
  • link33
    link33
    22 Posts

    Re: Code Coverage with local variables

    ‏2013-01-03T10:41:12Z  
    Hi,
    To reach 100% coverage, try to define FLS_enuRead function stub as follow :
    void FLS_enuRead(_in input_type, uint8* _no input2, _in input_type)
    {
    input2[0] = GL_au8LocFlsPage[0];
    input2[1] = GL_au8LocFlsPage[1];
    input2[2] = GL_au8LocFlsPage[2];
    input2[3] = GL_au8LocFlsPage[3];
    input2[4] = GL_au8LocFlsPage[4];
    input2[5] = GL_au8LocFlsPage[5];
    input2[6] = GL_au8LocFlsPage[6];
    input2[7] = GL_au8LocFlsPage[7];
    }
    with GL_au8LocFlsPage defined as global Array in your ptu as uint8 GL_au8LocFlsPage[8]
    And then you can set the GL_au8LocFlsPage global Array as follow:

    VAR GL_au8LocFlsPage[0], INIT = 0xCA, EV = INIT
    VAR GL_au8LocFlsPage[1], INIT = 0xFE, EV = INIT
    VAR GL_au8LocFlsPage[2], INIT = 0xDE, EV = INIT
    VAR GL_au8LocFlsPage[3], INIT = 0xCA, EV = INIT

    VAR GL_au8LocFlsPage[4], INIT =0, EV = INIT
    VAR GL_au8LocFlsPage[5], INIT in {0, 1}, EV = INIT
    VAR GL_au8LocFlsPage[6], INIT =0, EV = INIT
    VAR GL_au8LocFlsPage[7], INIT =0, EV = INIT

    VAR BINVDM_au32SavedDynamicBlockSize[1], INIT = 0xFFFFFFFF, EV (GL_au8LocFlsPage[5]) with {0xCAFEDECA,0}
  • SystemAdmin
    SystemAdmin
    2260 Posts

    Re: Code Coverage with local variables

    ‏2013-01-04T08:10:17Z  
    • link33
    • ‏2013-01-03T10:41:12Z
    Hi,
    To reach 100% coverage, try to define FLS_enuRead function stub as follow :
    void FLS_enuRead(_in input_type, uint8* _no input2, _in input_type)
    {
    input2[0] = GL_au8LocFlsPage[0];
    input2[1] = GL_au8LocFlsPage[1];
    input2[2] = GL_au8LocFlsPage[2];
    input2[3] = GL_au8LocFlsPage[3];
    input2[4] = GL_au8LocFlsPage[4];
    input2[5] = GL_au8LocFlsPage[5];
    input2[6] = GL_au8LocFlsPage[6];
    input2[7] = GL_au8LocFlsPage[7];
    }
    with GL_au8LocFlsPage defined as global Array in your ptu as uint8 GL_au8LocFlsPage[8]
    And then you can set the GL_au8LocFlsPage global Array as follow:

    VAR GL_au8LocFlsPage[0], INIT = 0xCA, EV = INIT
    VAR GL_au8LocFlsPage[1], INIT = 0xFE, EV = INIT
    VAR GL_au8LocFlsPage[2], INIT = 0xDE, EV = INIT
    VAR GL_au8LocFlsPage[3], INIT = 0xCA, EV = INIT

    VAR GL_au8LocFlsPage[4], INIT =0, EV = INIT
    VAR GL_au8LocFlsPage[5], INIT in {0, 1}, EV = INIT
    VAR GL_au8LocFlsPage[6], INIT =0, EV = INIT
    VAR GL_au8LocFlsPage[7], INIT =0, EV = INIT

    VAR BINVDM_au32SavedDynamicBlockSize[1], INIT = 0xFFFFFFFF, EV (GL_au8LocFlsPage[5]) with {0xCAFEDECA,0}
    Thanks very much for your kind help. I will try it