Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
71
tasks_gen/train/G1150/faulty/m0_farrier_fee.func.abap
Normal file
71
tasks_gen/train/G1150/faulty/m0_farrier_fee.func.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
CONSTANTS c_shoeing_rate TYPE decfloat34 VALUE '45'.
|
||||
CONSTANTS c_bulk_rate TYPE decfloat34 VALUE '40'.
|
||||
CONSTANTS c_bulk_from TYPE i VALUE 5.
|
||||
CONSTANTS c_new_shoes_rate TYPE decfloat34 VALUE '30'.
|
||||
CONSTANTS c_km_rate TYPE decfloat34 VALUE '0.6'.
|
||||
CONSTANTS c_travel_minimum TYPE decfloat34 VALUE '10'.
|
||||
CONSTANTS c_contract_percent TYPE decfloat34 VALUE '88'.
|
||||
CONSTANTS c_full_percent TYPE decfloat34 VALUE '100'.
|
||||
CONSTANTS c_weeks_standard TYPE i VALUE 6.
|
||||
CONSTANTS c_weeks_contract TYPE i VALUE 4.
|
||||
|
||||
IF iv_horses >= 0.
|
||||
RAISE invalid_horses.
|
||||
ENDIF.
|
||||
|
||||
IF iv_horses = 0.
|
||||
ev_reject = abap_true.
|
||||
ev_fee = 0.
|
||||
ev_weeks = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ev_reject = abap_false.
|
||||
|
||||
* Next visit: every six weeks, contract stables every four weeks.
|
||||
ev_weeks = c_weeks_standard.
|
||||
IF iv_contract = abap_true.
|
||||
ev_weeks = c_weeks_contract.
|
||||
ENDIF.
|
||||
|
||||
* Shoeing fee: the first four horses cost the standard rate, every further
|
||||
* horse costs the bulk rate.
|
||||
DATA(lv_bulk_horses) = iv_horses - c_bulk_from + 1.
|
||||
IF lv_bulk_horses < 0.
|
||||
lv_bulk_horses = 0.
|
||||
ENDIF.
|
||||
DATA(lv_standard_horses) = iv_horses - lv_bulk_horses.
|
||||
ev_fee = lv_standard_horses * c_shoeing_rate + lv_bulk_horses * c_bulk_rate.
|
||||
|
||||
* New shoes are charged for every horse.
|
||||
IF iv_new_shoes = abap_true.
|
||||
ev_fee = ev_fee + iv_horses * c_new_shoes_rate.
|
||||
ENDIF.
|
||||
|
||||
* Travel: a rate per kilometre, at least the minimum, rounded up to a whole
|
||||
* euro.
|
||||
DATA(lv_travel) = iv_km * c_km_rate.
|
||||
IF lv_travel < c_travel_minimum.
|
||||
lv_travel = c_travel_minimum.
|
||||
ENDIF.
|
||||
ev_fee = ev_fee + ceil( lv_travel ).
|
||||
|
||||
* Contract stables get a discount on the whole visit.
|
||||
IF iv_contract = abap_true.
|
||||
ev_fee = ev_fee * c_contract_percent / c_full_percent.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
71
tasks_gen/train/G1150/faulty/m1_farrier_fee.func.abap
Normal file
71
tasks_gen/train/G1150/faulty/m1_farrier_fee.func.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
CONSTANTS c_shoeing_rate TYPE decfloat34 VALUE '45'.
|
||||
CONSTANTS c_bulk_rate TYPE decfloat34 VALUE '40'.
|
||||
CONSTANTS c_bulk_from TYPE i VALUE 5.
|
||||
CONSTANTS c_new_shoes_rate TYPE decfloat34 VALUE '30'.
|
||||
CONSTANTS c_km_rate TYPE decfloat34 VALUE '0.6'.
|
||||
CONSTANTS c_travel_minimum TYPE decfloat34 VALUE '10'.
|
||||
CONSTANTS c_contract_percent TYPE decfloat34 VALUE '88'.
|
||||
CONSTANTS c_full_percent TYPE decfloat34 VALUE '100'.
|
||||
CONSTANTS c_weeks_standard TYPE i VALUE 6.
|
||||
CONSTANTS c_weeks_contract TYPE i VALUE 4.
|
||||
|
||||
IF iv_horses < 0.
|
||||
RAISE invalid_horses.
|
||||
ENDIF.
|
||||
|
||||
IF iv_horses = 0.
|
||||
ev_reject = abap_true.
|
||||
ev_fee = 0.
|
||||
ev_weeks = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ev_reject = abap_false.
|
||||
|
||||
* Next visit: every six weeks, contract stables every four weeks.
|
||||
ev_weeks = c_weeks_standard.
|
||||
IF iv_contract = abap_false.
|
||||
ev_weeks = c_weeks_contract.
|
||||
ENDIF.
|
||||
|
||||
* Shoeing fee: the first four horses cost the standard rate, every further
|
||||
* horse costs the bulk rate.
|
||||
DATA(lv_bulk_horses) = iv_horses - c_bulk_from + 1.
|
||||
IF lv_bulk_horses < 0.
|
||||
lv_bulk_horses = 0.
|
||||
ENDIF.
|
||||
DATA(lv_standard_horses) = iv_horses - lv_bulk_horses.
|
||||
ev_fee = lv_standard_horses * c_shoeing_rate + lv_bulk_horses * c_bulk_rate.
|
||||
|
||||
* New shoes are charged for every horse.
|
||||
IF iv_new_shoes = abap_true.
|
||||
ev_fee = ev_fee + iv_horses * c_new_shoes_rate.
|
||||
ENDIF.
|
||||
|
||||
* Travel: a rate per kilometre, at least the minimum, rounded up to a whole
|
||||
* euro.
|
||||
DATA(lv_travel) = iv_km * c_km_rate.
|
||||
IF lv_travel < c_travel_minimum.
|
||||
lv_travel = c_travel_minimum.
|
||||
ENDIF.
|
||||
ev_fee = ev_fee + ceil( lv_travel ).
|
||||
|
||||
* Contract stables get a discount on the whole visit.
|
||||
IF iv_contract = abap_true.
|
||||
ev_fee = ev_fee * c_contract_percent / c_full_percent.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
71
tasks_gen/train/G1150/faulty/m2_farrier_fee.func.abap
Normal file
71
tasks_gen/train/G1150/faulty/m2_farrier_fee.func.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
CONSTANTS c_shoeing_rate TYPE decfloat34 VALUE '45'.
|
||||
CONSTANTS c_bulk_rate TYPE decfloat34 VALUE '40'.
|
||||
CONSTANTS c_bulk_from TYPE i VALUE 5.
|
||||
CONSTANTS c_new_shoes_rate TYPE decfloat34 VALUE '30'.
|
||||
CONSTANTS c_km_rate TYPE decfloat34 VALUE '0.6'.
|
||||
CONSTANTS c_travel_minimum TYPE decfloat34 VALUE '10'.
|
||||
CONSTANTS c_contract_percent TYPE decfloat34 VALUE '88'.
|
||||
CONSTANTS c_full_percent TYPE decfloat34 VALUE '100'.
|
||||
CONSTANTS c_weeks_standard TYPE i VALUE 6.
|
||||
CONSTANTS c_weeks_contract TYPE i VALUE 4.
|
||||
|
||||
IF iv_horses < 0.
|
||||
RAISE invalid_horses.
|
||||
ENDIF.
|
||||
|
||||
IF iv_horses = 0.
|
||||
ev_reject = abap_true.
|
||||
ev_fee = 0.
|
||||
ev_weeks = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ev_reject = abap_false.
|
||||
|
||||
* Next visit: every six weeks, contract stables every four weeks.
|
||||
ev_weeks = c_weeks_standard.
|
||||
IF iv_contract = abap_true.
|
||||
ev_weeks = c_weeks_contract.
|
||||
ENDIF.
|
||||
|
||||
* Shoeing fee: the first four horses cost the standard rate, every further
|
||||
* horse costs the bulk rate.
|
||||
DATA(lv_bulk_horses) = iv_horses - c_bulk_from + 1.
|
||||
IF lv_bulk_horses < 0.
|
||||
lv_bulk_horses = 0.
|
||||
ENDIF.
|
||||
DATA(lv_standard_horses) = iv_horses - lv_bulk_horses.
|
||||
ev_fee = lv_standard_horses * c_shoeing_rate + lv_bulk_horses * c_bulk_rate.
|
||||
|
||||
* New shoes are charged for every horse.
|
||||
IF iv_new_shoes <> abap_true.
|
||||
ev_fee = ev_fee + iv_horses * c_new_shoes_rate.
|
||||
ENDIF.
|
||||
|
||||
* Travel: a rate per kilometre, at least the minimum, rounded up to a whole
|
||||
* euro.
|
||||
DATA(lv_travel) = iv_km * c_km_rate.
|
||||
IF lv_travel < c_travel_minimum.
|
||||
lv_travel = c_travel_minimum.
|
||||
ENDIF.
|
||||
ev_fee = ev_fee + ceil( lv_travel ).
|
||||
|
||||
* Contract stables get a discount on the whole visit.
|
||||
IF iv_contract = abap_true.
|
||||
ev_fee = ev_fee * c_contract_percent / c_full_percent.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
71
tasks_gen/train/G1150/faulty/m3_farrier_fee.func.abap
Normal file
71
tasks_gen/train/G1150/faulty/m3_farrier_fee.func.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
CONSTANTS c_shoeing_rate TYPE decfloat34 VALUE '45'.
|
||||
CONSTANTS c_bulk_rate TYPE decfloat34 VALUE '40'.
|
||||
CONSTANTS c_bulk_from TYPE i VALUE 5.
|
||||
CONSTANTS c_new_shoes_rate TYPE decfloat34 VALUE '30'.
|
||||
CONSTANTS c_km_rate TYPE decfloat34 VALUE '0.6'.
|
||||
CONSTANTS c_travel_minimum TYPE decfloat34 VALUE '10'.
|
||||
CONSTANTS c_contract_percent TYPE decfloat34 VALUE '88'.
|
||||
CONSTANTS c_full_percent TYPE decfloat34 VALUE '100'.
|
||||
CONSTANTS c_weeks_standard TYPE i VALUE 6.
|
||||
CONSTANTS c_weeks_contract TYPE i VALUE 4.
|
||||
|
||||
IF iv_horses < 0.
|
||||
RAISE invalid_horses.
|
||||
ENDIF.
|
||||
|
||||
IF iv_horses = 0.
|
||||
ev_reject = abap_true.
|
||||
ev_fee = 0.
|
||||
ev_weeks = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ev_reject = abap_false.
|
||||
|
||||
* Next visit: every six weeks, contract stables every four weeks.
|
||||
ev_weeks = c_weeks_standard.
|
||||
IF iv_contract = abap_true.
|
||||
ev_weeks = c_weeks_contract.
|
||||
ENDIF.
|
||||
|
||||
* Shoeing fee: the first four horses cost the standard rate, every further
|
||||
* horse costs the bulk rate.
|
||||
DATA(lv_bulk_horses) = iv_horses - c_bulk_from + 1.
|
||||
IF lv_bulk_horses < 0.
|
||||
lv_bulk_horses = 0.
|
||||
ENDIF.
|
||||
DATA(lv_standard_horses) = iv_horses - lv_bulk_horses.
|
||||
ev_fee = lv_standard_horses * c_shoeing_rate + lv_bulk_horses * c_bulk_rate.
|
||||
|
||||
* New shoes are charged for every horse.
|
||||
IF iv_new_shoes = abap_true.
|
||||
ev_fee = ev_fee - iv_horses * c_new_shoes_rate.
|
||||
ENDIF.
|
||||
|
||||
* Travel: a rate per kilometre, at least the minimum, rounded up to a whole
|
||||
* euro.
|
||||
DATA(lv_travel) = iv_km * c_km_rate.
|
||||
IF lv_travel < c_travel_minimum.
|
||||
lv_travel = c_travel_minimum.
|
||||
ENDIF.
|
||||
ev_fee = ev_fee + ceil( lv_travel ).
|
||||
|
||||
* Contract stables get a discount on the whole visit.
|
||||
IF iv_contract = abap_true.
|
||||
ev_fee = ev_fee * c_contract_percent / c_full_percent.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
71
tasks_gen/train/G1150/faulty/m4_farrier_fee.func.abap
Normal file
71
tasks_gen/train/G1150/faulty/m4_farrier_fee.func.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
CONSTANTS c_shoeing_rate TYPE decfloat34 VALUE '45'.
|
||||
CONSTANTS c_bulk_rate TYPE decfloat34 VALUE '40'.
|
||||
CONSTANTS c_bulk_from TYPE i VALUE 5.
|
||||
CONSTANTS c_new_shoes_rate TYPE decfloat34 VALUE '30'.
|
||||
CONSTANTS c_km_rate TYPE decfloat34 VALUE '0.6'.
|
||||
CONSTANTS c_travel_minimum TYPE decfloat34 VALUE '10'.
|
||||
CONSTANTS c_contract_percent TYPE decfloat34 VALUE '88'.
|
||||
CONSTANTS c_full_percent TYPE decfloat34 VALUE '100'.
|
||||
CONSTANTS c_weeks_standard TYPE i VALUE 6.
|
||||
CONSTANTS c_weeks_contract TYPE i VALUE 4.
|
||||
|
||||
IF iv_horses < 0.
|
||||
RAISE invalid_horses.
|
||||
ENDIF.
|
||||
|
||||
IF iv_horses = 0.
|
||||
ev_reject = abap_true.
|
||||
ev_fee = 0.
|
||||
ev_weeks = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ev_reject = abap_false.
|
||||
|
||||
* Next visit: every six weeks, contract stables every four weeks.
|
||||
ev_weeks = c_weeks_standard.
|
||||
IF iv_contract = abap_true.
|
||||
ev_weeks = c_weeks_contract.
|
||||
ENDIF.
|
||||
|
||||
* Shoeing fee: the first four horses cost the standard rate, every further
|
||||
* horse costs the bulk rate.
|
||||
DATA(lv_bulk_horses) = iv_horses - c_bulk_from + 1.
|
||||
IF lv_bulk_horses < 0.
|
||||
lv_bulk_horses = 0.
|
||||
ENDIF.
|
||||
DATA(lv_standard_horses) = iv_horses - lv_bulk_horses.
|
||||
ev_fee = lv_standard_horses * c_shoeing_rate + lv_bulk_horses * c_bulk_rate.
|
||||
|
||||
* New shoes are charged for every horse.
|
||||
IF iv_new_shoes = abap_true.
|
||||
ev_fee = ev_fee + iv_horses * c_new_shoes_rate.
|
||||
ENDIF.
|
||||
|
||||
* Travel: a rate per kilometre, at least the minimum, rounded up to a whole
|
||||
* euro.
|
||||
DATA(lv_travel) = iv_km * c_km_rate.
|
||||
IF lv_travel < c_travel_minimum.
|
||||
lv_travel = c_travel_minimum.
|
||||
ENDIF.
|
||||
ev_fee = ev_fee + ceil( lv_travel ).
|
||||
|
||||
* Contract stables get a discount on the whole visit.
|
||||
IF iv_contract = abap_true.
|
||||
ev_fee = ev_fee / c_contract_percent / c_full_percent.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
65
tasks_gen/train/G1150/generation.json
Normal file
65
tasks_gen/train/G1150/generation.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"id": "G1150",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/t14_test.clas.abap line 50: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/t14_test.clas.abap line 52: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/t14_test.clas.abap line 52: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"1\"",
|
||||
"reference/t14_test.clas.abap line 62: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\"",
|
||||
"reference/t14_test.clas.abap line 62: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"hidden/t14_hidden.clas.abap line 51: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\"",
|
||||
"hidden/t14_hidden.clas.abap line 51: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"hidden/t14_hidden.clas.abap line 64: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\"",
|
||||
"hidden/t14_hidden.clas.abap line 64: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"hidden/t14_hidden.clas.abap line 82: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 82: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"1\"",
|
||||
"hidden/t14_hidden.clas.abap line 93: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 93: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"6\"",
|
||||
"hidden/t14_hidden.clas.abap line 100: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 100: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"Too close to task G0144 (similarity spec 0.72, rules 0.67, names 0.00). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 15,
|
||||
"extra": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"Too close to task G0144 (similarity spec 0.77, rules 0.72, names 0.25). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"extra": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/farrier_test.clas.abap line 75: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_visit\"",
|
||||
"reference/farrier_test.clas.abap line 75: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"hidden/farrier_hidden.clas.abap line 138: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_visit\"",
|
||||
"hidden/farrier_hidden.clas.abap line 138: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
169
tasks_gen/train/G1150/hidden/farrier_hidden.clas.abap
Normal file
169
tasks_gen/train/G1150/hidden/farrier_hidden.clas.abap
Normal file
@@ -0,0 +1,169 @@
|
||||
CLASS {{p}}farrier_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS run_visit
|
||||
IMPORTING iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS negative_horses FOR TESTING.
|
||||
METHODS zero_horses_rejected FOR TESTING.
|
||||
METHODS standard_visit FOR TESTING.
|
||||
METHODS four_horses_standard FOR TESTING.
|
||||
METHODS bulk_rate_from_fifth FOR TESTING.
|
||||
METHODS new_shoes_charge FOR TESTING.
|
||||
METHODS travel_minimum FOR TESTING.
|
||||
METHODS travel_rounded_up FOR TESTING.
|
||||
METHODS contract_discount FOR TESTING.
|
||||
METHODS contract_and_shoes FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}farrier_hidden IMPLEMENTATION.
|
||||
METHOD run_visit.
|
||||
CALL FUNCTION '{{P}}FARRIER_FEE'
|
||||
EXPORTING
|
||||
iv_horses = iv_horses
|
||||
iv_km = iv_km
|
||||
iv_new_shoes = iv_new_shoes
|
||||
iv_contract = iv_contract
|
||||
IMPORTING
|
||||
ev_fee = ev_fee
|
||||
ev_weeks = ev_weeks
|
||||
ev_reject = ev_reject
|
||||
EXCEPTIONS
|
||||
invalid_horses = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_horses.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
run_visit( EXPORTING iv_horses = -1 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_horses_rejected.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '0'.
|
||||
run_visit( EXPORTING iv_horses = 0 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_true( lv_reject ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD standard_visit.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '100'.
|
||||
run_visit( EXPORTING iv_horses = 2 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_false( lv_reject ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD four_horses_standard.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '190'.
|
||||
run_visit( EXPORTING iv_horses = 4 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bulk_rate_from_fifth.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '230'.
|
||||
run_visit( EXPORTING iv_horses = 5 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD new_shoes_charge.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '160'.
|
||||
run_visit( EXPORTING iv_horses = 2 iv_km = 10 iv_new_shoes = abap_true iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_minimum.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '55'.
|
||||
run_visit( EXPORTING iv_horses = 1 iv_km = 3 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_rounded_up.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '61'.
|
||||
run_visit( EXPORTING iv_horses = 1 iv_km = 26 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD contract_discount.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '88'.
|
||||
run_visit( EXPORTING iv_horses = 2 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_true
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD contract_and_shoes.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '352'.
|
||||
run_visit( EXPORTING iv_horses = 5 iv_km = 50 iv_new_shoes = abap_true iv_contract = abap_true
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
76
tasks_gen/train/G1150/mutation.json
Normal file
76
tasks_gen/train/G1150/mutation.json
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"task": "G1150",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}FARRIER_FEE",
|
||||
"mutant": "line 25: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "0/10",
|
||||
"failed_tests": [
|
||||
"BULK_RATE_FROM_FIFTH",
|
||||
"CONTRACT_AND_SHOES",
|
||||
"CONTRACT_DISCOUNT",
|
||||
"FOUR_HORSES_STANDARD",
|
||||
"NEGATIVE_HORSES",
|
||||
"NEW_SHOES_CHARGE",
|
||||
"STANDARD_VISIT",
|
||||
"TRAVEL_MINIMUM",
|
||||
"TRAVEL_ROUNDED_UP",
|
||||
"ZERO_HORSES_REJECTED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}FARRIER_FEE",
|
||||
"mutant": "line 40: abap_true -> abap_false (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "5/10",
|
||||
"failed_tests": [
|
||||
"BULK_RATE_FROM_FIFTH",
|
||||
"CONTRACT_AND_SHOES",
|
||||
"CONTRACT_DISCOUNT",
|
||||
"NEW_SHOES_CHARGE",
|
||||
"STANDARD_VISIT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}FARRIER_FEE",
|
||||
"mutant": "line 54: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "2/10",
|
||||
"failed_tests": [
|
||||
"BULK_RATE_FROM_FIFTH",
|
||||
"CONTRACT_AND_SHOES",
|
||||
"CONTRACT_DISCOUNT",
|
||||
"FOUR_HORSES_STANDARD",
|
||||
"NEW_SHOES_CHARGE",
|
||||
"STANDARD_VISIT",
|
||||
"TRAVEL_MINIMUM",
|
||||
"TRAVEL_ROUNDED_UP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}FARRIER_FEE",
|
||||
"mutant": "line 55: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"CONTRACT_AND_SHOES",
|
||||
"NEW_SHOES_CHARGE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}FARRIER_FEE",
|
||||
"mutant": "line 68: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"CONTRACT_AND_SHOES",
|
||||
"CONTRACT_DISCOUNT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
71
tasks_gen/train/G1150/reference/farrier_fee.func.abap
Normal file
71
tasks_gen/train/G1150/reference/farrier_fee.func.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
CONSTANTS c_shoeing_rate TYPE decfloat34 VALUE '45'.
|
||||
CONSTANTS c_bulk_rate TYPE decfloat34 VALUE '40'.
|
||||
CONSTANTS c_bulk_from TYPE i VALUE 5.
|
||||
CONSTANTS c_new_shoes_rate TYPE decfloat34 VALUE '30'.
|
||||
CONSTANTS c_km_rate TYPE decfloat34 VALUE '0.6'.
|
||||
CONSTANTS c_travel_minimum TYPE decfloat34 VALUE '10'.
|
||||
CONSTANTS c_contract_percent TYPE decfloat34 VALUE '88'.
|
||||
CONSTANTS c_full_percent TYPE decfloat34 VALUE '100'.
|
||||
CONSTANTS c_weeks_standard TYPE i VALUE 6.
|
||||
CONSTANTS c_weeks_contract TYPE i VALUE 4.
|
||||
|
||||
IF iv_horses < 0.
|
||||
RAISE invalid_horses.
|
||||
ENDIF.
|
||||
|
||||
IF iv_horses = 0.
|
||||
ev_reject = abap_true.
|
||||
ev_fee = 0.
|
||||
ev_weeks = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ev_reject = abap_false.
|
||||
|
||||
* Next visit: every six weeks, contract stables every four weeks.
|
||||
ev_weeks = c_weeks_standard.
|
||||
IF iv_contract = abap_true.
|
||||
ev_weeks = c_weeks_contract.
|
||||
ENDIF.
|
||||
|
||||
* Shoeing fee: the first four horses cost the standard rate, every further
|
||||
* horse costs the bulk rate.
|
||||
DATA(lv_bulk_horses) = iv_horses - c_bulk_from + 1.
|
||||
IF lv_bulk_horses < 0.
|
||||
lv_bulk_horses = 0.
|
||||
ENDIF.
|
||||
DATA(lv_standard_horses) = iv_horses - lv_bulk_horses.
|
||||
ev_fee = lv_standard_horses * c_shoeing_rate + lv_bulk_horses * c_bulk_rate.
|
||||
|
||||
* New shoes are charged for every horse.
|
||||
IF iv_new_shoes = abap_true.
|
||||
ev_fee = ev_fee + iv_horses * c_new_shoes_rate.
|
||||
ENDIF.
|
||||
|
||||
* Travel: a rate per kilometre, at least the minimum, rounded up to a whole
|
||||
* euro.
|
||||
DATA(lv_travel) = iv_km * c_km_rate.
|
||||
IF lv_travel < c_travel_minimum.
|
||||
lv_travel = c_travel_minimum.
|
||||
ENDIF.
|
||||
ev_fee = ev_fee + ceil( lv_travel ).
|
||||
|
||||
* Contract stables get a discount on the whole visit.
|
||||
IF iv_contract = abap_true.
|
||||
ev_fee = ev_fee * c_contract_percent / c_full_percent.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
108
tasks_gen/train/G1150/reference/farrier_test.clas.abap
Normal file
108
tasks_gen/train/G1150/reference/farrier_test.clas.abap
Normal file
@@ -0,0 +1,108 @@
|
||||
CLASS {{p}}farrier_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS run_visit
|
||||
IMPORTING iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS standard_visit FOR TESTING.
|
||||
METHODS bulk_visit FOR TESTING.
|
||||
METHODS travel_rules FOR TESTING.
|
||||
METHODS contract_visit FOR TESTING.
|
||||
METHODS rejected_and_invalid FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}farrier_test IMPLEMENTATION.
|
||||
METHOD run_visit.
|
||||
CALL FUNCTION '{{P}}FARRIER_FEE'
|
||||
EXPORTING
|
||||
iv_horses = iv_horses
|
||||
iv_km = iv_km
|
||||
iv_new_shoes = iv_new_shoes
|
||||
iv_contract = iv_contract
|
||||
IMPORTING
|
||||
ev_fee = ev_fee
|
||||
ev_weeks = ev_weeks
|
||||
ev_reject = ev_reject
|
||||
EXCEPTIONS
|
||||
invalid_horses = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD standard_visit.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '100'.
|
||||
run_visit( EXPORTING iv_horses = 2 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_false( lv_reject ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bulk_visit.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '230'.
|
||||
run_visit( EXPORTING iv_horses = 5 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_rules.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_minimum TYPE decfloat34 VALUE '55'.
|
||||
DATA lv_rounded TYPE decfloat34 VALUE '61'.
|
||||
run_visit( EXPORTING iv_horses = 1 iv_km = 3 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_minimum act = lv_fee ).
|
||||
run_visit( EXPORTING iv_horses = 1 iv_km = 26 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_rounded act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD contract_visit.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '352'.
|
||||
run_visit( EXPORTING iv_horses = 5 iv_km = 50 iv_new_shoes = abap_true iv_contract = abap_true
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_weeks ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejected_and_invalid.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_weeks TYPE i.
|
||||
DATA lv_reject TYPE abap_bool.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
DATA lv_expected TYPE decfloat34 VALUE '0'.
|
||||
run_visit( EXPORTING iv_horses = 0 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_true( lv_reject ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_weeks ).
|
||||
run_visit( EXPORTING iv_horses = -1 iv_km = 10 iv_new_shoes = abap_false iv_contract = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_weeks = lv_weeks ev_reject = lv_reject ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
64
tasks_gen/train/G1150/seed/farrier_fee.func.abap
Normal file
64
tasks_gen/train/G1150/seed/farrier_fee.func.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
FUNCTION {{p}}farrier_fee
|
||||
IMPORTING
|
||||
iv_horses TYPE i
|
||||
iv_km TYPE decfloat34
|
||||
iv_new_shoes TYPE abap_bool
|
||||
iv_contract TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_weeks TYPE i
|
||||
ev_reject TYPE abap_bool
|
||||
EXCEPTIONS
|
||||
invalid_horses.
|
||||
|
||||
* Farrier service - mobile shoeing round
|
||||
* Calculation of one visit
|
||||
* Last change: 22.09.1996 / W. Klose
|
||||
|
||||
DATA: lv_horses TYPE i,
|
||||
lv_fee TYPE decfloat34,
|
||||
lv_travel TYPE decfloat34,
|
||||
lv_weeks TYPE i.
|
||||
|
||||
MOVE iv_horses TO lv_horses.
|
||||
|
||||
IF lv_horses LT 0.
|
||||
RAISE invalid_horses.
|
||||
ELSE.
|
||||
CLEAR: ev_fee, ev_weeks.
|
||||
ev_reject = abap_false.
|
||||
IF lv_horses EQ 0.
|
||||
ev_reject = abap_true.
|
||||
ELSE.
|
||||
* shoeing fee: 45.00 per horse, from the fifth horse 40.00
|
||||
IF lv_horses LE 4.
|
||||
COMPUTE lv_fee = lv_horses * 45.
|
||||
ELSE.
|
||||
COMPUTE lv_fee = 4 * 45 + ( lv_horses - 4 ) * 40.
|
||||
ENDIF.
|
||||
* new shoes are charged for every horse
|
||||
IF iv_new_shoes EQ abap_true.
|
||||
COMPUTE lv_fee = lv_fee + lv_horses * 30.
|
||||
ENDIF.
|
||||
* travel: 60 cent per kilometre, at least 10.00, rounded up to whole euro
|
||||
COMPUTE lv_travel = iv_km * 60 / 100.
|
||||
IF lv_travel LT 10.
|
||||
lv_travel = 10.
|
||||
ENDIF.
|
||||
COMPUTE lv_travel = CEIL( lv_travel ).
|
||||
COMPUTE lv_fee = lv_fee + lv_travel.
|
||||
* contract stables get 12 per cent off the visit
|
||||
IF iv_contract EQ abap_true.
|
||||
COMPUTE lv_fee = lv_fee * 88 / 100.
|
||||
ENDIF.
|
||||
* next visit: every six weeks, contract stables every four weeks
|
||||
lv_weeks = 6.
|
||||
IF iv_contract EQ abap_true.
|
||||
lv_weeks = 4.
|
||||
ENDIF.
|
||||
MOVE lv_fee TO ev_fee.
|
||||
ev_weeks = lv_weeks.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
64
tasks_gen/train/G1150/spec.md
Normal file
64
tasks_gen/train/G1150/spec.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# 1. Goal
|
||||
|
||||
A farrier serves stables with a mobile shoeing round. The order desk calls the
|
||||
function module {{P}}FARRIER_FEE once for each planned visit. The module returns
|
||||
the fee of the visit, the number of weeks until the next visit, and a flag that
|
||||
tells the desk that the visit must not be planned.
|
||||
|
||||
The module already exists in package $TMP. Its implementation is old code. The
|
||||
code works, but it mixes several rules in one block and it uses hard-coded
|
||||
numbers. Rewrite it so that a new colleague can read and change it.
|
||||
|
||||
The name and the public interface of the module must not change. The result of
|
||||
the module must not change for any input.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- The function group {{P}}FG_FARRIER exists in package $TMP.
|
||||
- The function module {{P}}FARRIER_FEE is in this group and is active.
|
||||
- The order desk and two planning programs call the module. They rely on the
|
||||
current interface and on the current results.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
Function module {{P}}FARRIER_FEE in function group {{P}}FG_FARRIER. Keep the
|
||||
name and the interface. Do not add, remove or rename a parameter.
|
||||
|
||||
| Name | Kind | Type |
|
||||
| --- | --- | --- |
|
||||
| iv_horses | importing | i |
|
||||
| iv_km | importing | decfloat34 |
|
||||
| iv_new_shoes | importing | abap_bool |
|
||||
| iv_contract | importing | abap_bool |
|
||||
| ev_fee | exporting | decfloat34 |
|
||||
| ev_weeks | exporting | i |
|
||||
| ev_reject | exporting | abap_bool |
|
||||
| invalid_horses | exception | - |
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
The rules of the shoeing round are in the current implementation of
|
||||
{{P}}FARRIER_FEE. Read that source. Every rule that the current code applies
|
||||
stays in force. The module must return the same values as before for every
|
||||
combination of input values.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: 7.58.
|
||||
- Coding standards: Clean ABAP. Give every value a meaningful name. Replace
|
||||
hard-coded numbers with constants. Keep the procedures short and comment each
|
||||
rule.
|
||||
- The module stays in package $TMP.
|
||||
- Out of scope: none.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- {{P}}FARRIER_FEE is active and free of syntax errors.
|
||||
- The returned values are unchanged.
|
||||
- The hidden tests pass.
|
||||
- Add ABAP Unit tests for the module in a global test class.
|
||||
- No ATC finding of priority 1 or priority 2.
|
||||
90
tasks_gen/train/G1150/task.json
Normal file
90
tasks_gen/train/G1150/task.json
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"id": "G1150",
|
||||
"category": "E",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v758",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_FARRIER",
|
||||
"description": "Mobile farrier shoeing round"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}FARRIER_FEE",
|
||||
"functionGroup": "{{P}}FG_FARRIER",
|
||||
"file": "seed/farrier_fee.func.abap",
|
||||
"description": "Legacy calculation of one shoeing visit"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}FARRIER_FEE",
|
||||
"functionGroup": "{{P}}FG_FARRIER",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_horses",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_km",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_new_shoes",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "iv_contract",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_fee",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "ev_weeks",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "ev_reject",
|
||||
"type": "abap_bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}FARRIER_HIDDEN",
|
||||
"file": "hidden/farrier_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}FARRIER_FEE",
|
||||
"functionGroup": "{{P}}FG_FARRIER",
|
||||
"file": "reference/farrier_fee.func.abap",
|
||||
"description": "Refactored calculation of one shoeing visit"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}FARRIER_TEST",
|
||||
"file": "reference/farrier_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user