!******************************************************************************!
! Test CONVERT BLUE2JSON without conversion options (i.e. custom mappings)
! starter test
!
! NXM-3855 Support BLUE information being put in nested JSON text file
!
! Author:  Jeanette McCall
!******************************************************************************!
startmacro

  res expectedException ""
  res outjsonfile "blue2json_out.txt"
  res blueFromPlat "blueplatinum4blue2json.tmp"

  say "the 1000 PLATINUM file"
  convert nxm.sys.test.testplat4plat2blue_cov.cdif PLAT2BLUE blueFromPlat options={TOA_SIGMA={VALUE=0.0},FOA_SIGMA={VALUE=0.0}}
  convert blueFromPlat BLUE2JSON outjsonfile
  foreach line INTF outjsonfile
    say "^line"
  endfor

  say ""
  say "now the 6000 file"
  convert nxm.sys.dat.test6000.prm BLUE2JSON outjsonfile
  foreach line INTF outjsonfile
    say "^line"
  endfor

!  erase outjsonfile
!  erase blueFromPlat

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
res expectedException
res emsg.data.message
  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