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:
148
tasks_gen/train/G1035/faulty/m0_photo_pricer.clas.abap
Normal file
148
tasks_gen/train/G1035/faulty/m0_photo_pricer.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}photo_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_session TYPE c LENGTH 7.
|
||||
TYPES ty_reason TYPE c LENGTH 8.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_request,
|
||||
session TYPE ty_session,
|
||||
minutes TYPE i,
|
||||
persons TYPE i,
|
||||
photos TYPE i,
|
||||
distance_km TYPE i,
|
||||
END OF ty_request.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
time_fee TYPE ty_amount,
|
||||
person_fee TYPE ty_amount,
|
||||
photo_fee TYPE ty_amount,
|
||||
travel_fee TYPE ty_amount,
|
||||
crew_fee TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_session,
|
||||
studio TYPE ty_session VALUE 'STUDIO',
|
||||
outdoor TYPE ty_session VALUE 'OUTDOOR',
|
||||
END OF c_session,
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
session TYPE ty_reason VALUE 'SESSION',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
persons TYPE ty_reason VALUE 'PERSONS',
|
||||
photos TYPE ty_reason VALUE 'PHOTOS',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_min_minutes TYPE i VALUE 30,
|
||||
c_max_minutes TYPE i VALUE 480,
|
||||
c_min_persons TYPE i VALUE 1,
|
||||
c_max_persons TYPE i VALUE 20,
|
||||
c_min_photos TYPE i VALUE 0,
|
||||
c_max_photos TYPE i VALUE 200,
|
||||
c_min_distance TYPE i VALUE 1,
|
||||
c_slot_minutes TYPE i VALUE 15,
|
||||
c_slot_fee TYPE ty_amount VALUE 20,
|
||||
c_free_persons TYPE i VALUE 2,
|
||||
c_person_fee TYPE ty_amount VALUE 10,
|
||||
c_bulk_limit TYPE i VALUE 50,
|
||||
c_photo_std TYPE ty_amount VALUE 5,
|
||||
c_photo_bulk TYPE ty_amount VALUE 4,
|
||||
c_travel_base TYPE ty_amount VALUE 15,
|
||||
c_travel_km TYPE ty_amount VALUE 2,
|
||||
c_crew_limit TYPE i VALUE 8,
|
||||
c_crew_fee TYPE ty_amount VALUE 40.
|
||||
|
||||
METHODS check_request
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
METHODS time_fee
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS person_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS photo_fee
|
||||
IMPORTING iv_photos TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS travel_fee
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS crew_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}photo_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
rs_quote-reason = check_request( is_request ).
|
||||
IF rs_quote-reason <> c_reason-ok.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_quote-time_fee = time_fee( is_request-minutes ).
|
||||
rs_quote-person_fee = person_fee( is_request-persons ).
|
||||
rs_quote-photo_fee = photo_fee( is_request-photos ).
|
||||
rs_quote-travel_fee = travel_fee( is_request ).
|
||||
rs_quote-crew_fee = crew_fee( is_request-persons ).
|
||||
rs_quote-total = rs_quote-time_fee + rs_quote-person_fee + rs_quote-photo_fee
|
||||
+ rs_quote-travel_fee + rs_quote-crew_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_request.
|
||||
IF is_request-session <> c_session-studio AND is_request-session <> c_session-outdoor.
|
||||
rv_reason = c_reason-session.
|
||||
ELSEIF is_request-minutes < c_min_minutes AND is_request-minutes > c_max_minutes.
|
||||
rv_reason = c_reason-minutes.
|
||||
ELSEIF is_request-persons < c_min_persons OR is_request-persons > c_max_persons.
|
||||
rv_reason = c_reason-persons.
|
||||
ELSEIF is_request-photos < c_min_photos OR is_request-photos > c_max_photos.
|
||||
rv_reason = c_reason-photos.
|
||||
ELSEIF is_request-session = c_session-outdoor AND is_request-distance_km < c_min_distance.
|
||||
rv_reason = c_reason-distance.
|
||||
ELSE.
|
||||
rv_reason = c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD time_fee.
|
||||
DATA(lv_slots) = ( iv_minutes + c_slot_minutes - 1 ) DIV c_slot_minutes.
|
||||
rv_fee = lv_slots * c_slot_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD person_fee.
|
||||
DATA(lv_extra) = iv_persons - c_free_persons.
|
||||
IF lv_extra > 0.
|
||||
rv_fee = lv_extra * c_person_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_fee.
|
||||
IF iv_photos >= c_bulk_limit.
|
||||
rv_fee = iv_photos * c_photo_bulk.
|
||||
ELSE.
|
||||
rv_fee = iv_photos * c_photo_std.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_fee.
|
||||
IF is_request-session <> c_session-outdoor.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_travel_base + is_request-distance_km * c_travel_km.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee.
|
||||
IF iv_persons > c_crew_limit.
|
||||
rv_fee = c_crew_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
148
tasks_gen/train/G1035/faulty/m1_photo_pricer.clas.abap
Normal file
148
tasks_gen/train/G1035/faulty/m1_photo_pricer.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}photo_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_session TYPE c LENGTH 7.
|
||||
TYPES ty_reason TYPE c LENGTH 8.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_request,
|
||||
session TYPE ty_session,
|
||||
minutes TYPE i,
|
||||
persons TYPE i,
|
||||
photos TYPE i,
|
||||
distance_km TYPE i,
|
||||
END OF ty_request.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
time_fee TYPE ty_amount,
|
||||
person_fee TYPE ty_amount,
|
||||
photo_fee TYPE ty_amount,
|
||||
travel_fee TYPE ty_amount,
|
||||
crew_fee TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_session,
|
||||
studio TYPE ty_session VALUE 'STUDIO',
|
||||
outdoor TYPE ty_session VALUE 'OUTDOOR',
|
||||
END OF c_session,
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
session TYPE ty_reason VALUE 'SESSION',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
persons TYPE ty_reason VALUE 'PERSONS',
|
||||
photos TYPE ty_reason VALUE 'PHOTOS',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_min_minutes TYPE i VALUE 30,
|
||||
c_max_minutes TYPE i VALUE 480,
|
||||
c_min_persons TYPE i VALUE 1,
|
||||
c_max_persons TYPE i VALUE 20,
|
||||
c_min_photos TYPE i VALUE 0,
|
||||
c_max_photos TYPE i VALUE 200,
|
||||
c_min_distance TYPE i VALUE 1,
|
||||
c_slot_minutes TYPE i VALUE 15,
|
||||
c_slot_fee TYPE ty_amount VALUE 20,
|
||||
c_free_persons TYPE i VALUE 2,
|
||||
c_person_fee TYPE ty_amount VALUE 10,
|
||||
c_bulk_limit TYPE i VALUE 50,
|
||||
c_photo_std TYPE ty_amount VALUE 5,
|
||||
c_photo_bulk TYPE ty_amount VALUE 4,
|
||||
c_travel_base TYPE ty_amount VALUE 15,
|
||||
c_travel_km TYPE ty_amount VALUE 2,
|
||||
c_crew_limit TYPE i VALUE 8,
|
||||
c_crew_fee TYPE ty_amount VALUE 40.
|
||||
|
||||
METHODS check_request
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
METHODS time_fee
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS person_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS photo_fee
|
||||
IMPORTING iv_photos TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS travel_fee
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS crew_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}photo_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
rs_quote-reason = check_request( is_request ).
|
||||
IF rs_quote-reason <> c_reason-ok.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_quote-time_fee = time_fee( is_request-minutes ).
|
||||
rs_quote-person_fee = person_fee( is_request-persons ).
|
||||
rs_quote-photo_fee = photo_fee( is_request-photos ).
|
||||
rs_quote-travel_fee = travel_fee( is_request ).
|
||||
rs_quote-crew_fee = crew_fee( is_request-persons ).
|
||||
rs_quote-total = rs_quote-time_fee + rs_quote-person_fee + rs_quote-photo_fee
|
||||
+ rs_quote-travel_fee + rs_quote-crew_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_request.
|
||||
IF is_request-session <> c_session-studio AND is_request-session <> c_session-outdoor.
|
||||
rv_reason = c_reason-session.
|
||||
ELSEIF is_request-minutes < c_min_minutes OR is_request-minutes > c_max_minutes.
|
||||
rv_reason = c_reason-minutes.
|
||||
ELSEIF is_request-persons < c_min_persons OR is_request-persons > c_max_persons.
|
||||
rv_reason = c_reason-persons.
|
||||
ELSEIF is_request-photos >= c_min_photos OR is_request-photos > c_max_photos.
|
||||
rv_reason = c_reason-photos.
|
||||
ELSEIF is_request-session = c_session-outdoor AND is_request-distance_km < c_min_distance.
|
||||
rv_reason = c_reason-distance.
|
||||
ELSE.
|
||||
rv_reason = c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD time_fee.
|
||||
DATA(lv_slots) = ( iv_minutes + c_slot_minutes - 1 ) DIV c_slot_minutes.
|
||||
rv_fee = lv_slots * c_slot_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD person_fee.
|
||||
DATA(lv_extra) = iv_persons - c_free_persons.
|
||||
IF lv_extra > 0.
|
||||
rv_fee = lv_extra * c_person_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_fee.
|
||||
IF iv_photos >= c_bulk_limit.
|
||||
rv_fee = iv_photos * c_photo_bulk.
|
||||
ELSE.
|
||||
rv_fee = iv_photos * c_photo_std.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_fee.
|
||||
IF is_request-session <> c_session-outdoor.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_travel_base + is_request-distance_km * c_travel_km.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee.
|
||||
IF iv_persons > c_crew_limit.
|
||||
rv_fee = c_crew_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
148
tasks_gen/train/G1035/faulty/m2_photo_pricer.clas.abap
Normal file
148
tasks_gen/train/G1035/faulty/m2_photo_pricer.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}photo_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_session TYPE c LENGTH 7.
|
||||
TYPES ty_reason TYPE c LENGTH 8.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_request,
|
||||
session TYPE ty_session,
|
||||
minutes TYPE i,
|
||||
persons TYPE i,
|
||||
photos TYPE i,
|
||||
distance_km TYPE i,
|
||||
END OF ty_request.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
time_fee TYPE ty_amount,
|
||||
person_fee TYPE ty_amount,
|
||||
photo_fee TYPE ty_amount,
|
||||
travel_fee TYPE ty_amount,
|
||||
crew_fee TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_session,
|
||||
studio TYPE ty_session VALUE 'STUDIO',
|
||||
outdoor TYPE ty_session VALUE 'OUTDOOR',
|
||||
END OF c_session,
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
session TYPE ty_reason VALUE 'SESSION',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
persons TYPE ty_reason VALUE 'PERSONS',
|
||||
photos TYPE ty_reason VALUE 'PHOTOS',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_min_minutes TYPE i VALUE 30,
|
||||
c_max_minutes TYPE i VALUE 480,
|
||||
c_min_persons TYPE i VALUE 1,
|
||||
c_max_persons TYPE i VALUE 20,
|
||||
c_min_photos TYPE i VALUE 0,
|
||||
c_max_photos TYPE i VALUE 200,
|
||||
c_min_distance TYPE i VALUE 1,
|
||||
c_slot_minutes TYPE i VALUE 15,
|
||||
c_slot_fee TYPE ty_amount VALUE 20,
|
||||
c_free_persons TYPE i VALUE 2,
|
||||
c_person_fee TYPE ty_amount VALUE 10,
|
||||
c_bulk_limit TYPE i VALUE 50,
|
||||
c_photo_std TYPE ty_amount VALUE 5,
|
||||
c_photo_bulk TYPE ty_amount VALUE 4,
|
||||
c_travel_base TYPE ty_amount VALUE 15,
|
||||
c_travel_km TYPE ty_amount VALUE 2,
|
||||
c_crew_limit TYPE i VALUE 8,
|
||||
c_crew_fee TYPE ty_amount VALUE 40.
|
||||
|
||||
METHODS check_request
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
METHODS time_fee
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS person_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS photo_fee
|
||||
IMPORTING iv_photos TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS travel_fee
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS crew_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}photo_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
rs_quote-reason = check_request( is_request ).
|
||||
IF rs_quote-reason <> c_reason-ok.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_quote-time_fee = time_fee( is_request-minutes ).
|
||||
rs_quote-person_fee = person_fee( is_request-persons ).
|
||||
rs_quote-photo_fee = photo_fee( is_request-photos ).
|
||||
rs_quote-travel_fee = travel_fee( is_request ).
|
||||
rs_quote-crew_fee = crew_fee( is_request-persons ).
|
||||
rs_quote-total = rs_quote-time_fee + rs_quote-person_fee + rs_quote-photo_fee
|
||||
+ rs_quote-travel_fee + rs_quote-crew_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_request.
|
||||
IF is_request-session <> c_session-studio AND is_request-session <> c_session-outdoor.
|
||||
rv_reason = c_reason-session.
|
||||
ELSEIF is_request-minutes < c_min_minutes OR is_request-minutes > c_max_minutes.
|
||||
rv_reason = c_reason-minutes.
|
||||
ELSEIF is_request-persons < c_min_persons OR is_request-persons > c_max_persons.
|
||||
rv_reason = c_reason-persons.
|
||||
ELSEIF is_request-photos < c_min_photos OR is_request-photos > c_max_photos.
|
||||
rv_reason = c_reason-photos.
|
||||
ELSEIF is_request-session = c_session-outdoor AND is_request-distance_km >= c_min_distance.
|
||||
rv_reason = c_reason-distance.
|
||||
ELSE.
|
||||
rv_reason = c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD time_fee.
|
||||
DATA(lv_slots) = ( iv_minutes + c_slot_minutes - 1 ) DIV c_slot_minutes.
|
||||
rv_fee = lv_slots * c_slot_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD person_fee.
|
||||
DATA(lv_extra) = iv_persons - c_free_persons.
|
||||
IF lv_extra > 0.
|
||||
rv_fee = lv_extra * c_person_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_fee.
|
||||
IF iv_photos >= c_bulk_limit.
|
||||
rv_fee = iv_photos * c_photo_bulk.
|
||||
ELSE.
|
||||
rv_fee = iv_photos * c_photo_std.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_fee.
|
||||
IF is_request-session <> c_session-outdoor.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_travel_base + is_request-distance_km * c_travel_km.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee.
|
||||
IF iv_persons > c_crew_limit.
|
||||
rv_fee = c_crew_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
148
tasks_gen/train/G1035/faulty/m3_photo_pricer.clas.abap
Normal file
148
tasks_gen/train/G1035/faulty/m3_photo_pricer.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}photo_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_session TYPE c LENGTH 7.
|
||||
TYPES ty_reason TYPE c LENGTH 8.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_request,
|
||||
session TYPE ty_session,
|
||||
minutes TYPE i,
|
||||
persons TYPE i,
|
||||
photos TYPE i,
|
||||
distance_km TYPE i,
|
||||
END OF ty_request.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
time_fee TYPE ty_amount,
|
||||
person_fee TYPE ty_amount,
|
||||
photo_fee TYPE ty_amount,
|
||||
travel_fee TYPE ty_amount,
|
||||
crew_fee TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_session,
|
||||
studio TYPE ty_session VALUE 'STUDIO',
|
||||
outdoor TYPE ty_session VALUE 'OUTDOOR',
|
||||
END OF c_session,
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
session TYPE ty_reason VALUE 'SESSION',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
persons TYPE ty_reason VALUE 'PERSONS',
|
||||
photos TYPE ty_reason VALUE 'PHOTOS',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_min_minutes TYPE i VALUE 30,
|
||||
c_max_minutes TYPE i VALUE 480,
|
||||
c_min_persons TYPE i VALUE 1,
|
||||
c_max_persons TYPE i VALUE 20,
|
||||
c_min_photos TYPE i VALUE 0,
|
||||
c_max_photos TYPE i VALUE 200,
|
||||
c_min_distance TYPE i VALUE 1,
|
||||
c_slot_minutes TYPE i VALUE 15,
|
||||
c_slot_fee TYPE ty_amount VALUE 20,
|
||||
c_free_persons TYPE i VALUE 2,
|
||||
c_person_fee TYPE ty_amount VALUE 10,
|
||||
c_bulk_limit TYPE i VALUE 50,
|
||||
c_photo_std TYPE ty_amount VALUE 5,
|
||||
c_photo_bulk TYPE ty_amount VALUE 4,
|
||||
c_travel_base TYPE ty_amount VALUE 15,
|
||||
c_travel_km TYPE ty_amount VALUE 2,
|
||||
c_crew_limit TYPE i VALUE 8,
|
||||
c_crew_fee TYPE ty_amount VALUE 40.
|
||||
|
||||
METHODS check_request
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
METHODS time_fee
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS person_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS photo_fee
|
||||
IMPORTING iv_photos TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS travel_fee
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS crew_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}photo_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
rs_quote-reason = check_request( is_request ).
|
||||
IF rs_quote-reason <> c_reason-ok.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_quote-time_fee = time_fee( is_request-minutes ).
|
||||
rs_quote-person_fee = person_fee( is_request-persons ).
|
||||
rs_quote-photo_fee = photo_fee( is_request-photos ).
|
||||
rs_quote-travel_fee = travel_fee( is_request ).
|
||||
rs_quote-crew_fee = crew_fee( is_request-persons ).
|
||||
rs_quote-total = rs_quote-time_fee + rs_quote-person_fee + rs_quote-photo_fee
|
||||
+ rs_quote-travel_fee + rs_quote-crew_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_request.
|
||||
IF is_request-session <> c_session-studio AND is_request-session <> c_session-outdoor.
|
||||
rv_reason = c_reason-session.
|
||||
ELSEIF is_request-minutes < c_min_minutes OR is_request-minutes > c_max_minutes.
|
||||
rv_reason = c_reason-minutes.
|
||||
ELSEIF is_request-persons < c_min_persons OR is_request-persons > c_max_persons.
|
||||
rv_reason = c_reason-persons.
|
||||
ELSEIF is_request-photos < c_min_photos OR is_request-photos > c_max_photos.
|
||||
rv_reason = c_reason-photos.
|
||||
ELSEIF is_request-session = c_session-outdoor AND is_request-distance_km < c_min_distance.
|
||||
rv_reason = c_reason-distance.
|
||||
ELSE.
|
||||
rv_reason = c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD time_fee.
|
||||
DATA(lv_slots) = ( iv_minutes + c_slot_minutes - 1 ) DIV c_slot_minutes.
|
||||
rv_fee = lv_slots * c_slot_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD person_fee.
|
||||
DATA(lv_extra) = iv_persons - c_free_persons.
|
||||
IF lv_extra > 0.
|
||||
rv_fee = lv_extra * c_person_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_fee.
|
||||
IF iv_photos >= c_bulk_limit.
|
||||
rv_fee = iv_photos / c_photo_bulk.
|
||||
ELSE.
|
||||
rv_fee = iv_photos * c_photo_std.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_fee.
|
||||
IF is_request-session <> c_session-outdoor.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_travel_base + is_request-distance_km * c_travel_km.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee.
|
||||
IF iv_persons > c_crew_limit.
|
||||
rv_fee = c_crew_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
148
tasks_gen/train/G1035/faulty/m4_photo_pricer.clas.abap
Normal file
148
tasks_gen/train/G1035/faulty/m4_photo_pricer.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}photo_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_session TYPE c LENGTH 7.
|
||||
TYPES ty_reason TYPE c LENGTH 8.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_request,
|
||||
session TYPE ty_session,
|
||||
minutes TYPE i,
|
||||
persons TYPE i,
|
||||
photos TYPE i,
|
||||
distance_km TYPE i,
|
||||
END OF ty_request.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
time_fee TYPE ty_amount,
|
||||
person_fee TYPE ty_amount,
|
||||
photo_fee TYPE ty_amount,
|
||||
travel_fee TYPE ty_amount,
|
||||
crew_fee TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_session,
|
||||
studio TYPE ty_session VALUE 'STUDIO',
|
||||
outdoor TYPE ty_session VALUE 'OUTDOOR',
|
||||
END OF c_session,
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
session TYPE ty_reason VALUE 'SESSION',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
persons TYPE ty_reason VALUE 'PERSONS',
|
||||
photos TYPE ty_reason VALUE 'PHOTOS',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_min_minutes TYPE i VALUE 30,
|
||||
c_max_minutes TYPE i VALUE 480,
|
||||
c_min_persons TYPE i VALUE 1,
|
||||
c_max_persons TYPE i VALUE 20,
|
||||
c_min_photos TYPE i VALUE 0,
|
||||
c_max_photos TYPE i VALUE 200,
|
||||
c_min_distance TYPE i VALUE 1,
|
||||
c_slot_minutes TYPE i VALUE 15,
|
||||
c_slot_fee TYPE ty_amount VALUE 20,
|
||||
c_free_persons TYPE i VALUE 2,
|
||||
c_person_fee TYPE ty_amount VALUE 10,
|
||||
c_bulk_limit TYPE i VALUE 50,
|
||||
c_photo_std TYPE ty_amount VALUE 5,
|
||||
c_photo_bulk TYPE ty_amount VALUE 4,
|
||||
c_travel_base TYPE ty_amount VALUE 15,
|
||||
c_travel_km TYPE ty_amount VALUE 2,
|
||||
c_crew_limit TYPE i VALUE 8,
|
||||
c_crew_fee TYPE ty_amount VALUE 40.
|
||||
|
||||
METHODS check_request
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
METHODS time_fee
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS person_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS photo_fee
|
||||
IMPORTING iv_photos TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS travel_fee
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS crew_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}photo_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
rs_quote-reason = check_request( is_request ).
|
||||
IF rs_quote-reason <> c_reason-ok.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_quote-time_fee = time_fee( is_request-minutes ).
|
||||
rs_quote-person_fee = person_fee( is_request-persons ).
|
||||
rs_quote-photo_fee = photo_fee( is_request-photos ).
|
||||
rs_quote-travel_fee = travel_fee( is_request ).
|
||||
rs_quote-crew_fee = crew_fee( is_request-persons ).
|
||||
rs_quote-total = rs_quote-time_fee + rs_quote-person_fee + rs_quote-photo_fee
|
||||
+ rs_quote-travel_fee + rs_quote-crew_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_request.
|
||||
IF is_request-session <> c_session-studio AND is_request-session <> c_session-outdoor.
|
||||
rv_reason = c_reason-session.
|
||||
ELSEIF is_request-minutes < c_min_minutes OR is_request-minutes > c_max_minutes.
|
||||
rv_reason = c_reason-minutes.
|
||||
ELSEIF is_request-persons < c_min_persons OR is_request-persons > c_max_persons.
|
||||
rv_reason = c_reason-persons.
|
||||
ELSEIF is_request-photos < c_min_photos OR is_request-photos > c_max_photos.
|
||||
rv_reason = c_reason-photos.
|
||||
ELSEIF is_request-session = c_session-outdoor AND is_request-distance_km < c_min_distance.
|
||||
rv_reason = c_reason-distance.
|
||||
ELSE.
|
||||
rv_reason = c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD time_fee.
|
||||
DATA(lv_slots) = ( iv_minutes + c_slot_minutes - 1 ) DIV c_slot_minutes.
|
||||
rv_fee = lv_slots * c_slot_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD person_fee.
|
||||
DATA(lv_extra) = iv_persons - c_free_persons.
|
||||
IF lv_extra > 0.
|
||||
rv_fee = lv_extra * c_person_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_fee.
|
||||
IF iv_photos >= c_bulk_limit.
|
||||
rv_fee = iv_photos * c_photo_bulk.
|
||||
ELSE.
|
||||
rv_fee = iv_photos / c_photo_std.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_fee.
|
||||
IF is_request-session <> c_session-outdoor.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_travel_base + is_request-distance_km * c_travel_km.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee.
|
||||
IF iv_persons > c_crew_limit.
|
||||
rv_fee = c_crew_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
19
tasks_gen/train/G1035/generation.json
Normal file
19
tasks_gen/train/G1035/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1035",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
267
tasks_gen/train/G1035/hidden/t120_hidden.clas.abap
Normal file
267
tasks_gen/train/G1035/hidden/t120_hidden.clas.abap
Normal file
@@ -0,0 +1,267 @@
|
||||
CLASS {{p}}t120_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}photo_pricer.
|
||||
|
||||
METHODS setup.
|
||||
METHODS studio_quote FOR TESTING.
|
||||
METHODS outdoor_quote FOR TESTING.
|
||||
METHODS studio_ignores_distance FOR TESTING.
|
||||
METHODS rounds_up_minutes FOR TESTING.
|
||||
METHODS free_persons FOR TESTING.
|
||||
METHODS crew_fee_large_group FOR TESTING.
|
||||
METHODS photo_rate_at_50 FOR TESTING.
|
||||
METHODS rejects_unknown_session FOR TESTING.
|
||||
METHODS rejects_bad_minutes FOR TESTING.
|
||||
METHODS rejects_bad_persons FOR TESTING.
|
||||
METHODS rejects_bad_photos FOR TESTING.
|
||||
METHODS rejects_outdoor_no_dist FOR TESTING.
|
||||
|
||||
METHODS build_request
|
||||
IMPORTING iv_session TYPE {{p}}photo_pricer=>ty_session
|
||||
iv_minutes TYPE i
|
||||
iv_persons TYPE i
|
||||
iv_photos TYPE i
|
||||
iv_distance_km TYPE i
|
||||
RETURNING VALUE(rs_request) TYPE {{p}}photo_pricer=>ty_request.
|
||||
|
||||
METHODS assert_amount
|
||||
IMPORTING iv_expected TYPE i
|
||||
iv_act TYPE {{p}}photo_pricer=>ty_amount
|
||||
iv_msg TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t120_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}photo_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD build_request.
|
||||
rs_request = VALUE #( session = iv_session
|
||||
minutes = iv_minutes
|
||||
persons = iv_persons
|
||||
photos = iv_photos
|
||||
distance_km = iv_distance_km ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_amount.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV {{p}}photo_pricer=>ty_amount( iv_expected )
|
||||
act = iv_act
|
||||
msg = iv_msg ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD studio_quote.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 90
|
||||
iv_persons = 3
|
||||
iv_photos = 10
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
assert_amount( iv_expected = 120 iv_act = ls_quote-time_fee iv_msg = `time fee` ).
|
||||
assert_amount( iv_expected = 10 iv_act = ls_quote-person_fee iv_msg = `person fee` ).
|
||||
assert_amount( iv_expected = 50 iv_act = ls_quote-photo_fee iv_msg = `photo fee` ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-travel_fee iv_msg = `travel fee` ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-crew_fee iv_msg = `crew fee` ).
|
||||
assert_amount( iv_expected = 180 iv_act = ls_quote-total iv_msg = `total` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD outdoor_quote.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-outdoor
|
||||
iv_minutes = 45
|
||||
iv_persons = 10
|
||||
iv_photos = 50
|
||||
iv_distance_km = 20 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
assert_amount( iv_expected = 60 iv_act = ls_quote-time_fee iv_msg = `time fee` ).
|
||||
assert_amount( iv_expected = 80 iv_act = ls_quote-person_fee iv_msg = `person fee` ).
|
||||
assert_amount( iv_expected = 200 iv_act = ls_quote-photo_fee iv_msg = `photo fee` ).
|
||||
assert_amount( iv_expected = 55 iv_act = ls_quote-travel_fee iv_msg = `travel fee` ).
|
||||
assert_amount( iv_expected = 40 iv_act = ls_quote-crew_fee iv_msg = `crew fee` ).
|
||||
assert_amount( iv_expected = 435 iv_act = ls_quote-total iv_msg = `total` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD studio_ignores_distance.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 1
|
||||
iv_photos = 0
|
||||
iv_distance_km = 25 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-travel_fee iv_msg = `travel fee` ).
|
||||
assert_amount( iv_expected = 40 iv_act = ls_quote-total iv_msg = `total` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounds_up_minutes.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 31
|
||||
iv_persons = 1
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 60 iv_act = ls_quote-time_fee iv_msg = `31 minutes` ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 480
|
||||
iv_persons = 1
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 640 iv_act = ls_quote-time_fee iv_msg = `480 minutes` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD free_persons.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-person_fee iv_msg = `two persons` ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 5
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 30 iv_act = ls_quote-person_fee iv_msg = `five persons` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee_large_group.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 8
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-crew_fee iv_msg = `eight persons` ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 9
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 70 iv_act = ls_quote-person_fee iv_msg = `nine persons` ).
|
||||
assert_amount( iv_expected = 40 iv_act = ls_quote-crew_fee iv_msg = `crew fee` ).
|
||||
assert_amount( iv_expected = 150 iv_act = ls_quote-total iv_msg = `total` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_rate_at_50.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 1
|
||||
iv_photos = 49
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 245 iv_act = ls_quote-photo_fee iv_msg = `49 photos` ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 1
|
||||
iv_photos = 50
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
assert_amount( iv_expected = 200 iv_act = ls_quote-photo_fee iv_msg = `50 photos` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_unknown_session.
|
||||
DATA(ls_request) = build_request( iv_session = 'WEDDING'
|
||||
iv_minutes = 5
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-session
|
||||
act = ls_quote-reason ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-total iv_msg = `total` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_minutes.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 29
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-minutes
|
||||
act = ls_quote-reason ).
|
||||
assert_amount( iv_expected = 0 iv_act = ls_quote-total iv_msg = `total` ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 481
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-minutes
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_persons.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 60
|
||||
iv_persons = 0
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-persons
|
||||
act = ls_quote-reason ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 60
|
||||
iv_persons = 21
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-persons
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_photos.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 60
|
||||
iv_persons = 2
|
||||
iv_photos = 201
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-photos
|
||||
act = ls_quote-reason ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 60
|
||||
iv_persons = 2
|
||||
iv_photos = -1
|
||||
iv_distance_km = 0 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-photos
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_outdoor_no_dist.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-outdoor
|
||||
iv_minutes = 60
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-distance
|
||||
act = ls_quote-reason ).
|
||||
|
||||
ls_request = build_request( iv_session = {{p}}photo_pricer=>c_session-outdoor
|
||||
iv_minutes = 60
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 1 ).
|
||||
ls_quote = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
assert_amount( iv_expected = 17 iv_act = ls_quote-travel_fee iv_msg = `travel fee` ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
65
tasks_gen/train/G1035/mutation.json
Normal file
65
tasks_gen/train/G1035/mutation.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"task": "G1035",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}PHOTO_PRICER",
|
||||
"mutant": "line 103: OR -> AND (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "11/12",
|
||||
"failed_tests": [
|
||||
"REJECTS_BAD_MINUTES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PHOTO_PRICER",
|
||||
"mutant": "line 107: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "3/12",
|
||||
"failed_tests": [
|
||||
"CREW_FEE_LARGE_GROUP",
|
||||
"FREE_PERSONS",
|
||||
"OUTDOOR_QUOTE",
|
||||
"PHOTO_RATE_AT_50",
|
||||
"REJECTS_BAD_PHOTOS",
|
||||
"REJECTS_OUTDOOR_NO_DIST",
|
||||
"ROUNDS_UP_MINUTES",
|
||||
"STUDIO_IGNORES_DISTANCE",
|
||||
"STUDIO_QUOTE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PHOTO_PRICER",
|
||||
"mutant": "line 109: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "10/12",
|
||||
"failed_tests": [
|
||||
"OUTDOOR_QUOTE",
|
||||
"REJECTS_OUTDOOR_NO_DIST"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PHOTO_PRICER",
|
||||
"mutant": "line 130: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "10/12",
|
||||
"failed_tests": [
|
||||
"OUTDOOR_QUOTE",
|
||||
"PHOTO_RATE_AT_50"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PHOTO_PRICER",
|
||||
"mutant": "line 132: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "10/12",
|
||||
"failed_tests": [
|
||||
"PHOTO_RATE_AT_50",
|
||||
"STUDIO_QUOTE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
148
tasks_gen/train/G1035/reference/photo_pricer.clas.abap
Normal file
148
tasks_gen/train/G1035/reference/photo_pricer.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}photo_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_session TYPE c LENGTH 7.
|
||||
TYPES ty_reason TYPE c LENGTH 8.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_request,
|
||||
session TYPE ty_session,
|
||||
minutes TYPE i,
|
||||
persons TYPE i,
|
||||
photos TYPE i,
|
||||
distance_km TYPE i,
|
||||
END OF ty_request.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
time_fee TYPE ty_amount,
|
||||
person_fee TYPE ty_amount,
|
||||
photo_fee TYPE ty_amount,
|
||||
travel_fee TYPE ty_amount,
|
||||
crew_fee TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_session,
|
||||
studio TYPE ty_session VALUE 'STUDIO',
|
||||
outdoor TYPE ty_session VALUE 'OUTDOOR',
|
||||
END OF c_session,
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
session TYPE ty_reason VALUE 'SESSION',
|
||||
minutes TYPE ty_reason VALUE 'MINUTES',
|
||||
persons TYPE ty_reason VALUE 'PERSONS',
|
||||
photos TYPE ty_reason VALUE 'PHOTOS',
|
||||
distance TYPE ty_reason VALUE 'DISTANCE',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_min_minutes TYPE i VALUE 30,
|
||||
c_max_minutes TYPE i VALUE 480,
|
||||
c_min_persons TYPE i VALUE 1,
|
||||
c_max_persons TYPE i VALUE 20,
|
||||
c_min_photos TYPE i VALUE 0,
|
||||
c_max_photos TYPE i VALUE 200,
|
||||
c_min_distance TYPE i VALUE 1,
|
||||
c_slot_minutes TYPE i VALUE 15,
|
||||
c_slot_fee TYPE ty_amount VALUE 20,
|
||||
c_free_persons TYPE i VALUE 2,
|
||||
c_person_fee TYPE ty_amount VALUE 10,
|
||||
c_bulk_limit TYPE i VALUE 50,
|
||||
c_photo_std TYPE ty_amount VALUE 5,
|
||||
c_photo_bulk TYPE ty_amount VALUE 4,
|
||||
c_travel_base TYPE ty_amount VALUE 15,
|
||||
c_travel_km TYPE ty_amount VALUE 2,
|
||||
c_crew_limit TYPE i VALUE 8,
|
||||
c_crew_fee TYPE ty_amount VALUE 40.
|
||||
|
||||
METHODS check_request
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
METHODS time_fee
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS person_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS photo_fee
|
||||
IMPORTING iv_photos TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS travel_fee
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
METHODS crew_fee
|
||||
IMPORTING iv_persons TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}photo_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
rs_quote-reason = check_request( is_request ).
|
||||
IF rs_quote-reason <> c_reason-ok.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_quote-time_fee = time_fee( is_request-minutes ).
|
||||
rs_quote-person_fee = person_fee( is_request-persons ).
|
||||
rs_quote-photo_fee = photo_fee( is_request-photos ).
|
||||
rs_quote-travel_fee = travel_fee( is_request ).
|
||||
rs_quote-crew_fee = crew_fee( is_request-persons ).
|
||||
rs_quote-total = rs_quote-time_fee + rs_quote-person_fee + rs_quote-photo_fee
|
||||
+ rs_quote-travel_fee + rs_quote-crew_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_request.
|
||||
IF is_request-session <> c_session-studio AND is_request-session <> c_session-outdoor.
|
||||
rv_reason = c_reason-session.
|
||||
ELSEIF is_request-minutes < c_min_minutes OR is_request-minutes > c_max_minutes.
|
||||
rv_reason = c_reason-minutes.
|
||||
ELSEIF is_request-persons < c_min_persons OR is_request-persons > c_max_persons.
|
||||
rv_reason = c_reason-persons.
|
||||
ELSEIF is_request-photos < c_min_photos OR is_request-photos > c_max_photos.
|
||||
rv_reason = c_reason-photos.
|
||||
ELSEIF is_request-session = c_session-outdoor AND is_request-distance_km < c_min_distance.
|
||||
rv_reason = c_reason-distance.
|
||||
ELSE.
|
||||
rv_reason = c_reason-ok.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD time_fee.
|
||||
DATA(lv_slots) = ( iv_minutes + c_slot_minutes - 1 ) DIV c_slot_minutes.
|
||||
rv_fee = lv_slots * c_slot_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD person_fee.
|
||||
DATA(lv_extra) = iv_persons - c_free_persons.
|
||||
IF lv_extra > 0.
|
||||
rv_fee = lv_extra * c_person_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD photo_fee.
|
||||
IF iv_photos >= c_bulk_limit.
|
||||
rv_fee = iv_photos * c_photo_bulk.
|
||||
ELSE.
|
||||
rv_fee = iv_photos * c_photo_std.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD travel_fee.
|
||||
IF is_request-session <> c_session-outdoor.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_travel_base + is_request-distance_km * c_travel_km.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_fee.
|
||||
IF iv_persons > c_crew_limit.
|
||||
rv_fee = c_crew_fee.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
121
tasks_gen/train/G1035/reference/photo_pricer.testclasses.abap
Normal file
121
tasks_gen/train/G1035/reference/photo_pricer.testclasses.abap
Normal file
@@ -0,0 +1,121 @@
|
||||
CLASS ltc_photo_pricer DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}photo_pricer.
|
||||
|
||||
METHODS setup.
|
||||
METHODS studio_quote FOR TESTING.
|
||||
METHODS outdoor_quote FOR TESTING.
|
||||
METHODS studio_ignores_distance FOR TESTING.
|
||||
METHODS rounds_up_minutes FOR TESTING.
|
||||
METHODS rejects_unknown_session FOR TESTING.
|
||||
METHODS rejects_bad_minutes FOR TESTING.
|
||||
METHODS rejects_outdoor_no_distance FOR TESTING.
|
||||
|
||||
METHODS build_request
|
||||
IMPORTING iv_session TYPE {{p}}photo_pricer=>ty_session
|
||||
iv_minutes TYPE i
|
||||
iv_persons TYPE i
|
||||
iv_photos TYPE i
|
||||
iv_distance_km TYPE i
|
||||
RETURNING VALUE(rs_request) TYPE {{p}}photo_pricer=>ty_request.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_photo_pricer IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}photo_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD build_request.
|
||||
rs_request = VALUE #( session = iv_session
|
||||
minutes = iv_minutes
|
||||
persons = iv_persons
|
||||
photos = iv_photos
|
||||
distance_km = iv_distance_km ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD studio_quote.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 90
|
||||
iv_persons = 3
|
||||
iv_photos = 10
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV {{p}}photo_pricer=>ty_amount( 180 )
|
||||
act = ls_quote-total ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD outdoor_quote.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-outdoor
|
||||
iv_minutes = 45
|
||||
iv_persons = 10
|
||||
iv_photos = 50
|
||||
iv_distance_km = 20 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV {{p}}photo_pricer=>ty_amount( 435 )
|
||||
act = ls_quote-total ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD studio_ignores_distance.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 30
|
||||
iv_persons = 1
|
||||
iv_photos = 0
|
||||
iv_distance_km = 25 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV {{p}}photo_pricer=>ty_amount( 0 )
|
||||
act = ls_quote-travel_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounds_up_minutes.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 31
|
||||
iv_persons = 1
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV {{p}}photo_pricer=>ty_amount( 60 )
|
||||
act = ls_quote-time_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_unknown_session.
|
||||
DATA(ls_request) = build_request( iv_session = 'WEDDING'
|
||||
iv_minutes = 60
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-session
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_minutes.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-studio
|
||||
iv_minutes = 29
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-minutes
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_outdoor_no_distance.
|
||||
DATA(ls_request) = build_request( iv_session = {{p}}photo_pricer=>c_session-outdoor
|
||||
iv_minutes = 60
|
||||
iv_persons = 2
|
||||
iv_photos = 0
|
||||
iv_distance_km = 0 ).
|
||||
DATA(ls_quote) = mo_cut->calculate( ls_request ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}photo_pricer=>c_reason-distance
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
80
tasks_gen/train/G1035/spec.md
Normal file
80
tasks_gen/train/G1035/spec.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# 1. Goal
|
||||
|
||||
A photo studio prices a photo shoot. A booking program calls the calculation
|
||||
before it shows the quote to the customer. The program needs the fee parts and
|
||||
the total fee.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- The class {{P}}PHOTO_PRICER does not exist. Create it in package $TMP.
|
||||
- The booking program uses the public types, the public constants and the
|
||||
public method of the class. It does not use other parts of the class.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
- Create the class {{P}}PHOTO_PRICER in package $TMP.
|
||||
- The class is public and final. It has a public constructor without parameters.
|
||||
- The class has these public types:
|
||||
- ty_session: type c, length 7.
|
||||
- ty_reason: type c, length 8.
|
||||
- ty_amount: type p, length 8, 2 decimal places.
|
||||
- ty_request: a structure with the components session (ty_session),
|
||||
minutes (i), persons (i), photos (i) and distance_km (i).
|
||||
- ty_quote: a structure with the components time_fee (ty_amount),
|
||||
person_fee (ty_amount), photo_fee (ty_amount), travel_fee (ty_amount),
|
||||
crew_fee (ty_amount), total (ty_amount) and reason (ty_reason).
|
||||
- The class has these public constants:
|
||||
- c_session with the components studio = 'STUDIO' and outdoor = 'OUTDOOR'.
|
||||
Both components have the type ty_session.
|
||||
- c_reason with the components ok = 'OK', session = 'SESSION',
|
||||
minutes = 'MINUTES', persons = 'PERSONS', photos = 'PHOTOS' and
|
||||
distance = 'DISTANCE'. All components have the type ty_reason.
|
||||
- The class has one public method:
|
||||
calculate
|
||||
IMPORTING is_request TYPE ty_request
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
First check the input. Apply the checks in this sequence. If a check fails, set
|
||||
rs_quote-reason to the reason of that check, keep all fee components and the
|
||||
total at 0, and stop.
|
||||
|
||||
1. is_request-session must be STUDIO or OUTDOOR. Else reason = SESSION.
|
||||
2. is_request-minutes must be 30 or more and 480 or less. Else reason = MINUTES.
|
||||
3. is_request-persons must be 1 or more and 20 or less. Else reason = PERSONS.
|
||||
4. is_request-photos must be 0 or more and 200 or less. Else reason = PHOTOS.
|
||||
5. If the session is OUTDOOR, is_request-distance_km must be 1 or more. Else
|
||||
reason = DISTANCE. For a STUDIO session, ignore distance_km.
|
||||
|
||||
If all checks pass, set reason = OK and calculate the fees.
|
||||
|
||||
- time_fee: each started 15 minutes of the shoot costs 20.00. Example: 30
|
||||
minutes cost 40.00. 31 minutes cost 60.00. 480 minutes cost 640.00.
|
||||
- person_fee: the first 2 persons are free. Each other person costs 10.00.
|
||||
- photo_fee: if photos is less than 50, each photo costs 5.00. If photos is 50
|
||||
or more, each photo costs 4.00.
|
||||
- travel_fee: for a STUDIO session, 0.00. For an OUTDOOR session, 15.00 plus
|
||||
2.00 for each kilometre of distance_km.
|
||||
- crew_fee: if persons is more than 8, the studio sends a second photographer.
|
||||
The crew_fee is then 40.00. Else the crew_fee is 0.00.
|
||||
- total: the sum of time_fee, person_fee, photo_fee, travel_fee and crew_fee.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: SAP_BASIS 816.
|
||||
- Coding standards: Clean ABAP. Each method has less than 40 statements. No
|
||||
global variables. No comment that restates the code.
|
||||
- Out of scope: database access, ALV lists, CDS views, function modules,
|
||||
reports and dynpros.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
48
tasks_gen/train/G1035/task.json
Normal file
48
tasks_gen/train/G1035/task.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"id": "G1035",
|
||||
"category": "A",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}PHOTO_PRICER"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"database access",
|
||||
"ALV lists",
|
||||
"CDS views",
|
||||
"function modules",
|
||||
"reports",
|
||||
"dynpros"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T120_HIDDEN",
|
||||
"file": "hidden/t120_hidden.clas.abap",
|
||||
"description": "T120 hidden tests for the photo shoot pricer"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}PHOTO_PRICER",
|
||||
"file": "reference/photo_pricer.clas.abap",
|
||||
"description": "Photo shoot pricer",
|
||||
"testclasses_file": "reference/photo_pricer.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"cyclomatic_complexity"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user