Source for file tester.php

Documentation is available at tester.php

  1. <?
  2.  
  3. /*
  4. Program E
  5. Copyright 2002, Paul Rydell
  6. This file is part of Program E.
  7. Program E is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. Program E is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Program E; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21.  
  22.  
  23. /**
  24. * AIML test application
  25. *
  26. * Load up dev-testcases.aiml and run this file to see if it passes all the tests
  27. * @author Paul Rydell
  28. * @copyright 2002
  29. * @version 0.0.8
  30. * @package Interpreter
  31. * @subpackage Responder
  32. */
  33.  
  34.  
  35. /**
  36. * Include the guts of the program.
  37. */
  38. include "respond.php";
  39.  
  40. // Read tests.txt into an array, each line a different element.
  41. $tests=array(
  42. "testatomic",
  43. "testdisplayset",
  44. "testhide",
  45. "testget",
  46. "testsetx",
  47. "testalter",
  48. "testsettopic",
  49. "test6a",
  50. "test6b",
  51. "testsimplecondition",
  52. "testsimpleconditiona",
  53. "testsimpleconditionmatch",
  54. "testconditionlist",
  55. "testconditionlistmatch",
  56. "testconditionlistdefault",
  57. "testconditionlistname",
  58. "teststar test passed",
  59. "teststar Test passed one and Test passed two and Test passed three and Test passed four",
  60. "testunderscore Test passed one and Test passed two and Test passed three and Test passed four",
  61. "testrandom",
  62. "testwordformat",
  63. "testnestedwordformat",
  64. "testsimplemultisentencethat",
  65. "testarray4multisentencethat",
  66. "testarray3multisentencethat",
  67. "testarray2multisentencethat",
  68. "testarray1multisentencethat",
  69. "testthatarray",
  70. "testbotproperties",
  71. "testconditionsetvalue",
  72. "testnestedcondition",
  73. "testnestedcondition1",
  74. "testnestedcondition2",
  75. "testsetcondition",
  76. "testversion",
  77. "testsrai",
  78. "testsr sraisucceeded",
  79. "testnestedsrai",
  80. "testthinksrai",
  81. "teststarset test passed",
  82. "testidsizedate",
  83. "testgossip",
  84. "testname",
  85. "testinput",
  86. "testinput1",
  87. "testinput2",
  88. "testinput3",
  89. "testgender he",
  90. "testthatstar",
  91. "testthatstar1",
  92. "testmultithatstar",
  93. "testmultithatstar1",
  94. "testtopicstar",
  95. "testmultitopicstar",
  96. "test35",
  97. "testoldtopic",
  98. "test36",
  99. "testextremesrai",
  100. "testperson i was",
  101. "testperson2 with you");
  102.  
  103. ss_timing_start("alll");
  104.  
  105. // For each element in the array to a curl request to talk.php.
  106. for ($x=0;$x<sizeof($tests);$x++){
  107.  
  108. // Start the session or get the existing session.
  109. session_start();
  110. $myuniqueid=session_id();
  111.  
  112. // Timer will let us know how long it took to get our response.
  113. ss_timing_start("single");
  114.  
  115. // Here is where we get the reply.
  116. $botresponse=reply($tests[$x],$myuniqueid,1);
  117.  
  118. // Stop the timer.
  119. ss_timing_stop("single");
  120.  
  121. // Print the results.
  122. print "<B>RESPONSE: " . $botresponse->response . "<BR></b>";
  123. print "<BR><BR>execution time: " . ss_timing_current("single");
  124. print "<BR>";
  125.  
  126. }
  127.  
  128. ss_timing_stop("alll");
  129. print "<BR><BR>all execution time: " . ss_timing_current("alll");
  130. print "<BR>";
  131.  
  132. ?>

Documentation generated on Wed, 12 Jan 2005 12:24:49 +0100 by phpDocumentor 1.3.0RC3