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:
122
tasks_gen/eval/G0139/faulty/m0_marina_fee.clas.abap
Normal file
122
tasks_gen/eval/G0139/faulty/m0_marina_fee.clas.abap
Normal file
@@ -0,0 +1,122 @@
|
||||
CLASS {{p}}marina_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_boat_type TYPE c LENGTH 1.
|
||||
TYPES ty_season TYPE c LENGTH 1.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING
|
||||
iv_length_m TYPE i
|
||||
iv_nights TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE ty_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_length_small TYPE i VALUE 8,
|
||||
c_length_medium TYPE i VALUE 12,
|
||||
c_length_large TYPE i VALUE 18,
|
||||
c_rate_small TYPE ty_fee VALUE '20.00',
|
||||
c_rate_medium TYPE ty_fee VALUE '32.00',
|
||||
c_rate_large TYPE ty_fee VALUE '48.00',
|
||||
c_rate_xlarge TYPE ty_fee VALUE '75.00',
|
||||
c_factor_sail TYPE ty_fee VALUE '1.00',
|
||||
c_factor_motor TYPE ty_fee VALUE '1.20',
|
||||
c_factor_cat TYPE ty_fee VALUE '1.50',
|
||||
c_factor_high TYPE ty_fee VALUE '1.40',
|
||||
c_factor_low TYPE ty_fee VALUE '1.00',
|
||||
c_power_fee TYPE ty_fee VALUE '5.00',
|
||||
c_discount TYPE ty_fee VALUE '0.90',
|
||||
c_discount_days TYPE i VALUE 7,
|
||||
c_min_fee TYPE ty_fee VALUE '30.00',
|
||||
c_no_fee TYPE ty_fee VALUE '0.00'.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS type_factor
|
||||
IMPORTING iv_boat_type TYPE ty_boat_type
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS season_factor
|
||||
IMPORTING iv_season TYPE ty_season
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS nightly_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS total_fee
|
||||
IMPORTING iv_nightly TYPE ty_fee
|
||||
iv_nights TYPE i
|
||||
RETURNING VALUE(rv_total) TYPE ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee IMPLEMENTATION.
|
||||
METHOD calculate_fee.
|
||||
IF iv_length_m <= 0 OR iv_nights <= 0.
|
||||
rv_fee = c_no_fee.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_nightly) = nightly_rate( iv_length_m = iv_length_m
|
||||
iv_boat_type = iv_boat_type
|
||||
iv_season = iv_season
|
||||
iv_power = iv_power ).
|
||||
rv_fee = total_fee( iv_nightly = lv_nightly
|
||||
iv_nights = iv_nights ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
IF iv_length_m <= c_length_small.
|
||||
rv_rate = c_rate_small.
|
||||
ELSEIF iv_length_m > c_length_medium.
|
||||
rv_rate = c_rate_medium.
|
||||
ELSEIF iv_length_m <= c_length_large.
|
||||
rv_rate = c_rate_large.
|
||||
ELSE.
|
||||
rv_rate = c_rate_xlarge.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_factor.
|
||||
CASE iv_boat_type.
|
||||
WHEN 'C'.
|
||||
rv_factor = c_factor_cat.
|
||||
WHEN 'M'.
|
||||
rv_factor = c_factor_motor.
|
||||
WHEN OTHERS.
|
||||
rv_factor = c_factor_sail.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD season_factor.
|
||||
IF iv_season = 'H'.
|
||||
rv_factor = c_factor_high.
|
||||
ELSE.
|
||||
rv_factor = c_factor_low.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nightly_rate.
|
||||
rv_rate = base_rate( iv_length_m ) * type_factor( iv_boat_type ) * season_factor( iv_season ).
|
||||
IF iv_power = abap_true.
|
||||
rv_rate = rv_rate + c_power_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD total_fee.
|
||||
DATA lv_total TYPE ty_fee.
|
||||
lv_total = iv_nightly * iv_nights.
|
||||
IF iv_nights >= c_discount_days.
|
||||
lv_total = round( val = lv_total * c_discount dec = 2 ).
|
||||
ENDIF.
|
||||
IF lv_total < c_min_fee.
|
||||
rv_total = c_min_fee.
|
||||
ELSE.
|
||||
rv_total = lv_total.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
122
tasks_gen/eval/G0139/faulty/m1_marina_fee.clas.abap
Normal file
122
tasks_gen/eval/G0139/faulty/m1_marina_fee.clas.abap
Normal file
@@ -0,0 +1,122 @@
|
||||
CLASS {{p}}marina_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_boat_type TYPE c LENGTH 1.
|
||||
TYPES ty_season TYPE c LENGTH 1.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING
|
||||
iv_length_m TYPE i
|
||||
iv_nights TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE ty_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_length_small TYPE i VALUE 8,
|
||||
c_length_medium TYPE i VALUE 12,
|
||||
c_length_large TYPE i VALUE 18,
|
||||
c_rate_small TYPE ty_fee VALUE '20.00',
|
||||
c_rate_medium TYPE ty_fee VALUE '32.00',
|
||||
c_rate_large TYPE ty_fee VALUE '48.00',
|
||||
c_rate_xlarge TYPE ty_fee VALUE '75.00',
|
||||
c_factor_sail TYPE ty_fee VALUE '1.00',
|
||||
c_factor_motor TYPE ty_fee VALUE '1.20',
|
||||
c_factor_cat TYPE ty_fee VALUE '1.50',
|
||||
c_factor_high TYPE ty_fee VALUE '1.40',
|
||||
c_factor_low TYPE ty_fee VALUE '1.00',
|
||||
c_power_fee TYPE ty_fee VALUE '5.00',
|
||||
c_discount TYPE ty_fee VALUE '0.90',
|
||||
c_discount_days TYPE i VALUE 7,
|
||||
c_min_fee TYPE ty_fee VALUE '30.00',
|
||||
c_no_fee TYPE ty_fee VALUE '0.00'.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS type_factor
|
||||
IMPORTING iv_boat_type TYPE ty_boat_type
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS season_factor
|
||||
IMPORTING iv_season TYPE ty_season
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS nightly_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS total_fee
|
||||
IMPORTING iv_nightly TYPE ty_fee
|
||||
iv_nights TYPE i
|
||||
RETURNING VALUE(rv_total) TYPE ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee IMPLEMENTATION.
|
||||
METHOD calculate_fee.
|
||||
IF iv_length_m <= 0 OR iv_nights <= 0.
|
||||
rv_fee = c_no_fee.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_nightly) = nightly_rate( iv_length_m = iv_length_m
|
||||
iv_boat_type = iv_boat_type
|
||||
iv_season = iv_season
|
||||
iv_power = iv_power ).
|
||||
rv_fee = total_fee( iv_nightly = lv_nightly
|
||||
iv_nights = iv_nights ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
IF iv_length_m <= c_length_small.
|
||||
rv_rate = c_rate_small.
|
||||
ELSEIF iv_length_m <= c_length_medium.
|
||||
rv_rate = c_rate_medium.
|
||||
ELSEIF iv_length_m <= c_length_large.
|
||||
rv_rate = c_rate_large.
|
||||
ELSE.
|
||||
rv_rate = c_rate_xlarge.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_factor.
|
||||
CASE iv_boat_type.
|
||||
WHEN 'C'.
|
||||
rv_factor = c_factor_cat.
|
||||
WHEN 'M'.
|
||||
rv_factor = c_factor_motor.
|
||||
WHEN OTHERS.
|
||||
rv_factor = c_factor_sail.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD season_factor.
|
||||
IF iv_season <> 'H'.
|
||||
rv_factor = c_factor_high.
|
||||
ELSE.
|
||||
rv_factor = c_factor_low.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nightly_rate.
|
||||
rv_rate = base_rate( iv_length_m ) * type_factor( iv_boat_type ) * season_factor( iv_season ).
|
||||
IF iv_power = abap_true.
|
||||
rv_rate = rv_rate + c_power_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD total_fee.
|
||||
DATA lv_total TYPE ty_fee.
|
||||
lv_total = iv_nightly * iv_nights.
|
||||
IF iv_nights >= c_discount_days.
|
||||
lv_total = round( val = lv_total * c_discount dec = 2 ).
|
||||
ENDIF.
|
||||
IF lv_total < c_min_fee.
|
||||
rv_total = c_min_fee.
|
||||
ELSE.
|
||||
rv_total = lv_total.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
122
tasks_gen/eval/G0139/faulty/m2_marina_fee.clas.abap
Normal file
122
tasks_gen/eval/G0139/faulty/m2_marina_fee.clas.abap
Normal file
@@ -0,0 +1,122 @@
|
||||
CLASS {{p}}marina_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_boat_type TYPE c LENGTH 1.
|
||||
TYPES ty_season TYPE c LENGTH 1.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING
|
||||
iv_length_m TYPE i
|
||||
iv_nights TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE ty_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_length_small TYPE i VALUE 8,
|
||||
c_length_medium TYPE i VALUE 12,
|
||||
c_length_large TYPE i VALUE 18,
|
||||
c_rate_small TYPE ty_fee VALUE '20.00',
|
||||
c_rate_medium TYPE ty_fee VALUE '32.00',
|
||||
c_rate_large TYPE ty_fee VALUE '48.00',
|
||||
c_rate_xlarge TYPE ty_fee VALUE '75.00',
|
||||
c_factor_sail TYPE ty_fee VALUE '1.00',
|
||||
c_factor_motor TYPE ty_fee VALUE '1.20',
|
||||
c_factor_cat TYPE ty_fee VALUE '1.50',
|
||||
c_factor_high TYPE ty_fee VALUE '1.40',
|
||||
c_factor_low TYPE ty_fee VALUE '1.00',
|
||||
c_power_fee TYPE ty_fee VALUE '5.00',
|
||||
c_discount TYPE ty_fee VALUE '0.90',
|
||||
c_discount_days TYPE i VALUE 7,
|
||||
c_min_fee TYPE ty_fee VALUE '30.00',
|
||||
c_no_fee TYPE ty_fee VALUE '0.00'.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS type_factor
|
||||
IMPORTING iv_boat_type TYPE ty_boat_type
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS season_factor
|
||||
IMPORTING iv_season TYPE ty_season
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS nightly_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS total_fee
|
||||
IMPORTING iv_nightly TYPE ty_fee
|
||||
iv_nights TYPE i
|
||||
RETURNING VALUE(rv_total) TYPE ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee IMPLEMENTATION.
|
||||
METHOD calculate_fee.
|
||||
IF iv_length_m <= 0 OR iv_nights <= 0.
|
||||
rv_fee = c_no_fee.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_nightly) = nightly_rate( iv_length_m = iv_length_m
|
||||
iv_boat_type = iv_boat_type
|
||||
iv_season = iv_season
|
||||
iv_power = iv_power ).
|
||||
rv_fee = total_fee( iv_nightly = lv_nightly
|
||||
iv_nights = iv_nights ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
IF iv_length_m <= c_length_small.
|
||||
rv_rate = c_rate_small.
|
||||
ELSEIF iv_length_m <= c_length_medium.
|
||||
rv_rate = c_rate_medium.
|
||||
ELSEIF iv_length_m <= c_length_large.
|
||||
rv_rate = c_rate_large.
|
||||
ELSE.
|
||||
rv_rate = c_rate_xlarge.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_factor.
|
||||
CASE iv_boat_type.
|
||||
WHEN 'C'.
|
||||
rv_factor = c_factor_cat.
|
||||
WHEN 'M'.
|
||||
rv_factor = c_factor_motor.
|
||||
WHEN OTHERS.
|
||||
rv_factor = c_factor_sail.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD season_factor.
|
||||
IF iv_season = 'H'.
|
||||
rv_factor = c_factor_high.
|
||||
ELSE.
|
||||
rv_factor = c_factor_low.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nightly_rate.
|
||||
rv_rate = base_rate( iv_length_m ) * type_factor( iv_boat_type ) * season_factor( iv_season ).
|
||||
IF iv_power = abap_false.
|
||||
rv_rate = rv_rate + c_power_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD total_fee.
|
||||
DATA lv_total TYPE ty_fee.
|
||||
lv_total = iv_nightly * iv_nights.
|
||||
IF iv_nights >= c_discount_days.
|
||||
lv_total = round( val = lv_total * c_discount dec = 2 ).
|
||||
ENDIF.
|
||||
IF lv_total < c_min_fee.
|
||||
rv_total = c_min_fee.
|
||||
ELSE.
|
||||
rv_total = lv_total.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
122
tasks_gen/eval/G0139/faulty/m3_marina_fee.clas.abap
Normal file
122
tasks_gen/eval/G0139/faulty/m3_marina_fee.clas.abap
Normal file
@@ -0,0 +1,122 @@
|
||||
CLASS {{p}}marina_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_boat_type TYPE c LENGTH 1.
|
||||
TYPES ty_season TYPE c LENGTH 1.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING
|
||||
iv_length_m TYPE i
|
||||
iv_nights TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE ty_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_length_small TYPE i VALUE 8,
|
||||
c_length_medium TYPE i VALUE 12,
|
||||
c_length_large TYPE i VALUE 18,
|
||||
c_rate_small TYPE ty_fee VALUE '20.00',
|
||||
c_rate_medium TYPE ty_fee VALUE '32.00',
|
||||
c_rate_large TYPE ty_fee VALUE '48.00',
|
||||
c_rate_xlarge TYPE ty_fee VALUE '75.00',
|
||||
c_factor_sail TYPE ty_fee VALUE '1.00',
|
||||
c_factor_motor TYPE ty_fee VALUE '1.20',
|
||||
c_factor_cat TYPE ty_fee VALUE '1.50',
|
||||
c_factor_high TYPE ty_fee VALUE '1.40',
|
||||
c_factor_low TYPE ty_fee VALUE '1.00',
|
||||
c_power_fee TYPE ty_fee VALUE '5.00',
|
||||
c_discount TYPE ty_fee VALUE '0.90',
|
||||
c_discount_days TYPE i VALUE 7,
|
||||
c_min_fee TYPE ty_fee VALUE '30.00',
|
||||
c_no_fee TYPE ty_fee VALUE '0.00'.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS type_factor
|
||||
IMPORTING iv_boat_type TYPE ty_boat_type
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS season_factor
|
||||
IMPORTING iv_season TYPE ty_season
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS nightly_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS total_fee
|
||||
IMPORTING iv_nightly TYPE ty_fee
|
||||
iv_nights TYPE i
|
||||
RETURNING VALUE(rv_total) TYPE ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee IMPLEMENTATION.
|
||||
METHOD calculate_fee.
|
||||
IF iv_length_m <= 0 OR iv_nights <= 0.
|
||||
rv_fee = c_no_fee.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_nightly) = nightly_rate( iv_length_m = iv_length_m
|
||||
iv_boat_type = iv_boat_type
|
||||
iv_season = iv_season
|
||||
iv_power = iv_power ).
|
||||
rv_fee = total_fee( iv_nightly = lv_nightly
|
||||
iv_nights = iv_nights ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
IF iv_length_m <= c_length_small.
|
||||
rv_rate = c_rate_small.
|
||||
ELSEIF iv_length_m <= c_length_medium.
|
||||
rv_rate = c_rate_medium.
|
||||
ELSEIF iv_length_m <= c_length_large.
|
||||
rv_rate = c_rate_large.
|
||||
ELSE.
|
||||
rv_rate = c_rate_xlarge.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_factor.
|
||||
CASE iv_boat_type.
|
||||
WHEN 'C'.
|
||||
rv_factor = c_factor_cat.
|
||||
WHEN 'M'.
|
||||
rv_factor = c_factor_motor.
|
||||
WHEN OTHERS.
|
||||
rv_factor = c_factor_sail.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD season_factor.
|
||||
IF iv_season = 'H'.
|
||||
rv_factor = c_factor_high.
|
||||
ELSE.
|
||||
rv_factor = c_factor_low.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nightly_rate.
|
||||
rv_rate = base_rate( iv_length_m ) * type_factor( iv_boat_type ) * season_factor( iv_season ).
|
||||
IF iv_power = abap_true.
|
||||
rv_rate = rv_rate - c_power_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD total_fee.
|
||||
DATA lv_total TYPE ty_fee.
|
||||
lv_total = iv_nightly * iv_nights.
|
||||
IF iv_nights >= c_discount_days.
|
||||
lv_total = round( val = lv_total * c_discount dec = 2 ).
|
||||
ENDIF.
|
||||
IF lv_total < c_min_fee.
|
||||
rv_total = c_min_fee.
|
||||
ELSE.
|
||||
rv_total = lv_total.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
19
tasks_gen/eval/G0139/generation.json
Normal file
19
tasks_gen/eval/G0139/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G0139",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
156
tasks_gen/eval/G0139/hidden/marina_fee_hidden.clas.abap
Normal file
156
tasks_gen/eval/G0139/hidden/marina_fee_hidden.clas.abap
Normal file
@@ -0,0 +1,156 @@
|
||||
CLASS {{p}}marina_fee_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}marina_fee.
|
||||
METHODS setup.
|
||||
METHODS zero_length_returns_zero FOR TESTING.
|
||||
METHODS zero_nights_returns_zero FOR TESTING.
|
||||
METHODS minimum_fee_applies FOR TESTING.
|
||||
METHODS sail_in_low_season FOR TESTING.
|
||||
METHODS motor_in_high_season FOR TESTING.
|
||||
METHODS catamaran_with_power FOR TESTING.
|
||||
METHODS week_discount FOR TESTING.
|
||||
METHODS discount_rounds_up FOR TESTING.
|
||||
METHODS unknown_type_like_sail FOR TESTING.
|
||||
METHODS large_boat_high_power FOR TESTING.
|
||||
METHODS length_boundary_8m FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}marina_fee( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_length_returns_zero.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 0
|
||||
iv_nights = 3
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_nights_returns_zero.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 10
|
||||
iv_nights = 0
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee_applies.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '30.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 6
|
||||
iv_nights = 1
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sail_in_low_season.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '96.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 10
|
||||
iv_nights = 3
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD motor_in_high_season.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '107.52'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 10
|
||||
iv_nights = 2
|
||||
iv_boat_type = 'M'
|
||||
iv_season = 'H'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD catamaran_with_power.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '308.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 14
|
||||
iv_nights = 4
|
||||
iv_boat_type = 'C'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD week_discount.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '201.60'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 12
|
||||
iv_nights = 7
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_rounds_up.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '370.19'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 10
|
||||
iv_nights = 7
|
||||
iv_boat_type = 'M'
|
||||
iv_season = 'H'
|
||||
iv_power = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_type_like_sail.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '96.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 10
|
||||
iv_nights = 3
|
||||
iv_boat_type = 'X'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD large_boat_high_power.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '262.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 25
|
||||
iv_nights = 2
|
||||
iv_boat_type = 'M'
|
||||
iv_season = 'H'
|
||||
iv_power = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD length_boundary_8m.
|
||||
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
||||
lv_exp = '40.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 8
|
||||
iv_nights = 2
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
74
tasks_gen/eval/G0139/mutation.json
Normal file
74
tasks_gen/eval/G0139/mutation.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"task": "G0139",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}MARINA_FEE",
|
||||
"mutant": "line 75: <= -> > (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "4/11",
|
||||
"failed_tests": [
|
||||
"CATAMARAN_WITH_POWER",
|
||||
"DISCOUNT_ROUNDS_UP",
|
||||
"LARGE_BOAT_HIGH_POWER",
|
||||
"MOTOR_IN_HIGH_SEASON",
|
||||
"SAIL_IN_LOW_SEASON",
|
||||
"UNKNOWN_TYPE_LIKE_SAIL",
|
||||
"WEEK_DISCOUNT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MARINA_FEE",
|
||||
"mutant": "line 96: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"CATAMARAN_WITH_POWER",
|
||||
"DISCOUNT_ROUNDS_UP",
|
||||
"LARGE_BOAT_HIGH_POWER",
|
||||
"LENGTH_BOUNDARY_8M",
|
||||
"MOTOR_IN_HIGH_SEASON",
|
||||
"SAIL_IN_LOW_SEASON",
|
||||
"UNKNOWN_TYPE_LIKE_SAIL",
|
||||
"WEEK_DISCOUNT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MARINA_FEE",
|
||||
"mutant": "line 105: abap_true -> abap_false (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"CATAMARAN_WITH_POWER",
|
||||
"DISCOUNT_ROUNDS_UP",
|
||||
"LARGE_BOAT_HIGH_POWER",
|
||||
"LENGTH_BOUNDARY_8M",
|
||||
"MOTOR_IN_HIGH_SEASON",
|
||||
"SAIL_IN_LOW_SEASON",
|
||||
"UNKNOWN_TYPE_LIKE_SAIL",
|
||||
"WEEK_DISCOUNT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MARINA_FEE",
|
||||
"mutant": "line 106: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "8/11",
|
||||
"failed_tests": [
|
||||
"CATAMARAN_WITH_POWER",
|
||||
"DISCOUNT_ROUNDS_UP",
|
||||
"LARGE_BOAT_HIGH_POWER"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MARINA_FEE",
|
||||
"mutant": "line 114: 2 -> 3 (const)",
|
||||
"status": "survived",
|
||||
"hidden": "11/11",
|
||||
"failed_tests": []
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"kill_rate": 0.8,
|
||||
"ok": true
|
||||
}
|
||||
122
tasks_gen/eval/G0139/reference/marina_fee.clas.abap
Normal file
122
tasks_gen/eval/G0139/reference/marina_fee.clas.abap
Normal file
@@ -0,0 +1,122 @@
|
||||
CLASS {{p}}marina_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_boat_type TYPE c LENGTH 1.
|
||||
TYPES ty_season TYPE c LENGTH 1.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING
|
||||
iv_length_m TYPE i
|
||||
iv_nights TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE ty_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_length_small TYPE i VALUE 8,
|
||||
c_length_medium TYPE i VALUE 12,
|
||||
c_length_large TYPE i VALUE 18,
|
||||
c_rate_small TYPE ty_fee VALUE '20.00',
|
||||
c_rate_medium TYPE ty_fee VALUE '32.00',
|
||||
c_rate_large TYPE ty_fee VALUE '48.00',
|
||||
c_rate_xlarge TYPE ty_fee VALUE '75.00',
|
||||
c_factor_sail TYPE ty_fee VALUE '1.00',
|
||||
c_factor_motor TYPE ty_fee VALUE '1.20',
|
||||
c_factor_cat TYPE ty_fee VALUE '1.50',
|
||||
c_factor_high TYPE ty_fee VALUE '1.40',
|
||||
c_factor_low TYPE ty_fee VALUE '1.00',
|
||||
c_power_fee TYPE ty_fee VALUE '5.00',
|
||||
c_discount TYPE ty_fee VALUE '0.90',
|
||||
c_discount_days TYPE i VALUE 7,
|
||||
c_min_fee TYPE ty_fee VALUE '30.00',
|
||||
c_no_fee TYPE ty_fee VALUE '0.00'.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS type_factor
|
||||
IMPORTING iv_boat_type TYPE ty_boat_type
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS season_factor
|
||||
IMPORTING iv_season TYPE ty_season
|
||||
RETURNING VALUE(rv_factor) TYPE ty_fee.
|
||||
METHODS nightly_rate
|
||||
IMPORTING iv_length_m TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING VALUE(rv_rate) TYPE ty_fee.
|
||||
METHODS total_fee
|
||||
IMPORTING iv_nightly TYPE ty_fee
|
||||
iv_nights TYPE i
|
||||
RETURNING VALUE(rv_total) TYPE ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee IMPLEMENTATION.
|
||||
METHOD calculate_fee.
|
||||
IF iv_length_m <= 0 OR iv_nights <= 0.
|
||||
rv_fee = c_no_fee.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_nightly) = nightly_rate( iv_length_m = iv_length_m
|
||||
iv_boat_type = iv_boat_type
|
||||
iv_season = iv_season
|
||||
iv_power = iv_power ).
|
||||
rv_fee = total_fee( iv_nightly = lv_nightly
|
||||
iv_nights = iv_nights ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
IF iv_length_m <= c_length_small.
|
||||
rv_rate = c_rate_small.
|
||||
ELSEIF iv_length_m <= c_length_medium.
|
||||
rv_rate = c_rate_medium.
|
||||
ELSEIF iv_length_m <= c_length_large.
|
||||
rv_rate = c_rate_large.
|
||||
ELSE.
|
||||
rv_rate = c_rate_xlarge.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_factor.
|
||||
CASE iv_boat_type.
|
||||
WHEN 'C'.
|
||||
rv_factor = c_factor_cat.
|
||||
WHEN 'M'.
|
||||
rv_factor = c_factor_motor.
|
||||
WHEN OTHERS.
|
||||
rv_factor = c_factor_sail.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD season_factor.
|
||||
IF iv_season = 'H'.
|
||||
rv_factor = c_factor_high.
|
||||
ELSE.
|
||||
rv_factor = c_factor_low.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nightly_rate.
|
||||
rv_rate = base_rate( iv_length_m ) * type_factor( iv_boat_type ) * season_factor( iv_season ).
|
||||
IF iv_power = abap_true.
|
||||
rv_rate = rv_rate + c_power_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD total_fee.
|
||||
DATA lv_total TYPE ty_fee.
|
||||
lv_total = iv_nightly * iv_nights.
|
||||
IF iv_nights >= c_discount_days.
|
||||
lv_total = round( val = lv_total * c_discount dec = 2 ).
|
||||
ENDIF.
|
||||
IF lv_total < c_min_fee.
|
||||
rv_total = c_min_fee.
|
||||
ELSE.
|
||||
rv_total = lv_total.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
64
tasks_gen/eval/G0139/reference/marina_fee.testclasses.abap
Normal file
64
tasks_gen/eval/G0139/reference/marina_fee.testclasses.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS ltc_marina_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}marina_fee.
|
||||
METHODS setup.
|
||||
METHODS minimum_fee_applies FOR TESTING.
|
||||
METHODS week_discount FOR TESTING.
|
||||
METHODS motor_in_high_season FOR TESTING.
|
||||
METHODS invalid_input_returns_zero FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_marina_fee IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}marina_fee( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee_applies.
|
||||
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
||||
lv_exp = '30.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 6
|
||||
iv_nights = 1
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD week_discount.
|
||||
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
||||
lv_exp = '201.60'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 12
|
||||
iv_nights = 7
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD motor_in_high_season.
|
||||
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
||||
lv_exp = '107.52'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 10
|
||||
iv_nights = 2
|
||||
iv_boat_type = 'M'
|
||||
iv_season = 'H'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_input_returns_zero.
|
||||
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_exp
|
||||
act = mo_cut->calculate_fee( iv_length_m = 0
|
||||
iv_nights = 3
|
||||
iv_boat_type = 'S'
|
||||
iv_season = 'L'
|
||||
iv_power = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
68
tasks_gen/eval/G0139/seed/marina_fee.clas.abap
Normal file
68
tasks_gen/eval/G0139/seed/marina_fee.clas.abap
Normal file
@@ -0,0 +1,68 @@
|
||||
CLASS {{p}}marina_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_boat_type TYPE c LENGTH 1.
|
||||
TYPES ty_season TYPE c LENGTH 1.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING
|
||||
iv_length_m TYPE i
|
||||
iv_nights TYPE i
|
||||
iv_boat_type TYPE ty_boat_type
|
||||
iv_season TYPE ty_season
|
||||
iv_power TYPE abap_bool
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}marina_fee IMPLEMENTATION.
|
||||
METHOD calculate_fee.
|
||||
DATA lv_base TYPE ty_fee.
|
||||
DATA lv_factor TYPE ty_fee.
|
||||
DATA lv_nightly TYPE ty_fee.
|
||||
DATA lv_total TYPE ty_fee.
|
||||
|
||||
IF iv_length_m <= 0 OR iv_nights <= 0.
|
||||
rv_fee = 0.
|
||||
ELSE.
|
||||
IF iv_length_m <= 8.
|
||||
lv_base = '20.00'.
|
||||
ELSE.
|
||||
IF iv_length_m <= 12.
|
||||
lv_base = '32.00'.
|
||||
ELSE.
|
||||
IF iv_length_m <= 18.
|
||||
lv_base = '48.00'.
|
||||
ELSE.
|
||||
lv_base = '75.00'.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
IF iv_boat_type = 'C'.
|
||||
lv_factor = '1.50'.
|
||||
ELSE.
|
||||
IF iv_boat_type = 'M'.
|
||||
lv_factor = '1.20'.
|
||||
ELSE.
|
||||
lv_factor = '1.00'.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
lv_nightly = lv_base * lv_factor.
|
||||
IF iv_season = 'H'.
|
||||
lv_nightly = lv_nightly * '1.40'.
|
||||
ENDIF.
|
||||
IF iv_power = abap_true.
|
||||
lv_nightly = lv_nightly + '5.00'.
|
||||
ENDIF.
|
||||
lv_total = lv_nightly * iv_nights.
|
||||
IF iv_nights >= 7.
|
||||
lv_total = lv_total * '0.90'.
|
||||
ENDIF.
|
||||
IF lv_total < '30.00'.
|
||||
rv_fee = '30.00'.
|
||||
ELSE.
|
||||
rv_fee = lv_total.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
53
tasks_gen/eval/G0139/spec.md
Normal file
53
tasks_gen/eval/G0139/spec.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# 1. Goal
|
||||
Refactor the class {{P}}MARINA_FEE in package $TMP. The class calculates the
|
||||
berthing fee of a boat in a marina. The behavior of the class must not change.
|
||||
The public interface of the class must not change. Improve the internal quality
|
||||
of the class.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The class {{P}}MARINA_FEE exists in package $TMP. It is active.
|
||||
- A marina uses the class to calculate the berthing fee of a boat.
|
||||
- The class is legacy code. The results of the class are correct. The quality of
|
||||
the code is poor.
|
||||
- The class has one public method. This method contains the complete calculation.
|
||||
- The source code of the class is the specification of the behavior. Read the
|
||||
source code before you change it.
|
||||
|
||||
# 4. Contract
|
||||
- Change the class {{P}}MARINA_FEE in package $TMP. Do not create a new class.
|
||||
- Keep the name of the class {{P}}MARINA_FEE.
|
||||
- Keep the public interface of the class. The public interface is:
|
||||
- The public types TY_BOAT_TYPE (CHAR 1), TY_SEASON (CHAR 1), and TY_FEE
|
||||
(PACKED 8, 2 decimal places).
|
||||
- The public method CALCULATE_FEE.
|
||||
- The importing parameters of CALCULATE_FEE: IV_LENGTH_M (TYPE i), IV_NIGHTS
|
||||
(TYPE i), IV_BOAT_TYPE (TYPE ty_boat_type), IV_SEASON (TYPE ty_season), and
|
||||
IV_POWER (TYPE abap_bool).
|
||||
- The returning parameter RV_FEE (TYPE ty_fee).
|
||||
- Do not change the names, the types, or the sequence of the parameters.
|
||||
- Do not add other public methods or public attributes.
|
||||
- You can change the private section of the class.
|
||||
|
||||
# 5. Business rules
|
||||
- The method CALCULATE_FEE keeps its behavior. The behavior is the behavior of
|
||||
the legacy class {{P}}MARINA_FEE in package $TMP.
|
||||
- Read the legacy source code. The legacy source code is the only specification
|
||||
of the calculation.
|
||||
- Do not change a result value. Do not add a rule. Do not remove a rule.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Methods below 40 statements. No nesting deeper
|
||||
than two levels. No magic numbers. Use constants. Use meaningful names. No
|
||||
comment that restates the code.
|
||||
- Out of scope: none.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class {{P}}MARINA_FEE is active and has no syntax error.
|
||||
- The public interface of the class is unchanged.
|
||||
- The behavior of the class is unchanged. The hidden tests pass.
|
||||
- The class has no ATC priority 1 finding and no ATC priority 2 finding.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
49
tasks_gen/eval/G0139/task.json
Normal file
49
tasks_gen/eval/G0139/task.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"id": "G0139",
|
||||
"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}}MARINA_FEE",
|
||||
"file": "seed/marina_fee.clas.abap",
|
||||
"description": "Legacy marina berth fee calculator with deep nesting and magic numbers"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}MARINA_FEE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}MARINA_FEE_HIDDEN",
|
||||
"file": "hidden/marina_fee_hidden.clas.abap",
|
||||
"description": "Hidden tests for the unchanged berth fee behavior"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}MARINA_FEE",
|
||||
"file": "reference/marina_fee.clas.abap",
|
||||
"description": "Refactored marina berth fee calculator",
|
||||
"testclasses_file": "reference/marina_fee.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"nesting_depth",
|
||||
"magic_numbers"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user