test_prostitution_functions.qsrc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. # test_prostitution_functions
  2. !! ------------------------------------------------------------------------------------
  3. !! $LOCATIONNAME = the tested location with the test_ prefix.
  4. !! E.g.: test_korrPar, test_internet_mobile, test_prostitution_functions, etc.
  5. !! ------------------------------------------------------------------------------------
  6. !! @locationsetup
  7. _ISTEST = 1
  8. $LOCATIONNAME = 'prostitution_functions'
  9. !! ------------------------------------------------------------------------------------
  10. !! Run the tests - add the calls to the tests for the location that have to be run.
  11. !! ------------------------------------------------------------------------------------
  12. !! @run test_set_pavlovsk_prostitute_1
  13. !! @run test_set_pavlovsk_prostitute_2
  14. !! @run test_set_pavlovsk_prostitute_3
  15. !! @run test_set_pavlovsk_prostitute_blocked_1
  16. !! @run test_set_pavlovsk_prostitute_blocked_2
  17. !! @run test_prostitute_work_hours_735am
  18. !! @run test_prostitute_work_hours_535pm_check_loc
  19. !! @run 'test_prostitute_work_hours_1am_Pavlovsk'
  20. !! @run test_prostitute_work_hours_1am_Pushkin
  21. !! ------------------------------------------------------------------------------------
  22. !! @tests
  23. if $ARGS[0] = 'test_set_pavlovsk_prostitute_1':
  24. $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if Pavlovsk prostitution is enabled.'
  25. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  26. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  27. gs 'testframework', 'testsetup'
  28. fame['pav_prostitute'] = 260
  29. fame['pav_slut'] = 0
  30. prostitute['blocked'] = 0
  31. EXPECTED = 1
  32. $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
  33. gs $LOCATIONNAME, $FUNCTIONNAME
  34. *clr & cla
  35. ACTUAL = prostitute['pavlovsk']
  36. $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
  37. TESTRESULT = EXPECTED = ACTUAL
  38. else:
  39. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  40. end
  41. gs 'testframework', 'addTestResult'
  42. gs 'testframework', 'testDefaultCleanup'
  43. killvar 'fame'
  44. killvar 'prostitute'
  45. end
  46. if $ARGS[0] = 'test_set_pavlovsk_prostitute_2':
  47. $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if prostitution is now active.'
  48. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  49. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  50. gs 'testframework', 'testsetup'
  51. fame['pav_prostitute'] = 260
  52. fame['pav_slut'] = 0
  53. prostitute['blocked'] = 0
  54. EXPECTED = 1
  55. $EXPECTED_MESSAGE = "prostitute['active'] = <<EXPECTED>>"
  56. gs $LOCATIONNAME, $FUNCTIONNAME
  57. *clr & cla
  58. ACTUAL = prostitute['active']
  59. $ACTUAL_MESSAGE = "prostitute['active'] = <<ACTUAL>>"
  60. TESTRESULT = EXPECTED = ACTUAL
  61. else:
  62. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  63. end
  64. gs 'testframework', 'addTestResult'
  65. gs 'testframework', 'testDefaultCleanup'
  66. killvar 'fame'
  67. killvar 'prostitute'
  68. end
  69. if $ARGS[0] = 'test_set_pavlovsk_prostitute_3':
  70. $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if prostitution payment method is 1.'
  71. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  72. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  73. gs 'testframework', 'testsetup'
  74. fame['pav_prostitute'] = 260
  75. fame['pav_slut'] = 0
  76. prostitute['blocked'] = 0
  77. EXPECTED = 1
  78. $EXPECTED_MESSAGE = "prostitute['payment_method'] = <<EXPECTED>>"
  79. gs $LOCATIONNAME, $FUNCTIONNAME
  80. *clr & cla
  81. ACTUAL = prostitute['payment_method']
  82. $ACTUAL_MESSAGE = "prostitute['payment_method'] = <<ACTUAL>>"
  83. TESTRESULT = EXPECTED = ACTUAL
  84. else:
  85. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  86. end
  87. gs 'testframework', 'addTestResult'
  88. gs 'testframework', 'testDefaultCleanup'
  89. killvar 'fame'
  90. killvar 'prostitute'
  91. end
  92. if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_1':
  93. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, prostitution is blocked, check if Pavlovsk prostitution is inactive.'
  94. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  95. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  96. gs 'testframework', 'testsetup'
  97. fame['pav_prostitute'] = 260
  98. fame['pav_slut'] = 270
  99. prostitute['blocked'] = 1
  100. EXPECTED = 0
  101. $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
  102. gs $LOCATIONNAME, $FUNCTIONNAME
  103. *clr & cla
  104. ACTUAL = prostitute['pavlovsk']
  105. $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
  106. TESTRESULT = EXPECTED = ACTUAL
  107. else:
  108. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  109. end
  110. gs 'testframework', 'addTestResult'
  111. gs 'testframework', 'testDefaultCleanup'
  112. killvar 'fame'
  113. killvar 'prostitute'
  114. end
  115. if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_2':
  116. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, prostitution is blocked check if prostitution is inactive.'
  117. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  118. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  119. gs 'testframework', 'testsetup'
  120. fame['pav_prostitute'] = 260
  121. fame['pav_slut'] = 270
  122. prostitute['blocked'] = 1
  123. EXPECTED = 0
  124. $EXPECTED_MESSAGE = "prostitute['active'] = <<EXPECTED>>"
  125. gs $LOCATIONNAME, $FUNCTIONNAME
  126. *clr & cla
  127. ACTUAL = prostitute['active']
  128. $ACTUAL_MESSAGE = "prostitute['active'] = <<ACTUAL>>"
  129. TESTRESULT = EXPECTED = ACTUAL
  130. else:
  131. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  132. end
  133. gs 'testframework', 'addTestResult'
  134. gs 'testframework', 'testDefaultCleanup'
  135. killvar 'fame'
  136. killvar 'prostitute'
  137. end
  138. if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_2':
  139. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, Pavlovsk prostitution is action and prostitution gets blocked: check if Pavlovsk prostitution is inactive.'
  140. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  141. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  142. gs 'testframework', 'testsetup'
  143. fame['pav_prostitute'] = 260
  144. fame['pav_slut'] = 270
  145. prostitute['active'] = 1
  146. prostitute['pavlovsk'] = 1
  147. prostitute['blocked'] = 1
  148. EXPECTED = 0
  149. $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
  150. gs $LOCATIONNAME, $FUNCTIONNAME
  151. *clr & cla
  152. ACTUAL = prostitute['pavlovsk']
  153. $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
  154. TESTRESULT = EXPECTED = ACTUAL
  155. else:
  156. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  157. end
  158. gs 'testframework', 'addTestResult'
  159. gs 'testframework', 'testDefaultCleanup'
  160. killvar 'fame'
  161. killvar 'prostitute'
  162. end
  163. if $ARGS[0] = 'test_prostitute_work_hours_735am':
  164. $TESTNAME = 'Region is Pavlovsk, 7:35am, check if work hours check returns false.'
  165. $FUNCTIONNAME = 'prostitute_work_hours'
  166. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  167. gs 'testframework', 'testsetup'
  168. $region = 'pav'
  169. hour = 7
  170. minut = 35
  171. EXPECTED = _FALSE
  172. $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
  173. gs $LOCATIONNAME, $FUNCTIONNAME
  174. *clr & cla
  175. ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
  176. $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
  177. TESTRESULT = EXPECTED = ACTUAL
  178. else:
  179. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  180. end
  181. gs 'testframework', 'addTestResult'
  182. gs 'testframework', 'testDefaultCleanup'
  183. killvar 'region'
  184. end
  185. if $ARGS[0] = 'test_prostitute_work_hours_535pm_check_loc':
  186. $TESTNAME = "Location is Pavlovsk NoSuchLocation (location is checked if starts with 'pav_'), 5:35pm, check if work hours check returns true."
  187. $FUNCTIONNAME = 'prostitute_work_hours'
  188. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  189. gs 'testframework', 'testsetup'
  190. $loc = 'pav_nosuchplace'
  191. hour = 17
  192. minut = 35
  193. EXPECTED = _TRUE
  194. $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
  195. gs $LOCATIONNAME, $FUNCTIONNAME
  196. *clr & cla
  197. ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
  198. $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
  199. TESTRESULT = EXPECTED = ACTUAL
  200. else:
  201. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  202. end
  203. gs 'testframework', 'addTestResult'
  204. gs 'testframework', 'testDefaultCleanup'
  205. killvar 'loc'
  206. end
  207. if $ARGS[0] = 'test_prostitute_work_hours_1am_Pavlovsk':
  208. $TESTNAME = 'Region is Pavlovsk, 1:00am, check if work hours check returns false.'
  209. $FUNCTIONNAME = 'prostitute_work_hours'
  210. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  211. gs 'testframework', 'testsetup'
  212. $region = 'pav'
  213. hour = 1
  214. minut = 0
  215. EXPECTED = _FALSE
  216. $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
  217. gs $LOCATIONNAME, $FUNCTIONNAME
  218. *clr & cla
  219. ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
  220. $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
  221. TESTRESULT = EXPECTED = ACTUAL
  222. else:
  223. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  224. end
  225. gs 'testframework', 'addTestResult'
  226. gs 'testframework', 'testDefaultCleanup'
  227. killvar 'region'
  228. end
  229. if $ARGS[0] = 'test_prostitute_work_hours_1am_Pushkin':
  230. $TESTNAME = 'Region is Pushkin, 1:00am, check if work hours check returns true.'
  231. $FUNCTIONNAME = 'prostitute_work_hours'
  232. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  233. gs 'testframework', 'testsetup'
  234. $region = 'pushkin'
  235. hour = 1
  236. minut = 0
  237. EXPECTED = _TRUE
  238. $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
  239. gs $LOCATIONNAME, $FUNCTIONNAME
  240. *clr & cla
  241. ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
  242. $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
  243. TESTRESULT = EXPECTED = ACTUAL
  244. else:
  245. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  246. end
  247. gs 'testframework', 'addTestResult'
  248. gs 'testframework', 'testDefaultCleanup'
  249. killvar 'region'
  250. end
  251. killvar 'LOCATIONNAME'
  252. killvar '_ISTEST'
  253. --- test_prostitution_functions ---------------------------------