! This IS NOT a real test case yet
!
! PLANS: Are to turn this into a test case that gives the X-Midas
! instructions to generate its newrate output and then the test
! case will bring up the appropriate panel/plots for easy comparison
!
! REASON: Automatic testing is limited, it is not great to have lots
! of extra BLUE files in the test area anyhow, and that is not even an
! option at this time
!
! IDEA: Probably the easiet thing to do for the NXM files is to run
! %test_newrate_nsteps_gt_ntaps /KEEP
! then after this test is over run
! %test_newrate_nsteps_gt_ntaps
! to clean up those files
!
! @issue   NXM-3613
! @author  Jeanette McCall
! @since   NeXtMidas 3.9.4
!************************************************************
startmacro s:func[""]
  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)

  res out_hz  8000
  res out_hz2 8311

  res first_freq   ram:newrate_first_freq.tmp
  res second_freq  ram:newrate_second_freq.tmp
  res third_freq   ram:newrate_third_freq.tmp
  res input_file   newrate_input_file.tmp
  res abs_output_file  newrate_abs_output_file_^{out_hz}.tmp
  res abs_output_file2 newrate_abs_output_file_^{out_hz2}.tmp
  res abs_output_fileb  newrate_abs_output_file_^{out_hz}b.tmp
  res abs_output_file2b newrate_abs_output_file_^{out_hz2}b.tmp

  res jay_output_file  newrate_jay_output_file_^{out_hz}.tmp
  res jay_output_file2 newrate_jay_output_file_^{out_hz2}.tmp
  res jay_output_fileb  newrate_jay_output_file_^{out_hz}b.tmp
  res jay_output_file2b newrate_jay_output_file_^{out_hz2}b.tmp

  if interAct then
    set instructions "TODO: Enter test case instructions here"

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      gcontrol label macro "Test MACRO"
      gcontrol menu  main "Exit with Status =" "PASS,FAIL" TABLE={ItemColors={PASS="GREEN",FAIL="RED"}} /tleft

      gcontrol text  idtext "Instructions" instructions 24 8 /title

      plot/bg abs_output_file|xm_newrate_output_file.tmp|abs_output_fileb /LEGEND
      plot/bg jay_output_file|xm_newrate_output_file.tmp|jay_output_fileb /LEGEND
    
      plot/bg abs_output_file2|xm_newrate_output_file_8311.tmp|abs_output_file2b /LEGEND
      plot/bg jay_output_file2|xm_newrate_output_file_8311.tmp|jay_output_file2b /LEGEND
    pipe off

  endif

endmacro

!******************************************************************************!
! Main process message for this macro. Should be right after the ENDMACRO.
!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    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

!******************************************************************************!
! If an unexpected exception is caught, mark test as failed, unless it is expected
!******************************************************************************!
procedure processException m:emsg
  if expectedException REXISTS then
    assert/text="^reg.main.name: Expected ERROR starts with: ^{expectedException}" expectedException EQSS emsg.data.message
    remove expectedException
  else
    assert/text="^reg.main.name: Caught unexpected exception ^{emsg.data}" "FALSE" isTrue
    if "Trace" SUBS ENV.DEBUG then invoke ,, emsg.data.printStackTrace()
  endif
return

!******************************************************************************!
! NOOP of 1.1 file creates 1.1 file unless input file has 'Z' type
!******************************************************************************!
procedure noopFile fn:inputFile fn:outputFile S:expectedBlueVer S:description

  noop inputFile outputFile
  keyword outputFile get name=ver value=blueVer

  assert/text="^reg.main.name: ^description" blueVer EQS expectedBlueVer

return
