Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
43
tasks_gen/train/G1105/faulty/m0_kennel_fee.func.abap
Normal file
43
tasks_gen/train/G1105/faulty/m0_kennel_fee.func.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
FUNCTION {{p}}kennel_fee
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
IF iv_nights < 1.
|
||||
RAISE invalid_nights.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_pet_type.
|
||||
WHEN 'DOG'.
|
||||
lv_rate = '24.90'.
|
||||
WHEN 'CAT'.
|
||||
lv_rate = '17.90'.
|
||||
WHEN 'RABBIT'.
|
||||
lv_rate = '11.90'.
|
||||
WHEN OTHERS.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
cv_fee = lv_rate / iv_nights.
|
||||
IF iv_peak = abap_true.
|
||||
cv_fee = cv_fee * '1.2'.
|
||||
ENDIF.
|
||||
IF iv_nights >= 7.
|
||||
cv_fee = cv_fee * '0.9'.
|
||||
ENDIF.
|
||||
cv_fee = round( val = cv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ev_deposit = round( val = cv_fee * '0.2' dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
ENDFUNCTION.
|
||||
43
tasks_gen/train/G1105/faulty/m1_kennel_fee.func.abap
Normal file
43
tasks_gen/train/G1105/faulty/m1_kennel_fee.func.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
FUNCTION {{p}}kennel_fee
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
IF iv_nights < 1.
|
||||
RAISE invalid_nights.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_pet_type.
|
||||
WHEN 'DOG'.
|
||||
lv_rate = '24.90'.
|
||||
WHEN 'CAT'.
|
||||
lv_rate = '17.90'.
|
||||
WHEN 'RABBIT'.
|
||||
lv_rate = '11.90'.
|
||||
WHEN OTHERS.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
cv_fee = lv_rate * iv_nights.
|
||||
IF iv_peak <> abap_true.
|
||||
cv_fee = cv_fee * '1.2'.
|
||||
ENDIF.
|
||||
IF iv_nights >= 7.
|
||||
cv_fee = cv_fee * '0.9'.
|
||||
ENDIF.
|
||||
cv_fee = round( val = cv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ev_deposit = round( val = cv_fee * '0.2' dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
ENDFUNCTION.
|
||||
43
tasks_gen/train/G1105/faulty/m2_kennel_fee.func.abap
Normal file
43
tasks_gen/train/G1105/faulty/m2_kennel_fee.func.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
FUNCTION {{p}}kennel_fee
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
IF iv_nights < 1.
|
||||
RAISE invalid_nights.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_pet_type.
|
||||
WHEN 'DOG'.
|
||||
lv_rate = '24.90'.
|
||||
WHEN 'CAT'.
|
||||
lv_rate = '17.90'.
|
||||
WHEN 'RABBIT'.
|
||||
lv_rate = '11.90'.
|
||||
WHEN OTHERS.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
cv_fee = lv_rate * iv_nights.
|
||||
IF iv_peak = abap_true.
|
||||
cv_fee = cv_fee / '1.2'.
|
||||
ENDIF.
|
||||
IF iv_nights >= 7.
|
||||
cv_fee = cv_fee * '0.9'.
|
||||
ENDIF.
|
||||
cv_fee = round( val = cv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ev_deposit = round( val = cv_fee * '0.2' dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
ENDFUNCTION.
|
||||
43
tasks_gen/train/G1105/faulty/m3_kennel_fee.func.abap
Normal file
43
tasks_gen/train/G1105/faulty/m3_kennel_fee.func.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
FUNCTION {{p}}kennel_fee
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
IF iv_nights < 1.
|
||||
RAISE invalid_nights.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_pet_type.
|
||||
WHEN 'DOG'.
|
||||
lv_rate = '24.90'.
|
||||
WHEN 'CAT'.
|
||||
lv_rate = '17.90'.
|
||||
WHEN 'RABBIT'.
|
||||
lv_rate = '11.90'.
|
||||
WHEN OTHERS.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
cv_fee = lv_rate * iv_nights.
|
||||
IF iv_peak = abap_true.
|
||||
cv_fee = cv_fee * '1.2'.
|
||||
ENDIF.
|
||||
IF iv_nights < 7.
|
||||
cv_fee = cv_fee * '0.9'.
|
||||
ENDIF.
|
||||
cv_fee = round( val = cv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ev_deposit = round( val = cv_fee * '0.2' dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
ENDFUNCTION.
|
||||
43
tasks_gen/train/G1105/faulty/m4_kennel_fee.func.abap
Normal file
43
tasks_gen/train/G1105/faulty/m4_kennel_fee.func.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
FUNCTION {{p}}kennel_fee
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
IF iv_nights < 1.
|
||||
RAISE invalid_nights.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_pet_type.
|
||||
WHEN 'DOG'.
|
||||
lv_rate = '24.90'.
|
||||
WHEN 'CAT'.
|
||||
lv_rate = '17.90'.
|
||||
WHEN 'RABBIT'.
|
||||
lv_rate = '11.90'.
|
||||
WHEN OTHERS.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
cv_fee = lv_rate * iv_nights.
|
||||
IF iv_peak = abap_true.
|
||||
cv_fee = cv_fee * '1.2'.
|
||||
ENDIF.
|
||||
IF iv_nights >= 7.
|
||||
cv_fee = cv_fee * '0.9'.
|
||||
ENDIF.
|
||||
cv_fee = round( val = cv_fee dec = 3 mode = cl_abap_math=>round_half_up ).
|
||||
ev_deposit = round( val = cv_fee * '0.2' dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
ENDFUNCTION.
|
||||
19
tasks_gen/train/G1105/generation.json
Normal file
19
tasks_gen/train/G1105/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1105",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "F",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
105
tasks_gen/train/G1105/hidden/t42_hidden.clas.abap
Normal file
105
tasks_gen/train/G1105/hidden/t42_hidden.clas.abap
Normal file
@@ -0,0 +1,105 @@
|
||||
CLASS {{p}}t42_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING iv_pet TYPE string iv_nights TYPE i iv_peak TYPE abap_bool
|
||||
EXPORTING ev_fee TYPE decfloat34 ev_deposit TYPE decfloat34 ev_subrc TYPE sysubrc.
|
||||
METHODS dog_peak_night FOR TESTING.
|
||||
METHODS cat_standard FOR TESTING.
|
||||
METHODS rabbit_long_peak FOR TESTING.
|
||||
METHODS dog_long_peak FOR TESTING.
|
||||
METHODS long_stay_boundary FOR TESTING.
|
||||
METHODS other_pet_zero FOR TESTING.
|
||||
METHODS nights_zero_invalid FOR TESTING.
|
||||
METHODS nights_negative_invalid FOR TESTING.
|
||||
METHODS deposit_percent FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t42_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
DATA lv_fee TYPE decfloat34 VALUE 99.
|
||||
CALL FUNCTION '{{P}}KENNEL_FEE'
|
||||
EXPORTING
|
||||
iv_pet_type = iv_pet
|
||||
iv_nights = iv_nights
|
||||
iv_peak = iv_peak
|
||||
IMPORTING
|
||||
ev_deposit = ev_deposit
|
||||
CHANGING
|
||||
cv_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_nights = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ev_fee = lv_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dog_peak_night.
|
||||
call( EXPORTING iv_pet = `DOG` iv_nights = 1 iv_peak = abap_true
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_deposit = DATA(lv_dep) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '29.88' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.98' ) act = lv_dep ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cat_standard.
|
||||
call( EXPORTING iv_pet = `CAT` iv_nights = 3 iv_peak = abap_false
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_deposit = DATA(lv_dep) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '53.70' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.74' ) act = lv_dep ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rabbit_long_peak.
|
||||
call( EXPORTING iv_pet = `RABBIT` iv_nights = 10 iv_peak = abap_true
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_deposit = DATA(lv_dep) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '128.52' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '25.70' ) act = lv_dep ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dog_long_peak.
|
||||
call( EXPORTING iv_pet = `DOG` iv_nights = 7 iv_peak = abap_true
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_deposit = DATA(lv_dep) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '188.24' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '37.65' ) act = lv_dep ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD long_stay_boundary.
|
||||
call( EXPORTING iv_pet = `DOG` iv_nights = 6 iv_peak = abap_false
|
||||
IMPORTING ev_fee = DATA(lv_six) ).
|
||||
call( EXPORTING iv_pet = `DOG` iv_nights = 7 iv_peak = abap_false
|
||||
IMPORTING ev_fee = DATA(lv_seven) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '149.40' ) act = lv_six ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '156.87' ) act = lv_seven ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD other_pet_zero.
|
||||
call( EXPORTING iv_pet = `SNAKE` iv_nights = 5 iv_peak = abap_false
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_deposit = DATA(lv_dep) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_dep ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nights_zero_invalid.
|
||||
call( EXPORTING iv_pet = `DOG` iv_nights = 0 iv_peak = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD nights_negative_invalid.
|
||||
call( EXPORTING iv_pet = `CAT` iv_nights = -3 iv_peak = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD deposit_percent.
|
||||
call( EXPORTING iv_pet = `CAT` iv_nights = 1 iv_peak = abap_false
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_deposit = DATA(lv_dep) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '17.90' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.58' ) act = lv_dep ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
69
tasks_gen/train/G1105/mutation.json
Normal file
69
tasks_gen/train/G1105/mutation.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"task": "G1105",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}KENNEL_FEE",
|
||||
"mutant": "line 33: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "5/9",
|
||||
"failed_tests": [
|
||||
"CAT_STANDARD",
|
||||
"DOG_LONG_PEAK",
|
||||
"LONG_STAY_BOUNDARY",
|
||||
"RABBIT_LONG_PEAK"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}KENNEL_FEE",
|
||||
"mutant": "line 34: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "3/9",
|
||||
"failed_tests": [
|
||||
"CAT_STANDARD",
|
||||
"DEPOSIT_PERCENT",
|
||||
"DOG_LONG_PEAK",
|
||||
"DOG_PEAK_NIGHT",
|
||||
"LONG_STAY_BOUNDARY",
|
||||
"RABBIT_LONG_PEAK"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}KENNEL_FEE",
|
||||
"mutant": "line 35: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "6/9",
|
||||
"failed_tests": [
|
||||
"DOG_LONG_PEAK",
|
||||
"DOG_PEAK_NIGHT",
|
||||
"RABBIT_LONG_PEAK"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}KENNEL_FEE",
|
||||
"mutant": "line 37: >= -> < (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "3/9",
|
||||
"failed_tests": [
|
||||
"CAT_STANDARD",
|
||||
"DEPOSIT_PERCENT",
|
||||
"DOG_LONG_PEAK",
|
||||
"DOG_PEAK_NIGHT",
|
||||
"LONG_STAY_BOUNDARY",
|
||||
"RABBIT_LONG_PEAK"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}KENNEL_FEE",
|
||||
"mutant": "line 40: 2 -> 3 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"DOG_LONG_PEAK"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
43
tasks_gen/train/G1105/reference/kennel_fee.func.abap
Normal file
43
tasks_gen/train/G1105/reference/kennel_fee.func.abap
Normal file
@@ -0,0 +1,43 @@
|
||||
FUNCTION {{p}}kennel_fee
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
IF iv_nights < 1.
|
||||
RAISE invalid_nights.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_pet_type.
|
||||
WHEN 'DOG'.
|
||||
lv_rate = '24.90'.
|
||||
WHEN 'CAT'.
|
||||
lv_rate = '17.90'.
|
||||
WHEN 'RABBIT'.
|
||||
lv_rate = '11.90'.
|
||||
WHEN OTHERS.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
cv_fee = lv_rate * iv_nights.
|
||||
IF iv_peak = abap_true.
|
||||
cv_fee = cv_fee * '1.2'.
|
||||
ENDIF.
|
||||
IF iv_nights >= 7.
|
||||
cv_fee = cv_fee * '0.9'.
|
||||
ENDIF.
|
||||
cv_fee = round( val = cv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ev_deposit = round( val = cv_fee * '0.2' dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
ENDFUNCTION.
|
||||
61
tasks_gen/train/G1105/reference/t42_test.clas.abap
Normal file
61
tasks_gen/train/G1105/reference/t42_test.clas.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
CLASS {{p}}t42_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_for
|
||||
IMPORTING iv_pet TYPE string iv_nights TYPE i iv_peak TYPE abap_bool
|
||||
RETURNING VALUE(rv_fee) TYPE decfloat34.
|
||||
METHODS dog_fee FOR TESTING.
|
||||
METHODS long_stay FOR TESTING.
|
||||
METHODS other_pet FOR TESTING.
|
||||
METHODS invalid_nights FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t42_test IMPLEMENTATION.
|
||||
METHOD fee_for.
|
||||
CALL FUNCTION '{{P}}KENNEL_FEE'
|
||||
EXPORTING
|
||||
iv_pet_type = iv_pet
|
||||
iv_nights = iv_nights
|
||||
iv_peak = iv_peak
|
||||
CHANGING
|
||||
cv_fee = rv_fee
|
||||
EXCEPTIONS
|
||||
invalid_nights = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dog_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '74.70' )
|
||||
act = fee_for( iv_pet = `DOG` iv_nights = 3 iv_peak = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD long_stay.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '156.87' )
|
||||
act = fee_for( iv_pet = `DOG` iv_nights = 7 iv_peak = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD other_pet.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 0 )
|
||||
act = fee_for( iv_pet = `SNAKE` iv_nights = 4 iv_peak = abap_false ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_nights.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}KENNEL_FEE'
|
||||
EXPORTING
|
||||
iv_pet_type = `DOG`
|
||||
iv_nights = 0
|
||||
iv_peak = abap_false
|
||||
CHANGING
|
||||
cv_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_nights = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1105/seed/kennel_sample.func.abap
Normal file
16
tasks_gen/train/G1105/seed/kennel_sample.func.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
FUNCTION {{p}}kennel_sample
|
||||
IMPORTING
|
||||
iv_pet_type TYPE string
|
||||
iv_nights TYPE i
|
||||
iv_peak TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_deposit TYPE decfloat34
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_nights.
|
||||
|
||||
ev_deposit = 0.
|
||||
cv_fee = 0.
|
||||
|
||||
ENDFUNCTION.
|
||||
43
tasks_gen/train/G1105/spec.md
Normal file
43
tasks_gen/train/G1105/spec.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 1. Goal
|
||||
A pet boarding kennel charges the owner of a pet for each night that the pet
|
||||
stays in the kennel. The booking program calls one event module for each
|
||||
booking. The event module must have the same interface as the sample event
|
||||
module, because the booking program calls all event modules in the same way.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_KENNEL exists in package $TMP.
|
||||
- Function module {{P}}KENNEL_SAMPLE exists in this group. It is the sample
|
||||
event module. Its interface is the interface that all event modules must use.
|
||||
- The booking program passes the pet type, the number of nights and the peak
|
||||
season flag. It reads the fee and the deposit.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}KENNEL_FEE in function group {{P}}FG_KENNEL.
|
||||
- Use exactly the interface of {{P}}KENNEL_SAMPLE: the same parameter names,
|
||||
kinds, types and exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
1. If the number of nights is less than 1, raise the exception INVALID_NIGHTS.
|
||||
This rule applies before all other rules.
|
||||
2. The nightly rate is 24.90 for pet type DOG, 17.90 for pet type CAT and
|
||||
11.90 for pet type RABBIT. For every other pet type the fee is 0 and the
|
||||
deposit is 0.
|
||||
3. The fee is the nightly rate multiplied by the number of nights.
|
||||
4. If the peak season flag is true, increase the fee by 20 %.
|
||||
5. If the number of nights is 7 or more, decrease the fee by 10 %. Apply this
|
||||
decrease after the peak season increase.
|
||||
6. Round the fee half up to 2 decimals.
|
||||
7. The deposit is 20 % of the fee, rounded half up to 2 decimals.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816.
|
||||
- Coding standards: Clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: do not change {{P}}KENNEL_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.
|
||||
84
tasks_gen/train/G1105/task.json
Normal file
84
tasks_gen/train/G1105/task.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"id": "G1105",
|
||||
"category": "F",
|
||||
"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_KENNEL",
|
||||
"description": "Kennel boarding fee events"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}KENNEL_SAMPLE",
|
||||
"functionGroup": "{{P}}FG_KENNEL",
|
||||
"file": "seed/kennel_sample.func.abap",
|
||||
"description": "Sample boarding event module"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}KENNEL_FEE",
|
||||
"functionGroup": "{{P}}FG_KENNEL",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_pet_type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_nights",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_peak",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_deposit",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "cv_fee",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}KENNEL_SAMPLE"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T42_HIDDEN",
|
||||
"file": "hidden/t42_hidden.clas.abap",
|
||||
"description": "T42 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}KENNEL_FEE",
|
||||
"functionGroup": "{{P}}FG_KENNEL",
|
||||
"file": "reference/kennel_fee.func.abap",
|
||||
"description": "Boarding fee event module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T42_TEST",
|
||||
"file": "reference/t42_test.clas.abap",
|
||||
"description": "T42 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user