Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
61
tasks_gen/train/G1918/faulty/m0_bouquet_pricing.intf.abap
Normal file
61
tasks_gen/train/G1918/faulty/m0_bouquet_pricing.intf.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
INTERFACE {{p}}if_bouquet_pricing PUBLIC.
|
||||
TYPES:
|
||||
ty_size TYPE c LENGTH 1,
|
||||
ty_zone TYPE c LENGTH 1,
|
||||
ty_reason TYPE c LENGTH 12,
|
||||
ty_amount TYPE p LENGTH 8 DECIMALS 2,
|
||||
ty_stems TYPE i.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_size,
|
||||
small TYPE ty_size VALUE 'S',
|
||||
medium TYPE ty_size VALUE 'M',
|
||||
large TYPE ty_size VALUE 'L',
|
||||
END OF c_size.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_zone,
|
||||
town TYPE ty_zone VALUE 'T1',
|
||||
nearby TYPE ty_zone VALUE 'N1',
|
||||
far TYPE ty_zone VALUE 'F1',
|
||||
END OF c_zone.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_stems TYPE ty_reason VALUE 'NO_STEMS',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
bad_size TYPE ty_reason VALUE 'BAD_SIZE',
|
||||
bad_zone TYPE ty_reason VALUE 'BAD_ZONE',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_stems TYPE ty_stems VALUE 5,
|
||||
max_stems TYPE ty_stems VALUE 60,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_fee,
|
||||
vase TYPE ty_amount VALUE '4.50',
|
||||
town TYPE ty_amount VALUE '0.00',
|
||||
nearby TYPE ty_amount VALUE '6.00',
|
||||
far TYPE ty_amount VALUE '12.00',
|
||||
END OF c_fee.
|
||||
|
||||
METHODS check_order
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS delivery_fee
|
||||
IMPORTING iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS bouquet_price
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_vase TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
61
tasks_gen/train/G1918/faulty/m1_bouquet_pricing.intf.abap
Normal file
61
tasks_gen/train/G1918/faulty/m1_bouquet_pricing.intf.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
INTERFACE {{p}}if_bouquet_pricing PUBLIC.
|
||||
TYPES:
|
||||
ty_size TYPE c LENGTH 1,
|
||||
ty_zone TYPE c LENGTH 2,
|
||||
ty_reason TYPE c LENGTH 12,
|
||||
ty_amount TYPE p LENGTH 8 DECIMALS 2,
|
||||
ty_stems TYPE i.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_size,
|
||||
small TYPE ty_size VALUE 'S',
|
||||
medium TYPE ty_size VALUE 'M',
|
||||
large TYPE ty_size VALUE 'L',
|
||||
END OF c_size.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_zone,
|
||||
town TYPE ty_zone VALUE 'T1',
|
||||
nearby TYPE ty_zone VALUE 'N1',
|
||||
far TYPE ty_zone VALUE 'Z1',
|
||||
END OF c_zone.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_stems TYPE ty_reason VALUE 'NO_STEMS',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
bad_size TYPE ty_reason VALUE 'BAD_SIZE',
|
||||
bad_zone TYPE ty_reason VALUE 'BAD_ZONE',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_stems TYPE ty_stems VALUE 5,
|
||||
max_stems TYPE ty_stems VALUE 60,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_fee,
|
||||
vase TYPE ty_amount VALUE '4.50',
|
||||
town TYPE ty_amount VALUE '0.00',
|
||||
nearby TYPE ty_amount VALUE '6.00',
|
||||
far TYPE ty_amount VALUE '12.00',
|
||||
END OF c_fee.
|
||||
|
||||
METHODS check_order
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS delivery_fee
|
||||
IMPORTING iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS bouquet_price
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_vase TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
61
tasks_gen/train/G1918/faulty/m2_bouquet_pricing.intf.abap
Normal file
61
tasks_gen/train/G1918/faulty/m2_bouquet_pricing.intf.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
INTERFACE {{p}}if_bouquet_pricing PUBLIC.
|
||||
TYPES:
|
||||
ty_size TYPE c LENGTH 1,
|
||||
ty_zone TYPE c LENGTH 2,
|
||||
ty_reason TYPE c LENGTH 12,
|
||||
ty_amount TYPE p LENGTH 8 DECIMALS 2,
|
||||
ty_stems TYPE i.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_size,
|
||||
small TYPE ty_size VALUE 'S',
|
||||
medium TYPE ty_size VALUE 'M',
|
||||
large TYPE ty_size VALUE 'L',
|
||||
END OF c_size.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_zone,
|
||||
town TYPE ty_zone VALUE 'T1',
|
||||
nearby TYPE ty_zone VALUE 'N1',
|
||||
far TYPE ty_zone VALUE 'F1',
|
||||
END OF c_zone.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'ZK',
|
||||
no_stems TYPE ty_reason VALUE 'NO_STEMS',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
bad_size TYPE ty_reason VALUE 'BAD_SIZE',
|
||||
bad_zone TYPE ty_reason VALUE 'BAD_ZONE',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_stems TYPE ty_stems VALUE 5,
|
||||
max_stems TYPE ty_stems VALUE 60,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_fee,
|
||||
vase TYPE ty_amount VALUE '4.50',
|
||||
town TYPE ty_amount VALUE '0.00',
|
||||
nearby TYPE ty_amount VALUE '6.00',
|
||||
far TYPE ty_amount VALUE '12.00',
|
||||
END OF c_fee.
|
||||
|
||||
METHODS check_order
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS delivery_fee
|
||||
IMPORTING iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS bouquet_price
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_vase TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
61
tasks_gen/train/G1918/faulty/m3_bouquet_pricing.intf.abap
Normal file
61
tasks_gen/train/G1918/faulty/m3_bouquet_pricing.intf.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
INTERFACE {{p}}if_bouquet_pricing PUBLIC.
|
||||
TYPES:
|
||||
ty_size TYPE c LENGTH 1,
|
||||
ty_zone TYPE c LENGTH 2,
|
||||
ty_reason TYPE c LENGTH 12,
|
||||
ty_amount TYPE p LENGTH 8 DECIMALS 2,
|
||||
ty_stems TYPE i.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_size,
|
||||
small TYPE ty_size VALUE 'S',
|
||||
medium TYPE ty_size VALUE 'M',
|
||||
large TYPE ty_size VALUE 'L',
|
||||
END OF c_size.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_zone,
|
||||
town TYPE ty_zone VALUE 'T1',
|
||||
nearby TYPE ty_zone VALUE 'N1',
|
||||
far TYPE ty_zone VALUE 'F1',
|
||||
END OF c_zone.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_stems TYPE ty_reason VALUE 'NO_STEMS',
|
||||
too_many TYPE ty_reason VALUE 'ZOO_MANY',
|
||||
bad_size TYPE ty_reason VALUE 'BAD_SIZE',
|
||||
bad_zone TYPE ty_reason VALUE 'BAD_ZONE',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_stems TYPE ty_stems VALUE 5,
|
||||
max_stems TYPE ty_stems VALUE 60,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_fee,
|
||||
vase TYPE ty_amount VALUE '4.50',
|
||||
town TYPE ty_amount VALUE '0.00',
|
||||
nearby TYPE ty_amount VALUE '6.00',
|
||||
far TYPE ty_amount VALUE '12.00',
|
||||
END OF c_fee.
|
||||
|
||||
METHODS check_order
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS delivery_fee
|
||||
IMPORTING iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS bouquet_price
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_vase TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
39
tasks_gen/train/G1918/generation.json
Normal file
39
tasks_gen/train/G1918/generation.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"id": "G1918",
|
||||
"pool": "train",
|
||||
"object_type": "INTF",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"hidden/t02_hidden.clas.abap line 62: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"reference/bouquet_if_test.clas.abap line 59: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 80.6,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 4,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
173
tasks_gen/train/G1918/hidden/t02_hidden.clas.abap
Normal file
173
tasks_gen/train/G1918/hidden/t02_hidden.clas.abap
Normal file
@@ -0,0 +1,173 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_bouquet_pricing.
|
||||
PRIVATE SECTION.
|
||||
METHODS size_constants FOR TESTING.
|
||||
METHODS zone_constants FOR TESTING.
|
||||
METHODS reason_constants FOR TESTING.
|
||||
METHODS limit_constants FOR TESTING.
|
||||
METHODS fee_constants FOR TESTING.
|
||||
METHODS type_lengths FOR TESTING.
|
||||
METHODS check_order_contract FOR TESTING.
|
||||
METHODS delivery_fee_contract FOR TESTING.
|
||||
METHODS bouquet_price_contract FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
METHOD {{p}}if_bouquet_pricing~check_order.
|
||||
rv_reason = {{p}}if_bouquet_pricing=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_bouquet_pricing~delivery_fee.
|
||||
rv_fee = {{p}}if_bouquet_pricing=>c_fee-nearby.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_bouquet_pricing~bouquet_price.
|
||||
rv_price = {{p}}if_bouquet_pricing=>c_fee-vase.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_constants.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_size.
|
||||
lv_exp = 'S'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_size-small ).
|
||||
lv_exp = 'M'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_size-medium ).
|
||||
lv_exp = 'L'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_size-large ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zone_constants.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_zone.
|
||||
lv_exp = 'T1'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_zone-town ).
|
||||
lv_exp = 'N1'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_zone-nearby ).
|
||||
lv_exp = 'F1'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_zone-far ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_constants.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_reason.
|
||||
lv_exp = 'OK'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-ok ).
|
||||
lv_exp = 'NO_STEMS'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-no_stems ).
|
||||
lv_exp = 'TOO_MANY'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-too_many ).
|
||||
lv_exp = 'BAD_SIZE'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-bad_size ).
|
||||
lv_exp = 'BAD_ZONE'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-bad_zone ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_constants.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_stems.
|
||||
lv_exp = 5.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_limit-min_stems ).
|
||||
lv_exp = 60.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_limit-max_stems ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fee_constants.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_amount.
|
||||
lv_exp = '4.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-vase ).
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-town ).
|
||||
lv_exp = '6.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-nearby ).
|
||||
lv_exp = '12.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-far ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_lengths.
|
||||
DATA lv_size TYPE {{p}}if_bouquet_pricing=>ty_size.
|
||||
DATA lv_zone TYPE {{p}}if_bouquet_pricing=>ty_zone.
|
||||
DATA lv_reason TYPE {{p}}if_bouquet_pricing=>ty_reason.
|
||||
DATA lv_amount TYPE {{p}}if_bouquet_pricing=>ty_amount.
|
||||
DATA lv_stems TYPE {{p}}if_bouquet_pricing=>ty_stems.
|
||||
|
||||
DATA lv_ref_size TYPE c LENGTH 1.
|
||||
DATA lv_ref_zone TYPE c LENGTH 2.
|
||||
DATA lv_ref_reason TYPE c LENGTH 12.
|
||||
DATA lv_ref_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
DATA lv_ref_stems TYPE i.
|
||||
|
||||
DATA(lo_size) = cl_abap_typedescr=>describe_by_data( lv_size ).
|
||||
DATA(lo_zone) = cl_abap_typedescr=>describe_by_data( lv_zone ).
|
||||
DATA(lo_reason) = cl_abap_typedescr=>describe_by_data( lv_reason ).
|
||||
DATA(lo_amount) = cl_abap_typedescr=>describe_by_data( lv_amount ).
|
||||
DATA(lo_stems) = cl_abap_typedescr=>describe_by_data( lv_stems ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lo_size->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lo_zone->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lo_reason->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'P' act = lo_amount->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'I' act = lo_stems->type_kind ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lo_amount->decimals ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_size )->length
|
||||
act = lo_size->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_zone )->length
|
||||
act = lo_zone->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_reason )->length
|
||||
act = lo_reason->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_amount )->length
|
||||
act = lo_amount->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_stems )->length
|
||||
act = lo_stems->length ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_order_contract.
|
||||
DATA lo_cut TYPE REF TO {{p}}if_bouquet_pricing.
|
||||
lo_cut = me.
|
||||
DATA(lv_reason) = lo_cut->check_order( iv_size = {{p}}if_bouquet_pricing=>c_size-medium
|
||||
iv_stems = 20
|
||||
iv_zone = {{p}}if_bouquet_pricing=>c_zone-town ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_bouquet_pricing=>c_reason-ok
|
||||
act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD delivery_fee_contract.
|
||||
DATA lo_cut TYPE REF TO {{p}}if_bouquet_pricing.
|
||||
lo_cut = me.
|
||||
DATA(lv_fee) = lo_cut->delivery_fee( iv_zone = {{p}}if_bouquet_pricing=>c_zone-nearby ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_bouquet_pricing=>c_fee-nearby
|
||||
act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bouquet_price_contract.
|
||||
DATA lo_cut TYPE REF TO {{p}}if_bouquet_pricing.
|
||||
lo_cut = me.
|
||||
DATA(lv_price) = lo_cut->bouquet_price( iv_size = {{p}}if_bouquet_pricing=>c_size-large
|
||||
iv_stems = 40
|
||||
iv_vase = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_bouquet_pricing=>c_fee-vase
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
52
tasks_gen/train/G1918/mutation.json
Normal file
52
tasks_gen/train/G1918/mutation.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"task": "G1918",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}IF_BOUQUET_PRICING",
|
||||
"mutant": "line 4: LENGTH 2 -> LENGTH 1 (length)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"TYPE_LENGTHS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_BOUQUET_PRICING",
|
||||
"mutant": "line 20: VALUE 'F1' -> VALUE 'Z1' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"ZONE_CONSTANTS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_BOUQUET_PRICING",
|
||||
"mutant": "line 25: VALUE 'OK' -> VALUE 'ZK' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"REASON_CONSTANTS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_BOUQUET_PRICING",
|
||||
"mutant": "line 27: VALUE 'TOO_MANY' -> VALUE 'ZOO_MANY' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"REASON_CONSTANTS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_BOUQUET_PRICING",
|
||||
"mutant": "line 41: VALUE '0.00' -> VALUE 'Z.00' (lit)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
}
|
||||
],
|
||||
"valid": 4,
|
||||
"killed": 4,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
142
tasks_gen/train/G1918/reference/bouquet_if_test.clas.abap
Normal file
142
tasks_gen/train/G1918/reference/bouquet_if_test.clas.abap
Normal file
@@ -0,0 +1,142 @@
|
||||
CLASS {{p}}bouquet_if_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_bouquet_pricing.
|
||||
PRIVATE SECTION.
|
||||
METHODS size_values FOR TESTING.
|
||||
METHODS zone_values FOR TESTING.
|
||||
METHODS reason_values FOR TESTING.
|
||||
METHODS limit_values FOR TESTING.
|
||||
METHODS fee_values FOR TESTING.
|
||||
METHODS types_are_correct FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}bouquet_if_test IMPLEMENTATION.
|
||||
METHOD {{p}}if_bouquet_pricing~check_order.
|
||||
rv_reason = {{p}}if_bouquet_pricing=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_bouquet_pricing~delivery_fee.
|
||||
rv_fee = {{p}}if_bouquet_pricing=>c_fee-town.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_bouquet_pricing~bouquet_price.
|
||||
rv_price = {{p}}if_bouquet_pricing=>c_fee-vase.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD size_values.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_size.
|
||||
lv_exp = 'S'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_size-small ).
|
||||
lv_exp = 'M'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_size-medium ).
|
||||
lv_exp = 'L'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_size-large ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zone_values.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_zone.
|
||||
lv_exp = 'T1'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_zone-town ).
|
||||
lv_exp = 'N1'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_zone-nearby ).
|
||||
lv_exp = 'F1'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_zone-far ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_values.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_reason.
|
||||
lv_exp = 'OK'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-ok ).
|
||||
lv_exp = 'NO_STEMS'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-no_stems ).
|
||||
lv_exp = 'TOO_MANY'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-too_many ).
|
||||
lv_exp = 'BAD_SIZE'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-bad_size ).
|
||||
lv_exp = 'BAD_ZONE'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_reason-bad_zone ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_values.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_stems.
|
||||
lv_exp = 5.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_limit-min_stems ).
|
||||
lv_exp = 60.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_limit-max_stems ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fee_values.
|
||||
DATA lv_exp TYPE {{p}}if_bouquet_pricing=>ty_amount.
|
||||
lv_exp = '4.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-vase ).
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-town ).
|
||||
lv_exp = '6.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-nearby ).
|
||||
lv_exp = '12.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp
|
||||
act = {{p}}if_bouquet_pricing=>c_fee-far ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD types_are_correct.
|
||||
DATA lv_size TYPE {{p}}if_bouquet_pricing=>ty_size.
|
||||
DATA lv_zone TYPE {{p}}if_bouquet_pricing=>ty_zone.
|
||||
DATA lv_reason TYPE {{p}}if_bouquet_pricing=>ty_reason.
|
||||
DATA lv_amount TYPE {{p}}if_bouquet_pricing=>ty_amount.
|
||||
DATA lv_stems TYPE {{p}}if_bouquet_pricing=>ty_stems.
|
||||
|
||||
DATA lv_ref_size TYPE c LENGTH 1.
|
||||
DATA lv_ref_zone TYPE c LENGTH 2.
|
||||
DATA lv_ref_reason TYPE c LENGTH 12.
|
||||
DATA lv_ref_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
DATA lv_ref_stems TYPE i.
|
||||
|
||||
DATA(lo_size) = cl_abap_typedescr=>describe_by_data( lv_size ).
|
||||
DATA(lo_zone) = cl_abap_typedescr=>describe_by_data( lv_zone ).
|
||||
DATA(lo_reason) = cl_abap_typedescr=>describe_by_data( lv_reason ).
|
||||
DATA(lo_amount) = cl_abap_typedescr=>describe_by_data( lv_amount ).
|
||||
DATA(lo_stems) = cl_abap_typedescr=>describe_by_data( lv_stems ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lo_size->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lo_zone->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lo_reason->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'P' act = lo_amount->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'I' act = lo_stems->type_kind ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lo_amount->decimals ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_size )->length
|
||||
act = lo_size->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_zone )->length
|
||||
act = lo_zone->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_reason )->length
|
||||
act = lo_reason->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_amount )->length
|
||||
act = lo_amount->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = cl_abap_typedescr=>describe_by_data( lv_ref_stems )->length
|
||||
act = lo_stems->length ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
61
tasks_gen/train/G1918/reference/bouquet_pricing.intf.abap
Normal file
61
tasks_gen/train/G1918/reference/bouquet_pricing.intf.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
INTERFACE {{p}}if_bouquet_pricing PUBLIC.
|
||||
TYPES:
|
||||
ty_size TYPE c LENGTH 1,
|
||||
ty_zone TYPE c LENGTH 2,
|
||||
ty_reason TYPE c LENGTH 12,
|
||||
ty_amount TYPE p LENGTH 8 DECIMALS 2,
|
||||
ty_stems TYPE i.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_size,
|
||||
small TYPE ty_size VALUE 'S',
|
||||
medium TYPE ty_size VALUE 'M',
|
||||
large TYPE ty_size VALUE 'L',
|
||||
END OF c_size.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_zone,
|
||||
town TYPE ty_zone VALUE 'T1',
|
||||
nearby TYPE ty_zone VALUE 'N1',
|
||||
far TYPE ty_zone VALUE 'F1',
|
||||
END OF c_zone.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_stems TYPE ty_reason VALUE 'NO_STEMS',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
bad_size TYPE ty_reason VALUE 'BAD_SIZE',
|
||||
bad_zone TYPE ty_reason VALUE 'BAD_ZONE',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_stems TYPE ty_stems VALUE 5,
|
||||
max_stems TYPE ty_stems VALUE 60,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_fee,
|
||||
vase TYPE ty_amount VALUE '4.50',
|
||||
town TYPE ty_amount VALUE '0.00',
|
||||
nearby TYPE ty_amount VALUE '6.00',
|
||||
far TYPE ty_amount VALUE '12.00',
|
||||
END OF c_fee.
|
||||
|
||||
METHODS check_order
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS delivery_fee
|
||||
IMPORTING iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS bouquet_price
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_vase TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
93
tasks_gen/train/G1918/spec.md
Normal file
93
tasks_gen/train/G1918/spec.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# 1. Goal
|
||||
The order desk of a florist prices bouquet orders. The shop counter, the web
|
||||
shop and the telephone desk must all use the same contract. Create the interface
|
||||
{{P}}IF_BOUQUET_PRICING in package $TMP. The interface fixes the types, the
|
||||
constants and the methods of the contract.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_BOUQUET_PRICING does not exist yet.
|
||||
- The interface is in package $TMP.
|
||||
- Every pricing module of the florist implements this interface. The pricing
|
||||
modules are not part of this task.
|
||||
- The hidden tests use a class that implements the interface. That class only
|
||||
compiles when every type, every constant and every method signature matches.
|
||||
|
||||
# 4. Contract
|
||||
- Create the interface {{P}}IF_BOUQUET_PRICING in package $TMP.
|
||||
- The interface is global and public.
|
||||
- The interface contains the types, the constants and the methods of section 5.
|
||||
- Do not add other components to the interface.
|
||||
|
||||
# 5. Business rules
|
||||
## 5.1 Types
|
||||
The interface defines these five types.
|
||||
| Type | Definition |
|
||||
| --- | --- |
|
||||
| ty_size | TYPE c LENGTH 1 |
|
||||
| ty_zone | TYPE c LENGTH 2 |
|
||||
| ty_reason | TYPE c LENGTH 12 |
|
||||
| ty_amount | TYPE p LENGTH 8 DECIMALS 2 |
|
||||
| ty_stems | TYPE i |
|
||||
|
||||
## 5.2 Constants
|
||||
The interface defines these five constant structures.
|
||||
|
||||
c_size has the type ty_size. The components are:
|
||||
- small = 'S'. A small bouquet.
|
||||
- medium = 'M'. A medium bouquet.
|
||||
- large = 'L'. A large bouquet.
|
||||
|
||||
c_zone has the type ty_zone. The components are:
|
||||
- town = 'T1'. A delivery inside the town.
|
||||
- nearby = 'N1'. A delivery in the near area.
|
||||
- far = 'F1'. A delivery in the far area.
|
||||
|
||||
c_reason has the type ty_reason. The components are:
|
||||
- ok = 'OK'.
|
||||
- no_stems = 'NO_STEMS'.
|
||||
- too_many = 'TOO_MANY'.
|
||||
- bad_size = 'BAD_SIZE'.
|
||||
- bad_zone = 'BAD_ZONE'.
|
||||
|
||||
c_limit has the type ty_stems. The components are:
|
||||
- min_stems = 5.
|
||||
- max_stems = 60.
|
||||
|
||||
c_fee has the type ty_amount. The components are:
|
||||
- vase = '4.50'. The fee for a vase.
|
||||
- town = '0.00'. The delivery fee inside the town.
|
||||
- nearby = '6.00'. The delivery fee in the near area.
|
||||
- far = '12.00'. The delivery fee in the far area.
|
||||
|
||||
## 5.3 Methods
|
||||
The interface defines these three methods.
|
||||
|
||||
1. check_order
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
2. delivery_fee
|
||||
IMPORTING iv_zone TYPE ty_zone
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
3. bouquet_price
|
||||
IMPORTING iv_size TYPE ty_size
|
||||
iv_stems TYPE ty_stems
|
||||
iv_vase TYPE abap_bool
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.58.
|
||||
- Coding standards: Clean ABAP. No comment that restates the code.
|
||||
- Out of scope: no other repository object. Do not change other objects of
|
||||
package $TMP.
|
||||
|
||||
# 7. Acceptance
|
||||
- The interface {{P}}IF_BOUQUET_PRICING is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests in a global test class in package $TMP.
|
||||
46
tasks_gen/train/G1918/task.json
Normal file
46
tasks_gen/train/G1918/task.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"id": "G1918",
|
||||
"category": "A",
|
||||
"object_type": "INTF",
|
||||
"difficulty": 2,
|
||||
"release_target": "v758",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_BOUQUET_PRICING"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T02_HIDDEN",
|
||||
"file": "hidden/t02_hidden.clas.abap",
|
||||
"description": "T02 hidden tests: constants, types and method signatures of {{P}}IF_BOUQUET_PRICING"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_BOUQUET_PRICING",
|
||||
"file": "reference/bouquet_pricing.intf.abap",
|
||||
"description": "Bouquet pricing contract of the florist order desk"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BOUQUET_IF_TEST",
|
||||
"file": "reference/bouquet_if_test.clas.abap",
|
||||
"description": "Own ABAP Unit tests for the interface contract"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user