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:
154
tasks_gen/eval/G0006/hidden/t02_hidden.clas.abap
Normal file
154
tasks_gen/eval/G0006/hidden/t02_hidden.clas.abap
Normal file
@@ -0,0 +1,154 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}freight_calculator.
|
||||
|
||||
METHODS setup.
|
||||
METHODS assert_calculation
|
||||
IMPORTING iv_weight_kg TYPE p LENGTH 8 DECIMALS 2
|
||||
iv_zone TYPE string
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
is_expected TYPE {{p}}freight_calculator=>ty_result.
|
||||
|
||||
METHODS standard_parcel FOR TESTING.
|
||||
METHODS express_parcel FOR TESTING.
|
||||
METHODS zone_normalization FOR TESTING.
|
||||
METHODS rounding_half_up FOR TESTING.
|
||||
METHODS zero_weight FOR TESTING.
|
||||
METHODS negative_weight FOR TESTING.
|
||||
METHODS unknown_zone FOR TESTING.
|
||||
METHODS weight_error_wins FOR TESTING.
|
||||
METHODS supported_zones FOR TESTING.
|
||||
METHODS unsupported_zones FOR TESTING.
|
||||
METHODS all_rates FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}freight_calculator( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_calculation.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = is_expected
|
||||
act = mo_cut->calculate( iv_weight_kg = iv_weight_kg
|
||||
iv_zone = iv_zone
|
||||
iv_express = iv_express )
|
||||
msg = |zone { iv_zone }| ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD standard_parcel.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '10.00'
|
||||
iv_zone = `DE`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok
|
||||
base = '45.00'
|
||||
surcharge = '0.00'
|
||||
total = '45.00' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_parcel.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '10.00'
|
||||
iv_zone = `DE`
|
||||
iv_express = abap_true
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok
|
||||
base = '45.00'
|
||||
surcharge = '11.25'
|
||||
total = '56.25' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zone_normalization.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '5.00'
|
||||
iv_zone = ` ch `
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok
|
||||
base = '39.00'
|
||||
total = '39.00' ) ).
|
||||
assert_calculation(
|
||||
iv_weight_kg = '5.00'
|
||||
iv_zone = `de`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok
|
||||
base = '22.50'
|
||||
total = '22.50' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounding_half_up.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '3.33'
|
||||
iv_zone = `DE`
|
||||
iv_express = abap_true
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok
|
||||
base = '14.99'
|
||||
surcharge = '3.75'
|
||||
total = '18.74' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_weight.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '0.00'
|
||||
iv_zone = `DE`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-weight ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_weight.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '-2.50'
|
||||
iv_zone = `DE`
|
||||
iv_express = abap_true
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-weight ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_zone.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '5.00'
|
||||
iv_zone = `XX`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-zone ) ).
|
||||
assert_calculation(
|
||||
iv_weight_kg = '5.00'
|
||||
iv_zone = `DEU`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-zone ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weight_error_wins.
|
||||
assert_calculation(
|
||||
iv_weight_kg = '0.00'
|
||||
iv_zone = `XX`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-weight ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD supported_zones.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = mo_cut->is_zone_supported( `de` ) msg = `de` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = mo_cut->is_zone_supported( ` DE ` ) msg = ` DE ` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = mo_cut->is_zone_supported( `at` ) msg = `at` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = mo_cut->is_zone_supported( `es` ) msg = `es` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unsupported_zones.
|
||||
DATA lv_empty TYPE string.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = mo_cut->is_zone_supported( `XX` ) msg = `XX` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = mo_cut->is_zone_supported( lv_empty ) msg = `empty` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = mo_cut->is_zone_supported( ` ` ) msg = `blanks` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = mo_cut->is_zone_supported( `DEU` ) msg = `DEU` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = mo_cut->is_zone_supported( `DE1` ) msg = `DE1` ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD all_rates.
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `DE`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '4.50' total = '4.50' ) ).
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `AT`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '5.20' total = '5.20' ) ).
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `CH`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '7.80' total = '7.80' ) ).
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `FR`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '6.40' total = '6.40' ) ).
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `NL`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '4.90' total = '4.90' ) ).
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `PL`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '5.10' total = '5.10' ) ).
|
||||
assert_calculation( iv_weight_kg = '1.00' iv_zone = `ES`
|
||||
is_expected = VALUE #( status = {{p}}freight_calculator=>c_status-ok base = '6.90' total = '6.90' ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user