Sfoglia il codice sorgente

Tests for 'prostitution_functions'

netuttki 1 anno fa
parent
commit
7480a81fe1
1 ha cambiato i file con 301 aggiunte e 0 eliminazioni
  1. 301 0
      test/test_prostitution_functions.qsrc

+ 301 - 0
test/test_prostitution_functions.qsrc

@@ -0,0 +1,301 @@
+# test_prostitution_functions
+
+!! ------------------------------------------------------------------------------------
+!! $LOCATIONNAME = the tested location with the test_ prefix.
+!! E.g.: test_korrPar, test_internet_mobile, test_prostitution_functions, etc.
+!! ------------------------------------------------------------------------------------
+!! @locationsetup
+   
+_ISTEST = 1
+$LOCATIONNAME = 'prostitution_functions'
+   
+!! ------------------------------------------------------------------------------------
+!! Run the tests - add the calls to the tests for the location that have to be run.
+!! ------------------------------------------------------------------------------------
+  
+!! @run test_set_pavlovsk_prostitute_1
+!! @run test_set_pavlovsk_prostitute_2
+!! @run test_set_pavlovsk_prostitute_3
+!! @run test_set_pavlovsk_prostitute_blocked_1
+!! @run test_set_pavlovsk_prostitute_blocked_2
+!! @run test_prostitute_work_hours_735am
+!! @run test_prostitute_work_hours_535pm_check_loc
+!! @run 'test_prostitute_work_hours_1am_Pavlovsk'
+!! @run test_prostitute_work_hours_1am_Pushkin
+
+!! ------------------------------------------------------------------------------------
+!! @tests 
+
+if $ARGS[0] = 'test_set_pavlovsk_prostitute_1':
+    $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if Pavlovsk prostitution is enabled.'
+    $FUNCTIONNAME = 'set_pavlovsk_prostitute'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        fame['pav_prostitute'] = 260
+        fame['pav_slut'] = 0
+        prostitute['blocked'] = 0
+
+        EXPECTED = 1
+        $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
+        
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla 
+        ACTUAL = prostitute['pavlovsk']
+        $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'fame'
+    killvar 'prostitute'
+end
+
+
+if $ARGS[0] = 'test_set_pavlovsk_prostitute_2':
+    $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if prostitution is now active.'
+    $FUNCTIONNAME = 'set_pavlovsk_prostitute'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        fame['pav_prostitute'] = 260
+        fame['pav_slut'] = 0
+        prostitute['blocked'] = 0
+
+        EXPECTED = 1
+        $EXPECTED_MESSAGE = "prostitute['active'] = <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla 
+        ACTUAL = prostitute['active']
+        $ACTUAL_MESSAGE = "prostitute['active'] = <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'fame'
+    killvar 'prostitute'
+end
+
+if $ARGS[0] = 'test_set_pavlovsk_prostitute_3':
+    $TESTNAME = 'Prostitute fame > 250, Slut fame < 250 check if prostitution payment method is 1.'
+    $FUNCTIONNAME = 'set_pavlovsk_prostitute'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        fame['pav_prostitute'] = 260
+        fame['pav_slut'] = 0
+        prostitute['blocked'] = 0
+
+        EXPECTED = 1
+        $EXPECTED_MESSAGE = "prostitute['payment_method'] = <<EXPECTED>>"
+       
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla 
+        ACTUAL = prostitute['payment_method']
+        $ACTUAL_MESSAGE = "prostitute['payment_method'] = <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end  
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'fame'
+    killvar 'prostitute'
+end
+
+if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_1':
+    $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, prostitution is blocked, check if Pavlovsk prostitution is inactive.'
+    $FUNCTIONNAME = 'set_pavlovsk_prostitute'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        fame['pav_prostitute'] = 260
+        fame['pav_slut'] = 270
+        prostitute['blocked'] = 1
+
+        EXPECTED = 0
+        $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
+       
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla 
+        ACTUAL = prostitute['pavlovsk']
+        $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end  
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'fame'
+    killvar 'prostitute'
+end
+
+if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_2':
+    $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, prostitution is blocked check if prostitution is inactive.'
+    $FUNCTIONNAME = 'set_pavlovsk_prostitute'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        fame['pav_prostitute'] = 260
+        fame['pav_slut'] = 270
+        prostitute['blocked'] = 1
+
+        EXPECTED = 0
+        $EXPECTED_MESSAGE = "prostitute['active'] = <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla 
+        ACTUAL = prostitute['active']
+        $ACTUAL_MESSAGE = "prostitute['active'] = <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'fame'
+    killvar 'prostitute'
+end
+
+if $ARGS[0] = 'test_set_pavlovsk_prostitute_blocked_2':
+    $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, Pavlovsk prostitution is action and prostitution gets blocked: check if Pavlovsk prostitution is inactive.'
+    $FUNCTIONNAME = 'set_pavlovsk_prostitute'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        fame['pav_prostitute'] = 260
+        fame['pav_slut'] = 270
+        prostitute['active'] = 1
+        prostitute['pavlovsk'] = 1
+        prostitute['blocked'] = 1
+
+        EXPECTED = 0
+        $EXPECTED_MESSAGE = "prostitute['pavlovsk'] = <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla 
+        ACTUAL = prostitute['pavlovsk']
+        $ACTUAL_MESSAGE = "prostitute['pavlovsk'] = <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'fame'
+    killvar 'prostitute'
+end
+
+
+if $ARGS[0] = 'test_prostitute_work_hours_735am':
+    $TESTNAME = 'Region is Pavlovsk, 7:35am, check if work hours check returns false.'
+    $FUNCTIONNAME = 'prostitute_work_hours'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        $region = 'pav'
+        hour = 7
+        minut = 35
+
+        EXPECTED = _FALSE
+        $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla
+        ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
+        $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'region'
+end
+
+if $ARGS[0] = 'test_prostitute_work_hours_535pm_check_loc':
+    $TESTNAME = "Location is Pavlovsk NoSuchLocation (location is checked if starts with 'pav_'), 5:35pm, check if work hours check returns true."
+    $FUNCTIONNAME = 'prostitute_work_hours'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        $loc = 'pav_nosuchplace'
+        hour = 17
+        minut = 35
+
+        EXPECTED = _TRUE
+        $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla
+        ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
+        $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'loc'
+end
+
+if $ARGS[0] = 'test_prostitute_work_hours_1am_Pavlovsk':
+    $TESTNAME = 'Region is Pavlovsk, 1:00am, check if work hours check returns false.'
+    $FUNCTIONNAME = 'prostitute_work_hours'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        $region = 'pav'
+        hour = 1
+        minut = 0
+        EXPECTED = _FALSE
+        $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla
+        ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
+        $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'region'
+end
+
+if $ARGS[0] = 'test_prostitute_work_hours_1am_Pushkin':
+    $TESTNAME = 'Region is Pushkin, 1:00am, check if work hours check returns true.'
+    $FUNCTIONNAME = 'prostitute_work_hours'
+
+    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
+        gs 'testframework', 'testsetup'
+        $region = 'pushkin'
+        hour = 1
+        minut = 0
+
+        EXPECTED = _TRUE
+        $EXPECTED_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<EXPECTED>>"
+      
+        gs $LOCATIONNAME, $FUNCTIONNAME
+        *clr & cla
+        ACTUAL = FUNC('prostitution_functions', 'prostitute_work_hours')
+        $ACTUAL_MESSAGE = "FUNC('prostitution_functions', 'prostitute_work_hours') => <<ACTUAL>>"
+        TESTRESULT = EXPECTED = ACTUAL
+    else:
+        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
+    end
+    gs 'testframework', 'addTestResult'
+    gs 'testframework', 'testDefaultCleanup'
+    killvar 'region'
+end
+
+killvar 'LOCATIONNAME'
+killvar '_ISTEST'
+
+--- test_prostitution_functions  ---------------------------------