! Macro to test "GET" command
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  ! Insert a string result into the results table then get its value using all
  ! of the known switches.  None of the switches should change the result.
  res test_get_val "foo"

  get test_get_val /res=out
  assert/text="^reg.main.name: string" out EQS test_get_val


  res test_get_val 16
  remove out
  get test_get_val /res=out
  assert/text="^reg.main.name: integer as DECIMAL" ^out EQ ^test_get_val

  remove out
  get test_get_val /bin /res=out
  assert/text="^reg.main.name: integer as BIN" "^out" EQS "0b00000000000000000000000000010000"

  remove out
  get test_get_val /radix=1 /res=out
  assert/text="^reg.main.name: integer as /RADIX=1" "^out" EQS "0b00000000000000000000000000010000"

  remove out
  get test_get_val /oct /res=out
  assert/text="^reg.main.name: integer as OCT" "^out" EQS "0o00000000020"

  remove out
  get test_get_val /radix=8 /res=out
  assert/text="^reg.main.name: integer as RADIX=8" "^out" EQS "0o00000000020"

  remove out
  get test_get_val /hex /res=out
  assert/text="^reg.main.name: integer as HEX" "^out" EQS "0x00000010"

  remove out
  get test_get_val /radix=16 /res=out
  assert/text="^reg.main.name: integer as RADIX=16" "^out" EQS "0x00000010"

  ! Start Interactive test section to verify RESULTS output
  if interAct then
    res inst "Should see a list of GET outputs which displays values for "test_val" &
              and "test_val2" including the hexadecimal form."

    res test_val "foo"
    res test_val2 16

    pipe on
      panel/msgid=MAIN/setup/controls=gc
      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" "^inst" 24 7 /title

      shellgui/id=idshellgui/attach
      say ""
      say "nM> GET test_val"
      GET test_val
      say ""
      say "nM> GET test_val2"
      GET test_val2
      say ""
      say "nM> GET test_val2 /hex"
      GET test_val2 /hex
    pipe off
  endif
  ! End Interactive test section

endmacro


!******************************************************************************!
! process messages for interactive tests
procedure processMessage m:msg
  !say "msg.name ^msg.name, data ^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Tests for GET" msg.data eqss "PASS"
    pipe stop
  else
    say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif
return
