Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
37
tasks_gen/eval/G0133/faulty/m0_donor_check.func.abap
Normal file
37
tasks_gen/eval/G0133/faulty/m0_donor_check.func.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
FUNCTION {{p}}donor_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days_since_last TYPE i
|
||||
RAISING
|
||||
{{p}}cx_donor_check.
|
||||
|
||||
IF iv_age < 0 AND iv_weight < 0 OR iv_hb < 0 OR iv_days_since_last < 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_INPUT'.
|
||||
ELSEIF iv_age < 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_YOUNG'.
|
||||
ELSEIF iv_age > 65.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_OLD'.
|
||||
ELSEIF iv_weight < 50.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'UNDERWEIGHT'.
|
||||
ELSEIF iv_hb < '12.5'.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'LOW_HB'.
|
||||
ELSEIF iv_days_since_last < 56.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_SOON'
|
||||
iv_retry_days = 56 - iv_days_since_last.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
37
tasks_gen/eval/G0133/faulty/m1_donor_check.func.abap
Normal file
37
tasks_gen/eval/G0133/faulty/m1_donor_check.func.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
FUNCTION {{p}}donor_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days_since_last TYPE i
|
||||
RAISING
|
||||
{{p}}cx_donor_check.
|
||||
|
||||
IF iv_age < 0 OR iv_weight < 0 OR iv_hb < 0 OR iv_days_since_last >= 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_INPUT'.
|
||||
ELSEIF iv_age < 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_YOUNG'.
|
||||
ELSEIF iv_age > 65.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_OLD'.
|
||||
ELSEIF iv_weight < 50.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'UNDERWEIGHT'.
|
||||
ELSEIF iv_hb < '12.5'.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'LOW_HB'.
|
||||
ELSEIF iv_days_since_last < 56.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_SOON'
|
||||
iv_retry_days = 56 - iv_days_since_last.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
37
tasks_gen/eval/G0133/faulty/m2_donor_check.func.abap
Normal file
37
tasks_gen/eval/G0133/faulty/m2_donor_check.func.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
FUNCTION {{p}}donor_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days_since_last TYPE i
|
||||
RAISING
|
||||
{{p}}cx_donor_check.
|
||||
|
||||
IF iv_age < 0 OR iv_weight < 0 OR iv_hb < 0 OR iv_days_since_last < 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_INPUT'.
|
||||
ELSEIF iv_age >= 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_YOUNG'.
|
||||
ELSEIF iv_age > 65.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_OLD'.
|
||||
ELSEIF iv_weight < 50.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'UNDERWEIGHT'.
|
||||
ELSEIF iv_hb < '12.5'.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'LOW_HB'.
|
||||
ELSEIF iv_days_since_last < 56.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_SOON'
|
||||
iv_retry_days = 56 - iv_days_since_last.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
37
tasks_gen/eval/G0133/faulty/m3_donor_check.func.abap
Normal file
37
tasks_gen/eval/G0133/faulty/m3_donor_check.func.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
FUNCTION {{p}}donor_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days_since_last TYPE i
|
||||
RAISING
|
||||
{{p}}cx_donor_check.
|
||||
|
||||
IF iv_age < 0 OR iv_weight < 0 OR iv_hb < 0 OR iv_days_since_last < 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_INPUT'.
|
||||
ELSEIF iv_age < 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_YOUNG'.
|
||||
ELSEIF iv_age > 65.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_OLD'.
|
||||
ELSEIF iv_weight >= 50.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'UNDERWEIGHT'.
|
||||
ELSEIF iv_hb < '12.5'.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'LOW_HB'.
|
||||
ELSEIF iv_days_since_last < 56.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_SOON'
|
||||
iv_retry_days = 56 - iv_days_since_last.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
37
tasks_gen/eval/G0133/faulty/m4_donor_check.func.abap
Normal file
37
tasks_gen/eval/G0133/faulty/m4_donor_check.func.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
FUNCTION {{p}}donor_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days_since_last TYPE i
|
||||
RAISING
|
||||
{{p}}cx_donor_check.
|
||||
|
||||
IF iv_age < 0 OR iv_weight < 0 OR iv_hb < 0 OR iv_days_since_last < 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_INPUT'.
|
||||
ELSEIF iv_age < 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_YOUNG'.
|
||||
ELSEIF iv_age > 65.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_OLD'.
|
||||
ELSEIF iv_weight < 50.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'UNDERWEIGHT'.
|
||||
ELSEIF iv_hb < '12.5'.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'LOW_HB'.
|
||||
ELSEIF iv_days_since_last < 56.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_SOON'
|
||||
iv_retry_days = 56 + iv_days_since_last.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
33
tasks_gen/eval/G0133/generation.json
Normal file
33
tasks_gen/eval/G0133/generation.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"id": "G0133",
|
||||
"pool": "eval",
|
||||
"object_type": "FUNC",
|
||||
"category": "D",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"hidden/t14_hidden.clas.abap line 66: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"check\"",
|
||||
"hidden/t14_hidden.clas.abap line 66: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"9\"",
|
||||
"hidden/t14_hidden.clas.abap line 72: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"check\"",
|
||||
"hidden/t14_hidden.clas.abap line 72: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"4\"",
|
||||
"hidden/t14_hidden.clas.abap line 104: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"check\"",
|
||||
"hidden/t14_hidden.clas.abap line 104: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
109
tasks_gen/eval/G0133/hidden/t14_hidden.clas.abap
Normal file
109
tasks_gen/eval/G0133/hidden/t14_hidden.clas.abap
Normal file
@@ -0,0 +1,109 @@
|
||||
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS verify_donation
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days TYPE i
|
||||
EXPORTING
|
||||
ev_reason TYPE string
|
||||
ev_retry TYPE i.
|
||||
|
||||
METHODS eligible FOR TESTING.
|
||||
METHODS too_young FOR TESTING.
|
||||
METHODS too_old FOR TESTING.
|
||||
METHODS underweight FOR TESTING.
|
||||
METHODS low_hb FOR TESTING.
|
||||
METHODS too_soon FOR TESTING.
|
||||
METHODS never_donated FOR TESTING.
|
||||
METHODS invalid_input FOR TESTING.
|
||||
METHODS first_rule_wins FOR TESTING.
|
||||
METHODS boundary_ok FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD verify_donation.
|
||||
CLEAR: ev_reason, ev_retry.
|
||||
TRY.
|
||||
CALL FUNCTION '{{P}}DONOR_CHECK'
|
||||
EXPORTING
|
||||
iv_age = iv_age
|
||||
iv_weight = iv_weight
|
||||
iv_hb = iv_hb
|
||||
iv_days_since_last = iv_days.
|
||||
CATCH {{p}}cx_donor_check INTO DATA(lx_check).
|
||||
ev_reason = lx_check->mv_reason.
|
||||
ev_retry = lx_check->mv_retry_days.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD eligible.
|
||||
verify_donation( EXPORTING iv_age = 30 iv_weight = 70 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ev_retry = DATA(lv_retry) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_retry ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD too_young.
|
||||
verify_donation( EXPORTING iv_age = 17 iv_weight = 70 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ev_retry = DATA(lv_retry) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_YOUNG' act = lv_reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_retry ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD too_old.
|
||||
verify_donation( EXPORTING iv_age = 66 iv_weight = 70 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_OLD' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD underweight.
|
||||
verify_donation( EXPORTING iv_age = 30 iv_weight = '49.9' iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'UNDERWEIGHT' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD low_hb.
|
||||
verify_donation( EXPORTING iv_age = 30 iv_weight = 70 iv_hb = '12.4' iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'LOW_HB' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD too_soon.
|
||||
verify_donation( EXPORTING iv_age = 30 iv_weight = 70 iv_hb = 14 iv_days = 30
|
||||
IMPORTING ev_reason = DATA(lv_reason) ev_retry = DATA(lv_retry) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_SOON' act = lv_reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 26 act = lv_retry ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD never_donated.
|
||||
verify_donation( EXPORTING iv_age = 40 iv_weight = 80 iv_hb = 15 iv_days = 99999
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_input.
|
||||
verify_donation( EXPORTING iv_age = -1 iv_weight = 70 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ev_retry = DATA(lv_retry) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INVALID_INPUT' act = lv_reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_retry ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD first_rule_wins.
|
||||
verify_donation( EXPORTING iv_age = 17 iv_weight = 40 iv_hb = 10 iv_days = 10
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_YOUNG' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD boundary_ok.
|
||||
verify_donation( EXPORTING iv_age = 18 iv_weight = 50 iv_hb = '12.5' iv_days = 56
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
75
tasks_gen/eval/G0133/mutation.json
Normal file
75
tasks_gen/eval/G0133/mutation.json
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"task": "G0133",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}DONOR_CHECK",
|
||||
"mutant": "line 10: OR -> AND (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"INVALID_INPUT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DONOR_CHECK",
|
||||
"mutant": "line 10: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "1/10",
|
||||
"failed_tests": [
|
||||
"BOUNDARY_OK",
|
||||
"ELIGIBLE",
|
||||
"FIRST_RULE_WINS",
|
||||
"LOW_HB",
|
||||
"NEVER_DONATED",
|
||||
"TOO_OLD",
|
||||
"TOO_SOON",
|
||||
"TOO_YOUNG",
|
||||
"UNDERWEIGHT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DONOR_CHECK",
|
||||
"mutant": "line 14: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "1/10",
|
||||
"failed_tests": [
|
||||
"BOUNDARY_OK",
|
||||
"ELIGIBLE",
|
||||
"FIRST_RULE_WINS",
|
||||
"LOW_HB",
|
||||
"NEVER_DONATED",
|
||||
"TOO_OLD",
|
||||
"TOO_SOON",
|
||||
"TOO_YOUNG",
|
||||
"UNDERWEIGHT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DONOR_CHECK",
|
||||
"mutant": "line 22: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "4/10",
|
||||
"failed_tests": [
|
||||
"BOUNDARY_OK",
|
||||
"ELIGIBLE",
|
||||
"LOW_HB",
|
||||
"NEVER_DONATED",
|
||||
"TOO_SOON",
|
||||
"UNDERWEIGHT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}DONOR_CHECK",
|
||||
"mutant": "line 34: - -> + (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"TOO_SOON"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
27
tasks_gen/eval/G0133/reference/cx_donor_check.clas.abap
Normal file
27
tasks_gen/eval/G0133/reference/cx_donor_check.clas.abap
Normal file
@@ -0,0 +1,27 @@
|
||||
CLASS {{p}}cx_donor_check DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM cx_static_check
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_reason TYPE string READ-ONLY.
|
||||
DATA mv_retry_days TYPE i READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING
|
||||
iv_reason TYPE string
|
||||
iv_retry_days TYPE i DEFAULT 0.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_donor_check IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_reason = iv_reason.
|
||||
mv_retry_days = iv_retry_days.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
37
tasks_gen/eval/G0133/reference/donor_check.func.abap
Normal file
37
tasks_gen/eval/G0133/reference/donor_check.func.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
FUNCTION {{p}}donor_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days_since_last TYPE i
|
||||
RAISING
|
||||
{{p}}cx_donor_check.
|
||||
|
||||
IF iv_age < 0 OR iv_weight < 0 OR iv_hb < 0 OR iv_days_since_last < 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_INPUT'.
|
||||
ELSEIF iv_age < 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_YOUNG'.
|
||||
ELSEIF iv_age > 65.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_OLD'.
|
||||
ELSEIF iv_weight < 50.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'UNDERWEIGHT'.
|
||||
ELSEIF iv_hb < '12.5'.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'LOW_HB'.
|
||||
ELSEIF iv_days_since_last < 56.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_donor_check
|
||||
EXPORTING
|
||||
iv_reason = 'TOO_SOON'
|
||||
iv_retry_days = 56 - iv_days_since_last.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
71
tasks_gen/eval/G0133/reference/t14_test.clas.abap
Normal file
71
tasks_gen/eval/G0133/reference/t14_test.clas.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS run_check
|
||||
IMPORTING
|
||||
iv_age TYPE i
|
||||
iv_weight TYPE decfloat34
|
||||
iv_hb TYPE decfloat34
|
||||
iv_days TYPE i
|
||||
EXPORTING
|
||||
ev_reason TYPE string
|
||||
ev_retry TYPE i.
|
||||
|
||||
METHODS eligible_donor FOR TESTING.
|
||||
METHODS rejects_too_young FOR TESTING.
|
||||
METHODS rejects_low_hb FOR TESTING.
|
||||
METHODS rejects_too_soon FOR TESTING.
|
||||
METHODS rejects_invalid FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_test IMPLEMENTATION.
|
||||
|
||||
METHOD run_check.
|
||||
CLEAR: ev_reason, ev_retry.
|
||||
TRY.
|
||||
CALL FUNCTION '{{P}}DONOR_CHECK'
|
||||
EXPORTING
|
||||
iv_age = iv_age
|
||||
iv_weight = iv_weight
|
||||
iv_hb = iv_hb
|
||||
iv_days_since_last = iv_days.
|
||||
CATCH {{p}}cx_donor_check INTO DATA(lx_check).
|
||||
ev_reason = lx_check->mv_reason.
|
||||
ev_retry = lx_check->mv_retry_days.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD eligible_donor.
|
||||
run_check( EXPORTING iv_age = 30 iv_weight = 70 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_too_young.
|
||||
run_check( EXPORTING iv_age = 17 iv_weight = 70 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_YOUNG' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_low_hb.
|
||||
run_check( EXPORTING iv_age = 30 iv_weight = 70 iv_hb = 12 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'LOW_HB' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_too_soon.
|
||||
run_check( EXPORTING iv_age = 30 iv_weight = 70 iv_hb = 14 iv_days = 20
|
||||
IMPORTING ev_reason = DATA(lv_reason) ev_retry = DATA(lv_retry) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_SOON' act = lv_reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 36 act = lv_retry ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_invalid.
|
||||
run_check( EXPORTING iv_age = 30 iv_weight = -1 iv_hb = 14 iv_days = 200
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INVALID_INPUT' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
69
tasks_gen/eval/G0133/spec.md
Normal file
69
tasks_gen/eval/G0133/spec.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# 1. Goal
|
||||
A blood donation centre checks a person before it takes a blood donation. The
|
||||
check is one function module. The function module rejects a person who may not
|
||||
donate. A rejection is a class-based exception. The exception tells the caller
|
||||
the reason for the rejection and the waiting time.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_DONOR exists in package $TMP.
|
||||
- The centre uses class-based exceptions for rejected checks. The exception
|
||||
class for this check does not exist yet.
|
||||
|
||||
# 4. Contract
|
||||
Exception class {{P}}CX_DONOR_CHECK in package $TMP:
|
||||
- The class is public and final. It inherits from CX_STATIC_CHECK. Its creation
|
||||
type is CREATE PUBLIC.
|
||||
- The class has these public attributes:
|
||||
- MV_REASON, type string: the reason for the rejection.
|
||||
- MV_RETRY_DAYS, type i: the number of days after which the person may try
|
||||
again.
|
||||
- The constructor has the importing parameters IV_REASON (type string) and
|
||||
IV_RETRY_DAYS (type i, default 0).
|
||||
|
||||
Function module {{P}}DONOR_CHECK in function group {{P}}FG_DONOR:
|
||||
- Importing parameters:
|
||||
- IV_AGE, type i: the age of the person in years.
|
||||
- IV_WEIGHT, type decfloat34: the weight of the person in kilograms.
|
||||
- IV_HB, type decfloat34: the haemoglobin value of the person in grams per
|
||||
decilitre.
|
||||
- IV_DAYS_SINCE_LAST, type i: the number of days since the last whole-blood
|
||||
donation. The value is 99999 if the person never donated blood.
|
||||
- The function module raises the exception {{P}}CX_DONOR_CHECK.
|
||||
- The function module has no exporting and no changing parameters.
|
||||
|
||||
# 5. Business rules
|
||||
The function module checks the rules below in the given order. The first rule
|
||||
that matches raises the exception. The function module does not check the other
|
||||
rules after a match.
|
||||
|
||||
1. If IV_AGE, IV_WEIGHT, IV_HB, or IV_DAYS_SINCE_LAST is less than 0, raise the
|
||||
exception with reason INVALID_INPUT and 0 retry days.
|
||||
2. If IV_AGE is less than 18, raise the exception with reason TOO_YOUNG and 0
|
||||
retry days.
|
||||
3. If IV_AGE is greater than 65, raise the exception with reason TOO_OLD and 0
|
||||
retry days.
|
||||
4. If IV_WEIGHT is less than 50, raise the exception with reason UNDERWEIGHT
|
||||
and 0 retry days.
|
||||
5. If IV_HB is less than 12.5, raise the exception with reason LOW_HB and 0
|
||||
retry days.
|
||||
6. If IV_DAYS_SINCE_LAST is less than 56, raise the exception with reason
|
||||
TOO_SOON. The retry days are 56 minus IV_DAYS_SINCE_LAST.
|
||||
7. If no rule matches, the person may donate. The function module does not
|
||||
raise an exception.
|
||||
|
||||
The reason is the value of the attribute MV_REASON of the exception. The retry
|
||||
days are the value of the attribute MV_RETRY_DAYS of the exception.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16 (SAP_BASIS 816).
|
||||
- Use Clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: no other objects.
|
||||
|
||||
# 7. Acceptance
|
||||
- The exception class and the function module are active and have no syntax
|
||||
error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
86
tasks_gen/eval/G0133/task.json
Normal file
86
tasks_gen/eval/G0133/task.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"id": "G0133",
|
||||
"category": "D",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_DONOR",
|
||||
"description": "Blood donation check"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_DONOR_CHECK",
|
||||
"superclass": "CX_STATIC_CHECK",
|
||||
"description": "Class-based exception for a rejected blood donation. Public attributes MV_REASON (string) and MV_RETRY_DAYS (i)."
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}DONOR_CHECK",
|
||||
"functionGroup": "{{P}}FG_DONOR",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_age",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_weight",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_hb",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_days_since_last",
|
||||
"type": "i"
|
||||
}
|
||||
],
|
||||
"exceptions": [
|
||||
"{{P}}CX_DONOR_CHECK"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_HIDDEN",
|
||||
"file": "hidden/t14_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_DONOR_CHECK",
|
||||
"file": "reference/cx_donor_check.clas.abap",
|
||||
"description": "Exception class for a rejected blood donation"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}DONOR_CHECK",
|
||||
"functionGroup": "{{P}}FG_DONOR",
|
||||
"file": "reference/donor_check.func.abap",
|
||||
"description": "Blood donation check"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_TEST",
|
||||
"file": "reference/t14_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user