H and K tested (G0168, G0178 accepted); keyword fast path needs all groups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
14
tasks_gen/eval/G0168/generation.json
Normal file
14
tasks_gen/eval/G0168/generation.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "G0168",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "H",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100,
|
||||
"null": 30
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
50
tasks_gen/eval/G0168/reference/volume_discount.clas.abap
Normal file
50
tasks_gen/eval/G0168/reference/volume_discount.clas.abap
Normal file
@@ -0,0 +1,50 @@
|
||||
CLASS {{p}}volume_discount DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_discount.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_discount TYPE {{p}}if_discount=>ty_percent VALUE '12.00',
|
||||
c_key_discount TYPE {{p}}if_discount=>ty_percent VALUE '6.00',
|
||||
c_mid_discount TYPE {{p}}if_discount=>ty_percent VALUE '3.00',
|
||||
c_high_discount TYPE {{p}}if_discount=>ty_percent VALUE '7.00',
|
||||
c_no_discount TYPE {{p}}if_discount=>ty_percent VALUE '0.00',
|
||||
c_mid_limit TYPE i VALUE 100,
|
||||
c_high_limit TYPE i VALUE 500.
|
||||
|
||||
METHODS customer_discount
|
||||
IMPORTING iv_group TYPE {{p}}if_discount=>ty_group
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_discount=>ty_percent.
|
||||
|
||||
METHODS volume_discount
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_discount=>ty_percent.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}volume_discount IMPLEMENTATION.
|
||||
METHOD {{p}}if_discount~calculate.
|
||||
rv_percent = customer_discount( iv_group ) + volume_discount( iv_quantity ).
|
||||
IF rv_percent > c_max_discount.
|
||||
rv_percent = c_max_discount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD customer_discount.
|
||||
IF iv_group = {{p}}if_discount=>c_group_key.
|
||||
rv_percent = c_key_discount.
|
||||
ELSE.
|
||||
rv_percent = c_no_discount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD volume_discount.
|
||||
IF iv_quantity < c_mid_limit.
|
||||
rv_percent = c_no_discount.
|
||||
ELSEIF iv_quantity < c_high_limit.
|
||||
rv_percent = c_mid_discount.
|
||||
ELSE.
|
||||
rv_percent = c_high_discount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,63 @@
|
||||
CLASS ltc_volume_discount DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_discount.
|
||||
METHODS setup.
|
||||
METHODS key_high_volume FOR TESTING.
|
||||
METHODS key_mid_volume FOR TESTING.
|
||||
METHODS standard_small FOR TESTING.
|
||||
METHODS standard_high FOR TESTING.
|
||||
METHODS unknown_group FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_volume_discount IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}volume_discount( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD key_high_volume.
|
||||
DATA lv_expected TYPE {{p}}if_discount=>ty_percent.
|
||||
lv_expected = '12.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_expected
|
||||
act = mo_cut->calculate( iv_quantity = 800
|
||||
iv_group = {{p}}if_discount=>c_group_key ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD key_mid_volume.
|
||||
DATA lv_expected TYPE {{p}}if_discount=>ty_percent.
|
||||
lv_expected = '9.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_expected
|
||||
act = mo_cut->calculate( iv_quantity = 250
|
||||
iv_group = {{p}}if_discount=>c_group_key ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD standard_small.
|
||||
DATA lv_expected TYPE {{p}}if_discount=>ty_percent.
|
||||
lv_expected = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_expected
|
||||
act = mo_cut->calculate( iv_quantity = 50
|
||||
iv_group = {{p}}if_discount=>c_group_standard ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD standard_high.
|
||||
DATA lv_expected TYPE {{p}}if_discount=>ty_percent.
|
||||
lv_expected = '7.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_expected
|
||||
act = mo_cut->calculate( iv_quantity = 600
|
||||
iv_group = {{p}}if_discount=>c_group_standard ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_group.
|
||||
DATA lv_expected TYPE {{p}}if_discount=>ty_percent.
|
||||
lv_expected = '7.00'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = lv_expected
|
||||
act = mo_cut->calculate( iv_quantity = 600
|
||||
iv_group = 'X' ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
11
tasks_gen/eval/G0168/seed/if_discount.intf.abap
Normal file
11
tasks_gen/eval/G0168/seed/if_discount.intf.abap
Normal file
@@ -0,0 +1,11 @@
|
||||
INTERFACE {{p}}if_discount PUBLIC.
|
||||
TYPES ty_group TYPE c LENGTH 1.
|
||||
TYPES ty_percent TYPE p LENGTH 5 DECIMALS 2.
|
||||
CONSTANTS:
|
||||
c_group_key TYPE ty_group VALUE 'A',
|
||||
c_group_standard TYPE ty_group VALUE 'S'.
|
||||
METHODS calculate
|
||||
IMPORTING iv_quantity TYPE i
|
||||
iv_group TYPE ty_group
|
||||
RETURNING VALUE(rv_percent) TYPE ty_percent.
|
||||
ENDINTERFACE.
|
||||
48
tasks_gen/eval/G0168/spec.md
Normal file
48
tasks_gen/eval/G0168/spec.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# 1. Goal
|
||||
Calculate the discount percentage for a wholesale order. A sales program calls the
|
||||
calculation before it prices the order. The program needs one discount percentage
|
||||
for each order.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_DISCOUNT exists in package $TMP. It is active.
|
||||
- The interface has the type TY_GROUP (CHAR 1), the type TY_PERCENT (P length 5
|
||||
with 2 decimals), the constants C_GROUP_KEY ('A') and C_GROUP_STANDARD ('S'),
|
||||
and one method:
|
||||
CALCULATE IMPORTING iv_quantity TYPE i
|
||||
iv_group TYPE ty_group
|
||||
RETURNING VALUE(rv_percent) TYPE ty_percent.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}VOLUME_DISCOUNT in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_DISCOUNT.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
The discount percentage is the sum of the customer discount and the volume
|
||||
discount. The result is at most 12.00.
|
||||
1. Customer discount:
|
||||
- Group C_GROUP_KEY: 6.00.
|
||||
- Group C_GROUP_STANDARD: 0.00.
|
||||
- Any other group: 0.00.
|
||||
2. Volume discount. The order quantity is the number of pieces:
|
||||
- Less than 100 pieces: 0.00.
|
||||
- More than 100 pieces and less than 500 pieces: 3.00.
|
||||
- 500 pieces or more: 7.00.
|
||||
3. Add the customer discount and the volume discount. If the sum is more than
|
||||
12.00, the result is 12.00.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_DISCOUNT.
|
||||
- If a business rule is missing or two business rules contradict, do not create
|
||||
the object. Report the gap.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
57
tasks_gen/eval/G0168/task.json
Normal file
57
tasks_gen/eval/G0168/task.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"id": "G0168",
|
||||
"category": "H",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "stop",
|
||||
"expected_gap": {
|
||||
"description": "The business rules do not state which volume discount applies for an order quantity of exactly 100 pieces.",
|
||||
"keywords": [
|
||||
[
|
||||
"quantity",
|
||||
"100"
|
||||
],
|
||||
[
|
||||
"volume",
|
||||
"discount"
|
||||
]
|
||||
]
|
||||
},
|
||||
"budget": {
|
||||
"max_tool_calls": 30,
|
||||
"max_activations": 5
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_DISCOUNT",
|
||||
"file": "seed/if_discount.intf.abap",
|
||||
"description": "Discount calculation contract"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}VOLUME_DISCOUNT",
|
||||
"implements": "{{P}}IF_DISCOUNT"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_DISCOUNT"
|
||||
],
|
||||
"hidden_tests": [],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}VOLUME_DISCOUNT",
|
||||
"file": "reference/volume_discount.clas.abap",
|
||||
"description": "Volume discount calculation",
|
||||
"testclasses_file": "reference/volume_discount.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"global_variables"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user