!******************************************************************************!
! Macro to test "RESULTS" intrinsic
!******************************************************************************!
startmacro s:func[""]
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE
  switch "DEBUG" dbg GET DEF=1

  call setDatDir
  invoke rampExists reg.shell.M.dictionary.isDictionaryEntry(RAMP)
  if rampExists isFalse then
    res z:interAct false
  endif

  set includeKnownExceptions "TRUE"

if func NEQS "" then
  call test_^{func}
else
  ! The "basics" include over-writing a result, removing a result ...
  call test_basics
  call test_passingResultNameToSubmacroForAssignment
  call test_arrays
  call test_getsize
  if rampExists then call test_inline
  call test_raw_java
  call test_tables
  call test_s_vs_a ! Tests for S: vs A:
  call test_invalid_caret_expression
  call test_save
  call test_load
  call test_esc_str
  call test_count
  call test_no_right_hand_type ! Since 3.5.3 to ensure right hand type support not accidentally enables
  call test_addroot ! Since 3.5.4

  ! Start Interactive test section to verify RESULTS output
  if interAct then
    res inst "Should see a list of RESULTS outputs for "FREQ" and "FRANK" and &
              all values in the "FRANK" table when then "/ALL" option is used."

    res FREQ 9728.0
    res FRANK {a=1, b={c=2.1, d=2.2}, e=hi}

    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> RESULTS FREQ"
      RESULTS FREQ
      say ""
      say "nM> RESULTS FR*"
      RESULTS FR*
      say ""
      say "nM> RES/ALL FR*"
      res/all FR*
    pipe off

  %test_results_context  ! Added for Bug 2454
  %test_results_os_prompt ! NXM-4108

  endif
  ! End Interactive test section
  
  %test_results_xlong    ! Added for Bug 2833
  %test_results_j_datatype            ! NXM-3894
  %test_results_j_datatype /NONATIVE  ! NXM-3894

endif

  remove/quiet/global test1
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 RESULTS" 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


!******************************************************************************!
procedure processException m:emsg
  if expectException REXISTS and expectException isTRUE then
    remove expectException
  else
    assert/text="^{reg.main.name}: Unexpected exception: ^emsg.data" FALSE
    invoke ,, this.M.printStackTrace(emsg.data)
    stop
  endif
return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return

!******************************************************************************!
procedure test_basics
  ! Test remove a result
  results status "GetRidOfMe"
  remove status
  assert/text="basics/remove" status NREXISTS

  results status "GetRidOfMe"
  remove label=status
  assert/text="basics/remove with LABEL=" status NREXISTS

  ! Test the ability to set a result
  result status "PASS"
  assert/text="basics/set" status EQS "PASS"

  ! Result should only exist as UPPER CASE name
  remove resName
  result resName "OLDSTRING"
  assert/text="basics/no lower case result name" "resname" NREXISTS

  ! Test the ability to over-write a result
  remove resName
  result resName "OLDSTRING"
  result resName "NEWSTRING"
  assert/text="basics/over-write" resName EQS "NEWSTRING"

  ! Test the default of uppercasing a result
  remove resUpcase
  result resupcase ThisIsUpperCase
  assert/text="basics/upper-case" "^resupcase" EQS "THISISUPPERCASE"

  ! Test the ability to set a result to a mixed case string
  remove resMixed
  result resMixed "AMixedCaseString"
  assert/text="basics/mixed-case" "^resMixed" EQS "AMixedCaseString"

  ! Test the ability to differentiate between a result and a quoted string
  result resName "dummy_string"
  ! If there is a problem this will be set to ^resname instead of 'resname'!!!
  result resName "resname"
  assert/text="basics/result vs. string" "^resName" EQS "resname"

  ! Test natural result delimiters
  ! The dot (.) delimiter followed by an invalid results character should
  ! signal the end of the results name is ^x
  result D:x 1.0
  result s:str "^x..."
  result s:answer "1.0..."
  assert/text="basics/natural delimiter dot, str = '^str'" "^str" EQS "^answer"

  ! Since the colon delimiter is used as a type separator (i.e. L:X or D:X,...)
  ! it can NOT be used as a natural delimiter
  result D:x 1.0
  result s:str "^x: is"
  result s:answer "^x: is"
  assert/text="basics/natural delimiter colon, str = '^str'" "^str" EQS "^answer"

  ! This should be converted to a string
  remove x
  result x 127.0.0.1:9000
  result s:answer "127.0.0.1:9000"
  assert/text="basics/ip_address:port w/o quotes, x = '^x'" "^x" eqs "^answer"

  ! Set a result with an invalid type
  if includeKnownExceptions then
    result expectException "TRUE"
    result w:y 10
    assert/text="basics/invalid type given for result" expectException NREXISTS
  endif

  !jph -- start - DR 500219-4
  !jph -- had to comment the checks for invalid results name out
  ! Set with an invalid result name - SPACE
  set tab {}
  set tab.x-y 10
  assert/text="basics: table key with dash (-)" ^{tab.x-y} EQ 10

  ! Set with an invalid result name - SPACE
  !result "Z Z" 10
  !assert/text="basics: illegal result name, 'Z Z'" "Z Z" NREXISTS

  ! Set with an invalid result name - STARTS WITH NUMBER
  !result 1X 10
  !assert/text="basics: illegal result name 1X, starts with number" "1X" NREXISTS
  !jph -- end - DR 500219-4

  ! Create an EXTRA long value (improved for bug_2833)
  result X:xlongval 6362923255675387860
  result S:xlongval_s ^xlongval
  assert/text="basics: XLONG value (X:)" xlongval_s EQS "6362923255675387860"


  ! test some true/false values (boolean type support)
  invoke trueValues  nxm.sys.lib.Args.trueStates
  invoke falseValues nxm.sys.lib.Args.falseStates

  set trueValues  "^{trueValues.toLowerCase()}|^{trueValues}"
  set falseValues "^{falseValues.toLowerCase()}|^{falseValues}"

  sedit trueValues  trueValues  GSUBS "|" ","
  sedit falseValues falseValues GSUBS "|" ","

  foreach key inList trueValues
    if key neqs "" then
      result z:state ^{key}
      assert/text="basics: BOOL value (Z:), given '^{key}'" state eqs "true"
    endif
  endfor

  foreach key inList falseValues
    if key neqs "" then
      result z:state ^{key}
      assert/text="basics: BOOL value (Z:), given '^{key}'" state eqs "false"
    endif
  endfor

  ! since 3.1.3: test setting INLINE TEST to boolean results (BUG 696)
  set z:state TEST(0)
  assert/text="basics: setting boolean result from INLINE TEST(0) is false" state isFalse
  set z:state TEST(1)
  assert/text="basics: setting boolean result from INLINE TEST(1) is true" state isTrue
  set x 3
  set z:state TEST(x)
  assert/text="basics: setting boolean result from INLINE TEST(X) is true for x=3" state isTrue
  set x -1
  set z:state TEST(x)
  assert/text="basics: setting boolean result from INLINE TEST(X) is false for x=-1" state isFalse
return

!******************************************************************************!
!      Test arrays (both inside Data and Object[])
!
! Depends on SEDIT's SPLIT function to create String[] to test Bug 2068
!
procedure test_arrays
  result array (0,1,2,3,4,5,6,7,8,9)
  result answer 0
  assert/text="ARRAYS get first element with () syntax " array(0) EQ answer
  assert/text="ARRAYS get first element with . syntax " array.0 EQ answer

  result answer 9
  assert/text="ARRAYS get last element with () syntax " array(9) EQ answer
  assert/text="ARRAYS get last element with . syntax " array.9 EQ answer

if /DataArray then
  ! set element using parens syntax for in a Data vector - TDB: Data.setIndex(index,val) NOT IMPLEMENTED
  result answer 20
  result array(1) answer
  assert/text="ARRAYS set second element with () syntax " array(1) EQ answer

  ! set element using dot syntax in a Data (vector) - TDB: Data.setIndex(index,val) NOT IMPLEMENTED
  result answer 21
  result array.1 answer
  assert/text="ARRAYS set second element with . syntax " array.1 EQ answer
endif

  ! original test case for Bug 2068 to set element using parens syntax in a String array
  sedit "1,2,3" sa split ","
  result answer "10"
  res sa(0) answer
  assert/text="ARRAYS (String) set first element with () syntax " sa(0) EQS answer

  set index 1
  result answer "11"
  res sa(index) answer
  assert/text="ARRAYS (String) set element with (result) syntax " sa(index) EQS answer

  ! workaround for Bug 2068 to set element using dot syntax in a String array
  result answer "40"
  res sa.2 answer
  assert/text="ARRAYS (String) set last element with . syntax " sa.2 EQS answer
return

!***************************************************************************
!      Given a results table, ask for the size of the table.
!
procedure test_getsize
  ! ask for the size of a table using GETSIZE
  res t:tab {x=1,y=2,z="stuff"}
  res answer tab.getsize
  assert/text="GETSIZE of a table results variable" answer EQ 3

  ! use GETSIZE on an integer and get back the number of elements
  res i:number (1,2,3,4,5,6)
  res number.spa 2
  res answer number.getsize
  assert/text="GETSIZE of a numeric results variable" answer EQ 3
return

!***************************************************************************
!    Test results handling between calling and called macros
!
!    Pass the name of a variable to a subroutine and have the subroutine put a
!    value into the named variable.
!
procedure test_passingResultNameToSubmacroForAssignment
  remove/quiet test1
  !result d:test1 0

  global test1

  ! This result should not be visible by the submacro
  result S:A_PARENT_LOCAL_RESULT "PARENT TEXT"
  %sub_results/debug=^dbg test1

  ! the subroutine should have set test1 = 123.0  Did it?
  res d:expected 123.0
  assert/text="Assign in sub macro" ^test1 eq ^expected

  !remove test1
return

!***************************************************************************
!    Test results inline
!
!    Test the ability of results to access objects that exist inside java code
!
procedure test_inline
  ! create a test file
  ramp test_results_inline

  ! obtain the 'representation' field from the file
  res rep file(test_results_inline).datarep
  assert/text="INLINE FILE().datarep" rep eqs env.osrep

  ! test ability to set/read file data contents from an inline call
  res file(test_results_inline).setdata(0) 10
  res newdataVal file(test_results_inline).getdata(0)
  res expectedValue 10.0
  assert/text="INLINE FILE, type 1000 set/get" newdataVal eq expectedValue
  remove rep
  erase test_results_inline

  ! test ability to set/read Type 3000 file data contents from an inline call
  call test_inline_3000 "^{datDir}.test3000_eeei.prm" "eeei"
  call test_inline_3000 "^{datDir}.test3000_ieee.prm" "ieee"

  assert/text="INLINE TEST" 0 EQ TEST(1,eq,2)
  assert/text="INLINE CALC" 2 EQ CALC(1,2,*)
  assert/text="INLINE SEDIT" SEDIT("This/is/a/string",ELEM,2,"/") EQS "is"

  ! testing for spaces between arguments for in-line functions (bug 713)
  assert/text="INLINE TEST with spaces between arguments" test(1,      eq, 2) EQ 0
  assert/text="INLINE CALC with spaces between arguments" calc(10,      20, +) EQ 30
  assert/text="INLINE SEDIT with spaces between arguments" sedit("a string",SUBS,      "string","new string",LOCASE) EQS "a new string"

  call test_deeper_nested_inline
return


!***************************************************************************
procedure test_inline_3000 s:fileName s:rep
  if ^fileName FEXISTS then
    set outfile "test3000_^{rep}_copy"
    file copy/f "^fileName" "^outfile"
    set FILE(^outfile).setData(0,ORD2) 999.0
    assert/text="INLINE FILE, type 3000 (^rep) set/get" FILE(^outfile).getData(0,ORD2) eq 999
    ! Bug 1647: handle getting nested dot notation
    assert/text="INLINE FILE, type 3000 (^rep) nested dot notation" &
      FILE(^outfile).getDataTable(0).ORD2 eq 999

    erase outfile
  else
    beep 1
    warn "Could not find ^fileName"
    assert/text="INLINE FILE, type 3000 (^rep) set/get" FALSE
  endif
return

!***************************************************************************
! test deeper nested dot notations with FILE inline function
! testing on a BLUE type 5000 (record-based) file.
! Bug 1647 and 1840
! @since NeXtMidas 2.7.1
procedure test_deeper_nested_inline
  res testfile "ram:test_deep_nested_inline"
  file copy/f ^{datDir}.sv1.prm testfile

  ! additional test cases for Bug 1647 (deeper dot level notation) these should not cause any ERROR
  res posRecord FILE(testfile).getDataTable(0).POS  ! only get POS sub-record (VD of len 3)
  res record0   FILE(testfile).getData(0)           ! get both POS and VEL sub-records (VD of len 6)
  assert/text="INLINE FILE(testfile).getDataTable(0).POS(0)" FILE(testfile).getDataTable(0).POS(0) eq posRecord(0)
  assert/text="INLINE FILE(testfile).getDataTable(0).POS(1)" FILE(testfile).getDataTable(0).POS(1) eq posRecord.1
  assert/text="INLINE FILE(testfile).getDataTable(0).POS.2"  FILE(testfile).getDataTable(0).POS.2  eq posRecord(2)
  assert/text="INLINE FILE(testfile).getDataTable(0).VEL(0)" FILE(testfile).getDataTable(0).VEL(0) eq record0(3)
  assert/text="INLINE FILE(testfile).getData(0).0"           FILE(testfile).getData(0).0           eq posRecord(0)
  assert/text="INLINE FILE(testfile).getData(0).4"           FILE(testfile).getData(0).4           eq record0.4

  ! test Bug 1840 (this should not cause an ERROR)
  assert/text="INLINE FILE(testfile).time.diff(FILE(testfile).time)" FILE(testfile).time.diff(FILE(testfile).time) eq 0.0

  ! cleanup
  erase testfile

return

!***************************************************************************
!    Test calling raw java
!
procedure test_raw_java
  result str "123:456"
  result x str.indexOf(":")
  assert/text="JAVA: STRING.indexof(String)" x eq 3


  result str "111.222.333.444"
  remove index
  set index str.indexof("2.",1)
  assert/text="JAVA: STRING.indexof(String,int)" index eq 6
return

!***************************************************************************
procedure test_tables

  ! Test the difference between cloning a table and creating a reference to
  ! a table.
  set origtable {x=1,y=2}
  set table {}
  set table.1 origtable  ! table.1 is a reference to original table
  set table.2 ^origtable ! table.2 is a clone/copy of the original table
  set table.1.x 9        ! change the x value in table 1, also changes
                         ! original table

  result value ^{table.1.x} ! verify original table was updated to new value
  assert/text="TABLE REFERENCE" value EQ 9

  result cloneValue ^{table.2.x} ! verify cloned table 2.x was not changed
  assert/text="TABLE CLONE remain same" cloneValue EQ 1


  result origValue ^{origtable.x} ! verify original table was also changed
                                  ! when the referenced table was modified
  assert/text="TABLE CLONE update" origValue EQ 9

  ! Check a table with a key "_string"
  result answer "another string"
  result tab {_1="^answer"}
  result x tab._1
  assert/text="TABLE: with _KEY, x = '^x'" "^x" eqs "^answer"

  ! Should not create a subtable without a root table.  Process the
  ! exception in the processException procedure
  if includeKnownExceptions then
    remove rootTable
    result expectException "TRUE"
    result rootTable.subTable {}
    assert/text="TABLE: create inner without root table" expectException NREXISTS

    ! Same as above except one more level in
    set tab {}
    result expectException "TRUE"
    set tab.x.y 10  ! Should not be able to set inner table
    assert/text="TABLE: create >1 level past root table" expectException NREXISTS
    remove expectException
  endif


  ! Check to be sure warning is issued for malformed table
  set tab {X=""Y=2} ! Malformed TABLE
  assert/text="TABLE: MALFORMED table (subsequent warning is OK!)" tab.x NEQS ""

  ! Check to be sure we do not falsely issue a malformed table
  set tab {X="Z=3",Y=2}
  assert/text="TABLE: table that is close to malformed but not (no warning)" &
         tab.x EQS "Z=3"

  !Since version 2.1.1 - ability to merge qualifiers into tables.
  res tab {X=2,Y=2}{X=1,Z=3}
  assert/text="TABLE: merge adjoining tables{}{}" tab.x EQ 1 AND &
                                                  tab.y EQ 2 AND &
                                                  tab.z EQ 3
return

!******************************************************************************!
!  This set of tests added by JC4 to check exception handling a command such as:
!      nM> RES FOO ^{BAR
!
!  is entered (as per changes reflected in DR 504098-1)
!
procedure test_invalid_caret_expression
  ASSERT/TEXT="RESULTS: INVALID CARET EXPRESSION (TEST 1 of 2)"/EXCEPT &
        RESULTS FOO ^{OPT

  ASSERT/TEXT="RESULTS: INVALID CARET EXPRESSION (TEST 1 of 2)"/EXCEPT &
        RESULTS ^{OPT
return

!******************************************************************************!
!  This set of tests handling of A: and S:. See Bug 1214 for details.
procedure test_s_vs_a
  say "This may print a deprecation warning about use of A:TEST..."
  res a:test "WayneIsAPain"
  set test2 test.toLowerCase()
  ASSERT/TEXT="RESULTS: Use of .toLoserCase() with A: (deprecated)" test2 eqs "wayneisapain"

  res s:test3 "WayneIsAPain"
  set test4 test3.toLowerCase()
  ASSERT/TEXT="RESULTS: Use of .toLoserCase() with S:" test2 eqs "wayneisapain"

return

!******************************************************************************!
!  This set of tests handling saving of result sets to file. See Bug 1451 for details.
procedure test_save

  res myTest {a=1, b={c=2.1, d=2.2}, e=hi}

  res/save
  ASSERT/TEXT="TEST_RESULTS: RES/SAVE: whole res table, default file name:"  results.tmp fexists
  erase results.tmp

  res/save=test_results_wholeTable
  ASSERT/TEXT="TEST_RESULTS: RES/SAVE: whole res table, custom .tmp file name:"  test_results_wholeTable.tmp fexists
  erase test_results_wholeTable.tmp

  res/save=test_results_wholeTable.txt *
  ASSERT/TEXT="TEST_RESULTS: RES/SAVE: whole res table, custom .txt file name:"  test_results_wholeTable.txt fexists
  erase test_results_wholeTable.txt

  res/save=test_results_myTest myTest
  ASSERT/TEXT="TEST_RESULTS: RES/SAVE: partial res table, custom file name:"  test_results_myTest.tmp fexists
  erase test_results_myTest.tmp

  res/save="test_results_myTest2" myTest
  ASSERT/TEXT="TEST_RESULTS: RES/SAVE: partial res table, custom file name:"  test_results_myTest2.tmp fexists
  erase test_results_myTest2.tmp

  res/save=test_results_myTest.txt myTest
  ASSERT/TEXT="TEST_RESULTS: RES/SAVE: partial res table, custom file name:"  test_results_myTest.txt fexists
  ! Not erasing because it is used by test_load procedure below

return

!******************************************************************************!
!  This set of tests handling loading of result sets from a file. See Bug 1451 for details.
procedure test_load

  rem myTest
  res myTest {a=1, b={c=2.1, d=2.2}, e=hi}
  res/save

  say "!!!!!!!SHOULD SEE PERMISSIONS WARNINGS BELOW!!!!!!!!!!!!!"
  res/load
  ASSERT/TEXT="TEST_RESULTS: RES/LOAD: whole res table from results.tmp:"  myTest rexists
  rem myTest

  res/load=test_results_myTest.txt
  ASSERT/TEXT="TEST_RESULTS: RES/LOAD: partial res table from myTest.txt:"  myTest rexists
  res yourTest {a=1, b={c=2.1, d=2.2}, e=hi}
  ASSERT/TEXT="TEST_RESULTS: RES/LOAD: check loaded String contents:"   myTest.e eqs yourTest.e
  ASSERT/TEXT="TEST_RESULTS: RES/LOAD: check loaded Numeric contents:"  myTest.a eq  yourTest.a

  erase test_results_myTest.txt
  erase results.tmp
return

!******************************************************************************!
!  This set of tests handling escape characters in quotes Strings (Bug 2292)
procedure test_esc_str
  res  s:iooptions_orig ENV.iooptions
  env set iooptions "-disableEscapeSequences"
  %test_results_esc_strings /interactive=^interAct /baseline=^baseline ! this should only be called from here so the iooptions settings stick
  env set iooptions iooptions_orig
return

!******************************************************************************!
! test case for BUG 2443 to prevent overwritting restricted results
procedure test_set_restricted
  result mytest1 "TRUE"
  assert/text="^reg.main.name: Able to set non restricted result: MYTEST1" mytest1 REXISTS

  result expectException "TRUE"
  res aux "should not be allowed to overwrite AUX result"
  assert/text="^reg.main.name: Should not be able to set restricted result: AUX" expectException NREXISTS

  result expectException "TRUE"
  res env "should not be allowed to overwrite ENV result"
  assert/text="^reg.main.name: Should not be able to set restricted result: ENV" expectException NREXISTS

  result expectException "TRUE"
  res opt "should not be allowed to overwrite OPT result"
  assert/text="^reg.main.name: Should not be able to set restricted result: OPT" expectException NREXISTS

  result expectException "TRUE"
  res RAM "should not be allowed to overwrite RAM result"
  assert/text="^reg.main.name: Should not be able to set restricted result: RAM" expectException NREXISTS

  result expectException "TRUE"
  res REG "should not be allowed to overwrite REG result"
  assert/text="^reg.main.name: Should not be able to set restricted result: REG" expectException NREXISTS

  result mytest2 "TRUE"
  assert/text="^reg.main.name: Able to set non restricted result: MYTEST2" mytest2 REXISTS
return

!******************************************************************************!
! test case for BUG 2506 to add the /count switch
procedure test_count

  res test_dummy_1 1
  res test_dummy_2 a
  res test_dummy_3 6.2
  res test_dummy_4 "Hello world"
  res test_dummy_5 test_dummy_2
  res test_dummy_6 ^test_dummy_4

  info "It is expected to see output for CNTALL and CNTSINGLE below."
  res/count=cntall test_dummy*

  assert/text="^reg.main.name: Counting results: " ^cntall eq 6

  res/count=cntsingle test_dummy_1
  assert/text="^reg.main.name: Counting results: " ^cntsingle eq 1
return

!******************************************************************************
! test case to show that results DO NOT support right hand types (types directly 
! place on the value), but converts these cases to a string (Since 3.5.3 Bug 2876 2883)
procedure test_no_right_hand_type

  res test_i_type I:3
  assert/text="^reg.main.name: right hand types NOT Supported I: " ^test_i_type eqs "I:3"
  res test_l_type L:678
  assert/text="^reg.main.name: right hand types NOT Supported L: " ^test_l_type eqs "L:678"
  res test_x_type X:234567
  assert/text="^reg.main.name: right hand types NOT Supported X: " ^test_x_type eqs "X:234567"
  res test_f_type F:34.0
  assert/text="^reg.main.name: right hand types NOT Supported F: " ^test_f_type eqs "F:34.0"
  res test_d_type D:56
  assert/text="^reg.main.name: right hand types NOT Supported D: " ^test_d_type eqs "D:56"
  res test_a_type A:HI
  assert/text="^reg.main.name: right hand types NOT Supported A: " ^test_a_type eqs "A:HI"
  res test_t_type T:2014:01:02::11:27:56.234
  assert/text="^reg.main.name: right hand types NOT Supported T: " ^test_t_type eqs "T:2014:01:02::11:27:56.234"
return

!******************************************************************************!
! test case for BUG 2929 (Since 3.5.4)
procedure test_addroot
   res newtable2929.a.b.c 8 /ADDROOT
   assert/text="^reg.main.name: testing newtable2929.a.b.c = ^newtable2929.a.b.c" ^newtable2929.a.b.c eq 8
   res newtable2929.x.y.z 6 /ADDROOT
   assert/text="^reg.main.name: testing original entry exists: newtable2929.a.b.c = ^newtable2929.a.b.c" ^newtable2929.a.b.c eq 8
   assert/text="^reg.main.name: testing the new entries: newtable2929.x.y.z = ^newtable2929.x.y.z" ^newtable2929.x.y.z eq 6
return