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:
125
tasks_gen/eval/G0138/faulty/m0_cake_pricer.clas.abap
Normal file
125
tasks_gen/eval/G0138/faulty/m0_cake_pricer.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_price TYPE ty_price VALUE '12.00',
|
||||
c_min_price TYPE ty_price VALUE '15.00',
|
||||
c_min_size TYPE i VALUE 16,
|
||||
c_free_size TYPE i VALUE 20,
|
||||
c_photo_size TYPE i VALUE 24,
|
||||
c_size_rate TYPE ty_price VALUE '0.80',
|
||||
c_layer_rate TYPE ty_price VALUE '4.50',
|
||||
c_express_rate TYPE ty_price VALUE '1.25',
|
||||
c_filling_plain TYPE ty_price VALUE '3.00',
|
||||
c_filling_choc TYPE ty_price VALUE '4.00',
|
||||
c_filling_fruit TYPE ty_price VALUE '5.50',
|
||||
c_deco_flowers TYPE ty_price VALUE '6.00',
|
||||
c_deco_photo TYPE ty_price VALUE '9.50',
|
||||
c_deco_sugar TYPE ty_price VALUE '12.00'.
|
||||
|
||||
METHODS clamp_size
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_size) TYPE i.
|
||||
METHODS clamp_layers
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_layers) TYPE i.
|
||||
METHODS size_surcharge
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS layer_surcharge
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS filling_surcharge
|
||||
IMPORTING iv_filling TYPE ty_filling
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS decoration_surcharge
|
||||
IMPORTING iv_decoration TYPE ty_decoration
|
||||
iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS apply_express
|
||||
IMPORTING iv_amount TYPE ty_price
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
DATA(lv_size) = clamp_size( iv_size ).
|
||||
DATA(lv_price) = c_base_price.
|
||||
lv_price = lv_price + size_surcharge( lv_size ).
|
||||
lv_price = lv_price - layer_surcharge( clamp_layers( iv_layers ) ).
|
||||
lv_price = lv_price + filling_surcharge( iv_filling ).
|
||||
lv_price = lv_price + decoration_surcharge( iv_decoration = iv_decoration
|
||||
iv_size = lv_size ).
|
||||
IF iv_express = abap_true.
|
||||
lv_price = apply_express( lv_price ).
|
||||
ENDIF.
|
||||
IF lv_price < c_min_price.
|
||||
rv_price = c_min_price.
|
||||
ELSE.
|
||||
rv_price = lv_price.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_size.
|
||||
rv_size = nmax( val1 = iv_size val2 = c_min_size ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_layers.
|
||||
rv_layers = nmax( val1 = iv_layers val2 = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_surcharge.
|
||||
IF iv_size > c_free_size.
|
||||
rv_amount = ( iv_size - c_free_size ) * c_size_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_surcharge.
|
||||
IF iv_layers > 1.
|
||||
rv_amount = ( iv_layers - 1 ) * c_layer_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_surcharge.
|
||||
CASE iv_filling.
|
||||
WHEN 'C'.
|
||||
rv_amount = c_filling_choc.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_filling_fruit.
|
||||
WHEN 'N'.
|
||||
CLEAR rv_amount.
|
||||
WHEN OTHERS.
|
||||
rv_amount = c_filling_plain.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_surcharge.
|
||||
CASE iv_decoration.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_deco_flowers.
|
||||
WHEN 'P'.
|
||||
IF iv_size >= c_photo_size.
|
||||
rv_amount = c_deco_photo.
|
||||
ENDIF.
|
||||
WHEN 'S'.
|
||||
rv_amount = c_deco_sugar.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_express.
|
||||
rv_amount = round( val = iv_amount * c_express_rate dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
125
tasks_gen/eval/G0138/faulty/m1_cake_pricer.clas.abap
Normal file
125
tasks_gen/eval/G0138/faulty/m1_cake_pricer.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_price TYPE ty_price VALUE '12.00',
|
||||
c_min_price TYPE ty_price VALUE '15.00',
|
||||
c_min_size TYPE i VALUE 16,
|
||||
c_free_size TYPE i VALUE 20,
|
||||
c_photo_size TYPE i VALUE 24,
|
||||
c_size_rate TYPE ty_price VALUE '0.80',
|
||||
c_layer_rate TYPE ty_price VALUE '4.50',
|
||||
c_express_rate TYPE ty_price VALUE '1.25',
|
||||
c_filling_plain TYPE ty_price VALUE '3.00',
|
||||
c_filling_choc TYPE ty_price VALUE '4.00',
|
||||
c_filling_fruit TYPE ty_price VALUE '5.50',
|
||||
c_deco_flowers TYPE ty_price VALUE '6.00',
|
||||
c_deco_photo TYPE ty_price VALUE '9.50',
|
||||
c_deco_sugar TYPE ty_price VALUE '12.00'.
|
||||
|
||||
METHODS clamp_size
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_size) TYPE i.
|
||||
METHODS clamp_layers
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_layers) TYPE i.
|
||||
METHODS size_surcharge
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS layer_surcharge
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS filling_surcharge
|
||||
IMPORTING iv_filling TYPE ty_filling
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS decoration_surcharge
|
||||
IMPORTING iv_decoration TYPE ty_decoration
|
||||
iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS apply_express
|
||||
IMPORTING iv_amount TYPE ty_price
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
DATA(lv_size) = clamp_size( iv_size ).
|
||||
DATA(lv_price) = c_base_price.
|
||||
lv_price = lv_price + size_surcharge( lv_size ).
|
||||
lv_price = lv_price + layer_surcharge( clamp_layers( iv_layers ) ).
|
||||
lv_price = lv_price + filling_surcharge( iv_filling ).
|
||||
lv_price = lv_price + decoration_surcharge( iv_decoration = iv_decoration
|
||||
iv_size = lv_size ).
|
||||
IF iv_express <> abap_true.
|
||||
lv_price = apply_express( lv_price ).
|
||||
ENDIF.
|
||||
IF lv_price < c_min_price.
|
||||
rv_price = c_min_price.
|
||||
ELSE.
|
||||
rv_price = lv_price.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_size.
|
||||
rv_size = nmax( val1 = iv_size val2 = c_min_size ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_layers.
|
||||
rv_layers = nmax( val1 = iv_layers val2 = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_surcharge.
|
||||
IF iv_size > c_free_size.
|
||||
rv_amount = ( iv_size - c_free_size ) * c_size_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_surcharge.
|
||||
IF iv_layers > 1.
|
||||
rv_amount = ( iv_layers - 1 ) * c_layer_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_surcharge.
|
||||
CASE iv_filling.
|
||||
WHEN 'C'.
|
||||
rv_amount = c_filling_choc.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_filling_fruit.
|
||||
WHEN 'N'.
|
||||
CLEAR rv_amount.
|
||||
WHEN OTHERS.
|
||||
rv_amount = c_filling_plain.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_surcharge.
|
||||
CASE iv_decoration.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_deco_flowers.
|
||||
WHEN 'P'.
|
||||
IF iv_size >= c_photo_size.
|
||||
rv_amount = c_deco_photo.
|
||||
ENDIF.
|
||||
WHEN 'S'.
|
||||
rv_amount = c_deco_sugar.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_express.
|
||||
rv_amount = round( val = iv_amount * c_express_rate dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
125
tasks_gen/eval/G0138/faulty/m2_cake_pricer.clas.abap
Normal file
125
tasks_gen/eval/G0138/faulty/m2_cake_pricer.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_price TYPE ty_price VALUE '12.00',
|
||||
c_min_price TYPE ty_price VALUE '15.00',
|
||||
c_min_size TYPE i VALUE 16,
|
||||
c_free_size TYPE i VALUE 20,
|
||||
c_photo_size TYPE i VALUE 24,
|
||||
c_size_rate TYPE ty_price VALUE '0.80',
|
||||
c_layer_rate TYPE ty_price VALUE '4.50',
|
||||
c_express_rate TYPE ty_price VALUE '1.25',
|
||||
c_filling_plain TYPE ty_price VALUE '3.00',
|
||||
c_filling_choc TYPE ty_price VALUE '4.00',
|
||||
c_filling_fruit TYPE ty_price VALUE '5.50',
|
||||
c_deco_flowers TYPE ty_price VALUE '6.00',
|
||||
c_deco_photo TYPE ty_price VALUE '9.50',
|
||||
c_deco_sugar TYPE ty_price VALUE '12.00'.
|
||||
|
||||
METHODS clamp_size
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_size) TYPE i.
|
||||
METHODS clamp_layers
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_layers) TYPE i.
|
||||
METHODS size_surcharge
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS layer_surcharge
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS filling_surcharge
|
||||
IMPORTING iv_filling TYPE ty_filling
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS decoration_surcharge
|
||||
IMPORTING iv_decoration TYPE ty_decoration
|
||||
iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS apply_express
|
||||
IMPORTING iv_amount TYPE ty_price
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
DATA(lv_size) = clamp_size( iv_size ).
|
||||
DATA(lv_price) = c_base_price.
|
||||
lv_price = lv_price + size_surcharge( lv_size ).
|
||||
lv_price = lv_price + layer_surcharge( clamp_layers( iv_layers ) ).
|
||||
lv_price = lv_price + filling_surcharge( iv_filling ).
|
||||
lv_price = lv_price + decoration_surcharge( iv_decoration = iv_decoration
|
||||
iv_size = lv_size ).
|
||||
IF iv_express = abap_true.
|
||||
lv_price = apply_express( lv_price ).
|
||||
ENDIF.
|
||||
IF lv_price < c_min_price.
|
||||
rv_price = c_min_price.
|
||||
ELSE.
|
||||
rv_price = lv_price.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_size.
|
||||
rv_size = nmax( val1 = iv_size val2 = c_min_size ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_layers.
|
||||
rv_layers = nmax( val1 = iv_layers val2 = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_surcharge.
|
||||
IF iv_size > c_free_size.
|
||||
rv_amount = ( iv_size - c_free_size ) * c_size_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_surcharge.
|
||||
IF iv_layers <= 1.
|
||||
rv_amount = ( iv_layers - 1 ) * c_layer_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_surcharge.
|
||||
CASE iv_filling.
|
||||
WHEN 'C'.
|
||||
rv_amount = c_filling_choc.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_filling_fruit.
|
||||
WHEN 'N'.
|
||||
CLEAR rv_amount.
|
||||
WHEN OTHERS.
|
||||
rv_amount = c_filling_plain.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_surcharge.
|
||||
CASE iv_decoration.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_deco_flowers.
|
||||
WHEN 'P'.
|
||||
IF iv_size >= c_photo_size.
|
||||
rv_amount = c_deco_photo.
|
||||
ENDIF.
|
||||
WHEN 'S'.
|
||||
rv_amount = c_deco_sugar.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_express.
|
||||
rv_amount = round( val = iv_amount * c_express_rate dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
125
tasks_gen/eval/G0138/faulty/m3_cake_pricer.clas.abap
Normal file
125
tasks_gen/eval/G0138/faulty/m3_cake_pricer.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_price TYPE ty_price VALUE '12.00',
|
||||
c_min_price TYPE ty_price VALUE '15.00',
|
||||
c_min_size TYPE i VALUE 16,
|
||||
c_free_size TYPE i VALUE 20,
|
||||
c_photo_size TYPE i VALUE 24,
|
||||
c_size_rate TYPE ty_price VALUE '0.80',
|
||||
c_layer_rate TYPE ty_price VALUE '4.50',
|
||||
c_express_rate TYPE ty_price VALUE '1.25',
|
||||
c_filling_plain TYPE ty_price VALUE '3.00',
|
||||
c_filling_choc TYPE ty_price VALUE '4.00',
|
||||
c_filling_fruit TYPE ty_price VALUE '5.50',
|
||||
c_deco_flowers TYPE ty_price VALUE '6.00',
|
||||
c_deco_photo TYPE ty_price VALUE '9.50',
|
||||
c_deco_sugar TYPE ty_price VALUE '12.00'.
|
||||
|
||||
METHODS clamp_size
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_size) TYPE i.
|
||||
METHODS clamp_layers
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_layers) TYPE i.
|
||||
METHODS size_surcharge
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS layer_surcharge
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS filling_surcharge
|
||||
IMPORTING iv_filling TYPE ty_filling
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS decoration_surcharge
|
||||
IMPORTING iv_decoration TYPE ty_decoration
|
||||
iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS apply_express
|
||||
IMPORTING iv_amount TYPE ty_price
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
DATA(lv_size) = clamp_size( iv_size ).
|
||||
DATA(lv_price) = c_base_price.
|
||||
lv_price = lv_price + size_surcharge( lv_size ).
|
||||
lv_price = lv_price + layer_surcharge( clamp_layers( iv_layers ) ).
|
||||
lv_price = lv_price + filling_surcharge( iv_filling ).
|
||||
lv_price = lv_price + decoration_surcharge( iv_decoration = iv_decoration
|
||||
iv_size = lv_size ).
|
||||
IF iv_express = abap_true.
|
||||
lv_price = apply_express( lv_price ).
|
||||
ENDIF.
|
||||
IF lv_price < c_min_price.
|
||||
rv_price = c_min_price.
|
||||
ELSE.
|
||||
rv_price = lv_price.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_size.
|
||||
rv_size = nmax( val1 = iv_size val2 = c_min_size ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_layers.
|
||||
rv_layers = nmax( val1 = iv_layers val2 = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_surcharge.
|
||||
IF iv_size > c_free_size.
|
||||
rv_amount = ( iv_size - c_free_size ) * c_size_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_surcharge.
|
||||
IF iv_layers > 1.
|
||||
rv_amount = ( iv_layers + 1 ) * c_layer_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_surcharge.
|
||||
CASE iv_filling.
|
||||
WHEN 'C'.
|
||||
rv_amount = c_filling_choc.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_filling_fruit.
|
||||
WHEN 'N'.
|
||||
CLEAR rv_amount.
|
||||
WHEN OTHERS.
|
||||
rv_amount = c_filling_plain.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_surcharge.
|
||||
CASE iv_decoration.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_deco_flowers.
|
||||
WHEN 'P'.
|
||||
IF iv_size >= c_photo_size.
|
||||
rv_amount = c_deco_photo.
|
||||
ENDIF.
|
||||
WHEN 'S'.
|
||||
rv_amount = c_deco_sugar.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_express.
|
||||
rv_amount = round( val = iv_amount * c_express_rate dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
125
tasks_gen/eval/G0138/faulty/m4_cake_pricer.clas.abap
Normal file
125
tasks_gen/eval/G0138/faulty/m4_cake_pricer.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_price TYPE ty_price VALUE '12.00',
|
||||
c_min_price TYPE ty_price VALUE '15.00',
|
||||
c_min_size TYPE i VALUE 16,
|
||||
c_free_size TYPE i VALUE 20,
|
||||
c_photo_size TYPE i VALUE 24,
|
||||
c_size_rate TYPE ty_price VALUE '0.80',
|
||||
c_layer_rate TYPE ty_price VALUE '4.50',
|
||||
c_express_rate TYPE ty_price VALUE '1.25',
|
||||
c_filling_plain TYPE ty_price VALUE '3.00',
|
||||
c_filling_choc TYPE ty_price VALUE '4.00',
|
||||
c_filling_fruit TYPE ty_price VALUE '5.50',
|
||||
c_deco_flowers TYPE ty_price VALUE '6.00',
|
||||
c_deco_photo TYPE ty_price VALUE '9.50',
|
||||
c_deco_sugar TYPE ty_price VALUE '12.00'.
|
||||
|
||||
METHODS clamp_size
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_size) TYPE i.
|
||||
METHODS clamp_layers
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_layers) TYPE i.
|
||||
METHODS size_surcharge
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS layer_surcharge
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS filling_surcharge
|
||||
IMPORTING iv_filling TYPE ty_filling
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS decoration_surcharge
|
||||
IMPORTING iv_decoration TYPE ty_decoration
|
||||
iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS apply_express
|
||||
IMPORTING iv_amount TYPE ty_price
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
DATA(lv_size) = clamp_size( iv_size ).
|
||||
DATA(lv_price) = c_base_price.
|
||||
lv_price = lv_price + size_surcharge( lv_size ).
|
||||
lv_price = lv_price + layer_surcharge( clamp_layers( iv_layers ) ).
|
||||
lv_price = lv_price + filling_surcharge( iv_filling ).
|
||||
lv_price = lv_price + decoration_surcharge( iv_decoration = iv_decoration
|
||||
iv_size = lv_size ).
|
||||
IF iv_express = abap_true.
|
||||
lv_price = apply_express( lv_price ).
|
||||
ENDIF.
|
||||
IF lv_price < c_min_price.
|
||||
rv_price = c_min_price.
|
||||
ELSE.
|
||||
rv_price = lv_price.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_size.
|
||||
rv_size = nmax( val1 = iv_size val2 = c_min_size ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_layers.
|
||||
rv_layers = nmax( val1 = iv_layers val2 = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_surcharge.
|
||||
IF iv_size > c_free_size.
|
||||
rv_amount = ( iv_size - c_free_size ) * c_size_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_surcharge.
|
||||
IF iv_layers > 1.
|
||||
rv_amount = ( iv_layers - 2 ) * c_layer_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_surcharge.
|
||||
CASE iv_filling.
|
||||
WHEN 'C'.
|
||||
rv_amount = c_filling_choc.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_filling_fruit.
|
||||
WHEN 'N'.
|
||||
CLEAR rv_amount.
|
||||
WHEN OTHERS.
|
||||
rv_amount = c_filling_plain.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_surcharge.
|
||||
CASE iv_decoration.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_deco_flowers.
|
||||
WHEN 'P'.
|
||||
IF iv_size >= c_photo_size.
|
||||
rv_amount = c_deco_photo.
|
||||
ENDIF.
|
||||
WHEN 'S'.
|
||||
rv_amount = c_deco_sugar.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_express.
|
||||
rv_amount = round( val = iv_amount * c_express_rate dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
52
tasks_gen/eval/G0138/generation.json
Normal file
52
tasks_gen/eval/G0138/generation.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"id": "G0138",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"hidden/e05_hidden.clas.abap line 45: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 45: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"00\"",
|
||||
"hidden/e05_hidden.clas.abap line 51: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 51: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 54: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 54: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 57: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 57: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"80\"",
|
||||
"hidden/e05_hidden.clas.abap line 63: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 63: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 69: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 69: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 72: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 72: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 78: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 78: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 81: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 81: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"hidden/e05_hidden.clas.abap line 84: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"expect_price\"",
|
||||
"hidden/e05_hidden.clas.abap line 84: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"00\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 20
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
244
tasks_gen/eval/G0138/hidden/e05_hidden.clas.abap
Normal file
244
tasks_gen/eval/G0138/hidden/e05_hidden.clas.abap
Normal file
@@ -0,0 +1,244 @@
|
||||
CLASS {{p}}e05_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_min TYPE {{p}}cake_pricer=>ty_price VALUE '15.00',
|
||||
c_size_fee TYPE {{p}}cake_pricer=>ty_price VALUE '16.80',
|
||||
c_clamped TYPE {{p}}cake_pricer=>ty_price VALUE '38.50',
|
||||
c_layers TYPE {{p}}cake_pricer=>ty_price VALUE '25.50',
|
||||
c_lay_clamp TYPE {{p}}cake_pricer=>ty_price VALUE '29.50',
|
||||
c_vanilla TYPE {{p}}cake_pricer=>ty_price VALUE '19.50',
|
||||
c_choc TYPE {{p}}cake_pricer=>ty_price VALUE '20.50',
|
||||
c_fruit TYPE {{p}}cake_pricer=>ty_price VALUE '22.00',
|
||||
c_plain TYPE {{p}}cake_pricer=>ty_price VALUE '16.50',
|
||||
c_flowers TYPE {{p}}cake_pricer=>ty_price VALUE '22.80',
|
||||
c_sugar TYPE {{p}}cake_pricer=>ty_price VALUE '28.80',
|
||||
c_photo TYPE {{p}}cake_pricer=>ty_price VALUE '26.30',
|
||||
c_photo_lo TYPE {{p}}cake_pricer=>ty_price VALUE '20.50',
|
||||
c_photo_hi TYPE {{p}}cake_pricer=>ty_price VALUE '33.20',
|
||||
c_unknown TYPE {{p}}cake_pricer=>ty_price VALUE '23.00',
|
||||
c_express TYPE {{p}}cake_pricer=>ty_price VALUE '29.50',
|
||||
c_round TYPE {{p}}cake_pricer=>ty_price VALUE '39.13'.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}cake_pricer.
|
||||
METHODS setup.
|
||||
METHODS base_min_price FOR TESTING.
|
||||
METHODS size_rules FOR TESTING.
|
||||
METHODS layer_fee FOR TESTING.
|
||||
METHODS layers_clamped FOR TESTING.
|
||||
METHODS filling_fee FOR TESTING.
|
||||
METHODS decoration_fee FOR TESTING.
|
||||
METHODS photo_needs_size FOR TESTING.
|
||||
METHODS unknown_codes FOR TESTING.
|
||||
METHODS express_exact FOR TESTING.
|
||||
METHODS express_rounds FOR TESTING.
|
||||
METHODS express_at_min FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}e05_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}cake_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_min_price.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_base_min
|
||||
act = mo_cut->calculate_price( iv_size = 16
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `base` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_rules.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_clamped
|
||||
act = mo_cut->calculate_price( iv_size = 10
|
||||
iv_layers = 3
|
||||
iv_filling = 'F'
|
||||
iv_decoration = 'S'
|
||||
iv_express = abap_false )
|
||||
msg = `clamped` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_clamped
|
||||
act = mo_cut->calculate_price( iv_size = 16
|
||||
iv_layers = 3
|
||||
iv_filling = 'F'
|
||||
iv_decoration = 'S'
|
||||
iv_express = abap_false )
|
||||
msg = `min size` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_size_fee
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `size fee` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_layers
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 4
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `layers` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layers_clamped.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_lay_clamp
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 0
|
||||
iv_filling = 'F'
|
||||
iv_decoration = 'S'
|
||||
iv_express = abap_false )
|
||||
msg = `zero layers` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_lay_clamp
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 1
|
||||
iv_filling = 'F'
|
||||
iv_decoration = 'S'
|
||||
iv_express = abap_false )
|
||||
msg = `one layer` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_vanilla
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 2
|
||||
iv_filling = 'V'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `vanilla` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_choc
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 2
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `chocolate` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_fruit
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 2
|
||||
iv_filling = 'F'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `fruit` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_plain
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 2
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `none` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_size_fee
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false )
|
||||
msg = `no deco` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_flowers
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'F'
|
||||
iv_express = abap_false )
|
||||
msg = `flowers` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_sugar
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'S'
|
||||
iv_express = abap_false )
|
||||
msg = `sugar` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_photo
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'P'
|
||||
iv_express = abap_false )
|
||||
msg = `photo` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_needs_size.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_photo_lo
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 2
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'P'
|
||||
iv_express = abap_false )
|
||||
msg = `too small` ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_photo_hi
|
||||
act = mo_cut->calculate_price( iv_size = 24
|
||||
iv_layers = 2
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'P'
|
||||
iv_express = abap_false )
|
||||
msg = `large enough` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_codes.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_unknown
|
||||
act = mo_cut->calculate_price( iv_size = 30
|
||||
iv_layers = 1
|
||||
iv_filling = 'X'
|
||||
iv_decoration = 'Z'
|
||||
iv_express = abap_false )
|
||||
msg = `unknown codes` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_exact.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_express
|
||||
act = mo_cut->calculate_price( iv_size = 22
|
||||
iv_layers = 1
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'F'
|
||||
iv_express = abap_true )
|
||||
msg = `express` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_rounds.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_round
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 2
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'F'
|
||||
iv_express = abap_true )
|
||||
msg = `express rounded` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_at_min.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_base_min
|
||||
act = mo_cut->calculate_price( iv_size = 16
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_true )
|
||||
msg = `express at minimum` ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
78
tasks_gen/eval/G0138/mutation.json
Normal file
78
tasks_gen/eval/G0138/mutation.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"task": "G0138",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}CAKE_PRICER",
|
||||
"mutant": "line 62: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "6/11",
|
||||
"failed_tests": [
|
||||
"EXPRESS_ROUNDS",
|
||||
"FILLING_FEE",
|
||||
"LAYER_FEE",
|
||||
"PHOTO_NEEDS_SIZE",
|
||||
"SIZE_RULES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CAKE_PRICER",
|
||||
"mutant": "line 66: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "2/11",
|
||||
"failed_tests": [
|
||||
"DECORATION_FEE",
|
||||
"EXPRESS_EXACT",
|
||||
"EXPRESS_ROUNDS",
|
||||
"FILLING_FEE",
|
||||
"LAYERS_CLAMPED",
|
||||
"LAYER_FEE",
|
||||
"PHOTO_NEEDS_SIZE",
|
||||
"SIZE_RULES",
|
||||
"UNKNOWN_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CAKE_PRICER",
|
||||
"mutant": "line 91: > -> <= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "6/11",
|
||||
"failed_tests": [
|
||||
"EXPRESS_ROUNDS",
|
||||
"FILLING_FEE",
|
||||
"LAYER_FEE",
|
||||
"PHOTO_NEEDS_SIZE",
|
||||
"SIZE_RULES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CAKE_PRICER",
|
||||
"mutant": "line 92: - -> + (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "6/11",
|
||||
"failed_tests": [
|
||||
"EXPRESS_ROUNDS",
|
||||
"FILLING_FEE",
|
||||
"LAYER_FEE",
|
||||
"PHOTO_NEEDS_SIZE",
|
||||
"SIZE_RULES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CAKE_PRICER",
|
||||
"mutant": "line 92: 1 -> 2 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "6/11",
|
||||
"failed_tests": [
|
||||
"EXPRESS_ROUNDS",
|
||||
"FILLING_FEE",
|
||||
"LAYER_FEE",
|
||||
"PHOTO_NEEDS_SIZE",
|
||||
"SIZE_RULES"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
125
tasks_gen/eval/G0138/reference/cake_pricer.clas.abap
Normal file
125
tasks_gen/eval/G0138/reference/cake_pricer.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_base_price TYPE ty_price VALUE '12.00',
|
||||
c_min_price TYPE ty_price VALUE '15.00',
|
||||
c_min_size TYPE i VALUE 16,
|
||||
c_free_size TYPE i VALUE 20,
|
||||
c_photo_size TYPE i VALUE 24,
|
||||
c_size_rate TYPE ty_price VALUE '0.80',
|
||||
c_layer_rate TYPE ty_price VALUE '4.50',
|
||||
c_express_rate TYPE ty_price VALUE '1.25',
|
||||
c_filling_plain TYPE ty_price VALUE '3.00',
|
||||
c_filling_choc TYPE ty_price VALUE '4.00',
|
||||
c_filling_fruit TYPE ty_price VALUE '5.50',
|
||||
c_deco_flowers TYPE ty_price VALUE '6.00',
|
||||
c_deco_photo TYPE ty_price VALUE '9.50',
|
||||
c_deco_sugar TYPE ty_price VALUE '12.00'.
|
||||
|
||||
METHODS clamp_size
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_size) TYPE i.
|
||||
METHODS clamp_layers
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_layers) TYPE i.
|
||||
METHODS size_surcharge
|
||||
IMPORTING iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS layer_surcharge
|
||||
IMPORTING iv_layers TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS filling_surcharge
|
||||
IMPORTING iv_filling TYPE ty_filling
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS decoration_surcharge
|
||||
IMPORTING iv_decoration TYPE ty_decoration
|
||||
iv_size TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
METHODS apply_express
|
||||
IMPORTING iv_amount TYPE ty_price
|
||||
RETURNING VALUE(rv_amount) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
DATA(lv_size) = clamp_size( iv_size ).
|
||||
DATA(lv_price) = c_base_price.
|
||||
lv_price = lv_price + size_surcharge( lv_size ).
|
||||
lv_price = lv_price + layer_surcharge( clamp_layers( iv_layers ) ).
|
||||
lv_price = lv_price + filling_surcharge( iv_filling ).
|
||||
lv_price = lv_price + decoration_surcharge( iv_decoration = iv_decoration
|
||||
iv_size = lv_size ).
|
||||
IF iv_express = abap_true.
|
||||
lv_price = apply_express( lv_price ).
|
||||
ENDIF.
|
||||
IF lv_price < c_min_price.
|
||||
rv_price = c_min_price.
|
||||
ELSE.
|
||||
rv_price = lv_price.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_size.
|
||||
rv_size = nmax( val1 = iv_size val2 = c_min_size ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD clamp_layers.
|
||||
rv_layers = nmax( val1 = iv_layers val2 = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_surcharge.
|
||||
IF iv_size > c_free_size.
|
||||
rv_amount = ( iv_size - c_free_size ) * c_size_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD layer_surcharge.
|
||||
IF iv_layers > 1.
|
||||
rv_amount = ( iv_layers - 1 ) * c_layer_rate.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filling_surcharge.
|
||||
CASE iv_filling.
|
||||
WHEN 'C'.
|
||||
rv_amount = c_filling_choc.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_filling_fruit.
|
||||
WHEN 'N'.
|
||||
CLEAR rv_amount.
|
||||
WHEN OTHERS.
|
||||
rv_amount = c_filling_plain.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decoration_surcharge.
|
||||
CASE iv_decoration.
|
||||
WHEN 'F'.
|
||||
rv_amount = c_deco_flowers.
|
||||
WHEN 'P'.
|
||||
IF iv_size >= c_photo_size.
|
||||
rv_amount = c_deco_photo.
|
||||
ENDIF.
|
||||
WHEN 'S'.
|
||||
rv_amount = c_deco_sugar.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_express.
|
||||
rv_amount = round( val = iv_amount * c_express_rate dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
62
tasks_gen/eval/G0138/reference/cake_pricer.testclasses.abap
Normal file
62
tasks_gen/eval/G0138/reference/cake_pricer.testclasses.abap
Normal file
@@ -0,0 +1,62 @@
|
||||
CLASS ltc_cake_pricer DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_minimum TYPE {{p}}cake_pricer=>ty_price VALUE '15.00',
|
||||
c_big_order TYPE {{p}}cake_pricer=>ty_price VALUE '43.30',
|
||||
c_photo_lo TYPE {{p}}cake_pricer=>ty_price VALUE '20.50',
|
||||
c_express TYPE {{p}}cake_pricer=>ty_price VALUE '39.13'.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}cake_pricer.
|
||||
METHODS setup.
|
||||
METHODS minimum_price FOR TESTING.
|
||||
METHODS size_and_layers FOR TESTING.
|
||||
METHODS photo_print_needs_size FOR TESTING.
|
||||
METHODS express_surcharge FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_cake_pricer IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}cake_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_price.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_minimum
|
||||
act = mo_cut->calculate_price( iv_size = 16
|
||||
iv_layers = 1
|
||||
iv_filling = 'N'
|
||||
iv_decoration = 'N'
|
||||
iv_express = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_and_layers.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_big_order
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 3
|
||||
iv_filling = 'F'
|
||||
iv_decoration = 'S'
|
||||
iv_express = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_print_needs_size.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_photo_lo
|
||||
act = mo_cut->calculate_price( iv_size = 20
|
||||
iv_layers = 2
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'P'
|
||||
iv_express = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_surcharge.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_express
|
||||
act = mo_cut->calculate_price( iv_size = 26
|
||||
iv_layers = 2
|
||||
iv_filling = 'C'
|
||||
iv_decoration = 'F'
|
||||
iv_express = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
92
tasks_gen/eval/G0138/seed/cake_pricer.clas.abap
Normal file
92
tasks_gen/eval/G0138/seed/cake_pricer.clas.abap
Normal file
@@ -0,0 +1,92 @@
|
||||
CLASS {{p}}cake_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_filling TYPE c LENGTH 1.
|
||||
TYPES ty_decoration TYPE c LENGTH 1.
|
||||
|
||||
METHODS calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cake_pricer IMPLEMENTATION.
|
||||
METHOD calculate_price.
|
||||
" legacy implementation, one long method
|
||||
DATA lv_size TYPE i.
|
||||
DATA lv_layers TYPE i.
|
||||
DATA lv_total TYPE ty_price.
|
||||
DATA lv_fee TYPE ty_price.
|
||||
DATA lv_amount TYPE ty_price.
|
||||
DATA lv_rate TYPE ty_price.
|
||||
DATA lv_old_check TYPE i.
|
||||
|
||||
lv_total = '12.00'.
|
||||
lv_size = iv_size.
|
||||
IF lv_size < 16.
|
||||
lv_size = 16.
|
||||
ENDIF.
|
||||
IF lv_size > 20.
|
||||
lv_rate = '0.80'.
|
||||
lv_fee = ( lv_size - 20 ) * lv_rate.
|
||||
lv_total = lv_total + lv_fee.
|
||||
ENDIF.
|
||||
lv_layers = iv_layers.
|
||||
IF lv_layers < 1.
|
||||
lv_layers = 1.
|
||||
ENDIF.
|
||||
IF lv_layers > 1.
|
||||
lv_rate = '4.50'.
|
||||
lv_fee = ( lv_layers - 1 ) * lv_rate.
|
||||
lv_total = lv_total + lv_fee.
|
||||
ENDIF.
|
||||
IF iv_filling = 'V'.
|
||||
lv_amount = '3.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSEIF iv_filling = 'C'.
|
||||
lv_amount = '4.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSEIF iv_filling = 'F'.
|
||||
lv_amount = '5.50'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSEIF iv_filling = 'N'.
|
||||
lv_amount = '0.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSE.
|
||||
lv_amount = '3.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ENDIF.
|
||||
IF iv_decoration = 'F'.
|
||||
lv_amount = '6.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSEIF iv_decoration = 'P'.
|
||||
IF lv_size >= 24.
|
||||
lv_amount = '9.50'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSE.
|
||||
lv_amount = '0.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ENDIF.
|
||||
ELSEIF iv_decoration = 'S'.
|
||||
lv_amount = '12.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ELSE.
|
||||
lv_amount = '0.00'.
|
||||
lv_total = lv_total + lv_amount.
|
||||
ENDIF.
|
||||
IF iv_express = abap_true.
|
||||
lv_rate = '1.25'.
|
||||
lv_fee = lv_total * lv_rate.
|
||||
lv_total = lv_fee.
|
||||
ENDIF.
|
||||
lv_amount = '15.00'.
|
||||
IF lv_total < lv_amount.
|
||||
lv_total = lv_amount.
|
||||
ENDIF.
|
||||
rv_price = lv_total.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
49
tasks_gen/eval/G0138/spec.md
Normal file
49
tasks_gen/eval/G0138/spec.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# 1. Goal
|
||||
The class {{P}}CAKE_PRICER calculates the price of a custom cake order. The
|
||||
code is old and hard to maintain. Refactor the class. The behavior must stay
|
||||
the same. A shop program calls the class before it shows the price to the
|
||||
customer.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The class {{P}}CAKE_PRICER exists in package $TMP. It is active.
|
||||
- The class is public and final. It has a public constructor without parameters.
|
||||
- The class has one public method, CALCULATE_PRICE, and three public types.
|
||||
- The current implementation is one long method. It has deep nesting, magic
|
||||
numbers, dead code and an unused variable. The results of the method are
|
||||
correct.
|
||||
|
||||
# 4. Contract
|
||||
- Keep the class {{P}}CAKE_PRICER in package $TMP. Keep the name.
|
||||
- Keep the public interface. Do not change it:
|
||||
- TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
- TYPES ty_filling TYPE c LENGTH 1.
|
||||
- TYPES ty_decoration TYPE c LENGTH 1.
|
||||
- METHOD calculate_price
|
||||
IMPORTING iv_size TYPE i
|
||||
iv_layers TYPE i
|
||||
iv_filling TYPE ty_filling
|
||||
iv_decoration TYPE ty_decoration
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_price.
|
||||
- Do not add other public methods or public attributes.
|
||||
|
||||
# 5. Business rules
|
||||
- The behavior of the class stays the same.
|
||||
- Read the current implementation in {{P}}CAKE_PRICER. Keep every result.
|
||||
- Do not change the meaning of an input value or of the returned price.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Refactor the class in place. Do not create a new class.
|
||||
- Coding standards: Clean ABAP. Methods below 40 statements. No deep nesting.
|
||||
No unused variable. No magic number in the code. No comment that restates
|
||||
the code.
|
||||
- Out of scope: do not change the public interface of {{P}}CAKE_PRICER.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class {{P}}CAKE_PRICER is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
49
tasks_gen/eval/G0138/task.json
Normal file
49
tasks_gen/eval/G0138/task.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"id": "G0138",
|
||||
"category": "E",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CAKE_PRICER",
|
||||
"file": "seed/cake_pricer.clas.abap",
|
||||
"description": "Legacy cake price calculator, one long method"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CAKE_PRICER"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}E05_HIDDEN",
|
||||
"file": "hidden/e05_hidden.clas.abap",
|
||||
"description": "E05 hidden tests for the unchanged cake price behavior"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CAKE_PRICER",
|
||||
"file": "reference/cake_pricer.clas.abap",
|
||||
"description": "Refactored cake price calculator",
|
||||
"testclasses_file": "reference/cake_pricer.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"nesting_depth",
|
||||
"unused_variable"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user