Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
103
tasks_gen/eval/G0103/hidden/t02_hidden.clas.abap
Normal file
103
tasks_gen/eval/G0103/hidden/t02_hidden.clas.abap
Normal file
@@ -0,0 +1,103 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}overdue_fine.
|
||||
METHODS setup.
|
||||
METHODS assert_fine
|
||||
IMPORTING iv_due TYPE d
|
||||
iv_return TYPE d
|
||||
iv_media TYPE {{p}}overdue_fine=>ty_media
|
||||
iv_days TYPE i
|
||||
iv_charge TYPE i
|
||||
iv_fine TYPE {{p}}overdue_fine=>ty_amount.
|
||||
METHODS not_late_no_fine FOR TESTING.
|
||||
METHODS book_in_grace FOR TESTING.
|
||||
METHODS book_over_grace FOR TESTING.
|
||||
METHODS dvd_in_grace FOR TESTING.
|
||||
METHODS dvd_over_grace FOR TESTING.
|
||||
METHODS game_no_grace FOR TESTING.
|
||||
METHODS reminder_fee_added FOR TESTING.
|
||||
METHODS no_reminder_day_30 FOR TESTING.
|
||||
METHODS fine_capped FOR TESTING.
|
||||
METHODS cap_after_reminder FOR TESTING.
|
||||
METHODS unknown_media_no_fine FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}overdue_fine( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_fine.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_due_date = iv_due
|
||||
iv_return_date = iv_return
|
||||
iv_media = iv_media ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_days
|
||||
act = ls_result-days_overdue
|
||||
msg = |days overdue for { iv_media }| ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_charge
|
||||
act = ls_result-chargeable_days
|
||||
msg = |chargeable days for { iv_media }| ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_fine
|
||||
act = ls_result-fine
|
||||
msg = |fine for { iv_media }| ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD not_late_no_fine.
|
||||
assert_fine( iv_due = '20250110' iv_return = '20250109' iv_media = 'BOOK'
|
||||
iv_days = 0 iv_charge = 0 iv_fine = '0.00' ).
|
||||
assert_fine( iv_due = '20250110' iv_return = '20250110' iv_media = 'DVD'
|
||||
iv_days = 0 iv_charge = 0 iv_fine = '0.00' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD book_in_grace.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250108' iv_media = 'BOOK'
|
||||
iv_days = 7 iv_charge = 0 iv_fine = '0.00' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD book_over_grace.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250109' iv_media = 'BOOK'
|
||||
iv_days = 8 iv_charge = 1 iv_fine = '0.30' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dvd_in_grace.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250103' iv_media = 'DVD'
|
||||
iv_days = 2 iv_charge = 0 iv_fine = '0.00' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dvd_over_grace.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250104' iv_media = 'DVD'
|
||||
iv_days = 3 iv_charge = 1 iv_fine = '1.50' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD game_no_grace.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250102' iv_media = 'GAME'
|
||||
iv_days = 1 iv_charge = 1 iv_fine = '2.50' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reminder_fee_added.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250215' iv_media = 'BOOK'
|
||||
iv_days = 45 iv_charge = 38 iv_fine = '16.40' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_reminder_day_30.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250131' iv_media = 'BOOK'
|
||||
iv_days = 30 iv_charge = 23 iv_fine = '6.90' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fine_capped.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250113' iv_media = 'GAME'
|
||||
iv_days = 12 iv_charge = 12 iv_fine = '25.00' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cap_after_reminder.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250201' iv_media = 'GAME'
|
||||
iv_days = 31 iv_charge = 31 iv_fine = '25.00' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_media_no_fine.
|
||||
assert_fine( iv_due = '20250101' iv_return = '20250105' iv_media = 'TAPE'
|
||||
iv_days = 4 iv_charge = 0 iv_fine = '0.00' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user