Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
88
tasks_gen/eval/G0100/faulty/m0_supplier_score.clas.abap
Normal file
88
tasks_gen/eval/G0100/faulty/m0_supplier_score.clas.abap
Normal file
@@ -0,0 +1,88 @@
|
||||
CLASS {{p}}supplier_score DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_rating TYPE i.
|
||||
TYPES ty_score TYPE p LENGTH 5 DECIMALS 1.
|
||||
TYPES ty_grade TYPE c LENGTH 1.
|
||||
TYPES:
|
||||
BEGIN OF ty_result,
|
||||
score TYPE ty_score,
|
||||
grade TYPE ty_grade,
|
||||
END OF ty_result.
|
||||
|
||||
METHODS evaluate
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_weight_price TYPE i VALUE 40,
|
||||
c_weight_quality TYPE i VALUE 35,
|
||||
c_weight_delivery TYPE i VALUE 25,
|
||||
c_round_half TYPE i VALUE 5,
|
||||
c_ten TYPE i VALUE 10,
|
||||
c_tenth TYPE ty_score VALUE '0.1',
|
||||
c_threshold_a TYPE ty_score VALUE '4.5',
|
||||
c_threshold_b TYPE ty_score VALUE '3.5',
|
||||
c_threshold_c TYPE ty_score VALUE '2.5',
|
||||
c_threshold_d TYPE ty_score VALUE '1.5',
|
||||
c_score_blocked TYPE ty_score VALUE '0.0',
|
||||
c_grade_blocked TYPE ty_grade VALUE 'X'.
|
||||
|
||||
METHODS is_rating_valid
|
||||
IMPORTING iv_rating TYPE ty_rating
|
||||
RETURNING VALUE(rv_valid) TYPE abap_bool.
|
||||
METHODS weighted_score
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rv_score) TYPE ty_score.
|
||||
METHODS grade_of
|
||||
IMPORTING iv_score TYPE ty_score
|
||||
RETURNING VALUE(rv_grade) TYPE ty_grade.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}supplier_score IMPLEMENTATION.
|
||||
METHOD evaluate.
|
||||
IF is_rating_valid( iv_price ) = abap_false
|
||||
OR is_rating_valid( iv_quality ) <> abap_false
|
||||
OR is_rating_valid( iv_delivery ) = abap_false
|
||||
OR iv_quality = 1.
|
||||
rs_result-score = c_score_blocked.
|
||||
rs_result-grade = c_grade_blocked.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_result-score = weighted_score( iv_price = iv_price
|
||||
iv_quality = iv_quality
|
||||
iv_delivery = iv_delivery ).
|
||||
rs_result-grade = grade_of( rs_result-score ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_rating_valid.
|
||||
rv_valid = xsdbool( iv_rating >= 1 AND iv_rating <= 5 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weighted_score.
|
||||
DATA(lv_points) = iv_price * c_weight_price
|
||||
+ iv_quality * c_weight_quality
|
||||
+ iv_delivery * c_weight_delivery.
|
||||
DATA(lv_tenths) = ( lv_points + c_round_half ) DIV c_ten.
|
||||
rv_score = CONV ty_score( lv_tenths ) * c_tenth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD grade_of.
|
||||
IF iv_score >= c_threshold_a.
|
||||
rv_grade = 'A'.
|
||||
ELSEIF iv_score >= c_threshold_b.
|
||||
rv_grade = 'B'.
|
||||
ELSEIF iv_score >= c_threshold_c.
|
||||
rv_grade = 'C'.
|
||||
ELSEIF iv_score >= c_threshold_d.
|
||||
rv_grade = 'D'.
|
||||
ELSE.
|
||||
rv_grade = 'E'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
88
tasks_gen/eval/G0100/faulty/m1_supplier_score.clas.abap
Normal file
88
tasks_gen/eval/G0100/faulty/m1_supplier_score.clas.abap
Normal file
@@ -0,0 +1,88 @@
|
||||
CLASS {{p}}supplier_score DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_rating TYPE i.
|
||||
TYPES ty_score TYPE p LENGTH 5 DECIMALS 1.
|
||||
TYPES ty_grade TYPE c LENGTH 1.
|
||||
TYPES:
|
||||
BEGIN OF ty_result,
|
||||
score TYPE ty_score,
|
||||
grade TYPE ty_grade,
|
||||
END OF ty_result.
|
||||
|
||||
METHODS evaluate
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_weight_price TYPE i VALUE 40,
|
||||
c_weight_quality TYPE i VALUE 35,
|
||||
c_weight_delivery TYPE i VALUE 25,
|
||||
c_round_half TYPE i VALUE 5,
|
||||
c_ten TYPE i VALUE 10,
|
||||
c_tenth TYPE ty_score VALUE '0.1',
|
||||
c_threshold_a TYPE ty_score VALUE '4.5',
|
||||
c_threshold_b TYPE ty_score VALUE '3.5',
|
||||
c_threshold_c TYPE ty_score VALUE '2.5',
|
||||
c_threshold_d TYPE ty_score VALUE '1.5',
|
||||
c_score_blocked TYPE ty_score VALUE '0.0',
|
||||
c_grade_blocked TYPE ty_grade VALUE 'X'.
|
||||
|
||||
METHODS is_rating_valid
|
||||
IMPORTING iv_rating TYPE ty_rating
|
||||
RETURNING VALUE(rv_valid) TYPE abap_bool.
|
||||
METHODS weighted_score
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rv_score) TYPE ty_score.
|
||||
METHODS grade_of
|
||||
IMPORTING iv_score TYPE ty_score
|
||||
RETURNING VALUE(rv_grade) TYPE ty_grade.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}supplier_score IMPLEMENTATION.
|
||||
METHOD evaluate.
|
||||
IF is_rating_valid( iv_price ) = abap_false
|
||||
OR is_rating_valid( iv_quality ) = abap_false
|
||||
OR is_rating_valid( iv_delivery ) = abap_true
|
||||
OR iv_quality = 1.
|
||||
rs_result-score = c_score_blocked.
|
||||
rs_result-grade = c_grade_blocked.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_result-score = weighted_score( iv_price = iv_price
|
||||
iv_quality = iv_quality
|
||||
iv_delivery = iv_delivery ).
|
||||
rs_result-grade = grade_of( rs_result-score ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_rating_valid.
|
||||
rv_valid = xsdbool( iv_rating >= 1 AND iv_rating <= 5 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weighted_score.
|
||||
DATA(lv_points) = iv_price * c_weight_price
|
||||
+ iv_quality * c_weight_quality
|
||||
+ iv_delivery * c_weight_delivery.
|
||||
DATA(lv_tenths) = ( lv_points + c_round_half ) DIV c_ten.
|
||||
rv_score = CONV ty_score( lv_tenths ) * c_tenth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD grade_of.
|
||||
IF iv_score >= c_threshold_a.
|
||||
rv_grade = 'A'.
|
||||
ELSEIF iv_score >= c_threshold_b.
|
||||
rv_grade = 'B'.
|
||||
ELSEIF iv_score >= c_threshold_c.
|
||||
rv_grade = 'C'.
|
||||
ELSEIF iv_score >= c_threshold_d.
|
||||
rv_grade = 'D'.
|
||||
ELSE.
|
||||
rv_grade = 'E'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
88
tasks_gen/eval/G0100/faulty/m2_supplier_score.clas.abap
Normal file
88
tasks_gen/eval/G0100/faulty/m2_supplier_score.clas.abap
Normal file
@@ -0,0 +1,88 @@
|
||||
CLASS {{p}}supplier_score DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_rating TYPE i.
|
||||
TYPES ty_score TYPE p LENGTH 5 DECIMALS 1.
|
||||
TYPES ty_grade TYPE c LENGTH 1.
|
||||
TYPES:
|
||||
BEGIN OF ty_result,
|
||||
score TYPE ty_score,
|
||||
grade TYPE ty_grade,
|
||||
END OF ty_result.
|
||||
|
||||
METHODS evaluate
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_weight_price TYPE i VALUE 40,
|
||||
c_weight_quality TYPE i VALUE 35,
|
||||
c_weight_delivery TYPE i VALUE 25,
|
||||
c_round_half TYPE i VALUE 5,
|
||||
c_ten TYPE i VALUE 10,
|
||||
c_tenth TYPE ty_score VALUE '0.1',
|
||||
c_threshold_a TYPE ty_score VALUE '4.5',
|
||||
c_threshold_b TYPE ty_score VALUE '3.5',
|
||||
c_threshold_c TYPE ty_score VALUE '2.5',
|
||||
c_threshold_d TYPE ty_score VALUE '1.5',
|
||||
c_score_blocked TYPE ty_score VALUE '0.0',
|
||||
c_grade_blocked TYPE ty_grade VALUE 'X'.
|
||||
|
||||
METHODS is_rating_valid
|
||||
IMPORTING iv_rating TYPE ty_rating
|
||||
RETURNING VALUE(rv_valid) TYPE abap_bool.
|
||||
METHODS weighted_score
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rv_score) TYPE ty_score.
|
||||
METHODS grade_of
|
||||
IMPORTING iv_score TYPE ty_score
|
||||
RETURNING VALUE(rv_grade) TYPE ty_grade.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}supplier_score IMPLEMENTATION.
|
||||
METHOD evaluate.
|
||||
IF is_rating_valid( iv_price ) = abap_false
|
||||
OR is_rating_valid( iv_quality ) = abap_false
|
||||
OR is_rating_valid( iv_delivery ) = abap_false
|
||||
OR iv_quality = 1.
|
||||
rs_result-score = c_score_blocked.
|
||||
rs_result-grade = c_grade_blocked.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_result-score = weighted_score( iv_price = iv_price
|
||||
iv_quality = iv_quality
|
||||
iv_delivery = iv_delivery ).
|
||||
rs_result-grade = grade_of( rs_result-score ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_rating_valid.
|
||||
rv_valid = xsdbool( iv_rating >= 1 AND iv_rating <= 6 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weighted_score.
|
||||
DATA(lv_points) = iv_price * c_weight_price
|
||||
+ iv_quality * c_weight_quality
|
||||
+ iv_delivery * c_weight_delivery.
|
||||
DATA(lv_tenths) = ( lv_points + c_round_half ) DIV c_ten.
|
||||
rv_score = CONV ty_score( lv_tenths ) * c_tenth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD grade_of.
|
||||
IF iv_score >= c_threshold_a.
|
||||
rv_grade = 'A'.
|
||||
ELSEIF iv_score >= c_threshold_b.
|
||||
rv_grade = 'B'.
|
||||
ELSEIF iv_score >= c_threshold_c.
|
||||
rv_grade = 'C'.
|
||||
ELSEIF iv_score >= c_threshold_d.
|
||||
rv_grade = 'D'.
|
||||
ELSE.
|
||||
rv_grade = 'E'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
88
tasks_gen/eval/G0100/faulty/m3_supplier_score.clas.abap
Normal file
88
tasks_gen/eval/G0100/faulty/m3_supplier_score.clas.abap
Normal file
@@ -0,0 +1,88 @@
|
||||
CLASS {{p}}supplier_score DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_rating TYPE i.
|
||||
TYPES ty_score TYPE p LENGTH 5 DECIMALS 1.
|
||||
TYPES ty_grade TYPE c LENGTH 1.
|
||||
TYPES:
|
||||
BEGIN OF ty_result,
|
||||
score TYPE ty_score,
|
||||
grade TYPE ty_grade,
|
||||
END OF ty_result.
|
||||
|
||||
METHODS evaluate
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_weight_price TYPE i VALUE 40,
|
||||
c_weight_quality TYPE i VALUE 35,
|
||||
c_weight_delivery TYPE i VALUE 25,
|
||||
c_round_half TYPE i VALUE 5,
|
||||
c_ten TYPE i VALUE 10,
|
||||
c_tenth TYPE ty_score VALUE '0.1',
|
||||
c_threshold_a TYPE ty_score VALUE '4.5',
|
||||
c_threshold_b TYPE ty_score VALUE '3.5',
|
||||
c_threshold_c TYPE ty_score VALUE '2.5',
|
||||
c_threshold_d TYPE ty_score VALUE '1.5',
|
||||
c_score_blocked TYPE ty_score VALUE '0.0',
|
||||
c_grade_blocked TYPE ty_grade VALUE 'X'.
|
||||
|
||||
METHODS is_rating_valid
|
||||
IMPORTING iv_rating TYPE ty_rating
|
||||
RETURNING VALUE(rv_valid) TYPE abap_bool.
|
||||
METHODS weighted_score
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rv_score) TYPE ty_score.
|
||||
METHODS grade_of
|
||||
IMPORTING iv_score TYPE ty_score
|
||||
RETURNING VALUE(rv_grade) TYPE ty_grade.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}supplier_score IMPLEMENTATION.
|
||||
METHOD evaluate.
|
||||
IF is_rating_valid( iv_price ) = abap_false
|
||||
OR is_rating_valid( iv_quality ) = abap_false
|
||||
OR is_rating_valid( iv_delivery ) = abap_false
|
||||
OR iv_quality = 1.
|
||||
rs_result-score = c_score_blocked.
|
||||
rs_result-grade = c_grade_blocked.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_result-score = weighted_score( iv_price = iv_price
|
||||
iv_quality = iv_quality
|
||||
iv_delivery = iv_delivery ).
|
||||
rs_result-grade = grade_of( rs_result-score ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_rating_valid.
|
||||
rv_valid = xsdbool( iv_rating >= 1 AND iv_rating <= 5 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weighted_score.
|
||||
DATA(lv_points) = iv_price * c_weight_price
|
||||
- iv_quality * c_weight_quality
|
||||
+ iv_delivery * c_weight_delivery.
|
||||
DATA(lv_tenths) = ( lv_points + c_round_half ) DIV c_ten.
|
||||
rv_score = CONV ty_score( lv_tenths ) * c_tenth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD grade_of.
|
||||
IF iv_score >= c_threshold_a.
|
||||
rv_grade = 'A'.
|
||||
ELSEIF iv_score >= c_threshold_b.
|
||||
rv_grade = 'B'.
|
||||
ELSEIF iv_score >= c_threshold_c.
|
||||
rv_grade = 'C'.
|
||||
ELSEIF iv_score >= c_threshold_d.
|
||||
rv_grade = 'D'.
|
||||
ELSE.
|
||||
rv_grade = 'E'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
88
tasks_gen/eval/G0100/faulty/m4_supplier_score.clas.abap
Normal file
88
tasks_gen/eval/G0100/faulty/m4_supplier_score.clas.abap
Normal file
@@ -0,0 +1,88 @@
|
||||
CLASS {{p}}supplier_score DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_rating TYPE i.
|
||||
TYPES ty_score TYPE p LENGTH 5 DECIMALS 1.
|
||||
TYPES ty_grade TYPE c LENGTH 1.
|
||||
TYPES:
|
||||
BEGIN OF ty_result,
|
||||
score TYPE ty_score,
|
||||
grade TYPE ty_grade,
|
||||
END OF ty_result.
|
||||
|
||||
METHODS evaluate
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_weight_price TYPE i VALUE 40,
|
||||
c_weight_quality TYPE i VALUE 35,
|
||||
c_weight_delivery TYPE i VALUE 25,
|
||||
c_round_half TYPE i VALUE 5,
|
||||
c_ten TYPE i VALUE 10,
|
||||
c_tenth TYPE ty_score VALUE '0.1',
|
||||
c_threshold_a TYPE ty_score VALUE '4.5',
|
||||
c_threshold_b TYPE ty_score VALUE '3.5',
|
||||
c_threshold_c TYPE ty_score VALUE '2.5',
|
||||
c_threshold_d TYPE ty_score VALUE '1.5',
|
||||
c_score_blocked TYPE ty_score VALUE '0.0',
|
||||
c_grade_blocked TYPE ty_grade VALUE 'X'.
|
||||
|
||||
METHODS is_rating_valid
|
||||
IMPORTING iv_rating TYPE ty_rating
|
||||
RETURNING VALUE(rv_valid) TYPE abap_bool.
|
||||
METHODS weighted_score
|
||||
IMPORTING iv_price TYPE ty_rating
|
||||
iv_quality TYPE ty_rating
|
||||
iv_delivery TYPE ty_rating
|
||||
RETURNING VALUE(rv_score) TYPE ty_score.
|
||||
METHODS grade_of
|
||||
IMPORTING iv_score TYPE ty_score
|
||||
RETURNING VALUE(rv_grade) TYPE ty_grade.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}supplier_score IMPLEMENTATION.
|
||||
METHOD evaluate.
|
||||
IF is_rating_valid( iv_price ) = abap_false
|
||||
OR is_rating_valid( iv_quality ) = abap_false
|
||||
OR is_rating_valid( iv_delivery ) = abap_false
|
||||
OR iv_quality = 1.
|
||||
rs_result-score = c_score_blocked.
|
||||
rs_result-grade = c_grade_blocked.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rs_result-score = weighted_score( iv_price = iv_price
|
||||
iv_quality = iv_quality
|
||||
iv_delivery = iv_delivery ).
|
||||
rs_result-grade = grade_of( rs_result-score ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_rating_valid.
|
||||
rv_valid = xsdbool( iv_rating >= 1 AND iv_rating <= 5 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weighted_score.
|
||||
DATA(lv_points) = iv_price * c_weight_price
|
||||
+ iv_quality * c_weight_quality
|
||||
+ iv_delivery * c_weight_delivery.
|
||||
DATA(lv_tenths) = ( lv_points + c_round_half ) DIV c_ten.
|
||||
rv_score = CONV ty_score( lv_tenths ) * c_tenth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD grade_of.
|
||||
IF iv_score < c_threshold_a.
|
||||
rv_grade = 'A'.
|
||||
ELSEIF iv_score >= c_threshold_b.
|
||||
rv_grade = 'B'.
|
||||
ELSEIF iv_score >= c_threshold_c.
|
||||
rv_grade = 'C'.
|
||||
ELSEIF iv_score >= c_threshold_d.
|
||||
rv_grade = 'D'.
|
||||
ELSE.
|
||||
rv_grade = 'E'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user