0
0

test_prostitution_functions.qsrc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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_set_pavlovsk_prostitute_blocked_3
  18. !! @run test_prostitute_work_hours_735am
  19. !! @run test_prostitute_work_hours_535pm_check_loc
  20. !! @run 'test_prostitute_work_hours_1am_Pavlovsk'
  21. !! @run test_prostitute_work_hours_1am_Pushkin
  22. !! @run test_is_solicitation_location_pav_commercial
  23. !! @run test_is_solicitation_location_city_center
  24. !! ------------------------------------------------------------------------------------
  25. !! @tests
  26. if $ARGS[0] = 'test_set_pavlovsk_prostitute_1':
  27. $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if Pavlovsk prostitution is enabled.'
  28. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  29. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  30. gs 'testframework', 'testsetup'
  31. fame['pav_prostitute'] = 260
  32. fame['pav_slut'] = 0
  33. prostitute['blocked'] = 0
  34. EXPECTED = 1
  35. $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
  36. gs $LOCATIONNAME, $FUNCTIONNAME
  37. *clr & cla
  38. ACTUAL = prostitute['pavlovsk']
  39. $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
  40. TESTRESULT = EXPECTED = ACTUAL
  41. else:
  42. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  43. end
  44. gs 'testframework', 'addTestResult'
  45. gs 'testframework', 'testDefaultCleanup'
  46. killvar 'fame'
  47. killvar 'prostitute'
  48. end
  49. if $ARGS[0] = 'test_set_pavlovsk_prostitute_2':
  50. $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if prostitution is now active.'
  51. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  52. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  53. gs 'testframework', 'testsetup'
  54. fame['pav_prostitute'] = 260
  55. fame['pav_slut'] = 0
  56. prostitute['blocked'] = 0
  57. EXPECTED = 1
  58. $EXPECTED_MESSAGE = "prostitute['active'] = <<EXPECTED>>"
  59. gs $LOCATIONNAME, $FUNCTIONNAME
  60. *clr & cla
  61. ACTUAL = prostitute['active']
  62. $ACTUAL_MESSAGE = "prostitute['active'] = <<ACTUAL>>"
  63. TESTRESULT = EXPECTED = ACTUAL
  64. else:
  65. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  66. end
  67. gs 'testframework', 'addTestResult'
  68. gs 'testframework', 'testDefaultCleanup'
  69. killvar 'fame'
  70. killvar 'prostitute'
  71. end
  72. if $ARGS[0] = 'test_set_pavlovsk_prostitute_3':
  73. $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if prostitution payment method is 1.'
  74. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  75. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  76. gs 'testframework', 'testsetup'
  77. fame['pav_prostitute'] = 260
  78. fame['pav_slut'] = 0
  79. prostitute['blocked'] = 0
  80. EXPECTED = 1
  81. $EXPECTED_MESSAGE = "prostitute['payment_method'] = <<EXPECTED>>"
  82. gs $LOCATIONNAME, $FUNCTIONNAME
  83. *clr & cla
  84. ACTUAL = prostitute['payment_method']
  85. $ACTUAL_MESSAGE = "prostitute['payment_method'] = <<ACTUAL>>"
  86. TESTRESULT = EXPECTED = ACTUAL
  87. else:
  88. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  89. end
  90. gs 'testframework', 'addTestResult'
  91. gs 'testframework', 'testDefaultCleanup'
  92. killvar 'fame'
  93. killvar 'prostitute'
  94. end
  95. if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_1':
  96. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, prostitution is blocked, check if Pavlovsk prostitution is inactive.'
  97. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  98. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  99. gs 'testframework', 'testsetup'
  100. fame['pav_prostitute'] = 260
  101. fame['pav_slut'] = 270
  102. prostitute['blocked'] = 1
  103. EXPECTED = 0
  104. $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
  105. gs $LOCATIONNAME, $FUNCTIONNAME
  106. *clr & cla
  107. ACTUAL = prostitute['pavlovsk']
  108. $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
  109. TESTRESULT = EXPECTED = ACTUAL
  110. else:
  111. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  112. end
  113. gs 'testframework', 'addTestResult'
  114. gs 'testframework', 'testDefaultCleanup'
  115. killvar 'fame'
  116. killvar 'prostitute'
  117. end
  118. if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_2':
  119. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, prostitution is blocked check if prostitution is inactive.'
  120. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  121. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  122. gs 'testframework', 'testsetup'
  123. fame['pav_prostitute'] = 260
  124. fame['pav_slut'] = 270
  125. prostitute['blocked'] = 1
  126. EXPECTED = 0
  127. $EXPECTED_MESSAGE = "prostitute['active'] = <<EXPECTED>>"
  128. gs $LOCATIONNAME, $FUNCTIONNAME
  129. *clr & cla
  130. ACTUAL = prostitute['active']
  131. $ACTUAL_MESSAGE = "prostitute['active'] = <<ACTUAL>>"
  132. TESTRESULT = EXPECTED = ACTUAL
  133. else:
  134. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  135. end
  136. gs 'testframework', 'addTestResult'
  137. gs 'testframework', 'testDefaultCleanup'
  138. killvar 'fame'
  139. killvar 'prostitute'
  140. end
  141. if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_3':
  142. $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, Pavlovsk prostitution is active and prostitution gets blocked: check if Pavlovsk prostitution is inactive.'
  143. $FUNCTIONNAME = 'set_pavlovsk_prostitute'
  144. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  145. gs 'testframework', 'testsetup'
  146. fame['pav_prostitute'] = 260
  147. fame['pav_slut'] = 270
  148. prostitute['active'] = 1
  149. prostitute['pavlovsk'] = 1
  150. prostitute['blocked'] = 1
  151. EXPECTED = 0
  152. $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
  153. gs $LOCATIONNAME, $FUNCTIONNAME
  154. *clr & cla
  155. ACTUAL = prostitute['pavlovsk']
  156. $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
  157. TESTRESULT = EXPECTED = ACTUAL
  158. else:
  159. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  160. end
  161. gs 'testframework', 'addTestResult'
  162. gs 'testframework', 'testDefaultCleanup'
  163. killvar 'fame'
  164. killvar 'prostitute'
  165. end
  166. if $ARGS[0] = 'test_prostitute_work_hours_735am':
  167. $TESTNAME = 'Region is Pavlovsk, 7:35am, check if work hours check returns false.'
  168. $FUNCTIONNAME = 'prostitute_work_hours'
  169. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  170. gs 'testframework', 'testsetup'
  171. $region = 'pav'
  172. hour = 7
  173. minut = 35
  174. EXPECTED = _FALSE
  175. $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
  176. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  177. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
  178. TESTRESULT = EXPECTED = ACTUAL
  179. else:
  180. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  181. end
  182. gs 'testframework', 'addTestResult'
  183. gs 'testframework', 'testDefaultCleanup'
  184. killvar 'region'
  185. end
  186. if $ARGS[0] = 'test_prostitute_work_hours_535pm_check_loc':
  187. $TESTNAME = "Location is Pavlovsk NoSuchLocation (location is checked if starts with 'pav_'), 5:35pm, check if work hours check returns true."
  188. $FUNCTIONNAME = 'prostitute_work_hours'
  189. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  190. gs 'testframework', 'testsetup'
  191. $loc = 'pav_nosuchplace'
  192. hour = 17
  193. minut = 35
  194. EXPECTED = _TRUE
  195. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
  196. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  197. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<ACTUAL>>"
  198. TESTRESULT = EXPECTED = ACTUAL
  199. else:
  200. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  201. end
  202. gs 'testframework', 'addTestResult'
  203. gs 'testframework', 'testDefaultCleanup'
  204. killvar 'loc'
  205. end
  206. if $ARGS[0] = 'test_prostitute_work_hours_1am_Pavlovsk':
  207. $TESTNAME = 'Region is Pavlovsk, 1:00am, check if work hours check returns false.'
  208. $FUNCTIONNAME = 'prostitute_work_hours'
  209. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  210. gs 'testframework', 'testsetup'
  211. $region = 'pav'
  212. hour = 1
  213. minut = 0
  214. EXPECTED = _FALSE
  215. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<EXPECTED>>"
  216. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  217. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<ACTUAL>>"
  218. TESTRESULT = EXPECTED = ACTUAL
  219. else:
  220. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  221. end
  222. gs 'testframework', 'addTestResult'
  223. gs 'testframework', 'testDefaultCleanup'
  224. killvar 'region'
  225. end
  226. if $ARGS[0] = 'test_prostitute_work_hours_1am_Pushkin':
  227. $TESTNAME = 'Region is Pushkin, 1:00am, check if work hours check returns true.'
  228. $FUNCTIONNAME = 'prostitute_work_hours'
  229. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  230. gs 'testframework', 'testsetup'
  231. $region = 'pushkin'
  232. hour = 1
  233. minut = 0
  234. EXPECTED = _TRUE
  235. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<EXPECTED>>"
  236. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
  237. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<ACTUAL>>"
  238. TESTRESULT = EXPECTED = ACTUAL
  239. else:
  240. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  241. end
  242. gs 'testframework', 'addTestResult'
  243. gs 'testframework', 'testDefaultCleanup'
  244. killvar 'region'
  245. end
  246. if $ARGS[0] = 'test_is_solicitation_location_pav_commercial':
  247. $TESTNAME = "Location is Pavlovsk Commercial, check if solicitation location check returns true."
  248. $FUNCTIONNAME = 'is_solicitation_location'
  249. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  250. gs 'testframework', 'testsetup'
  251. $loc = 'pav_commercial'
  252. menu_off = 0
  253. $loc_arg = ''
  254. EXPECTED = _TRUE
  255. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
  256. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME, -1)
  257. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
  258. TESTRESULT = EXPECTED = ACTUAL
  259. else:
  260. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  261. end
  262. gs 'testframework', 'addTestResult'
  263. gs 'testframework', 'testDefaultCleanup'
  264. killvar 'loc'
  265. killvar 'menu_off'
  266. killvar 'loc_arg'
  267. end
  268. if $ARGS[0] = 'test_is_solicitation_location_city_center':
  269. $TESTNAME = "Location is City Center, check if solicitation location check returns false."
  270. $FUNCTIONNAME = 'is_solicitation_location'
  271. if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
  272. gs 'testframework', 'testsetup'
  273. $loc = 'city_center'
  274. menu_off = 0
  275. $loc_arg = ''
  276. EXPECTED = _FALSE
  277. $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
  278. ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME, -1)
  279. $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
  280. TESTRESULT = EXPECTED = ACTUAL
  281. else:
  282. $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
  283. end
  284. gs 'testframework', 'addTestResult'
  285. gs 'testframework', 'testDefaultCleanup'
  286. killvar 'loc'
  287. killvar 'menu_off'
  288. killvar 'loc_arg'
  289. end
  290. killvar 'LOCATIONNAME'
  291. killvar '_ISTEST'
  292. --- test_prostitution_functions ---------------------------------