Hard batch G0022-G0026: 5/5 accepted; budget floor, CDS checks, mutation check
- generator: budget floor (2x oracle activations, 3x calls), static checks for CDS $parameters and UNION annotation - harness/mutation.py: deterministic mutants of the reference; hidden tests must fail - G0022 revalidated with harness fixes: oracle 100, null 0 - results in docs/faz1-tasarim.md 11f Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
85
tasks_gen/eval/G0022/reference/expense_validator.clas.abap
Normal file
85
tasks_gen/eval/G0022/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.
|
||||
Reference in New Issue
Block a user