Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
67
tasks_gen/train/G1104/faulty/m0_golf_fee.func.abap
Normal file
67
tasks_gen/train/G1104/faulty/m0_golf_fee.func.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
FUNCTION {{p}}golf_fee
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_golf.
|
||||
|
||||
CONSTANTS: c_member TYPE decfloat34 VALUE '25.00',
|
||||
c_guest TYPE decfloat34 VALUE '62.50',
|
||||
c_junior TYPE decfloat34 VALUE '12.50'.
|
||||
|
||||
DATA lv_per_player TYPE decfloat34.
|
||||
|
||||
IF iv_players >= 1 OR iv_players > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_PLAYERS'
|
||||
iv_message = 'Number of players must be between 1 and 4'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9 AND iv_holes <> 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_HOLES'
|
||||
iv_message = 'Number of holes must be 9 or 18'.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_category.
|
||||
WHEN 'M'.
|
||||
lv_per_player = c_member.
|
||||
WHEN 'G'.
|
||||
lv_per_player = c_guest.
|
||||
WHEN 'J'.
|
||||
lv_per_player = c_junior.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_CATEGORY'
|
||||
iv_message = 'Player category must be M, G or J'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_tee_hour < 6 OR iv_tee_hour > 20.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_TEE_HOUR'
|
||||
iv_message = 'Tee hour must be between 6 and 20'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes = 9.
|
||||
lv_per_player = lv_per_player / 2.
|
||||
ENDIF.
|
||||
|
||||
IF iv_tee_hour >= 18.
|
||||
lv_per_player = round( val = lv_per_player * 75 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_per_player * iv_players.
|
||||
|
||||
IF iv_players = 4.
|
||||
ev_fee = round( val = ev_fee * 90 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
67
tasks_gen/train/G1104/faulty/m1_golf_fee.func.abap
Normal file
67
tasks_gen/train/G1104/faulty/m1_golf_fee.func.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
FUNCTION {{p}}golf_fee
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_golf.
|
||||
|
||||
CONSTANTS: c_member TYPE decfloat34 VALUE '25.00',
|
||||
c_guest TYPE decfloat34 VALUE '62.50',
|
||||
c_junior TYPE decfloat34 VALUE '12.50'.
|
||||
|
||||
DATA lv_per_player TYPE decfloat34.
|
||||
|
||||
IF iv_players < 1 OR iv_players > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_PLAYERS'
|
||||
iv_message = 'Number of players must be between 1 and 4'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9 OR iv_holes <> 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_HOLES'
|
||||
iv_message = 'Number of holes must be 9 or 18'.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_category.
|
||||
WHEN 'M'.
|
||||
lv_per_player = c_member.
|
||||
WHEN 'G'.
|
||||
lv_per_player = c_guest.
|
||||
WHEN 'J'.
|
||||
lv_per_player = c_junior.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_CATEGORY'
|
||||
iv_message = 'Player category must be M, G or J'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_tee_hour < 6 OR iv_tee_hour > 20.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_TEE_HOUR'
|
||||
iv_message = 'Tee hour must be between 6 and 20'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes = 9.
|
||||
lv_per_player = lv_per_player / 2.
|
||||
ENDIF.
|
||||
|
||||
IF iv_tee_hour >= 18.
|
||||
lv_per_player = round( val = lv_per_player * 75 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_per_player * iv_players.
|
||||
|
||||
IF iv_players = 4.
|
||||
ev_fee = round( val = ev_fee * 90 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
67
tasks_gen/train/G1104/faulty/m2_golf_fee.func.abap
Normal file
67
tasks_gen/train/G1104/faulty/m2_golf_fee.func.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
FUNCTION {{p}}golf_fee
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_golf.
|
||||
|
||||
CONSTANTS: c_member TYPE decfloat34 VALUE '25.00',
|
||||
c_guest TYPE decfloat34 VALUE '62.50',
|
||||
c_junior TYPE decfloat34 VALUE '12.50'.
|
||||
|
||||
DATA lv_per_player TYPE decfloat34.
|
||||
|
||||
IF iv_players < 1 OR iv_players > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_PLAYERS'
|
||||
iv_message = 'Number of players must be between 1 and 4'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9 AND iv_holes <> 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_HOLES'
|
||||
iv_message = 'Number of holes must be 9 or 18'.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_category.
|
||||
WHEN 'M'.
|
||||
lv_per_player = c_member.
|
||||
WHEN 'G'.
|
||||
lv_per_player = c_guest.
|
||||
WHEN 'J'.
|
||||
lv_per_player = c_junior.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_CATEGORY'
|
||||
iv_message = 'Player category must be M, G or J'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_tee_hour < 7 OR iv_tee_hour > 20.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_TEE_HOUR'
|
||||
iv_message = 'Tee hour must be between 6 and 20'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes = 9.
|
||||
lv_per_player = lv_per_player / 2.
|
||||
ENDIF.
|
||||
|
||||
IF iv_tee_hour >= 18.
|
||||
lv_per_player = round( val = lv_per_player * 75 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_per_player * iv_players.
|
||||
|
||||
IF iv_players = 4.
|
||||
ev_fee = round( val = ev_fee * 90 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
67
tasks_gen/train/G1104/faulty/m3_golf_fee.func.abap
Normal file
67
tasks_gen/train/G1104/faulty/m3_golf_fee.func.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
FUNCTION {{p}}golf_fee
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_golf.
|
||||
|
||||
CONSTANTS: c_member TYPE decfloat34 VALUE '25.00',
|
||||
c_guest TYPE decfloat34 VALUE '62.50',
|
||||
c_junior TYPE decfloat34 VALUE '12.50'.
|
||||
|
||||
DATA lv_per_player TYPE decfloat34.
|
||||
|
||||
IF iv_players < 1 OR iv_players > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_PLAYERS'
|
||||
iv_message = 'Number of players must be between 1 and 4'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9 AND iv_holes <> 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_HOLES'
|
||||
iv_message = 'Number of holes must be 9 or 18'.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_category.
|
||||
WHEN 'M'.
|
||||
lv_per_player = c_member.
|
||||
WHEN 'G'.
|
||||
lv_per_player = c_guest.
|
||||
WHEN 'J'.
|
||||
lv_per_player = c_junior.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_CATEGORY'
|
||||
iv_message = 'Player category must be M, G or J'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_tee_hour < 6 OR iv_tee_hour > 20.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_TEE_HOUR'
|
||||
iv_message = 'Tee hour must be between 6 and 20'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9.
|
||||
lv_per_player = lv_per_player / 2.
|
||||
ENDIF.
|
||||
|
||||
IF iv_tee_hour >= 18.
|
||||
lv_per_player = round( val = lv_per_player * 75 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_per_player * iv_players.
|
||||
|
||||
IF iv_players = 4.
|
||||
ev_fee = round( val = ev_fee * 90 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
67
tasks_gen/train/G1104/faulty/m4_golf_fee.func.abap
Normal file
67
tasks_gen/train/G1104/faulty/m4_golf_fee.func.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
FUNCTION {{p}}golf_fee
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_golf.
|
||||
|
||||
CONSTANTS: c_member TYPE decfloat34 VALUE '25.00',
|
||||
c_guest TYPE decfloat34 VALUE '62.50',
|
||||
c_junior TYPE decfloat34 VALUE '12.50'.
|
||||
|
||||
DATA lv_per_player TYPE decfloat34.
|
||||
|
||||
IF iv_players < 1 OR iv_players > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_PLAYERS'
|
||||
iv_message = 'Number of players must be between 1 and 4'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9 AND iv_holes <> 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_HOLES'
|
||||
iv_message = 'Number of holes must be 9 or 18'.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_category.
|
||||
WHEN 'M'.
|
||||
lv_per_player = c_member.
|
||||
WHEN 'G'.
|
||||
lv_per_player = c_guest.
|
||||
WHEN 'J'.
|
||||
lv_per_player = c_junior.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_CATEGORY'
|
||||
iv_message = 'Player category must be M, G or J'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_tee_hour < 6 OR iv_tee_hour > 20.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_TEE_HOUR'
|
||||
iv_message = 'Tee hour must be between 6 and 20'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes = 9.
|
||||
lv_per_player = lv_per_player / 2.
|
||||
ENDIF.
|
||||
|
||||
IF iv_tee_hour >= 18.
|
||||
lv_per_player = round( val = lv_per_player / 75 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_per_player * iv_players.
|
||||
|
||||
IF iv_players = 4.
|
||||
ev_fee = round( val = ev_fee * 90 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
34
tasks_gen/train/G1104/generation.json
Normal file
34
tasks_gen/train/G1104/generation.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"id": "G1104",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "D",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 85.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
123
tasks_gen/train/G1104/hidden/t71_hidden.clas.abap
Normal file
123
tasks_gen/train/G1104/hidden/t71_hidden.clas.abap
Normal file
@@ -0,0 +1,123 @@
|
||||
CLASS {{p}}t71_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_for
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_reason TYPE string
|
||||
ev_message TYPE string.
|
||||
|
||||
METHODS member_18_fee FOR TESTING.
|
||||
METHODS guest_9_fee FOR TESTING.
|
||||
METHODS junior_18_fee FOR TESTING.
|
||||
METHODS twilight_rate FOR TESTING.
|
||||
METHODS group_discount FOR TESTING.
|
||||
METHODS twilight_and_group FOR TESTING.
|
||||
METHODS rejects_player_count FOR TESTING.
|
||||
METHODS rejects_holes FOR TESTING.
|
||||
METHODS rejects_category FOR TESTING.
|
||||
METHODS rejects_tee_hour FOR TESTING.
|
||||
METHODS exception_message FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t71_hidden IMPLEMENTATION.
|
||||
METHOD fee_for.
|
||||
CLEAR: ev_fee, ev_reason, ev_message.
|
||||
TRY.
|
||||
CALL FUNCTION '{{P}}GOLF_FEE'
|
||||
EXPORTING
|
||||
iv_category = iv_category
|
||||
iv_holes = iv_holes
|
||||
iv_players = iv_players
|
||||
iv_tee_hour = iv_tee_hour
|
||||
IMPORTING
|
||||
ev_fee = ev_fee.
|
||||
CATCH {{p}}cx_golf INTO DATA(lo_exc).
|
||||
ev_reason = lo_exc->mv_reason.
|
||||
ev_message = lo_exc->mv_message.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD member_18_fee.
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 18 iv_players = 1 iv_tee_hour = 6
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_reason ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD guest_9_fee.
|
||||
fee_for( EXPORTING iv_category = 'G' iv_holes = 9 iv_players = 2 iv_tee_hour = 10
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '62.50' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD junior_18_fee.
|
||||
fee_for( EXPORTING iv_category = 'J' iv_holes = 18 iv_players = 3 iv_tee_hour = 10
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '37.50' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD twilight_rate.
|
||||
fee_for( EXPORTING iv_category = 'G' iv_holes = 18 iv_players = 1 iv_tee_hour = 18
|
||||
IMPORTING ev_fee = DATA(lv_late) ).
|
||||
fee_for( EXPORTING iv_category = 'G' iv_holes = 18 iv_players = 1 iv_tee_hour = 17
|
||||
IMPORTING ev_fee = DATA(lv_early) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '46.88' ) act = lv_late ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '62.50' ) act = lv_early ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD group_discount.
|
||||
fee_for( EXPORTING iv_category = 'G' iv_holes = 18 iv_players = 4 iv_tee_hour = 17
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '225.00' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD twilight_and_group.
|
||||
fee_for( EXPORTING iv_category = 'G' iv_holes = 18 iv_players = 4 iv_tee_hour = 19
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '168.77' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_player_count.
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 18 iv_players = 0 iv_tee_hour = 10
|
||||
IMPORTING ev_reason = DATA(lv_zero) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `INVALID_PLAYERS` act = lv_zero ).
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 18 iv_players = 5 iv_tee_hour = 10
|
||||
IMPORTING ev_reason = DATA(lv_five) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `INVALID_PLAYERS` act = lv_five ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_holes.
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 12 iv_players = 1 iv_tee_hour = 10
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `INVALID_HOLES` act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_category.
|
||||
fee_for( EXPORTING iv_category = 'X' iv_holes = 18 iv_players = 1 iv_tee_hour = 10
|
||||
IMPORTING ev_reason = DATA(lv_reason) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `INVALID_CATEGORY` act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_tee_hour.
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 18 iv_players = 1 iv_tee_hour = 5
|
||||
IMPORTING ev_reason = DATA(lv_early) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `INVALID_TEE_HOUR` act = lv_early ).
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 18 iv_players = 1 iv_tee_hour = 21
|
||||
IMPORTING ev_reason = DATA(lv_late) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `INVALID_TEE_HOUR` act = lv_late ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_message.
|
||||
fee_for( EXPORTING iv_category = 'M' iv_holes = 12 iv_players = 1 iv_tee_hour = 10
|
||||
IMPORTING ev_message = DATA(lv_text) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `Number of holes must be 9 or 18` act = lv_text ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
77
tasks_gen/train/G1104/mutation.json
Normal file
77
tasks_gen/train/G1104/mutation.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"task": "G1104",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}GOLF_FEE",
|
||||
"mutant": "line 18: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "0/11",
|
||||
"failed_tests": [
|
||||
"EXCEPTION_MESSAGE",
|
||||
"GROUP_DISCOUNT",
|
||||
"GUEST_9_FEE",
|
||||
"JUNIOR_18_FEE",
|
||||
"MEMBER_18_FEE",
|
||||
"REJECTS_CATEGORY",
|
||||
"REJECTS_HOLES",
|
||||
"REJECTS_PLAYER_COUNT",
|
||||
"REJECTS_TEE_HOUR",
|
||||
"TWILIGHT_AND_GROUP",
|
||||
"TWILIGHT_RATE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}GOLF_FEE",
|
||||
"mutant": "line 25: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"GROUP_DISCOUNT",
|
||||
"GUEST_9_FEE",
|
||||
"JUNIOR_18_FEE",
|
||||
"MEMBER_18_FEE",
|
||||
"REJECTS_CATEGORY",
|
||||
"REJECTS_TEE_HOUR",
|
||||
"TWILIGHT_AND_GROUP",
|
||||
"TWILIGHT_RATE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}GOLF_FEE",
|
||||
"mutant": "line 46: 6 -> 7 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"MEMBER_18_FEE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}GOLF_FEE",
|
||||
"mutant": "line 53: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "5/11",
|
||||
"failed_tests": [
|
||||
"GROUP_DISCOUNT",
|
||||
"GUEST_9_FEE",
|
||||
"JUNIOR_18_FEE",
|
||||
"MEMBER_18_FEE",
|
||||
"TWILIGHT_AND_GROUP",
|
||||
"TWILIGHT_RATE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}GOLF_FEE",
|
||||
"mutant": "line 58: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "9/11",
|
||||
"failed_tests": [
|
||||
"TWILIGHT_AND_GROUP",
|
||||
"TWILIGHT_RATE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
24
tasks_gen/train/G1104/reference/cx_golf.clas.abap
Normal file
24
tasks_gen/train/G1104/reference/cx_golf.clas.abap
Normal file
@@ -0,0 +1,24 @@
|
||||
CLASS {{p}}cx_golf DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM cx_static_check
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING
|
||||
iv_reason TYPE string
|
||||
iv_message TYPE string.
|
||||
|
||||
DATA mv_reason TYPE string READ-ONLY.
|
||||
DATA mv_message TYPE string READ-ONLY.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_golf IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_reason = iv_reason.
|
||||
mv_message = iv_message.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
67
tasks_gen/train/G1104/reference/golf_fee.func.abap
Normal file
67
tasks_gen/train/G1104/reference/golf_fee.func.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
FUNCTION {{p}}golf_fee
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
RAISING
|
||||
{{p}}cx_golf.
|
||||
|
||||
CONSTANTS: c_member TYPE decfloat34 VALUE '25.00',
|
||||
c_guest TYPE decfloat34 VALUE '62.50',
|
||||
c_junior TYPE decfloat34 VALUE '12.50'.
|
||||
|
||||
DATA lv_per_player TYPE decfloat34.
|
||||
|
||||
IF iv_players < 1 OR iv_players > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_PLAYERS'
|
||||
iv_message = 'Number of players must be between 1 and 4'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes <> 9 AND iv_holes <> 18.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_HOLES'
|
||||
iv_message = 'Number of holes must be 9 or 18'.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_category.
|
||||
WHEN 'M'.
|
||||
lv_per_player = c_member.
|
||||
WHEN 'G'.
|
||||
lv_per_player = c_guest.
|
||||
WHEN 'J'.
|
||||
lv_per_player = c_junior.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_CATEGORY'
|
||||
iv_message = 'Player category must be M, G or J'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_tee_hour < 6 OR iv_tee_hour > 20.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_golf
|
||||
EXPORTING
|
||||
iv_reason = 'INVALID_TEE_HOUR'
|
||||
iv_message = 'Tee hour must be between 6 and 20'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_holes = 9.
|
||||
lv_per_player = lv_per_player / 2.
|
||||
ENDIF.
|
||||
|
||||
IF iv_tee_hour >= 18.
|
||||
lv_per_player = round( val = lv_per_player * 75 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_per_player * iv_players.
|
||||
|
||||
IF iv_players = 4.
|
||||
ev_fee = round( val = ev_fee * 90 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
78
tasks_gen/train/G1104/reference/t71_test.clas.abap
Normal file
78
tasks_gen/train/G1104/reference/t71_test.clas.abap
Normal file
@@ -0,0 +1,78 @@
|
||||
CLASS {{p}}t71_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_for
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE decfloat34.
|
||||
|
||||
METHODS reason_for
|
||||
IMPORTING
|
||||
iv_category TYPE string
|
||||
iv_holes TYPE i
|
||||
iv_players TYPE i
|
||||
iv_tee_hour TYPE i
|
||||
RETURNING
|
||||
VALUE(rv_reason) TYPE string.
|
||||
|
||||
METHODS member_fee FOR TESTING.
|
||||
METHODS twilight_and_group FOR TESTING.
|
||||
METHODS invalid_holes FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t71_test IMPLEMENTATION.
|
||||
METHOD fee_for.
|
||||
TRY.
|
||||
CALL FUNCTION '{{P}}GOLF_FEE'
|
||||
EXPORTING
|
||||
iv_category = iv_category
|
||||
iv_holes = iv_holes
|
||||
iv_players = iv_players
|
||||
iv_tee_hour = iv_tee_hour
|
||||
IMPORTING
|
||||
ev_fee = rv_fee.
|
||||
CATCH {{p}}cx_golf.
|
||||
cl_abap_unit_assert=>fail( msg = 'no exception expected' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_for.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
TRY.
|
||||
CALL FUNCTION '{{P}}GOLF_FEE'
|
||||
EXPORTING
|
||||
iv_category = iv_category
|
||||
iv_holes = iv_holes
|
||||
iv_players = iv_players
|
||||
iv_tee_hour = iv_tee_hour
|
||||
IMPORTING
|
||||
ev_fee = lv_fee.
|
||||
CATCH {{p}}cx_golf INTO DATA(lo_exc).
|
||||
rv_reason = lo_exc->mv_reason.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD member_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 25 )
|
||||
act = fee_for( iv_category = 'M' iv_holes = 18 iv_players = 1 iv_tee_hour = 6 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD twilight_and_group.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '168.77' )
|
||||
act = fee_for( iv_category = 'G' iv_holes = 18 iv_players = 4 iv_tee_hour = 19 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_holes.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `INVALID_HOLES`
|
||||
act = reason_for( iv_category = 'M' iv_holes = 12 iv_players = 1 iv_tee_hour = 10 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
73
tasks_gen/train/G1104/spec.md
Normal file
73
tasks_gen/train/G1104/spec.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# 1. Goal
|
||||
A golf club prices a tee time booking. The pro shop calls one function module
|
||||
for each booking before it confirms the booking. The function module rejects an
|
||||
invalid booking with a class-based exception and returns the green fee of a
|
||||
valid booking.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_GOLF exists in package $TMP.
|
||||
- The club sells rounds of 9 holes and rounds of 18 holes.
|
||||
- The club has three player categories: members, guests and juniors.
|
||||
- The pro shop calls the function module for each booking.
|
||||
|
||||
# 4. Contract
|
||||
Exception class {{P}}CX_GOLF in package $TMP:
|
||||
- The class is public, final and inherits from CX_STATIC_CHECK.
|
||||
- The class has a public constructor with the importing parameters iv_reason
|
||||
(type string) and iv_message (type string).
|
||||
- The class has the public read-only attributes mv_reason (type string) and
|
||||
mv_message (type string).
|
||||
- The constructor stores iv_reason in mv_reason and iv_message in mv_message.
|
||||
|
||||
Function module {{P}}GOLF_FEE in function group {{P}}FG_GOLF:
|
||||
- Importing parameters:
|
||||
- iv_category type string
|
||||
- iv_holes type i
|
||||
- iv_players type i
|
||||
- iv_tee_hour type i
|
||||
- Exporting parameter:
|
||||
- ev_fee type decfloat34
|
||||
- The function module raises the class-based exception {{P}}CX_GOLF. Declare
|
||||
this exception in the interface of the function module, because the caller
|
||||
handles it with CATCH {{P}}CX_GOLF.
|
||||
- The function module has no classic exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
1. The number of players must be between 1 and 4. If it is not, raise
|
||||
{{P}}CX_GOLF with the reason INVALID_PLAYERS and the message
|
||||
"Number of players must be between 1 and 4".
|
||||
2. The number of holes must be 9 or 18. If it is not, raise {{P}}CX_GOLF with
|
||||
the reason INVALID_HOLES and the message "Number of holes must be 9 or 18".
|
||||
3. The player category must be M (member), G (guest) or J (junior). If it is
|
||||
not, raise {{P}}CX_GOLF with the reason INVALID_CATEGORY and the message
|
||||
"Player category must be M, G or J".
|
||||
4. The tee hour must be between 6 and 20. If it is not, raise {{P}}CX_GOLF with
|
||||
the reason INVALID_TEE_HOUR and the message "Tee hour must be between 6 and
|
||||
20".
|
||||
5. Check the rules 1 to 4 in this order. Raise only the first exception that
|
||||
applies.
|
||||
6. The green fee per player for 18 holes is 25.00 for a member, 62.50 for a
|
||||
guest and 12.50 for a junior. For 9 holes the green fee per player is half
|
||||
of the green fee per player for 18 holes.
|
||||
7. Twilight rate: if the tee hour is 18 or later, reduce the green fee per
|
||||
player by 25 %. Round the result half up to 2 decimals.
|
||||
8. The total fee is the green fee per player times the number of players.
|
||||
9. Group discount: if the booking has 4 players, reduce the total fee by 10 %.
|
||||
Round the result half up to 2 decimals. Apply this discount after the
|
||||
twilight rate.
|
||||
10. If the booking is valid, return the total fee in ev_fee and raise no
|
||||
exception.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: none.
|
||||
|
||||
# 7. Acceptance
|
||||
- The exception class and the function module are active and have no syntax
|
||||
error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
86
tasks_gen/train/G1104/task.json
Normal file
86
tasks_gen/train/G1104/task.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"id": "G1104",
|
||||
"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_GOLF",
|
||||
"description": "Golf green fee"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_GOLF",
|
||||
"description": "Class-based exception for golf bookings"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}GOLF_FEE",
|
||||
"functionGroup": "{{P}}FG_GOLF",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_category",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_holes",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_players",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_tee_hour",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "ev_fee",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T71_HIDDEN",
|
||||
"file": "hidden/t71_hidden.clas.abap",
|
||||
"description": "Hidden tests for {{P}}GOLF_FEE"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_GOLF",
|
||||
"file": "reference/cx_golf.clas.abap",
|
||||
"description": "Exception class for golf bookings"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}GOLF_FEE",
|
||||
"functionGroup": "{{P}}FG_GOLF",
|
||||
"file": "reference/golf_fee.func.abap",
|
||||
"description": "Green fee calculation"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T71_TEST",
|
||||
"file": "reference/t71_test.clas.abap",
|
||||
"description": "Own tests for the function module"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user