Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
64
tasks_gen/train/G1081/faulty/m0_studio_summary.clas.abap
Normal file
64
tasks_gen/train/G1081/faulty/m0_studio_summary.clas.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS {{p}}studio_summary DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_attendance,
|
||||
studio TYPE c LENGTH 4,
|
||||
class_id TYPE c LENGTH 8,
|
||||
class_type TYPE c LENGTH 10,
|
||||
member_id TYPE c LENGTH 8,
|
||||
fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_attendance,
|
||||
tt_attendance TYPE STANDARD TABLE OF ty_attendance WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
class_type TYPE c LENGTH 10,
|
||||
class_count TYPE i,
|
||||
member_count TYPE i,
|
||||
total_fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_summary,
|
||||
tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_summary IMPLEMENTATION.
|
||||
METHOD summarize.
|
||||
DATA lt_seen TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id member_id.
|
||||
DATA lt_class TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id class_type.
|
||||
DATA lt_member TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY class_type member_id.
|
||||
DATA lt_groups TYPE HASHED TABLE OF ty_summary WITH UNIQUE KEY class_type.
|
||||
|
||||
LOOP AT it_attendance ASSIGNING FIELD-SYMBOL(<ls_attendance>).
|
||||
IF <ls_attendance>-class_type IS INITIAL AND <ls_attendance>-fee <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_seen.
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN lt_groups[ class_type = <ls_attendance>-class_type ]
|
||||
TO FIELD-SYMBOL(<ls_group>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE ty_summary( class_type = <ls_attendance>-class_type )
|
||||
INTO TABLE lt_groups ASSIGNING <ls_group>.
|
||||
ENDIF.
|
||||
<ls_group>-total_fee = <ls_group>-total_fee + <ls_attendance>-fee.
|
||||
INSERT <ls_attendance> INTO TABLE lt_class.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-class_count = <ls_group>-class_count + 1.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_member.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-member_count = <ls_group>-member_count + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_groups.
|
||||
SORT rt_summary BY class_type.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
64
tasks_gen/train/G1081/faulty/m1_studio_summary.clas.abap
Normal file
64
tasks_gen/train/G1081/faulty/m1_studio_summary.clas.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS {{p}}studio_summary DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_attendance,
|
||||
studio TYPE c LENGTH 4,
|
||||
class_id TYPE c LENGTH 8,
|
||||
class_type TYPE c LENGTH 10,
|
||||
member_id TYPE c LENGTH 8,
|
||||
fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_attendance,
|
||||
tt_attendance TYPE STANDARD TABLE OF ty_attendance WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
class_type TYPE c LENGTH 10,
|
||||
class_count TYPE i,
|
||||
member_count TYPE i,
|
||||
total_fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_summary,
|
||||
tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_summary IMPLEMENTATION.
|
||||
METHOD summarize.
|
||||
DATA lt_seen TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id member_id.
|
||||
DATA lt_class TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id class_type.
|
||||
DATA lt_member TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY class_type member_id.
|
||||
DATA lt_groups TYPE HASHED TABLE OF ty_summary WITH UNIQUE KEY class_type.
|
||||
|
||||
LOOP AT it_attendance ASSIGNING FIELD-SYMBOL(<ls_attendance>).
|
||||
IF <ls_attendance>-class_type IS INITIAL OR <ls_attendance>-fee > 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_seen.
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN lt_groups[ class_type = <ls_attendance>-class_type ]
|
||||
TO FIELD-SYMBOL(<ls_group>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE ty_summary( class_type = <ls_attendance>-class_type )
|
||||
INTO TABLE lt_groups ASSIGNING <ls_group>.
|
||||
ENDIF.
|
||||
<ls_group>-total_fee = <ls_group>-total_fee + <ls_attendance>-fee.
|
||||
INSERT <ls_attendance> INTO TABLE lt_class.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-class_count = <ls_group>-class_count + 1.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_member.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-member_count = <ls_group>-member_count + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_groups.
|
||||
SORT rt_summary BY class_type.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
64
tasks_gen/train/G1081/faulty/m2_studio_summary.clas.abap
Normal file
64
tasks_gen/train/G1081/faulty/m2_studio_summary.clas.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS {{p}}studio_summary DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_attendance,
|
||||
studio TYPE c LENGTH 4,
|
||||
class_id TYPE c LENGTH 8,
|
||||
class_type TYPE c LENGTH 10,
|
||||
member_id TYPE c LENGTH 8,
|
||||
fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_attendance,
|
||||
tt_attendance TYPE STANDARD TABLE OF ty_attendance WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
class_type TYPE c LENGTH 10,
|
||||
class_count TYPE i,
|
||||
member_count TYPE i,
|
||||
total_fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_summary,
|
||||
tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_summary IMPLEMENTATION.
|
||||
METHOD summarize.
|
||||
DATA lt_seen TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id member_id.
|
||||
DATA lt_class TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id class_type.
|
||||
DATA lt_member TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY class_type member_id.
|
||||
DATA lt_groups TYPE HASHED TABLE OF ty_summary WITH UNIQUE KEY class_type.
|
||||
|
||||
LOOP AT it_attendance ASSIGNING FIELD-SYMBOL(<ls_attendance>).
|
||||
IF <ls_attendance>-class_type IS INITIAL OR <ls_attendance>-fee <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_seen.
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN lt_groups[ class_type = <ls_attendance>-class_type ]
|
||||
TO FIELD-SYMBOL(<ls_group>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE ty_summary( class_type = <ls_attendance>-class_type )
|
||||
INTO TABLE lt_groups ASSIGNING <ls_group>.
|
||||
ENDIF.
|
||||
<ls_group>-total_fee = <ls_group>-total_fee - <ls_attendance>-fee.
|
||||
INSERT <ls_attendance> INTO TABLE lt_class.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-class_count = <ls_group>-class_count + 1.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_member.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-member_count = <ls_group>-member_count + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_groups.
|
||||
SORT rt_summary BY class_type.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
64
tasks_gen/train/G1081/faulty/m3_studio_summary.clas.abap
Normal file
64
tasks_gen/train/G1081/faulty/m3_studio_summary.clas.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS {{p}}studio_summary DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_attendance,
|
||||
studio TYPE c LENGTH 4,
|
||||
class_id TYPE c LENGTH 8,
|
||||
class_type TYPE c LENGTH 10,
|
||||
member_id TYPE c LENGTH 8,
|
||||
fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_attendance,
|
||||
tt_attendance TYPE STANDARD TABLE OF ty_attendance WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
class_type TYPE c LENGTH 10,
|
||||
class_count TYPE i,
|
||||
member_count TYPE i,
|
||||
total_fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_summary,
|
||||
tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_summary IMPLEMENTATION.
|
||||
METHOD summarize.
|
||||
DATA lt_seen TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id member_id.
|
||||
DATA lt_class TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id class_type.
|
||||
DATA lt_member TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY class_type member_id.
|
||||
DATA lt_groups TYPE HASHED TABLE OF ty_summary WITH UNIQUE KEY class_type.
|
||||
|
||||
LOOP AT it_attendance ASSIGNING FIELD-SYMBOL(<ls_attendance>).
|
||||
IF <ls_attendance>-class_type IS INITIAL OR <ls_attendance>-fee <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_seen.
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN lt_groups[ class_type = <ls_attendance>-class_type ]
|
||||
TO FIELD-SYMBOL(<ls_group>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE ty_summary( class_type = <ls_attendance>-class_type )
|
||||
INTO TABLE lt_groups ASSIGNING <ls_group>.
|
||||
ENDIF.
|
||||
<ls_group>-total_fee = <ls_group>-total_fee + <ls_attendance>-fee.
|
||||
INSERT <ls_attendance> INTO TABLE lt_class.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-class_count = <ls_group>-class_count - 1.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_member.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-member_count = <ls_group>-member_count + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_groups.
|
||||
SORT rt_summary BY class_type.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
64
tasks_gen/train/G1081/faulty/m4_studio_summary.clas.abap
Normal file
64
tasks_gen/train/G1081/faulty/m4_studio_summary.clas.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS {{p}}studio_summary DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_attendance,
|
||||
studio TYPE c LENGTH 4,
|
||||
class_id TYPE c LENGTH 8,
|
||||
class_type TYPE c LENGTH 10,
|
||||
member_id TYPE c LENGTH 8,
|
||||
fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_attendance,
|
||||
tt_attendance TYPE STANDARD TABLE OF ty_attendance WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
class_type TYPE c LENGTH 10,
|
||||
class_count TYPE i,
|
||||
member_count TYPE i,
|
||||
total_fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_summary,
|
||||
tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_summary IMPLEMENTATION.
|
||||
METHOD summarize.
|
||||
DATA lt_seen TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id member_id.
|
||||
DATA lt_class TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id class_type.
|
||||
DATA lt_member TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY class_type member_id.
|
||||
DATA lt_groups TYPE HASHED TABLE OF ty_summary WITH UNIQUE KEY class_type.
|
||||
|
||||
LOOP AT it_attendance ASSIGNING FIELD-SYMBOL(<ls_attendance>).
|
||||
IF <ls_attendance>-class_type IS INITIAL OR <ls_attendance>-fee <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_seen.
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN lt_groups[ class_type = <ls_attendance>-class_type ]
|
||||
TO FIELD-SYMBOL(<ls_group>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE ty_summary( class_type = <ls_attendance>-class_type )
|
||||
INTO TABLE lt_groups ASSIGNING <ls_group>.
|
||||
ENDIF.
|
||||
<ls_group>-total_fee = <ls_group>-total_fee + <ls_attendance>-fee.
|
||||
INSERT <ls_attendance> INTO TABLE lt_class.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-class_count = <ls_group>-class_count + 1.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_member.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-member_count = <ls_group>-member_count - 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_groups.
|
||||
SORT rt_summary BY class_type.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
24
tasks_gen/train/G1081/generation.json
Normal file
24
tasks_gen/train/G1081/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1081",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "C",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 96.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
139
tasks_gen/train/G1081/hidden/t30_hidden.clas.abap
Normal file
139
tasks_gen/train/G1081/hidden/t30_hidden.clas.abap
Normal file
@@ -0,0 +1,139 @@
|
||||
CLASS {{p}}t30_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
DATA mo_cut TYPE REF TO {{p}}studio_summary.
|
||||
METHODS setup.
|
||||
METHODS empty_input FOR TESTING.
|
||||
METHODS single_entry FOR TESTING.
|
||||
METHODS two_studios_same_type FOR TESTING.
|
||||
METHODS ignores_zero_fee FOR TESTING.
|
||||
METHODS ignores_negative_fee FOR TESTING.
|
||||
METHODS ignores_empty_type FOR TESTING.
|
||||
METHODS removes_duplicates FOR TESTING.
|
||||
METHODS same_member_two_types FOR TESTING.
|
||||
METHODS same_class_two_studios FOR TESTING.
|
||||
METHODS sorted_by_class_type FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t30_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}studio_summary( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_input.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lt_result ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD single_entry.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '12.50' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'YOGA' act = lt_result[ 1 ]-class_type ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-member_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '12.50' )
|
||||
act = lt_result[ 1 ]-total_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD two_studios_same_type.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S002' class_id = 'C0000002' class_type = 'YOGA'
|
||||
member_id = 'M0000002' fee = '15.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_result[ 1 ]-member_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '25.00' )
|
||||
act = lt_result[ 1 ]-total_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_zero_fee.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '0.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lt_result ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_negative_fee.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '-5.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lt_result ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_empty_type.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = ''
|
||||
member_id = 'M0000001' fee = '10.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lt_result ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD removes_duplicates.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '99.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-member_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '10.00' )
|
||||
act = lt_result[ 1 ]-total_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD same_member_two_types.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S001' class_id = 'C0000002' class_type = 'PILATES'
|
||||
member_id = 'M0000001' fee = '12.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PILATES' act = lt_result[ 1 ]-class_type ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'YOGA' act = lt_result[ 2 ]-class_type ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-member_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 2 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 2 ]-member_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '12.00' )
|
||||
act = lt_result[ 1 ]-total_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '10.00' )
|
||||
act = lt_result[ 2 ]-total_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD same_class_two_studios.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S002' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000002' fee = '10.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_result[ 1 ]-member_count ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_class_type.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'ZUMBA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S001' class_id = 'C0000002' class_type = 'AEROBIC'
|
||||
member_id = 'M0000002' fee = '10.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'AEROBIC' act = lt_result[ 1 ]-class_type ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ZUMBA' act = lt_result[ 2 ]-class_type ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
74
tasks_gen/train/G1081/mutation.json
Normal file
74
tasks_gen/train/G1081/mutation.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"task": "G1081",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}STUDIO_SUMMARY",
|
||||
"mutant": "line 37: OR -> AND (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "7/10",
|
||||
"failed_tests": [
|
||||
"IGNORES_EMPTY_TYPE",
|
||||
"IGNORES_NEGATIVE_FEE",
|
||||
"IGNORES_ZERO_FEE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}STUDIO_SUMMARY",
|
||||
"mutant": "line 37: <= -> > (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "2/10",
|
||||
"failed_tests": [
|
||||
"IGNORES_NEGATIVE_FEE",
|
||||
"IGNORES_ZERO_FEE",
|
||||
"REMOVES_DUPLICATES",
|
||||
"SAME_CLASS_TWO_STUDIOS",
|
||||
"SAME_MEMBER_TWO_TYPES",
|
||||
"SINGLE_ENTRY",
|
||||
"SORTED_BY_CLASS_TYPE",
|
||||
"TWO_STUDIOS_SAME_TYPE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}STUDIO_SUMMARY",
|
||||
"mutant": "line 50: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "6/10",
|
||||
"failed_tests": [
|
||||
"REMOVES_DUPLICATES",
|
||||
"SAME_MEMBER_TWO_TYPES",
|
||||
"SINGLE_ENTRY",
|
||||
"TWO_STUDIOS_SAME_TYPE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}STUDIO_SUMMARY",
|
||||
"mutant": "line 53: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "5/10",
|
||||
"failed_tests": [
|
||||
"REMOVES_DUPLICATES",
|
||||
"SAME_CLASS_TWO_STUDIOS",
|
||||
"SAME_MEMBER_TWO_TYPES",
|
||||
"SINGLE_ENTRY",
|
||||
"TWO_STUDIOS_SAME_TYPE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}STUDIO_SUMMARY",
|
||||
"mutant": "line 57: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "5/10",
|
||||
"failed_tests": [
|
||||
"REMOVES_DUPLICATES",
|
||||
"SAME_CLASS_TWO_STUDIOS",
|
||||
"SAME_MEMBER_TWO_TYPES",
|
||||
"SINGLE_ENTRY",
|
||||
"TWO_STUDIOS_SAME_TYPE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
64
tasks_gen/train/G1081/reference/studio_summary.clas.abap
Normal file
64
tasks_gen/train/G1081/reference/studio_summary.clas.abap
Normal file
@@ -0,0 +1,64 @@
|
||||
CLASS {{p}}studio_summary DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_attendance,
|
||||
studio TYPE c LENGTH 4,
|
||||
class_id TYPE c LENGTH 8,
|
||||
class_type TYPE c LENGTH 10,
|
||||
member_id TYPE c LENGTH 8,
|
||||
fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_attendance,
|
||||
tt_attendance TYPE STANDARD TABLE OF ty_attendance WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
class_type TYPE c LENGTH 10,
|
||||
class_count TYPE i,
|
||||
member_count TYPE i,
|
||||
total_fee TYPE p LENGTH 8 DECIMALS 2,
|
||||
END OF ty_summary,
|
||||
tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_summary IMPLEMENTATION.
|
||||
METHOD summarize.
|
||||
DATA lt_seen TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id member_id.
|
||||
DATA lt_class TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY studio class_id class_type.
|
||||
DATA lt_member TYPE HASHED TABLE OF ty_attendance
|
||||
WITH UNIQUE KEY class_type member_id.
|
||||
DATA lt_groups TYPE HASHED TABLE OF ty_summary WITH UNIQUE KEY class_type.
|
||||
|
||||
LOOP AT it_attendance ASSIGNING FIELD-SYMBOL(<ls_attendance>).
|
||||
IF <ls_attendance>-class_type IS INITIAL OR <ls_attendance>-fee <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_seen.
|
||||
IF sy-subrc <> 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
ASSIGN lt_groups[ class_type = <ls_attendance>-class_type ]
|
||||
TO FIELD-SYMBOL(<ls_group>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE ty_summary( class_type = <ls_attendance>-class_type )
|
||||
INTO TABLE lt_groups ASSIGNING <ls_group>.
|
||||
ENDIF.
|
||||
<ls_group>-total_fee = <ls_group>-total_fee + <ls_attendance>-fee.
|
||||
INSERT <ls_attendance> INTO TABLE lt_class.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-class_count = <ls_group>-class_count + 1.
|
||||
ENDIF.
|
||||
INSERT <ls_attendance> INTO TABLE lt_member.
|
||||
IF sy-subrc = 0.
|
||||
<ls_group>-member_count = <ls_group>-member_count + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_groups.
|
||||
SORT rt_summary BY class_type.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,71 @@
|
||||
CLASS ltc_studio_summary DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
DATA mo_cut TYPE REF TO {{p}}studio_summary.
|
||||
METHODS setup.
|
||||
METHODS single_entry FOR TESTING.
|
||||
METHODS ignores_invalid_fee FOR TESTING.
|
||||
METHODS removes_duplicates FOR TESTING.
|
||||
METHODS groups_two_studios FOR TESTING.
|
||||
METHODS sorts_by_class_type FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_studio_summary IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}studio_summary( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD single_entry.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '12.50' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '12.50' )
|
||||
act = lt_result[ 1 ]-total_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_invalid_fee.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '0.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lt_result ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD removes_duplicates.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '99.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV ty_fee( '10.00' )
|
||||
act = lt_result[ 1 ]-total_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD groups_two_studios.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'YOGA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S002' class_id = 'C0000002' class_type = 'YOGA'
|
||||
member_id = 'M0000002' fee = '15.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_result[ 1 ]-class_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_result[ 1 ]-member_count ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_class_type.
|
||||
DATA lt_input TYPE {{p}}studio_summary=>tt_attendance.
|
||||
lt_input = VALUE #( ( studio = 'S001' class_id = 'C0000001' class_type = 'ZUMBA'
|
||||
member_id = 'M0000001' fee = '10.00' )
|
||||
( studio = 'S001' class_id = 'C0000002' class_type = 'AEROBIC'
|
||||
member_id = 'M0000002' fee = '10.00' ) ).
|
||||
DATA(lt_result) = mo_cut->summarize( lt_input ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'AEROBIC' act = lt_result[ 1 ]-class_type ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
55
tasks_gen/train/G1081/spec.md
Normal file
55
tasks_gen/train/G1081/spec.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# 1. Goal
|
||||
A fitness chain runs several studios. Each studio sends the attendance list of
|
||||
its classes for one day. The head office needs one summary row for each class
|
||||
type. The summary shows how many classes took place, how many members attended,
|
||||
and the total fee.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- All objects are in package $TMP.
|
||||
- The class {{P}}STUDIO_SUMMARY does not exist yet.
|
||||
- Each studio sends its own list. The caller appends the lists of all studios
|
||||
into one table and calls the class once.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}STUDIO_SUMMARY in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class defines these public types:
|
||||
- ty_attendance: studio (CHAR 4), class_id (CHAR 8), class_type (CHAR 10),
|
||||
member_id (CHAR 8), fee (PACKED, length 8, 2 decimals).
|
||||
- tt_attendance: a table of ty_attendance.
|
||||
- ty_summary: class_type (CHAR 10), class_count (INT4), member_count (INT4),
|
||||
total_fee (PACKED, length 8, 2 decimals).
|
||||
- tt_summary: a table of ty_summary.
|
||||
- The class has this public method:
|
||||
summarize
|
||||
IMPORTING it_attendance TYPE tt_attendance
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
1. Use only entries with a class_type that is not empty and a fee greater than
|
||||
zero. Ignore all other entries.
|
||||
2. If two of the remaining entries have the same studio, class_id and member_id,
|
||||
keep only the first of these entries in the input order and ignore the later
|
||||
entries.
|
||||
3. Group the remaining entries by class_type.
|
||||
4. class_count is the number of different combinations of studio and class_id
|
||||
in the group.
|
||||
5. member_count is the number of different member_id values in the group.
|
||||
6. total_fee is the sum of the fee of all entries in the group.
|
||||
7. Return one row for each class_type that has at least one entry. Sort the rows
|
||||
by class_type in ascending order.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: no database access, no ALV list, no report, no function module.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
42
tasks_gen/train/G1081/task.json
Normal file
42
tasks_gen/train/G1081/task.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"id": "G1081",
|
||||
"category": "C",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}STUDIO_SUMMARY"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T30_HIDDEN",
|
||||
"file": "hidden/t30_hidden.clas.abap",
|
||||
"description": "T30 hidden tests for the studio class summary"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}STUDIO_SUMMARY",
|
||||
"file": "reference/studio_summary.clas.abap",
|
||||
"description": "Studio class summary",
|
||||
"testclasses_file": "reference/studio_summary.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"no_nested_loops",
|
||||
"keyed_table_access"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user