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:
Kral
2026-10-05 13:35:54 +02:00
parent 1c4667a0fc
commit 13360292dd
781 changed files with 50211 additions and 22 deletions

View File

@@ -0,0 +1,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm > 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 100 <> 0.
lv_metres = lv_metres + 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house = abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_true.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm <= 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 101 <> 0.
lv_metres = lv_metres + 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house = abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_true.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm <= 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 100 <> 0.
lv_metres = lv_metres - 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house = abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_true.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm <= 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 100 <> 0.
lv_metres = lv_metres + 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house <> abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_true.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm <= 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 100 <> 0.
lv_metres = lv_metres + 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house = abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_false.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,52 @@
{
"id": "G1046",
"pool": "train",
"object_type": "FUNC",
"category": "G",
"attempts": [
{
"stage": "bundle",
"errors": [
"reference/tree_test.clas.abap line 39: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/tree_test.clas.abap line 42: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/tree_test.clas.abap line 45: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/tree_test.clas.abap line 51: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/tree_test.clas.abap line 57: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/tree_test.clas.abap line 73: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 49: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 56: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 63: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 70: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 77: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 84: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 91: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 98: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 106: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/tree_hidden.clas.abap line 115: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\""
],
"by_check": {
"abaplint": 16
}
},
{
"stage": "bundle",
"errors": [
"reference/tree_test.clas.abap line 64: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"63\""
],
"by_check": {
"abaplint": 1
}
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,128 @@
CLASS {{p}}tree_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
ev_subrc TYPE sysubrc.
METHODS expect_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
iv_expected TYPE decfloat34.
METHODS oak_base_fee FOR TESTING.
METHODS pine_base_fee FOR TESTING.
METHODS birch_base_fee FOR TESTING.
METHODS other_species_fee FOR TESTING.
METHODS height_surcharge FOR TESTING.
METHODS started_metre_counts FOR TESTING.
METHODS house_surcharge FOR TESTING.
METHODS house_rounding FOR TESTING.
METHODS tall_tree_warning FOR TESTING.
METHODS no_warning_normal FOR TESTING.
METHODS invalid_height FOR TESTING.
ENDCLASS.
CLASS {{p}}tree_hidden IMPLEMENTATION.
METHOD call.
ev_fee = 0.
ev_warning = abap_false.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = iv_species
iv_height_cm = iv_height_cm
iv_near_house = iv_near_house
IMPORTING
ev_fee = ev_fee
ev_warning = ev_warning
EXCEPTIONS
invalid_height = 1
OTHERS = 2.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD expect_fee.
DATA lv_fee TYPE decfloat34.
call( EXPORTING iv_species = iv_species iv_height_cm = iv_height_cm
iv_near_house = iv_near_house
IMPORTING ev_fee = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = lv_fee ).
ENDMETHOD.
METHOD oak_base_fee.
expect_fee( EXPORTING iv_species = 'OAK' iv_height_cm = 300
iv_near_house = abap_false iv_expected = 200 ).
ENDMETHOD.
METHOD pine_base_fee.
expect_fee( EXPORTING iv_species = 'PINE' iv_height_cm = 400
iv_near_house = abap_false iv_expected = 150 ).
ENDMETHOD.
METHOD birch_base_fee.
expect_fee( EXPORTING iv_species = 'BIRCH' iv_height_cm = 300
iv_near_house = abap_false iv_expected = 120 ).
ENDMETHOD.
METHOD other_species_fee.
expect_fee( EXPORTING iv_species = 'ELM' iv_height_cm = 300
iv_near_house = abap_false iv_expected = 100 ).
ENDMETHOD.
METHOD height_surcharge.
expect_fee( EXPORTING iv_species = 'OAK' iv_height_cm = 620
iv_near_house = abap_false iv_expected = 250 ).
ENDMETHOD.
METHOD started_metre_counts.
expect_fee( EXPORTING iv_species = 'PINE' iv_height_cm = 501
iv_near_house = abap_false iv_expected = 175 ).
ENDMETHOD.
METHOD house_surcharge.
expect_fee( EXPORTING iv_species = 'OAK' iv_height_cm = 620
iv_near_house = abap_true iv_expected = '281.25' ).
ENDMETHOD.
METHOD house_rounding.
expect_fee( EXPORTING iv_species = 'ELM' iv_height_cm = 550
iv_near_house = abap_true iv_expected = '140.63' ).
ENDMETHOD.
METHOD tall_tree_warning.
DATA lv_fee TYPE decfloat34.
DATA lv_warning TYPE abap_bool.
call( EXPORTING iv_species = 'OAK' iv_height_cm = 2500
iv_near_house = abap_false
IMPORTING ev_fee = lv_fee ev_warning = lv_warning ).
cl_abap_unit_assert=>assert_equals( exp = 1200 act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_warning ).
ENDMETHOD.
METHOD no_warning_normal.
DATA lv_fee TYPE decfloat34.
DATA lv_warning TYPE abap_bool.
call( EXPORTING iv_species = 'OAK' iv_height_cm = 1000
iv_near_house = abap_false
IMPORTING ev_fee = lv_fee ev_warning = lv_warning ).
cl_abap_unit_assert=>assert_equals( exp = 325 act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_warning ).
ENDMETHOD.
METHOD invalid_height.
DATA lv_subrc TYPE sysubrc.
call( EXPORTING iv_species = 'OAK' iv_height_cm = 0 iv_near_house = abap_false
IMPORTING ev_subrc = lv_subrc ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
call( EXPORTING iv_species = 'OAK' iv_height_cm = -5 iv_near_house = abap_false
IMPORTING ev_subrc = lv_subrc ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,77 @@
{
"task": "G1046",
"mutants": [
{
"object": "{{P}}TREE_FEE",
"mutant": "line 20: <= -> > (rel)",
"status": "killed",
"hidden": "0/11",
"failed_tests": [
"BIRCH_BASE_FEE",
"HEIGHT_SURCHARGE",
"HOUSE_ROUNDING",
"HOUSE_SURCHARGE",
"INVALID_HEIGHT",
"NO_WARNING_NORMAL",
"OAK_BASE_FEE",
"OTHER_SPECIES_FEE",
"PINE_BASE_FEE",
"STARTED_METRE_COUNTS",
"TALL_TREE_WARNING"
]
},
{
"object": "{{P}}TREE_FEE",
"mutant": "line 36: 100 -> 101 (const)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"NO_WARNING_NORMAL",
"TALL_TREE_WARNING"
]
},
{
"object": "{{P}}TREE_FEE",
"mutant": "line 37: + -> - (arith)",
"status": "killed",
"hidden": "7/11",
"failed_tests": [
"HEIGHT_SURCHARGE",
"HOUSE_ROUNDING",
"HOUSE_SURCHARGE",
"STARTED_METRE_COUNTS"
]
},
{
"object": "{{P}}TREE_FEE",
"mutant": "line 47: = -> <> (eq)",
"status": "killed",
"hidden": "1/11",
"failed_tests": [
"BIRCH_BASE_FEE",
"HEIGHT_SURCHARGE",
"HOUSE_ROUNDING",
"HOUSE_SURCHARGE",
"NO_WARNING_NORMAL",
"OAK_BASE_FEE",
"OTHER_SPECIES_FEE",
"PINE_BASE_FEE",
"STARTED_METRE_COUNTS",
"TALL_TREE_WARNING"
]
},
{
"object": "{{P}}TREE_FEE",
"mutant": "line 52: abap_true -> abap_false (bool)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"TALL_TREE_WARNING"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm <= 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 100 <> 0.
lv_metres = lv_metres + 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house = abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_true.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,103 @@
CLASS {{p}}tree_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS fee_for
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
RETURNING
VALUE(rv_fee) TYPE decfloat34.
METHODS species_fees FOR TESTING.
METHODS height_fee FOR TESTING.
METHODS house_fee FOR TESTING.
METHODS tall_tree FOR TESTING.
METHODS invalid_height FOR TESTING.
ENDCLASS.
CLASS {{p}}tree_test IMPLEMENTATION.
METHOD fee_for.
DATA lv_fee TYPE decfloat34.
DATA lv_warning TYPE abap_bool.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = iv_species
iv_height_cm = iv_height_cm
iv_near_house = iv_near_house
IMPORTING
ev_fee = lv_fee
ev_warning = lv_warning
EXCEPTIONS
invalid_height = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
rv_fee = lv_fee.
ENDMETHOD.
METHOD species_fees.
DATA lv_exp TYPE decfloat34.
lv_exp = 200.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'OAK' iv_height_cm = 300 iv_near_house = abap_false ) ).
lv_exp = 120.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'BIRCH' iv_height_cm = 300 iv_near_house = abap_false ) ).
lv_exp = 100.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'ELM' iv_height_cm = 300 iv_near_house = abap_false ) ).
ENDMETHOD.
METHOD height_fee.
DATA lv_exp TYPE decfloat34.
lv_exp = 250.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'OAK' iv_height_cm = 620 iv_near_house = abap_false ) ).
ENDMETHOD.
METHOD house_fee.
DATA lv_exp TYPE decfloat34.
lv_exp = '140.63'.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'ELM' iv_height_cm = 550 iv_near_house = abap_true ) ).
ENDMETHOD.
METHOD tall_tree.
DATA lv_fee TYPE decfloat34.
DATA lv_warning TYPE abap_bool.
DATA lv_exp TYPE decfloat34.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = 'OAK'
iv_height_cm = 2500
iv_near_house = abap_false
IMPORTING
ev_fee = lv_fee
ev_warning = lv_warning.
lv_exp = 1200.
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_warning ).
ENDMETHOD.
METHOD invalid_height.
DATA lv_fee TYPE decfloat34.
DATA lv_subrc TYPE sysubrc.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = 'OAK'
iv_height_cm = 0
iv_near_house = abap_false
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_height = 1
OTHERS = 2.
lv_subrc = sy-subrc.
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,59 @@
# 1. Goal
A tree surgery company prices tree felling jobs. The dispatch program calls one
function module for each job. The function module calculates the fee of the job
and shows if the tree needs special equipment.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_TREE is in package $TMP. The group is empty.
- The dispatch program calls the function module {{P}}TREE_FEE for each job.
- A job has a tree species, the height of the tree in centimetres, and a flag
that shows if the tree is near a house.
# 4. Contract
Create the function module {{P}}TREE_FEE in function group {{P}}FG_TREE with
this interface:
- Importing parameters:
- iv_species TYPE string
- iv_height_cm TYPE i
- iv_near_house TYPE abap_bool
- Exporting parameters:
- ev_fee TYPE decfloat34
- ev_warning TYPE abap_bool
- Exceptions:
- invalid_height
# 5. Business rules
1. If iv_height_cm is 0 or less, raise the exception INVALID_HEIGHT.
2. The base fee depends on the tree species:
- OAK: 200.00
- PINE: 150.00
- BIRCH: 120.00
- all other species: 100.00
3. The height counts in full metres. A started metre counts as a full metre.
For each metre above 5 metres, add 25.00 to the fee.
4. If iv_near_house is true, add 12.5 % of the fee that results from rules 2
and 3.
5. If iv_height_cm is more than 2000, set ev_warning to true and add 500.00 to
the fee. In all other cases ev_warning is false.
6. Round the final fee half up to 2 decimals.
# 6. Constraints
- Release target: 7.02. Use only syntax that release 7.02 supports.
- Coding standards: Clean ABAP. Keep the function module short.
- Out of scope: do not create other objects.
# 7. Acceptance
- The function module 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,77 @@
{
"id": "G1046",
"category": "G",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v702",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_TREE",
"description": "Tree surgery fee function group"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}TREE_FEE",
"functionGroup": "{{P}}FG_TREE",
"params": [
{
"name": "iv_species",
"type": "string"
},
{
"name": "iv_height_cm",
"type": "i"
},
{
"name": "iv_near_house",
"type": "abap_bool"
},
{
"name": "ev_fee",
"type": "decfloat34"
},
{
"name": "ev_warning",
"type": "abap_bool"
}
]
}
],
"out_of_scope": [
"Other objects in package $TMP"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}TREE_HIDDEN",
"file": "hidden/tree_hidden.clas.abap",
"description": "Hidden tests for {{P}}TREE_FEE"
}
],
"reference": [
{
"type": "FUNC",
"name": "{{P}}TREE_FEE",
"functionGroup": "{{P}}FG_TREE",
"file": "reference/tree_fee.func.abap",
"description": "Tree felling fee"
},
{
"type": "CLAS",
"name": "{{P}}TREE_TEST",
"file": "reference/tree_test.clas.abap",
"description": "Own tests for {{P}}TREE_FEE"
}
],
"craft_checks": [
"method_length"
]
}