startmacro
  !warning "DR# 502953-1 - FORALL does not work!"
  call test_count_syntax

  res writeAux aux.write
  if writeAux eqs "1" then
    invoke writeAuxPath aux.1.replace("+","^{env.user}")
  else
    res writeAuxPath aux.^{aux.write}
  endif
  invoke writeAuxPathLower writeAuxPath.toLowerCase()
  if/cs writeAuxPathLower NEQS writeAuxPath then
    warn "SKIPPING ^reg.main.name test_file_syntax since write aux is mixed case. Please run this test with an all-lowercase write aux."
  else
    call test_file_syntax
  endif
endmacro

!******************************************************************************!
procedure test_count_syntax
  !
  !  Test the #=... syntax
  !
  res n 0
  forall #=1:7 calc n n # +
  assert/text="^reg.main.name: #= SYNTAX (TEST 1 OF 6)" n EQ 28

  res n 0
  forall #=-1:7 calc n n # +
  assert/text="^reg.main.name: #= SYNTAX (TEST 2 OF 6)" n EQ 27

  res n 0
  forall #=0:2.5;0.75 calc n n # +
  assert/text="^reg.main.name: #= SYNTAX (TEST 3 OF 6)" n EQ 4.5

  res n 0
  forall #=1:21;2 calc n n # +
  assert/text="^reg.main.name: #= SYNTAX (TEST 4 OF 6)" n EQ 121

  res n 0
  forall #=1:22;2 calc n n # +
  assert/text="^reg.main.name: #= SYNTAX (TEST 5 OF 6)" n EQ 121

  res n 0
  forall #=50:21;2 calc n n # +
  assert/text="^reg.main.name: #= SYNTAX (TEST 6 OF 6)" n EQ 0
return

!******************************************************************************!
procedure test_file_syntax
  !
  !  Test the FILES syntax
  !

  !res numcommands 0
  !forall MENU calc numcommands numcommands 1 +
  !assert/text="^reg.main.name: FILE SYNTAX (TEST 1 OF 2)" &
  !        numcommands EQ FILE(menu).size()


  set numFiles 5
  set fileSize 1k
  set filePrefix "temp_forall_"
  do n 1 numFiles
    set curFile "^{filePrefix}^n"
    if "^curFile" FEXISTS erase/all "^curFile"
    waveform OUT="^{curFile}{AUX=^{aux.write}}" FORM=SB ELEM=^fileSize
  enddo

  files/f="temp_test_forall_files"/v=f "^{filePrefix}*" AUX=^{aux.write}
  set totalFilelements 0
  forall temp_test_forall_files calc totalFilelements totalFilelements FILE(#).size() +

  calc answer ^fileSize ^numFiles *
  assert/text="^reg.main.name: FILE SYNTAX (TEST 2 OF 2)" &
          totalFilelements EQ answer
  forall temp_test_forall_files erase/all #
  if temp_test_forall_files FEXISTS erase/all temp_test_forall_files
return



