# 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_set_pavlovsk_prostitute_blocked_3
!! @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
!! @run test_is_solicitation_location_pav_commercial
!! @run test_is_solicitation_location_city_center

!! ------------------------------------------------------------------------------------
!! @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_3':
    $TESTNAME = 'Prostitute fame > 250, Slut fame > 250, Pavlovsk prostitution is active 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>>"

        ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
        $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<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('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"

        ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
        $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<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('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<EXPECTED>>"

        ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
        $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<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('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<EXPECTED>>"

        ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME)
        $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', <<$FUNCTIONNAME>>') => <<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_is_solicitation_location_pav_commercial':
    $TESTNAME = "Location is Pavlovsk Commercial, check if solicitation location check returns true."
    $FUNCTIONNAME = 'is_solicitation_location'

    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
        gs 'testframework', 'testsetup'
        $loc = 'pav_commercial'
        menu_off = 0
        $loc_arg = ''

        EXPECTED = _TRUE
        $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"

        ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME, -1)
        $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
        TESTRESULT = EXPECTED = ACTUAL
    else:
        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
    end
    gs 'testframework', 'addTestResult'
    gs 'testframework', 'testDefaultCleanup'
    killvar 'loc'
    killvar 'menu_off'
    killvar 'loc_arg'
end

if $ARGS[0] = 'test_is_solicitation_location_city_center':
    $TESTNAME = "Location is City Center, check if solicitation location check returns false."
    $FUNCTIONNAME = 'is_solicitation_location'

    if _ISVALIDCALL['<<$LOCATIONNAME>>,<<$FUNCTIONNAME>>'] ! 0:
        gs 'testframework', 'testsetup'
        $loc = 'city_center'
        menu_off = 0
        $loc_arg = ''

        EXPECTED = _FALSE
        $EXPECTED_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<EXPECTED>>"
      
        ACTUAL = FUNC($LOCATIONNAME, $FUNCTIONNAME, -1)
        $ACTUAL_MESSAGE = "FUNC('<<$LOCATIONNAME>>', '<<$FUNCTIONNAME>>') => <<ACTUAL>>"
        TESTRESULT = EXPECTED = ACTUAL
    else:
        $ACTUAL_MESSAGE = '<<$LOCATIONNAME>> <<$FUNCTIONNAME>> does not exist.'
    end
    gs 'testframework', 'addTestResult'
    gs 'testframework', 'testDefaultCleanup'
    killvar 'loc'
    killvar 'menu_off'
    killvar 'loc_arg'
end


killvar 'LOCATIONNAME'
killvar '_ISTEST'

--- test_prostitution_functions  ---------------------------------