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:
145
tasks_gen/eval/G0102/hidden/t13_hidden.clas.abap
Normal file
145
tasks_gen/eval/G0102/hidden/t13_hidden.clas.abap
Normal file
@@ -0,0 +1,145 @@
|
||||
CLASS {{p}}t13_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_hotel_rate.
|
||||
METHODS setup.
|
||||
METHODS expect_price
|
||||
IMPORTING iv_expected TYPE {{p}}if_hotel_rate=>ty_amount
|
||||
iv_actual TYPE {{p}}if_hotel_rate=>ty_amount.
|
||||
METHODS rejects_zero_nights FOR TESTING.
|
||||
METHODS rejects_zero_guests FOR TESTING.
|
||||
METHODS rejects_unknown_category FOR TESTING.
|
||||
METHODS validation_order FOR TESTING.
|
||||
METHODS single_standard_night FOR TESTING.
|
||||
METHODS two_guests_one_room FOR TESTING.
|
||||
METHODS three_guests_two_rooms FOR TESTING.
|
||||
METHODS breakfast_per_guest FOR TESTING.
|
||||
METHODS discount_starts_at_seven FOR TESTING.
|
||||
METHODS discount_fifteen_percent FOR TESTING.
|
||||
METHODS discount_twenty_percent FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t13_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}hotel_rate( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expect_price.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_zero_nights.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
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 ).
|
||||
expect_price( iv_expected = '0.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_zero_guests.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
iv_nights = 3
|
||||
iv_guests = 0
|
||||
iv_breakfast = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-guests
|
||||
act = ls_result-reason ).
|
||||
expect_price( iv_expected = '0.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_unknown_category.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = 'X'
|
||||
iv_nights = 2
|
||||
iv_guests = 1
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-category
|
||||
act = ls_result-reason ).
|
||||
expect_price( iv_expected = '0.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD validation_order.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = 'X'
|
||||
iv_nights = 0
|
||||
iv_guests = 0
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-nights
|
||||
act = ls_result-reason ).
|
||||
ls_result = mo_cut->calculate( iv_category = 'X'
|
||||
iv_nights = 2
|
||||
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 ).
|
||||
ls_result = mo_cut->calculate( iv_category = 'X'
|
||||
iv_nights = 2
|
||||
iv_guests = 2
|
||||
iv_breakfast = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_hotel_rate=>c_reason-category
|
||||
act = ls_result-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD single_standard_night.
|
||||
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 ).
|
||||
expect_price( iv_expected = '93.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD two_guests_one_room.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-comfort
|
||||
iv_nights = 3
|
||||
iv_guests = 2
|
||||
iv_breakfast = abap_false ).
|
||||
expect_price( iv_expected = '438.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD three_guests_two_rooms.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-comfort
|
||||
iv_nights = 2
|
||||
iv_guests = 3
|
||||
iv_breakfast = abap_false ).
|
||||
expect_price( iv_expected = '578.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD breakfast_per_guest.
|
||||
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 ).
|
||||
expect_price( iv_expected = '242.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_starts_at_seven.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
iv_nights = 6
|
||||
iv_guests = 1
|
||||
iv_breakfast = abap_false ).
|
||||
expect_price( iv_expected = '558.00' iv_actual = ls_result-price ).
|
||||
ls_result = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-basic
|
||||
iv_nights = 7
|
||||
iv_guests = 1
|
||||
iv_breakfast = abap_false ).
|
||||
expect_price( iv_expected = '588.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_fifteen_percent.
|
||||
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 ).
|
||||
expect_price( iv_expected = '1750.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_twenty_percent.
|
||||
DATA(ls_result) = mo_cut->calculate( iv_category = {{p}}if_hotel_rate=>c_category-suite
|
||||
iv_nights = 28
|
||||
iv_guests = 1
|
||||
iv_breakfast = abap_false ).
|
||||
expect_price( iv_expected = '5908.00' iv_actual = ls_result-price ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user