Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
49
tasks_gen/train/G1003/faulty/m0_drone_checker.clas.abap
Normal file
49
tasks_gen/train/G1003/faulty/m0_drone_checker.clas.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
CLASS {{p}}drone_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_drone_check.
|
||||
|
||||
METHODS required_battery
|
||||
IMPORTING iv_distance TYPE {{p}}if_drone_check=>ty_distance
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_drone_check=>ty_percent.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_payload TYPE {{p}}if_drone_check=>ty_weight VALUE '5.00',
|
||||
c_max_distance TYPE {{p}}if_drone_check=>ty_distance VALUE '20.00',
|
||||
c_max_wind TYPE {{p}}if_drone_check=>ty_speed VALUE '12.00',
|
||||
c_reserve TYPE {{p}}if_drone_check=>ty_percent VALUE 10,
|
||||
c_percent_per_km TYPE {{p}}if_drone_check=>ty_percent VALUE 2.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}drone_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_drone_check~check.
|
||||
IF iv_payload <= 0 AND iv_payload > c_max_payload.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-payload.
|
||||
ELSEIF iv_distance <= 0 OR iv_distance > c_max_distance.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-distance.
|
||||
ELSEIF iv_wind_speed > c_max_wind.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-wind.
|
||||
ELSEIF iv_battery < required_battery( iv_distance ).
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-battery.
|
||||
ELSEIF iv_in_zone = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-zone.
|
||||
ELSEIF iv_daylight = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-light.
|
||||
ELSE.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery.
|
||||
IF iv_distance <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_km TYPE i.
|
||||
lv_km = iv_distance.
|
||||
IF lv_km < iv_distance.
|
||||
lv_km = lv_km + 1.
|
||||
ENDIF.
|
||||
rv_percent = lv_km * c_percent_per_km + c_reserve.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
49
tasks_gen/train/G1003/faulty/m1_drone_checker.clas.abap
Normal file
49
tasks_gen/train/G1003/faulty/m1_drone_checker.clas.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
CLASS {{p}}drone_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_drone_check.
|
||||
|
||||
METHODS required_battery
|
||||
IMPORTING iv_distance TYPE {{p}}if_drone_check=>ty_distance
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_drone_check=>ty_percent.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_payload TYPE {{p}}if_drone_check=>ty_weight VALUE '5.00',
|
||||
c_max_distance TYPE {{p}}if_drone_check=>ty_distance VALUE '20.00',
|
||||
c_max_wind TYPE {{p}}if_drone_check=>ty_speed VALUE '12.00',
|
||||
c_reserve TYPE {{p}}if_drone_check=>ty_percent VALUE 10,
|
||||
c_percent_per_km TYPE {{p}}if_drone_check=>ty_percent VALUE 2.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}drone_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_drone_check~check.
|
||||
IF iv_payload <= 0 OR iv_payload > c_max_payload.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-payload.
|
||||
ELSEIF iv_distance <= 0 OR iv_distance <= c_max_distance.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-distance.
|
||||
ELSEIF iv_wind_speed > c_max_wind.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-wind.
|
||||
ELSEIF iv_battery < required_battery( iv_distance ).
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-battery.
|
||||
ELSEIF iv_in_zone = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-zone.
|
||||
ELSEIF iv_daylight = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-light.
|
||||
ELSE.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery.
|
||||
IF iv_distance <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_km TYPE i.
|
||||
lv_km = iv_distance.
|
||||
IF lv_km < iv_distance.
|
||||
lv_km = lv_km + 1.
|
||||
ENDIF.
|
||||
rv_percent = lv_km * c_percent_per_km + c_reserve.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
49
tasks_gen/train/G1003/faulty/m2_drone_checker.clas.abap
Normal file
49
tasks_gen/train/G1003/faulty/m2_drone_checker.clas.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
CLASS {{p}}drone_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_drone_check.
|
||||
|
||||
METHODS required_battery
|
||||
IMPORTING iv_distance TYPE {{p}}if_drone_check=>ty_distance
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_drone_check=>ty_percent.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_payload TYPE {{p}}if_drone_check=>ty_weight VALUE '5.00',
|
||||
c_max_distance TYPE {{p}}if_drone_check=>ty_distance VALUE '20.00',
|
||||
c_max_wind TYPE {{p}}if_drone_check=>ty_speed VALUE '12.00',
|
||||
c_reserve TYPE {{p}}if_drone_check=>ty_percent VALUE 10,
|
||||
c_percent_per_km TYPE {{p}}if_drone_check=>ty_percent VALUE 2.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}drone_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_drone_check~check.
|
||||
IF iv_payload <= 0 OR iv_payload > c_max_payload.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-payload.
|
||||
ELSEIF iv_distance <= 0 OR iv_distance > c_max_distance.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-distance.
|
||||
ELSEIF iv_wind_speed > c_max_wind.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-wind.
|
||||
ELSEIF iv_battery < required_battery( iv_distance ).
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-battery.
|
||||
ELSEIF iv_in_zone <> abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-zone.
|
||||
ELSEIF iv_daylight = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-light.
|
||||
ELSE.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery.
|
||||
IF iv_distance <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_km TYPE i.
|
||||
lv_km = iv_distance.
|
||||
IF lv_km < iv_distance.
|
||||
lv_km = lv_km + 1.
|
||||
ENDIF.
|
||||
rv_percent = lv_km * c_percent_per_km + c_reserve.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
49
tasks_gen/train/G1003/faulty/m3_drone_checker.clas.abap
Normal file
49
tasks_gen/train/G1003/faulty/m3_drone_checker.clas.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
CLASS {{p}}drone_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_drone_check.
|
||||
|
||||
METHODS required_battery
|
||||
IMPORTING iv_distance TYPE {{p}}if_drone_check=>ty_distance
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_drone_check=>ty_percent.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_payload TYPE {{p}}if_drone_check=>ty_weight VALUE '5.00',
|
||||
c_max_distance TYPE {{p}}if_drone_check=>ty_distance VALUE '20.00',
|
||||
c_max_wind TYPE {{p}}if_drone_check=>ty_speed VALUE '12.00',
|
||||
c_reserve TYPE {{p}}if_drone_check=>ty_percent VALUE 10,
|
||||
c_percent_per_km TYPE {{p}}if_drone_check=>ty_percent VALUE 2.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}drone_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_drone_check~check.
|
||||
IF iv_payload <= 0 OR iv_payload > c_max_payload.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-payload.
|
||||
ELSEIF iv_distance <= 0 OR iv_distance > c_max_distance.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-distance.
|
||||
ELSEIF iv_wind_speed > c_max_wind.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-wind.
|
||||
ELSEIF iv_battery < required_battery( iv_distance ).
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-battery.
|
||||
ELSEIF iv_in_zone = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-zone.
|
||||
ELSEIF iv_daylight = abap_true.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-light.
|
||||
ELSE.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery.
|
||||
IF iv_distance <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_km TYPE i.
|
||||
lv_km = iv_distance.
|
||||
IF lv_km < iv_distance.
|
||||
lv_km = lv_km + 1.
|
||||
ENDIF.
|
||||
rv_percent = lv_km * c_percent_per_km + c_reserve.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
24
tasks_gen/train/G1003/generation.json
Normal file
24
tasks_gen/train/G1003/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1003",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 70.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
172
tasks_gen/train/G1003/hidden/t21_hidden.clas.abap
Normal file
172
tasks_gen/train/G1003/hidden/t21_hidden.clas.abap
Normal file
@@ -0,0 +1,172 @@
|
||||
CLASS {{p}}t21_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_drone_check.
|
||||
DATA mo_drone TYPE REF TO {{p}}drone_checker.
|
||||
|
||||
METHODS setup.
|
||||
|
||||
METHODS ok_flight FOR TESTING.
|
||||
METHODS payload_zero FOR TESTING.
|
||||
METHODS payload_too_heavy FOR TESTING.
|
||||
METHODS distance_zero FOR TESTING.
|
||||
METHODS distance_too_far FOR TESTING.
|
||||
METHODS wind_too_strong FOR TESTING.
|
||||
METHODS battery_too_low FOR TESTING.
|
||||
METHODS battery_exact_ok FOR TESTING.
|
||||
METHODS outside_zone FOR TESTING.
|
||||
METHODS no_daylight FOR TESTING.
|
||||
METHODS required_battery_rounds_up FOR TESTING.
|
||||
METHODS order_payload_first FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t21_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_drone = NEW {{p}}drone_checker( ).
|
||||
mo_cut = mo_drone.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ok_flight.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-ok
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-ok
|
||||
act = mo_cut->check( iv_payload = '5.00'
|
||||
iv_distance = '20.00'
|
||||
iv_wind_speed = '12.00'
|
||||
iv_battery = 50
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD payload_zero.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-payload
|
||||
act = mo_cut->check( iv_payload = '0.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD payload_too_heavy.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-payload
|
||||
act = mo_cut->check( iv_payload = '5.01'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distance_zero.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-distance
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '0.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distance_too_far.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-distance
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '20.01'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 60
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD wind_too_strong.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-wind
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '12.01'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD battery_too_low.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-battery
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 29
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-battery
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '7.50'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 25
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD battery_exact_ok.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-ok
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD outside_zone.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-zone
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_false
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_daylight.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-light
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery_rounds_up.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 26 act = mo_drone->required_battery( '7.50' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 50 act = mo_drone->required_battery( '20.00' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = mo_drone->required_battery( '0.00' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD order_payload_first.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-payload
|
||||
act = mo_cut->check( iv_payload = '6.00'
|
||||
iv_distance = '25.00'
|
||||
iv_wind_speed = '20.00'
|
||||
iv_battery = 0
|
||||
iv_in_zone = abap_false
|
||||
iv_daylight = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
65
tasks_gen/train/G1003/mutation.json
Normal file
65
tasks_gen/train/G1003/mutation.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"task": "G1003",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}DRONE_CHECKER",
|
||||
"mutant": "line 21: OR -> AND (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "9/12",
|
||||
"failed_tests": [
|
||||
"ORDER_PAYLOAD_FIRST",
|
||||
"PAYLOAD_TOO_HEAVY",
|
||||
"PAYLOAD_ZERO"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DRONE_CHECKER",
|
||||
"mutant": "line 23: > -> <= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "5/12",
|
||||
"failed_tests": [
|
||||
"BATTERY_EXACT_OK",
|
||||
"BATTERY_TOO_LOW",
|
||||
"DISTANCE_TOO_FAR",
|
||||
"NO_DAYLIGHT",
|
||||
"OK_FLIGHT",
|
||||
"OUTSIDE_ZONE",
|
||||
"WIND_TOO_STRONG"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DRONE_CHECKER",
|
||||
"mutant": "line 29: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "8/12",
|
||||
"failed_tests": [
|
||||
"BATTERY_EXACT_OK",
|
||||
"NO_DAYLIGHT",
|
||||
"OK_FLIGHT",
|
||||
"OUTSIDE_ZONE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DRONE_CHECKER",
|
||||
"mutant": "line 31: abap_false -> abap_true (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "9/12",
|
||||
"failed_tests": [
|
||||
"BATTERY_EXACT_OK",
|
||||
"NO_DAYLIGHT",
|
||||
"OK_FLIGHT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DRONE_CHECKER",
|
||||
"mutant": "line 45: + -> - (arith)",
|
||||
"status": "survived",
|
||||
"hidden": "12/12",
|
||||
"failed_tests": []
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"kill_rate": 0.8,
|
||||
"ok": true
|
||||
}
|
||||
49
tasks_gen/train/G1003/reference/drone_checker.clas.abap
Normal file
49
tasks_gen/train/G1003/reference/drone_checker.clas.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
CLASS {{p}}drone_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_drone_check.
|
||||
|
||||
METHODS required_battery
|
||||
IMPORTING iv_distance TYPE {{p}}if_drone_check=>ty_distance
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_drone_check=>ty_percent.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_payload TYPE {{p}}if_drone_check=>ty_weight VALUE '5.00',
|
||||
c_max_distance TYPE {{p}}if_drone_check=>ty_distance VALUE '20.00',
|
||||
c_max_wind TYPE {{p}}if_drone_check=>ty_speed VALUE '12.00',
|
||||
c_reserve TYPE {{p}}if_drone_check=>ty_percent VALUE 10,
|
||||
c_percent_per_km TYPE {{p}}if_drone_check=>ty_percent VALUE 2.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}drone_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_drone_check~check.
|
||||
IF iv_payload <= 0 OR iv_payload > c_max_payload.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-payload.
|
||||
ELSEIF iv_distance <= 0 OR iv_distance > c_max_distance.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-distance.
|
||||
ELSEIF iv_wind_speed > c_max_wind.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-wind.
|
||||
ELSEIF iv_battery < required_battery( iv_distance ).
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-battery.
|
||||
ELSEIF iv_in_zone = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-zone.
|
||||
ELSEIF iv_daylight = abap_false.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-light.
|
||||
ELSE.
|
||||
rv_reason = {{p}}if_drone_check=>c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery.
|
||||
IF iv_distance <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_km TYPE i.
|
||||
lv_km = iv_distance.
|
||||
IF lv_km < iv_distance.
|
||||
lv_km = lv_km + 1.
|
||||
ENDIF.
|
||||
rv_percent = lv_km * c_percent_per_km + c_reserve.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
110
tasks_gen/train/G1003/reference/drone_checker.testclasses.abap
Normal file
110
tasks_gen/train/G1003/reference/drone_checker.testclasses.abap
Normal file
@@ -0,0 +1,110 @@
|
||||
CLASS ltc_drone_checker DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_drone_check.
|
||||
DATA mo_drone TYPE REF TO {{p}}drone_checker.
|
||||
|
||||
METHODS setup.
|
||||
METHODS valid_request_is_ok FOR TESTING.
|
||||
METHODS heavy_payload_is_rejected FOR TESTING.
|
||||
METHODS strong_wind_is_rejected FOR TESTING.
|
||||
METHODS low_battery_is_rejected FOR TESTING.
|
||||
METHODS required_battery_is_rounded_up FOR TESTING.
|
||||
METHODS zone_and_light_are_checked FOR TESTING.
|
||||
METHODS reason_order_is_kept FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_drone_checker IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_drone = NEW {{p}}drone_checker( ).
|
||||
mo_cut = mo_drone.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_request_is_ok.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-ok
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD heavy_payload_is_rejected.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-payload
|
||||
act = mo_cut->check( iv_payload = '5.01'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD strong_wind_is_rejected.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-wind
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '12.01'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD low_battery_is_rejected.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-battery
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 29
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD required_battery_is_rounded_up.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 26 act = mo_drone->required_battery( '7.50' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 30 act = mo_drone->required_battery( '10.00' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = mo_drone->required_battery( '0.00' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zone_and_light_are_checked.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-zone
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_false
|
||||
iv_daylight = abap_true ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-light
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '10.00'
|
||||
iv_wind_speed = '5.00'
|
||||
iv_battery = 30
|
||||
iv_in_zone = abap_true
|
||||
iv_daylight = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_order_is_kept.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-payload
|
||||
act = mo_cut->check( iv_payload = '6.00'
|
||||
iv_distance = '25.00'
|
||||
iv_wind_speed = '20.00'
|
||||
iv_battery = 0
|
||||
iv_in_zone = abap_false
|
||||
iv_daylight = abap_false ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_drone_check=>c_reason-distance
|
||||
act = mo_cut->check( iv_payload = '2.00'
|
||||
iv_distance = '25.00'
|
||||
iv_wind_speed = '20.00'
|
||||
iv_battery = 0
|
||||
iv_in_zone = abap_false
|
||||
iv_daylight = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
25
tasks_gen/train/G1003/seed/if_drone_check.intf.abap
Normal file
25
tasks_gen/train/G1003/seed/if_drone_check.intf.abap
Normal file
@@ -0,0 +1,25 @@
|
||||
INTERFACE {{p}}if_drone_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_weight TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_distance TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_speed TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_percent TYPE i.
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
payload TYPE ty_reason VALUE 'PAYLOAD',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
wind TYPE ty_reason VALUE 'WIND',
|
||||
battery TYPE ty_reason VALUE 'BATTERY',
|
||||
zone TYPE ty_reason VALUE 'ZONE',
|
||||
light TYPE ty_reason VALUE 'LIGHT',
|
||||
END OF c_reason.
|
||||
METHODS check
|
||||
IMPORTING iv_payload TYPE ty_weight
|
||||
iv_distance TYPE ty_distance
|
||||
iv_wind_speed TYPE ty_speed
|
||||
iv_battery TYPE ty_percent
|
||||
iv_in_zone TYPE abap_bool
|
||||
iv_daylight TYPE abap_bool
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
ENDINTERFACE.
|
||||
65
tasks_gen/train/G1003/spec.md
Normal file
65
tasks_gen/train/G1003/spec.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# 1. Goal
|
||||
A drone delivery operator checks a delivery request before it releases a drone.
|
||||
The dispatch program calls one check for each request. The program needs one
|
||||
reason code for each request and the battery charge that the flight needs.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_DRONE_CHECK exists in package $TMP. It is active.
|
||||
- The interface has the types TY_REASON (character, length 10), TY_WEIGHT
|
||||
(packed number, length 8, 2 decimals), TY_DISTANCE (packed number, length 8,
|
||||
2 decimals), TY_SPEED (packed number, length 8, 2 decimals) and TY_PERCENT
|
||||
(integer).
|
||||
- The interface has the constant structure C_REASON with the components OK,
|
||||
PAYLOAD, DISTANCE, WIND, BATTERY, ZONE and LIGHT.
|
||||
- The interface has one method:
|
||||
CHECK
|
||||
IMPORTING iv_payload TYPE ty_weight
|
||||
iv_distance TYPE ty_distance
|
||||
iv_wind_speed TYPE ty_speed
|
||||
iv_battery TYPE ty_percent
|
||||
iv_in_zone TYPE abap_bool
|
||||
iv_daylight TYPE abap_bool
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}DRONE_CHECKER in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_DRONE_CHECK.
|
||||
- The class has the public method REQUIRED_BATTERY:
|
||||
IMPORTING iv_distance TYPE {{P}}IF_DRONE_CHECK=>TY_DISTANCE
|
||||
RETURNING VALUE(rv_percent) TYPE {{P}}IF_DRONE_CHECK=>TY_PERCENT.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
The payload is in kilograms, the distance in kilometres, the wind speed in
|
||||
metres per second, and the battery charge in percent.
|
||||
The check applies the rules in this sequence and returns the reason of the
|
||||
first rule that fails.
|
||||
1. If the payload is less than or equal to zero, or greater than 5.00, return
|
||||
PAYLOAD.
|
||||
2. If the distance is less than or equal to zero, or greater than 20.00, return
|
||||
DISTANCE.
|
||||
3. If the wind speed is greater than 12.00, return WIND.
|
||||
4. If the battery charge is less than the charge that the flight needs, return
|
||||
BATTERY.
|
||||
5. If iv_in_zone is abap_false, return ZONE.
|
||||
6. If iv_daylight is abap_false, return LIGHT.
|
||||
7. Else return OK.
|
||||
The charge that a flight needs is the result of REQUIRED_BATTERY:
|
||||
- If the distance is less than or equal to zero, the result is 0.
|
||||
- Else the result is 2 percent for each started kilometre plus a reserve of
|
||||
10 percent. A started kilometre counts as a full kilometre.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_DRONE_CHECK.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
51
tasks_gen/train/G1003/task.json
Normal file
51
tasks_gen/train/G1003/task.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"id": "G1003",
|
||||
"category": "A",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 80,
|
||||
"max_activations": 20
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_DRONE_CHECK",
|
||||
"file": "seed/if_drone_check.intf.abap",
|
||||
"description": "Drone flight check contract"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}DRONE_CHECKER",
|
||||
"implements": "{{P}}IF_DRONE_CHECK"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_DRONE_CHECK"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T21_HIDDEN",
|
||||
"file": "hidden/t21_hidden.clas.abap",
|
||||
"description": "T21 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}DRONE_CHECKER",
|
||||
"file": "reference/drone_checker.clas.abap",
|
||||
"description": "Drone flight checker",
|
||||
"testclasses_file": "reference/drone_checker.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user