Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
140
tasks_gen/train/G1036/faulty/m0_ride_booking.clas.abap
Normal file
140
tasks_gen/train/G1036/faulty/m0_ride_booking.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}ride_booking DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_ride_booking.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_rate,
|
||||
discipline TYPE {{p}}if_ride_booking=>ty_discipline,
|
||||
base TYPE {{p}}if_ride_booking=>ty_amount,
|
||||
END OF ty_rate,
|
||||
tt_rate TYPE HASHED TABLE OF ty_rate WITH UNIQUE KEY discipline.
|
||||
|
||||
METHODS check_input
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_input.
|
||||
|
||||
METHODS check_limits
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_limit.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS level_surcharge
|
||||
IMPORTING iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS discount
|
||||
IMPORTING iv_riders TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_booking IMPLEMENTATION.
|
||||
METHOD {{p}}if_ride_booking~book.
|
||||
check_input( iv_rider_name = iv_rider_name
|
||||
iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_minutes = iv_minutes
|
||||
iv_riders = iv_riders ).
|
||||
check_limits( iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_riders = iv_riders ).
|
||||
|
||||
DATA lv_periods TYPE i.
|
||||
DATA lv_gross TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
lv_periods = iv_minutes DIV 30.
|
||||
lv_gross = ( base_rate( iv_discipline ) - level_surcharge( iv_level ) ) * lv_periods.
|
||||
rv_price = lv_gross * ( 100 - discount( iv_riders ) ) / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_input.
|
||||
IF iv_rider_name IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-dressage
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-western
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-vaulting.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-discipline.
|
||||
ENDIF.
|
||||
|
||||
IF iv_level <> {{p}}if_ride_booking=>c_level-basic
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-light
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_minutes < 30 OR iv_minutes > 120 OR iv_minutes MOD 30 <> 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-minutes.
|
||||
ENDIF.
|
||||
|
||||
IF iv_riders < 1 OR iv_riders > 6.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-riders.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_limits.
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-show_level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
AND iv_riders < 3.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-volt_group.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
DATA(lt_rate) = VALUE tt_rate(
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-dressage base = 20 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-jumping base = 25 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-western base = 18 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-vaulting base = 15 ) ).
|
||||
rv_rate = lt_rate[ discipline = iv_discipline ]-base.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_surcharge.
|
||||
CASE iv_level.
|
||||
WHEN {{p}}if_ride_booking=>c_level-light.
|
||||
rv_amount = 2.
|
||||
WHEN {{p}}if_ride_booking=>c_level-medium.
|
||||
rv_amount = 4.
|
||||
WHEN {{p}}if_ride_booking=>c_level-advanced.
|
||||
rv_amount = 6.
|
||||
WHEN OTHERS.
|
||||
rv_amount = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount.
|
||||
CASE iv_riders.
|
||||
WHEN 1 OR 2.
|
||||
rv_percent = 0.
|
||||
WHEN 3 OR 4.
|
||||
rv_percent = 20.
|
||||
WHEN OTHERS.
|
||||
rv_percent = 40.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
140
tasks_gen/train/G1036/faulty/m1_ride_booking.clas.abap
Normal file
140
tasks_gen/train/G1036/faulty/m1_ride_booking.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}ride_booking DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_ride_booking.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_rate,
|
||||
discipline TYPE {{p}}if_ride_booking=>ty_discipline,
|
||||
base TYPE {{p}}if_ride_booking=>ty_amount,
|
||||
END OF ty_rate,
|
||||
tt_rate TYPE HASHED TABLE OF ty_rate WITH UNIQUE KEY discipline.
|
||||
|
||||
METHODS check_input
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_input.
|
||||
|
||||
METHODS check_limits
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_limit.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS level_surcharge
|
||||
IMPORTING iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS discount
|
||||
IMPORTING iv_riders TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_booking IMPLEMENTATION.
|
||||
METHOD {{p}}if_ride_booking~book.
|
||||
check_input( iv_rider_name = iv_rider_name
|
||||
iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_minutes = iv_minutes
|
||||
iv_riders = iv_riders ).
|
||||
check_limits( iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_riders = iv_riders ).
|
||||
|
||||
DATA lv_periods TYPE i.
|
||||
DATA lv_gross TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
lv_periods = iv_minutes DIV 30.
|
||||
lv_gross = ( base_rate( iv_discipline ) + level_surcharge( iv_level ) ) * lv_periods.
|
||||
rv_price = lv_gross * ( 100 - discount( iv_riders ) ) / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_input.
|
||||
IF iv_rider_name IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-dressage
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-western
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-vaulting.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-discipline.
|
||||
ENDIF.
|
||||
|
||||
IF iv_level <> {{p}}if_ride_booking=>c_level-basic
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-light
|
||||
OR iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_minutes < 30 OR iv_minutes > 120 OR iv_minutes MOD 30 <> 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-minutes.
|
||||
ENDIF.
|
||||
|
||||
IF iv_riders < 1 OR iv_riders > 6.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-riders.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_limits.
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-show_level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
AND iv_riders < 3.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-volt_group.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
DATA(lt_rate) = VALUE tt_rate(
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-dressage base = 20 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-jumping base = 25 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-western base = 18 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-vaulting base = 15 ) ).
|
||||
rv_rate = lt_rate[ discipline = iv_discipline ]-base.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_surcharge.
|
||||
CASE iv_level.
|
||||
WHEN {{p}}if_ride_booking=>c_level-light.
|
||||
rv_amount = 2.
|
||||
WHEN {{p}}if_ride_booking=>c_level-medium.
|
||||
rv_amount = 4.
|
||||
WHEN {{p}}if_ride_booking=>c_level-advanced.
|
||||
rv_amount = 6.
|
||||
WHEN OTHERS.
|
||||
rv_amount = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount.
|
||||
CASE iv_riders.
|
||||
WHEN 1 OR 2.
|
||||
rv_percent = 0.
|
||||
WHEN 3 OR 4.
|
||||
rv_percent = 20.
|
||||
WHEN OTHERS.
|
||||
rv_percent = 40.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
140
tasks_gen/train/G1036/faulty/m2_ride_booking.clas.abap
Normal file
140
tasks_gen/train/G1036/faulty/m2_ride_booking.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}ride_booking DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_ride_booking.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_rate,
|
||||
discipline TYPE {{p}}if_ride_booking=>ty_discipline,
|
||||
base TYPE {{p}}if_ride_booking=>ty_amount,
|
||||
END OF ty_rate,
|
||||
tt_rate TYPE HASHED TABLE OF ty_rate WITH UNIQUE KEY discipline.
|
||||
|
||||
METHODS check_input
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_input.
|
||||
|
||||
METHODS check_limits
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_limit.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS level_surcharge
|
||||
IMPORTING iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS discount
|
||||
IMPORTING iv_riders TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_booking IMPLEMENTATION.
|
||||
METHOD {{p}}if_ride_booking~book.
|
||||
check_input( iv_rider_name = iv_rider_name
|
||||
iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_minutes = iv_minutes
|
||||
iv_riders = iv_riders ).
|
||||
check_limits( iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_riders = iv_riders ).
|
||||
|
||||
DATA lv_periods TYPE i.
|
||||
DATA lv_gross TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
lv_periods = iv_minutes DIV 30.
|
||||
lv_gross = ( base_rate( iv_discipline ) + level_surcharge( iv_level ) ) * lv_periods.
|
||||
rv_price = lv_gross * ( 100 - discount( iv_riders ) ) / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_input.
|
||||
IF iv_rider_name IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-dressage
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-western
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-vaulting.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-discipline.
|
||||
ENDIF.
|
||||
|
||||
IF iv_level <> {{p}}if_ride_booking=>c_level-basic
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-light
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_minutes < 30 OR iv_minutes > 120 OR iv_minutes MOD 30 <> 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-minutes.
|
||||
ENDIF.
|
||||
|
||||
IF iv_riders >= 1 OR iv_riders > 6.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-riders.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_limits.
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-show_level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
AND iv_riders < 3.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-volt_group.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
DATA(lt_rate) = VALUE tt_rate(
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-dressage base = 20 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-jumping base = 25 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-western base = 18 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-vaulting base = 15 ) ).
|
||||
rv_rate = lt_rate[ discipline = iv_discipline ]-base.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_surcharge.
|
||||
CASE iv_level.
|
||||
WHEN {{p}}if_ride_booking=>c_level-light.
|
||||
rv_amount = 2.
|
||||
WHEN {{p}}if_ride_booking=>c_level-medium.
|
||||
rv_amount = 4.
|
||||
WHEN {{p}}if_ride_booking=>c_level-advanced.
|
||||
rv_amount = 6.
|
||||
WHEN OTHERS.
|
||||
rv_amount = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount.
|
||||
CASE iv_riders.
|
||||
WHEN 1 OR 2.
|
||||
rv_percent = 0.
|
||||
WHEN 3 OR 4.
|
||||
rv_percent = 20.
|
||||
WHEN OTHERS.
|
||||
rv_percent = 40.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
140
tasks_gen/train/G1036/faulty/m3_ride_booking.clas.abap
Normal file
140
tasks_gen/train/G1036/faulty/m3_ride_booking.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}ride_booking DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_ride_booking.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_rate,
|
||||
discipline TYPE {{p}}if_ride_booking=>ty_discipline,
|
||||
base TYPE {{p}}if_ride_booking=>ty_amount,
|
||||
END OF ty_rate,
|
||||
tt_rate TYPE HASHED TABLE OF ty_rate WITH UNIQUE KEY discipline.
|
||||
|
||||
METHODS check_input
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_input.
|
||||
|
||||
METHODS check_limits
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_limit.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS level_surcharge
|
||||
IMPORTING iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS discount
|
||||
IMPORTING iv_riders TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_booking IMPLEMENTATION.
|
||||
METHOD {{p}}if_ride_booking~book.
|
||||
check_input( iv_rider_name = iv_rider_name
|
||||
iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_minutes = iv_minutes
|
||||
iv_riders = iv_riders ).
|
||||
check_limits( iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_riders = iv_riders ).
|
||||
|
||||
DATA lv_periods TYPE i.
|
||||
DATA lv_gross TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
lv_periods = iv_minutes DIV 30.
|
||||
lv_gross = ( base_rate( iv_discipline ) + level_surcharge( iv_level ) ) * lv_periods.
|
||||
rv_price = lv_gross * ( 100 - discount( iv_riders ) ) / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_input.
|
||||
IF iv_rider_name IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-dressage
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-western
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-vaulting.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-discipline.
|
||||
ENDIF.
|
||||
|
||||
IF iv_level <> {{p}}if_ride_booking=>c_level-basic
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-light
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_minutes < 30 OR iv_minutes > 120 OR iv_minutes MOD 30 <> 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-minutes.
|
||||
ENDIF.
|
||||
|
||||
IF iv_riders < 1 OR iv_riders > 6.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-riders.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_limits.
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-show_level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
AND iv_riders < 3.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-volt_group.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
DATA(lt_rate) = VALUE tt_rate(
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-dressage base = 20 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-jumping base = 25 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-western base = 18 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-vaulting base = 15 ) ).
|
||||
rv_rate = lt_rate[ discipline = iv_discipline ]-base.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_surcharge.
|
||||
CASE iv_level.
|
||||
WHEN {{p}}if_ride_booking=>c_level-light.
|
||||
rv_amount = 2.
|
||||
WHEN {{p}}if_ride_booking=>c_level-medium.
|
||||
rv_amount = 4.
|
||||
WHEN {{p}}if_ride_booking=>c_level-advanced.
|
||||
rv_amount = 6.
|
||||
WHEN OTHERS.
|
||||
rv_amount = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount.
|
||||
CASE iv_riders.
|
||||
WHEN 1 OR 2.
|
||||
rv_percent = 0.
|
||||
WHEN 3 OR 4.
|
||||
rv_percent = 20.
|
||||
WHEN OTHERS.
|
||||
rv_percent = 40.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
140
tasks_gen/train/G1036/faulty/m4_ride_booking.clas.abap
Normal file
140
tasks_gen/train/G1036/faulty/m4_ride_booking.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}ride_booking DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_ride_booking.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_rate,
|
||||
discipline TYPE {{p}}if_ride_booking=>ty_discipline,
|
||||
base TYPE {{p}}if_ride_booking=>ty_amount,
|
||||
END OF ty_rate,
|
||||
tt_rate TYPE HASHED TABLE OF ty_rate WITH UNIQUE KEY discipline.
|
||||
|
||||
METHODS check_input
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_input.
|
||||
|
||||
METHODS check_limits
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_limit.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS level_surcharge
|
||||
IMPORTING iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS discount
|
||||
IMPORTING iv_riders TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_booking IMPLEMENTATION.
|
||||
METHOD {{p}}if_ride_booking~book.
|
||||
check_input( iv_rider_name = iv_rider_name
|
||||
iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_minutes = iv_minutes
|
||||
iv_riders = iv_riders ).
|
||||
check_limits( iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_riders = iv_riders ).
|
||||
|
||||
DATA lv_periods TYPE i.
|
||||
DATA lv_gross TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
lv_periods = iv_minutes DIV 30.
|
||||
lv_gross = ( base_rate( iv_discipline ) + level_surcharge( iv_level ) ) * lv_periods.
|
||||
rv_price = lv_gross * ( 100 - discount( iv_riders ) ) / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_input.
|
||||
IF iv_rider_name IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-dressage
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-western
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-vaulting.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-discipline.
|
||||
ENDIF.
|
||||
|
||||
IF iv_level <> {{p}}if_ride_booking=>c_level-basic
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-light
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_minutes < 30 OR iv_minutes > 120 OR iv_minutes MOD 30 <> 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-minutes.
|
||||
ENDIF.
|
||||
|
||||
IF iv_riders < 1 OR iv_riders > 6.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-riders.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_limits.
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-show_level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
AND iv_riders < 3.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-volt_group.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
DATA(lt_rate) = VALUE tt_rate(
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-dressage base = 21 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-jumping base = 25 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-western base = 18 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-vaulting base = 15 ) ).
|
||||
rv_rate = lt_rate[ discipline = iv_discipline ]-base.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_surcharge.
|
||||
CASE iv_level.
|
||||
WHEN {{p}}if_ride_booking=>c_level-light.
|
||||
rv_amount = 2.
|
||||
WHEN {{p}}if_ride_booking=>c_level-medium.
|
||||
rv_amount = 4.
|
||||
WHEN {{p}}if_ride_booking=>c_level-advanced.
|
||||
rv_amount = 6.
|
||||
WHEN OTHERS.
|
||||
rv_amount = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount.
|
||||
CASE iv_riders.
|
||||
WHEN 1 OR 2.
|
||||
rv_percent = 0.
|
||||
WHEN 3 OR 4.
|
||||
rv_percent = 20.
|
||||
WHEN OTHERS.
|
||||
rv_percent = 40.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
24
tasks_gen/train/G1036/generation.json
Normal file
24
tasks_gen/train/G1036/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1036",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "D",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
226
tasks_gen/train/G1036/hidden/ride_hidden.clas.abap
Normal file
226
tasks_gen/train/G1036/hidden/ride_hidden.clas.abap
Normal file
@@ -0,0 +1,226 @@
|
||||
CLASS {{p}}ride_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_ride_booking.
|
||||
|
||||
METHODS setup.
|
||||
METHODS exp_amount
|
||||
IMPORTING iv_cents TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS price_dressage_basic FOR TESTING.
|
||||
METHODS price_jumping_medium FOR TESTING.
|
||||
METHODS price_western_group3 FOR TESTING.
|
||||
METHODS price_vaulting_group6 FOR TESTING.
|
||||
METHODS price_dressage_group5 FOR TESTING.
|
||||
METHODS name_empty_raises FOR TESTING.
|
||||
METHODS discipline_unknown_raises FOR TESTING.
|
||||
METHODS level_unknown_raises FOR TESTING.
|
||||
METHODS minutes_invalid_raises FOR TESTING.
|
||||
METHODS riders_invalid_raises FOR TESTING.
|
||||
METHODS jumping_level_raises FOR TESTING.
|
||||
METHODS vaulting_group_raises FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}ride_booking( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exp_amount.
|
||||
DATA lv_amount TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
lv_amount = iv_cents.
|
||||
rv_amount = lv_amount / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_dressage_basic.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 2000 )
|
||||
act = mo_cut->book( iv_rider_name = `Anna`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_jumping_medium.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 5800 )
|
||||
act = mo_cut->book( iv_rider_name = `Berta`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
iv_level = {{p}}if_ride_booking=>c_level-medium
|
||||
iv_minutes = 60
|
||||
iv_riders = 2 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_western_group3.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 4800 )
|
||||
act = mo_cut->book( iv_rider_name = `Carl`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-western
|
||||
iv_level = {{p}}if_ride_booking=>c_level-light
|
||||
iv_minutes = 90
|
||||
iv_riders = 3 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_vaulting_group6.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 5040 )
|
||||
act = mo_cut->book( iv_rider_name = `Dora`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
iv_level = {{p}}if_ride_booking=>c_level-advanced
|
||||
iv_minutes = 120
|
||||
iv_riders = 6 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_dressage_group5.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 4320 )
|
||||
act = mo_cut->book( iv_rider_name = `Emil`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-medium
|
||||
iv_minutes = 90
|
||||
iv_riders = 5 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD name_empty_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = ``
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-name
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discipline_unknown_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Frida`
|
||||
iv_discipline = 'XXXX'
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-discipline
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_unknown_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Gustav`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = 'X'
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-level
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minutes_invalid_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Hanna`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 45
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-minutes
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD riders_invalid_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Ida`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 7 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-riders
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD jumping_level_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Jonas`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 60
|
||||
iv_riders = 2 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
CATCH {{p}}cx_ride_limit INTO DATA(lx_limit).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-show_level
|
||||
act = lx_limit->reason ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD vaulting_group_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Klara`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 60
|
||||
iv_riders = 2 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
CATCH {{p}}cx_ride_limit INTO DATA(lx_limit).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-volt_group
|
||||
act = lx_limit->reason ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
75
tasks_gen/train/G1036/mutation.json
Normal file
75
tasks_gen/train/G1036/mutation.json
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"task": "G1036",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}RIDE_BOOKING",
|
||||
"mutant": "line 56: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "8/12",
|
||||
"failed_tests": [
|
||||
"PRICE_DRESSAGE_GROUP5",
|
||||
"PRICE_JUMPING_MEDIUM",
|
||||
"PRICE_VAULTING_GROUP6",
|
||||
"PRICE_WESTERN_GROUP3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RIDE_BOOKING",
|
||||
"mutant": "line 76: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "3/12",
|
||||
"failed_tests": [
|
||||
"JUMPING_LEVEL_RAISES",
|
||||
"MINUTES_INVALID_RAISES",
|
||||
"PRICE_DRESSAGE_BASIC",
|
||||
"PRICE_DRESSAGE_GROUP5",
|
||||
"PRICE_JUMPING_MEDIUM",
|
||||
"PRICE_VAULTING_GROUP6",
|
||||
"PRICE_WESTERN_GROUP3",
|
||||
"RIDERS_INVALID_RAISES",
|
||||
"VAULTING_GROUP_RAISES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RIDE_BOOKING",
|
||||
"mutant": "line 87: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "5/12",
|
||||
"failed_tests": [
|
||||
"JUMPING_LEVEL_RAISES",
|
||||
"PRICE_DRESSAGE_BASIC",
|
||||
"PRICE_DRESSAGE_GROUP5",
|
||||
"PRICE_JUMPING_MEDIUM",
|
||||
"PRICE_VAULTING_GROUP6",
|
||||
"PRICE_WESTERN_GROUP3",
|
||||
"VAULTING_GROUP_RAISES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RIDE_BOOKING",
|
||||
"mutant": "line 94: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "8/12",
|
||||
"failed_tests": [
|
||||
"JUMPING_LEVEL_RAISES",
|
||||
"PRICE_DRESSAGE_BASIC",
|
||||
"PRICE_WESTERN_GROUP3",
|
||||
"VAULTING_GROUP_RAISES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RIDE_BOOKING",
|
||||
"mutant": "line 110: 20 -> 21 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "10/12",
|
||||
"failed_tests": [
|
||||
"PRICE_DRESSAGE_BASIC",
|
||||
"PRICE_DRESSAGE_GROUP5"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
140
tasks_gen/train/G1036/reference/ride_booking.clas.abap
Normal file
140
tasks_gen/train/G1036/reference/ride_booking.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}ride_booking DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_ride_booking.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_rate,
|
||||
discipline TYPE {{p}}if_ride_booking=>ty_discipline,
|
||||
base TYPE {{p}}if_ride_booking=>ty_amount,
|
||||
END OF ty_rate,
|
||||
tt_rate TYPE HASHED TABLE OF ty_rate WITH UNIQUE KEY discipline.
|
||||
|
||||
METHODS check_input
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_input.
|
||||
|
||||
METHODS check_limits
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
iv_riders TYPE i
|
||||
RAISING {{p}}cx_ride_limit.
|
||||
|
||||
METHODS base_rate
|
||||
IMPORTING iv_discipline TYPE {{p}}if_ride_booking=>ty_discipline
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS level_surcharge
|
||||
IMPORTING iv_level TYPE {{p}}if_ride_booking=>ty_level
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS discount
|
||||
IMPORTING iv_riders TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ride_booking IMPLEMENTATION.
|
||||
METHOD {{p}}if_ride_booking~book.
|
||||
check_input( iv_rider_name = iv_rider_name
|
||||
iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_minutes = iv_minutes
|
||||
iv_riders = iv_riders ).
|
||||
check_limits( iv_discipline = iv_discipline
|
||||
iv_level = iv_level
|
||||
iv_riders = iv_riders ).
|
||||
|
||||
DATA lv_periods TYPE i.
|
||||
DATA lv_gross TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
lv_periods = iv_minutes DIV 30.
|
||||
lv_gross = ( base_rate( iv_discipline ) + level_surcharge( iv_level ) ) * lv_periods.
|
||||
rv_price = lv_gross * ( 100 - discount( iv_riders ) ) / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_input.
|
||||
IF iv_rider_name IS INITIAL.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline <> {{p}}if_ride_booking=>c_discipline-dressage
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-western
|
||||
AND iv_discipline <> {{p}}if_ride_booking=>c_discipline-vaulting.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-discipline.
|
||||
ENDIF.
|
||||
|
||||
IF iv_level <> {{p}}if_ride_booking=>c_level-basic
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-light
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_minutes < 30 OR iv_minutes > 120 OR iv_minutes MOD 30 <> 0.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-minutes.
|
||||
ENDIF.
|
||||
|
||||
IF iv_riders < 1 OR iv_riders > 6.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_input
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-riders.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_limits.
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-medium
|
||||
AND iv_level <> {{p}}if_ride_booking=>c_level-advanced.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-show_level.
|
||||
ENDIF.
|
||||
|
||||
IF iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
AND iv_riders < 3.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_ride_limit
|
||||
EXPORTING iv_reason = {{p}}if_ride_booking=>c_reason-volt_group.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_rate.
|
||||
DATA(lt_rate) = VALUE tt_rate(
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-dressage base = 20 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-jumping base = 25 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-western base = 18 )
|
||||
( discipline = {{p}}if_ride_booking=>c_discipline-vaulting base = 15 ) ).
|
||||
rv_rate = lt_rate[ discipline = iv_discipline ]-base.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD level_surcharge.
|
||||
CASE iv_level.
|
||||
WHEN {{p}}if_ride_booking=>c_level-light.
|
||||
rv_amount = 2.
|
||||
WHEN {{p}}if_ride_booking=>c_level-medium.
|
||||
rv_amount = 4.
|
||||
WHEN {{p}}if_ride_booking=>c_level-advanced.
|
||||
rv_amount = 6.
|
||||
WHEN OTHERS.
|
||||
rv_amount = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount.
|
||||
CASE iv_riders.
|
||||
WHEN 1 OR 2.
|
||||
rv_percent = 0.
|
||||
WHEN 3 OR 4.
|
||||
rv_percent = 20.
|
||||
WHEN OTHERS.
|
||||
rv_percent = 40.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
143
tasks_gen/train/G1036/reference/ride_booking.testclasses.abap
Normal file
143
tasks_gen/train/G1036/reference/ride_booking.testclasses.abap
Normal file
@@ -0,0 +1,143 @@
|
||||
CLASS ltc_ride_booking DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_ride_booking.
|
||||
|
||||
METHODS setup.
|
||||
METHODS exp_amount
|
||||
IMPORTING iv_cents TYPE i
|
||||
RETURNING VALUE(rv_amount) TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
|
||||
METHODS price_basic_lesson FOR TESTING.
|
||||
METHODS price_group_discount FOR TESTING.
|
||||
METHODS empty_name_raises FOR TESTING.
|
||||
METHODS unknown_discipline_raises FOR TESTING.
|
||||
METHODS invalid_minutes_raises FOR TESTING.
|
||||
METHODS jumping_needs_level FOR TESTING.
|
||||
METHODS vaulting_needs_group FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_ride_booking IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}ride_booking( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exp_amount.
|
||||
DATA lv_amount TYPE {{p}}if_ride_booking=>ty_amount.
|
||||
lv_amount = iv_cents.
|
||||
rv_amount = lv_amount / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_basic_lesson.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 2000 )
|
||||
act = mo_cut->book( iv_rider_name = `Anna`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_group_discount.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = exp_amount( 5040 )
|
||||
act = mo_cut->book( iv_rider_name = `Ben`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
iv_level = {{p}}if_ride_booking=>c_level-advanced
|
||||
iv_minutes = 120
|
||||
iv_riders = 6 ) ).
|
||||
CATCH {{p}}cx_ride_booking.
|
||||
cl_abap_unit_assert=>fail( 'exception not expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_name_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = ``
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-dressage
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-name
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_discipline_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Cara`
|
||||
iv_discipline = 'XXXX'
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 30
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-discipline
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_minutes_raises.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Dana`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-western
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 20
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input INTO DATA(lx_input).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-minutes
|
||||
act = lx_input->reason ).
|
||||
CATCH {{p}}cx_ride_limit.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD jumping_needs_level.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Erik`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-jumping
|
||||
iv_level = {{p}}if_ride_booking=>c_level-light
|
||||
iv_minutes = 60
|
||||
iv_riders = 1 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
CATCH {{p}}cx_ride_limit INTO DATA(lx_limit).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-show_level
|
||||
act = lx_limit->reason ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD vaulting_needs_group.
|
||||
TRY.
|
||||
mo_cut->book( iv_rider_name = `Fiona`
|
||||
iv_discipline = {{p}}if_ride_booking=>c_discipline-vaulting
|
||||
iv_level = {{p}}if_ride_booking=>c_level-basic
|
||||
iv_minutes = 60
|
||||
iv_riders = 2 ).
|
||||
cl_abap_unit_assert=>fail( 'exception expected' ).
|
||||
CATCH {{p}}cx_ride_input.
|
||||
cl_abap_unit_assert=>fail( 'wrong exception' ).
|
||||
CATCH {{p}}cx_ride_limit INTO DATA(lx_limit).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_ride_booking=>c_reason-volt_group
|
||||
act = lx_limit->reason ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
19
tasks_gen/train/G1036/seed/cx_ride_booking.clas.abap
Normal file
19
tasks_gen/train/G1036/seed/cx_ride_booking.clas.abap
Normal file
@@ -0,0 +1,19 @@
|
||||
CLASS {{p}}cx_ride_booking DEFINITION PUBLIC INHERITING FROM cx_static_check CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
|
||||
DATA reason TYPE ty_reason READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_reason TYPE ty_reason.
|
||||
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_ride_booking IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
reason = iv_reason.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
7
tasks_gen/train/G1036/seed/cx_ride_input.clas.abap
Normal file
7
tasks_gen/train/G1036/seed/cx_ride_input.clas.abap
Normal file
@@ -0,0 +1,7 @@
|
||||
CLASS {{p}}cx_ride_input DEFINITION PUBLIC INHERITING FROM {{p}}cx_ride_booking FINAL CREATE PUBLIC.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_ride_input IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
7
tasks_gen/train/G1036/seed/cx_ride_limit.clas.abap
Normal file
7
tasks_gen/train/G1036/seed/cx_ride_limit.clas.abap
Normal file
@@ -0,0 +1,7 @@
|
||||
CLASS {{p}}cx_ride_limit DEFINITION PUBLIC INHERITING FROM {{p}}cx_ride_booking FINAL CREATE PUBLIC.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_ride_limit IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
43
tasks_gen/train/G1036/seed/if_ride_booking.intf.abap
Normal file
43
tasks_gen/train/G1036/seed/if_ride_booking.intf.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
INTERFACE {{p}}if_ride_booking PUBLIC.
|
||||
TYPES ty_discipline TYPE c LENGTH 4.
|
||||
TYPES ty_level TYPE c LENGTH 1.
|
||||
TYPES ty_reason TYPE {{p}}cx_ride_booking=>ty_reason.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_discipline,
|
||||
dressage TYPE ty_discipline VALUE 'DRES',
|
||||
jumping TYPE ty_discipline VALUE 'SHOW',
|
||||
western TYPE ty_discipline VALUE 'WEST',
|
||||
vaulting TYPE ty_discipline VALUE 'VOLT',
|
||||
END OF c_discipline.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_level,
|
||||
basic TYPE ty_level VALUE 'B',
|
||||
light TYPE ty_level VALUE 'L',
|
||||
medium TYPE ty_level VALUE 'M',
|
||||
advanced TYPE ty_level VALUE 'S',
|
||||
END OF c_level.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
name TYPE ty_reason VALUE 'NAME',
|
||||
discipline TYPE ty_reason VALUE 'DISCIPLINE',
|
||||
level TYPE ty_reason VALUE 'LEVEL',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
riders TYPE ty_reason VALUE 'RIDERS',
|
||||
show_level TYPE ty_reason VALUE 'SHOW_LEVEL',
|
||||
volt_group TYPE ty_reason VALUE 'VOLT_GROUP',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS book
|
||||
IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE ty_discipline
|
||||
iv_level TYPE ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount
|
||||
RAISING {{p}}cx_ride_input
|
||||
{{p}}cx_ride_limit.
|
||||
ENDINTERFACE.
|
||||
79
tasks_gen/train/G1036/spec.md
Normal file
79
tasks_gen/train/G1036/spec.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# 1. Goal
|
||||
A riding stable sells riding lessons. A booking program calls the class
|
||||
{{P}}RIDE_BOOKING for each booking request. The class checks the request and
|
||||
returns the price that one rider pays. The class stops the booking with a
|
||||
class-based exception if the request is not correct.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_RIDE_BOOKING is in package $TMP. It is active.
|
||||
- The interface has these types:
|
||||
TY_DISCIPLINE (character 4), TY_LEVEL (character 1), TY_REASON
|
||||
(character 10), TY_AMOUNT (packed number, length 8, 2 decimal places).
|
||||
- The interface has these constants:
|
||||
C_DISCIPLINE: DRESSAGE 'DRES', JUMPING 'SHOW', WESTERN 'WEST',
|
||||
VAULTING 'VOLT'.
|
||||
C_LEVEL: BASIC 'B', LIGHT 'L', MEDIUM 'M', ADVANCED 'S'.
|
||||
C_REASON: NAME 'NAME', DISCIPLINE 'DISCIPLINE', LEVEL 'LEVEL',
|
||||
MINUTES 'MINUTES', RIDERS 'RIDERS', SHOW_LEVEL 'SHOW_LEVEL',
|
||||
VOLT_GROUP 'VOLT_GROUP'.
|
||||
- The interface has one method:
|
||||
BOOK IMPORTING iv_rider_name TYPE string
|
||||
iv_discipline TYPE ty_discipline
|
||||
iv_level TYPE ty_level
|
||||
iv_minutes TYPE i
|
||||
iv_riders TYPE i
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount
|
||||
RAISING {{P}}CX_RIDE_INPUT
|
||||
{{P}}CX_RIDE_LIMIT.
|
||||
- The exception classes {{P}}CX_RIDE_BOOKING, {{P}}CX_RIDE_INPUT and
|
||||
{{P}}CX_RIDE_LIMIT are in package $TMP. They are active.
|
||||
- {{P}}CX_RIDE_BOOKING inherits from CX_STATIC_CHECK. It has the type
|
||||
TY_REASON (character 10), the read-only attribute REASON of type TY_REASON
|
||||
and the constructor with the importing parameter IV_REASON of type TY_REASON.
|
||||
- {{P}}CX_RIDE_INPUT and {{P}}CX_RIDE_LIMIT inherit from
|
||||
{{P}}CX_RIDE_BOOKING. They add nothing.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}RIDE_BOOKING in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_RIDE_BOOKING.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence. Raise the exception of the first rule that
|
||||
fails.
|
||||
1. If the rider name is empty, raise {{P}}CX_RIDE_INPUT with the reason NAME.
|
||||
2. The discipline must be DRES, SHOW, WEST or VOLT. Else raise
|
||||
{{P}}CX_RIDE_INPUT with the reason DISCIPLINE.
|
||||
3. The level must be B, L, M or S. Else raise {{P}}CX_RIDE_INPUT with the
|
||||
reason LEVEL.
|
||||
4. The number of minutes must be 30, 60, 90 or 120. Else raise
|
||||
{{P}}CX_RIDE_INPUT with the reason MINUTES.
|
||||
5. The number of riders must be between 1 and 6. Else raise
|
||||
{{P}}CX_RIDE_INPUT with the reason RIDERS.
|
||||
6. Show jumping (SHOW) is only for the levels M and S. Else raise
|
||||
{{P}}CX_RIDE_LIMIT with the reason SHOW_LEVEL.
|
||||
7. Vaulting (VOLT) is only for a group lesson with 3 or more riders. Else
|
||||
raise {{P}}CX_RIDE_LIMIT with the reason VOLT_GROUP.
|
||||
8. Calculate the price that one rider pays:
|
||||
a. The base rate for 30 minutes: DRES 20, SHOW 25, WEST 18, VOLT 15.
|
||||
b. The level surcharge for 30 minutes: B 0, L 2, M 4, S 6.
|
||||
c. The gross price = (base rate + level surcharge) * (minutes / 30).
|
||||
d. The group discount: 1 or 2 riders 0 percent, 3 or 4 riders 20 percent,
|
||||
5 or 6 riders 40 percent.
|
||||
e. The price = gross price * (100 - group discount) / 100.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_RIDE_BOOKING, {{P}}CX_RIDE_BOOKING,
|
||||
{{P}}CX_RIDE_INPUT and {{P}}CX_RIDE_LIMIT.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
72
tasks_gen/train/G1036/task.json
Normal file
72
tasks_gen/train/G1036/task.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"id": "G1036",
|
||||
"category": "D",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 80,
|
||||
"max_activations": 20
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_RIDE_BOOKING",
|
||||
"file": "seed/cx_ride_booking.clas.abap",
|
||||
"description": "Base exception with a reason code"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_RIDE_INPUT",
|
||||
"file": "seed/cx_ride_input.clas.abap",
|
||||
"description": "Exception for wrong input data"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_RIDE_LIMIT",
|
||||
"file": "seed/cx_ride_limit.clas.abap",
|
||||
"description": "Exception for a business limit"
|
||||
},
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_RIDE_BOOKING",
|
||||
"file": "seed/if_ride_booking.intf.abap",
|
||||
"description": "Riding lesson booking contract"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}RIDE_BOOKING",
|
||||
"implements": "{{P}}IF_RIDE_BOOKING"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_RIDE_BOOKING",
|
||||
"{{P}}CX_RIDE_BOOKING",
|
||||
"{{P}}CX_RIDE_INPUT",
|
||||
"{{P}}CX_RIDE_LIMIT"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}RIDE_HIDDEN",
|
||||
"file": "hidden/ride_hidden.clas.abap",
|
||||
"description": "T41 hidden tests for the riding lesson booking"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}RIDE_BOOKING",
|
||||
"file": "reference/ride_booking.clas.abap",
|
||||
"description": "Riding lesson booking with class-based exceptions",
|
||||
"testclasses_file": "reference/ride_booking.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"cyclomatic_complexity"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user