!    
!    Test the use of the GETALL function in the SWITCH command
!
!    @Author:  JC4
!    @Version: $Id: test_switch_getall.mm,v 1.1 2010/11/10 20:04:12 jwb Exp $
!    @BUG 2284 - SWITCH: add a GETALL function.
!    
! NOTE: This macro needs to be called witht he following switches:
!    %test_switch_getall/y=1/z=2
startmacro/A/B=/C=""/D="MyStr"/Y=555
  
  ! Creates a new table
  switch ,, mytable GETALL ,, "YES"
  
  assert/text="Table exists" &
    mytable rExists
  
  assert/text="State switch" &
    mytable.A rExists AND &
    mytable.A isTrue
  
  assert/text="Value switch with empty String (not quoted)" &
    mytable.B rExists AND &
    mytable.B eqs ""  /NOOP="Known Bug 2285"
  
  assert/text="Value switch with empty String (quoted)" &
    mytable.C rExists AND &
    mytable.C eqs ""  /NOOP="Known Bug 2285"
  
  assert/text="Value switch with a String" &
    mytable.D rExists AND &
    mytable.D eqs "MyStr"
  
  assert/text="Switch not specified" &
    mytable.E nrExists
  
  assert/text="Command line switch (no override)" &
    mytable.Y rExists AND &
    mytable.Y eq 1
  
  assert/text="Command line switch (with override)" &
    mytable.Z rExists AND &
    mytable.Z eq 2
    
  ! Takes in a table with defaults
  set t:switches {A=3,B="Hello World",X="MyDef"}
  
  switch ,, switches GETALL ,, "YES"
  
  assert/text="Table exists" &
    switches rExists
   
  assert/text="State switch" &
    switches.A rExists AND &
    switches.A isTrue
  
  assert/text="Value switch with empty String (not quoted)" &
    switches.B rExists AND &
    switches.B eqs ""  /NOOP="Known Bug 2285"
  
  assert/text="Value switch with empty String (quoted)" &
    switches.C rExists AND &
    switches.C eqs ""  /NOOP="Known Bug 2285"
  
  assert/text="Value switch with a String" &
    switches.D rExists AND &
    switches.D eqs "MyStr"
  
  assert/text="Switch not specified (no default)" &
    switches.E nrExists
    
  assert/text="Switch not specified (with default)" &
    switches.X rExists AND &
    switches.X eqs "MyDef"
    
  assert/text="Command line switch (no override)" &
    switches.Y rExists AND &
    switches.Y eq 1
  
  assert/text="Command line switch (with override)" &
    switches.Z rExists AND &
    switches.Z eq 2 
    
endmacro