!******************************************************************************!
! Test datalist cut.
!
! Arguments: None
!
! Issue:   NXM-2921 PLOT: x-cut NPE on files without extension specified
! Since:   NeXtMidas 3.7.1
! Author:  Paul M
!******************************************************************************!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)

  call setDatDir

  set prefix "datalist_cut_"
  info "^reg.main.name: Three DATALIST cuts will be displayed as part of this automated test"
  archive on ^{prefix}test1.log
  if datDir eqs "nxm.sys.test" then
    datalist/sw=500 apenny(80:81)
  else
    ! Switch to using slashes since nxm.sys.test.dat.<filename> with NO extension specified currently does not work
    datalist/sw=500 ^{datDirSlash}/apenny(80:81)
  endif
  archive off datalist_test1.log
  archive on ^{prefix}test2.log
  datalist/sw=500 ^{datDir}.apenny.prm(80:81)
  archive off ^{prefix}test2.log
  archive on ^{prefix}test3.log
  datalist/sw=500 ^{datDir}.apenny.prm(81:82)
  archive off ^{prefix}test3.log
  assert/text="^reg.main.name: DATALIST ^{prefix}test1.log should be the same as ^{prefix}test2.log"     ^{prefix}test1.log FEQ  ^{prefix}test2.log
  assert/text="^reg.main.name: DATALIST ^{prefix}test1.log should not be the same as ^{prefix}test3.log" ^{prefix}test1.log NFEQ ^{prefix}test3.log
  assert/text="^reg.main.name: DATALIST ^{prefix}test2.log should not be the same as ^{prefix}test3.log" ^{prefix}test2.log NFEQ ^{prefix}test3.log
  files/e ^{prefix}*.log
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
