!******************************************************************************!
! Test case to make sure the REG.HANDLERS.PACKET does not contain duplicates
! when run from -INDEPENDENT mode or from nxm.sys.lib.NeXtMidas class.
!
! @bug      2596 REG.HANDLERS.PACKET in -INDEPENDENT  mode allows dupes
! @author:  Neon Ngo
! @version: $Id: test_dr814551-1.mm,v 1.1 2012/05/11 13:21:03 ntn Exp $
!******************************************************************************!
startmacro
  set origSize reg.handlers.packet.GETSIZE
  set reg.handlers.packet.BUG2596 "ABC"
  set reg.handlers.packet.BUG2596 "DEF"
  set reg.handlers.packet.BUG2596 "XYZ"
  set tabSize reg.handlers.packet.GETSIZE
  calc expSize origSize 1 +
  assert/text="REG.HANDLERS.PACKET has no duplicates: size [^{tabSize}] == ^{expSize}" tabSize eq expSize
  assert/text="REG.HANDLERS.PACKET.BUG2596 value [^{reg.handlers.packet.BUG2596}] == XYZ" reg.handlers.packet.BUG2596 eqs "XYZ"

  ! cleanup
  remove reg.handlers.packet.BUG2596
endmacro

!******************************************************************************!
! 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
