Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 12:10:52 +02:00
parent d3250acfb8
commit 39769afce8
741 changed files with 40573 additions and 317 deletions

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}taxi_fare
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
CONSTANTS: lc_base_fare TYPE decfloat34 VALUE '3.50',
lc_km_rate_1 TYPE decfloat34 VALUE '2.20',
lc_km_rate_2 TYPE decfloat34 VALUE '1.80',
lc_wait_rate TYPE decfloat34 VALUE '0.40',
lc_night_factor TYPE decfloat34 VALUE '1.2',
lc_min_fare TYPE decfloat34 VALUE '5.00',
lc_free_km TYPE decfloat34 VALUE '10'.
IF iv_distance_km >= 0.
RAISE invalid_distance.
ENDIF.
IF iv_wait_min < 0.
RAISE invalid_wait.
ENDIF.
DATA lv_distance_fare TYPE decfloat34.
IF iv_distance_km <= lc_free_km.
lv_distance_fare = iv_distance_km * lc_km_rate_1.
ELSE.
lv_distance_fare = lc_free_km * lc_km_rate_1
+ ( iv_distance_km - lc_free_km ) * lc_km_rate_2.
ENDIF.
DATA lv_sum TYPE decfloat34.
lv_sum = lc_base_fare + lv_distance_fare.
IF iv_start_time >= '220000' OR iv_start_time < '060000'.
lv_sum = lv_sum * lc_night_factor.
ENDIF.
lv_sum = lv_sum + iv_wait_min * lc_wait_rate.
ev_fare = round( val = lv_sum dec = 2 mode = cl_abap_math=>round_half_up ).
IF ev_fare < lc_min_fare.
ev_fare = lc_min_fare.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}taxi_fare
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
CONSTANTS: lc_base_fare TYPE decfloat34 VALUE '3.50',
lc_km_rate_1 TYPE decfloat34 VALUE '2.20',
lc_km_rate_2 TYPE decfloat34 VALUE '1.80',
lc_wait_rate TYPE decfloat34 VALUE '0.40',
lc_night_factor TYPE decfloat34 VALUE '1.2',
lc_min_fare TYPE decfloat34 VALUE '5.00',
lc_free_km TYPE decfloat34 VALUE '10'.
IF iv_distance_km < 0.
RAISE invalid_distance.
ENDIF.
IF iv_wait_min < 0.
RAISE invalid_wait.
ENDIF.
DATA lv_distance_fare TYPE decfloat34.
IF iv_distance_km <= lc_free_km.
lv_distance_fare = iv_distance_km * lc_km_rate_1.
ELSE.
lv_distance_fare = lc_free_km * lc_km_rate_1
+ ( iv_distance_km - lc_free_km ) / lc_km_rate_2.
ENDIF.
DATA lv_sum TYPE decfloat34.
lv_sum = lc_base_fare + lv_distance_fare.
IF iv_start_time >= '220000' OR iv_start_time < '060000'.
lv_sum = lv_sum * lc_night_factor.
ENDIF.
lv_sum = lv_sum + iv_wait_min * lc_wait_rate.
ev_fare = round( val = lv_sum dec = 2 mode = cl_abap_math=>round_half_up ).
IF ev_fare < lc_min_fare.
ev_fare = lc_min_fare.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}taxi_fare
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
CONSTANTS: lc_base_fare TYPE decfloat34 VALUE '3.50',
lc_km_rate_1 TYPE decfloat34 VALUE '2.20',
lc_km_rate_2 TYPE decfloat34 VALUE '1.80',
lc_wait_rate TYPE decfloat34 VALUE '0.40',
lc_night_factor TYPE decfloat34 VALUE '1.2',
lc_min_fare TYPE decfloat34 VALUE '5.00',
lc_free_km TYPE decfloat34 VALUE '10'.
IF iv_distance_km < 0.
RAISE invalid_distance.
ENDIF.
IF iv_wait_min < 0.
RAISE invalid_wait.
ENDIF.
DATA lv_distance_fare TYPE decfloat34.
IF iv_distance_km <= lc_free_km.
lv_distance_fare = iv_distance_km * lc_km_rate_1.
ELSE.
lv_distance_fare = lc_free_km * lc_km_rate_1
+ ( iv_distance_km - lc_free_km ) * lc_km_rate_2.
ENDIF.
DATA lv_sum TYPE decfloat34.
lv_sum = lc_base_fare + lv_distance_fare.
IF iv_start_time >= '220000' AND iv_start_time < '060000'.
lv_sum = lv_sum * lc_night_factor.
ENDIF.
lv_sum = lv_sum + iv_wait_min * lc_wait_rate.
ev_fare = round( val = lv_sum dec = 2 mode = cl_abap_math=>round_half_up ).
IF ev_fare < lc_min_fare.
ev_fare = lc_min_fare.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}taxi_fare
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
CONSTANTS: lc_base_fare TYPE decfloat34 VALUE '3.50',
lc_km_rate_1 TYPE decfloat34 VALUE '2.20',
lc_km_rate_2 TYPE decfloat34 VALUE '1.80',
lc_wait_rate TYPE decfloat34 VALUE '0.40',
lc_night_factor TYPE decfloat34 VALUE '1.2',
lc_min_fare TYPE decfloat34 VALUE '5.00',
lc_free_km TYPE decfloat34 VALUE '10'.
IF iv_distance_km < 0.
RAISE invalid_distance.
ENDIF.
IF iv_wait_min < 0.
RAISE invalid_wait.
ENDIF.
DATA lv_distance_fare TYPE decfloat34.
IF iv_distance_km <= lc_free_km.
lv_distance_fare = iv_distance_km * lc_km_rate_1.
ELSE.
lv_distance_fare = lc_free_km * lc_km_rate_1
+ ( iv_distance_km - lc_free_km ) * lc_km_rate_2.
ENDIF.
DATA lv_sum TYPE decfloat34.
lv_sum = lc_base_fare + lv_distance_fare.
IF iv_start_time >= '220000' OR iv_start_time < '060000'.
lv_sum = lv_sum * lc_night_factor.
ENDIF.
lv_sum = lv_sum + iv_wait_min * lc_wait_rate.
ev_fare = round( val = lv_sum dec = 3 mode = cl_abap_math=>round_half_up ).
IF ev_fare < lc_min_fare.
ev_fare = lc_min_fare.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}taxi_fare
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
CONSTANTS: lc_base_fare TYPE decfloat34 VALUE '3.50',
lc_km_rate_1 TYPE decfloat34 VALUE '2.20',
lc_km_rate_2 TYPE decfloat34 VALUE '1.80',
lc_wait_rate TYPE decfloat34 VALUE '0.40',
lc_night_factor TYPE decfloat34 VALUE '1.2',
lc_min_fare TYPE decfloat34 VALUE '5.00',
lc_free_km TYPE decfloat34 VALUE '10'.
IF iv_distance_km < 0.
RAISE invalid_distance.
ENDIF.
IF iv_wait_min < 0.
RAISE invalid_wait.
ENDIF.
DATA lv_distance_fare TYPE decfloat34.
IF iv_distance_km <= lc_free_km.
lv_distance_fare = iv_distance_km * lc_km_rate_1.
ELSE.
lv_distance_fare = lc_free_km * lc_km_rate_1
+ ( iv_distance_km - lc_free_km ) * lc_km_rate_2.
ENDIF.
DATA lv_sum TYPE decfloat34.
lv_sum = lc_base_fare + lv_distance_fare.
IF iv_start_time >= '220000' OR iv_start_time < '060000'.
lv_sum = lv_sum * lc_night_factor.
ENDIF.
lv_sum = lv_sum + iv_wait_min * lc_wait_rate.
ev_fare = round( val = lv_sum dec = 2 mode = cl_abap_math=>round_half_up ).
IF ev_fare >= lc_min_fare.
ev_fare = lc_min_fare.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,39 @@
{
"id": "G0158",
"pool": "eval",
"object_type": "FUNC",
"category": "G",
"attempts": [
{
"stage": "bundle",
"errors": [
"reference/t14_test.clas.abap line 30: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/t14_test.clas.abap line 35: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"reference/t14_test.clas.abap line 40: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/t14_hidden.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\"",
"hidden/t14_hidden.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\"",
"hidden/t14_hidden.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\"",
"hidden/t14_hidden.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\"",
"hidden/t14_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/t14_hidden.clas.abap line 69: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/t14_hidden.clas.abap line 75: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/t14_hidden.clas.abap line 81: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
"hidden/t14_hidden.clas.abap line 87: 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": 12
}
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,119 @@
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call IMPORTING iv_distance TYPE decfloat34 iv_wait TYPE i iv_time TYPE t
EXPORTING ev_fare TYPE decfloat34 ev_subrc TYPE sysubrc.
METHODS expect_fare IMPORTING iv_distance TYPE decfloat34 iv_wait TYPE i
iv_time TYPE t iv_expected TYPE decfloat34.
METHODS day_short_trip_minimum FOR TESTING.
METHODS day_ten_km FOR TESTING.
METHODS day_over_ten_km FOR TESTING.
METHODS night_surcharge FOR TESTING.
METHODS night_boundary_start FOR TESTING.
METHODS day_boundary_start FOR TESTING.
METHODS wait_time_charge FOR TESTING.
METHODS rounding FOR TESTING.
METHODS night_short_trip_minimum FOR TESTING.
METHODS negative_distance FOR TESTING.
METHODS negative_wait FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_hidden IMPLEMENTATION.
METHOD call.
CALL FUNCTION '{{P}}TAXI_FARE'
EXPORTING
iv_distance_km = iv_distance
iv_wait_min = iv_wait
iv_start_time = iv_time
IMPORTING
ev_fare = ev_fare
EXCEPTIONS
invalid_distance = 1
invalid_wait = 2
OTHERS = 3.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD expect_fare.
DATA lv_fare TYPE decfloat34.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_distance = iv_distance
iv_wait = iv_wait
iv_time = iv_time
IMPORTING ev_fare = lv_fare
ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = lv_fare ).
ENDMETHOD.
METHOD day_short_trip_minimum.
DATA lv_expected TYPE decfloat34 VALUE '5.00'.
expect_fare( iv_distance = 0 iv_wait = 0 iv_time = '120000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD day_ten_km.
DATA lv_expected TYPE decfloat34 VALUE '25.50'.
expect_fare( iv_distance = 10 iv_wait = 0 iv_time = '120000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD day_over_ten_km.
DATA lv_expected TYPE decfloat34 VALUE '34.50'.
expect_fare( iv_distance = 15 iv_wait = 0 iv_time = '120000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD night_surcharge.
DATA lv_expected TYPE decfloat34 VALUE '30.60'.
expect_fare( iv_distance = 10 iv_wait = 0 iv_time = '230000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD night_boundary_start.
DATA lv_expected TYPE decfloat34 VALUE '30.60'.
expect_fare( iv_distance = 10 iv_wait = 0 iv_time = '220000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD day_boundary_start.
DATA lv_expected TYPE decfloat34 VALUE '25.50'.
expect_fare( iv_distance = 10 iv_wait = 0 iv_time = '060000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD wait_time_charge.
DATA lv_expected TYPE decfloat34 VALUE '11.90'.
expect_fare( iv_distance = 2 iv_wait = 10 iv_time = '120000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD rounding.
DATA lv_expected TYPE decfloat34 VALUE '10.83'.
expect_fare( iv_distance = '3.333' iv_wait = 0 iv_time = '120000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD night_short_trip_minimum.
DATA lv_expected TYPE decfloat34 VALUE '5.00'.
expect_fare( iv_distance = 0 iv_wait = 0 iv_time = '230000'
iv_expected = lv_expected ).
ENDMETHOD.
METHOD negative_distance.
DATA lv_fare TYPE decfloat34.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_distance = -1 iv_wait = 0 iv_time = '120000'
IMPORTING ev_fare = lv_fare ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD negative_wait.
DATA lv_fare TYPE decfloat34.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_distance = 1 iv_wait = -1 iv_time = '120000'
IMPORTING ev_fare = lv_fare ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,73 @@
{
"task": "G0158",
"mutants": [
{
"object": "{{P}}TAXI_FARE",
"mutant": "line 20: < -> >= (rel)",
"status": "killed",
"hidden": "0/11",
"failed_tests": [
"DAY_BOUNDARY_START",
"DAY_OVER_TEN_KM",
"DAY_SHORT_TRIP_MINIMUM",
"DAY_TEN_KM",
"NEGATIVE_DISTANCE",
"NEGATIVE_WAIT",
"NIGHT_BOUNDARY_START",
"NIGHT_SHORT_TRIP_MINIMUM",
"NIGHT_SURCHARGE",
"ROUNDING",
"WAIT_TIME_CHARGE"
]
},
{
"object": "{{P}}TAXI_FARE",
"mutant": "line 32: * -> / (arith)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"DAY_OVER_TEN_KM"
]
},
{
"object": "{{P}}TAXI_FARE",
"mutant": "line 38: OR -> AND (logic)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"NIGHT_BOUNDARY_START",
"NIGHT_SURCHARGE"
]
},
{
"object": "{{P}}TAXI_FARE",
"mutant": "line 44: 2 -> 3 (const)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"ROUNDING"
]
},
{
"object": "{{P}}TAXI_FARE",
"mutant": "line 46: < -> >= (rel)",
"status": "killed",
"hidden": "2/11",
"failed_tests": [
"DAY_BOUNDARY_START",
"DAY_OVER_TEN_KM",
"DAY_SHORT_TRIP_MINIMUM",
"DAY_TEN_KM",
"NIGHT_BOUNDARY_START",
"NIGHT_SHORT_TRIP_MINIMUM",
"NIGHT_SURCHARGE",
"ROUNDING",
"WAIT_TIME_CHARGE"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,64 @@
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS fare_for IMPORTING iv_distance TYPE decfloat34 iv_wait TYPE i iv_time TYPE t
RETURNING VALUE(rv_fare) TYPE decfloat34.
METHODS day_fare FOR TESTING.
METHODS night_fare FOR TESTING.
METHODS minimum_fare FOR TESTING.
METHODS invalid_distance FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_test IMPLEMENTATION.
METHOD fare_for.
CALL FUNCTION '{{P}}TAXI_FARE'
EXPORTING
iv_distance_km = iv_distance
iv_wait_min = iv_wait
iv_start_time = iv_time
IMPORTING
ev_fare = rv_fare
EXCEPTIONS
invalid_distance = 1
invalid_wait = 2
OTHERS = 3.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD day_fare.
DATA lv_expected TYPE decfloat34 VALUE '25.50'.
DATA lv_actual TYPE decfloat34.
lv_actual = fare_for( iv_distance = 10 iv_wait = 0 iv_time = '120000' ).
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_actual ).
ENDMETHOD.
METHOD night_fare.
DATA lv_expected TYPE decfloat34 VALUE '30.60'.
DATA lv_actual TYPE decfloat34.
lv_actual = fare_for( iv_distance = 10 iv_wait = 0 iv_time = '230000' ).
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_actual ).
ENDMETHOD.
METHOD minimum_fare.
DATA lv_expected TYPE decfloat34 VALUE '5.00'.
DATA lv_actual TYPE decfloat34.
lv_actual = fare_for( iv_distance = 0 iv_wait = 0 iv_time = '120000' ).
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_actual ).
ENDMETHOD.
METHOD invalid_distance.
DATA lv_fare TYPE decfloat34.
CALL FUNCTION '{{P}}TAXI_FARE'
EXPORTING
iv_distance_km = -1
iv_wait_min = 0
iv_start_time = '120000'
IMPORTING
ev_fare = lv_fare
EXCEPTIONS
invalid_distance = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}taxi_fare
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
CONSTANTS: lc_base_fare TYPE decfloat34 VALUE '3.50',
lc_km_rate_1 TYPE decfloat34 VALUE '2.20',
lc_km_rate_2 TYPE decfloat34 VALUE '1.80',
lc_wait_rate TYPE decfloat34 VALUE '0.40',
lc_night_factor TYPE decfloat34 VALUE '1.2',
lc_min_fare TYPE decfloat34 VALUE '5.00',
lc_free_km TYPE decfloat34 VALUE '10'.
IF iv_distance_km < 0.
RAISE invalid_distance.
ENDIF.
IF iv_wait_min < 0.
RAISE invalid_wait.
ENDIF.
DATA lv_distance_fare TYPE decfloat34.
IF iv_distance_km <= lc_free_km.
lv_distance_fare = iv_distance_km * lc_km_rate_1.
ELSE.
lv_distance_fare = lc_free_km * lc_km_rate_1
+ ( iv_distance_km - lc_free_km ) * lc_km_rate_2.
ENDIF.
DATA lv_sum TYPE decfloat34.
lv_sum = lc_base_fare + lv_distance_fare.
IF iv_start_time >= '220000' OR iv_start_time < '060000'.
lv_sum = lv_sum * lc_night_factor.
ENDIF.
lv_sum = lv_sum + iv_wait_min * lc_wait_rate.
ev_fare = round( val = lv_sum dec = 2 mode = cl_abap_math=>round_half_up ).
IF ev_fare < lc_min_fare.
ev_fare = lc_min_fare.
ENDIF.
ENDFUNCTION.

View File

@@ -0,0 +1,14 @@
FUNCTION {{p}}taxi_sample
IMPORTING
iv_distance_km TYPE decfloat34
iv_wait_min TYPE i
iv_start_time TYPE t
EXPORTING
ev_fare TYPE decfloat34
EXCEPTIONS
invalid_distance
invalid_wait.
ev_fare = 0.
ENDFUNCTION.

View File

@@ -0,0 +1,33 @@
# 1. Goal
Calculate the fare of a taxi trip. A dispatch program calls one function module for each completed trip. The function module must have the same interface as the sample function module, because the dispatch program calls all trip modules in the same way.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_TAXI exists in package $TMP.
- Function module {{P}}TAXI_SAMPLE exists in this group. It is the sample trip module. Its interface is the interface that all trip modules must use.
# 4. Contract
- Create the function module {{P}}TAXI_FARE in function group {{P}}FG_TAXI.
- Use exactly the interface of {{P}}TAXI_SAMPLE: the same parameter names, kinds, types, and exceptions.
# 5. Business rules
1. If the distance is less than 0, raise the exception INVALID_DISTANCE.
2. If the waiting time is less than 0, raise the exception INVALID_WAIT.
3. The base fare is 3.50.
4. The distance fare is 2.20 per kilometre for the first 10 kilometres. Every kilometre above 10 kilometres costs 1.80.
5. The waiting time fare is 0.40 per minute.
6. If the trip starts at or after 22:00:00, or before 06:00:00, multiply the sum of the base fare and the distance fare by 1.2. The waiting time fare is not multiplied.
7. The total fare is the base fare plus the distance fare plus the waiting time fare, after rule 6.
8. Round the total fare half up to 2 decimals.
9. If the rounded total fare is less than 5.00, the fare is 5.00.
# 6. Constraints
- Release target: 7.02. Do not use syntax that is newer than release 7.02.
- Out of scope: do not change {{P}}TAXI_SAMPLE.
# 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,80 @@
{
"id": "G0158",
"category": "G",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v702",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 40,
"max_activations": 10
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_TAXI",
"description": "Taxi fare function group"
},
{
"type": "FUNC",
"name": "{{P}}TAXI_SAMPLE",
"functionGroup": "{{P}}FG_TAXI",
"file": "seed/taxi_sample.func.abap",
"description": "Sample taxi function module"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}TAXI_FARE",
"functionGroup": "{{P}}FG_TAXI",
"params": [
{
"name": "iv_distance_km",
"type": "decfloat34"
},
{
"name": "iv_wait_min",
"type": "i"
},
{
"name": "iv_start_time",
"type": "t"
},
{
"name": "ev_fare",
"type": "decfloat34"
}
]
}
],
"out_of_scope": [
"{{P}}TAXI_SAMPLE"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T14_HIDDEN",
"file": "hidden/t14_hidden.clas.abap",
"description": "T14 hidden tests"
}
],
"reference": [
{
"type": "FUNC",
"name": "{{P}}TAXI_FARE",
"functionGroup": "{{P}}FG_TAXI",
"file": "reference/taxi_fare.func.abap",
"description": "Taxi fare module"
},
{
"type": "CLAS",
"name": "{{P}}T14_TEST",
"file": "reference/t14_test.clas.abap",
"description": "T14 own tests"
}
],
"craft_checks": [
"method_length"
]
}