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:
20
tasks_gen/eval/G0184/reference/cx_claim_amount.clas.abap
Normal file
20
tasks_gen/eval/G0184/reference/cx_claim_amount.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS {{p}}cx_claim_amount DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_claim_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_amount TYPE {{p}}if_expense_claim=>ty_amount READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_amount TYPE {{p}}if_expense_claim=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_claim_amount IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_message = 'Amount must be positive' ).
|
||||
mv_amount = iv_amount.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
20
tasks_gen/eval/G0184/reference/cx_claim_costcenter.clas.abap
Normal file
20
tasks_gen/eval/G0184/reference/cx_claim_costcenter.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS {{p}}cx_claim_costcenter DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_claim_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_amount TYPE {{p}}if_expense_claim=>ty_amount READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_amount TYPE {{p}}if_expense_claim=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_claim_costcenter IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_message = 'Cost center is required' ).
|
||||
mv_amount = iv_amount.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
20
tasks_gen/eval/G0184/reference/cx_claim_currency.clas.abap
Normal file
20
tasks_gen/eval/G0184/reference/cx_claim_currency.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS {{p}}cx_claim_currency DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_claim_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_currency TYPE {{p}}if_expense_claim=>ty_currency READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_currency TYPE {{p}}if_expense_claim=>ty_currency.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_claim_currency IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_message = 'Currency is not supported' ).
|
||||
mv_currency = iv_currency.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
20
tasks_gen/eval/G0184/reference/cx_claim_date.clas.abap
Normal file
20
tasks_gen/eval/G0184/reference/cx_claim_date.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS {{p}}cx_claim_date DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_claim_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_claim_date TYPE d READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_claim_date TYPE d.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_claim_date IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_message = 'Claim date is in the future' ).
|
||||
mv_claim_date = iv_claim_date.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
20
tasks_gen/eval/G0184/reference/cx_claim_receipt.clas.abap
Normal file
20
tasks_gen/eval/G0184/reference/cx_claim_receipt.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS {{p}}cx_claim_receipt DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_claim_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
DATA mv_amount TYPE {{p}}if_expense_claim=>ty_amount READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_amount TYPE {{p}}if_expense_claim=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_claim_receipt IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_message = 'Receipt is required' ).
|
||||
mv_amount = iv_amount.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
85
tasks_gen/eval/G0184/reference/expense_validator.clas.abap
Normal file
85
tasks_gen/eval/G0184/reference/expense_validator.clas.abap
Normal file
@@ -0,0 +1,85 @@
|
||||
CLASS {{p}}expense_validator DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS validate
|
||||
IMPORTING is_claim TYPE {{p}}if_expense_claim=>ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_receipt_limit TYPE {{p}}if_expense_claim=>ty_amount VALUE '100.00',
|
||||
c_cc_limit TYPE {{p}}if_expense_claim=>ty_amount VALUE '1000.00'.
|
||||
|
||||
METHODS check_amount
|
||||
IMPORTING is_claim TYPE {{p}}if_expense_claim=>ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
METHODS check_currency
|
||||
IMPORTING is_claim TYPE {{p}}if_expense_claim=>ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
METHODS check_date
|
||||
IMPORTING is_claim TYPE {{p}}if_expense_claim=>ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
METHODS check_receipt
|
||||
IMPORTING is_claim TYPE {{p}}if_expense_claim=>ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
METHODS check_cost_center
|
||||
IMPORTING is_claim TYPE {{p}}if_expense_claim=>ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
METHODS is_supported_currency
|
||||
IMPORTING iv_currency TYPE {{p}}if_expense_claim=>ty_currency
|
||||
RETURNING VALUE(rv_supported) TYPE abap_bool.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}expense_validator IMPLEMENTATION.
|
||||
METHOD validate.
|
||||
check_amount( is_claim ).
|
||||
check_currency( is_claim ).
|
||||
check_date( is_claim ).
|
||||
check_receipt( is_claim ).
|
||||
check_cost_center( is_claim ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_amount.
|
||||
IF is_claim-amount <= 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_claim_amount
|
||||
EXPORTING iv_amount = is_claim-amount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_currency.
|
||||
IF is_supported_currency( is_claim-currency ) = abap_false.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_claim_currency
|
||||
EXPORTING iv_currency = is_claim-currency.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_date.
|
||||
IF is_claim-claim_date > sy-datum.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_claim_date
|
||||
EXPORTING iv_claim_date = is_claim-claim_date.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_receipt.
|
||||
IF is_claim-amount >= c_receipt_limit AND is_claim-has_receipt = abap_false.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_claim_receipt
|
||||
EXPORTING iv_amount = is_claim-amount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_cost_center.
|
||||
IF is_claim-amount >= c_cc_limit AND is_claim-cost_center IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_claim_costcenter
|
||||
EXPORTING iv_amount = is_claim-amount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_supported_currency.
|
||||
rv_supported = xsdbool( iv_currency = 'EUR' OR iv_currency = 'USD'
|
||||
OR iv_currency = 'GBP' OR iv_currency = 'CHF' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,127 @@
|
||||
CLASS ltc_expense_validator DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_amount TYPE {{p}}if_expense_claim=>ty_amount.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}expense_validator.
|
||||
|
||||
METHODS setup.
|
||||
METHODS valid_claim FOR TESTING.
|
||||
METHODS zero_amount FOR TESTING.
|
||||
METHODS unknown_currency FOR TESTING.
|
||||
METHODS future_date FOR TESTING.
|
||||
METHODS receipt_missing FOR TESTING.
|
||||
METHODS cost_center_missing FOR TESTING.
|
||||
|
||||
METHODS build_claim
|
||||
IMPORTING iv_amount TYPE ty_amount
|
||||
iv_currency TYPE {{p}}if_expense_claim=>ty_currency
|
||||
iv_date TYPE d
|
||||
iv_cc TYPE {{p}}if_expense_claim=>ty_cost_center
|
||||
iv_receipt TYPE abap_bool
|
||||
RETURNING VALUE(rs_claim) TYPE {{p}}if_expense_claim=>ty_claim.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_expense_validator IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}expense_validator( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD build_claim.
|
||||
rs_claim = VALUE #( amount = iv_amount
|
||||
currency = iv_currency
|
||||
claim_date = iv_date
|
||||
cost_center = iv_cc
|
||||
has_receipt = iv_receipt ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_claim.
|
||||
DATA(ls_claim) = build_claim( iv_amount = '250.00' iv_currency = 'EUR'
|
||||
iv_date = sy-datum iv_cc = 'CC1000'
|
||||
iv_receipt = abap_true ).
|
||||
TRY.
|
||||
mo_cut->validate( ls_claim ).
|
||||
CATCH {{p}}cx_claim_error INTO DATA(lx).
|
||||
cl_abap_unit_assert=>fail( msg = lx->get_message( ) ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_amount.
|
||||
DATA(ls_claim) = build_claim( iv_amount = 0 iv_currency = 'EUR'
|
||||
iv_date = sy-datum iv_cc = 'CC1000'
|
||||
iv_receipt = abap_true ).
|
||||
TRY.
|
||||
mo_cut->validate( ls_claim ).
|
||||
cl_abap_unit_assert=>fail( msg = 'Exception expected' ).
|
||||
CATCH {{p}}cx_claim_amount INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_amount( '0.00' )
|
||||
act = lx->mv_amount ).
|
||||
CATCH {{p}}cx_claim_error INTO DATA(lx_other).
|
||||
cl_abap_unit_assert=>fail( msg = lx_other->get_message( ) ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_currency.
|
||||
DATA(ls_claim) = build_claim( iv_amount = '250.00' iv_currency = 'JPY'
|
||||
iv_date = sy-datum iv_cc = 'CC1000'
|
||||
iv_receipt = abap_true ).
|
||||
TRY.
|
||||
mo_cut->validate( ls_claim ).
|
||||
cl_abap_unit_assert=>fail( msg = 'Exception expected' ).
|
||||
CATCH {{p}}cx_claim_currency INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'JPY'
|
||||
act = lx->mv_currency ).
|
||||
CATCH {{p}}cx_claim_error INTO DATA(lx_other).
|
||||
cl_abap_unit_assert=>fail( msg = lx_other->get_message( ) ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD future_date.
|
||||
DATA lv_future TYPE d.
|
||||
lv_future = sy-datum + 1.
|
||||
DATA(ls_claim) = build_claim( iv_amount = '250.00' iv_currency = 'EUR'
|
||||
iv_date = lv_future iv_cc = 'CC1000'
|
||||
iv_receipt = abap_true ).
|
||||
TRY.
|
||||
mo_cut->validate( ls_claim ).
|
||||
cl_abap_unit_assert=>fail( msg = 'Exception expected' ).
|
||||
CATCH {{p}}cx_claim_date INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_future
|
||||
act = lx->mv_claim_date ).
|
||||
CATCH {{p}}cx_claim_error INTO DATA(lx_other).
|
||||
cl_abap_unit_assert=>fail( msg = lx_other->get_message( ) ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD receipt_missing.
|
||||
DATA(ls_claim) = build_claim( iv_amount = '250.00' iv_currency = 'EUR'
|
||||
iv_date = sy-datum iv_cc = 'CC1000'
|
||||
iv_receipt = abap_false ).
|
||||
TRY.
|
||||
mo_cut->validate( ls_claim ).
|
||||
cl_abap_unit_assert=>fail( msg = 'Exception expected' ).
|
||||
CATCH {{p}}cx_claim_receipt INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Receipt is required'
|
||||
act = lx->get_message( ) ).
|
||||
CATCH {{p}}cx_claim_error INTO DATA(lx_other).
|
||||
cl_abap_unit_assert=>fail( msg = lx_other->get_message( ) ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cost_center_missing.
|
||||
DATA(ls_claim) = build_claim( iv_amount = '1500.00' iv_currency = 'EUR'
|
||||
iv_date = sy-datum iv_cc = ''
|
||||
iv_receipt = abap_true ).
|
||||
TRY.
|
||||
mo_cut->validate( ls_claim ).
|
||||
cl_abap_unit_assert=>fail( msg = 'Exception expected' ).
|
||||
CATCH {{p}}cx_claim_costcenter INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Cost center is required'
|
||||
act = lx->get_message( ) ).
|
||||
CATCH {{p}}cx_claim_error INTO DATA(lx_other).
|
||||
cl_abap_unit_assert=>fail( msg = lx_other->get_message( ) ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user