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:
76
tasks_gen/eval/G0102/reference/hotel_rate.testclasses.abap
Normal file
76
tasks_gen/eval/G0102/reference/hotel_rate.testclasses.abap
Normal file
@@ -0,0 +1,76 @@
|
||||
CLASS ltc_hotel_rate DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_hotel_rate.
|
||||
METHODS setup.
|
||||
METHODS basic_room FOR TESTING.
|
||||
METHODS invalid_nights FOR TESTING.
|
||||
METHODS invalid_guests FOR TESTING.
|
||||
METHODS invalid_category FOR TESTING.
|
||||
METHODS breakfast_and_tax FOR TESTING.
|
||||
METHODS long_stay_discount FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_hotel_rate IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}hotel_rate( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD basic_room.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
iv_nights = 1
|
||||
iv_guests = 1
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-ok
|
||||
act = ls_result-reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}if_hotel_rate=>ty_amount( '93.00' )
|
||||
act = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_nights.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-comfort
|
||||
iv_nights = 0
|
||||
iv_guests = 2
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-nights
|
||||
act = ls_result-reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}if_hotel_rate=>ty_amount( '0.00' )
|
||||
act = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_guests.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
iv_nights = 4
|
||||
iv_guests = 0
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-guests
|
||||
act = ls_result-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_category.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = 'Z'
|
||||
iv_nights = 4
|
||||
iv_guests = 2
|
||||
iv_breakfast = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-category
|
||||
act = ls_result-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD breakfast_and_tax.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
iv_nights = 2
|
||||
iv_guests = 2
|
||||
iv_breakfast = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}if_hotel_rate=>ty_amount( '242.00' )
|
||||
act = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD long_stay_discount.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-comfort
|
||||
iv_nights = 14
|
||||
iv_guests = 2
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}if_hotel_rate=>ty_amount( '1750.00' )
|
||||
act = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user