Generator: pilot analysis and fixes; G0002-G0021 tasks; handover notes merged
- Static bundle checks (name length, seed type, reserved words, contract test classes, testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse - Runner: G2 for CDS views with parameters, contract_check detail in report - G0020 and G0013 fixed by review and revalidated (oracle 100, null 0) - Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
90
tasks_gen/eval/G0012/reference/t14_test.clas.abap
Normal file
90
tasks_gen/eval/G0012/reference/t14_test.clas.abap
Normal file
@@ -0,0 +1,90 @@
|
||||
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS result_for
|
||||
IMPORTING iv_quantity TYPE decfloat34
|
||||
iv_scrap TYPE decfloat34
|
||||
iv_rework TYPE decfloat34 DEFAULT 0
|
||||
EXPORTING ev_pct TYPE decfloat34
|
||||
ev_severity TYPE string
|
||||
ev_rework TYPE decfloat34.
|
||||
METHODS percent_and_severity FOR TESTING.
|
||||
METHODS severity_bands FOR TESTING.
|
||||
METHODS rework_quantity FOR TESTING.
|
||||
METHODS invalid_inputs FOR TESTING.
|
||||
METHODS scrap_too_high FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_test IMPLEMENTATION.
|
||||
METHOD result_for.
|
||||
ev_rework = iv_rework.
|
||||
CALL FUNCTION '{{P}}PRD_SCRAP'
|
||||
EXPORTING
|
||||
iv_quantity = iv_quantity
|
||||
iv_scrap = iv_scrap
|
||||
IMPORTING
|
||||
ev_scrap_pct = ev_pct
|
||||
ev_severity = ev_severity
|
||||
CHANGING
|
||||
cv_rework_qty = ev_rework
|
||||
EXCEPTIONS
|
||||
invalid_quantity = 1
|
||||
scrap_too_high = 2
|
||||
OTHERS = 3.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD percent_and_severity.
|
||||
result_for( EXPORTING iv_quantity = 800 iv_scrap = 7
|
||||
IMPORTING ev_pct = DATA(lv_pct) ev_severity = DATA(lv_sev) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.9' ) act = lv_pct ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_sev ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD severity_bands.
|
||||
result_for( EXPORTING iv_quantity = 100 iv_scrap = 0
|
||||
IMPORTING ev_severity = DATA(lv_ok) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `OK` act = lv_ok ).
|
||||
result_for( EXPORTING iv_quantity = 100 iv_scrap = 5
|
||||
IMPORTING ev_severity = DATA(lv_low) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `LOW` act = lv_low ).
|
||||
result_for( EXPORTING iv_quantity = 100 iv_scrap = 20
|
||||
IMPORTING ev_severity = DATA(lv_high) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `HIGH` act = lv_high ).
|
||||
result_for( EXPORTING iv_quantity = 100 iv_scrap = 21
|
||||
IMPORTING ev_severity = DATA(lv_crit) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `CRITICAL` act = lv_crit ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rework_quantity.
|
||||
result_for( EXPORTING iv_quantity = 100 iv_scrap = 4 iv_rework = 99
|
||||
IMPORTING ev_rework = DATA(lv_keep) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 99 ) act = lv_keep ).
|
||||
result_for( EXPORTING iv_quantity = 100 iv_scrap = 10
|
||||
IMPORTING ev_rework = DATA(lv_set) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = lv_set ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_inputs.
|
||||
DATA lv_pct TYPE decfloat34.
|
||||
DATA lv_rework TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}PRD_SCRAP'
|
||||
EXPORTING iv_quantity = 0 iv_scrap = 0
|
||||
IMPORTING ev_scrap_pct = lv_pct
|
||||
CHANGING cv_rework_qty = lv_rework
|
||||
EXCEPTIONS invalid_quantity = 1 OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD scrap_too_high.
|
||||
DATA lv_pct TYPE decfloat34.
|
||||
DATA lv_rework TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}PRD_SCRAP'
|
||||
EXPORTING iv_quantity = 100 iv_scrap = 101
|
||||
IMPORTING ev_scrap_pct = lv_pct
|
||||
CHANGING cv_rework_qty = lv_rework
|
||||
EXCEPTIONS scrap_too_high = 2 OTHERS = 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user