Restore faz1/yol-haritasi docs (overwritten by copy); stage1 docs; G0174 new gap; stage1 25-task subset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
18
tasks_gen/eval/G0144/empirical.json
Normal file
18
tasks_gen/eval/G0144/empirical.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"deepseek-v4.1-flash:cloud": {
|
||||
"score": 80.0,
|
||||
"parts": {
|
||||
"correctness": 40.0,
|
||||
"craft": 20.0,
|
||||
"clean": 15.0,
|
||||
"own_tests": 0.0,
|
||||
"discipline": 5.0,
|
||||
"total": 80.0,
|
||||
"note": "own_tests: faulty-reference part not implemented in skeleton"
|
||||
},
|
||||
"hidden": "11/11",
|
||||
"tool_calls": 30,
|
||||
"seconds": 214.6,
|
||||
"run_dir": "runs/emp/14001_G0144_llm_deepseek-v4.1-flash_cloud"
|
||||
}
|
||||
}
|
||||
91
tasks_gen/eval/G0144/faulty/m0_museum_fee_old.func.abap
Normal file
91
tasks_gen/eval/G0144/faulty/m0_museum_fee_old.func.abap
Normal file
@@ -0,0 +1,91 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
CONSTANTS:
|
||||
c_adult TYPE decfloat34 VALUE '12.00',
|
||||
c_child TYPE decfloat34 VALUE '6.00',
|
||||
c_senior TYPE decfloat34 VALUE '8.00',
|
||||
c_student TYPE decfloat34 VALUE '7.00',
|
||||
c_family TYPE decfloat34 VALUE '30.00',
|
||||
c_extra TYPE decfloat34 VALUE '6.00',
|
||||
c_member TYPE decfloat34 VALUE '10.00',
|
||||
c_weekend TYPE decfloat34 VALUE '1.20',
|
||||
c_group TYPE decfloat34 VALUE '0.90'.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
lv_base = c_adult.
|
||||
WHEN 'CHILD'.
|
||||
lv_base = c_child.
|
||||
WHEN 'SENIOR'.
|
||||
lv_base = c_senior.
|
||||
WHEN 'STUDENT'.
|
||||
lv_base = c_student.
|
||||
WHEN 'FAMILY'.
|
||||
lv_base = c_family.
|
||||
WHEN OTHERS.
|
||||
RAISE invalid_input.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
lv_total = lv_base.
|
||||
IF iv_size > 4.
|
||||
lv_total = lv_total + ( iv_size - 5 ) * c_extra.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT' OR iv_day = 'SUN'.
|
||||
lv_total = lv_total * c_weekend.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
lv_total = lv_total - c_member.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
lv_total = lv_total * c_group.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
ev_note = ''.
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
WHEN 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
WHEN 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
WHEN 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
WHEN 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDCASE.
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
91
tasks_gen/eval/G0144/faulty/m1_museum_fee_old.func.abap
Normal file
91
tasks_gen/eval/G0144/faulty/m1_museum_fee_old.func.abap
Normal file
@@ -0,0 +1,91 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
CONSTANTS:
|
||||
c_adult TYPE decfloat34 VALUE '12.00',
|
||||
c_child TYPE decfloat34 VALUE '6.00',
|
||||
c_senior TYPE decfloat34 VALUE '8.00',
|
||||
c_student TYPE decfloat34 VALUE '7.00',
|
||||
c_family TYPE decfloat34 VALUE '30.00',
|
||||
c_extra TYPE decfloat34 VALUE '6.00',
|
||||
c_member TYPE decfloat34 VALUE '10.00',
|
||||
c_weekend TYPE decfloat34 VALUE '1.20',
|
||||
c_group TYPE decfloat34 VALUE '0.90'.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
lv_base = c_adult.
|
||||
WHEN 'CHILD'.
|
||||
lv_base = c_child.
|
||||
WHEN 'SENIOR'.
|
||||
lv_base = c_senior.
|
||||
WHEN 'STUDENT'.
|
||||
lv_base = c_student.
|
||||
WHEN 'FAMILY'.
|
||||
lv_base = c_family.
|
||||
WHEN OTHERS.
|
||||
RAISE invalid_input.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
lv_total = lv_base.
|
||||
IF iv_size > 4.
|
||||
lv_total = lv_total + ( iv_size - 4 ) * c_extra.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT' OR iv_day <> 'SUN'.
|
||||
lv_total = lv_total * c_weekend.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
lv_total = lv_total - c_member.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
lv_total = lv_total * c_group.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
ev_note = ''.
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
WHEN 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
WHEN 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
WHEN 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
WHEN 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDCASE.
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
91
tasks_gen/eval/G0144/faulty/m2_museum_fee_old.func.abap
Normal file
91
tasks_gen/eval/G0144/faulty/m2_museum_fee_old.func.abap
Normal file
@@ -0,0 +1,91 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
CONSTANTS:
|
||||
c_adult TYPE decfloat34 VALUE '12.00',
|
||||
c_child TYPE decfloat34 VALUE '6.00',
|
||||
c_senior TYPE decfloat34 VALUE '8.00',
|
||||
c_student TYPE decfloat34 VALUE '7.00',
|
||||
c_family TYPE decfloat34 VALUE '30.00',
|
||||
c_extra TYPE decfloat34 VALUE '6.00',
|
||||
c_member TYPE decfloat34 VALUE '10.00',
|
||||
c_weekend TYPE decfloat34 VALUE '1.20',
|
||||
c_group TYPE decfloat34 VALUE '0.90'.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
lv_base = c_adult.
|
||||
WHEN 'CHILD'.
|
||||
lv_base = c_child.
|
||||
WHEN 'SENIOR'.
|
||||
lv_base = c_senior.
|
||||
WHEN 'STUDENT'.
|
||||
lv_base = c_student.
|
||||
WHEN 'FAMILY'.
|
||||
lv_base = c_family.
|
||||
WHEN OTHERS.
|
||||
RAISE invalid_input.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
lv_total = lv_base.
|
||||
IF iv_size > 4.
|
||||
lv_total = lv_total + ( iv_size - 4 ) * c_extra.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT' OR iv_day = 'SUN'.
|
||||
lv_total = lv_total * c_weekend.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_false.
|
||||
lv_total = lv_total - c_member.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
lv_total = lv_total * c_group.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
ev_note = ''.
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
WHEN 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
WHEN 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
WHEN 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
WHEN 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDCASE.
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
91
tasks_gen/eval/G0144/faulty/m3_museum_fee_old.func.abap
Normal file
91
tasks_gen/eval/G0144/faulty/m3_museum_fee_old.func.abap
Normal file
@@ -0,0 +1,91 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
CONSTANTS:
|
||||
c_adult TYPE decfloat34 VALUE '12.00',
|
||||
c_child TYPE decfloat34 VALUE '6.00',
|
||||
c_senior TYPE decfloat34 VALUE '8.00',
|
||||
c_student TYPE decfloat34 VALUE '7.00',
|
||||
c_family TYPE decfloat34 VALUE '30.00',
|
||||
c_extra TYPE decfloat34 VALUE '6.00',
|
||||
c_member TYPE decfloat34 VALUE '10.00',
|
||||
c_weekend TYPE decfloat34 VALUE '1.20',
|
||||
c_group TYPE decfloat34 VALUE '0.90'.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
lv_base = c_adult.
|
||||
WHEN 'CHILD'.
|
||||
lv_base = c_child.
|
||||
WHEN 'SENIOR'.
|
||||
lv_base = c_senior.
|
||||
WHEN 'STUDENT'.
|
||||
lv_base = c_student.
|
||||
WHEN 'FAMILY'.
|
||||
lv_base = c_family.
|
||||
WHEN OTHERS.
|
||||
RAISE invalid_input.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
lv_total = lv_base.
|
||||
IF iv_size > 4.
|
||||
lv_total = lv_total + ( iv_size - 4 ) * c_extra.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT' OR iv_day = 'SUN'.
|
||||
lv_total = lv_total * c_weekend.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
lv_total = lv_total + c_member.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
lv_total = lv_total * c_group.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
ev_note = ''.
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
WHEN 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
WHEN 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
WHEN 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
WHEN 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDCASE.
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
91
tasks_gen/eval/G0144/faulty/m4_museum_fee_old.func.abap
Normal file
91
tasks_gen/eval/G0144/faulty/m4_museum_fee_old.func.abap
Normal file
@@ -0,0 +1,91 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
CONSTANTS:
|
||||
c_adult TYPE decfloat34 VALUE '12.00',
|
||||
c_child TYPE decfloat34 VALUE '6.00',
|
||||
c_senior TYPE decfloat34 VALUE '8.00',
|
||||
c_student TYPE decfloat34 VALUE '7.00',
|
||||
c_family TYPE decfloat34 VALUE '30.00',
|
||||
c_extra TYPE decfloat34 VALUE '6.00',
|
||||
c_member TYPE decfloat34 VALUE '10.00',
|
||||
c_weekend TYPE decfloat34 VALUE '1.20',
|
||||
c_group TYPE decfloat34 VALUE '0.90'.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
lv_base = c_adult.
|
||||
WHEN 'CHILD'.
|
||||
lv_base = c_child.
|
||||
WHEN 'SENIOR'.
|
||||
lv_base = c_senior.
|
||||
WHEN 'STUDENT'.
|
||||
lv_base = c_student.
|
||||
WHEN 'FAMILY'.
|
||||
lv_base = c_family.
|
||||
WHEN OTHERS.
|
||||
RAISE invalid_input.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
lv_total = lv_base.
|
||||
IF iv_size > 4.
|
||||
lv_total = lv_total + ( iv_size - 4 ) * c_extra.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT' OR iv_day = 'SUN'.
|
||||
lv_total = lv_total * c_weekend.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
lv_total = lv_total - c_member.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size < 10.
|
||||
lv_total = lv_total * c_group.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
ev_note = ''.
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
WHEN 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
WHEN 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
WHEN 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
WHEN 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDCASE.
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
80
tasks_gen/eval/G0144/generation.json
Normal file
80
tasks_gen/eval/G0144/generation.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"id": "G0144",
|
||||
"pool": "eval",
|
||||
"object_type": "FUNC",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/t14_test.clas.abap line 33: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"reference/t14_test.clas.abap line 39: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"reference/t14_test.clas.abap line 45: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"reference/t14_test.clas.abap line 51: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 40: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 47: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 54: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 57: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 63: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 66: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 72: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 78: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 81: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 87: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 93: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 99: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 105: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 108: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 111: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 117: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 20
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/t14_test.clas.abap line 39: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"reference/t14_test.clas.abap line 45: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"reference/t14_test.clas.abap line 51: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"reference/t14_test.clas.abap line 57: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 46: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 53: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 60: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 63: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 69: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 72: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 78: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 84: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 87: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 93: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 99: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 105: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 111: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 114: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 117: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\"",
|
||||
"hidden/t14_hidden.clas.abap line 123: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"run_case\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 20
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
118
tasks_gen/eval/G0144/hidden/t14_hidden.clas.abap
Normal file
118
tasks_gen/eval/G0144/hidden/t14_hidden.clas.abap
Normal file
@@ -0,0 +1,118 @@
|
||||
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES: BEGIN OF ty_result,
|
||||
fee TYPE decfloat34,
|
||||
note TYPE string,
|
||||
subrc TYPE sysubrc,
|
||||
END OF ty_result.
|
||||
METHODS calc
|
||||
IMPORTING iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
METHODS adult_base FOR TESTING.
|
||||
METHODS child_base FOR TESTING.
|
||||
METHODS senior_student_base FOR TESTING.
|
||||
METHODS family_flat FOR TESTING.
|
||||
METHODS family_extra FOR TESTING.
|
||||
METHODS weekend_surcharge FOR TESTING.
|
||||
METHODS member_discount FOR TESTING.
|
||||
METHODS member_not_below_zero FOR TESTING.
|
||||
METHODS group_discount FOR TESTING.
|
||||
METHODS invalid_inputs FOR TESTING.
|
||||
METHODS note_text FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_hidden IMPLEMENTATION.
|
||||
METHOD calc.
|
||||
rs_result-fee = 0.
|
||||
rs_result-note = ''.
|
||||
CALL FUNCTION '{{P}}MUSEUM_FEE_OLD'
|
||||
EXPORTING
|
||||
iv_visitor = iv_visitor
|
||||
iv_day = iv_day
|
||||
iv_size = iv_size
|
||||
iv_member = iv_member
|
||||
IMPORTING
|
||||
ev_fee = rs_result-fee
|
||||
ev_note = rs_result-note
|
||||
EXCEPTIONS
|
||||
invalid_input = 1
|
||||
OTHERS = 2.
|
||||
rs_result-subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD adult_base.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 2 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_r-subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 24 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD child_base.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'CHILD' iv_day = 'MON' iv_size = 3 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_r-subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 18 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD senior_student_base.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'SENIOR' iv_day = 'MON' iv_size = 1 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 8 ) act = ls_r-fee ).
|
||||
DATA(ls_s) = me->calc( iv_visitor = 'STUDENT' iv_day = 'MON' iv_size = 2 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 14 ) act = ls_s-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD family_flat.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'FAMILY' iv_day = 'MON' iv_size = 4 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 30 ) act = ls_r-fee ).
|
||||
DATA(ls_s) = me->calc( iv_visitor = 'FAMILY' iv_day = 'MON' iv_size = 2 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 30 ) act = ls_s-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD family_extra.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'FAMILY' iv_day = 'MON' iv_size = 6 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 42 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weekend_surcharge.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'SAT' iv_size = 1 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '14.4' ) act = ls_r-fee ).
|
||||
DATA(ls_s) = me->calc( iv_visitor = 'ADULT' iv_day = 'SUN' iv_size = 1 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '14.4' ) act = ls_s-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD member_discount.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 2 iv_member = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 14 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD member_not_below_zero.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'CHILD' iv_day = 'MON' iv_size = 1 iv_member = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD group_discount.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 10 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 108 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_inputs.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 0 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_r-subrc ).
|
||||
DATA(ls_s) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = -1 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_s-subrc ).
|
||||
DATA(ls_t) = me->calc( iv_visitor = 'XXX' iv_day = 'MON' iv_size = 1 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_t-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD note_text.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 1 iv_member = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Adult member' act = ls_r-note ).
|
||||
DATA(ls_s) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 10 iv_member = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Adult member group' act = ls_s-note ).
|
||||
DATA(ls_t) = me->calc( iv_visitor = 'CHILD' iv_day = 'SAT' iv_size = 1 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Child' act = ls_t-note ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,102 +0,0 @@
|
||||
CLASS {{p}}t_ski_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING iv_equipment TYPE string
|
||||
iv_days TYPE i
|
||||
iv_customer TYPE string
|
||||
iv_insurance TYPE abap_bool
|
||||
EXPORTING ev_price TYPE decfloat34
|
||||
ev_deposit TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS invalid_days FOR TESTING.
|
||||
METHODS invalid_equipment FOR TESTING.
|
||||
METHODS invalid_customer FOR TESTING.
|
||||
METHODS adult_ski_one_day FOR TESTING.
|
||||
METHODS child_boots_two_days FOR TESTING.
|
||||
METHODS senior_snowboard_3d FOR TESTING.
|
||||
METHODS adult_ski_7d_insurance FOR TESTING.
|
||||
METHODS child_helmet_10d_ins FOR TESTING.
|
||||
METHODS rounding_case FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_ski_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}SKI_RENTAL_OLD'
|
||||
EXPORTING
|
||||
iv_equipment = iv_equipment
|
||||
iv_days = iv_days
|
||||
iv_customer = iv_customer
|
||||
iv_insurance = iv_insurance
|
||||
IMPORTING
|
||||
ev_price = ev_price
|
||||
ev_deposit = ev_deposit
|
||||
EXCEPTIONS
|
||||
invalid_equipment = 1
|
||||
invalid_days = 2
|
||||
invalid_customer = 3
|
||||
OTHERS = 4.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_days.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 0 iv_customer = 'ADULT' iv_insurance = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_subrc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_equipment.
|
||||
call( EXPORTING iv_equipment = 'X' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_subrc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_customer.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'X' iv_insurance = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_subrc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD adult_ski_one_day.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD child_boots_two_days.
|
||||
call( EXPORTING iv_equipment = 'BOOTS' iv_days = 2 iv_customer = 'CHILD' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 20 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD senior_snowboard_3d.
|
||||
call( EXPORTING iv_equipment = 'SNOWBOARD' iv_days = 3 iv_customer = 'SENIOR' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '68.40' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD adult_ski_7d_insurance.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 7 iv_customer = 'ADULT' iv_insurance = abap_true
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '192.50' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD child_helmet_10d_ins.
|
||||
call( EXPORTING iv_equipment = 'HELMET' iv_days = 10 iv_customer = 'CHILD' iv_insurance = abap_true
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '72.50' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 60 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounding_case.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 3 iv_customer = 'CHILD' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '35.63' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
77
tasks_gen/eval/G0144/mutation.json
Normal file
77
tasks_gen/eval/G0144/mutation.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"task": "G0144",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}MUSEUM_FEE_OLD",
|
||||
"mutant": "line 49: 4 -> 5 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"FAMILY_EXTRA"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MUSEUM_FEE_OLD",
|
||||
"mutant": "line 55: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"ADULT_BASE",
|
||||
"CHILD_BASE",
|
||||
"FAMILY_EXTRA",
|
||||
"FAMILY_FLAT",
|
||||
"GROUP_DISCOUNT",
|
||||
"MEMBER_DISCOUNT",
|
||||
"SENIOR_STUDENT_BASE",
|
||||
"WEEKEND_SURCHARGE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MUSEUM_FEE_OLD",
|
||||
"mutant": "line 59: abap_true -> abap_false (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "2/11",
|
||||
"failed_tests": [
|
||||
"ADULT_BASE",
|
||||
"CHILD_BASE",
|
||||
"FAMILY_EXTRA",
|
||||
"FAMILY_FLAT",
|
||||
"GROUP_DISCOUNT",
|
||||
"MEMBER_DISCOUNT",
|
||||
"MEMBER_NOT_BELOW_ZERO",
|
||||
"SENIOR_STUDENT_BASE",
|
||||
"WEEKEND_SURCHARGE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MUSEUM_FEE_OLD",
|
||||
"mutant": "line 60: - -> + (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "9/11",
|
||||
"failed_tests": [
|
||||
"MEMBER_DISCOUNT",
|
||||
"MEMBER_NOT_BELOW_ZERO"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MUSEUM_FEE_OLD",
|
||||
"mutant": "line 66: >= -> < (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"ADULT_BASE",
|
||||
"CHILD_BASE",
|
||||
"FAMILY_EXTRA",
|
||||
"FAMILY_FLAT",
|
||||
"GROUP_DISCOUNT",
|
||||
"MEMBER_DISCOUNT",
|
||||
"SENIOR_STUDENT_BASE",
|
||||
"WEEKEND_SURCHARGE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
91
tasks_gen/eval/G0144/reference/museum_fee_old.func.abap
Normal file
91
tasks_gen/eval/G0144/reference/museum_fee_old.func.abap
Normal file
@@ -0,0 +1,91 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
CONSTANTS:
|
||||
c_adult TYPE decfloat34 VALUE '12.00',
|
||||
c_child TYPE decfloat34 VALUE '6.00',
|
||||
c_senior TYPE decfloat34 VALUE '8.00',
|
||||
c_student TYPE decfloat34 VALUE '7.00',
|
||||
c_family TYPE decfloat34 VALUE '30.00',
|
||||
c_extra TYPE decfloat34 VALUE '6.00',
|
||||
c_member TYPE decfloat34 VALUE '10.00',
|
||||
c_weekend TYPE decfloat34 VALUE '1.20',
|
||||
c_group TYPE decfloat34 VALUE '0.90'.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
lv_base = c_adult.
|
||||
WHEN 'CHILD'.
|
||||
lv_base = c_child.
|
||||
WHEN 'SENIOR'.
|
||||
lv_base = c_senior.
|
||||
WHEN 'STUDENT'.
|
||||
lv_base = c_student.
|
||||
WHEN 'FAMILY'.
|
||||
lv_base = c_family.
|
||||
WHEN OTHERS.
|
||||
RAISE invalid_input.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
lv_total = lv_base.
|
||||
IF iv_size > 4.
|
||||
lv_total = lv_total + ( iv_size - 4 ) * c_extra.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT' OR iv_day = 'SUN'.
|
||||
lv_total = lv_total * c_weekend.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
lv_total = lv_total - c_member.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
lv_total = lv_total * c_group.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
ev_note = ''.
|
||||
CASE iv_visitor.
|
||||
WHEN 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
WHEN 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
WHEN 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
WHEN 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
WHEN 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDCASE.
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
@@ -1,166 +0,0 @@
|
||||
FUNCTION {{p}}ski_rental_old
|
||||
IMPORTING
|
||||
iv_equipment TYPE string
|
||||
iv_days TYPE i
|
||||
iv_customer TYPE string
|
||||
iv_insurance TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_price TYPE decfloat34
|
||||
ev_deposit TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_equipment
|
||||
invalid_days
|
||||
invalid_customer.
|
||||
|
||||
CLASS lcx_invalid_equipment DEFINITION INHERITING FROM cx_static_check.
|
||||
ENDCLASS.
|
||||
CLASS lcx_invalid_equipment IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcx_invalid_days DEFINITION INHERITING FROM cx_static_check.
|
||||
ENDCLASS.
|
||||
CLASS lcx_invalid_days IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcx_invalid_customer DEFINITION INHERITING FROM cx_static_check.
|
||||
ENDCLASS.
|
||||
CLASS lcx_invalid_customer IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_ski_pricer DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
TYPES: BEGIN OF ty_result,
|
||||
price TYPE decfloat34,
|
||||
deposit TYPE decfloat34,
|
||||
END OF ty_result.
|
||||
CLASS-METHODS calculate
|
||||
IMPORTING iv_equipment TYPE string
|
||||
iv_days TYPE i
|
||||
iv_customer TYPE string
|
||||
iv_insurance TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result
|
||||
RAISING lcx_invalid_equipment lcx_invalid_days lcx_invalid_customer.
|
||||
PRIVATE SECTION.
|
||||
CLASS-METHODS get_daily_rate
|
||||
IMPORTING iv_equipment TYPE string
|
||||
RETURNING VALUE(rv_rate) TYPE decfloat34
|
||||
RAISING lcx_invalid_equipment.
|
||||
CLASS-METHODS get_deposit
|
||||
IMPORTING iv_equipment TYPE string
|
||||
RETURNING VALUE(rv_deposit) TYPE decfloat34
|
||||
RAISING lcx_invalid_equipment.
|
||||
CLASS-METHODS get_customer_discount
|
||||
IMPORTING iv_customer TYPE string
|
||||
RETURNING VALUE(rv_discount) TYPE decfloat34
|
||||
RAISING lcx_invalid_customer.
|
||||
CLASS-METHODS get_duration_discount
|
||||
IMPORTING iv_days TYPE i
|
||||
RETURNING VALUE(rv_discount) TYPE decfloat34.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_ski_pricer IMPLEMENTATION.
|
||||
METHOD calculate.
|
||||
CONSTANTS: c_insurance_per_day TYPE decfloat34 VALUE 5,
|
||||
c_insurance_deposit TYPE decfloat34 VALUE 50.
|
||||
IF iv_days < 1.
|
||||
RAISE EXCEPTION TYPE lcx_invalid_days.
|
||||
ENDIF.
|
||||
DATA(lv_daily_rate) = get_daily_rate( iv_equipment ).
|
||||
DATA(lv_customer_disc) = get_customer_discount( iv_customer ).
|
||||
DATA(lv_total) = lv_daily_rate * iv_days.
|
||||
lv_total = lv_total - lv_total * lv_customer_disc / 100.
|
||||
DATA(lv_duration_disc) = get_duration_discount( iv_days ).
|
||||
lv_total = lv_total - lv_total * lv_duration_disc / 100.
|
||||
IF iv_insurance = abap_true.
|
||||
lv_total = lv_total + c_insurance_per_day * iv_days.
|
||||
ENDIF.
|
||||
rs_result-price = round( val = lv_total dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
rs_result-deposit = get_deposit( iv_equipment ).
|
||||
IF iv_insurance = abap_true.
|
||||
rs_result-deposit = rs_result-deposit + c_insurance_deposit.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_daily_rate.
|
||||
CONSTANTS: c_ski_rate TYPE decfloat34 VALUE 25,
|
||||
c_snowboard_rate TYPE decfloat34 VALUE 30,
|
||||
c_boots_rate TYPE decfloat34 VALUE 10,
|
||||
c_helmet_rate TYPE decfloat34 VALUE 5.
|
||||
CASE iv_equipment.
|
||||
WHEN 'SKI'.
|
||||
rv_rate = c_ski_rate.
|
||||
WHEN 'SNOWBOARD'.
|
||||
rv_rate = c_snowboard_rate.
|
||||
WHEN 'BOOTS'.
|
||||
rv_rate = c_boots_rate.
|
||||
WHEN 'HELMET'.
|
||||
rv_rate = c_helmet_rate.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE lcx_invalid_equipment.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_deposit.
|
||||
CONSTANTS: c_ski_deposit TYPE decfloat34 VALUE 100,
|
||||
c_snowboard_deposit TYPE decfloat34 VALUE 120,
|
||||
c_boots_deposit TYPE decfloat34 VALUE 20,
|
||||
c_helmet_deposit TYPE decfloat34 VALUE 10.
|
||||
CASE iv_equipment.
|
||||
WHEN 'SKI'.
|
||||
rv_deposit = c_ski_deposit.
|
||||
WHEN 'SNOWBOARD'.
|
||||
rv_deposit = c_snowboard_deposit.
|
||||
WHEN 'BOOTS'.
|
||||
rv_deposit = c_boots_deposit.
|
||||
WHEN 'HELMET'.
|
||||
rv_deposit = c_helmet_deposit.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE lcx_invalid_equipment.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_customer_discount.
|
||||
CONSTANTS: c_child_discount TYPE decfloat34 VALUE 50,
|
||||
c_senior_discount TYPE decfloat34 VALUE 20.
|
||||
CASE iv_customer.
|
||||
WHEN 'ADULT'.
|
||||
rv_discount = 0.
|
||||
WHEN 'CHILD'.
|
||||
rv_discount = c_child_discount.
|
||||
WHEN 'SENIOR'.
|
||||
rv_discount = c_senior_discount.
|
||||
WHEN OTHERS.
|
||||
RAISE EXCEPTION TYPE lcx_invalid_customer.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_duration_discount.
|
||||
CONSTANTS: c_disc_7 TYPE decfloat34 VALUE 10,
|
||||
c_disc_3 TYPE decfloat34 VALUE 5.
|
||||
IF iv_days >= 7.
|
||||
rv_discount = c_disc_7.
|
||||
ELSEIF iv_days >= 3.
|
||||
rv_discount = c_disc_3.
|
||||
ELSE.
|
||||
rv_discount = 0.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
TRY.
|
||||
DATA(ls_result) = lcl_ski_pricer=>calculate(
|
||||
iv_equipment = iv_equipment
|
||||
iv_days = iv_days
|
||||
iv_customer = iv_customer
|
||||
iv_insurance = iv_insurance ).
|
||||
ev_price = ls_result-price.
|
||||
ev_deposit = ls_result-deposit.
|
||||
CATCH lcx_invalid_equipment.
|
||||
RAISE invalid_equipment.
|
||||
CATCH lcx_invalid_days.
|
||||
RAISE invalid_days.
|
||||
CATCH lcx_invalid_customer.
|
||||
RAISE invalid_customer.
|
||||
ENDTRY.
|
||||
|
||||
ENDFUNCTION.
|
||||
60
tasks_gen/eval/G0144/reference/t14_test.clas.abap
Normal file
60
tasks_gen/eval/G0144/reference/t14_test.clas.abap
Normal file
@@ -0,0 +1,60 @@
|
||||
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES: BEGIN OF ty_result,
|
||||
fee TYPE decfloat34,
|
||||
note TYPE string,
|
||||
subrc TYPE sysubrc,
|
||||
END OF ty_result.
|
||||
METHODS calc
|
||||
IMPORTING iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
METHODS adult_fee FOR TESTING.
|
||||
METHODS family_fee FOR TESTING.
|
||||
METHODS weekend_and_member FOR TESTING.
|
||||
METHODS invalid_input FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_test IMPLEMENTATION.
|
||||
METHOD calc.
|
||||
rs_result-fee = 0.
|
||||
rs_result-note = ''.
|
||||
CALL FUNCTION '{{P}}MUSEUM_FEE_OLD'
|
||||
EXPORTING
|
||||
iv_visitor = iv_visitor
|
||||
iv_day = iv_day
|
||||
iv_size = iv_size
|
||||
iv_member = iv_member
|
||||
IMPORTING
|
||||
ev_fee = rs_result-fee
|
||||
ev_note = rs_result-note
|
||||
EXCEPTIONS
|
||||
invalid_input = 1
|
||||
OTHERS = 2.
|
||||
rs_result-subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD adult_fee.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 2 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 24 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD family_fee.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'FAMILY' iv_day = 'MON' iv_size = 6 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 42 ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weekend_and_member.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'SAT' iv_size = 2 iv_member = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '18.8' ) act = ls_r-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_input.
|
||||
DATA(ls_r) = me->calc( iv_visitor = 'ADULT' iv_day = 'MON' iv_size = 0 iv_member = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_r-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,94 +0,0 @@
|
||||
CLASS {{p}}t_ski_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING iv_equipment TYPE string
|
||||
iv_days TYPE i
|
||||
iv_customer TYPE string
|
||||
iv_insurance TYPE abap_bool
|
||||
EXPORTING ev_price TYPE decfloat34
|
||||
ev_deposit TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS test_invalid_days FOR TESTING.
|
||||
METHODS test_invalid_equipment FOR TESTING.
|
||||
METHODS test_invalid_customer FOR TESTING.
|
||||
METHODS test_adult_ski FOR TESTING.
|
||||
METHODS test_child_boots FOR TESTING.
|
||||
METHODS test_senior_snowboard FOR TESTING.
|
||||
METHODS test_insurance FOR TESTING.
|
||||
METHODS test_rounding FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_ski_test IMPLEMENTATION.
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}SKI_RENTAL_OLD'
|
||||
EXPORTING
|
||||
iv_equipment = iv_equipment
|
||||
iv_days = iv_days
|
||||
iv_customer = iv_customer
|
||||
iv_insurance = iv_insurance
|
||||
IMPORTING
|
||||
ev_price = ev_price
|
||||
ev_deposit = ev_deposit
|
||||
EXCEPTIONS
|
||||
invalid_equipment = 1
|
||||
invalid_days = 2
|
||||
invalid_customer = 3
|
||||
OTHERS = 4.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_invalid_days.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 0 iv_customer = 'ADULT' iv_insurance = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_subrc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_invalid_equipment.
|
||||
call( EXPORTING iv_equipment = 'X' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_subrc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_invalid_customer.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'X' iv_insurance = abap_false
|
||||
IMPORTING ev_subrc = DATA(lv_subrc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_adult_ski.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 1 iv_customer = 'ADULT' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_child_boots.
|
||||
call( EXPORTING iv_equipment = 'BOOTS' iv_days = 2 iv_customer = 'CHILD' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 20 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_senior_snowboard.
|
||||
call( EXPORTING iv_equipment = 'SNOWBOARD' iv_days = 3 iv_customer = 'SENIOR' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '68.40' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_insurance.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 7 iv_customer = 'ADULT' iv_insurance = abap_true
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '192.50' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_rounding.
|
||||
call( EXPORTING iv_equipment = 'SKI' iv_days = 3 iv_customer = 'CHILD' iv_insurance = abap_false
|
||||
IMPORTING ev_price = DATA(lv_price) ev_deposit = DATA(lv_deposit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '35.63' ) act = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 100 ) act = lv_deposit ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
82
tasks_gen/eval/G0144/seed/museum_fee_old.func.abap
Normal file
82
tasks_gen/eval/G0144/seed/museum_fee_old.func.abap
Normal file
@@ -0,0 +1,82 @@
|
||||
FUNCTION {{p}}museum_fee_old
|
||||
IMPORTING
|
||||
iv_visitor TYPE string
|
||||
iv_day TYPE string
|
||||
iv_size TYPE i
|
||||
iv_member TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_input.
|
||||
|
||||
DATA lv_base TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
|
||||
IF iv_size <= 0.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
IF iv_visitor = 'ADULT'.
|
||||
lv_base = 12.
|
||||
ELSEIF iv_visitor = 'CHILD'.
|
||||
lv_base = 6.
|
||||
ELSEIF iv_visitor = 'SENIOR'.
|
||||
lv_base = 8.
|
||||
ELSEIF iv_visitor = 'STUDENT'.
|
||||
lv_base = 7.
|
||||
ELSEIF iv_visitor = 'FAMILY'.
|
||||
lv_base = 30.
|
||||
ELSE.
|
||||
RAISE invalid_input.
|
||||
ENDIF.
|
||||
|
||||
IF iv_visitor = 'FAMILY'.
|
||||
IF iv_size <= 4.
|
||||
lv_total = 30.
|
||||
ELSE.
|
||||
lv_total = 30 + ( iv_size - 4 ) * 6.
|
||||
ENDIF.
|
||||
ELSE.
|
||||
lv_total = lv_base * iv_size.
|
||||
ENDIF.
|
||||
|
||||
IF iv_day = 'SAT'.
|
||||
lv_total = lv_total * '1.2'.
|
||||
ELSEIF iv_day = 'SUN'.
|
||||
lv_total = lv_total * '1.2'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
lv_total = lv_total - 10.
|
||||
IF lv_total < 0.
|
||||
lv_total = 0.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
lv_total = lv_total * '0.9'.
|
||||
ENDIF.
|
||||
|
||||
ev_fee = lv_total.
|
||||
|
||||
IF iv_visitor = 'ADULT'.
|
||||
ev_note = 'Adult'.
|
||||
ELSEIF iv_visitor = 'CHILD'.
|
||||
ev_note = 'Child'.
|
||||
ELSEIF iv_visitor = 'SENIOR'.
|
||||
ev_note = 'Senior'.
|
||||
ELSEIF iv_visitor = 'STUDENT'.
|
||||
ev_note = 'Student'.
|
||||
ELSEIF iv_visitor = 'FAMILY'.
|
||||
ev_note = 'Family'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_member = abap_true.
|
||||
ev_note = ev_note && ' member'.
|
||||
ENDIF.
|
||||
|
||||
IF iv_size >= 10.
|
||||
ev_note = ev_note && ' group'.
|
||||
ENDIF.
|
||||
ENDFUNCTION.
|
||||
@@ -1,78 +0,0 @@
|
||||
FUNCTION {{p}}ski_rental_old
|
||||
IMPORTING
|
||||
iv_equipment TYPE string
|
||||
iv_days TYPE i
|
||||
iv_customer TYPE string
|
||||
iv_insurance TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_price TYPE decfloat34
|
||||
ev_deposit TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_equipment
|
||||
invalid_days
|
||||
invalid_customer.
|
||||
|
||||
DATA lv_daily TYPE decfloat34.
|
||||
DATA lv_discount TYPE decfloat34.
|
||||
DATA lv_total TYPE decfloat34.
|
||||
DATA lv_duration_disc TYPE decfloat34.
|
||||
|
||||
IF iv_days < 1.
|
||||
RAISE invalid_days.
|
||||
ENDIF.
|
||||
|
||||
IF iv_equipment = 'SKI'.
|
||||
lv_daily = 25.
|
||||
ELSEIF iv_equipment = 'SNOWBOARD'.
|
||||
lv_daily = 30.
|
||||
ELSEIF iv_equipment = 'BOOTS'.
|
||||
lv_daily = 10.
|
||||
ELSEIF iv_equipment = 'HELMET'.
|
||||
lv_daily = 5.
|
||||
ELSE.
|
||||
RAISE invalid_equipment.
|
||||
ENDIF.
|
||||
|
||||
IF iv_customer = 'ADULT'.
|
||||
lv_discount = 0.
|
||||
ELSEIF iv_customer = 'CHILD'.
|
||||
lv_discount = 50.
|
||||
ELSEIF iv_customer = 'SENIOR'.
|
||||
lv_discount = 20.
|
||||
ELSE.
|
||||
RAISE invalid_customer.
|
||||
ENDIF.
|
||||
|
||||
lv_total = lv_daily * iv_days.
|
||||
lv_total = lv_total - lv_total * lv_discount / 100.
|
||||
|
||||
IF iv_days >= 7.
|
||||
lv_duration_disc = 10.
|
||||
ELSEIF iv_days >= 3.
|
||||
lv_duration_disc = 5.
|
||||
ELSE.
|
||||
lv_duration_disc = 0.
|
||||
ENDIF.
|
||||
lv_total = lv_total - lv_total * lv_duration_disc / 100.
|
||||
|
||||
IF iv_insurance = abap_true.
|
||||
lv_total = lv_total + 5 * iv_days.
|
||||
ENDIF.
|
||||
|
||||
ev_price = round( val = lv_total dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF iv_equipment = 'SKI'.
|
||||
ev_deposit = 100.
|
||||
ELSEIF iv_equipment = 'SNOWBOARD'.
|
||||
ev_deposit = 120.
|
||||
ELSEIF iv_equipment = 'BOOTS'.
|
||||
ev_deposit = 20.
|
||||
ELSEIF iv_equipment = 'HELMET'.
|
||||
ev_deposit = 10.
|
||||
ENDIF.
|
||||
|
||||
IF iv_insurance = abap_true.
|
||||
ev_deposit = ev_deposit + 50.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
@@ -1,32 +1,41 @@
|
||||
# 1. Goal
|
||||
Refactor the legacy function module {{P}}SKI_RENTAL_OLD in function group {{P}}FG_SKI. The function module calculates the rental price and the deposit for ski equipment. Improve the readability, the maintainability, and the structure of the code. The behavior must stay the same. The public interface must not change.
|
||||
Refactor the legacy function module {{P}}MUSEUM_FEE_OLD in function group
|
||||
{{P}}FG_MUSEUM. The function module calculates the entry fee for a museum visit.
|
||||
The behavior of the function module must stay the same. Improve the code
|
||||
quality.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_SKI exists in package $TMP.
|
||||
- Function module {{P}}SKI_RENTAL_OLD exists in this group. It contains legacy code.
|
||||
- A rental program calls the function module. The callers use the current interface.
|
||||
- Function group {{P}}FG_MUSEUM exists in package $TMP.
|
||||
- Function module {{P}}MUSEUM_FEE_OLD exists in this group. It contains legacy
|
||||
code.
|
||||
- The function module is called by a ticketing program. The interface must not
|
||||
change.
|
||||
|
||||
# 4. Contract
|
||||
- The function module {{P}}SKI_RENTAL_OLD keeps its name and its function group.
|
||||
- The interface stays exactly the same:
|
||||
- Importing: iv_equipment TYPE string, iv_days TYPE i, iv_customer TYPE string, iv_insurance TYPE abap_bool
|
||||
- Exporting: ev_price TYPE decfloat34, ev_deposit TYPE decfloat34
|
||||
- Exceptions: invalid_equipment, invalid_days, invalid_customer
|
||||
- Refactor the function module {{P}}MUSEUM_FEE_OLD in function group
|
||||
{{P}}FG_MUSEUM.
|
||||
- Keep the name and the public interface: the same parameter names, kinds,
|
||||
types, and exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
The business rules are defined by the current implementation of {{P}}SKI_RENTAL_OLD. The behavior must stay the same. Read the legacy code to understand the rules.
|
||||
1. The behavior of the function module must not change. The legacy code defines
|
||||
the business rules.
|
||||
2. The function module must raise the exception INVALID_INPUT for the same
|
||||
inputs as the legacy code.
|
||||
3. The exported values must be the same as the legacy code for all valid
|
||||
inputs.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- The function module must be active and have no syntax error.
|
||||
- Refactor the code in place. Do not change the public interface.
|
||||
- Follow Clean ABAP: small methods, no duplication, meaningful names, constants for literals.
|
||||
- Out of scope: do not change the function group {{P}}FG_SKI. Do not create new function modules.
|
||||
- Coding standards: Clean ABAP, no ATC priority 1 or 2 findings, methods below
|
||||
40 statements.
|
||||
- Out of scope: none.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module is active and has no syntax error.
|
||||
- The behavior is unchanged.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
|
||||
@@ -12,52 +12,47 @@
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_SKI",
|
||||
"description": "Ski rental function group"
|
||||
"name": "{{P}}FG_MUSEUM",
|
||||
"description": "Museum fee function group"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}SKI_RENTAL_OLD",
|
||||
"functionGroup": "{{P}}FG_SKI",
|
||||
"file": "seed/ski_rental_old.func.abap",
|
||||
"description": "Legacy ski rental pricing"
|
||||
"name": "{{P}}MUSEUM_FEE_OLD",
|
||||
"functionGroup": "{{P}}FG_MUSEUM",
|
||||
"file": "seed/museum_fee_old.func.abap",
|
||||
"description": "Legacy museum fee calculator"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}SKI_RENTAL_OLD",
|
||||
"functionGroup": "{{P}}FG_SKI",
|
||||
"name": "{{P}}MUSEUM_FEE_OLD",
|
||||
"functionGroup": "{{P}}FG_MUSEUM",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_equipment",
|
||||
"name": "iv_visitor",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_days",
|
||||
"name": "iv_day",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_size",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_customer",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_insurance",
|
||||
"name": "iv_member",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_price",
|
||||
"name": "ev_fee",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "ev_deposit",
|
||||
"type": "decfloat34"
|
||||
"name": "ev_note",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"exceptions": [
|
||||
"invalid_equipment",
|
||||
"invalid_days",
|
||||
"invalid_customer"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -65,24 +60,24 @@
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_SKI_HIDDEN",
|
||||
"file": "hidden/t_ski_hidden.clas.abap",
|
||||
"description": "Hidden tests for ski rental pricing"
|
||||
"name": "{{P}}T14_HIDDEN",
|
||||
"file": "hidden/t14_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}SKI_RENTAL_OLD",
|
||||
"functionGroup": "{{P}}FG_SKI",
|
||||
"file": "reference/ski_rental_old.func.abap",
|
||||
"description": "Refactored ski rental pricing"
|
||||
"name": "{{P}}MUSEUM_FEE_OLD",
|
||||
"functionGroup": "{{P}}FG_MUSEUM",
|
||||
"file": "reference/museum_fee_old.func.abap",
|
||||
"description": "Refactored museum fee calculator"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_SKI_TEST",
|
||||
"file": "reference/t_ski_test.clas.abap",
|
||||
"description": "Own tests for ski rental pricing"
|
||||
"name": "{{P}}T14_TEST",
|
||||
"file": "reference/t14_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
|
||||
Reference in New Issue
Block a user