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:
67
tasks_gen/train/G1017/faulty/m0_inspection_checker.clas.abap
Normal file
67
tasks_gen/train/G1017/faulty/m0_inspection_checker.clas.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
CLASS {{p}}inspection_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_inspection_check.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS normalize
|
||||
IMPORTING iv_text TYPE string
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
METHODS age_in_years
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
RETURNING VALUE(rv_years) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}inspection_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_inspection_check~check_vehicle.
|
||||
IF normalize( iv_plate ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_plate.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF normalize( iv_make ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_make.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_first_reg IS INITIAL AND iv_first_reg > iv_check_date.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-reg_date.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF age_in_years( iv_from = iv_first_reg iv_to = iv_check_date ) >= 30.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-too_old.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_mileage_km < 0.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-mileage.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_brake_pct < 50.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-brakes.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_exhaust_ppm > 1000.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-exhaust.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD normalize.
|
||||
rv_text = to_upper( replace( val = iv_text sub = ` ` with = `` occ = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD age_in_years.
|
||||
rv_years = CONV i( iv_to(4) ) - CONV i( iv_from(4) ).
|
||||
IF iv_to+4(4) < iv_from+4(4).
|
||||
rv_years = rv_years - 1.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
67
tasks_gen/train/G1017/faulty/m2_inspection_checker.clas.abap
Normal file
67
tasks_gen/train/G1017/faulty/m2_inspection_checker.clas.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
CLASS {{p}}inspection_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_inspection_check.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS normalize
|
||||
IMPORTING iv_text TYPE string
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
METHODS age_in_years
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
RETURNING VALUE(rv_years) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}inspection_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_inspection_check~check_vehicle.
|
||||
IF normalize( iv_plate ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_plate.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF normalize( iv_make ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_make.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_first_reg IS INITIAL OR iv_first_reg > iv_check_date.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-reg_date.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF age_in_years( iv_from = iv_first_reg iv_to = iv_check_date ) >= 30.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-too_old.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_mileage_km < 0.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-mileage.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_brake_pct < 50.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-brakes.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_exhaust_ppm <= 1000.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-exhaust.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD normalize.
|
||||
rv_text = to_upper( replace( val = iv_text sub = ` ` with = `` occ = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD age_in_years.
|
||||
rv_years = CONV i( iv_to(4) ) - CONV i( iv_from(4) ).
|
||||
IF iv_to+4(4) < iv_from+4(4).
|
||||
rv_years = rv_years - 1.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
67
tasks_gen/train/G1017/faulty/m3_inspection_checker.clas.abap
Normal file
67
tasks_gen/train/G1017/faulty/m3_inspection_checker.clas.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
CLASS {{p}}inspection_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_inspection_check.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS normalize
|
||||
IMPORTING iv_text TYPE string
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
METHODS age_in_years
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
RETURNING VALUE(rv_years) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}inspection_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_inspection_check~check_vehicle.
|
||||
IF normalize( iv_plate ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_plate.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF normalize( iv_make ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_make.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_first_reg IS INITIAL OR iv_first_reg > iv_check_date.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-reg_date.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF age_in_years( iv_from = iv_first_reg iv_to = iv_check_date ) >= 30.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-too_old.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_mileage_km < 0.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-mileage.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_brake_pct < 50.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-brakes.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_exhaust_ppm > 1000.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-exhaust.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD normalize.
|
||||
rv_text = to_upper( replace( val = iv_text sub = ` ` with = `` occ = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD age_in_years.
|
||||
rv_years = CONV i( iv_to(4) ) + CONV i( iv_from(4) ).
|
||||
IF iv_to+4(4) < iv_from+4(4).
|
||||
rv_years = rv_years - 1.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
19
tasks_gen/train/G1017/generation.json
Normal file
19
tasks_gen/train/G1017/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1017",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "F",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 3,
|
||||
"killed": 3,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
119
tasks_gen/train/G1017/hidden/t_f01_hidden.clas.abap
Normal file
119
tasks_gen/train/G1017/hidden/t_f01_hidden.clas.abap
Normal file
@@ -0,0 +1,119 @@
|
||||
CLASS {{p}}t_f01_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_inspection_check.
|
||||
|
||||
METHODS setup.
|
||||
METHODS reason_of
|
||||
IMPORTING iv_plate TYPE string DEFAULT `B-AB 1234`
|
||||
iv_make TYPE string DEFAULT `VW`
|
||||
iv_first_reg TYPE d DEFAULT '20150101'
|
||||
iv_check_date TYPE d DEFAULT '20250615'
|
||||
iv_mileage_km TYPE i DEFAULT 100000
|
||||
iv_brake_pct TYPE i DEFAULT 60
|
||||
iv_exhaust_ppm TYPE i DEFAULT 1000
|
||||
RETURNING VALUE(rv_reason) TYPE {{p}}if_inspection_check=>ty_reason.
|
||||
|
||||
METHODS ok_vehicle FOR TESTING.
|
||||
METHODS plate_with_spaces FOR TESTING.
|
||||
METHODS empty_plate FOR TESTING.
|
||||
METHODS empty_make FOR TESTING.
|
||||
METHODS future_reg_date FOR TESTING.
|
||||
METHODS initial_reg_date FOR TESTING.
|
||||
METHODS age_29_years FOR TESTING.
|
||||
METHODS age_30_years FOR TESTING.
|
||||
METHODS negative_mileage FOR TESTING.
|
||||
METHODS weak_brakes FOR TESTING.
|
||||
METHODS brake_boundary FOR TESTING.
|
||||
METHODS high_exhaust FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_f01_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}inspection_checker( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_of.
|
||||
rv_reason = mo_cut->check_vehicle(
|
||||
iv_plate = iv_plate
|
||||
iv_make = iv_make
|
||||
iv_first_reg = iv_first_reg
|
||||
iv_check_date = iv_check_date
|
||||
iv_mileage_km = iv_mileage_km
|
||||
iv_brake_pct = iv_brake_pct
|
||||
iv_exhaust_ppm = iv_exhaust_ppm ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ok_vehicle.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-ok
|
||||
act = reason_of( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD plate_with_spaces.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-ok
|
||||
act = reason_of( iv_plate = ` b-ab 1234 ` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_plate.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-no_plate
|
||||
act = reason_of( iv_plate = ` ` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_make.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-no_make
|
||||
act = reason_of( iv_make = `` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD future_reg_date.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-reg_date
|
||||
act = reason_of( iv_first_reg = '20260101' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD initial_reg_date.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-reg_date
|
||||
act = reason_of( iv_first_reg = '00000000' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD age_29_years.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-ok
|
||||
act = reason_of( iv_first_reg = '19950615' iv_check_date = '20250614' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD age_30_years.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-too_old
|
||||
act = reason_of( iv_first_reg = '19950615' iv_check_date = '20250615' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_mileage.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-mileage
|
||||
act = reason_of( iv_mileage_km = -1 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weak_brakes.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-brakes
|
||||
act = reason_of( iv_brake_pct = 49 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD brake_boundary.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-ok
|
||||
act = reason_of( iv_brake_pct = 50 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD high_exhaust.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-exhaust
|
||||
act = reason_of( iv_exhaust_ppm = 1001 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
61
tasks_gen/train/G1017/mutation.json
Normal file
61
tasks_gen/train/G1017/mutation.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"task": "G1017",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}INSPECTION_CHECKER",
|
||||
"mutant": "line 29: OR -> AND (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "10/12",
|
||||
"failed_tests": [
|
||||
"FUTURE_REG_DATE",
|
||||
"INITIAL_REG_DATE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}INSPECTION_CHECKER",
|
||||
"mutant": "line 34: = -> <> (eq)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}INSPECTION_CHECKER",
|
||||
"mutant": "line 49: > -> <= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "7/12",
|
||||
"failed_tests": [
|
||||
"AGE_29_YEARS",
|
||||
"BRAKE_BOUNDARY",
|
||||
"HIGH_EXHAUST",
|
||||
"OK_VEHICLE",
|
||||
"PLATE_WITH_SPACES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}INSPECTION_CHECKER",
|
||||
"mutant": "line 62: - -> + (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "5/12",
|
||||
"failed_tests": [
|
||||
"AGE_29_YEARS",
|
||||
"BRAKE_BOUNDARY",
|
||||
"HIGH_EXHAUST",
|
||||
"NEGATIVE_MILEAGE",
|
||||
"OK_VEHICLE",
|
||||
"PLATE_WITH_SPACES",
|
||||
"WEAK_BRAKES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}INSPECTION_CHECKER",
|
||||
"mutant": "line 63: 4 -> 5 (const)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
}
|
||||
],
|
||||
"valid": 3,
|
||||
"killed": 3,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
67
tasks_gen/train/G1017/reference/inspection_checker.clas.abap
Normal file
67
tasks_gen/train/G1017/reference/inspection_checker.clas.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
CLASS {{p}}inspection_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_inspection_check.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS normalize
|
||||
IMPORTING iv_text TYPE string
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
METHODS age_in_years
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
RETURNING VALUE(rv_years) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}inspection_checker IMPLEMENTATION.
|
||||
METHOD {{p}}if_inspection_check~check_vehicle.
|
||||
IF normalize( iv_plate ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_plate.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF normalize( iv_make ) IS INITIAL.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-no_make.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_first_reg IS INITIAL OR iv_first_reg > iv_check_date.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-reg_date.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF age_in_years( iv_from = iv_first_reg iv_to = iv_check_date ) >= 30.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-too_old.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_mileage_km < 0.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-mileage.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_brake_pct < 50.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-brakes.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_exhaust_ppm > 1000.
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-exhaust.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
rv_reason = {{p}}if_inspection_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD normalize.
|
||||
rv_text = to_upper( replace( val = iv_text sub = ` ` with = `` occ = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD age_in_years.
|
||||
rv_years = CONV i( iv_to(4) ) - CONV i( iv_from(4) ).
|
||||
IF iv_to+4(4) < iv_from+4(4).
|
||||
rv_years = rv_years - 1.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,84 @@
|
||||
CLASS ltc_inspection_checker DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_inspection_check.
|
||||
|
||||
METHODS setup.
|
||||
METHODS reason_of
|
||||
IMPORTING iv_plate TYPE string DEFAULT `B-AB 1234`
|
||||
iv_make TYPE string DEFAULT `VW`
|
||||
iv_first_reg TYPE d DEFAULT '20150101'
|
||||
iv_check_date TYPE d DEFAULT '20250615'
|
||||
iv_mileage_km TYPE i DEFAULT 100000
|
||||
iv_brake_pct TYPE i DEFAULT 60
|
||||
iv_exhaust_ppm TYPE i DEFAULT 500
|
||||
RETURNING VALUE(rv_reason) TYPE {{p}}if_inspection_check=>ty_reason.
|
||||
|
||||
METHODS ok_vehicle FOR TESTING.
|
||||
METHODS empty_plate FOR TESTING.
|
||||
METHODS empty_make FOR TESTING.
|
||||
METHODS future_reg_date FOR TESTING.
|
||||
METHODS old_vehicle FOR TESTING.
|
||||
METHODS weak_brakes FOR TESTING.
|
||||
METHODS high_exhaust FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_inspection_checker IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}inspection_checker( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_of.
|
||||
rv_reason = mo_cut->check_vehicle(
|
||||
iv_plate = iv_plate
|
||||
iv_make = iv_make
|
||||
iv_first_reg = iv_first_reg
|
||||
iv_check_date = iv_check_date
|
||||
iv_mileage_km = iv_mileage_km
|
||||
iv_brake_pct = iv_brake_pct
|
||||
iv_exhaust_ppm = iv_exhaust_ppm ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ok_vehicle.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-ok
|
||||
act = reason_of( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_plate.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-no_plate
|
||||
act = reason_of( iv_plate = ` ` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_make.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-no_make
|
||||
act = reason_of( iv_make = ` ` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD future_reg_date.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-reg_date
|
||||
act = reason_of( iv_first_reg = '20300101' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD old_vehicle.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-too_old
|
||||
act = reason_of( iv_first_reg = '19800101' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weak_brakes.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-brakes
|
||||
act = reason_of( iv_brake_pct = 20 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD high_exhaust.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_inspection_check=>c_reason-exhaust
|
||||
act = reason_of( iv_exhaust_ppm = 5000 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
25
tasks_gen/train/G1017/seed/if_inspection_check.intf.abap
Normal file
25
tasks_gen/train/G1017/seed/if_inspection_check.intf.abap
Normal file
@@ -0,0 +1,25 @@
|
||||
INTERFACE {{p}}if_inspection_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_plate TYPE ty_reason VALUE 'NO_PLATE',
|
||||
no_make TYPE ty_reason VALUE 'NO_MAKE',
|
||||
reg_date TYPE ty_reason VALUE 'REG_DATE',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
mileage TYPE ty_reason VALUE 'MILEAGE',
|
||||
brakes TYPE ty_reason VALUE 'BRAKES',
|
||||
exhaust TYPE ty_reason VALUE 'EXHAUST',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS check_vehicle
|
||||
IMPORTING iv_plate TYPE string
|
||||
iv_make TYPE string
|
||||
iv_first_reg TYPE d
|
||||
iv_check_date TYPE d
|
||||
iv_mileage_km TYPE i
|
||||
iv_brake_pct TYPE i
|
||||
iv_exhaust_ppm TYPE i
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
ENDINTERFACE.
|
||||
50
tasks_gen/train/G1017/spec.md
Normal file
50
tasks_gen/train/G1017/spec.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# 1. Goal
|
||||
A vehicle inspection station checks a vehicle before it gives a test
|
||||
certificate. The check returns one reason code for each vehicle.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_INSPECTION_CHECK exists in package $TMP. It is active.
|
||||
- The interface has the type of the reason code, one constant for each reason
|
||||
code, and one method that checks a vehicle.
|
||||
- Read the interface. It gives the exact method name, the parameters and the
|
||||
type of the return value. This specification does not repeat the signature.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}INSPECTION_CHECKER in package $TMP.
|
||||
- The class is public and final. It has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_INSPECTION_CHECK.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence. Return the reason code of the first rule that
|
||||
fails.
|
||||
1. Remove all spaces from the plate. Convert all letters to upper case. If the
|
||||
result is empty, return the reason code for a missing plate (NO_PLATE).
|
||||
2. Remove all spaces from the make. Convert all letters to upper case. If the
|
||||
result is empty, return the reason code for a missing make (NO_MAKE).
|
||||
3. If the first registration date is initial or after the check date, return the
|
||||
reason code for a bad registration date (REG_DATE).
|
||||
4. Calculate the age of the vehicle. The age is the number of full years between
|
||||
the first registration date and the check date. If the age is 30 years or
|
||||
more, return the reason code for an old vehicle (TOO_OLD).
|
||||
5. If the mileage is less than zero, return the reason code for a bad mileage
|
||||
(MILEAGE).
|
||||
6. If the brake performance is less than 50 percent, return the reason code for
|
||||
weak brakes (BRAKES).
|
||||
7. If the exhaust value is more than 1000 ppm, return the reason code for a bad
|
||||
exhaust value (EXHAUST).
|
||||
8. Else return the reason code for a passed check (OK).
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
||||
- 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_INSPECTION_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/G1017/task.json
Normal file
51
tasks_gen/train/G1017/task.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"id": "G1017",
|
||||
"category": "F",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_INSPECTION_CHECK",
|
||||
"file": "seed/if_inspection_check.intf.abap",
|
||||
"description": "Vehicle inspection check contract"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}INSPECTION_CHECKER",
|
||||
"implements": "{{P}}IF_INSPECTION_CHECK"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_INSPECTION_CHECK"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_F01_HIDDEN",
|
||||
"file": "hidden/t_f01_hidden.clas.abap",
|
||||
"description": "F01 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}INSPECTION_CHECKER",
|
||||
"file": "reference/inspection_checker.clas.abap",
|
||||
"description": "Vehicle inspection checker",
|
||||
"testclasses_file": "reference/inspection_checker.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"cyclomatic_complexity"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user