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:
16
tasks_gen/train/G1308/generation.json
Normal file
16
tasks_gen/train/G1308/generation.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"id": "G1308",
|
||||
"pool": "train",
|
||||
"category": "K",
|
||||
"base_task": "G1004",
|
||||
"style": "free_text",
|
||||
"tool_schema": null,
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
169
tasks_gen/train/G1308/hidden/balloon_hidden.clas.abap
Normal file
169
tasks_gen/train/G1308/hidden/balloon_hidden.clas.abap
Normal file
@@ -0,0 +1,169 @@
|
||||
CLASS {{p}}balloon_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}balloon_checker.
|
||||
|
||||
METHODS setup.
|
||||
METHODS free_payload
|
||||
IMPORTING iv_passengers TYPE i
|
||||
iv_weight_kg TYPE i
|
||||
iv_wind_kmh TYPE i
|
||||
iv_cloud_base_m TYPE i
|
||||
RETURNING VALUE(rv_free_kg) TYPE i.
|
||||
|
||||
METHODS valid_flight_is_released FOR TESTING.
|
||||
METHODS crew_above_limit FOR TESTING.
|
||||
METHODS weight_above_limit FOR TESTING.
|
||||
METHODS wind_above_limit FOR TESTING.
|
||||
METHODS cloud_base_below_limit FOR TESTING.
|
||||
METHODS crew_is_checked_first FOR TESTING.
|
||||
METHODS weight_is_checked_second FOR TESTING.
|
||||
METHODS wind_is_checked_third FOR TESTING.
|
||||
METHODS limits_are_accepted FOR TESTING.
|
||||
METHODS free_payload_is_returned FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}balloon_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}balloon_checker( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD free_payload.
|
||||
TRY.
|
||||
rv_free_kg = mo_cut->check_flight( iv_passengers = iv_passengers
|
||||
iv_weight_kg = iv_weight_kg
|
||||
iv_wind_kmh = iv_wind_kmh
|
||||
iv_cloud_base_m = iv_cloud_base_m ).
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
rv_free_kg = -1.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_flight_is_released.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 140
|
||||
act = free_payload( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 2000 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_above_limit.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 9 iv_weight_kg = 500
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 2000 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_crew INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Passengers 9 exceeds the limit 8'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weight_above_limit.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 4 iv_weight_kg = 700
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 2000 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_weight INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Weight 700 kg exceeds the limit 640 kg'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD wind_above_limit.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 25 iv_cloud_base_m = 2000 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_wind INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Wind 25 km/h exceeds the limit 18 km/h'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cloud_base_below_limit.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 200 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_cloud INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Cloud base 200 m is below the limit 300 m'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_is_checked_first.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 9 iv_weight_kg = 700
|
||||
iv_wind_kmh = 25 iv_cloud_base_m = 100 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_crew INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Passengers 9 exceeds the limit 8'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weight_is_checked_second.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 4 iv_weight_kg = 700
|
||||
iv_wind_kmh = 25 iv_cloud_base_m = 100 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_weight INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Weight 700 kg exceeds the limit 640 kg'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD wind_is_checked_third.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 25 iv_cloud_base_m = 100 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_wind INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Wind 25 km/h exceeds the limit 18 km/h'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limits_are_accepted.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 0
|
||||
act = free_payload( iv_passengers = 8 iv_weight_kg = 640
|
||||
iv_wind_kmh = 18 iv_cloud_base_m = 300 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD free_payload_is_returned.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 40
|
||||
act = free_payload( iv_passengers = 2 iv_weight_kg = 600
|
||||
iv_wind_kmh = 12 iv_cloud_base_m = 1200 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
52
tasks_gen/train/G1308/reference/balloon_checker.clas.abap
Normal file
52
tasks_gen/train/G1308/reference/balloon_checker.clas.abap
Normal file
@@ -0,0 +1,52 @@
|
||||
CLASS {{p}}balloon_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS check_flight
|
||||
IMPORTING iv_passengers TYPE i
|
||||
iv_weight_kg TYPE i
|
||||
iv_wind_kmh TYPE i
|
||||
iv_cloud_base_m TYPE i
|
||||
RETURNING VALUE(rv_free_kg) TYPE i
|
||||
RAISING {{p}}cx_balloon_flight.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_passengers TYPE i VALUE 8,
|
||||
c_max_weight_kg TYPE i VALUE 640,
|
||||
c_max_wind_kmh TYPE i VALUE 18,
|
||||
c_min_cloud_base_m TYPE i VALUE 300.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}balloon_checker IMPLEMENTATION.
|
||||
METHOD check_flight.
|
||||
IF iv_passengers > c_max_passengers.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_balloon_crew
|
||||
EXPORTING
|
||||
iv_passengers = iv_passengers
|
||||
iv_limit = c_max_passengers.
|
||||
ENDIF.
|
||||
|
||||
IF iv_weight_kg > c_max_weight_kg.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_balloon_weight
|
||||
EXPORTING
|
||||
iv_weight_kg = iv_weight_kg
|
||||
iv_limit_kg = c_max_weight_kg.
|
||||
ENDIF.
|
||||
|
||||
IF iv_wind_kmh > c_max_wind_kmh.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_balloon_wind
|
||||
EXPORTING
|
||||
iv_wind_kmh = iv_wind_kmh
|
||||
iv_limit_kmh = c_max_wind_kmh.
|
||||
ENDIF.
|
||||
|
||||
IF iv_cloud_base_m < c_min_cloud_base_m.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_balloon_cloud
|
||||
EXPORTING
|
||||
iv_cloud_base_m = iv_cloud_base_m
|
||||
iv_limit_m = c_min_cloud_base_m.
|
||||
ENDIF.
|
||||
|
||||
rv_free_kg = c_max_weight_kg - iv_weight_kg.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,89 @@
|
||||
CLASS ltc_balloon_checker DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}balloon_checker.
|
||||
|
||||
METHODS setup.
|
||||
METHODS free_payload
|
||||
IMPORTING iv_passengers TYPE i
|
||||
iv_weight_kg TYPE i
|
||||
iv_wind_kmh TYPE i
|
||||
iv_cloud_base_m TYPE i
|
||||
RETURNING VALUE(rv_free_kg) TYPE i.
|
||||
|
||||
METHODS released_flight FOR TESTING.
|
||||
METHODS crew_limit FOR TESTING.
|
||||
METHODS weight_limit FOR TESTING.
|
||||
METHODS wind_limit FOR TESTING.
|
||||
METHODS cloud_limit FOR TESTING.
|
||||
METHODS check_sequence FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_balloon_checker IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}balloon_checker( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD free_payload.
|
||||
TRY.
|
||||
rv_free_kg = mo_cut->check_flight( iv_passengers = iv_passengers
|
||||
iv_weight_kg = iv_weight_kg
|
||||
iv_wind_kmh = iv_wind_kmh
|
||||
iv_cloud_base_m = iv_cloud_base_m ).
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
rv_free_kg = -1.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD released_flight.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 140
|
||||
act = free_payload( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 2000 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD crew_limit.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = -1
|
||||
act = free_payload( iv_passengers = 9 iv_weight_kg = 500
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 2000 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weight_limit.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = -1
|
||||
act = free_payload( iv_passengers = 4 iv_weight_kg = 700
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 2000 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD wind_limit.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = -1
|
||||
act = free_payload( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 25 iv_cloud_base_m = 2000 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cloud_limit.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = -1
|
||||
act = free_payload( iv_passengers = 4 iv_weight_kg = 500
|
||||
iv_wind_kmh = 10 iv_cloud_base_m = 200 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_sequence.
|
||||
DATA lv_text TYPE string.
|
||||
TRY.
|
||||
mo_cut->check_flight( iv_passengers = 9 iv_weight_kg = 700
|
||||
iv_wind_kmh = 25 iv_cloud_base_m = 100 ).
|
||||
cl_abap_unit_assert=>fail( msg = 'No exception was raised' ).
|
||||
CATCH {{p}}cx_balloon_crew INTO DATA(lo_exc).
|
||||
lv_text = lo_exc->mv_text.
|
||||
CATCH {{p}}cx_balloon_flight.
|
||||
cl_abap_unit_assert=>fail( msg = 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Passengers 9 exceeds the limit 8'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1308/reference/cx_balloon_cloud.clas.abap
Normal file
16
tasks_gen/train/G1308/reference/cx_balloon_cloud.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_balloon_cloud DEFINITION PUBLIC INHERITING FROM {{p}}cx_balloon_flight FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_cloud_base_m TYPE i
|
||||
iv_limit_m TYPE i.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_dummy TYPE i VALUE 0.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_balloon_cloud IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = |Cloud base { iv_cloud_base_m } m is below the limit { iv_limit_m } m| ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1308/reference/cx_balloon_crew.clas.abap
Normal file
16
tasks_gen/train/G1308/reference/cx_balloon_crew.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_balloon_crew DEFINITION PUBLIC INHERITING FROM {{p}}cx_balloon_flight FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_passengers TYPE i
|
||||
iv_limit TYPE i.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_dummy TYPE i VALUE 0.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_balloon_crew IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = |Passengers { iv_passengers } exceeds the limit { iv_limit }| ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1308/reference/cx_balloon_weight.clas.abap
Normal file
16
tasks_gen/train/G1308/reference/cx_balloon_weight.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_balloon_weight DEFINITION PUBLIC INHERITING FROM {{p}}cx_balloon_flight FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_weight_kg TYPE i
|
||||
iv_limit_kg TYPE i.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_dummy TYPE i VALUE 0.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_balloon_weight IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = |Weight { iv_weight_kg } kg exceeds the limit { iv_limit_kg } kg| ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1308/reference/cx_balloon_wind.clas.abap
Normal file
16
tasks_gen/train/G1308/reference/cx_balloon_wind.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_balloon_wind DEFINITION PUBLIC INHERITING FROM {{p}}cx_balloon_flight FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_wind_kmh TYPE i
|
||||
iv_limit_kmh TYPE i.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_dummy TYPE i VALUE 0.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_balloon_wind IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = |Wind { iv_wind_kmh } km/h exceeds the limit { iv_limit_kmh } km/h| ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
18
tasks_gen/train/G1308/seed/cx_balloon_flight.clas.abap
Normal file
18
tasks_gen/train/G1308/seed/cx_balloon_flight.clas.abap
Normal file
@@ -0,0 +1,18 @@
|
||||
CLASS {{p}}cx_balloon_flight DEFINITION PUBLIC INHERITING FROM cx_static_check CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
DATA mv_text TYPE string READ-ONLY.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING iv_text TYPE string.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_dummy TYPE i VALUE 0.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_balloon_flight IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_text = iv_text.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
13
tasks_gen/train/G1308/spec.md
Normal file
13
tasks_gen/train/G1308/spec.md
Normal file
@@ -0,0 +1,13 @@
|
||||
Hello, we need a check for hot-air balloon flights before launch. The flight office calls this check for each planned flight. The check must stop a flight when a limit is exceeded. The caller needs one exception for each reason.
|
||||
|
||||
The exception class {{P}}CX_BALLOON_FLIGHT already exists in package $TMP. It is active. It inherits from CX_STATIC_CHECK. It has a public read-only attribute MV_TEXT of type string and a constructor with importing parameter IV_TEXT of type string. The constructor writes IV_TEXT to MV_TEXT. The flight office knows four figures: the number of passengers, the total take-off weight in kilograms, the wind speed in kilometres per hour, and the height of the cloud base in metres.
|
||||
|
||||
Please create the class {{P}}BALLOON_CHECKER in package $TMP. The class is public and final. It can be created without constructor parameters. It has the public method CHECK_FLIGHT with these parameters: importing IV_PASSENGERS type i, importing IV_WEIGHT_KG type i, importing IV_WIND_KMH type i, importing IV_CLOUD_BASE_M type i, returning RV_FREE_KG type i, and raising {{P}}CX_BALLOON_FLIGHT. Do not add other public methods.
|
||||
|
||||
Also create these exception classes in package $TMP. Each class inherits from {{P}}CX_BALLOON_FLIGHT. {{P}}CX_BALLOON_CREW has a constructor with importing IV_PASSENGERS type i and IV_LIMIT type i. {{P}}CX_BALLOON_WEIGHT has a constructor with importing IV_WEIGHT_KG type i and IV_LIMIT_KG type i. {{P}}CX_BALLOON_WIND has a constructor with importing IV_WIND_KMH type i and IV_LIMIT_KMH type i. {{P}}CX_BALLOON_CLOUD has a constructor with importing IV_CLOUD_BASE_M type i and IV_LIMIT_M type i. Each constructor writes the message text to MV_TEXT. The rules below give the text of each exception.
|
||||
|
||||
The method CHECK_FLIGHT applies the rules in this sequence. It raises the exception of the first rule that fails. If no rule fails, the method returns the free payload. First, check the passengers. The limit is 8. If IV_PASSENGERS is greater than 8, raise {{P}}CX_BALLOON_CREW. The message text is "Passengers <passengers> exceeds the limit <limit>". For example, 12 passengers give the text "Passengers 12 exceeds the limit 8". Second, check the weight. The limit is 640 kilograms. If IV_WEIGHT_KG is greater than 640, raise {{P}}CX_BALLOON_WEIGHT. The message text is "Weight <weight> kg exceeds the limit <limit> kg". For example, 700 kilograms give the text "Weight 700 kg exceeds the limit 640 kg". Third, check the wind. The limit is 18 kilometres per hour. If IV_WIND_KMH is greater than 18, raise {{P}}CX_BALLOON_WIND. The message text is "Wind <wind> km/h exceeds the limit <limit> km/h". For example, 25 kilometres per hour give the text "Wind 25 km/h exceeds the limit 18 km/h". Fourth, check the cloud base. The limit is 300 metres. If IV_CLOUD_BASE_M is less than 300, raise {{P}}CX_BALLOON_CLOUD. The message text is "Cloud base <cloud base> m is below the limit <limit> m". For example, 200 metres give the text "Cloud base 200 m is below the limit 300 m". Finally, if no rule fails, the free payload is 640 minus IV_WEIGHT_KG. Return the free payload in RV_FREE_KG.
|
||||
|
||||
The release target is ABAP Platform 2025 (SAP_BASIS 816). Follow Clean ABAP. Keep the method length below 40 statements. Do not use global variables. Do not write comments that restate the code. Do not change {{P}}CX_BALLOON_FLIGHT.
|
||||
|
||||
The classes must be active and have no syntax error. The hidden tests must pass. Write your own ABAP Unit tests for the class.
|
||||
92
tasks_gen/train/G1308/task.json
Normal file
92
tasks_gen/train/G1308/task.json
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"id": "G1308",
|
||||
"category": "K",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 70,
|
||||
"max_activations": 18
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_FLIGHT",
|
||||
"file": "seed/cx_balloon_flight.clas.abap",
|
||||
"description": "Base exception class of a rejected balloon flight"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BALLOON_CHECKER"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_CREW"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_WEIGHT"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_WIND"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_CLOUD"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}CX_BALLOON_FLIGHT"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BALLOON_HIDDEN",
|
||||
"file": "hidden/balloon_hidden.clas.abap",
|
||||
"description": "Hidden tests for the balloon flight check"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_CREW",
|
||||
"file": "reference/cx_balloon_crew.clas.abap",
|
||||
"description": "Too many passengers"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_WEIGHT",
|
||||
"file": "reference/cx_balloon_weight.clas.abap",
|
||||
"description": "Weight above the limit"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_WIND",
|
||||
"file": "reference/cx_balloon_wind.clas.abap",
|
||||
"description": "Wind above the limit"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BALLOON_CLOUD",
|
||||
"file": "reference/cx_balloon_cloud.clas.abap",
|
||||
"description": "Cloud base below the limit"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BALLOON_CHECKER",
|
||||
"file": "reference/balloon_checker.clas.abap",
|
||||
"description": "Balloon flight check with class-based exceptions",
|
||||
"testclasses_file": "reference/balloon_checker.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
],
|
||||
"base_task": "G1004",
|
||||
"input_style": "free_text"
|
||||
}
|
||||
Reference in New Issue
Block a user