Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}move_fee
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
CONSTANTS lc_box_rate TYPE decfloat34 VALUE '1.5'.
CONSTANTS lc_exp_rate TYPE decfloat34 VALUE '1.2'.
DATA lv_rate TYPE decfloat34.
DATA lv_subtotal TYPE decfloat34.
ev_fee = 0.
IF iv_order_no IS INITIAL.
ev_msg = 'Order number is missing'.
RAISE invalid_order.
ENDIF.
IF iv_move_date IS INITIAL.
ev_msg = 'Move date is missing'.
RAISE invalid_date.
ENDIF.
IF iv_work_hours > 0.
ev_msg = 'Work hours are not positive'.
RAISE invalid_hours.
ENDIF.
IF iv_box_count < 0.
ev_msg = 'Box count is negative'.
RAISE invalid_count.
ENDIF.
CASE iv_calc_mode.
WHEN 'ECO'.
lv_rate = 45.
WHEN 'STD'.
lv_rate = 60.
WHEN 'EXP'.
lv_rate = 75.
WHEN OTHERS.
ev_msg = 'Calculation mode is unknown'.
RAISE unknown_mode.
ENDCASE.
lv_subtotal = iv_work_hours * lv_rate + iv_box_count * lc_box_rate.
IF iv_calc_mode = 'EXP'.
lv_subtotal = lv_subtotal * lc_exp_rate.
ENDIF.
ev_fee = round( val = lv_subtotal dec = 2 mode = cl_abap_math=>round_half_up ).
ev_msg = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}move_fee
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
CONSTANTS lc_box_rate TYPE decfloat34 VALUE '1.5'.
CONSTANTS lc_exp_rate TYPE decfloat34 VALUE '1.2'.
DATA lv_rate TYPE decfloat34.
DATA lv_subtotal TYPE decfloat34.
ev_fee = 0.
IF iv_order_no IS INITIAL.
ev_msg = 'Order number is missing'.
RAISE invalid_order.
ENDIF.
IF iv_move_date IS INITIAL.
ev_msg = 'Move date is missing'.
RAISE invalid_date.
ENDIF.
IF iv_work_hours <= 0.
ev_msg = 'Work hours are not positive'.
RAISE invalid_hours.
ENDIF.
IF iv_box_count < 0.
ev_msg = 'Box count is negative'.
RAISE invalid_count.
ENDIF.
CASE iv_calc_mode.
WHEN 'ECO'.
lv_rate = 45.
WHEN 'STD'.
lv_rate = 60.
WHEN 'EXP'.
lv_rate = 75.
WHEN OTHERS.
ev_msg = 'Calculation mode is unknown'.
RAISE unknown_mode.
ENDCASE.
lv_subtotal = iv_work_hours / lv_rate + iv_box_count * lc_box_rate.
IF iv_calc_mode = 'EXP'.
lv_subtotal = lv_subtotal * lc_exp_rate.
ENDIF.
ev_fee = round( val = lv_subtotal dec = 2 mode = cl_abap_math=>round_half_up ).
ev_msg = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}move_fee
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
CONSTANTS lc_box_rate TYPE decfloat34 VALUE '1.5'.
CONSTANTS lc_exp_rate TYPE decfloat34 VALUE '1.2'.
DATA lv_rate TYPE decfloat34.
DATA lv_subtotal TYPE decfloat34.
ev_fee = 0.
IF iv_order_no IS INITIAL.
ev_msg = 'Order number is missing'.
RAISE invalid_order.
ENDIF.
IF iv_move_date IS INITIAL.
ev_msg = 'Move date is missing'.
RAISE invalid_date.
ENDIF.
IF iv_work_hours <= 0.
ev_msg = 'Work hours are not positive'.
RAISE invalid_hours.
ENDIF.
IF iv_box_count < 0.
ev_msg = 'Box count is negative'.
RAISE invalid_count.
ENDIF.
CASE iv_calc_mode.
WHEN 'ECO'.
lv_rate = 45.
WHEN 'STD'.
lv_rate = 60.
WHEN 'EXP'.
lv_rate = 75.
WHEN OTHERS.
ev_msg = 'Calculation mode is unknown'.
RAISE unknown_mode.
ENDCASE.
lv_subtotal = iv_work_hours * lv_rate + iv_box_count / lc_box_rate.
IF iv_calc_mode = 'EXP'.
lv_subtotal = lv_subtotal * lc_exp_rate.
ENDIF.
ev_fee = round( val = lv_subtotal dec = 2 mode = cl_abap_math=>round_half_up ).
ev_msg = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}move_fee
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
CONSTANTS lc_box_rate TYPE decfloat34 VALUE '1.5'.
CONSTANTS lc_exp_rate TYPE decfloat34 VALUE '1.2'.
DATA lv_rate TYPE decfloat34.
DATA lv_subtotal TYPE decfloat34.
ev_fee = 0.
IF iv_order_no IS INITIAL.
ev_msg = 'Order number is missing'.
RAISE invalid_order.
ENDIF.
IF iv_move_date IS INITIAL.
ev_msg = 'Move date is missing'.
RAISE invalid_date.
ENDIF.
IF iv_work_hours <= 0.
ev_msg = 'Work hours are not positive'.
RAISE invalid_hours.
ENDIF.
IF iv_box_count < 0.
ev_msg = 'Box count is negative'.
RAISE invalid_count.
ENDIF.
CASE iv_calc_mode.
WHEN 'ECO'.
lv_rate = 45.
WHEN 'STD'.
lv_rate = 60.
WHEN 'EXP'.
lv_rate = 75.
WHEN OTHERS.
ev_msg = 'Calculation mode is unknown'.
RAISE unknown_mode.
ENDCASE.
lv_subtotal = iv_work_hours * lv_rate + iv_box_count * lc_box_rate.
IF iv_calc_mode <> 'EXP'.
lv_subtotal = lv_subtotal * lc_exp_rate.
ENDIF.
ev_fee = round( val = lv_subtotal dec = 2 mode = cl_abap_math=>round_half_up ).
ev_msg = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}move_fee
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
CONSTANTS lc_box_rate TYPE decfloat34 VALUE '1.5'.
CONSTANTS lc_exp_rate TYPE decfloat34 VALUE '1.2'.
DATA lv_rate TYPE decfloat34.
DATA lv_subtotal TYPE decfloat34.
ev_fee = 0.
IF iv_order_no IS INITIAL.
ev_msg = 'Order number is missing'.
RAISE invalid_order.
ENDIF.
IF iv_move_date IS INITIAL.
ev_msg = 'Move date is missing'.
RAISE invalid_date.
ENDIF.
IF iv_work_hours <= 0.
ev_msg = 'Work hours are not positive'.
RAISE invalid_hours.
ENDIF.
IF iv_box_count < 0.
ev_msg = 'Box count is negative'.
RAISE invalid_count.
ENDIF.
CASE iv_calc_mode.
WHEN 'ECO'.
lv_rate = 45.
WHEN 'STD'.
lv_rate = 60.
WHEN 'EXP'.
lv_rate = 75.
WHEN OTHERS.
ev_msg = 'Calculation mode is unknown'.
RAISE unknown_mode.
ENDCASE.
lv_subtotal = iv_work_hours * lv_rate + iv_box_count * lc_box_rate.
IF iv_calc_mode = 'EXP'.
lv_subtotal = lv_subtotal * lc_exp_rate.
ENDIF.
ev_fee = round( val = lv_subtotal dec = 3 mode = cl_abap_math=>round_half_up ).
ev_msg = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,24 @@
{
"id": "G1144",
"pool": "train",
"object_type": "FUNC",
"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
}

View File

@@ -0,0 +1,135 @@
CLASS {{p}}move_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call
IMPORTING iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING ev_fee TYPE decfloat34
ev_msg TYPE string
ev_subrc TYPE sysubrc.
METHODS eco_base_fee FOR TESTING.
METHODS std_base_fee FOR TESTING.
METHODS box_fee_added FOR TESTING.
METHODS exp_surcharge FOR TESTING.
METHODS rounds_half_up FOR TESTING.
METHODS rejects_empty_order FOR TESTING.
METHODS rejects_empty_date FOR TESTING.
METHODS rejects_bad_hours FOR TESTING.
METHODS rejects_negative_boxes FOR TESTING.
METHODS rejects_unknown_mode FOR TESTING.
METHODS first_error_wins FOR TESTING.
ENDCLASS.
CLASS {{p}}move_hidden IMPLEMENTATION.
METHOD call.
ev_fee = 0.
ev_msg = ''.
CALL FUNCTION '{{P}}MOVE_FEE'
EXPORTING
iv_order_no = iv_order_no
iv_move_date = iv_move_date
iv_work_hours = iv_work_hours
iv_box_count = iv_box_count
iv_calc_mode = iv_calc_mode
IMPORTING
ev_fee = ev_fee
ev_msg = ev_msg
EXCEPTIONS
invalid_order = 1
invalid_date = 2
invalid_hours = 3
invalid_count = 4
unknown_mode = 5
OTHERS = 6.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD eco_base_fee.
call( EXPORTING iv_order_no = `A1` iv_move_date = '20250101'
iv_work_hours = 3 iv_box_count = 0 iv_calc_mode = `ECO`
IMPORTING ev_fee = DATA(lv_fee) ev_msg = DATA(lv_msg) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 135 ) act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = `OK` act = lv_msg ).
ENDMETHOD.
METHOD std_base_fee.
call( EXPORTING iv_order_no = `A2` iv_move_date = '20250201'
iv_work_hours = 2 iv_box_count = 0 iv_calc_mode = `STD`
IMPORTING ev_fee = DATA(lv_fee) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = lv_fee ).
ENDMETHOD.
METHOD box_fee_added.
call( EXPORTING iv_order_no = `A3` iv_move_date = '20250201'
iv_work_hours = 1 iv_box_count = 4 iv_calc_mode = `STD`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 66 ) act = lv_fee ).
ENDMETHOD.
METHOD exp_surcharge.
call( EXPORTING iv_order_no = `A4` iv_move_date = '20250201'
iv_work_hours = 1 iv_box_count = 2 iv_calc_mode = `EXP`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '93.6' ) act = lv_fee ).
ENDMETHOD.
METHOD rounds_half_up.
call( EXPORTING iv_order_no = `A5` iv_move_date = '20250201'
iv_work_hours = '1.005' iv_box_count = 0 iv_calc_mode = `ECO`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.23' ) act = lv_fee ).
ENDMETHOD.
METHOD rejects_empty_order.
call( EXPORTING iv_order_no = `` iv_move_date = '20250101'
iv_work_hours = 1 iv_box_count = 0 iv_calc_mode = `STD`
IMPORTING ev_msg = DATA(lv_msg) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = `Order number is missing` act = lv_msg ).
ENDMETHOD.
METHOD rejects_empty_date.
call( EXPORTING iv_order_no = `A6` iv_move_date = '00000000'
iv_work_hours = 1 iv_box_count = 0 iv_calc_mode = `STD`
IMPORTING ev_msg = DATA(lv_msg) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = `Move date is missing` act = lv_msg ).
ENDMETHOD.
METHOD rejects_bad_hours.
call( EXPORTING iv_order_no = `A7` iv_move_date = '20250101'
iv_work_hours = 0 iv_box_count = 0 iv_calc_mode = `STD`
IMPORTING ev_msg = DATA(lv_msg) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = `Work hours are not positive` act = lv_msg ).
ENDMETHOD.
METHOD rejects_negative_boxes.
call( EXPORTING iv_order_no = `A8` iv_move_date = '20250101'
iv_work_hours = 1 iv_box_count = -1 iv_calc_mode = `STD`
IMPORTING ev_msg = DATA(lv_msg) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = `Box count is negative` act = lv_msg ).
ENDMETHOD.
METHOD rejects_unknown_mode.
call( EXPORTING iv_order_no = `A9` iv_move_date = '20250101'
iv_work_hours = 1 iv_box_count = 0 iv_calc_mode = `FIX`
IMPORTING ev_msg = DATA(lv_msg) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = `Calculation mode is unknown` act = lv_msg ).
ENDMETHOD.
METHOD first_error_wins.
call( EXPORTING iv_order_no = `` iv_move_date = '00000000'
iv_work_hours = -2 iv_box_count = -1 iv_calc_mode = `FIX`
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,70 @@
{
"task": "G1144",
"mutants": [
{
"object": "{{P}}MOVE_FEE",
"mutant": "line 36: <= -> > (rel)",
"status": "killed",
"hidden": "3/11",
"failed_tests": [
"BOX_FEE_ADDED",
"ECO_BASE_FEE",
"EXP_SURCHARGE",
"REJECTS_BAD_HOURS",
"REJECTS_NEGATIVE_BOXES",
"REJECTS_UNKNOWN_MODE",
"ROUNDS_HALF_UP",
"STD_BASE_FEE"
]
},
{
"object": "{{P}}MOVE_FEE",
"mutant": "line 58: * -> / (arith)",
"status": "killed",
"hidden": "6/11",
"failed_tests": [
"BOX_FEE_ADDED",
"ECO_BASE_FEE",
"EXP_SURCHARGE",
"ROUNDS_HALF_UP",
"STD_BASE_FEE"
]
},
{
"object": "{{P}}MOVE_FEE",
"mutant": "line 58: * -> / (arith)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"BOX_FEE_ADDED",
"EXP_SURCHARGE"
]
},
{
"object": "{{P}}MOVE_FEE",
"mutant": "line 59: = -> <> (eq)",
"status": "killed",
"hidden": "6/11",
"failed_tests": [
"BOX_FEE_ADDED",
"ECO_BASE_FEE",
"EXP_SURCHARGE",
"ROUNDS_HALF_UP",
"STD_BASE_FEE"
]
},
{
"object": "{{P}}MOVE_FEE",
"mutant": "line 63: 2 -> 3 (const)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"ROUNDS_HALF_UP"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,66 @@
FUNCTION {{p}}move_fee
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
CONSTANTS lc_box_rate TYPE decfloat34 VALUE '1.5'.
CONSTANTS lc_exp_rate TYPE decfloat34 VALUE '1.2'.
DATA lv_rate TYPE decfloat34.
DATA lv_subtotal TYPE decfloat34.
ev_fee = 0.
IF iv_order_no IS INITIAL.
ev_msg = 'Order number is missing'.
RAISE invalid_order.
ENDIF.
IF iv_move_date IS INITIAL.
ev_msg = 'Move date is missing'.
RAISE invalid_date.
ENDIF.
IF iv_work_hours <= 0.
ev_msg = 'Work hours are not positive'.
RAISE invalid_hours.
ENDIF.
IF iv_box_count < 0.
ev_msg = 'Box count is negative'.
RAISE invalid_count.
ENDIF.
CASE iv_calc_mode.
WHEN 'ECO'.
lv_rate = 45.
WHEN 'STD'.
lv_rate = 60.
WHEN 'EXP'.
lv_rate = 75.
WHEN OTHERS.
ev_msg = 'Calculation mode is unknown'.
RAISE unknown_mode.
ENDCASE.
lv_subtotal = iv_work_hours * lv_rate + iv_box_count * lc_box_rate.
IF iv_calc_mode = 'EXP'.
lv_subtotal = lv_subtotal * lc_exp_rate.
ENDIF.
ev_fee = round( val = lv_subtotal dec = 2 mode = cl_abap_math=>round_half_up ).
ev_msg = 'OK'.
ENDFUNCTION.

View File

@@ -0,0 +1,104 @@
CLASS {{p}}move_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS fee_for
IMPORTING iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
RETURNING VALUE(rv_fee) TYPE decfloat34.
METHODS eco_fee FOR TESTING.
METHODS express_fee FOR TESTING.
METHODS box_fee FOR TESTING.
METHODS rejects_zero_hours FOR TESTING.
METHODS first_error_wins FOR TESTING.
ENDCLASS.
CLASS {{p}}move_test IMPLEMENTATION.
METHOD fee_for.
DATA lv_msg TYPE string.
CALL FUNCTION '{{P}}MOVE_FEE'
EXPORTING
iv_order_no = iv_order_no
iv_move_date = iv_move_date
iv_work_hours = iv_work_hours
iv_box_count = iv_box_count
iv_calc_mode = iv_calc_mode
IMPORTING
ev_fee = rv_fee
ev_msg = lv_msg
EXCEPTIONS
invalid_order = 1
invalid_date = 2
invalid_hours = 3
invalid_count = 4
unknown_mode = 5
OTHERS = 6.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD eco_fee.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 135 )
act = fee_for( iv_order_no = `A1` iv_move_date = '20250101'
iv_work_hours = 3 iv_box_count = 0 iv_calc_mode = `ECO` ) ).
ENDMETHOD.
METHOD express_fee.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( '93.6' )
act = fee_for( iv_order_no = `A2` iv_move_date = '20250101'
iv_work_hours = 1 iv_box_count = 2 iv_calc_mode = `EXP` ) ).
ENDMETHOD.
METHOD box_fee.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 66 )
act = fee_for( iv_order_no = `A3` iv_move_date = '20250101'
iv_work_hours = 1 iv_box_count = 4 iv_calc_mode = `STD` ) ).
ENDMETHOD.
METHOD rejects_zero_hours.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}MOVE_FEE'
EXPORTING
iv_order_no = `A4`
iv_move_date = '20250101'
iv_work_hours = 0
iv_box_count = 0
iv_calc_mode = `STD`
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_order = 1
invalid_date = 2
invalid_hours = 3
invalid_count = 4
unknown_mode = 5
OTHERS = 6.
cl_abap_unit_assert=>assert_equals( exp = 3 act = sy-subrc ).
ENDMETHOD.
METHOD first_error_wins.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}MOVE_FEE'
EXPORTING
iv_order_no = ``
iv_move_date = '00000000'
iv_work_hours = -1
iv_box_count = -1
iv_calc_mode = `FIX`
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_order = 1
invalid_date = 2
invalid_hours = 3
invalid_count = 4
unknown_mode = 5
OTHERS = 6.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,18 @@
FUNCTION {{p}}move_sample
IMPORTING
iv_order_no TYPE string
iv_move_date TYPE d
iv_work_hours TYPE decfloat34
iv_box_count TYPE i
iv_calc_mode TYPE string
EXPORTING
ev_fee TYPE decfloat34
ev_msg TYPE string
EXCEPTIONS
invalid_order
invalid_date
invalid_hours
invalid_count
unknown_mode.
ENDFUNCTION.

View File

@@ -0,0 +1,58 @@
# 1. Goal
Calculate the price of a house move for a removal company. The dispatch program
calls one function module for each move order. The function module must reject
bad input with the correct exception and must give a short message text.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_MOVE exists in package $TMP.
- Function module {{P}}MOVE_SAMPLE exists in this group. It is the interface
template for all move fee modules. Its body is empty.
# 4. Contract
- Create the function module {{P}}MOVE_FEE in function group {{P}}FG_MOVE.
- Use exactly the interface of {{P}}MOVE_SAMPLE: the same parameter names,
kinds, types and exceptions.
- Importing parameters: iv_order_no (string), iv_move_date (date),
iv_work_hours (decfloat34), iv_box_count (integer), iv_calc_mode (string).
- Exporting parameters: ev_fee (decfloat34), ev_msg (string).
- Exceptions: invalid_order, invalid_date, invalid_hours, invalid_count,
unknown_mode.
# 5. Business rules
1. Check the input in this order: order number, move date, work hours, box
count, calculation mode. Raise only the first exception that applies.
2. The order number is empty: raise invalid_order.
3. The move date is empty: raise invalid_date.
4. The work hours are zero or negative: raise invalid_hours.
5. The box count is negative: raise invalid_count.
6. The calculation mode is not ECO, STD or EXP: raise unknown_mode.
7. The hourly rate is 45.00 for ECO, 60.00 for STD and 75.00 for EXP. The base
fee is the work hours multiplied by the hourly rate.
8. The box fee is 1.50 for each box.
9. The subtotal is the base fee plus the box fee.
10. For mode EXP, increase the subtotal by 20 %.
11. The fee is the subtotal rounded half up to 2 decimals.
12. ev_msg is 'OK' after a successful call. If the function module raises an
exception, ev_msg holds the text of the failed check:
- invalid_order: 'Order number is missing'
- invalid_date: 'Move date is missing'
- invalid_hours: 'Work hours are not positive'
- invalid_count: 'Box count is negative'
- unknown_mode: 'Calculation mode is unknown'
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Keep each method below 40 statements.
- The business domain uses words that are reserved in ABAP or in ABAP SQL
(hours, mode, order, date, count, group, value). Use the parameter names of
the contract. Do not use a reserved word as the name of a parameter, a field
or a data object.
- Out of scope: do not change {{P}}MOVE_SAMPLE.
# 7. Acceptance
- The function module {{P}}MOVE_FEE is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the function module in a global test class.

View File

@@ -0,0 +1,92 @@
{
"id": "G1144",
"category": "D",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_MOVE",
"description": "Function group for removal move pricing"
},
{
"type": "FUNC",
"name": "{{P}}MOVE_SAMPLE",
"functionGroup": "{{P}}FG_MOVE",
"file": "seed/move_sample.func.abap",
"description": "Interface template for move fee modules"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}MOVE_FEE",
"functionGroup": "{{P}}FG_MOVE",
"params": [
{
"name": "iv_order_no",
"type": "string"
},
{
"name": "iv_move_date",
"type": "d"
},
{
"name": "iv_work_hours",
"type": "decfloat34"
},
{
"name": "iv_box_count",
"type": "i"
},
{
"name": "iv_calc_mode",
"type": "string"
},
{
"name": "ev_fee",
"type": "decfloat34"
},
{
"name": "ev_msg",
"type": "string"
}
]
}
],
"out_of_scope": [
"{{P}}MOVE_SAMPLE"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}MOVE_HIDDEN",
"file": "hidden/move_hidden.clas.abap",
"description": "D14 hidden tests"
}
],
"reference": [
{
"type": "FUNC",
"name": "{{P}}MOVE_FEE",
"functionGroup": "{{P}}FG_MOVE",
"file": "reference/move_fee.func.abap",
"description": "Move fee module"
},
{
"type": "CLAS",
"name": "{{P}}MOVE_TEST",
"file": "reference/move_test.clas.abap",
"description": "D14 own tests"
}
],
"craft_checks": [
"method_length"
]
}