home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / testrexx.zip / testrexx.cmd < prev    next >
OS/2 REXX Batch file  |  1994-04-07  |  3KB  |  99 lines

  1. /* TESTREXX.CMD */
  2. /* An example test script for the vanilla version of TESTREXX.DLL. This tests some of
  3.     the TestDummy functions that actually return something. It's just to get you started
  4.     writing your own test script.
  5. */
  6.  
  7. /* The TestLoadFuncs loads all the rest of the REXX functions in the TESTREXX DLL. */
  8. /* So, we don't have to make calls to RxFuncAdd to add each one of those functions. Of */
  9. /* course, in order to call TestLoadFuncs, we have to add that one. */
  10. CALL RxFuncAdd 'TestLoadFuncs', 'TESTREXX', 'TestLoadFuncs'
  11. CALL TestLoadFuncs
  12.  
  13. /* ========================= TestDummy1 ========================== */
  14. SAY "Calling...TestDummy1('my string'). Should be 'my string'"
  15. str = TestDummy1('my string')
  16. SAY str
  17.  
  18. /* ========================= TestDummy2 ========================== */
  19. SAY "Calling...TestDummy2('my string'). Should be null"
  20. str = TestDummy2('my string')
  21. SAY str
  22.  
  23. SAY "Calling...TestDummy2(346). Should be 346"
  24. str = TestDummy2(346)
  25. SAY str
  26.  
  27. val=-46
  28. SAY "Calling...TestDummy2(-46). Should be -46"
  29. str = TestDummy2(val)
  30. SAY str
  31.  
  32. /* ========================= TestDummy3 ========================== */
  33. SAY "Calling...TestDummy3('my string', 45). Should be null"
  34. str = TestDummy3('my string', 45)
  35. SAY str
  36.  
  37. SAY "Calling...TestDummy3(45, 45). Should be 90."
  38. str = TestDummy3(45, 45)
  39. SAY str
  40.  
  41. val=-45
  42. SAY "Calling...TestDummy3(-45, 45). Should be 0."
  43. str = TestDummy3(val, 45)
  44. SAY str
  45.  
  46. /* ========================= TestDummy4 ========================== */
  47. SAY "Calling...TestDummy4('my name is ', 'Jeff'). Should be 'my name is Jeff'"
  48. str = TestDummy4('my name is ', 'Jeff')
  49. SAY str
  50.  
  51. /* ========================= TestDummy5 ========================== */
  52. SAY "Calling...TestDummy5('my string', 45). Should produce an error."
  53. str = TestDummy5('my string', 45)
  54. IF str = "" THEN SAY "ERROR"
  55. IF str <> "" THEN SAY TestSum
  56.  
  57. SAY "Calling...TestDummy5(45, 45). Should be 90"
  58. str = TestDummy5(45, 45)
  59. IF str = "" THEN SAY "ERROR"
  60. IF str <> "" THEN SAY TestSum
  61.  
  62. /* ========================= TestDummy6 ========================== */
  63. SAY "Calling...TestDummy6(2, 45). Should be 47 and 90."
  64. str = TestDummy6(2, 45)
  65. IF str = "" THEN SAY "ERROR"
  66. IF str <> "" THEN SAY TestResult.0  TestResult.1
  67.  
  68. /* ========================= TestDummy7 ========================== */
  69. SAY "Calling...TestDummy7('hello', 'HELLO'). Should be positive number."
  70. str = TestDummy7('hello', 'HELLO')
  71. SAY str
  72.  
  73. SAY "Calling...TestDummy7('hello', 'HELLO', 'i'). Should be 0."
  74. str = TestDummy7('hello', 'HELLO', 'i')
  75. SAY str
  76.  
  77. SAY "Calling...TestDummy7('hello', 'HELLO', 's'). Should be positive number."
  78. str = TestDummy7('hello', 'HELLO', 's')
  79. SAY str
  80.  
  81. SAY "Calling...TestDummy7('hello', 'hillo'). Should be negative number."
  82. str = TestDummy7('hello', 'hillo')
  83. SAY str
  84.  
  85. /* ========================= TestDummy8 ========================== */
  86. SAY "Calling...TestDummy8(''). Should be TESTVAL."
  87. str = TestDummy8('')
  88. SAY str
  89.  
  90. TestVal = 'This is a test'
  91. SAY "Calling...TestDummy8(''). Should be 'This is a test'."
  92. str = TestDummy8('')
  93. SAY str
  94.  
  95. /* =============================================================================== */
  96. /* TestDropFuncs: This unloads all of the functions in the TESTREXX DLL. */
  97. /* We could otherwise leave them registered for some other REXX script */
  98. CALL TestDropFuncs
  99.