C++ Test Data Source Generation Issue

LegacyForumLegacyForum Posts: 1,669 ✭✭
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

  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    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
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    > 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.
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    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.
Sign In or Register to comment.