! This tests the primlab2 macro for the Primitives Lab 2
!
! Author:  Neon Ngo
! Version: $Id: test_primlab2.mm,v 1.1 2007/07/25 19:04:37 ntn Exp $
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  if interAct then
    res inst "Verify the EXPECTED OUTPUT against the ACTUAL OUTPUT."

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

      shellgui/attach
      say ""
      say "EXPECTED OUTPUT:"
      say "INFO: Hello_World! [PRIMLAB2]"
      say ""
      say "ACTUAL OUTPUT:"
      say "nM> primlab2 "Hello_World!" "
      primlab2 "Hello_World!"
      say ""
      say ""
      say "EXPECTED OUTPUT:"
      say "WARN: Hello! [PRIMLAB2]"
      say ""
      say "ACTUAL OUTPUT:"
      say "nM> primlab2/warn "Hello!" ""
      primlab2/warn "Hello!"
      say ""
      say ""
      say "EXPECTED OUTPUT:"
      say "INFO: Hello [PRIMLAB2]"
      say " 5S: MYRES           = Hello"
      say ""
      say "ACTUAL OUTPUT:"
      say "nM> primlab2 "Hello" RESNAME=myres"
      say "nM> results myres"
      primlab2 "Hello" RESNAME=myres
      results myres
      say ""
      say ""
      say "EXPECTED OUTPUT:"
      say "INFO: Hi [PRIMLAB2]"
      say " 2S: MYRES           = Hi"
      say ""
      say "ACTUAL OUTPUT:"
      say "nM> primlab2 "Hi" RESNAME=myres"
      say "nM> results myres"
      primlab2 "Hi" RESNAME=myres
      results myres
    pipe off
  endif
endmacro

procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Tests for PRIMLAB1" 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
