!******************************************************************************!
! Tests interrupt a command (BUG 2150,NXM-2626)
! Arguments: None
! @bug: NXM-2626 - Unable to CTRL+C from loop
! Author:  JC4, J. Bauer,PDM
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  call setDatDir

  if interAct then

    ! test case #2 interrupting a primitive command outside of pipe section
    info "Directions: Use CTRL+C to exit the plot."
    plot ^{datDir}.world.prm
    assert/text="^reg.main.name: Ctrl+C (interrupt) command run outside the pipe section." TRUE

    ! test case #3 interrupting a child macro (sub-macro) that is piped
    info "Directions: Use CTRL+C to exit the DEMO macro."
    DEMO;SYS
    assert/text="^reg.main.name: Ctrl+C (interrupt) piped sub-macro." TRUE

    ! test case #4 interrupting long running series of piped sub-macros (test scenario for ICE)
    !info "Directions: Press CTRL+C very quickly twice to interrupt the loop that calls a long running piped macro"
    !do ii 1 20
      ! todo check
    !enddo
    !assert/text="^reg.main.name: Ctrl+C (interrupt) piped sub-macros in loop." TRUE

  endif

endmacro

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return
