!******************************************************************************!
! Tests for DATALIST command.
!
! Arguments: None
!
! Author : J. Czechowski IV
!******************************************************************************!
startmacro/theme=gear4
  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)
  switch COREGRAPHICS coregraphics GET DEF=FALSE SDEF=TRUE  ! for a quick check of graphics - more extreme tests - since 3.8.1

  if interAct OR coregraphics then
    res t:setupTbl1 nxm.sys.test.test_datalist_setup.tbl
    res s:dir "nxm.sys.test."

    res tests {ALL  ={TITLE="Show All",       SETUP=^setupTbl1, MACRO="^{dir}test_datalist_all.mm"},&
               SOME ={TITLE="Show Some",      SETUP=^setupTbl1, MACRO="^{dir}test_datalist_some.mm"},&
               ERROR={TITLE="Illegal Start",  SETUP=^setupTbl1, MACRO="^{dir}test_datalist_error.mm"},&
               HEX  ={TITLE="hexdump",        SETUP=^setupTbl1, MACRO="^{dir}test_datalist_hexdump.mm"}}

    res setup {}
    call makeSetupTable tests setup

    pipe on
      panel/msgid=MAIN/id=panel/tsetup=setup/controls=gc/OPTIONS=-RotateTabs|-PushPopX/EXIT=none

      gcontrol label macro "MACRO"
      gcontrol menu MAIN "Exit with Status = " "PASS,FAIL" /tleft
      set gc.MAIN.itemColors {PASS=GREEN,FAIL=RED}
      gcontrol text idtext "INSTRUCTIONS" "Try the tests in each of the tabs..." 24 5 /title

      call startTests tests

    pipe off
  else
    %test_datalist_error/interactive=^interAct
  endif

  ! Additional tests, only run with /BASELINE
  if baseline then
    %test_datalist_cut ! NXM-2921

    if interAct then
      %test_datalist_packed_and_nibble
      %test_datalist_256ascii           ! NXM-3570 'Z' 256 ASCII Data Type
      %test_datalist_bin_hex_format     ! NXM-4037
    endif
  endif
endmacro

!******************************************************************************!
! Procedure for handling all messages
procedure processMessage m:msg
  if msg.name EQS "MAIN" then
    call exitTests tests
    assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return

include multi_test_template.mm
