The testscript interpreter of CxxTester allows the usage of multileveled structs. There are two possibilities of specifying a struct and two possibilities for getting access to structured data. The kind of struct specification does not restrict the access method. Both selections can be made independent from each other:

// first specify possibility

// first access possibility

myPointStruct.x = 10

int      x = DIN["myPointStruct.x"];

myPointStruct.y = 12

int      y = DIN["myPointStruct.y"];

myPointStruct.z = 24

int      z = DIN["myPointStruct.z"];

myPointStruct.col = "blue"

char* c = DIN["myPointStruct.col"];

 

 

// second specify possibility is shorter

// same as first access possibility,  

// and therefore recommended

// but this access possibility allows the 

myPointStruct

// usage of separate variables for each

{

// level and is therefore recommended.

   x = 10

int      x = DIN["myPointStruct"]["x"];

   y = 10

int      y = DIN["myPointStruct"]["y"];

   z = 24

int      z = DIN["myPointStruct"]["z"];

   col = "blue"

char* c = DIN["myPointStruct"]["col"];

}

 

If a global struct is used in the verify section of a testcase, the correctness  check always uses the given verify operator for all basic struct members:

{

searchPoint

   p1{ x = 0 y = 0}

{

   p2{ x = 100 y = 100 }

   verified:

   point{ x = 10 y = 20 }

       find.x = = 10

}

     find.y = = 20

 

   logged:

searchPoint

}

{

 

   left_down = (p1)

 

   right_up = (p2)

 

verify:

 

   // = = is used for x and y member

 

   find = = (point)  

 

}

 

The return of structured data to CxxTester is similar to the read access:

DOUT["point"]["x"] = 100;

int point.x = 100

DOUT["point"]["y"] = 200;

int point.y = 200

Structs should be used in order to keep the contents of the testscripts as close as possible to the C++ signature of the targetsoftware.