! Tests the CHECKXBC command.
!
! Author:  J. Czechowski IV / L. Nguyen
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    res instruct "Should see a number of INFO statements listing the various &
              M$ calls used by f3000.for (including: M$CHECKIN, M$APICK, and &
              M$ALLOCATE). All should be listed as 'supported'."

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol text idtext "Instructions" "^instruct" 24 7 /title
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}

      gcontrol menu testcases "Test CHECKXBC with various switches" &
          "0.Initial Instructions,&
           1.CHECKXBC [FILE]                     ,&
           2.CHECKXBC/VERBOSE                    ,&
           3.CHECKXBC                            ,&
           4.CHECKXBC/WARN=FALSE [FILE]          ,&
           5.CHECKXBC/WARN=FALSE                 ,&
           6.CHECKXBC/SUMMARIZE [FILE]           ,&
           7.CHECKXBC/SUMMARIZE                  ,&
          " "0.Initial Instructions"
      shellgui/id=idshellgui/attach
    pipe off
  endif
endmacro


procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Interactive tests for STATUS" msg.data eqss "PASS"
    pipe stop

    elseif msg.name eqs "TESTCASES" then
    if "STATUS" SUBS msg.data then
      ! clear text in terminal using "CLEAR" message via SENDX function
      message func=sendx id=idshellgui name="CLEAR"
    else
      ! clear text in terminal using invoke clear() method
      invoke ,, reg.idshellgui.clear()
    endif

    if msg.data eqss "0.Initial Instructions" then
      set gc.idtext.value instruct

    elseif msg.data eqss "1.CHECKXBC [FILE]" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                           There should be no output messages."
      say "nM> CHECKXBC nxm.xbc.host.f3000.for "
      CHECKXBC nxm.xbc.host.f3000.for

    elseif msg.data eqss "2.CHECKXBC/VERBOSE" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                           Should see multiple info statements printed."
      say "nM> CHECKXBC/VERBOSE nxm.xbc.host.f3000.for "
      CHECKXBC/VERBOSE nxm.xbc.host.f3000.for

    elseif msg.data eqss "3.CHECKXBC" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                           There should be warning messages."
      say "nM> CHECKXBC OPT=XBC "
      CHECKXBC OPT=XBC

    elseif msg.data eqss "4.CHECKXBC/WARN=FALSE [FILE]" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                           Should see no warning messages printed."
      say "nM> CHECKXBC/WARN=FALSE nxm.xbc.host.test_picks.for "
      CHECKXBC/WARN=FALSE nxm.xbc.host.test_picks.for

    elseif msg.data eqss "5.CHECKXBC/WARN=FALSE" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                           Should see no warning messages printed. \n&
                           Scroll up to view all the messages."
      say "nM> CHECKXBC/WARN=FALSE OPT=XBC "
      CHECKXBC/WARN=FALSE OPT=XBC

    elseif msg.data eqss "6.CHECKXBC/SUMMARIZE [FILE]" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                          *One* warning should be printed."
      say "nM> CHECKXBC/SUMMARIZE nxm.xbc.host.test_picks.for "
      CHECKXBC/SUMMARIZE nxm.xbc.host.test_picks.for

    elseif msg.data eqss "7.CHECKXBC/SUMMARIZE" then
      set gc.idtext.value "The old contents should be cleared in the SHELL before this test (via CLEAR message). \n&
                          *One* warning should be printed."
      say "nM> CHECKXBC/SUMMARIZE OPT=XBC "
      CHECKXBC/SUMMARIZE OPT=XBC

    else
      say "^reg.main.name: unknown test case: ^msg.data"
    endif

  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return
