       10 // Simple array test
       20 //
       30 n#:=99
       40 DIM a(100), b#(100), c$(10, 10), d(100), e#(100), f$(100)
       50 a():=n#  // Assign all elements the value of n#.
       60 check(a(), n#, TRUE)
       70 check(a(), n#-1, FALSE)
       80 a:=n#-2  // Assign all elements
       90 check(a(), n#-2, FALSE)
      100 TRAP
      110   a():=b#()  // We expect this to throw an error
      120   SYS assert, FALSE
      130 HANDLER
      140   NULL
      150 ENDTRAP
      160 d():=a()
      170 check(d(), n#-2, FALSE)
      180 b#():=42
      190 e#():=b#()
      200 check2(e#(), 42, TRUE)
      210 check2(e#(), 42, FALSE)
      220 c$():="OpenComal"
      230 check3(c$(), "OpenComal", 2)
      240 f$():=c$()
      250 check3(f$, "OpenComal", 1)
      260 //
      270 PROC check(REF a(), value, change#) CLOSED
      280   FOR f#:=1 TO 100 DO
      290     SYS assert, a(f#)=value
      300     IF change# THEN a(f#):-1
      310   ENDFOR f#
      320 ENDPROC check
      330 //
      340 PROC check2(g#(), value#, change#) CLOSED
      350   FOR f#:=1 TO 100 DO
      360     SYS assert, g#(f#)=value#
      370     IF change# THEN g#(f#):-1
      380   ENDFOR f#
      390 ENDPROC check2
      400 //
      410 PROC check3(h$(), value$, indices#)
      420   FOR f#:=0 TO 99 DO
      430     IF indices#=1 THEN
      440       a$:=h$(f#+1)
      450     ELSE
      460       a$:=h$(f# DIV 10+1, f# MOD 10+1)
      470     ENDIF
      480     SYS assert, a$=value$
      490   ENDFOR f#
      500 ENDPROC check3
      510 //
      520 PRINT "Ok"
