Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

C++ Test Data Source Generation Issue

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in C/C++test
C++ Test Data Source Generation Issue
What headings do I need to use in a CSV file to enable setting of Buffer[0], Buffer[1], etc. for the following function: unsigned char CalculateChecksum(unsigned char *Buffer,unsigned char Length).

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hello dmf

    > What headings do I need to use in a CSV file to enable setting of Buffer[0], Buffer[1], etc. for the following >function: unsigned char CalculateChecksum(unsigned char *Buffer,unsigned char Length)

    1. C++Test is not going to allow you to place an array of values for the Buffer variable as written. Therefore I would suggest changing the parameters

    FROM:
    unsigned char CalculateChecksum(unsigned char *Buffer,unsigned char Length)

    TO:
    unsigned char CalculateChecksum(unsigned char *Buffer[],unsigned char Length)


    2. I would suggest using hex values in your *.csv file. For Example

    try.csv
    ---------------------cut-------------------

    Column1,Column2,
    "\x041", "\x001",

    ----------------------cut-------------------

    Note: Data Source support is only available for Native Test Cases
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    > 1. C++Test is not going to allow you to place an array of values for the Buffer variable as written.

    Why not? It is a legitimate function. Also, I can set such values directly in the Test Case Editor with the function as is.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    OK, I have this now working, using option 2 and using the folowing format: "\x041\x043...". Thanks for the advice. Option 1 wasn't an option as this changes the nature of the function, which we did not want to do.