test_prostitution_functions.qsrc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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_3':
  139. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, Pavlovsk prostitution is active 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. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  174. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
  175. TESTRESULT = EXPECTED = ACTUAL
  176. else:
  177. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  178. end
  179. gs 'testframework', 'addTestResult'
  180. gs 'testframework', 'testDefaultCleanup'
  181. killvar 'region'
  182. end
  183. if $ARGS[0] = 'test_prostitute_work_hours_535pm_check_loc':
  184. $TESTNAME = "Location is Pavlovsk NoSuchLocation (location is checked if starts with 'pav_'), 5:35pm, check if work hours check returns true."
  185. $FUNCTIONNAME = 'prostitute_work_hours'
  186. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  187. gs 'testframework', 'testsetup'
  188. $loc = 'pav_nosuchplace'
  189. hour = 17
  190. minut = 35
  191. EXPECTED = _TRUE
  192. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
  193. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  194. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<ACTUAL>>"
  195. TESTRESULT = EXPECTED = ACTUAL
  196. else:
  197. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  198. end
  199. gs 'testframework', 'addTestResult'
  200. gs 'testframework', 'testDefaultCleanup'
  201. killvar 'loc'
  202. end
  203. if $ARGS[0] = 'test_prostitute_work_hours_1am_Pavlovsk':
  204. $TESTNAME = 'Region is Pavlovsk, 1:00am, check if work hours check returns false.'
  205. $FUNCTIONNAME = 'prostitute_work_hours'
  206. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  207. gs 'testframework', 'testsetup'
  208. $region = 'pav'
  209. hour = 1
  210. minut = 0
  211. EXPECTED = _FALSE
  212. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<EXPECTED>>"
  213. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  214. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<ACTUAL>>"
  215. TESTRESULT = EXPECTED = ACTUAL
  216. else:
  217. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  218. end
  219. gs 'testframework', 'addTestResult'
  220. gs 'testframework', 'testDefaultCleanup'
  221. killvar 'region'
  222. end
  223. if $ARGS[0] = 'test_prostitute_work_hours_1am_Pushkin':
  224. $TESTNAME = 'Region is Pushkin, 1:00am, check if work hours check returns true.'
  225. $FUNCTIONNAME = 'prostitute_work_hours'
  226. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  227. gs 'testframework', 'testsetup'
  228. $region = 'pushkin'
  229. hour = 1
  230. minut = 0
  231. EXPECTED = _TRUE
  232. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<EXPECTED>>"
  233. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  234. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<ACTUAL>>"
  235. TESTRESULT = EXPECTED = ACTUAL
  236. else:
  237. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  238. end
  239. gs 'testframework', 'addTestResult'
  240. gs 'testframework', 'testDefaultCleanup'
  241. killvar 'region'
  242. end
  243. if $ARGS[0] = 'test_is_solicitation_location_pav_commercial':
  244. $TESTNAME = "Location is Pavlovsk Commercial, check if solicitation location check returns true."
  245. $FUNCTIONNAME = 'is_solicitation_location'
  246. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  247. gs 'testframework', 'testsetup'
  248. $loc = 'pav_commercial'
  249. menu_off = 0
  250. $loc_arg = ''
  251. EXPECTED = _TRUE
  252. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
  253. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME, -1)
  254. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
  255. TESTRESULT = EXPECTED = ACTUAL
  256. else:
  257. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  258. end
  259. gs 'testframework', 'addTestResult'
  260. gs 'testframework', 'testDefaultCleanup'
  261. killvar 'loc'
  262. killvar 'menu_off'
  263. killvar 'loc_arg'
  264. end
  265. if $ARGS[0] = 'test_is_solicitation_location_city_center':
  266. $TESTNAME = "Location is City Center, check if solicitation location check returns false."
  267. $FUNCTIONNAME = 'is_solicitation_location'
  268. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  269. gs 'testframework', 'testsetup'
  270. $loc = 'city_center'
  271. menu_off = 0
  272. $loc_arg = ''
  273. EXPECTED = _FALSE
  274. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
  275. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME, -1)
  276. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
  277. TESTRESULT = EXPECTED = ACTUAL
  278. else:
  279. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  280. end
  281. gs 'testframework', 'addTestResult'
  282. gs 'testframework', 'testDefaultCleanup'
  283. killvar 'loc'
  284. killvar 'menu_off'
  285. killvar 'loc_arg'
  286. end
  287. killvar 'LOCATIONNAME'
  288. killvar '_ISTEST'
  289. --- test_prostitution_functions ---------------------------------