Nested arrays

This test case it part of the test suite proposed for new devices.

Test case ID: R0016
Language: ST

Code:
tests2/t0016.st



TYPE 
ARR2 : ARRAY [1..2] OF INT; 
ARR4 : ARRAY [1..3] OF ARR2;
ARRBD : ARRAY [1..3,1..2] OF INT;

END_TYPE

PROGRAM XX_R0016 

  VAR
  i : INT;
  a2 : ARR2;
  a4 : ARR4; // array of array
  abd : ARRBD; // bidimensional array
  END_VAR 
  i := 1;
  a2[i] := 10;
  a2[i+1] := 20;  // a2 : {10,20}
  a4[1] := a2;          
  a4[2][2] := 35;
  a4[2][1] := a4[2][2] + a2[2];  // a4 ((10, 20), (55, 35), (0, 0))
  abd[3,1] := 15;  // 

_GEB_ASSERT_(a2[1] = 10);
_GEB_ASSERT_(a2[2] = 20);
_GEB_ASSERT_(a4[1][1] = 10);
_GEB_ASSERT_(a4[1][2] = 20);
_GEB_ASSERT_(a4[2][1] = 55);
_GEB_ASSERT_(a4[2][2] = 35);
_GEB_ASSERT_(a4[3][1] = 0);
_GEB_ASSERT_(a4[3][2] = 0);
_GEB_ASSERT_(abd[1,1] = 0);
_GEB_ASSERT_(abd[1,2] = 0);
_GEB_ASSERT_(abd[2,1] = 0);
_GEB_ASSERT_(abd[2,2] = 0);
_GEB_ASSERT_(abd[3,1] = 15);
_GEB_ASSERT_(abd[3,2] = 0);

 
END_PROGRAM