Testing arrays with other arrays

Component Testing for C

The following example illustrates a form of initialization that consists of initializing or comparing an array with another array that has the same declaration:

TEST 4

FAMILY nominal

ELEMENT

VAR x1, init = 0, ev = init

VAR x2, init = SIZE_IMAGE-1, ev = init

VAR y1, init = 0, ev = init

VAR y2, init = SIZE_IMAGE-1, ev = init

ARRAY image, init = extern_image, ev = init

ARRAY histo, init = 0, ev ==

VAR status, init ==, ev = 0

#read_image(extern_image,"image.bmp");

#status = compute_histo(x1, y1, x2, y2, histo);

END ELEMENT

END TEST

Read_image and extern_image are two arrays that have been declared in the same way. Every element from the extern_image array is assigned to the corresponding read_image array element.

You can use this form of initialization and testing with one or more array dimensions.

Related Topics

Testing arrays | Testing arrays with pseudo-variables | Testing large arrays | Testing arrays with lists | Testing character arrays | Testing an array of union elements