!******************************************************************************!
! Test case for SWITCH command.
!
! @version: $Id: test_switch.mm,v 1.8 2012/04/03 18:21:54 ntn Exp $
!******************************************************************************!
startmacro/swnoval/swval=999/table={A=1,B=2}/swcsvalnotinquotes=mixedCase_String_for_CS_switch_test
  switch "SWNOVAL" S:swnoval       GET
  switch "SWNOVAL" L:l_swnoval_def GET DEF=1
  switch "SWNOVAL" S:s_swnoval_def GET DEF=1
  switch "SWVAL"   L:swval_def     GET DEF=1
  switch "TABLE"   T:table         GET DEF={ONE=1,TWO=2} ! <-- Tests Bug 1028
  switch "JUNK"    T:junk          GET DEF={ONE=1,TWO=2} ! <-- Tests Bug 1028

  switch "SWSLASH" L:swslash_def  /SWSLASH=888

  ! Test the 'macro/switch' behavior where no value is given to the switch
  assert/text="^reg.main.name: macro/switch; SWITCH val GET , val = '^swnoval'" &
        "^swnoval" EQS ""
  assert/text="^reg.main.name: (noval) /SWITCH GT 0" &
        /SWNOVAL GT 0
  assert/text="^reg.main.name: (noval) /SWITCH isTrue" &
        /SWNOVAL isTrue
  assert/text="^reg.main.name: (noval) SWITCH ... GET DEF=1, val = '^l_swnoval_def'" &
        l_swnoval_def EQ 1
  assert/text="^reg.main.name: (noval) SWITCH ... GET DEF=1, val = '^s_swnoval_def'" &
        "^s_swnoval_def" EQS "1"
  assert/text="^reg.main.name: (=val) SWITCH ... GET DEF=1, val = '^swval_def'" &
        swval_def EQ 999

  assert/text="^reg.main.name: (=val) SWITCH SWSLASH GET /SWSLASH=888, val = '^swslash_def'" &
        swslash_def EQ 888


  table table EQUALS {A=1,B=2} status
  assert/text="^reg.main.name: SWITCH TABLE GET DEF={ONE=1,TWO=2}, val=^table" status isTrue

  table junk EQUALS {ONE=1,TWO=2} status
  assert/text="^reg.main.name: SWITCH JUNK GET DEF={ONE=1,TWO=2}, val=^junk" status isTrue

  call test_get_cs_switch
  %test_switch_setdel /testset=99 /testdel=55  ! passing in these switches is required
  %test_switch_getall/Y=1/Z=2
  %test_switch_blanks/f

endmacro

!******************************************************************************!
! test /CS (case sensitive) switch for GET function
! @bug 2583 SWITCH: it would be nice if switches could be case-sensitive
! @since 3.1.2
!******************************************************************************!
procedure test_get_cs_switch
  switch/cs SWCSVALNOTINQUOTES S:csswval GET
  assert/text="^reg.main.name: case-sensitive (/CS) switch for value without quotes" &
         csswval eqs "mixedCase_String_for_CS_switch_test" /CS
return
