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:
22
tasks_gen/eval/G0132/reference/cx_deadline_passed.clas.abap
Normal file
22
tasks_gen/eval/G0132/reference/cx_deadline_passed.clas.abap
Normal file
@@ -0,0 +1,22 @@
|
||||
CLASS {{p}}cx_deadline_passed DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_exam_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_reg_date TYPE d READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_student_id TYPE string
|
||||
iv_reg_date TYPE d.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_deadline_passed IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_student_id = iv_student_id
|
||||
iv_text = 'The registration deadline has passed.' ).
|
||||
mv_reg_date = iv_reg_date.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
23
tasks_gen/eval/G0132/reference/cx_exam_error.clas.abap
Normal file
23
tasks_gen/eval/G0132/reference/cx_exam_error.clas.abap
Normal file
@@ -0,0 +1,23 @@
|
||||
CLASS {{p}}cx_exam_error DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM cx_static_check
|
||||
ABSTRACT
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_student_id TYPE string READ-ONLY.
|
||||
DATA mv_text TYPE string READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_student_id TYPE string
|
||||
iv_text TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_exam_error IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_student_id = iv_student_id.
|
||||
mv_text = iv_text.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
22
tasks_gen/eval/G0132/reference/cx_no_attempt_left.clas.abap
Normal file
22
tasks_gen/eval/G0132/reference/cx_no_attempt_left.clas.abap
Normal file
@@ -0,0 +1,22 @@
|
||||
CLASS {{p}}cx_no_attempt_left DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_exam_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_attempts TYPE i READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_student_id TYPE string
|
||||
iv_attempts TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_no_attempt_left IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_student_id = iv_student_id
|
||||
iv_text = 'No attempt is left.' ).
|
||||
mv_attempts = iv_attempts.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
18
tasks_gen/eval/G0132/reference/cx_not_enrolled.clas.abap
Normal file
18
tasks_gen/eval/G0132/reference/cx_not_enrolled.clas.abap
Normal file
@@ -0,0 +1,18 @@
|
||||
CLASS {{p}}cx_not_enrolled DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_exam_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_student_id TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_not_enrolled IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_student_id = iv_student_id
|
||||
iv_text = 'The student is not enrolled.' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
22
tasks_gen/eval/G0132/reference/cx_prereq_missing.clas.abap
Normal file
22
tasks_gen/eval/G0132/reference/cx_prereq_missing.clas.abap
Normal file
@@ -0,0 +1,22 @@
|
||||
CLASS {{p}}cx_prereq_missing DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_exam_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_prereq TYPE string READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_student_id TYPE string
|
||||
iv_prereq TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_prereq_missing IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_student_id = iv_student_id
|
||||
iv_text = 'The prerequisite exam is not passed.' ).
|
||||
mv_prereq = iv_prereq.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
54
tasks_gen/eval/G0132/reference/exam_check.clas.abap
Normal file
54
tasks_gen/eval/G0132/reference/exam_check.clas.abap
Normal file
@@ -0,0 +1,54 @@
|
||||
CLASS {{p}}exam_check DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_max_attempts TYPE i
|
||||
iv_deadline TYPE d.
|
||||
|
||||
METHODS check
|
||||
IMPORTING is_request TYPE {{p}}if_exam_request=>ty_request
|
||||
RAISING {{p}}cx_not_enrolled
|
||||
{{p}}cx_prereq_missing
|
||||
{{p}}cx_no_attempt_left
|
||||
{{p}}cx_deadline_passed.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mv_max_attempts TYPE i.
|
||||
DATA mv_deadline TYPE d.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}exam_check IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
mv_max_attempts = iv_max_attempts.
|
||||
mv_deadline = iv_deadline.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check.
|
||||
IF is_request-enrolled = abap_false.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_not_enrolled
|
||||
EXPORTING iv_student_id = is_request-student_id.
|
||||
ENDIF.
|
||||
|
||||
IF is_request-prereq_passed = abap_false.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_prereq_missing
|
||||
EXPORTING iv_student_id = is_request-student_id
|
||||
iv_prereq = is_request-prereq_id.
|
||||
ENDIF.
|
||||
|
||||
IF is_request-attempts >= mv_max_attempts.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_no_attempt_left
|
||||
EXPORTING iv_student_id = is_request-student_id
|
||||
iv_attempts = is_request-attempts.
|
||||
ENDIF.
|
||||
|
||||
IF is_request-reg_date > mv_deadline.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_deadline_passed
|
||||
EXPORTING iv_student_id = is_request-student_id
|
||||
iv_reg_date = is_request-reg_date.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
97
tasks_gen/eval/G0132/reference/exam_check.testclasses.abap
Normal file
97
tasks_gen/eval/G0132/reference/exam_check.testclasses.abap
Normal file
@@ -0,0 +1,97 @@
|
||||
CLASS ltc_exam_check DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_deadline TYPE d VALUE '20240331'.
|
||||
DATA mo_cut TYPE REF TO {{p}}exam_check.
|
||||
|
||||
METHODS setup.
|
||||
METHODS ok_request
|
||||
RETURNING VALUE(rs_request) TYPE {{p}}if_exam_request=>ty_request.
|
||||
METHODS allowed FOR TESTING.
|
||||
METHODS not_enrolled FOR TESTING.
|
||||
METHODS prereq_missing FOR TESTING.
|
||||
METHODS no_attempt_left FOR TESTING.
|
||||
METHODS deadline_passed FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_exam_check IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}exam_check( iv_max_attempts = 3
|
||||
iv_deadline = c_deadline ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ok_request.
|
||||
rs_request = VALUE #( student_id = 'S4711'
|
||||
enrolled = abap_true
|
||||
prereq_passed = abap_true
|
||||
prereq_id = 'P100'
|
||||
attempts = 0
|
||||
reg_date = CONV d( '20240115' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD allowed.
|
||||
TRY.
|
||||
mo_cut->check( ok_request( ) ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |The registration must be allowed| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD not_enrolled.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-enrolled = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_not_enrolled INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'S4711'
|
||||
act = lo_error->mv_student_id ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD prereq_missing.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-prereq_passed = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_prereq_missing INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'P100'
|
||||
act = lo_error->mv_prereq ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_attempt_left.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-attempts = 3.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_no_attempt_left INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3
|
||||
act = lo_error->mv_attempts ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD deadline_passed.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-reg_date = CONV d( '20240401' ).
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_deadline_passed INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV d( '20240401' )
|
||||
act = lo_error->mv_reg_date ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user