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:
114
tasks_gen/eval/G0008/reference/freight_calc.testclasses.abap
Normal file
114
tasks_gen/eval/G0008/reference/freight_calc.testclasses.abap
Normal file
@@ -0,0 +1,114 @@
|
||||
CLASS ltc_freight_calc DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_freight_calc.
|
||||
|
||||
METHODS setup.
|
||||
METHODS assert_amount
|
||||
IMPORTING iv_expected TYPE {{p}}if_freight_calc=>ty_amount
|
||||
iv_actual TYPE {{p}}if_freight_calc=>ty_amount.
|
||||
METHODS assert_weight
|
||||
IMPORTING iv_expected TYPE {{p}}if_freight_calc=>ty_weight
|
||||
iv_actual TYPE {{p}}if_freight_calc=>ty_weight.
|
||||
|
||||
METHODS base_and_distance FOR TESTING.
|
||||
METHODS fuel_is_rounded FOR TESTING.
|
||||
METHODS volume_sets_chargeable_weight FOR TESTING.
|
||||
METHODS weight_zero_is_rejected FOR TESTING.
|
||||
METHODS distance_zero_is_rejected FOR TESTING.
|
||||
METHODS fuel_index_out_of_range FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_freight_calc IMPLEMENTATION.
|
||||
|
||||
METHOD setup.
|
||||
DATA lo_calc TYPE REF TO {{p}}freight_calc.
|
||||
CREATE OBJECT lo_calc.
|
||||
mo_cut = lo_calc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_amount.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_weight.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_and_distance.
|
||||
DATA ls_result TYPE {{p}}if_freight_calc=>ty_result.
|
||||
|
||||
ls_result = mo_cut->calculate( iv_weight_kg = 2000
|
||||
iv_volume_m3 = 1
|
||||
iv_distance_km = 500
|
||||
iv_fuel_index = 100 ).
|
||||
|
||||
assert_amount( iv_expected = 110 iv_actual = ls_result-base ).
|
||||
assert_amount( iv_expected = 36 iv_actual = ls_result-distance ).
|
||||
assert_amount( iv_expected = 146 iv_actual = ls_result-fuel ).
|
||||
assert_amount( iv_expected = 292 iv_actual = ls_result-total ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fuel_is_rounded.
|
||||
DATA ls_result TYPE {{p}}if_freight_calc=>ty_result.
|
||||
|
||||
ls_result = mo_cut->calculate( iv_weight_kg = 1000
|
||||
iv_volume_m3 = 0
|
||||
iv_distance_km = 100
|
||||
iv_fuel_index = '12.3' ).
|
||||
|
||||
assert_amount( iv_expected = '5.54' iv_actual = ls_result-fuel ).
|
||||
assert_amount( iv_expected = '50.54' iv_actual = ls_result-total ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD volume_sets_chargeable_weight.
|
||||
DATA ls_result TYPE {{p}}if_freight_calc=>ty_result.
|
||||
|
||||
ls_result = mo_cut->calculate( iv_weight_kg = 500
|
||||
iv_volume_m3 = '4.5'
|
||||
iv_distance_km = 100
|
||||
iv_fuel_index = 0 ).
|
||||
|
||||
assert_weight( iv_expected = 1125 iv_actual = ls_result-chargeable_weight ).
|
||||
assert_amount( iv_expected = 58 iv_actual = ls_result-base ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weight_zero_is_rejected.
|
||||
DATA ls_result TYPE {{p}}if_freight_calc=>ty_result.
|
||||
|
||||
ls_result = mo_cut->calculate( iv_weight_kg = 0
|
||||
iv_volume_m3 = 2
|
||||
iv_distance_km = 300
|
||||
iv_fuel_index = 10 ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_freight_calc=>c_reason-weight
|
||||
act = ls_result-reason ).
|
||||
assert_amount( iv_expected = 0 iv_actual = ls_result-total ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distance_zero_is_rejected.
|
||||
DATA ls_result TYPE {{p}}if_freight_calc=>ty_result.
|
||||
|
||||
ls_result = mo_cut->calculate( iv_weight_kg = 1500
|
||||
iv_volume_m3 = 0
|
||||
iv_distance_km = 0
|
||||
iv_fuel_index = 10 ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_freight_calc=>c_reason-distance
|
||||
act = ls_result-reason ).
|
||||
assert_amount( iv_expected = 0 iv_actual = ls_result-total ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fuel_index_out_of_range.
|
||||
DATA ls_result TYPE {{p}}if_freight_calc=>ty_result.
|
||||
|
||||
ls_result = mo_cut->calculate( iv_weight_kg = 1500
|
||||
iv_volume_m3 = 0
|
||||
iv_distance_km = 300
|
||||
iv_fuel_index = 120 ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_freight_calc=>c_reason-fuel
|
||||
act = ls_result-reason ).
|
||||
assert_amount( iv_expected = 0 iv_actual = ls_result-total ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user