Testing arrays with other arrays

Component Testing for Ada

Component Testing for Ada is flexible enough to allow complex array comparisons. You can initialize or compare an array with another array that shares the same declaration.

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

Example

The following example tests the two arrays read_image and extern_image , which have been declared in the same way. Every element from the extern_image array is assigned to the corresponding read_image array element.

TEST 4

FAMILY nominal

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

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

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

END ELEMENT

END TEST

Related Topics

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