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:
172
tasks_gen/eval/G0128/hidden/crew_check_hidden.clas.abap
Normal file
172
tasks_gen/eval/G0128/hidden/crew_check_hidden.clas.abap
Normal file
@@ -0,0 +1,172 @@
|
||||
CLASS {{p}}crew_check_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_hours TYPE p LENGTH 4 DECIMALS 1.
|
||||
DATA mo_cut TYPE REF TO {{p}}crew_duty_check.
|
||||
METHODS setup.
|
||||
METHODS base_duty
|
||||
RETURNING VALUE(rs_duty) TYPE {{p}}crew_duty_check=>ty_duty.
|
||||
METHODS valid_duty_passes FOR TESTING.
|
||||
METHODS licence_invalid FOR TESTING.
|
||||
METHODS rating_missing FOR TESTING.
|
||||
METHODS rest_too_short FOR TESTING.
|
||||
METHODS duty_too_long FOR TESTING.
|
||||
METHODS month_limit FOR TESTING.
|
||||
METHODS first_rule_wins FOR TESTING.
|
||||
METHODS rating_before_rest FOR TESTING.
|
||||
METHODS boundary_values FOR TESTING.
|
||||
METHODS month_limit_exact FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}crew_check_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}crew_duty_check( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_duty.
|
||||
CLEAR rs_duty.
|
||||
rs_duty-crew_id = 'C0001'.
|
||||
rs_duty-licence_valid = abap_true.
|
||||
rs_duty-type_rating = 'A320'.
|
||||
rs_duty-aircraft_type = 'A320'.
|
||||
rs_duty-rest_hours = '12.0'.
|
||||
rs_duty-duty_hours = '8.0'.
|
||||
rs_duty-month_hours = '40.0'.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_duty_passes.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
CATCH {{p}}cx_licence_invalid
|
||||
{{p}}cx_rating_missing
|
||||
{{p}}cx_rest_too_short
|
||||
{{p}}cx_duty_too_long
|
||||
{{p}}cx_month_limit.
|
||||
cl_abap_unit_assert=>fail( msg = 'valid duty was rejected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD licence_invalid.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-licence_valid = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'invalid licence was accepted' ).
|
||||
CATCH {{p}}cx_licence_invalid.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rating_missing.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-type_rating = 'B737'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'missing rating was accepted' ).
|
||||
CATCH {{p}}cx_rating_missing INTO DATA(lo_exc).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'A320'
|
||||
act = lo_exc->mv_required ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'B737'
|
||||
act = lo_exc->mv_held ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rest_too_short.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-rest_hours = '9.9'.
|
||||
DATA lv_expected TYPE ty_hours.
|
||||
lv_expected = '9.9'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'short rest was accepted' ).
|
||||
CATCH {{p}}cx_rest_too_short INTO DATA(lo_exc).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected
|
||||
act = lo_exc->mv_rest_hours ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duty_too_long.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-duty_hours = '13.1'.
|
||||
DATA lv_expected TYPE ty_hours.
|
||||
lv_expected = '13.1'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'long duty was accepted' ).
|
||||
CATCH {{p}}cx_duty_too_long INTO DATA(lo_exc).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected
|
||||
act = lo_exc->mv_duty_hours ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD month_limit.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-month_hours = '95.0'.
|
||||
DATA lv_expected TYPE ty_hours.
|
||||
lv_expected = '103.0'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'month limit was ignored' ).
|
||||
CATCH {{p}}cx_month_limit INTO DATA(lo_exc).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected
|
||||
act = lo_exc->mv_total_hours ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD first_rule_wins.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-licence_valid = abap_false.
|
||||
ls_duty-type_rating = 'B737'.
|
||||
ls_duty-rest_hours = '2.0'.
|
||||
ls_duty-duty_hours = '20.0'.
|
||||
ls_duty-month_hours = '99.0'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'no rule matched' ).
|
||||
CATCH {{p}}cx_licence_invalid.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rating_before_rest.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-type_rating = 'B737'.
|
||||
ls_duty-rest_hours = '2.0'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
cl_abap_unit_assert=>fail( msg = 'no rule matched' ).
|
||||
CATCH {{p}}cx_rating_missing.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD boundary_values.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-rest_hours = '10.0'.
|
||||
ls_duty-duty_hours = '13.0'.
|
||||
ls_duty-month_hours = '87.0'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
CATCH {{p}}cx_licence_invalid
|
||||
{{p}}cx_rating_missing
|
||||
{{p}}cx_rest_too_short
|
||||
{{p}}cx_duty_too_long
|
||||
{{p}}cx_month_limit.
|
||||
cl_abap_unit_assert=>fail( msg = 'boundary values were rejected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD month_limit_exact.
|
||||
DATA(ls_duty) = base_duty( ).
|
||||
ls_duty-duty_hours = '10.0'.
|
||||
ls_duty-month_hours = '90.0'.
|
||||
TRY.
|
||||
mo_cut->check( ls_duty ).
|
||||
CATCH {{p}}cx_licence_invalid
|
||||
{{p}}cx_rating_missing
|
||||
{{p}}cx_rest_too_short
|
||||
{{p}}cx_duty_too_long
|
||||
{{p}}cx_month_limit.
|
||||
cl_abap_unit_assert=>fail( msg = 'exact monthly limit was rejected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user