Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
146
tasks_gen/eval/G0191/faulty/m0_locksmith_pricer.clas.abap
Normal file
146
tasks_gen/eval/G0191/faulty/m0_locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,146 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_job_key TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'K',
|
||||
c_job_lockout TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'L',
|
||||
c_job_rekey TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'R',
|
||||
c_key_std TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'S',
|
||||
c_key_sec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'Y',
|
||||
c_key_elec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'E',
|
||||
c_call_late TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'A',
|
||||
c_call_week TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'W',
|
||||
c_fee_std TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '89.00',
|
||||
c_fee_late TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '149.00',
|
||||
c_fee_week TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '179.00',
|
||||
c_rekey_base TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '35.00',
|
||||
c_rate_dup_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '4.50',
|
||||
c_rate_dup_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '9.80',
|
||||
c_rate_dup_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '24.00',
|
||||
c_rate_rek_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '6.00',
|
||||
c_rate_rek_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '11.00',
|
||||
c_rate_rek_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '26.00',
|
||||
c_qty_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '5.00',
|
||||
c_qty_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_disc_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '10.00',
|
||||
c_disc_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_percent TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '100.00',
|
||||
c_nothing TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '0.00'.
|
||||
|
||||
METHODS duplicate_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS lockout_price
|
||||
IMPORTING iv_callout TYPE {{p}}if_locksmith_pricer=>ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS dup_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
CASE iv_job_type.
|
||||
WHEN c_job_key.
|
||||
rv_price = duplicate_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN c_job_lockout.
|
||||
rv_price = lockout_price( iv_callout = iv_callout ).
|
||||
WHEN c_job_rekey.
|
||||
rv_price = rekey_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN OTHERS.
|
||||
rv_price = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty >= 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = dup_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_gross TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_gross = lv_rate * lv_qty.
|
||||
DATA(lv_discount) = discount_percent( iv_quantity ).
|
||||
rv_price = lv_gross - lv_gross * lv_discount / c_percent.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = rekey_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_price = lv_qty * ( c_rekey_base + lv_rate ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_price.
|
||||
CASE iv_callout.
|
||||
WHEN c_call_week.
|
||||
rv_price = c_fee_week.
|
||||
WHEN c_call_late.
|
||||
rv_price = c_fee_late.
|
||||
WHEN OTHERS.
|
||||
rv_price = c_fee_std.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_dup_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_dup_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_dup_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_rek_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_rek_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_rek_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_quantity >= c_qty_high.
|
||||
rv_percent = c_disc_high.
|
||||
ELSEIF iv_quantity >= c_qty_mid.
|
||||
rv_percent = c_disc_mid.
|
||||
ELSE.
|
||||
rv_percent = c_nothing.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
146
tasks_gen/eval/G0191/faulty/m1_locksmith_pricer.clas.abap
Normal file
146
tasks_gen/eval/G0191/faulty/m1_locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,146 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_job_key TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'K',
|
||||
c_job_lockout TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'L',
|
||||
c_job_rekey TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'R',
|
||||
c_key_std TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'S',
|
||||
c_key_sec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'Y',
|
||||
c_key_elec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'E',
|
||||
c_call_late TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'A',
|
||||
c_call_week TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'W',
|
||||
c_fee_std TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '89.00',
|
||||
c_fee_late TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '149.00',
|
||||
c_fee_week TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '179.00',
|
||||
c_rekey_base TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '35.00',
|
||||
c_rate_dup_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '4.50',
|
||||
c_rate_dup_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '9.80',
|
||||
c_rate_dup_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '24.00',
|
||||
c_rate_rek_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '6.00',
|
||||
c_rate_rek_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '11.00',
|
||||
c_rate_rek_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '26.00',
|
||||
c_qty_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '5.00',
|
||||
c_qty_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_disc_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '10.00',
|
||||
c_disc_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_percent TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '100.00',
|
||||
c_nothing TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '0.00'.
|
||||
|
||||
METHODS duplicate_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS lockout_price
|
||||
IMPORTING iv_callout TYPE {{p}}if_locksmith_pricer=>ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS dup_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
CASE iv_job_type.
|
||||
WHEN c_job_key.
|
||||
rv_price = duplicate_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN c_job_lockout.
|
||||
rv_price = lockout_price( iv_callout = iv_callout ).
|
||||
WHEN c_job_rekey.
|
||||
rv_price = rekey_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN OTHERS.
|
||||
rv_price = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = dup_key_rate( iv_key_type ).
|
||||
IF lv_rate <> 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_gross TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_gross = lv_rate * lv_qty.
|
||||
DATA(lv_discount) = discount_percent( iv_quantity ).
|
||||
rv_price = lv_gross - lv_gross * lv_discount / c_percent.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = rekey_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_price = lv_qty * ( c_rekey_base + lv_rate ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_price.
|
||||
CASE iv_callout.
|
||||
WHEN c_call_week.
|
||||
rv_price = c_fee_week.
|
||||
WHEN c_call_late.
|
||||
rv_price = c_fee_late.
|
||||
WHEN OTHERS.
|
||||
rv_price = c_fee_std.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_dup_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_dup_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_dup_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_rek_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_rek_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_rek_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_quantity >= c_qty_high.
|
||||
rv_percent = c_disc_high.
|
||||
ELSEIF iv_quantity >= c_qty_mid.
|
||||
rv_percent = c_disc_mid.
|
||||
ELSE.
|
||||
rv_percent = c_nothing.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
146
tasks_gen/eval/G0191/faulty/m2_locksmith_pricer.clas.abap
Normal file
146
tasks_gen/eval/G0191/faulty/m2_locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,146 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_job_key TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'K',
|
||||
c_job_lockout TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'L',
|
||||
c_job_rekey TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'R',
|
||||
c_key_std TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'S',
|
||||
c_key_sec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'Y',
|
||||
c_key_elec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'E',
|
||||
c_call_late TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'A',
|
||||
c_call_week TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'W',
|
||||
c_fee_std TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '89.00',
|
||||
c_fee_late TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '149.00',
|
||||
c_fee_week TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '179.00',
|
||||
c_rekey_base TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '35.00',
|
||||
c_rate_dup_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '4.50',
|
||||
c_rate_dup_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '9.80',
|
||||
c_rate_dup_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '24.00',
|
||||
c_rate_rek_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '6.00',
|
||||
c_rate_rek_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '11.00',
|
||||
c_rate_rek_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '26.00',
|
||||
c_qty_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '5.00',
|
||||
c_qty_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_disc_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '10.00',
|
||||
c_disc_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_percent TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '100.00',
|
||||
c_nothing TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '0.00'.
|
||||
|
||||
METHODS duplicate_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS lockout_price
|
||||
IMPORTING iv_callout TYPE {{p}}if_locksmith_pricer=>ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS dup_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
CASE iv_job_type.
|
||||
WHEN c_job_key.
|
||||
rv_price = duplicate_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN c_job_lockout.
|
||||
rv_price = lockout_price( iv_callout = iv_callout ).
|
||||
WHEN c_job_rekey.
|
||||
rv_price = rekey_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN OTHERS.
|
||||
rv_price = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = dup_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_gross TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_gross = lv_rate / lv_qty.
|
||||
DATA(lv_discount) = discount_percent( iv_quantity ).
|
||||
rv_price = lv_gross - lv_gross * lv_discount / c_percent.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = rekey_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_price = lv_qty * ( c_rekey_base + lv_rate ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_price.
|
||||
CASE iv_callout.
|
||||
WHEN c_call_week.
|
||||
rv_price = c_fee_week.
|
||||
WHEN c_call_late.
|
||||
rv_price = c_fee_late.
|
||||
WHEN OTHERS.
|
||||
rv_price = c_fee_std.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_dup_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_dup_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_dup_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_rek_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_rek_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_rek_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_quantity >= c_qty_high.
|
||||
rv_percent = c_disc_high.
|
||||
ELSEIF iv_quantity >= c_qty_mid.
|
||||
rv_percent = c_disc_mid.
|
||||
ELSE.
|
||||
rv_percent = c_nothing.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
146
tasks_gen/eval/G0191/faulty/m3_locksmith_pricer.clas.abap
Normal file
146
tasks_gen/eval/G0191/faulty/m3_locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,146 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_job_key TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'K',
|
||||
c_job_lockout TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'L',
|
||||
c_job_rekey TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'R',
|
||||
c_key_std TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'S',
|
||||
c_key_sec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'Y',
|
||||
c_key_elec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'E',
|
||||
c_call_late TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'A',
|
||||
c_call_week TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'W',
|
||||
c_fee_std TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '89.00',
|
||||
c_fee_late TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '149.00',
|
||||
c_fee_week TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '179.00',
|
||||
c_rekey_base TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '35.00',
|
||||
c_rate_dup_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '4.50',
|
||||
c_rate_dup_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '9.80',
|
||||
c_rate_dup_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '24.00',
|
||||
c_rate_rek_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '6.00',
|
||||
c_rate_rek_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '11.00',
|
||||
c_rate_rek_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '26.00',
|
||||
c_qty_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '5.00',
|
||||
c_qty_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_disc_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '10.00',
|
||||
c_disc_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_percent TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '100.00',
|
||||
c_nothing TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '0.00'.
|
||||
|
||||
METHODS duplicate_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS lockout_price
|
||||
IMPORTING iv_callout TYPE {{p}}if_locksmith_pricer=>ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS dup_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
CASE iv_job_type.
|
||||
WHEN c_job_key.
|
||||
rv_price = duplicate_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN c_job_lockout.
|
||||
rv_price = lockout_price( iv_callout = iv_callout ).
|
||||
WHEN c_job_rekey.
|
||||
rv_price = rekey_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN OTHERS.
|
||||
rv_price = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = dup_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_gross TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_gross = lv_rate * lv_qty.
|
||||
DATA(lv_discount) = discount_percent( iv_quantity ).
|
||||
rv_price = lv_gross - lv_gross * lv_discount / c_percent.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = rekey_key_rate( iv_key_type ).
|
||||
IF lv_rate <> 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_price = lv_qty * ( c_rekey_base + lv_rate ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_price.
|
||||
CASE iv_callout.
|
||||
WHEN c_call_week.
|
||||
rv_price = c_fee_week.
|
||||
WHEN c_call_late.
|
||||
rv_price = c_fee_late.
|
||||
WHEN OTHERS.
|
||||
rv_price = c_fee_std.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_dup_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_dup_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_dup_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_rek_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_rek_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_rek_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_quantity >= c_qty_high.
|
||||
rv_percent = c_disc_high.
|
||||
ELSEIF iv_quantity >= c_qty_mid.
|
||||
rv_percent = c_disc_mid.
|
||||
ELSE.
|
||||
rv_percent = c_nothing.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
146
tasks_gen/eval/G0191/faulty/m4_locksmith_pricer.clas.abap
Normal file
146
tasks_gen/eval/G0191/faulty/m4_locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,146 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_job_key TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'K',
|
||||
c_job_lockout TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'L',
|
||||
c_job_rekey TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'R',
|
||||
c_key_std TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'S',
|
||||
c_key_sec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'Y',
|
||||
c_key_elec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'E',
|
||||
c_call_late TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'A',
|
||||
c_call_week TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'W',
|
||||
c_fee_std TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '89.00',
|
||||
c_fee_late TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '149.00',
|
||||
c_fee_week TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '179.00',
|
||||
c_rekey_base TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '35.00',
|
||||
c_rate_dup_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '4.50',
|
||||
c_rate_dup_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '9.80',
|
||||
c_rate_dup_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '24.00',
|
||||
c_rate_rek_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '6.00',
|
||||
c_rate_rek_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '11.00',
|
||||
c_rate_rek_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '26.00',
|
||||
c_qty_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '5.00',
|
||||
c_qty_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_disc_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '10.00',
|
||||
c_disc_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_percent TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '100.00',
|
||||
c_nothing TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '0.00'.
|
||||
|
||||
METHODS duplicate_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS lockout_price
|
||||
IMPORTING iv_callout TYPE {{p}}if_locksmith_pricer=>ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS dup_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
CASE iv_job_type.
|
||||
WHEN c_job_key.
|
||||
rv_price = duplicate_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN c_job_lockout.
|
||||
rv_price = lockout_price( iv_callout = iv_callout ).
|
||||
WHEN c_job_rekey.
|
||||
rv_price = rekey_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN OTHERS.
|
||||
rv_price = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = dup_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_gross TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_gross = lv_rate * lv_qty.
|
||||
DATA(lv_discount) = discount_percent( iv_quantity ).
|
||||
rv_price = lv_gross - lv_gross * lv_discount / c_percent.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = rekey_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_price = lv_qty * ( c_rekey_base - lv_rate ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_price.
|
||||
CASE iv_callout.
|
||||
WHEN c_call_week.
|
||||
rv_price = c_fee_week.
|
||||
WHEN c_call_late.
|
||||
rv_price = c_fee_late.
|
||||
WHEN OTHERS.
|
||||
rv_price = c_fee_std.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_dup_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_dup_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_dup_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_rek_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_rek_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_rek_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_quantity >= c_qty_high.
|
||||
rv_percent = c_disc_high.
|
||||
ELSEIF iv_quantity >= c_qty_mid.
|
||||
rv_percent = c_disc_mid.
|
||||
ELSE.
|
||||
rv_percent = c_nothing.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
24
tasks_gen/eval/G0191/generation.json
Normal file
24
tasks_gen/eval/G0191/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G0191",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 85.7,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
151
tasks_gen/eval/G0191/hidden/t_locksmith_hidden.clas.abap
Normal file
151
tasks_gen/eval/G0191/hidden/t_locksmith_hidden.clas.abap
Normal file
@@ -0,0 +1,151 @@
|
||||
CLASS {{p}}t_locksmith_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_locksmith_pricer.
|
||||
METHODS setup.
|
||||
METHODS dup_standard_basic FOR TESTING.
|
||||
METHODS dup_discount_from_five FOR TESTING.
|
||||
METHODS dup_discount_from_twenty FOR TESTING.
|
||||
METHODS dup_no_discount_for_four FOR TESTING.
|
||||
METHODS dup_zero_quantity FOR TESTING.
|
||||
METHODS unknown_key_type FOR TESTING.
|
||||
METHODS lockout_standard FOR TESTING.
|
||||
METHODS lockout_after_hours FOR TESTING.
|
||||
METHODS lockout_weekend FOR TESTING.
|
||||
METHODS rekey_standard FOR TESTING.
|
||||
METHODS rekey_electronic FOR TESTING.
|
||||
METHODS unknown_job_type FOR TESTING.
|
||||
METHODS assert_price
|
||||
IMPORTING iv_expected TYPE {{p}}if_locksmith_pricer=>ty_amount
|
||||
iv_actual TYPE {{p}}if_locksmith_pricer=>ty_amount
|
||||
iv_msg TYPE string DEFAULT ''.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_locksmith_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}locksmith_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_standard_basic.
|
||||
assert_price(
|
||||
iv_expected = '13.50'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 3
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_discount_from_five.
|
||||
assert_price(
|
||||
iv_expected = '20.25'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 5
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_discount_from_twenty.
|
||||
assert_price(
|
||||
iv_expected = '156.80'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 20
|
||||
iv_key_type = 'Y'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_no_discount_for_four.
|
||||
assert_price(
|
||||
iv_expected = '96.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 4
|
||||
iv_key_type = 'E'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_zero_quantity.
|
||||
assert_price(
|
||||
iv_expected = '0.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 0
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_key_type.
|
||||
assert_price(
|
||||
iv_expected = '0.00'
|
||||
iv_msg = 'duplicate'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 3
|
||||
iv_key_type = 'X'
|
||||
iv_callout = 'N' ) ).
|
||||
assert_price(
|
||||
iv_expected = '0.00'
|
||||
iv_msg = 'rekey'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'R'
|
||||
iv_quantity = 2
|
||||
iv_key_type = 'X'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_standard.
|
||||
assert_price(
|
||||
iv_expected = '89.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'L'
|
||||
iv_quantity = 5
|
||||
iv_key_type = 'X'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_after_hours.
|
||||
assert_price(
|
||||
iv_expected = '149.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'L'
|
||||
iv_quantity = 0
|
||||
iv_key_type = 'X'
|
||||
iv_callout = 'A' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_weekend.
|
||||
assert_price(
|
||||
iv_expected = '179.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'L'
|
||||
iv_quantity = 0
|
||||
iv_key_type = 'X'
|
||||
iv_callout = 'W' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_standard.
|
||||
assert_price(
|
||||
iv_expected = '82.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'R'
|
||||
iv_quantity = 2
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_electronic.
|
||||
assert_price(
|
||||
iv_expected = '61.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'R'
|
||||
iv_quantity = 1
|
||||
iv_key_type = 'E'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_job_type.
|
||||
assert_price(
|
||||
iv_expected = '0.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'X'
|
||||
iv_quantity = 1
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_price.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected
|
||||
act = iv_actual
|
||||
msg = iv_msg ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
66
tasks_gen/eval/G0191/mutation.json
Normal file
66
tasks_gen/eval/G0191/mutation.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"task": "G0191",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}LOCKSMITH_PRICER",
|
||||
"mutant": "line 74: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "8/12",
|
||||
"failed_tests": [
|
||||
"DUP_DISCOUNT_FROM_FIVE",
|
||||
"DUP_DISCOUNT_FROM_TWENTY",
|
||||
"DUP_NO_DISCOUNT_FOR_FOUR",
|
||||
"DUP_STANDARD_BASIC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}LOCKSMITH_PRICER",
|
||||
"mutant": "line 78: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "8/12",
|
||||
"failed_tests": [
|
||||
"DUP_DISCOUNT_FROM_FIVE",
|
||||
"DUP_DISCOUNT_FROM_TWENTY",
|
||||
"DUP_NO_DISCOUNT_FOR_FOUR",
|
||||
"DUP_STANDARD_BASIC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}LOCKSMITH_PRICER",
|
||||
"mutant": "line 82: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "8/12",
|
||||
"failed_tests": [
|
||||
"DUP_DISCOUNT_FROM_FIVE",
|
||||
"DUP_DISCOUNT_FROM_TWENTY",
|
||||
"DUP_NO_DISCOUNT_FOR_FOUR",
|
||||
"DUP_STANDARD_BASIC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}LOCKSMITH_PRICER",
|
||||
"mutant": "line 94: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "9/12",
|
||||
"failed_tests": [
|
||||
"REKEY_ELECTRONIC",
|
||||
"REKEY_STANDARD",
|
||||
"UNKNOWN_KEY_TYPE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}LOCKSMITH_PRICER",
|
||||
"mutant": "line 97: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "10/12",
|
||||
"failed_tests": [
|
||||
"REKEY_ELECTRONIC",
|
||||
"REKEY_STANDARD"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
146
tasks_gen/eval/G0191/reference/locksmith_pricer.clas.abap
Normal file
146
tasks_gen/eval/G0191/reference/locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,146 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_job_key TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'K',
|
||||
c_job_lockout TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'L',
|
||||
c_job_rekey TYPE {{p}}if_locksmith_pricer=>ty_job_type VALUE 'R',
|
||||
c_key_std TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'S',
|
||||
c_key_sec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'Y',
|
||||
c_key_elec TYPE {{p}}if_locksmith_pricer=>ty_key_type VALUE 'E',
|
||||
c_call_late TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'A',
|
||||
c_call_week TYPE {{p}}if_locksmith_pricer=>ty_callout VALUE 'W',
|
||||
c_fee_std TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '89.00',
|
||||
c_fee_late TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '149.00',
|
||||
c_fee_week TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '179.00',
|
||||
c_rekey_base TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '35.00',
|
||||
c_rate_dup_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '4.50',
|
||||
c_rate_dup_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '9.80',
|
||||
c_rate_dup_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '24.00',
|
||||
c_rate_rek_s TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '6.00',
|
||||
c_rate_rek_y TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '11.00',
|
||||
c_rate_rek_e TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '26.00',
|
||||
c_qty_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '5.00',
|
||||
c_qty_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_disc_mid TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '10.00',
|
||||
c_disc_high TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '20.00',
|
||||
c_percent TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '100.00',
|
||||
c_nothing TYPE {{p}}if_locksmith_pricer=>ty_amount VALUE '0.00'.
|
||||
|
||||
METHODS duplicate_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_price
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS lockout_price
|
||||
IMPORTING iv_callout TYPE {{p}}if_locksmith_pricer=>ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS dup_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS rekey_key_rate
|
||||
IMPORTING iv_key_type TYPE {{p}}if_locksmith_pricer=>ty_key_type
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
CASE iv_job_type.
|
||||
WHEN c_job_key.
|
||||
rv_price = duplicate_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN c_job_lockout.
|
||||
rv_price = lockout_price( iv_callout = iv_callout ).
|
||||
WHEN c_job_rekey.
|
||||
rv_price = rekey_price( iv_quantity = iv_quantity
|
||||
iv_key_type = iv_key_type ).
|
||||
WHEN OTHERS.
|
||||
rv_price = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = dup_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_gross TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_gross = lv_rate * lv_qty.
|
||||
DATA(lv_discount) = discount_percent( iv_quantity ).
|
||||
rv_price = lv_gross - lv_gross * lv_discount / c_percent.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_price.
|
||||
DATA lv_qty TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
lv_qty = iv_quantity.
|
||||
IF lv_qty < 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_rate) = rekey_key_rate( iv_key_type ).
|
||||
IF lv_rate = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_price = lv_qty * ( c_rekey_base + lv_rate ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_price.
|
||||
CASE iv_callout.
|
||||
WHEN c_call_week.
|
||||
rv_price = c_fee_week.
|
||||
WHEN c_call_late.
|
||||
rv_price = c_fee_late.
|
||||
WHEN OTHERS.
|
||||
rv_price = c_fee_std.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_dup_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_dup_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_dup_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_key_rate.
|
||||
CASE iv_key_type.
|
||||
WHEN c_key_std.
|
||||
rv_rate = c_rate_rek_s.
|
||||
WHEN c_key_sec.
|
||||
rv_rate = c_rate_rek_y.
|
||||
WHEN c_key_elec.
|
||||
rv_rate = c_rate_rek_e.
|
||||
WHEN OTHERS.
|
||||
rv_rate = c_nothing.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_quantity >= c_qty_high.
|
||||
rv_percent = c_disc_high.
|
||||
ELSEIF iv_quantity >= c_qty_mid.
|
||||
rv_percent = c_disc_mid.
|
||||
ELSE.
|
||||
rv_percent = c_nothing.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,74 @@
|
||||
CLASS ltc_locksmith_pricer DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_locksmith_pricer.
|
||||
METHODS setup.
|
||||
METHODS dup_standard FOR TESTING.
|
||||
METHODS dup_discount FOR TESTING.
|
||||
METHODS dup_high_discount FOR TESTING.
|
||||
METHODS lockout_late FOR TESTING.
|
||||
METHODS rekey_standard FOR TESTING.
|
||||
METHODS unknown_job FOR TESTING.
|
||||
METHODS assert_price
|
||||
IMPORTING iv_expected TYPE {{p}}if_locksmith_pricer=>ty_amount
|
||||
iv_actual TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_locksmith_pricer IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}locksmith_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_standard.
|
||||
assert_price( iv_expected = '13.50'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 3
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_discount.
|
||||
assert_price( iv_expected = '20.25'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 5
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dup_high_discount.
|
||||
assert_price( iv_expected = '156.80'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
||||
iv_quantity = 20
|
||||
iv_key_type = 'Y'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lockout_late.
|
||||
assert_price( iv_expected = '149.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'L'
|
||||
iv_quantity = 0
|
||||
iv_key_type = 'X'
|
||||
iv_callout = 'A' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rekey_standard.
|
||||
assert_price( iv_expected = '82.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'R'
|
||||
iv_quantity = 2
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_job.
|
||||
assert_price( iv_expected = '0.00'
|
||||
iv_actual = mo_cut->calculate_price( iv_job_type = 'X'
|
||||
iv_quantity = 1
|
||||
iv_key_type = 'S'
|
||||
iv_callout = 'N' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_price.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected
|
||||
act = iv_actual ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
12
tasks_gen/eval/G0191/seed/if_locksmith_pricer.intf.abap
Normal file
12
tasks_gen/eval/G0191/seed/if_locksmith_pricer.intf.abap
Normal file
@@ -0,0 +1,12 @@
|
||||
INTERFACE {{p}}if_locksmith_pricer PUBLIC.
|
||||
TYPES ty_job_type TYPE c LENGTH 1.
|
||||
TYPES ty_key_type TYPE c LENGTH 1.
|
||||
TYPES ty_callout TYPE c LENGTH 1.
|
||||
TYPES ty_amount TYPE p LENGTH 9 DECIMALS 2.
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_job_type TYPE ty_job_type
|
||||
iv_quantity TYPE i
|
||||
iv_key_type TYPE ty_key_type
|
||||
iv_callout TYPE ty_callout
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
77
tasks_gen/eval/G0191/seed/locksmith_pricer.clas.abap
Normal file
77
tasks_gen/eval/G0191/seed/locksmith_pricer.clas.abap
Normal file
@@ -0,0 +1,77 @@
|
||||
CLASS {{p}}locksmith_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_locksmith_pricer.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}locksmith_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_locksmith_pricer~calculate_price.
|
||||
DATA lv_qty TYPE p LENGTH 9 DECIMALS 2.
|
||||
DATA lv_rate TYPE p LENGTH 9 DECIMALS 2.
|
||||
DATA lv_base TYPE p LENGTH 9 DECIMALS 2.
|
||||
DATA lv_disc TYPE p LENGTH 9 DECIMALS 2.
|
||||
DATA lv_hundred TYPE p LENGTH 9 DECIMALS 2.
|
||||
|
||||
lv_qty = iv_quantity.
|
||||
lv_hundred = '100.00'.
|
||||
|
||||
IF iv_job_type = 'K'.
|
||||
IF lv_qty < 1.
|
||||
rv_price = '0.00'.
|
||||
ELSE.
|
||||
IF iv_key_type = 'S'.
|
||||
lv_rate = '4.50'.
|
||||
ELSEIF iv_key_type = 'Y'.
|
||||
lv_rate = '9.80'.
|
||||
ELSEIF iv_key_type = 'E'.
|
||||
lv_rate = '24.00'.
|
||||
ELSE.
|
||||
lv_rate = '0.00'.
|
||||
ENDIF.
|
||||
IF lv_rate = 0.
|
||||
rv_price = '0.00'.
|
||||
ELSE.
|
||||
lv_base = lv_rate * lv_qty.
|
||||
IF lv_qty >= 20.
|
||||
lv_disc = '20.00'.
|
||||
ELSEIF lv_qty >= 5.
|
||||
lv_disc = '10.00'.
|
||||
ELSE.
|
||||
lv_disc = '0.00'.
|
||||
ENDIF.
|
||||
rv_price = lv_base - lv_base * lv_disc / lv_hundred.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ELSEIF iv_job_type = 'L'.
|
||||
IF iv_callout = 'W'.
|
||||
rv_price = '179.00'.
|
||||
ELSEIF iv_callout = 'A'.
|
||||
rv_price = '149.00'.
|
||||
ELSE.
|
||||
rv_price = '89.00'.
|
||||
ENDIF.
|
||||
ELSEIF iv_job_type = 'R'.
|
||||
IF lv_qty < 1.
|
||||
rv_price = '0.00'.
|
||||
ELSE.
|
||||
IF iv_key_type = 'S'.
|
||||
lv_rate = '6.00'.
|
||||
ELSEIF iv_key_type = 'Y'.
|
||||
lv_rate = '11.00'.
|
||||
ELSEIF iv_key_type = 'E'.
|
||||
lv_rate = '26.00'.
|
||||
ELSE.
|
||||
lv_rate = '0.00'.
|
||||
ENDIF.
|
||||
IF lv_rate = 0.
|
||||
rv_price = '0.00'.
|
||||
ELSE.
|
||||
lv_base = '35.00'.
|
||||
rv_price = lv_qty * ( lv_base + lv_rate ).
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
rv_price = '0.00'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
55
tasks_gen/eval/G0191/spec.md
Normal file
55
tasks_gen/eval/G0191/spec.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# 1. Goal
|
||||
Refactor the class {{P}}LOCKSMITH_PRICER in package $TMP. A locksmith shop uses
|
||||
the class to price its jobs. The class works, but the code is hard to read and
|
||||
hard to maintain. Make the code clean. The behavior stays the same.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_LOCKSMITH_PRICER exists in package $TMP. It is active.
|
||||
- The interface has the types TY_JOB_TYPE (CHAR 1), TY_KEY_TYPE (CHAR 1),
|
||||
TY_CALLOUT (CHAR 1) and TY_AMOUNT (packed number, length 9, 2 decimals).
|
||||
- The interface has one method CALCULATE_PRICE. The importing parameters are
|
||||
IV_JOB_TYPE, IV_QUANTITY, IV_KEY_TYPE and IV_CALLOUT. The returning parameter
|
||||
is RV_PRICE.
|
||||
- The class {{P}}LOCKSMITH_PRICER exists in package $TMP. It is active, public
|
||||
and final. It implements {{P}}IF_LOCKSMITH_PRICER.
|
||||
- The class has no other public members.
|
||||
- A job is a key duplication (job type K), a lockout (job type L) or a rekey of
|
||||
a cylinder (job type R).
|
||||
|
||||
# 4. Contract
|
||||
- Keep the class {{P}}LOCKSMITH_PRICER in package $TMP.
|
||||
- The class stays public and final.
|
||||
- The class stays an implementation of {{P}}IF_LOCKSMITH_PRICER.
|
||||
- Do not change the interface {{P}}IF_LOCKSMITH_PRICER.
|
||||
- Do not add other public methods, types, constants or attributes to the class.
|
||||
- The result of the method CALCULATE_PRICE stays the same for every input.
|
||||
|
||||
# 5. Business rules
|
||||
- The current implementation of the class is the specification of the pricing
|
||||
rules. Read the code.
|
||||
- The refactored class must return exactly the same price as the current class
|
||||
for every possible combination of the input parameters.
|
||||
- Do not change, add or remove a pricing rule.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP.
|
||||
- Every method has fewer than 40 statements.
|
||||
- The nesting depth of a method is at most three.
|
||||
- Replace magic numbers with constants that have a meaning.
|
||||
- One method does one task. Give each method a name that says what it does.
|
||||
- No global variables.
|
||||
- No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_LOCKSMITH_PRICER. Do not rename the class
|
||||
or the method. Do not change the parameter names, the parameter types or the
|
||||
parameter order.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class {{P}}LOCKSMITH_PRICER is active and has no syntax error.
|
||||
- The class still implements {{P}}IF_LOCKSMITH_PRICER.
|
||||
- The hidden tests pass.
|
||||
- The class returns the same prices as before.
|
||||
- Write your own ABAP Unit tests in the local test classes of the class.
|
||||
58
tasks_gen/eval/G0191/task.json
Normal file
58
tasks_gen/eval/G0191/task.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"id": "G0191",
|
||||
"category": "E",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 40,
|
||||
"max_activations": 10
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_LOCKSMITH_PRICER",
|
||||
"file": "seed/if_locksmith_pricer.intf.abap",
|
||||
"description": "Interface of the locksmith price calculator"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}LOCKSMITH_PRICER",
|
||||
"file": "seed/locksmith_pricer.clas.abap",
|
||||
"description": "Legacy locksmith price calculator, refactor target"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}LOCKSMITH_PRICER",
|
||||
"implements": "{{P}}IF_LOCKSMITH_PRICER"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_LOCKSMITH_PRICER"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_LOCKSMITH_HIDDEN",
|
||||
"file": "hidden/t_locksmith_hidden.clas.abap",
|
||||
"description": "Behaviour tests for the locksmith price calculator"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}LOCKSMITH_PRICER",
|
||||
"file": "reference/locksmith_pricer.clas.abap",
|
||||
"description": "Refactored locksmith price calculator",
|
||||
"testclasses_file": "reference/locksmith_pricer.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"nesting_depth",
|
||||
"magic_numbers"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user